:root {
  --bg: #070a1a;
  --bg2: #0b1028;
  --panel: rgba(18, 24, 54, .72);
  --panel-solid: #121836;
  --line: rgba(120, 140, 255, .14);
  --line2: rgba(120, 140, 255, .26);
  --text: #e8ebff;
  --muted: #8f97c4;
  --brand1: #5b4cf0;
  --brand2: #18d2f5;
  --ok: #2fd68a;
  --busy: #4ea3ff;
  --warn: #ffb547;
  --err: #ff5d73;
  --idle: #7a82ad;
  --radius: 14px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); margin: 2px 0 0; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
h3 { margin: 0; font-size: 18px; }
h4 { margin: 22px 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
input, select {
  font: inherit; color: var(--text); background: rgba(10, 14, 36, .8);
  border: 1px solid var(--line2); border-radius: 10px; padding: 9px 12px; outline: none;
}
input:focus, select:focus { border-color: var(--brand2); box-shadow: 0 0 0 3px rgba(24, 210, 245, .15); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand2); padding: 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  font: inherit; font-weight: 600; font-size: 13px; color: var(--text); cursor: pointer;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line2); border-radius: 10px;
  padding: 8px 13px; transition: .15s; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, .11); border-color: rgba(140, 160, 255, .45); }
.btn:disabled { opacity: .45; cursor: default; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: linear-gradient(135deg, var(--brand1), #2f8ff5 60%, var(--brand2)); border: 0; box-shadow: 0 6px 20px rgba(47, 143, 245, .35); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ok { border-color: rgba(47, 214, 138, .45); color: #b9f5d8; }
.btn.warn { border-color: rgba(255, 181, 71, .45); color: #ffe0b0; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.btn.danger { color: #ffb3bd; }
.btn.wide { width: 100%; }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.icon-btn { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px; border-radius: 8px; display: inline-flex; }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, .08); }

/* login */
.login {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse at 70% 20%, rgba(91, 76, 240, .25), transparent 55%),
              url("/static/img/login-bg.jpg") center/cover no-repeat, var(--bg);
}
.login-card {
  width: min(380px, 100%); padding: 34px 30px 28px; border-radius: 20px; text-align: center;
  background: rgba(14, 19, 46, .62); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line2); box-shadow: var(--shadow);
}
.login-logo { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 10px 30px rgba(24, 210, 245, .25); }
.login-card h1 { margin: 14px 0 0; font-size: 24px; }
.login-card .muted { margin-bottom: 22px; }
.login-card label { display: block; text-align: left; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.login-card input { display: block; width: 100%; margin-top: 6px; }
.login-card .btn { margin-top: 6px; padding: 11px; font-size: 14px; }
.login-err { color: var(--err); min-height: 20px; margin-top: 12px; font-size: 13px; }

/* shell */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100%; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 14px;
  background: linear-gradient(180deg, #0c1130, #080b1e); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; }
.brand img { width: 38px; height: 38px; border-radius: 11px; }
.brand b { display: block; font-size: 16px; letter-spacing: .04em; }
.brand span { display: block; font-size: 12px; color: var(--muted); margin-top: -2px; }
.side nav { display: flex; flex-direction: column; gap: 3px; }
.side nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); cursor: pointer; font-weight: 500; transition: .15s;
}
.side nav a:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.side nav a.active { color: #fff; background: linear-gradient(90deg, rgba(91, 76, 240, .35), rgba(24, 210, 245, .08)); box-shadow: inset 2px 0 0 var(--brand2); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.live { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, .03); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.live.on i { background: var(--ok); box-shadow: 0 0 0 0 rgba(47, 214, 138, .6); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(47, 214, 138, .55); } 70% { box-shadow: 0 0 0 8px rgba(47, 214, 138, 0); } 100% { box-shadow: 0 0 0 0 rgba(47, 214, 138, 0); } }
.main {
  padding: 26px 30px 60px; min-width: 0;
  background: radial-gradient(ellipse at 100% 0, rgba(91, 76, 240, .12), transparent 45%),
              radial-gradient(ellipse at 0 100%, rgba(24, 210, 245, .06), transparent 40%);
}
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; }
.search input { padding-left: 34px; width: 260px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { position: relative; overflow: hidden; padding: 16px 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--glow, rgba(91, 76, 240, .25)); filter: blur(30px); }
.kpi .k-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .06); color: var(--c, var(--brand2)); }
.kpi .k-val { font-size: 26px; font-weight: 700; margin-top: 12px; letter-spacing: -.02em; }
.kpi .k-val small { font-size: 14px; color: var(--muted); font-weight: 500; }
.kpi .k-lbl { color: var(--muted); font-size: 12.5px; }

