/* Fleet Console (customer portal). Light theme only; tokens from SPEC-V10 section 20.9. No web font is loaded. */

:root {
  --bg: #FFFFFF;
  --border: #E5E7EB;
  --text: #111827;
  --muted: #6B7280;
  --accent-top: #5B21B6;
  --link: #2563EB;
  --danger: #DC2626;
  --ok: #059669;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(17,24,39,.06);
  --sidebar: 260px;
  --soft: #F9FAFB;
  --warn: #92400E;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }
body {
  margin: 0;
  border-top: 3px solid var(--accent-top);
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
}

h1 { font-size: 24px; line-height: 1.25; margin: 0; font-weight: 600; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 13px; margin: 20px 0 8px; font-weight: 600; }
p { margin: 8px 0; }
a { color: var(--link); }
ul { margin: 0; padding: 0; list-style: none; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.unset { color: var(--warn); font-weight: 500; }
.warn { color: var(--warn); }

:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
main:focus { outline: none; }

/* ---------------------------------------------------------------- buttons, fields */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text);
  font: inherit; font-weight: 500; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--soft); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--text); border-color: var(--text); color: #FFFFFF; }
.btn-primary:hover { background: #1F2937; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #FFFFFF; }
.btn-danger:hover { background: #B91C1C; }
.btn-danger-quiet { color: var(--danger); }
.btn-wide { width: 100%; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 500; }
.field.grow { flex: 1; }
.field input, .field select {
  min-height: 36px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text); font: inherit; font-weight: 400;
}
.field input[readonly] { background: var(--soft); }
.hint { color: var(--muted); font-weight: 400; }
.check { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: start; font-weight: 500; }
.check input { width: 16px; height: 16px; margin: 3px 0 0; }
.check .hint { grid-column: 2; }
.msg { color: var(--danger); min-height: 0; margin: 0; }
.msg:empty { display: none; }

/* ---------------------------------------------------------------- sign-in screens */

.center { min-height: calc(100vh - 3px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.signin-card { width: 380px; max-width: 100%; display: flex; flex-direction: column; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 28px; height: 28px; border-radius: var(--radius); background: var(--text); color: #FFFFFF;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
}
.brand-name { font-weight: 600; font-size: 15px; }

/* ---------------------------------------------------------------- app frame */

.skip { position: absolute; left: -9999px; top: 8px; background: var(--bg); padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius); z-index: 20; }
.skip:focus { left: 8px; }

.sidebar {
  position: fixed; top: 3px; bottom: 0; left: 0; width: var(--sidebar);
  border-right: 1px solid var(--border); background: var(--bg);
  display: flex; flex-direction: column; padding: 20px 12px 16px; overflow-y: auto;
}
.sidebar .brand { padding: 0 8px; }
.org-name { padding: 12px 8px 4px; font-weight: 600; overflow-wrap: anywhere; }
#nav { flex: 1; padding-top: 8px; }
.navlink {
  display: block; padding: 7px 8px; border-radius: var(--radius);
  color: var(--text); text-decoration: none;
}
.navlink.sub { padding-left: 20px; }
.navlink:hover { background: var(--soft); }
.navlink.active { background: #F3F4F6; font-weight: 600; }
.navgroup { padding: 16px 8px 4px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.userbox { border-top: 1px solid var(--border); padding: 12px 8px 0; display: flex; flex-direction: column; gap: 2px; }
.userbox .btn { margin-top: 10px; }
.user-name { font-weight: 600; overflow-wrap: anywhere; }

.view { margin-left: var(--sidebar); min-width: 960px; max-width: 1240px; padding: 32px 40px 64px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; }
.part { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ---------------------------------------------------------------- cards, figures */

.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 600; line-height: 1.2; }
.grid-5 .kpi-value { font-size: 20px; }
.kpi-of { font-size: 14px; font-weight: 400; }
.kpi-sub { font-size: 13px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.kv:last-of-type { border-bottom: 0; }
.kv b { font-weight: 500; text-align: right; }

.bar { height: 8px; border-radius: 4px; background: #F3F4F6; overflow: hidden; margin: 4px 0; }
.bar-fill { height: 100%; background: var(--text); border-radius: 4px; }
.bar-fill.is-high { background: #D97706; }
.bar-fill.is-full { background: var(--danger); }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid var(--border); color: var(--muted); }
.pill-ok { color: var(--ok); border-color: #A7F3D0; background: #ECFDF5; }
.pill-danger { color: var(--danger); border-color: #FECACA; background: #FEF2F2; }

.notice { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; background: var(--soft); }
.notice-danger { border-color: #FECACA; background: #FEF2F2; color: #991B1B; }
.notice-danger a { color: inherit; font-weight: 600; }
.notice-warn { border-color: #FDE68A; background: #FFFBEB; color: var(--warn); }

.empty, .loading { color: var(--muted); padding: 20px 0; text-align: center; }
.unavailable { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.unavailable-title { font-weight: 600; }

/* ---------------------------------------------------------------- tables, filters */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
th.right, td.right { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: 600; border-top: 1px solid var(--border); border-bottom: 0; }
.row-actions { display: inline-flex; gap: 8px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters .field { min-width: 160px; }
.more { display: flex; justify-content: center; align-items: center; gap: 12px; padding-top: 16px; }
.more:empty { display: none; }

/* ---------------------------------------------------------------- charts */

.chart { margin: 0; }
.chart-max { font-size: 12px; margin-bottom: 6px; }
.chart-plot { display: flex; align-items: stretch; gap: 3px; height: 160px; border-bottom: 1px solid var(--border); }
.chart-col { flex: 1; min-width: 0; display: flex; }
.chart-track { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; }
.chart-stack { display: flex; flex-direction: column-reverse; min-height: 2px; border-radius: 3px 3px 0 0; overflow: hidden; }
.chart-col:hover .chart-stack { opacity: .8; }
.chart-seg { flex: 1 1 0; min-height: 1px; }
.chart-axis { display: flex; gap: 3px; margin-top: 4px; }
.chart-tick { flex: 1; min-width: 0; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: visible; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; }
.seg-0 { background: #111827; }
.seg-1 { background: #5B21B6; }
.seg-2 { background: #2563EB; }
.seg-3 { background: #059669; }
.seg-4 { background: #D97706; }
.seg-5 { background: #DC2626; }
.seg-6 { background: #6B7280; }
.seg-7 { background: #0891B2; }

/* ---------------------------------------------------------------- lists */

.models li { display: flex; justify-content: space-between; gap: 24px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.models li:last-child { border-bottom: 0; }
.prices { display: flex; flex-direction: column; align-items: flex-end; text-align: right; white-space: nowrap; }
.statements { margin: 0; }
.statement { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 24px; }
.statement:last-child { border-bottom: 0; }
.statement dt { flex: 1; }
.statement dd { margin: 0; font-weight: 500; text-align: right; max-width: 40%; }
.plain li { padding: 6px 0; }
.copy-row { display: flex; align-items: flex-end; gap: 8px; margin-top: 12px; }

/* ---------------------------------------------------------------- dialog, toasts */

dialog { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(17,24,39,.18); padding: 24px; width: 480px; max-width: calc(100vw - 32px); color: var(--text); }
dialog::backdrop { background: rgba(17,24,39,.4); }
dialog h2 { font-size: 17px; }
.dlg-body { display: flex; flex-direction: column; gap: 14px; margin: 12px 0; }
.dlg-body:empty { display: none; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 30; max-width: 420px; }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg); box-shadow: 0 4px 14px rgba(17,24,39,.12); }
.toast-ok { border-left: 4px solid var(--ok); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-x { border: 0; background: none; font: inherit; font-size: 18px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 2px; }
