/* AUROX CRM — styles. Colors are tokens: change them here to re-brand. */
:root {
  --ink: #0e1a2b;
  --ink-2: #16263d;
  --ink-3: #22364f;
  --ink-text: #c9d3e0;
  --gold: #f2a33a;
  --gold-2: #ffbf5f;
  --gold-soft: #fff4e2;
  --gold-text: #8a5300;  /* text on --gold-soft */
  --on-gold: #0e1a2b;    /* text on --gold */
  --bg: #f5f4f0;
  --card: #ffffff;
  --line: #e7e3da;
  --line-2: #f0ede6;
  --text: #17202e;
  --muted: #6b7484;
  --faint: #9aa2af;
  --green: #15803d;  --green-bg: #e8f6ec;
  --blue: #1d4ed8;   --blue-bg: #e8effd;
  --orange: #c2410c; --orange-bg: #fdeee4;
  --red: #b91c1c;    --red-bg: #fdeaea;
  --violet: #6d28d9; --violet-bg: #f1ebfd;
  --gray-bg: #eef0f3;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(14, 26, 43, .05), 0 4px 16px rgba(14, 26, 43, .04);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .money { font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--ink); color: var(--ink-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--gold-2), var(--gold)); display: grid; place-items: center; color: var(--on-gold); font-weight: 800; font-size: 17px; }
.brand-name { color: #fff; font-weight: 700; font-size: 15px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: #8796ab; }
.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: #66758b; padding: 14px 10px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; color: var(--ink-text); font-weight: 500; }
.nav a svg { width: 18px; height: 18px; opacity: .8; flex: none; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.active { background: var(--ink-3); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.nav a .count { margin-left: auto; background: var(--gold); color: var(--on-gold); border-radius: 10px; font-size: 11px; font-weight: 700; padding: 1px 7px; }
.sidebar-foot { margin-top: auto; padding: 14px 16px; border-top: 1px solid var(--ink-2); font-size: 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink-3); color: var(--gold-2); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.sidebar-foot .who { color: #fff; font-weight: 600; font-size: 13px; }
.sidebar-foot button { margin-left: auto; background: none; border: 0; color: #8796ab; cursor: pointer; padding: 6px; border-radius: 6px; }
.sidebar-foot button:hover { color: #fff; background: var(--ink-2); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(245, 244, 240, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 12px 28px; }
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 460px; }
.search input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 0 12px 0 36px; outline: none; }
.search input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.search > svg { position: absolute; left: 11px; top: 10px; width: 17px; height: 17px; color: var(--faint); }
.search-results { position: absolute; top: 44px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(14,26,43,.14); max-height: 420px; overflow: auto; display: none; }
.search-results.open { display: block; }
.search-results .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 10px 14px 4px; font-weight: 600; }
.search-results a { display: block; padding: 8px 14px; }
.search-results a:hover, .search-results a.hl { background: var(--gold-soft); }
.search-results small { color: var(--muted); }
.topbar .today { color: var(--muted); font-size: 13px; margin-left: auto; white-space: nowrap; }
.content { padding: 24px 28px 60px; max-width: 1480px; width: 100%; }

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; }
.page-head .sub { color: var(--muted); margin-top: 3px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #d3cdc0; background: #fcfbf8; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-3); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.btn.gold:hover { background: var(--gold-2); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: #f3c4c4; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn.icon { width: 36px; padding: 0; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, select.input, textarea.input { width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 11px; background: #fff; outline: none; }
textarea.input { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; }
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
label.field .req { color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 16px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span1 { grid-column: span 1; }
.form-section { grid-column: 1 / -1; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 700; padding-top: 6px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); font-weight: 500; height: 38px; }
.check input { width: 17px; height: 17px; accent-color: var(--ink); }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }

/* tag input */
.tags-input { display: flex; flex-wrap: wrap; gap: 5px; min-height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; background: #fff; align-items: center; }
.tags-input:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.tags-input input { border: 0; outline: none; flex: 1; min-width: 90px; height: 26px; padding: 0 4px; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--gold-soft); color: var(--gold-text); border-radius: 6px; padding: 2px 8px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.tag button { border: 0; background: none; cursor: pointer; padding: 0; color: inherit; font-size: 14px; line-height: 1; }
.tag-sugg { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.tag-sugg button { border: 1px dashed var(--line); background: none; border-radius: 6px; padding: 1px 7px; font-size: 11px; color: var(--muted); cursor: pointer; }
.tag-sugg button:hover { border-color: var(--gold); color: var(--text); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { font-size: 14px; font-weight: 700; }
.card-head .sub { color: var(--muted); font-size: 12px; }
.card-head .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.mb { margin-bottom: 16px; }

/* KPI / profit tiles */
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .value.neg { color: var(--red); }
.kpi .meta { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.kpi .meta b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.delta { font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; }
.delta.up { color: var(--green); background: var(--green-bg); }
.delta.down { color: var(--red); background: var(--red-bg); }
.delta.flat { color: var(--muted); background: var(--gray-bg); }
.kpi.hero { background: var(--ink); color: #fff; border-color: var(--ink); }
.kpi.hero .label { color: #9fb0c6; }
.kpi.hero .meta { color: #9fb0c6; }
.kpi.hero .meta b { color: #fff; }
.kpi.hero .value { color: var(--gold-2); }

.target { padding: 16px 18px; }
.bar { height: 10px; background: var(--line-2); border-radius: 6px; overflow: hidden; position: relative; }
.bar > span { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.bar .proj { position: absolute; top: 0; bottom: 0; border-right: 2px dashed var(--ink); opacity: .35; }

/* fleet status */
.fleet-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fs { border-radius: 10px; padding: 12px 14px; }
.fs .n { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fs .l { font-size: 12px; font-weight: 600; }
.fs.av { background: var(--green-bg); color: var(--green); }
.fs.bk { background: var(--blue-bg); color: var(--blue); }
.fs.mt { background: var(--orange-bg); color: var(--orange); }
.fs.ut { background: var(--gray-bg); color: var(--ink); }

.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 9px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-green { color: var(--green); background: var(--green-bg); }
.b-blue { color: var(--blue); background: var(--blue-bg); }
.b-orange { color: var(--orange); background: var(--orange-bg); }
.b-red { color: var(--red); background: var(--red-bg); }
.b-violet { color: var(--violet); background: var(--violet-bg); }
.b-gray { color: #4b5563; background: var(--gray-bg); }
.b-gold { color: var(--gold-text); background: var(--gold-soft); }

/* lists */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--line-2); }
.list li:last-child { border-bottom: 0; }
.list .t { font-weight: 600; }
.list .s { font-size: 12px; color: var(--muted); }
.list .r { margin-left: auto; text-align: right; }
.list a.row-link:hover .t { color: var(--blue); }
.empty { padding: 28px 18px; text-align: center; color: var(--faint); font-size: 13px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

.alert-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 18px; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.alert-item:last-child { border-bottom: 0; }
.alert-item .ic { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; flex: none; font-weight: 800; font-size: 12px; }
.alert-item.danger .ic { background: var(--red-bg); color: var(--red); }
.alert-item.warn .ic { background: var(--orange-bg); color: var(--orange); }

/* tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #faf9f6; white-space: nowrap; position: sticky; top: 0; }
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--text); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:hover td { background: #fcfbf8; }
.tbl tr.clickable { cursor: pointer; }
.tbl .r, .tbl th.r { text-align: right; }
.tbl tfoot td { font-weight: 700; background: #faf9f6; border-top: 1px solid var(--line); }
.tbl .strong { font-weight: 600; }
.tbl .muted { color: var(--muted); font-size: 12px; }

/* filters bar */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
.filters .input { height: 34px; width: auto; min-width: 140px; font-size: 13px; }
.filters .input.grow { flex: 1; min-width: 200px; }
.pager { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--muted); font-size: 12px; }
.pager .right { margin-left: auto; display: flex; gap: 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 6px; font-weight: 600; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--ink); color: #fff; }

/* kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kcol { flex: 0 0 272px; background: #ebe8e1; border-radius: 12px; display: flex; flex-direction: column; max-height: calc(100vh - 230px); }
.kcol-head { padding: 11px 12px 9px; display: flex; align-items: center; gap: 8px; }
.kcol-head .name { font-weight: 700; font-size: 13px; }
.kcol-head .cnt { color: var(--muted); font-size: 12px; font-weight: 600; }
.kcol-head .val { margin-left: auto; font-size: 11.5px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.kcol-body { padding: 0 8px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; min-height: 60px; }
.kcol.drop .kcol-body { background: rgba(242,163,58,.12); border-radius: 8px; }
.kcard { background: #fff; border-radius: 9px; padding: 10px 11px; border: 1px solid var(--line); cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.kcard:hover { border-color: #d3cdc0; }
.kcard.dragging { opacity: .45; }
.kcard .nm { font-weight: 700; font-size: 13px; }
.kcard .ln { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 6px; align-items: center; }
.kcard .ft { display: flex; gap: 5px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.kcard .ft .amt { margin-left: auto; font-weight: 700; font-size: 12px; font-variant-numeric: tabular-nums; }
.prio-High { color: var(--red); }
.overdue-txt { color: var(--red); font-weight: 600; }

/* fleet cards */
.cars-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 14px; }
.car-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.car-card:hover { border-color: #cfc8b9; }
.car-card .stripe { height: 4px; }
.car-card.s-Available .stripe { background: var(--green); }
.car-card.s-Booked .stripe { background: var(--blue); }
.car-card.s-Under.Maintenance .stripe, .car-card.s-maint .stripe { background: var(--orange); }
.car-card.s-Inactive .stripe { background: var(--faint); }
.car-card .top { padding: 14px 16px 10px; display: flex; gap: 12px; }
.car-ic { width: 46px; height: 46px; border-radius: 10px; background: var(--line-2); display: grid; place-items: center; flex: none; overflow: hidden; }
.car-ic img { width: 100%; height: 100%; object-fit: cover; }
.car-ic svg { width: 28px; height: 28px; color: var(--ink-3); }
.car-card .nm { font-weight: 700; font-size: 14.5px; }
.plate { font-family: var(--mono); font-size: 11.5px; background: var(--ink); color: #fff; padding: 2px 7px; border-radius: 5px; letter-spacing: .04em; display: inline-block; }
.car-card .specs { font-size: 12px; color: var(--muted); margin-top: 3px; }
.car-card .mid { padding: 0 16px 12px; font-size: 12.5px; color: var(--muted); min-height: 36px; }
.car-card .mid b { color: var(--text); font-weight: 600; }
.car-card .foot { margin-top: auto; border-top: 1px solid var(--line-2); padding: 10px 16px; display: flex; align-items: center; gap: 8px; }
.car-card .rate { font-weight: 800; font-variant-numeric: tabular-nums; }
.car-card .rate small { font-weight: 500; color: var(--muted); }

/* mini fleet board on dashboard */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; padding: 14px 18px; }
.board a { display: flex; gap: 9px; align-items: center; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 9px; }
.board a:hover { border-color: var(--line); background: #fcfbf8; }
.board .nm { font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board .s { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board .bar-v { width: 4px; align-self: stretch; border-radius: 3px; flex: none; }

/* calendar */
.cal-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.cal-toolbar h3 { font-size: 16px; min-width: 170px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #faf9f6; }
.cal-day { min-height: 118px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.out { background: #faf9f6; }
.cal-day.out .dn { color: var(--faint); }
.cal-day .dn { font-size: 12px; font-weight: 700; padding: 2px 4px; display: flex; justify-content: space-between; }
.cal-day.today .dn span:first-child { background: var(--gold); color: var(--on-gold); border-radius: 6px; padding: 0 6px; }
.cal-day:hover { background: #fcfbf8; }
.cal-ev { font-size: 11px; border-radius: 5px; padding: 2px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; cursor: pointer; }
.cal-ev.booking { background: var(--blue-bg); color: var(--blue); }
.cal-ev.booking.Ongoing { background: var(--blue); color: #fff; }
.cal-ev.booking.Completed { background: var(--gray-bg); color: #4b5563; }
.cal-ev.booking.overdue { background: var(--red); color: #fff; }
.cal-ev.maintenance { background: var(--orange-bg); color: var(--orange); }
.cal-ev.event { background: var(--violet-bg); color: var(--violet); }
.cal-ev.event.done { text-decoration: line-through; opacity: .6; }
.cal-ev.followup { background: var(--gold-soft); color: var(--gold-text); }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 4px; font-weight: 600; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* timeline (fleet gantt) */
.gantt { overflow-x: auto; }
.gantt table { border-collapse: collapse; font-size: 11px; min-width: 100%; }
.gantt th, .gantt td { border: 1px solid var(--line-2); padding: 0; height: 30px; min-width: 30px; text-align: center; }
.gantt th { background: #faf9f6; font-weight: 700; color: var(--muted); padding: 4px 0; }
.gantt th.today { background: var(--gold-soft); color: var(--gold-text); }
.gantt td.car { text-align: left; padding: 0 10px; white-space: nowrap; font-weight: 600; position: sticky; left: 0; background: #fff; z-index: 1; min-width: 180px; }
.gantt td.car small { color: var(--muted); font-weight: 500; }
.gantt td .blk { height: 22px; margin: 0 -1px; display: flex; align-items: center; padding: 0 5px; font-weight: 600; white-space: nowrap; overflow: hidden; cursor: pointer; font-size: 10.5px; }
.gantt td.wknd { background: #fbfaf7; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(14, 26, 43, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 100; overflow-y: auto; animation: fade .12s; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 680px; box-shadow: 0 24px 60px rgba(14,26,43,.3); animation: pop .15s; }
.modal.wide { max-width: 980px; }
.modal.narrow { max-width: 440px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line-2); gap: 10px; }
.modal-head h2 { font-size: 17px; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line-2); background: #faf9f6; border-radius: 0 0 14px 14px; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; display: flex; gap: 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

/* detail view */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 12px 12px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--gold); }
.note { padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.note .meta { font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.note .body { white-space: pre-wrap; }
.sum-box { background: #faf9f6; border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.sum-box .row { display: flex; justify-content: space-between; padding: 3px 0; }
.sum-box .row.total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; font-weight: 800; font-size: 15px; }
.warn-box { background: var(--red-bg); color: var(--red); border-radius: 9px; padding: 10px 12px; font-size: 13px; font-weight: 500; }
.ok-box { background: var(--green-bg); color: var(--green); border-radius: 9px; padding: 10px 12px; font-size: 13px; font-weight: 500; }
.info-box { background: var(--blue-bg); color: var(--blue); border-radius: 9px; padding: 10px 12px; font-size: 13px; }

/* toast */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-weight: 500; max-width: 380px; animation: pop .15s; }
.toast.err { background: var(--red); }

/* charts */
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { font-size: 10px; fill: var(--faint); }
.chart .grid line { stroke: var(--line-2); }
.chart-tip { position: fixed; pointer-events: none; background: var(--ink); color: #fff; border-radius: 8px; padding: 8px 10px; font-size: 12px; z-index: 300; display: none; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.chart-tip b { font-variant-numeric: tabular-nums; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.hbar { display: flex; flex-direction: column; gap: 9px; }
.hbar .r { display: grid; grid-template-columns: 120px 1fr 90px; gap: 10px; align-items: center; font-size: 12.5px; }
.hbar .r .track { height: 8px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.hbar .r .track span { display: block; height: 100%; border-radius: 5px; }
.hbar .r .v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art h1 { font-size: 40px; line-height: 1.1; max-width: 460px; }
.auth-art h1 em { font-style: normal; color: var(--gold-2); }
.auth-art p { color: #9fb0c6; max-width: 420px; line-height: 1.6; }
.auth-art .road { position: absolute; right: -60px; bottom: -40px; opacity: .1; width: 520px; }
.auth-form { display: grid; place-items: center; padding: 32px; }
.auth-form .box { width: 100%; max-width: 380px; }
.auth-form h2 { font-size: 24px; margin-bottom: 6px; }
.auth-form .sub { color: var(--muted); margin-bottom: 24px; }
.auth-form .field { margin-bottom: 14px; }
.auth-form .btn { width: 100%; justify-content: center; height: 42px; }

/* settings */
.settings-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 80px; }
.settings-nav button { text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 8px; font-weight: 600; color: var(--muted); cursor: pointer; }
.settings-nav button.on { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.list-editor { display: flex; flex-direction: column; gap: 6px; }
.list-editor .item { display: flex; gap: 6px; align-items: center; }
.list-editor .item .input { height: 34px; }
code, .code { font-family: var(--mono); font-size: 12px; background: var(--line-2); padding: 2px 6px; border-radius: 5px; }
pre.code { display: block; padding: 12px 14px; overflow-x: auto; white-space: pre; background: var(--ink); color: #d6e2f0; border-radius: 10px; font-size: 12px; line-height: 1.55; }

.stack { display: flex; flex-direction: column; gap: 16px; }
.row-flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { margin-left: auto; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.hide { display: none !important; }
.loading { padding: 60px; text-align: center; color: var(--faint); }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- print (reports) ---------- */
@media print {
  .sidebar, .topbar, .page-head .actions, .filters, .no-print { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
  .print-only { display: block !important; }
}
.print-only { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 248px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(14,26,43,.4); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 14px; }
  .topbar .today { display: none; }
  .content { padding: 16px 14px 60px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .fleet-stats { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .cal-day { min-height: 76px; }
  .cal-ev { font-size: 9.5px; padding: 1px 3px; }
  .kv { grid-template-columns: 110px 1fr; }
  .hbar .r { grid-template-columns: 90px 1fr 80px; }
}
@media (max-width: 520px) {
  .g4 { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 20px; }
  .modal-bg { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; }
}
.seg button { display: inline-flex; align-items: center; gap: 6px; }
.seg button svg { width: 15px; height: 15px; flex: none; }
.kcard .ln svg { flex: none; }
.gantt table { table-layout: fixed; width: max-content; min-width: 100%; }
.gantt th, .gantt td { width: 40px; max-width: 40px; overflow: hidden; }
.gantt th:first-child, .gantt td.car { width: 210px; max-width: 210px; text-overflow: ellipsis; position: sticky; left: 0; z-index: 2; background: #fff; }
.gantt th:first-child { background: #faf9f6; }
.gantt td .blk { text-overflow: ellipsis; }

/* ---------- logo ---------- */
.brand-logo { display: block; margin: 16px 14px 6px; border-radius: 12px; overflow: hidden; background: #0e0e0e; }
.brand-logo img { display: block; width: 100%; height: auto; }
.brand-logo + .brand-caption { padding: 0 18px 10px; font-size: 11px; color: #8796ab; letter-spacing: .04em; }
.auth-logo { max-width: 380px; width: 100%; border-radius: 16px; display: block; }
.logo-preview { width: 260px; max-width: 100%; border-radius: 12px; background: #0e0e0e; border: 1px solid var(--line); overflow: hidden; min-height: 80px; display: grid; place-items: center; color: #8796ab; font-size: 12px; }
.logo-preview img { width: 100%; display: block; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatches button { width: 30px; height: 30px; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatches button.on { box-shadow: 0 0 0 2px var(--text); }