/* machine cards */
.machines { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.m-card { padding: 16px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); cursor: pointer; transition: .18s; }
.m-card:hover { border-color: var(--line2); transform: translateY(-2px); box-shadow: var(--shadow); }
.m-card.off { opacity: .62; }
.m-top { display: flex; align-items: center; gap: 10px; }
.m-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(91, 76, 240, .35), rgba(24, 210, 245, .2)); color: #cfe9ff; }
.m-name { font-weight: 700; font-size: 15px; }
.m-meta { font-size: 12px; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--idle); vertical-align: 1px; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px rgba(47, 214, 138, .7); }
.m-bar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; background: rgba(255, 255, 255, .06); margin: 14px 0 10px; }
.m-bar i { display: block; height: 100%; }
.m-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.m-legend b { color: var(--text); font-weight: 600; }
.m-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.meter { font-size: 11.5px; color: var(--muted); }
.meter .track { height: 5px; border-radius: 4px; background: rgba(255, 255, 255, .07); margin-top: 5px; overflow: hidden; }
.meter .track i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand2), var(--brand1)); }
.meter.hot .track i { background: linear-gradient(90deg, var(--warn), var(--err)); }
.m-foot { display: flex; gap: 8px; margin-top: 14px; }
.c-farm { background: var(--ok); } .c-busy { background: var(--busy); } .c-needs_you { background: var(--warn); }
.c-error { background: var(--err); } .c-stopped { background: var(--idle); }

