/* Ads Guard — "sổ cái" theo dõi số dư dâng về ngưỡng thanh toán.
   Màu chủ đạo: xanh mực tiền giấy; đỏ son chỉ dùng cho "dừng"; hổ phách cho "gần ngưỡng". */
@import url('/fonts/be-vietnam-pro/400.css');
@import url('/fonts/be-vietnam-pro/500.css');
@import url('/fonts/be-vietnam-pro/600.css');
@import url('/fonts/be-vietnam-pro/700.css');
@import url('/fonts/ibm-plex-mono/500.css');

:root {
  --font-ui: 'Be Vietnam Pro', ui-sans-serif, system-ui, sans-serif;
  --font-num: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --bg: #eef1ee;
  --bg-grain: rgba(20, 40, 30, 0.035);
  --surface: #fbfcfb;
  --surface-2: #f3f6f4;
  --ink: #14211b;
  --ink-2: #3c4a43;
  --muted: #6a7871;
  --line: #dbe2dd;
  --line-strong: #c6d0ca;

  --money: #1d5c47;          /* xanh mực — hành động chính */
  --money-ink: #f4faf6;
  --money-soft: #e3efe8;
  --ok: #2f7a5a;
  --ok-soft: #e4f1ea;
  --near: #a8650f;
  --near-soft: #fbefd9;
  --stop: #c2410c;
  --stop-soft: #fde9df;
  --warn: #8a5a12;
  --warn-soft: #f6ecd8;
  --dim-soft: #e9edea;

  --shadow-1: 0 1px 0 rgba(20, 50, 35, 0.04), 0 1px 2px rgba(20, 50, 35, 0.06);
  --shadow-2: 0 10px 30px -12px rgba(20, 60, 40, 0.22);
  --r-lg: 16px;
  --r-md: 10px;
  --r-sm: 6px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1311;
    --bg-grain: rgba(200, 240, 220, 0.025);
    --surface: #131b18;
    --surface-2: #18221e;
    --ink: #e2ebe6;
    --ink-2: #b6c4bc;
    --muted: #869790;
    --line: #23302b;
    --line-strong: #2f3d37;
    --money: #4fb08a;
    --money-ink: #08130e;
    --money-soft: #16302a;
    --ok: #5cc095;
    --ok-soft: #14291f;
    --near: #e5a540;
    --near-soft: #2c2210;
    --stop: #f27a4a;
    --stop-soft: #321a10;
    --warn: #d9a650;
    --warn-soft: #2a2213;
    --dim-soft: #1c2622;
    --shadow-1: 0 1px 0 rgba(0, 0, 0, 0.3);
    --shadow-2: 0 14px 34px -14px rgba(0, 0, 0, 0.6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font: 15px/1.5 var(--font-ui);
  /* đường kẻ mờ như giấy sổ cái */
  background: repeating-linear-gradient(0deg, var(--bg-grain) 0 1px, transparent 1px 28px), var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--money); }
