/* Onde Driver Platform - portal styles. Hand written: this project has no node build step. */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .35rem; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
code { background: var(--surface-alt); border: 1px solid var(--border); border-radius: 5px; padding: .1rem .35rem; font-size: .85em; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px;
  flex: 0 0 236px;
  background: #0f172a;
  color: #cbd5e1;
  padding: 1.25rem 0;
  display: flex;
  flex-direction: column;
}
.sidebar .brand {
  display: block;
  padding: 0 1.25rem 1.1rem;
  color: #fff;
  font-weight: 650;
  font-size: 1rem;
  letter-spacing: -.01em;
}
.sidebar .brand small { display: block; color: #64748b; font-weight: 400; font-size: .75rem; letter-spacing: 0; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: 0 .75rem; }
.sidebar nav a {
  color: #cbd5e1;
  padding: .55rem .75rem;
  border-radius: 8px;
  font-weight: 500;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar .spacer { flex: 1; }
.sidebar .who { padding: 1rem 1.25rem 0; border-top: 1px solid rgba(255,255,255,.08); margin-top: 1rem; font-size: .8rem; }
.sidebar .who strong { color: #fff; display: block; }
.sidebar .who span { color: #64748b; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.content { padding: 1.5rem; max-width: 1400px; width: 100%; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.card-header {
  padding: .9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.card-body { padding: 1.1rem; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1000px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; }
}

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.stat .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat .value { font-size: 1.75rem; font-weight: 650; letter-spacing: -.02em; margin-top: .2rem; }
.stat .hint { color: var(--muted); font-size: .8rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th, td { padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { background: var(--surface-alt); font-weight: 600; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
tbody tr:hover { background: var(--surface-alt); }
tbody tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .84rem; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }

/* ---------- badges ---------- */
.badge {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-green { background: var(--success-soft); color: var(--success); border-color: #a7f3d0; }
.badge-amber { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.badge-red { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.badge-blue { background: var(--primary-soft); color: var(--primary-dark); border-color: #bfdbfe; }
.badge-gray { background: var(--surface-alt); color: var(--muted); border-color: var(--border); }

/* ---------- forms & buttons ---------- */
label { display: block; font-weight: 600; font-size: .82rem; margin-bottom: .3rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], select, textarea {
  width: 100%;
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  color: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.field { margin-bottom: .9rem; }
.field .error { color: var(--danger); font-size: .8rem; margin-top: .25rem; }
.help { color: var(--muted); font-size: .8rem; margin-top: .25rem; }
.checkbox { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
.checkbox input { width: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--surface-alt); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin: 0; min-width: 160px; }

/* ---------- alerts ---------- */
.alert { padding: .75rem 1rem; border-radius: 8px; border: 1px solid; margin-bottom: 1rem; font-size: .875rem; }
.alert-success { background: var(--success-soft); border-color: #a7f3d0; color: #065f46; }
.alert-error { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.alert-info { background: var(--primary-soft); border-color: #bfdbfe; color: #1e40af; }
.alert ul { margin: .35rem 0 0; padding-left: 1.1rem; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tabs a {
  padding: .55rem .9rem;
  color: var(--muted);
  font-weight: 600;
  font-size: .875rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------- pagination ---------- */
.pagination { display: flex; gap: .25rem; padding: .9rem 1.1rem; flex-wrap: wrap; align-items: center; }
.pagination a, .pagination span {
  padding: .35rem .65rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: .82rem;
  background: #fff;
  color: var(--text);
}
.pagination .current { background: var(--primary); border-color: var(--primary); color: #fff; }
.pagination .disabled { color: #cbd5e1; }
.pagination .meta { border: 0; background: none; color: var(--muted); margin-left: auto; }

/* ---------- auth screens ---------- */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { text-align: center; margin-bottom: 1.25rem; }
.auth-card .brand strong { font-size: 1.15rem; display: block; }
.auth-card .brand span { color: var(--muted); font-size: .85rem; }

.dl { display: grid; grid-template-columns: 180px 1fr; gap: .5rem 1rem; font-size: .875rem; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; }
@media (max-width: 640px) { .dl { grid-template-columns: 1fr; gap: .1rem .5rem; } .dl dd { margin-bottom: .55rem; } }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: .75rem; } .mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: .75rem; }

/* ---------- modal (sync details) ---------- */
.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.modal-dialog {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px -12px rgba(15, 23, 42, .45);
  width: 100%;
  max-width: 900px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}
.modal-body { padding: 1.25rem; overflow-y: auto; }
.modal-footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
}
.modal-close {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 .25rem;
}
.modal-close:hover { color: var(--text); }

/* Headline counters at the top of the sync report. */
.sync-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
@media (max-width: 760px) { .sync-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sync-stat { border: 1px solid var(--border); border-radius: 8px; padding: .7rem .8rem; background: var(--surface-alt); }
.sync-stat .label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.sync-stat .value { font-size: 1.5rem; font-weight: 650; letter-spacing: -.02em; }
.sync-stat.is-total { background: var(--primary-soft); border-color: #bfdbfe; }
.sync-stat.is-total .value { color: var(--primary-dark); }
.sync-stat.is-good .value { color: var(--success); }
.sync-stat.is-warn .value { color: var(--warning); }
.sync-stat.is-bad .value { color: var(--danger); }
.sync-stat.is-zero .value { color: var(--muted); }
