:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0efec;
  --text: #1c1c1a;
  --text-2: #6b6a65;
  --text-3: #9a9992;
  --line: #e3e2dd;
  --line-2: #cfcec8;
  /* Xanh thuong hieu Zolo la #00AFE2. Dat nguyen mau do lam chu tren nen
     trang thi qua nhat (do tuong phan ~2,5:1), nen dung ban dam hon cho
     chu va duong dan, con mau goc de danh cho icon va mang mau. */
  --brand: #00afe2;
  --accent: #0079a0;
  --accent-bg: #e3f5fc;
  --late: #a32d2d;
  --late-bg: #fcebeb;
  --soon: #854f0b;
  --soon-bg: #faeeda;
  --ok: #0f6e56;
  --ok-bg: #e1f5ee;
  --radius: 10px;
  --nav-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171a;
    --surface: #202024;
    --surface-2: #2a2a2f;
    --text: #ececea;
    --text-2: #a3a29c;
    --text-3: #76756f;
    --line: #32323a;
    --line-2: #43434c;
    --brand: #00afe2;
    --accent: #4cc6ec;
    --accent-bg: #0b3347;
    --late: #f09595;
    --late-bg: #3d1a1a;
    --soon: #efb877;
    --soon-bg: #3d2c12;
    --ok: #7fd3b4;
    --ok-bg: #103328;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { font-weight: 600; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }

/* ---------- Dieu huong ---------- */

.nav {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.nav-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 24px;
  padding: 0 18px; height: var(--nav-h);
}
.brand { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.nav-links { display: flex; gap: 2px; }
.nav-links a {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--radius);
  font-size: 14px; color: var(--text-2);
}
.nav-links a:hover { background: var(--surface-2); color: var(--text); }
.nav-links a.on { background: var(--surface-2); color: var(--text); font-weight: 500; }
.nav-links svg { width: 18px; height: 18px; flex: none; }

@media (max-width: 720px) {
  .nav {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    border-bottom: 0; border-top: 1px solid var(--line);
    padding: 0 0 env(safe-area-inset-bottom);
  }
  .nav-inner { padding: 0; height: 58px; gap: 0; }
  .brand { display: none; }
  .nav-links { flex: 1; justify-content: space-around; }
  .nav-links a {
    flex-direction: column; gap: 3px; padding: 8px 4px;
    font-size: 10.5px; border-radius: 0; background: none !important;
  }
  .nav-links a.on { color: var(--accent); }
  .nav-links svg { width: 21px; height: 21px; }
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
}

/* ---------- Bo cuc trang ---------- */

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 18px 60px; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 18px;
}
.page-head h1 { font-size: 22px; }
.page-head .sub { color: var(--text-2); font-size: 13px; margin-top: 2px; }

.sec { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 26px 0 10px; }
.hint { color: var(--text-2); font-size: 13px; margin: -6px 0 14px; }
.hint a { color: var(--accent); text-decoration: underline; }

.empty {
  border: 1px dashed var(--line-2); border-radius: 12px;
  padding: 32px 20px; text-align: center; color: var(--text-2);
}
.empty .btn { margin-top: 12px; }

/* ---------- Nut ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--text); color: var(--surface); border-color: var(--text); }
.btn-primary:hover { opacity: 0.88; background: var(--text); }
.btn-danger { color: var(--late); border-color: var(--line-2); background: var(--surface); }
.link {
  border: 0; background: none; color: var(--accent);
  font: inherit; font-size: 13px; cursor: pointer; padding: 4px;
}

/* ---------- Bo loc ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; color: var(--text-2); cursor: pointer;
}
.chip:hover { border-color: var(--line-2); }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- Bang san xuat ---------- */

.board {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr);
  gap: 10px; overflow-x: auto; padding-bottom: 8px;
}
.col { min-width: 200px; }
.col-head {
  display: flex; justify-content: space-between;
  font-size: 12.5px; color: var(--text-2); padding: 0 4px 9px;
}
.col-body { min-height: 60px; display: flex; flex-direction: column; gap: 7px; }
.col.over .col-body { outline: 2px dashed var(--line-2); outline-offset: 4px; border-radius: 12px; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 12px; cursor: pointer;
}
.card:hover { border-color: var(--line-2); }
.card.drag { opacity: 0.4; }
.card-title { font-size: 13.5px; line-height: 1.4; }
.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 9px;
}
.who { font-size: 11.5px; color: var(--text-3); }

.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.card .dot { margin-bottom: 7px; }

/* ---------- Danh sach ---------- */

