:root {
  color-scheme: light;
  --paper: #f7f6f2;
  --surface: #fffefa;
  --ink: #152a40;
  --muted: #687789;
  --blue: #245fbd;
  --blue-dark: #17498f;
  --line: #dfe3e6;
  --soft-blue: #eaf1fb;
  --green: #2b6559;
  --amber: #a96f25;
  --red: #a13e3e;
  --shadow: 0 18px 52px rgba(21, 42, 64, .09);
  font-family: "Aptos", "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }
.boot { min-height: 100vh; display: grid; place-content: center; gap: 12px; text-align: center; font-size: 13px; letter-spacing: .18em; font-weight: 700; }
.boot span { color: var(--muted); letter-spacing: 0; font-size: 14px; font-weight: 400; }
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 1fr) minmax(430px, .95fr); background: var(--surface); }
.auth-story { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(32px, 5vw, 76px); color: #f7f6f2; background: var(--ink); isolation: isolate; }
.auth-story::before { content: ""; position: absolute; z-index: -1; inset: auto -12% -11% 0; height: 68%; background: url('/assets/vehicle-sketch.webp') center bottom / contain no-repeat; opacity: .25; filter: grayscale(1) contrast(1.2); }
.auth-story::after { content: ""; position: absolute; z-index: -1; inset: 48% 0 0; background: linear-gradient(180deg, transparent, rgba(21,42,64,.55)); }
.brand { display: inline-flex; align-items: center; gap: 13px; width: fit-content; text-decoration: none; }
.brand img { width: 52px; height: 52px; object-fit: contain; border-radius: 50%; background: #f7f6f2; }
.brand strong { display: block; font-size: 16px; letter-spacing: .17em; }
.brand small { display: block; margin-top: 5px; color: #b7c8db; font-size: 9px; letter-spacing: .2em; }
.story-copy { max-width: 650px; margin: auto 0; padding: 84px 0 110px; }
.eyebrow { color: #7ea5df; font-size: 10px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; }
.story-copy h1 { margin: 18px 0; max-width: 620px; color: #f6f3ec; font: 500 clamp(44px, 5.4vw, 82px)/.98 Georgia, "Times New Roman", serif; letter-spacing: -.055em; }
.story-copy h1 em { color: #9cb7dc; font-weight: 400; }
.story-copy p { max-width: 490px; color: #c1cbd5; font-size: 16px; line-height: 1.75; }
.story-foot { display: flex; align-items: center; gap: 14px; color: #b7c8db; font-size: 12px; }
.story-foot::before { content: ""; width: 34px; height: 1px; background: #7196ca; }
.auth-panel { display: grid; place-items: center; padding: 36px; }
.auth-card { width: min(100%, 440px); }
.auth-card .brand { margin-bottom: 42px; }
.auth-card .brand img { display: none; }
.auth-card h2 { margin: 10px 0 8px; font: 500 clamp(32px, 4vw, 46px)/1.08 Georgia, "Times New Roman", serif; letter-spacing: -.04em; }
.auth-card > p { margin: 0 0 30px; max-width: 410px; color: var(--muted); line-height: 1.65; }
.field { display: grid; gap: 8px; margin: 0 0 17px; }
.field label { color: #34485e; font-size: 12px; font-weight: 650; }
.field input, .field select, .field textarea, .search-input { width: 100%; min-width: 0; border: 1px solid #d5dce1; border-radius: 9px; outline: 0; padding: 13px 14px; color: var(--ink); background: #fff; transition: border-color .16s, box-shadow .16s; }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .search-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(36,95,189,.13); }
.field small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.primary, .secondary, .quiet, .danger { border: 0; border-radius: 8px; padding: 12px 16px; font-weight: 650; transition: background .16s, transform .16s; }
.primary { color: white; background: var(--blue); }
.primary:hover { background: var(--blue-dark); transform: translateY(-1px); }
.primary.full { display: flex; width: 100%; justify-content: space-between; align-items: center; margin-top: 10px; padding: 15px 17px; }
.secondary { border: 1px solid var(--line); color: var(--ink); background: white; }
.secondary:hover { background: var(--soft-blue); }
.quiet { color: var(--blue); background: transparent; padding: 8px 10px; }
.quiet:hover { background: var(--soft-blue); }
.danger { color: #fff; background: var(--red); }
.auth-security { display: flex; gap: 10px; align-items: center; margin-top: 28px; border-top: 1px solid var(--line); padding-top: 20px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.auth-security b { display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid #ccdbeb; border-radius: 50%; color: var(--blue); }
.auth-link { display: block; width: 100%; margin-top: 15px; border: 0; color: var(--muted); background: transparent; text-align: center; text-decoration: underline; text-underline-offset: 3px; font-size: 12px; }
.auth-message { min-height: 22px; margin-top: 12px; color: var(--red); font-size: 13px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 258px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; padding: 24px 16px 18px; color: #f1f4f7; background: var(--ink); }
.sidebar .brand { padding: 5px 8px 25px; }
.sidebar .brand img { width: 42px; height: 42px; }
.workspace-label { margin: 14px 9px 9px; color: #93a7bc; font-size: 9px; letter-spacing: .18em; text-transform: uppercase; }
.side-nav { display: grid; gap: 4px; overflow-y: auto; padding-right: 2px; }
.nav-item { display: flex; align-items: center; gap: 11px; min-height: 42px; width: 100%; border: 1px solid transparent; border-radius: 8px; padding: 9px 11px; color: #c2ccd7; background: transparent; text-align: left; font-size: 13px; }
.nav-item:hover { color: white; background: rgba(255,255,255,.07); }
.nav-item.active { border-color: rgba(142,177,226,.17); color: white; background: rgba(65,111,174,.3); }
.nav-icon { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 6px; color: #9fbbe2; background: rgba(255,255,255,.07); font-size: 12px; }
.nav-label { flex: 1; }
.side-bottom { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 15px 8px 0; color: #94a7ba; font-size: 11px; line-height: 1.55; }
.side-bottom a { color: #bfd3ed; text-decoration: none; }
.main-area { min-width: 0; }
.topbar { position: sticky; z-index: 10; top: 0; display: flex; min-height: 76px; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding: 12px clamp(18px, 4vw, 54px); background: rgba(247,246,242,.92); backdrop-filter: blur(14px); }
.top-title small { display: block; color: var(--muted); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; }
.top-title strong { display: block; margin-top: 3px; font: 500 23px Georgia, "Times New Roman", serif; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.user-chip { display: flex; align-items: center; gap: 10px; margin-left: 8px; }
.user-avatar { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 50%; color: white; background: var(--blue); font-size: 12px; font-weight: 700; }
.user-detail { display: grid; gap: 3px; }
.user-detail strong { max-width: 175px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.user-detail small { color: var(--muted); font-size: 10px; }
.mobile-menu { display: none; }
.page-content { width: min(1500px, 100%); margin: 0 auto; padding: 30px clamp(18px, 4vw, 54px) 65px; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin: 2px 0 24px; }
.page-intro h1 { margin: 8px 0 7px; font: 500 clamp(29px, 3vw, 40px)/1.1 Georgia, "Times New Roman", serif; letter-spacing: -.035em; }
.page-intro p { max-width: 660px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; margin: 18px 0 22px; }
.metric-card, .panel, .data-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 5px 16px rgba(21,42,64,.025); }
.metric-card { min-height: 124px; padding: 18px; }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }
.metric-symbol { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 9px; color: var(--blue); background: var(--soft-blue); font-size: 13px; }
.metric-card strong { display: block; margin-top: 12px; font: 500 30px Georgia, "Times New Roman", serif; }
.metric-card p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(290px,.75fr); gap: 15px; }
.panel { padding: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.panel-head h2, .panel-head h3 { margin: 0; font: 500 21px Georgia, "Times New Roman", serif; }
.panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.panel-link { color: var(--blue); font-size: 12px; text-decoration: none; }
.quick-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.quick-link { display: flex; align-items: center; gap: 11px; min-height: 60px; border: 1px solid var(--line); border-radius: 9px; padding: 12px; background: white; text-align: left; }
.quick-link:hover { border-color: #9ab8e4; background: #f7faff; }
.quick-link b { font-size: 12px; }
.quick-link small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.data-tools { display: flex; align-items: center; gap: 12px; margin: 18px 0 12px; }
.search-input { max-width: 360px; padding: 10px 13px; font-size: 12px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { border-bottom: 1px solid #e8ebed; padding: 13px 14px; text-align: left; vertical-align: middle; }
th { color: #607184; background: #f3f5f6; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
td { color: #2b3e52; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
td strong { display: block; color: var(--ink); font-size: 12px; font-weight: 650; }
td small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.badge { display: inline-flex; align-items: center; width: fit-content; border-radius: 100px; padding: 5px 9px; color: #395b8a; background: var(--soft-blue); font-size: 10px; font-weight: 650; }
.badge.green { color: #28634c; background: #e9f3ed; }
.badge.amber { color: #926121; background: #f8f0df; }
.badge.red { color: #8e3b3b; background: #f8eaea; }
.empty-state { display: grid; min-height: 150px; place-items: center; padding: 22px; color: var(--muted); text-align: center; font-size: 13px; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); font: 500 20px Georgia, "Times New Roman", serif; }
.chart-bars { display: flex; align-items: end; gap: 7px; height: 150px; padding: 18px 3px 0; border-bottom: 1px solid var(--line); }
.chart-bar { flex: 1; min-width: 9px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg,#79a5e5,#245fbd); }
.chart-labels { display: flex; justify-content: space-between; gap: 4px; margin-top: 8px; color: var(--muted); font-size: 9px; }
.info-note { margin: 14px 0 0; border-left: 3px solid #83a9dd; padding: 9px 12px; color: #556c82; background: #f1f5fb; font-size: 11px; line-height: 1.6; }
.access-denied { padding: 22px; border: 1px solid #e1c9c9; border-radius: 10px; color: #754343; background: #fffafa; }
.editor-dialog { width: min(650px, calc(100% - 24px)); max-height: min(90vh, 850px); overflow: auto; border: 1px solid var(--line); border-radius: 14px; padding: 0; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.editor-dialog::backdrop { background: rgba(13,28,44,.48); backdrop-filter: blur(3px); }
.dialog-head { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 18px 22px; background: var(--surface); }
.dialog-head h2 { margin: 0; font: 500 23px Georgia, "Times New Roman", serif; }
.dialog-body { padding: 21px 22px 23px; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1/-1; }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 16px; }
.permission-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 4px 0 18px; }
.permission-option { display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; color: #41566b; background: white; font-size: 11px; }
.permission-option input { accent-color: var(--blue); }
.tenant-cards { display: grid; grid-template-columns: repeat(auto-fit,minmax(230px,1fr)); gap: 12px; }
.tenant-card { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: white; }
.tenant-card h3 { margin: 7px 0; font: 500 18px Georgia, "Times New Roman", serif; }
.tenant-card p { margin: 0; color: var(--muted); font-size: 11px; }
.inline-status { display: inline-flex; align-items: center; gap: 7px; color: var(--green); font-size: 11px; }
.inline-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.offline-banner { margin: 0 clamp(18px, 4vw, 54px); border: 1px solid #e4d0a6; border-radius: 0 0 9px 9px; padding: 9px 12px; color: #78571c; background: #fff7e8; font-size: 11px; }
.toast { position: fixed; z-index: 30; right: 22px; bottom: 22px; max-width: min(400px,calc(100% - 32px)); transform: translateY(15px); opacity: 0; pointer-events: none; border-radius: 8px; padding: 12px 16px; color: white; background: var(--ink); box-shadow: var(--shadow); font-size: 12px; transition: .2s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: var(--red); }
.hidden { display: none !important; }

@media (max-width: 980px) {
  .auth-layout { grid-template-columns: minmax(320px,.85fr) minmax(360px,1fr); }
  .auth-story { padding: 34px; }
  .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .app-shell { grid-template-columns: 226px minmax(0,1fr); }
  .user-detail { display: none; }
}
@media (max-width: 720px) {
  .auth-layout { display: flex; flex-direction: column; min-height: 100svh; }
  .auth-story { min-height: 270px; padding: 24px; }
  .auth-story::before { inset: auto -20px -70px 30%; height: 78%; opacity: .22; }
  .story-copy { padding: 37px 0 18px; }
  .story-copy h1 { max-width: 540px; margin: 11px 0; font-size: clamp(39px,10vw,58px); }
  .story-copy p { max-width: 400px; margin: 0; font-size: 13px; }
  .story-foot { display: none; }
  .auth-panel { flex: 1; align-items: start; padding: 28px 23px 34px; }
  .auth-card { max-width: 520px; margin: 0 auto; }
  .auth-card .brand { margin-bottom: 26px; }
  .auth-card h2 { font-size: 34px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 20; inset: 0 auto 0 0; width: min(290px,85vw); height: 100dvh; transform: translateX(-105%); box-shadow: 16px 0 40px rgba(0,0,0,.18); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 19; inset: 0; border: 0; background: rgba(8,19,31,.4); }
  .topbar { min-height: 67px; gap: 8px; padding: 9px 14px; }
  .mobile-menu { display: inline-grid; width: 37px; height: 37px; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; }
  .top-title { flex: 1; min-width: 0; }
  .top-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 20px; }
  .top-title small { font-size: 8px; }
  .top-actions { gap: 2px; }
  .user-chip { margin-left: 0; }
  .user-avatar { width: 32px; height: 32px; }
  .top-actions .secondary { padding: 8px 10px; font-size: 10px; }
  .page-content { padding: 22px 15px 46px; }
  .page-intro { align-items: start; flex-direction: column; gap: 14px; margin-bottom: 18px; }
  .page-intro h1 { font-size: 31px; }
  .page-intro p { font-size: 12px; }
  .metrics-grid { gap: 9px; margin: 12px 0 16px; }
  .metric-card { min-height: 110px; padding: 13px; }
  .metric-card strong { font-size: 26px; }
  .metric-top { align-items: start; font-size: 10px; }
  .metric-symbol { width: 26px; height: 26px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .panel { padding: 15px; }
  .quick-grid { grid-template-columns: 1fr; }
  .data-tools { align-items: stretch; flex-direction: column; }
  .search-input { max-width: none; }
  .offline-banner { margin: 0 15px; }
}
@media (max-width: 430px) {
  .story-copy h1 { font-size: 38px; }
  .story-copy p { font-size: 12px; }
  .auth-story { min-height: 245px; }
  .auth-panel { padding: 25px 19px; }
  .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .page-actions { width: 100%; }
  .page-actions > button { flex: 1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .permission-grid { grid-template-columns: 1fr; }
}
@media (max-width: 360px) { body { min-width: 0; } }
@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; } }
