/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f8f9fa;
  color: #202124;
  line-height: 1.5;
}

/* Login */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f1f3f4;
}
.login-card {
  background: #fff;
  border-radius: 12px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
  max-width: 400px;
  width: 100%;
}
.login-card h1 {
  font-size: 24px;
  font-weight: 600;
  color: #202124;
  margin-bottom: 4px;
}
.login-subtitle {
  color: #5f6368;
  margin-bottom: 32px;
  font-size: 15px;
}
.btn-login {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #dadce0;
  border-radius: 6px;
  background: #fff;
  color: #3c4043;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-login:hover { background: #f8f9fa; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.login-error {
  margin-top: 20px;
  padding: 12px 16px;
  background: #fce8e6;
  color: #c5221f;
  border-radius: 6px;
  font-size: 13px;
}

/* Header */
.header {
  background: #fff;
  border-bottom: 1px solid #dadce0;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-title { font-size: 18px; font-weight: 600; color: #1a73e8; }
.header-sep { color: #dadce0; }
.header-org { color: #5f6368; font-size: 14px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.user-email { color: #5f6368; font-size: 13px; }

/* Main */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Cards */
.card {
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid #e8eaed;
}
.card-header h2 { font-size: 14px; font-weight: 600; color: #202124; }
.card-actions { display: flex; gap: 8px; }
.card-body { padding: 16px 20px; }
.card-body-flush { padding: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-small { padding: 4px 12px; font-size: 12px; }
.btn-outline {
  background: #fff;
  border: 1px solid #dadce0;
  color: #3c4043;
}
.btn-outline:hover:not(:disabled) { background: #f1f3f4; }
.btn-primary {
  background: #1a73e8;
  color: #fff;
  padding: 10px 32px;
}
.btn-primary:hover:not(:disabled) { background: #1557b0; }
.btn-large { font-size: 15px; padding: 12px 40px; }

/* Period row */
.period-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; font-weight: 500; color: #5f6368; }
.field select, .field input {
  padding: 8px 12px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: #202124;
  background: #fff;
}
.field select:focus, .field input:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26,115,232,0.2);
}
.field-email { margin-top: 12px; max-width: 320px; }
.field-email input { width: 100%; }

/* Drive links */
.drive-links { display: flex; flex-wrap: wrap; gap: 8px; }
.drive-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  color: #1a73e8;
  text-decoration: none;
  border: 1px solid #d2e3fc;
  border-radius: 16px;
  background: #e8f0fe;
  transition: background 0.15s;
}
.drive-link:hover { background: #d2e3fc; }

/* Buildings grid */
.buildings-grid {
  display: flex;
  flex-direction: column;
}
.buildings-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2px;
}
.building-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s;
  user-select: none;
}
.building-item:hover { background: #f1f3f4; }
.building-item input { margin: 0; cursor: pointer; accent-color: #1a73e8; }
.building-item .bldg-number {
  font-weight: 600;
  font-size: 13px;
  color: #202124;
  min-width: 40px;
}
.building-item .bldg-address {
  font-size: 13px;
  color: #5f6368;
  flex: 1;
}
.badge-siro {
  font-size: 10px;
  font-weight: 600;
  background: #e6f4ea;
  color: #137333;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.3px;
}
.badge-bank {
  font-size: 10px;
  font-weight: 500;
  background: #e8eaed;
  color: #5f6368;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.3px;
}

/* Toggle row */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  user-select: none;
}
.toggle-row input { accent-color: #1a73e8; cursor: pointer; }

/* Process bar */
.process-bar {
  display: flex;
  align-items: center;
  gap: 16px;
}
.process-summary { font-size: 13px; color: #5f6368; }

/* Job status */
.card-status { border-color: #1a73e8; border-width: 2px; }
.progress-container { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.progress-bar {
  flex: 1;
  height: 8px;
  background: #e8eaed;
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: #1a73e8;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.progress-text { font-size: 13px; font-weight: 500; color: #5f6368; white-space: nowrap; }
.status-current {
  font-size: 13px;
  color: #202124;
  margin-bottom: 8px;
}
.status-completed { font-size: 12px; color: #5f6368; }

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}
.badge-running { background: #e8f0fe; color: #1a73e8; }
.badge-completed { background: #e6f4ea; color: #137333; }
.badge-failed { background: #fce8e6; color: #c5221f; }
.badge-queued { background: #fef7e0; color: #b06000; }

/* History table */
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.history-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 600;
  color: #5f6368;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: #f8f9fa;
  border-bottom: 1px solid #e8eaed;
}
.history-table td {
  padding: 10px 16px;
  border-bottom: 1px solid #e8eaed;
  color: #3c4043;
}
.history-table tr:last-child td { border-bottom: none; }
.history-table tr:hover td { background: #f8f9fa; }
.empty-state {
  padding: 32px 20px;
  text-align: center;
  color: #80868b;
  font-size: 14px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
[hidden] {
  display: none !important;
}
.modal {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e8eaed;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 13px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 12px;
}
.detail-label { font-weight: 600; color: #5f6368; }
.detail-value { color: #202124; }
.detail-results {
  margin-top: 16px;
}
.detail-results table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.detail-results th {
  text-align: left;
  padding: 6px 10px;
  background: #f8f9fa;
  font-weight: 600;
  color: #5f6368;
  border-bottom: 1px solid #e8eaed;
}
.detail-results td {
  padding: 6px 10px;
  border-bottom: 1px solid #e8eaed;
}

/* Instructivo */
.btn-instructivo {
  gap: 5px;
  margin-left: 12px;
  color: #1a73e8;
  border-color: #d2e3fc;
}
.btn-instructivo:hover { background: #e8f0fe; }
.instructivo-steps {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 14px;
  line-height: 1.6;
}
.instructivo-steps ul {
  padding-left: 20px;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.instructivo-steps code {
  background: #f1f3f4;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 13px;
  color: #c5221f;
}

/* Responsive */
@media (max-width: 600px) {
  .header { padding: 0 12px; }
  .header-sep, .header-org { display: none; }
  .main { padding: 16px 8px 48px; }
  .card-body { padding: 12px; }
  .buildings-list { grid-template-columns: 1fr; }
  .period-row { flex-direction: column; }
  .drive-links { flex-direction: column; }
  .process-bar { flex-direction: column; align-items: stretch; }
}