.list {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
}
.row {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px; border-top: 1px solid var(--line);
}
.row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-size: 14px; }
.row-meta { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.row.done .row-title { color: var(--text-3); text-decoration: line-through; }

.tick {
  width: 20px; height: 20px; flex: none; cursor: pointer;
  border: 1.5px solid var(--line-2); border-radius: 6px; background: none; padding: 0;
}
.tick.on { background: var(--ok); border-color: var(--ok); }

.avatar {
  width: 28px; height: 28px; flex: none; border-radius: 50%;
  background: var(--surface-2); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}

.due { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.due-late  { background: var(--late-bg); color: var(--late); }
.due-today { background: var(--soon-bg); color: var(--soon); }
.due-soon  { background: var(--soon-bg); color: var(--soon); }
.due-start { background: var(--accent-bg); color: var(--accent); }
.due-later { background: var(--surface-2); color: var(--text-3); }
.due-ok    { background: var(--surface-2); color: var(--text-3); }

.card-range { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.later-note { margin-top: 18px; }
.due-none { background: var(--surface-2); color: var(--text-3); }

/* ---------- Chon thu trong tuan ---------- */

.wd-row { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.wd { margin: 0; cursor: pointer; }
.wd input { position: absolute; opacity: 0; width: 0; height: 0; }
.wd span {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 36px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 13px; color: var(--text-2);
}
.wd input:checked + span {
  background: var(--text); color: var(--bg); border-color: var(--text);
}
.wd input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.sched-line {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 12px; padding: 9px 12px;
  background: var(--accent-bg); border-radius: var(--radius);
  font-size: 12.5px; color: var(--accent);
}
.sched-line b { font-weight: 500; }
.sched-next { color: var(--text-2); }
.sched-dot { color: var(--brand); font-size: 10px; vertical-align: 2px; }

/* ---------- Cong tac bat/tat thong bao ---------- */

.notif-row { cursor: pointer; }
.notif-row .row-title, .notif-row .row-meta { display: block; }

.switch { flex: none; display: inline-flex; align-items: center; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  width: 38px; height: 22px; border-radius: 999px;
  background: var(--line-2); position: relative;
  transition: background 0.15s;
}
.switch-track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.thr { flex: none; display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--text-2); }
.thr input { width: 74px; height: 34px; margin: 0; text-align: right; }

.saved {
  margin-left: 10px; font-size: 13px; color: var(--ok);
}
.gone-box {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 16px;
  border: 1px solid var(--border-late, var(--line-2)); border-radius: 12px;
  background: var(--late-bg); color: var(--late); font-size: 13px;
}
.gone-box .muted { color: var(--late); opacity: 0.75; font-size: 12px; }
.vid-gone .vid-title { color: var(--text-3); text-decoration: line-through; }
.vid-gone .vid-thumb { filter: grayscale(1); opacity: 0.6; }

.sync-warn {
  padding: 9px 12px; margin-bottom: 12px;
  border-radius: var(--radius);
  background: var(--soon-bg); color: var(--soon); font-size: 12.5px;
}
.canh-loi {
  display: inline-block; margin-left: 10px; padding: 4px 10px;
  border-radius: var(--radius);
  background: var(--late-bg); color: var(--late); font-size: 12.5px;
}

/* ---------- Man hinh Lich dang ---------- */

.batch {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 12px;
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 12px; position: sticky; top: calc(var(--nav-h) + 4px); z-index: 15;
}
.batch-n { font-size: 13px; color: var(--text-2); }
.batch select, .batch input[type=number] { width: auto; height: 34px; margin: 0; }
.batch input[type=number] { width: 68px; }
.batch #b-every { font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.batch .wd-row { margin: 0; }
.batch .wd span { width: 34px; height: 32px; font-size: 12px; }
.tbl input[type=checkbox] { width: auto; height: auto; margin: 0; }

.cal {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 6px;
}
.cal-day {
  min-height: 66px; padding: 7px 8px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface);
}
.cal-has { border-color: var(--line-2); }
.cal-today { border-color: var(--brand); border-width: 2px; padding: 6px 7px; }
.cal-n { font-size: 14px; font-weight: 600; }
.cal-w { font-size: 10.5px; color: var(--text-3); margin-left: 5px; }
.cal-ch {
  display: flex; align-items: center; gap: 5px; margin-top: 4px;
  font-size: 10.5px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-ch .dot { width: 5px; height: 5px; }

@media (max-width: 720px) {
  .batch { position: static; }
  .cal { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
}
.sec-n {
  display: inline-block; margin-left: 4px; padding: 1px 6px;
  border-radius: 999px; background: var(--surface-2);
  font-size: 11px; color: var(--text-3); font-weight: 400;
}

/* ---------- The kenh ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; cursor: pointer;
}
.panel:hover { border-color: var(--line-2); }
.panel-head { display: flex; align-items: center; gap: 10px; }
.panel-title { font-size: 15px; font-weight: 500; }
.panel-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.panel-head .count { margin-left: auto; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.yt-bar {
  display: flex; gap: 4px; margin-top: 14px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.yt-cell { flex: 1; min-width: 0; text-align: center; }
.yt-cell .n { display: block; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.yt-cell .l {
  display: block; font-size: 10.5px; color: var(--text-3); margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* ---------- Thanh chon pham vi xem (chi quan tri thay) ---------- */

.scope { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.scope-inner {
  max-width: 1180px; margin: 0 auto; padding: 8px 18px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.scope-label { font-size: 12px; color: var(--text-3); margin-right: 2px; }
.scope .chip { background: var(--surface); font-size: 12.5px; padding: 4px 10px; }
.scope .chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

@media (max-width: 720px) {
  .scope-inner { padding: 8px 14px calc(8px); }
  .scope { position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top, 0px); }
}

/* ---------- Anh dai dien kenh ---------- */

.ch-ava {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  object-fit: cover; outline: 2px solid transparent; outline-offset: 1px;
}
.ch-ava-none {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 600; outline: 0;
}
.ch-ava-big {
  width: 52px; height: 52px; flex: none;
  border-radius: 50%; object-fit: cover;
}
span.ch-ava-big { font-size: 20px; }
.ch-head { display: flex; align-items: center; gap: 14px; }

/* ---------- Trang chi tiet kenh ---------- */

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
.stat-l { display: block; font-size: 12px; color: var(--text-3); }
.stat-n {
  display: block; font-size: 21px; font-weight: 600;
  letter-spacing: -0.02em; margin: 2px 0 1px;
}

.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chart-box {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px 10px;
}
.chart-box .sec { margin: 0 0 8px; }
.chart-wrap { position: relative; }
.chart { display: block; width: 100%; height: 150px; }
.chart-line { stroke: var(--brand); stroke-width: 2; fill: none; vector-effect: non-scaling-stroke; }
.chart-fill { fill: var(--brand); opacity: 0.10; }
.chart-grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-axis {
  position: absolute; top: 4px; right: 0; bottom: 20px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-size: 10.5px; color: var(--text-3); pointer-events: none;
}
.chart-x { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-3); }
.chart-empty { font-size: 12.5px; color: var(--text-3); padding: 44px 0; text-align: center; }

.vid-thumb-big {
  width: 96px; height: 54px; flex: none;
  border-radius: 7px; object-fit: cover;
}
.vid-h1 { font-size: 18px; line-height: 1.35; }
.ch-head .sub .dot { vertical-align: middle; }

.vid { display: flex; align-items: center; gap: 10px; max-width: 420px; }
.vid-thumb { width: 60px; height: 34px; flex: none; border-radius: 5px; object-fit: cover; }
.vid-title { font-size: 13px; line-height: 1.35; }
.vid:hover .vid-title { color: var(--accent); }

@media (max-width: 720px) {
  .stat-row { grid-template-columns: 1fr; }
  .chart-row { grid-template-columns: 1fr; }
}

/* ---------- Bang kenh ---------- */

.filter-label { font-size: 13px; color: var(--text-2); align-self: center; margin-right: 2px; }
.chip-n { opacity: 0.55; font-size: 11.5px; margin-left: 1px; }
.cmd {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 12px; color: var(--text-2); word-break: break-all;
  background: var(--surface-2); padding: 2px 6px; border-radius: 5px;
}
.tbl .over { color: var(--late); font-weight: 500; }

.cfg-val {
  font-variant-numeric: tabular-nums; font-size: 14px; font-weight: 500;
  white-space: nowrap; margin-left: auto;
}
.filter-note { font-size: 12px; color: var(--text-3); align-self: center; margin-left: 4px; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  font-weight: 500; font-size: 12px; color: var(--text-2);
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.tbl th a { display: block; }
.tbl th a:hover { color: var(--text); }
.tbl th.on { color: var(--text); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--surface-2); }

/* Ghim cot ten kenh khi cuon ngang, neu khong nguoi xem mat dau dang doc hang nao. */
.tbl th:first-child, .tbl td:first-child {
  position: sticky; left: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.tbl th:first-child { z-index: 3; }
.tbl td:first-child { z-index: 1; }
.tbl tbody tr:hover td:first-child { background: var(--surface-2); }

.col-left   { text-align: left; }
.col-right  { text-align: right; }
.col-center { text-align: center; }
.tbl .num   { font-variant-numeric: tabular-nums; }
.tbl .small { font-size: 12px; white-space: nowrap; }
.tbl .muted { color: var(--text-3); }

.ch-name { display: flex; align-items: center; gap: 9px; }
.ch-name .dot { margin: 0; }
.ch-title { display: block; font-weight: 500; white-space: nowrap; }
.ch-sub { display: block; font-size: 11.5px; color: var(--text-3); white-space: nowrap; }
.ch-err {
  display: inline-block; margin-top: 5px; padding: 2px 7px; border-radius: 6px;
  background: var(--soon-bg); color: var(--soon); font-size: 11px;
}

.delta { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 12.5px; }
.delta-up   { color: var(--ok); }
.delta-down { color: var(--late); }
.delta-none { color: var(--text-3); }

.spark-cell { width: 100px; padding: 6px 8px; }
.spark-cell .spark { width: 90px; height: 26px; }

.spark-wrap { margin-top: 12px; }
.spark { display: block; width: 100%; height: 34px; }
.spark-line { stroke: var(--ok); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark-fill { fill: var(--ok); opacity: 0.12; }
.spark-cap { display: block; font-size: 10.5px; color: var(--text-3); margin-top: 3px; }

.yt-err {
  margin-top: 12px; padding: 8px 10px; border-radius: 8px;
  background: var(--soon-bg); color: var(--soon); font-size: 12px;
}

.stage-bar { display: flex; gap: 4px; margin-top: 14px; }
.stage-cell {
  flex: 1; text-align: center; padding: 7px 2px;
  background: var(--surface-2); border-radius: 8px; min-width: 0;
}
.stage-cell .n { display: block; font-size: 14px; font-weight: 600; color: var(--text-3); }
.stage-cell.has .n { color: var(--text); }
.stage-cell .l {
  display: block; font-size: 9.5px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- Bang truot / hop thoai ---------- */

.sheet {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.4);
  display: flex; align-items: flex-end; justify-content: center;
}
/* Bat buoc: display:flex o tren se de len thuoc tinh hidden cua trinh duyet,
   khong co dong nay thi hop thoai luon hien va chan het thao tac tren trang. */
.sheet[hidden] { display: none; }
.sheet-box {
  background: var(--surface); width: 100%; max-width: 460px;
  border-radius: 16px 16px 0 0; padding: 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto;
}
@media (min-width: 721px) {
  .sheet { align-items: center; }
  .sheet-box { border-radius: 16px; }
}
.sheet h2 { font-size: 17px; margin-bottom: 16px; }
.sheet-actions { display: flex; gap: 8px; margin-top: 20px; }
.sheet-actions .btn { flex: 1; justify-content: center; }
.sheet-actions .spacer { flex: 1; }

/* ---------- Bieu mau ---------- */

label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 12px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px;
  height: 40px; padding: 0 11px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 15px;
}
textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.err {
  background: var(--late-bg); color: var(--late);
  padding: 9px 12px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 14px;
}

/* ---------- Trang dang nhap ---------- */

.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 26px; width: 100%; max-width: 360px;
}
.auth h1 { font-size: 19px; margin-bottom: 16px; }
.auth .btn { width: 100%; justify-content: center; margin-top: 6px; height: 42px; }

/* ---------- Vung an toan cua man hinh co tai tho ---------- *
 * Khoi nay PHAI dat cuoi file. Tren dien thoai thanh dieu huong nam duoi
 * day nen khong con ai chua cho cho Dynamic Island o dau trang, va quy tac
 * `.wrap { padding: ... }` viet tat o tren se xoa moi padding-top dat truoc no.
 */
@media (max-width: 720px) {
  .wrap {
    padding-top: calc(24px + env(safe-area-inset-top, 0px));
    /* Xoay ngang may thi tai tho an vao canh ben, khong phai canh tren. */
    padding-left: calc(18px + env(safe-area-inset-left, 0px));
    padding-right: calc(18px + env(safe-area-inset-right, 0px));
  }
  .auth-page { padding-top: calc(20px + env(safe-area-inset-top, 0px)); }
  .sheet-box { max-height: calc(88vh - env(safe-area-inset-top, 0px)); }
  .nav-inner {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
}