:focus-visible { outline: 2px solid var(--money); outline-offset: 2px; border-radius: 4px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
[hidden] { display: none !important; }

/* ---------- khung: thanh bên + nội dung ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }
.rail {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: 28px;
  padding: 26px 18px 20px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: saturate(1.2);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.brand-sub { font-size: 12px; color: var(--muted); line-height: 1.3; }

.nav { display: grid; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: var(--r-md); background: none;
  color: var(--ink-2); font-weight: 500; text-align: left; cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.nav button svg { width: 18px; height: 18px; flex: none; opacity: 0.8; }
.nav button:hover { background: var(--surface-2); color: var(--ink); }
.nav button[aria-selected="true"] { background: var(--money-soft); color: var(--money); font-weight: 600; }
.nav button[aria-selected="true"] svg { opacity: 1; }

.rail-status { margin-top: auto; display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); }
.rail-status dt { font-size: 12px; color: var(--muted); }
.rail-status dd { margin: 2px 0 0; font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-status dl { margin: 0; display: grid; gap: 10px; }
.rail-status, .rail-status dl > div { min-width: 0; }
.rail-status dd[title] { cursor: default; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.stop { background: var(--stop); box-shadow: 0 0 0 3px var(--stop-soft); }
.dot.near { background: var(--near); box-shadow: 0 0 0 3px var(--near-soft); }
.rail-foot { display: flex; gap: 8px; }

.content { min-width: 0; padding: 30px clamp(16px, 4vw, 48px) 60px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: 26px; line-height: 1.2; letter-spacing: -0.025em; font-weight: 700; text-wrap: balance; }
.page-head .eyebrow { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.page-head .grow { flex: 1; min-width: 240px; }

/* ---------- nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--muted); box-shadow: var(--shadow-1); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn.primary { background: var(--money); border-color: var(--money); color: var(--money-ink); box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 0 6px 16px -8px var(--money); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn.danger { color: var(--stop); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn.running svg { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- huy hiệu trạng thái (vuông, không bo tròn kiểu pill) ---------- */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: var(--r-sm); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.tag.ok { color: var(--ok); background: var(--ok-soft); }
.tag.near { color: var(--near); background: var(--near-soft); }
.tag.stop { color: var(--stop); background: var(--stop-soft); }
.tag.stop-outline { color: var(--stop); box-shadow: inset 0 0 0 1px var(--stop); }
.tag.warn { color: var(--warn); background: var(--warn-soft); }
.tag.dim { color: var(--muted); background: var(--dim-soft); }

/* ---------- mặt bằng chung ---------- */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.alert { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 16px; font-size: 14px; }
.alert .grow { flex: 1; min-width: 220px; }
.alert.stop { background: var(--stop-soft); color: var(--stop); }
.alert.near { background: var(--near-soft); color: var(--near); }

/* ---------- biểu đồ cả đội (chữ ký của trang) ----------
   Thang 0–120% ngưỡng chia cột 5%; mỗi account là một ô vuông xếp chồng trong cột của nó. */
.fleet { padding: 22px 24px 20px; margin-bottom: 18px; }
.fleet-head { display: flex; gap: 8px 20px; align-items: baseline; flex-wrap: wrap; margin-bottom: 22px; }
.fleet-title { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; flex: 1; min-width: 220px; text-wrap: balance; }
.fleet-title b { color: var(--stop); font-family: var(--font-num); font-weight: 500; }
.fleet-title b.calm { color: var(--ok); }

.hist { position: relative; padding-top: 22px; }
.hist-plot {
  position: relative; display: grid; grid-template-columns: repeat(var(--bins), minmax(0, 1fr));
  align-items: end; column-gap: 3px; min-height: 64px;
}
.hist-col {
  display: flex; flex-direction: column-reverse; align-items: center; gap: 3px;
  padding-bottom: 7px; border-bottom: 3px solid var(--ok-soft);
}
.hist-col.near { border-bottom-color: var(--near-soft); }
.hist-col.stop { border-bottom-color: var(--stop-soft); }
.blk {
  appearance: none; display: block; padding: 0; margin: 0;
  width: 100%; max-width: 15px; aspect-ratio: 1; border: 0; border-radius: 4px;
  background: var(--ok); cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
  animation: stack-in 0.5s var(--ease) both; animation-delay: calc(var(--i) * 14ms);
}
.blk.near { background: var(--near); }
.blk.stop { background: var(--stop); }
.blk.dim { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); }
.blk:hover, .blk:focus-visible { transform: scale(1.25); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px currentColor; color: var(--ink); z-index: 2; position: relative; }
@keyframes stack-in { from { opacity: 0; transform: translateY(6px) scale(0.6); } }