/* chips + bulk */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); color: var(--muted); }
.chip i { width: 8px; height: 8px; border-radius: 50%; }
.chip.active { color: #fff; border-color: var(--brand2); background: rgba(24, 210, 245, .1); }
.chip span { color: var(--text); opacity: .8; }
.bulk {
  position: sticky; top: 12px; z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; margin-bottom: 12px; border-radius: 12px; background: rgba(28, 34, 80, .92);
  border: 1px solid rgba(24, 210, 245, .35); box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.bulk #bulk-n { font-weight: 700; margin-right: 6px; }

/* tables */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 230px); }
.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.grid th { position: sticky; top: 0; z-index: 1; background: #10163a; text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 11px 12px; border-bottom: 1px solid var(--line2); white-space: nowrap; user-select: none; }
.grid th[data-sort] { cursor: pointer; }
.grid th[data-sort]:hover { color: var(--text); }
.grid th.sorted::after { content: " ↓"; color: var(--brand2); }
.grid th.sorted.asc::after { content: " ↑"; }
.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid tbody tr:hover td { background: rgba(120, 140, 255, .05); }
.grid tr.sel td { background: rgba(24, 210, 245, .08); }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .c-sel { width: 36px; }
.reason { color: var(--muted); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-name b { font-weight: 600; } .acc-name span { display: block; color: var(--muted); font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.p-farm { color: var(--ok); background: rgba(47, 214, 138, .12); }
.p-busy { color: var(--busy); background: rgba(78, 163, 255, .12); }
.p-needs_you { color: var(--warn); background: rgba(255, 181, 71, .12); }
.p-error { color: var(--err); background: rgba(255, 93, 115, .12); }
.p-stopped { color: var(--idle); background: rgba(122, 130, 173, .14); }
.tick-on { color: var(--ok); } .tick-off { color: var(--idle); }
.tick-on svg, .tick-off svg { width: 16px; height: 16px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.st-sent, .st-running { color: var(--busy); } .st-done { color: var(--ok); } .st-failed, .st-timeout { color: var(--err); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }

/* chart */
.chart-card { padding: 18px; margin-bottom: 16px; }
.chart { height: 240px; }
.chart svg { width: 100%; height: 100%; stroke: none; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* files */
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.f-card { border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); overflow: hidden; cursor: pointer; transition: .15s; }
.f-card:hover { border-color: var(--line2); transform: translateY(-2px); }
.f-thumb { height: 130px; background: #0a0e24 center/cover no-repeat; display: grid; place-items: center; color: var(--muted); }
.f-thumb svg { width: 40px; height: 40px; stroke-width: 1.3; }
.f-info { padding: 10px 12px; font-size: 12px; color: var(--muted); }
.f-info b { display: block; color: var(--text); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* drawer */
.drawer { position: fixed; inset: 0; z-index: 20; background: rgba(3, 5, 15, .55); backdrop-filter: blur(3px); display: flex; justify-content: flex-end; }
.drawer-panel { width: min(520px, 100%); height: 100%; overflow: auto; padding: 22px 24px; background: linear-gradient(180deg, #10163a, #0a0e26); border-left: 1px solid var(--line2); box-shadow: var(--shadow); animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-panel header { display: flex; justify-content: space-between; align-items: flex-start; }
.d-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.d-logs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.log-day { display: flex; justify-content: space-between; align-items: center; padding: 9px 11px; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); font-size: 13px; }
.log-day small { color: var(--muted); display: block; font-size: 11px; }
.d-files .f-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.d-files .f-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* lightbox, toasts, menu */
.lightbox { position: fixed; inset: 0; z-index: 30; background: rgba(2, 3, 10, .88); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; }
.lightbox img { max-width: 100%; max-height: calc(100% - 70px); border-radius: 10px; box-shadow: var(--shadow); }
.lb-bar { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--muted); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100% - 40px)); }
.toast { display: flex; gap: 11px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: rgba(20, 26, 62, .96); border: 1px solid var(--line2); box-shadow: var(--shadow); animation: slide .2s ease-out; font-size: 13px; }
.toast svg { margin-top: 1px; }
.toast.ok svg { color: var(--ok); } .toast.err svg { color: var(--err); } .toast.info svg { color: var(--brand2); }
.toast b { display: block; margin-bottom: 2px; }
.toast a { color: var(--brand2); }
.menu { position: fixed; z-index: 25; min-width: 190px; padding: 6px; border-radius: 12px; background: #141b45; border: 1px solid var(--line2); box-shadow: var(--shadow); }
.menu button { display: flex; width: 100%; align-items: center; gap: 9px; background: none; border: 0; color: var(--text); font: inherit; font-size: 13px; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.menu button:hover { background: rgba(255, 255, 255, .07); }
.menu svg { width: 16px; height: 16px; color: var(--muted); }

.m-only { display: none; }
.c-money svg { display: none; }
.mob-top { display: none; }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  .app { grid-template-columns: 76px 1fr; }
  .brand { justify-content: center; padding: 4px 0 22px; }
  .brand div, .side nav a span, .side-foot .live span, .side-foot .btn span { display: none; }
  .side nav a { justify-content: center; gap: 0; }
  .side nav a svg { width: 20px; height: 20px; }
  .side-foot .btn { gap: 0; }
  .live { justify-content: center; }
  .c-since, .c-ld { display: none; }
  .grid th:nth-child(5), .grid th:nth-child(11) { display: none; }
}

/* ---------- phone ---------- */
@media (max-width: 720px) {
  body { font-size: 14px; }
  .app { display: block; padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .mob-top {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 10;
    padding: 10px 14px; background: rgba(8, 11, 30, .9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  }
  .mob-top img { width: 30px; height: 30px; border-radius: 9px; }
  .mob-top b { flex: 1; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mob-top .live { padding: 6px 10px; }
  .mob-top .live span { display: inline; }
  /* sidebar becomes a bottom tab bar */
  .side {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 15; height: auto; width: 100%;
    flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: rgba(10, 14, 38, .96); backdrop-filter: blur(14px); border-right: 0; border-top: 1px solid var(--line2);
  }
  .brand, .side-foot .live { display: none; }
  .side nav { flex: 1; flex-direction: row; justify-content: space-around; gap: 0; }
  .side nav a { flex: 1; flex-direction: column; gap: 3px; font-size: 10.5px; padding: 7px 2px; border-radius: 10px; }
  .side nav a.active { box-shadow: none; background: rgba(24, 210, 245, .12); }
  .side nav a span { display: block; }
  .side-foot { display: none; }
  .main { padding: 16px 12px 24px; }
  .page-head { margin-bottom: 14px; align-items: stretch; }
  .page-head > div:first-child { width: 100%; }
  h2 { font-size: 20px; }
  .filters { width: 100%; }
  .filters > * { flex: 1; min-width: 0; }
  .search input { width: 100%; }
  input, select { font-size: 16px; } /* no iOS zoom */
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpi .k-val { font-size: 21px; margin-top: 8px; }
  .kpi:last-child { grid-column: 1 / -1; }
  .machines { grid-template-columns: 1fr; gap: 10px; }
  .m-card:hover { transform: none; }
  .m-foot { flex-wrap: wrap; }
  .m-foot .btn { flex: 1; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px 12px; padding: 0 12px 4px; scrollbar-width: none; }
  .chip { flex: none; }
  /* bulk bar floats above the tab bar */
  .bulk {
    position: fixed; top: auto; left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 14;
    margin: 0; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap;
  }
  .bulk .btn { flex: none; }
  /* account table → cards */
  .table-wrap { max-height: none; overflow: visible; background: none; border: 0; }
  #acc-table thead { display: none; }
  #acc-table, #acc-table tbody { display: block; }
  #acc-table tr {
    display: grid; grid-template-columns: 30px 1fr auto; column-gap: 10px; row-gap: 4px;
    grid-template-areas: "sel name menu" "sel st st" "sel reason reason" "sel meta meta" "sel money money";
    padding: 12px; margin-bottom: 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  }
  #acc-table tr.sel { border-color: rgba(24, 210, 245, .5); background: rgba(24, 210, 245, .07); }
  #acc-table tr.sel td, #acc-table tbody tr:hover td { background: none; }
  #acc-table td { display: block; padding: 0; border: 0; text-align: left; }
  #acc-table .c-sel { grid-area: sel; padding-top: 2px; }
  #acc-table .c-sel input { width: 20px; height: 20px; }
  #acc-table .c-name { grid-area: name; font-size: 15px; }
  #acc-table .c-menu { grid-area: menu; margin: -6px -6px 0 0; justify-self: end; }
  #acc-table .c-st { grid-area: st; display: flex; gap: 8px; align-items: center; }
  #acc-table .c-reason { grid-area: reason; max-width: none; white-space: normal; font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  #acc-table .c-reason:empty { display: none; }
  #acc-table .c-m, #acc-table .c-id, #acc-table .c-ld, #acc-table .c-tick, #acc-table .c-since { display: inline-flex; align-items: center; font-size: 12px; color: var(--muted); }
  #acc-table tr { grid-template-columns: 30px minmax(0, 1fr) auto; grid-template-areas: "sel name menu" "sel st st" "sel reason reason" "sel m m" "sel money earn"; }
  #acc-table .c-m { grid-area: m; }
  #acc-table .c-id, #acc-table .c-ld, #acc-table .c-tick, #acc-table .c-since { display: none; }
  #acc-table .c-money, #acc-table .c-earn { font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; }
  #acc-table .c-money { grid-area: money; }
  #acc-table .c-money svg { display: inline; width: 14px; height: 14px; color: #f5c84b; }
  #acc-table .c-earn { grid-area: earn; justify-self: end; color: var(--ok); white-space: nowrap; }
  .m-only { display: inline; }
  .empty { padding: 28px 12px; }
  /* other tables scroll sideways */
  #h-table, #cmd-table { min-width: 640px; }
  #view-hourly .table-wrap, #view-commands .table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); }
  .chart { height: 180px; }
  .files { grid-template-columns: 1fr 1fr; gap: 10px; }
  .f-thumb { height: 96px; }
  /* drawer = full screen sheet */
  .drawer-panel { width: 100%; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); border-left: 0; }
  .d-actions .btn { flex: 1 1 45%; }
  .lightbox { padding: 10px; }
  .toasts { right: 10px; left: 10px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .login-card { padding: 28px 20px 22px; }
  .menu { left: 8px !important; right: 8px; }
}
