:root {
  --paper: #faf8f3;
  --ivory: #eeeae2;
  --ink: #252b31;
  --muted: #667680;
  --line: #e1eaf0;
  --brand: #086491;
  --brand-dark: #074d72;
  --heading: #124d6a;
  --pale: #eaf6fb;
  --green: #087e83;
  --warn: #8a5a12;
  --danger: #8a2f24;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ivory);
  color: var(--ink);
  font-family: "DM Sans", Arial, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--brand-dark); }
img { max-width: 100%; height: auto; }
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  padding: 10px 4vw;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { width: 148px; height: auto; display: block; object-fit: contain; background: transparent; }
.bar-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.card {
  width: min(440px, calc(100% - 32px));
  margin: 32px auto 48px;
  padding: 28px 24px 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 16px 60px #28322b0c;
}
.eyebrow, .sidebar-kicker {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  color: var(--heading);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.card h1 { margin-bottom: 12px; font-size: 28px; font-weight: 800; }
.note, .micro, .notice { color: var(--muted); font-size: 14px; line-height: 1.45; }
.note { margin: 0 0 12px; }
.notice { min-height: 1.2em; margin: 0 0 8px; }
.notice.error, .field-error { color: var(--danger); }
.field-error { margin: 0 0 8px; font-size: 13px; }
.field { display: block; margin: 0; font-size: 12px; font-weight: 700; color: var(--heading); }
input, select, textarea {
  width: 100%;
  max-width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.primary {
  width: 100%;
  margin-top: 18px;
  padding: 12px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}
.primary:hover { background: var(--brand-dark); }
.primary:disabled { opacity: 0.45; cursor: not-allowed; }
.facts { margin: 0; }
.facts div { padding: 8px 0; border-top: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.facts dd { margin: 2px 0 0; font-size: 14px; white-space: pre-wrap; }
.micro { margin: 16px 0 0; }
.gate { width: min(720px, calc(100% - 32px)); margin: 24px auto; }
body[data-page="shell"] #status.gate {
  width: min(420px, calc(100% - 32px));
  margin: 18vh auto 0;
  padding: 18px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
}
body[data-page="shell"] #next.gate { width: min(420px, calc(100% - 32px)); margin: 12px auto 0; text-align: center; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 0 12px 16px;
  background:
    linear-gradient(180deg, rgba(8, 100, 145, 0.08), transparent 72px),
    var(--paper);
  border-right: 1px solid var(--line);
  overflow: auto;
}
.sidebar .brand {
  margin: 0 -12px 4px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background-image: repeating-linear-gradient(135deg, transparent 0 7px, rgba(8, 100, 145, 0.18) 7px 8px);
  background-size: 100% 6px;
  background-repeat: no-repeat;
  background-position: bottom;
}
.sidebar-kicker { margin: 14px 8px 8px; }
.side { display: flex; flex-direction: column; gap: 4px; }
.side button, .ghost, .text-action, .icon-button {
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--heading);
  font-weight: 700;
}
.side button { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: 14px; }
.side svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.side button[aria-current="true"] { background: #fff; color: var(--brand-dark); box-shadow: inset 3px 0 0 var(--brand); }
.app-main { min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}
.topbar h1 { flex: 1; min-width: 0; font-size: 20px; }
.scope-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.scope-filter select { width: 220px; margin: 0; padding: 7px 8px; }
.profile-wrap { position: relative; }
.icon-button, .text-action {
  padding: 7px 10px;
  background: var(--pale);
  color: var(--brand-dark);
  font-size: 13px;
}
.profile-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: min(320px, 80vw);
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 32px #28322b14;
}
.panel { padding: 16px; }
.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.metric, .activity, .status-strip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.metric { position: relative; border-top: 2px solid var(--brand); padding: 12px 12px 11px; }
.metric p { margin: 0; }
.metric-value { color: var(--heading); font-size: 28px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.metric-label { margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--ink); }
.split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(240px, 0.9fr); gap: 8px; }
.status-strip { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.status-strip span { font-size: 13px; }
.activity h2, .section-head h2 { margin: 0; font-size: 15px; color: var(--heading); }
.activity ul { list-style: none; margin: 8px 0 0; padding: 0; }
.activity li { padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.activity time { display: block; color: var(--muted); font-size: 11px; }
.section-head, .toolbar, .row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.section-head { justify-content: space-between; margin-bottom: 8px; }
.toolbar { margin-bottom: 8px; }
.toolbar .field { min-width: 140px; flex: 1; }
.form-panel {
  margin: 0 0 12px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.route-map { height: 280px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.route-map img { max-width: none; }
.table-scroll { max-width: 100%; overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
#alerts .table-scroll table { min-width: 920px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { color: var(--muted); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--pale);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.ready, .badge.active, .badge.current { background: #e5f6f4; color: #0d5c58; }
.badge.charging { background: var(--pale); color: var(--brand-dark); }
.badge.maintenance { background: #fbf3e4; color: var(--warn); }
.badge.offline, .badge.inactive, .badge.ended { background: #f3f1ec; color: #4d565e; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 8px 0 12px; }
.check-list label { display: flex; gap: 6px; align-items: center; font-size: 13px; }
.link-box { display: flex; gap: 8px; align-items: center; }
.link-box input { flex: 1; min-width: 0; }
.empty {
  margin: 0;
  padding: 14px 12px;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
}
#nav-toggle { display: none; }
@media (max-width: 1100px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    z-index: 4;
    width: min(260px, 86vw);
    transform: translateX(-105%);
    transition: transform 160ms ease;
    box-shadow: 0 12px 32px #28322b22;
  }
  .sidebar.is-open { transform: none; }
  #nav-toggle { display: inline-block; }
  .topbar { flex-wrap: wrap; }
  .scope-filter { width: 100%; order: 5; }
  .scope-filter select { width: 100%; }
  .split { grid-template-columns: 1fr; }
}
.owner-limits .note { margin-bottom: 4px; }
.attention, .shortcut-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.attention h2, .owner-work h2, .owner-battery h2, .owner-complaints h2 { margin: 8px 0; font-size: 15px; color: var(--heading); }
.attention-link { min-height: 44px; }
.assignment-card {
  margin: 0 0 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.assignment-card p { margin: 4px 0 8px; }
.stack-form { display: grid; gap: 8px; }
.owner-editor {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 24px;
  overflow: visible;
}
.editor-section { display: grid; gap: 16px; overflow: visible; }
.owner-editor h2 { margin: 0; font-size: 15px; color: var(--heading); }
.owner-editor .note { margin: 0; }
.owner-editor .editor-fields { gap: 16px; }
.owner-editor .form-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.owner-editor .missing-city { display: grid; gap: 16px; }
.vehicle-editor { display: grid; gap: 16px; }
.vehicle-editor h2 { margin: 0; font-size: 15px; color: var(--heading); }
.vehicle-editor .vehicle-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.vehicle-editor .owner-field { grid-column: 1 / -1; }
.vehicle-editor .owner-field select,
.vehicle-editor .owner-field select:disabled {
  color: var(--ink);
  opacity: 1;
  font-size: 16px;
  font-weight: 400;
  -webkit-text-fill-color: var(--ink);
}
.vehicle-editor .selected-owner {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.35;
  white-space: normal;
}
.vehicle-editor .form-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
@media (max-width: 1024px) {
  .vehicle-editor .vehicle-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .vehicle-editor .vehicle-fields { grid-template-columns: minmax(0, 1fr); }
  .vehicle-editor .owner-field select,
  .vehicle-editor .owner-field select:disabled,
  .vehicle-editor .selected-owner { font-size: 14px; }
}
.city-combo { position: relative; }
.city-combo.is-open { z-index: 6; }
.city-combo input { width: 100%; min-height: 44px; }
.city-options {
  position: absolute;
  z-index: 6;
  left: 0;
  right: 0;
  max-height: min(240px, 40vh);
  margin: 4px 0 0;
  padding: 4px;
  overflow: auto;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px #28322b14;
}
.city-options li {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  cursor: pointer;
}
.city-options li.is-active, .city-options li:hover { background: var(--pale); }
.city-options .city-empty { color: var(--muted); cursor: default; }
@media (max-width: 720px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attention, .shortcut-row { display: grid; grid-template-columns: 1fr; }
  .stack-form { grid-template-columns: 1fr; }
  .panel { padding: 12px; }
  .card { width: min(440px, calc(100% - 16px)); }
  .bar { padding: 10px 12px; }
  .brand img { width: 128px; }
  .scope-filter { width: 100%; }
  .topbar h1 { font-size: 18px; }
}

/* ---------- ONIRICO brand refresh (2026-10) ---------- */
:root {
  --paper: #ffffff;
  --ivory: #f4f6f9;
  --ink: #0a0f1c;
  --muted: #5b6577;
  --line: #e3e8ef;
  --brand: #0257b0;
  --brand-dark: #013e80;
  --heading: #0a0f1c;
  --pale: #e8f0fb;
  --green: #138808;
  --saffron: #ff9933;
  --night: #0a0f1c;
  --night-2: #141b2b;
  --night-line: #26314a;
}
body { font-family: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.sidebar {
  background: var(--night);
  border-right: 0;
  color: #c9d3e3;
}
.sidebar::before {
  content: "";
  display: block;
  height: 4px;
  margin: 0 -12px;
  background: linear-gradient(90deg, var(--saffron) 0 33.3%, #fff 33.3% 66.6%, var(--green) 66.6%);
}
.sidebar .brand {
  margin: 12px 0 6px;
  padding: 10px 12px;
  border: 0;
  border-radius: 14px;
  background: #ffffff;
  background-image: none;
  justify-content: center;
}
.sidebar-kicker { color: #6ea8f0; }
.side button { color: #c9d3e3; border-radius: 10px; padding: 9px 10px; }
.side button:hover { background: var(--night-2); color: #ffffff; }
.side button[aria-current="true"] { background: var(--brand); color: #ffffff; box-shadow: none; }
.topbar { border-bottom: 1px solid var(--line); }
.topbar h1 { color: var(--ink); font-weight: 800; }
.primary { border-radius: 12px; background: var(--brand); }

/* ---------- Control room ---------- */
.control { display: grid; gap: 16px; }
.cr-hero {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 20px 22px; border-radius: 20px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #16274a 0%, #0a0f1c 60%);
}
.cr-kicker { margin: 0 0 4px; color: #6ea8f0; font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.cr-title { margin: 0; color: #fff; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.cr-meta { display: flex; align-items: center; gap: 10px; color: #a9b4c7; font-size: 13px; }
.cr-live { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(61, 220, 132, 0.15); color: #3ddc84; font-weight: 800; font-size: 12px; }
.cr-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; }
.cr-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cr-kpi { display: grid; gap: 4px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.cr-kpi.warn { border-color: #f6d4a8; background: #fff8ef; }
.cr-kpi.green { border-color: #d3ebd8; background: #eff8f1; }
.cr-kpi-label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.cr-kpi-value { color: var(--ink); font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cr-kpi-sub { color: var(--muted); font-size: 12px; }
.cr-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cr-card { padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 18px; min-width: 0; }
.cr-card h3 { margin: 0 0 10px; font-size: 15px; font-weight: 800; color: var(--ink); }
.cr-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.cr-card-head h3 { margin: 0; }
.cr-map { height: 460px; border-radius: 14px; overflow: hidden; background: #e9eef4; }
.cr-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.cr-legend { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12px; }
.cr-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.cr-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.cr-dot.free { background: var(--green); }
.cr-dot.busy { background: var(--brand); }
.cr-dot.pickup { background: var(--saffron); }
.cr-side { display: grid; gap: 16px; min-width: 0; }
.cr-list { display: grid; gap: 8px; }
.cr-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--ivory); }
.cr-row-main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.cr-row-main strong { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-row-main span { font-size: 12px; color: var(--muted); }
.cr-chip { flex: none; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; background: #eef1f5; color: var(--muted); text-transform: capitalize; }
.cr-chip.good { background: #e5f5e8; color: #0e6b06; }
.cr-chip.info { background: var(--pale); color: var(--brand-dark); }
.cr-chip.warn { background: #fff1de; color: #8a4b05; }
.cr-chip.bad { background: #fdecec; color: #b42318; }
.cr-meter { width: 70px; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; flex: none; }
.cr-meter i { display: block; height: 100%; background: linear-gradient(90deg, #d92d20, #ff9933); }
.cr-empty { margin: 0; color: var(--muted); font-size: 13px; padding: 8px 0; }
@media (max-width: 1100px) {
  .cr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cr-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .cr-kpi-value { font-size: 22px; }
  .cr-map { height: 320px; }
}
.badge.pending { background: #fff4e0; color: #8a5300; }
.muted { color: #6b7280; font-size: 0.9em; }
.saved-note { color: #0d5c58; font-weight: 600; margin: 8px 0 0; }
.rq-list { display: grid; gap: 12px; }
.rq-card { background: #fff; border: 1px solid #e3e7ee; border-radius: 14px; padding: 14px 16px; display: grid; gap: 8px; }
.rq-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rq-who { margin: 0; color: #4d565e; font-size: 0.92em; }
.rq-facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; }
.rq-facts dt { color: #6b7280; }
.rq-facts dd { margin: 0; font-weight: 600; }
.rq-note { margin: 0; color: #0d5c58; }
.rq-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.rq-sos { border-color: #f04438; box-shadow: 0 0 0 2px #fee4e2; }

.join-docs { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.join-doc { padding: 6px 10px; border-radius: 999px; background: #EEF2F7; color: #101828; text-decoration: none; font-size: 13px; }
.join-doc:hover { background: #E2E8F0; }

/* Marketing */
.mk-body { display: grid; gap: 16px; }
.mk-card { gap: 12px; }
.mk-title { margin: 0; font-size: 17px; }
.mk-row { display: grid; grid-template-columns: max-content 1fr max-content max-content max-content; align-items: center; gap: 4px 14px; padding: 10px 0; border-top: 1px solid #eef1f5; }
.mk-code { font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.04em; }
.mk-banners { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.mk-banner { display: grid; gap: 6px; border-radius: 16px; padding: 14px; color: #fff; }
.mk-banner .text-action { color: #fff; background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.55); justify-self: start; }
.mk-banner .text-action:hover { background: rgba(255,255,255,0.32); }
.mk-blue { background: #1D4ED8; } .mk-green { background: #0F7B4F; } .mk-saffron { background: #C2410C; } .mk-ink { background: #101828; }
.mk-off { opacity: 0.45; }
.mk-chip { justify-self: start; background: rgba(255,255,255,0.18); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; }
.mk-small { font-size: 12px; opacity: 0.85; }
@media (max-width: 760px) { .mk-row { grid-template-columns: 1fr; } }

/* Fleet import */
.import-panel { display: grid; gap: 12px; }
.import-steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.import-steps .text-action { margin-left: 4px; }
.import-preview { display: grid; gap: 10px; }
.import-preview .primary { justify-self: start; }
.import-preview .badge { white-space: normal; text-align: left; }