.hist-zone {
  position: absolute; top: 0; right: 0; bottom: 10px; pointer-events: none; border-radius: 0 var(--r-sm) 0 0;
  background: linear-gradient(180deg, transparent, var(--stop-soft));
}
.hist-line { position: absolute; top: 0; bottom: 10px; width: 0; pointer-events: none; }
.hist-line.stop { border-left: 1.5px dashed var(--stop); }
.hist-line.limit { border-left: 1.5px solid var(--line-strong); }
.hist-line span { position: absolute; top: 0; right: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; color: var(--stop); line-height: 1; }
.hist-line.limit span { right: auto; left: 6px; color: var(--muted); }
.hist-axis { position: relative; height: 18px; margin-top: 6px; font: 11px var(--font-num); color: var(--muted); }
.hist-axis span { position: absolute; transform: translateX(-50%); }
.hist-axis span:first-child { transform: none; }
.hist-axis span:last-child { transform: translateX(-100%); }

.gauge-tip {
  position: absolute; z-index: 3; transform: translate(-50%, calc(-100% - 8px)); pointer-events: none;
  background: var(--ink); color: var(--surface); padding: 6px 10px; border-radius: var(--r-sm); font-size: 12.5px; white-space: nowrap; box-shadow: var(--shadow-2);
}
.legend { display: flex; gap: 8px 18px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend b { color: var(--ink); font-family: var(--font-num); font-weight: 500; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend .l-ok { background: var(--ok); } .legend .l-near { background: var(--near); } .legend .l-stop { background: var(--stop); }
.legend .l-dim { box-shadow: inset 0 0 0 1.5px var(--muted); }

/* ---------- bộ lọc ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.segmented { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 12px; flex-wrap: wrap; }
.segmented button { border: 0; background: none; padding: 6px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; transition: background 0.2s var(--ease); }
.segmented button b { font-family: var(--font-num); font-weight: 500; margin-left: 6px; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.segmented button[aria-pressed="true"] b { color: var(--money); }
.search { flex: 1; min-width: 200px; position: relative; }
.search input { width: 100%; height: 38px; padding: 0 12px 0 36px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); font-size: 16px; }
.search svg { position: absolute; left: 11px; top: 11px; width: 16px; height: 16px; color: var(--muted); }

/* ---------- sổ cái account ---------- */
.ledger-head, .row {
  display: grid; align-items: center; gap: 16px;
  grid-template-columns: var(--cols, minmax(160px, 1.3fr) minmax(180px, 2fr) minmax(140px, 0.9fr) 150px);
  padding: 12px 18px;
}
.act { display: flex; justify-content: flex-end; }
.pause-btn { color: var(--stop); border-color: color-mix(in srgb, var(--stop) 35%, var(--line)); background: transparent; }
.pause-btn:hover { background: var(--stop-soft); border-color: var(--stop); }
.pause-btn.running svg { animation: pulse 1s var(--ease) infinite alternate; }
@keyframes pulse { to { opacity: 0.3; } }
.btn.danger-solid { background: var(--stop); border-color: var(--stop); color: #fff; }
.btn.danger-solid:hover { filter: brightness(1.06); }

/* hộp xác nhận */
dialog {
  width: min(440px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2), 0 0 0 4px color-mix(in srgb, var(--stop) 12%, transparent);
}
dialog[open] { animation: dialog-in 0.25s var(--ease); }
dialog::backdrop { background: rgba(6, 14, 11, 0.62); backdrop-filter: blur(3px); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.dialog-body { padding: 22px 22px 18px; }
.dialog-body h2 { margin: 0 0 14px; font-size: 18px; letter-spacing: -0.015em; }
.dialog-body p { margin: 10px 0 0; color: var(--ink-2); font-size: 14px; }
.dialog-account { display: grid; gap: 2px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); }
.dialog-account span { font-size: 13px; }
.dialog-warn { padding: 8px 12px; border-radius: var(--r-sm); background: var(--near-soft); color: var(--near) !important; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.ledger-head { font-size: 12px; color: var(--muted); font-weight: 500; border-bottom: 1px solid var(--line); padding-top: 10px; padding-bottom: 10px; }
.row { border-bottom: 1px solid var(--line); animation: rise 0.45s var(--ease) both; animation-delay: calc(min(var(--i), 20) * 22ms); transition: background 0.2s var(--ease); }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--surface-2); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.acc b { display: block; font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.acc span { font-size: 12.5px; color: var(--muted); }
.mcc { font-size: 13px; color: var(--ink-2); }
.figure { text-align: right; }
.figure .bal { font-size: 15px; }
.figure .of { font-size: 12.5px; color: var(--muted); }
.credit { color: var(--ok); }
.state { display: grid; justify-items: start; gap: 3px; }
.state .why { font-size: 12px; color: var(--muted); line-height: 1.35; }

.meter { display: grid; grid-template-columns: 1fr 44px; gap: 10px; align-items: center; }
.meter-track { position: relative; height: 8px; border-radius: 5px; background: var(--dim-soft); }
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; background: var(--ok); width: 0; transition: width 0.9s var(--ease); }
.meter.near .meter-fill { background: var(--near); }
.meter.stop .meter-fill { background: var(--stop); }
.meter.dim .meter-fill { background: repeating-linear-gradient(135deg, var(--line-strong) 0 4px, transparent 4px 7px); }
.meter-stop { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--stop); border-radius: 1px; opacity: 0.75; }
.meter.dim .meter-stop { display: none; }
.meter-pct { font-size: 13px; text-align: right; color: var(--ink-2); }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ---------- cài đặt ---------- */
.section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; padding: 26px 0; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: 0; padding-top: 4px; }
.section h2 { margin: 0 0 6px; font-size: 16px; letter-spacing: -0.01em; }
.section p.lead { margin: 0; color: var(--muted); font-size: 13.5px; text-wrap: pretty; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 13px; }
.input { height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); font-size: 16px; width: 100%; transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.input:focus { outline: none; border-color: var(--money); box-shadow: 0 0 0 3px var(--money-soft); }
.input.num { font-family: var(--font-num); }
.with-suffix { position: relative; }
.with-suffix .input { padding-right: 46px; }
.with-suffix span { position: absolute; right: 12px; top: 10px; color: var(--muted); font-size: 14px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.preview { margin-top: 2px; padding: 12px 14px; border-radius: var(--r-md); background: var(--money-soft); color: var(--ink-2); font-size: 14px; }
.preview b { color: var(--money); font-family: var(--font-num); font-weight: 500; }

.mcc-list { display: grid; gap: 8px; margin-bottom: 12px; }
.mcc-row { display: grid; grid-template-columns: 160px 1fr auto auto; gap: 8px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.mcc-row .input { height: 38px; }
.toggle { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 13.5px; color: var(--ink-2); }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle i { width: 34px; height: 20px; border-radius: 12px; background: var(--line-strong); position: relative; transition: background 0.2s var(--ease); }
.toggle i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,0.25); transition: transform 0.25s var(--ease); }
.toggle input:checked + i { background: var(--money); }
.toggle input:checked + i::after { transform: translateX(14px); }
.toggle input:focus-visible + i { outline: 2px solid var(--money); outline-offset: 2px; }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card { position: relative; display: block; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--r-md); cursor: pointer; background: var(--surface); transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.mode-card input { position: absolute; opacity: 0; }
.mode-card b { display: block; font-size: 15px; margin-bottom: 2px; }
.mode-card span { color: var(--muted); font-size: 13px; }
.mode-card:has(input:checked) { border-color: var(--money); box-shadow: 0 0 0 3px var(--money-soft); }
.mode-card.live:has(input:checked) { border-color: var(--stop); box-shadow: 0 0 0 3px var(--stop-soft); }
.mode-card:has(input:focus-visible) { outline: 2px solid var(--money); outline-offset: 2px; }

.session { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); margin-bottom: 12px; }
.session .grow { flex: 1; min-width: 200px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.savebar {
  position: sticky; bottom: 16px; z-index: 4; display: flex; gap: 14px; align-items: center; justify-content: flex-end; flex-wrap: wrap;
  margin-top: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(8px); box-shadow: var(--shadow-2);
}

/* ---------- lịch sử ---------- */
.timeline { position: relative; }
.run { display: grid; grid-template-columns: 120px 1fr auto; gap: 16px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background 0.2s var(--ease); }
.run:hover { background: var(--surface-2); }
.run time { font-family: var(--font-num); font-size: 14px; }
.run time small { display: block; font-family: var(--font-ui); color: var(--muted); font-size: 12px; }
.run .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.run .chev { color: var(--muted); transition: transform 0.25s var(--ease); }
.run[aria-expanded="true"] .chev { transform: rotate(90deg); }
.run-detail { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.run-detail .note { padding: 14px 18px; color: var(--muted); font-size: 14px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 30; transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center; max-width: calc(100vw - 32px);
  padding: 12px 16px; border-radius: var(--r-md); background: var(--ink); color: var(--surface);
  box-shadow: var(--shadow-2); font-size: 14px; animation: toast-in 0.35s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- đăng nhập ---------- */
.login-page { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr); }
.login-art { position: relative; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; background: var(--money); color: var(--money-ink); overflow: hidden; }
.login-art h2 { margin: 0; font-size: clamp(28px, 3.4vw, 40px); line-height: 1.12; letter-spacing: -0.03em; max-width: 14ch; text-wrap: balance; }
.login-art p { margin: 12px 0 0; max-width: 36ch; opacity: 0.8; }
.login-art svg.art { position: absolute; right: -60px; bottom: -40px; width: min(560px, 80%); opacity: 0.9; }
.login-form { display: grid; align-content: center; padding: 48px clamp(20px, 6vw, 72px); background: var(--surface); }
.login-form h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -0.02em; }
.login-form form { display: grid; gap: 12px; max-width: 360px; width: 100%; margin-top: 18px; }
.login-form .btn { height: 44px; }
.error { color: var(--stop); min-height: 1.4em; font-size: 14px; }

/* ---------- di động ---------- */
.mobile-top, .tabbar { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .mobile-top { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 10; padding: 10px 16px; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
  .mobile-top .grow { flex: 1; }
  .tabbar { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
  .tabbar button { display: grid; justify-items: center; gap: 2px; padding: 6px; border: 0; background: none; color: var(--muted); font-size: 11.5px; font-weight: 500; border-radius: var(--r-md); }
  .tabbar button svg { width: 20px; height: 20px; }
  .tabbar button[aria-selected="true"] { color: var(--money); background: var(--money-soft); }
  .content { padding: 18px 16px 96px; }
  .page-head h1 { font-size: 22px; }
  .fleet { padding: 18px 14px 14px; }
  .hist-plot { column-gap: 2px; }
  .blk { border-radius: 3px; }
  .toolbar { padding: 12px; }
  .segmented { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: 100%; }
  .segmented::-webkit-scrollbar { display: none; }
  .segmented button { flex: none; }
  .ledger-head { display: none; }
  .row { grid-template-columns: 1fr auto; grid-template-areas: 'acc state' 'meter meter' 'fig act' 'mcc mcc'; gap: 8px 12px; padding: 14px 16px; }
  .row .act { grid-area: act; }
  .row .acc { grid-area: acc; } .row .state { grid-area: state; justify-items: end; text-align: right; }
  .row .meter { grid-area: meter; } .row .figure { grid-area: fig; text-align: left; display: flex; gap: 8px; align-items: baseline; }
  .row .mcc { grid-area: mcc; }
  .section { grid-template-columns: 1fr; gap: 12px; }
  .pair, .modes { grid-template-columns: 1fr; }
  .mcc-row { grid-template-columns: 1fr 1fr; }
  .run { grid-template-columns: 1fr auto; }
  .run .chips { grid-column: 1 / -1; grid-row: 2; }
  .savebar { bottom: 76px; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { padding: 28px 22px; min-height: 220px; }
  .login-art svg.art { width: 70%; right: -40px; bottom: -30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
