/* Sổ sức khoẻ — khung kiểu trang quản trị (menu trái, thanh trên, thẻ trắng bóng nhẹ),
   theo mẫu admin Bạch Đằng / BKNS. Xanh dương là màu thao tác; xanh lá = ngày sạch, đỏ = có hút.
   Dấu ấn riêng giữ lại: lưới chấm "ngày sạch" như hàng vòng tròn tô tay trên sổ giấy. */

:root {
  --bg: #F4F5F9;
  --card: #FFFFFF;
  --ink: #2F3349;
  --ink-2: #4B5068;
  --muted: #80859A;
  --line: #E8EAF0;
  --field: #D8DBE4;
  --tint: #F5F6FA;
  --primary: #2F5FD0;
  --primary-hover: #244DB3;
  --primary-ink: #FFFFFF;
  --primary-soft: #E8EEFC;
  --green: #18A06C;
  --green-soft: #DDF4EA;
  --red: #E5484D;
  --red-ink: #FFFFFF;
  --red-soft: #FDECEC;
  --amber-soft: #FFF4E0;
  --shadow: 0 2px 10px rgba(47, 51, 73, .07);
  --shadow-up: 0 6px 18px rgba(47, 95, 208, .28);
  --radius: 12px;
  --radius-sm: 8px;
  --side-w: 264px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #25293C;
    --card: #2F3349;
    --ink: #E4E6F1;
    --ink-2: #BFC3D6;
    --muted: #9196AD;
    --line: #3D4259;
    --field: #4A5068;
    --tint: #353A52;
    --primary: #7B9CFF;
    --primary-hover: #94AFFF;
    --primary-ink: #141A33;
    --primary-soft: #39447A;
    --green: #45D49A;
    --green-soft: #284A42;
    --red: #FF7A7E;
    --red-ink: #2A1014;
    --red-soft: #4C2D38;
    --amber-soft: #4A3F2A;
    --shadow: 0 2px 12px rgba(0, 0, 0, .22);
    --shadow-up: 0 6px 18px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
}
a { color: var(--primary); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
small { font-size: .8em; font-weight: 400; color: var(--muted); }
.muted { color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: -999px; top: 8px; }
.skip:focus { left: 8px; z-index: 100; background: var(--card); padding: 8px 12px; }
.ico {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- khung: menu trái + cột chính ---------- */
.shell { min-height: 100vh; }
.side {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--side-w);
  display: flex; flex-direction: column;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow-y: auto; overscroll-behavior: contain;
}
.side__head { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 14px 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand__mark {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--primary); color: var(--primary-ink);
}
.brand__mark .ico { width: 22px; height: 22px; stroke-width: 2.2; }
.brand__text { display: grid; line-height: 1.2; }
.brand__name { font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand__sub { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--primary); }
.side__nav { flex: 1; padding: 4px 14px 12px; }
.side__group {
  margin: 20px 12px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted);
}
.side__nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side__link {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 44px; padding: 10px 14px; border-radius: var(--radius-sm);
  font: inherit; font-size: 15px; font-weight: 500; color: var(--ink-2); text-decoration: none;
  background: none; border: 0; cursor: pointer; text-align: left;
  transition: background-color .15s, color .15s;
}
.side__link:hover { background: var(--tint); color: var(--ink); }
.side__link[aria-current="page"] {
  background: var(--primary); color: var(--primary-ink); font-weight: 600;
  box-shadow: var(--shadow-up);
}
.side__link--crave:not([aria-current]) .ico { color: var(--red); }
.side__link--crave[aria-current="page"] { background: var(--red); color: var(--red-ink); box-shadow: 0 6px 18px rgba(229, 72, 77, .3); }
.side__foot { margin: 0; padding: 12px 14px 18px; border-top: 1px solid var(--line); }
.iconbtn.side__close { display: none; }
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(20, 24, 40, .45); }
.scrim[hidden] { display: none; }

.maincol { margin-left: var(--side-w); padding: 16px 28px 0; min-width: 0; }

/* ---------- thanh trên ---------- */
.topbar {
  position: sticky; top: 12px; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  min-height: 64px; padding: 10px 14px 10px 22px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
}
.iconbtn.topbar__menu, .topbar__brand { display: none; }
.topbar__date { margin: 0 auto 0 0; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.iconbtn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
  border: 0; border-radius: 50%; background: var(--tint); color: var(--ink-2); cursor: pointer;
}
.iconbtn:hover { color: var(--primary); }
.crave-btn {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm);
  background: var(--red); color: var(--red-ink); font-weight: 600; font-size: 14px; text-decoration: none;
  box-shadow: 0 4px 12px rgba(229, 72, 77, .28);
}
.crave-btn .ico { width: 18px; height: 18px; }
.crave-btn:hover { filter: brightness(1.06); }
.me { display: flex; align-items: center; gap: 10px; padding-left: 12px; border-left: 1px solid var(--line); }
.me__avatar {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary); color: var(--primary-ink); font-weight: 700;
  position: relative;
}
.me__avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.me__avatar::after {
  content: ""; position: absolute; right: 0; bottom: 1px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 2px var(--card);
}
.me__text { display: grid; line-height: 1.25; text-align: right; }
.me__text b { font-size: 14px; }
.me__text small { font-size: 12px; }

/* ---------- đầu trang: ô icon + tiêu đề + đường dẫn ---------- */
.content { padding: 26px 0 8px; }
.pagehead { display: flex; align-items: flex-start; gap: 16px; margin: 0 0 22px; }
.pagehead__icon {
  display: inline-grid; place-items: center; flex: none;
  width: 52px; height: 52px; border-radius: var(--radius);
  background: var(--primary-soft); color: var(--primary);
}
.pagehead__icon .ico { width: 24px; height: 24px; }
.pagehead__title { margin: 0; font-size: clamp(24px, 3.4vw, 30px); font-weight: 700; line-height: 1.2; letter-spacing: -.015em; }
.pagehead__sub { margin: 4px 0 0; color: var(--ink-2); }
.crumbs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--primary); }
.crumbs > * + *::before { content: "/"; margin-right: 6px; color: var(--field); }
.crumbs [aria-current] { color: var(--ink); font-weight: 600; }

/* ---------- chữ ---------- */
.eyebrow {
  margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.big { font-size: 17px; margin: 0 0 8px; }
.big b { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.note {
  margin: 0 0 18px; padding: 12px 16px;
  background: var(--primary-soft); border-radius: var(--radius-sm); color: var(--ink);
  font-size: 15px;
}

/* ---------- thẻ ---------- */
.panel, .today {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 24px 24px; margin: 0 0 22px;
}
.panel__title, .today__title {
  margin: -22px -24px 18px; padding: 18px 24px;
  font-size: 18px; font-weight: 600; line-height: 1.3;
  border-bottom: 1px solid var(--line);
}
.panel > :last-child { margin-bottom: 0; }

/* ---------- thông báo ---------- */
.flash {
  margin: 0 0 18px; padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--green-soft); color: var(--ink); font-size: 15px; font-weight: 500;
}
.flash--err { background: var(--red-soft); }

/* ---------- form ---------- */
.stack { display: grid; gap: 16px; }
.fld { display: grid; gap: 6px; }
.fld > span { font-size: 14px; font-weight: 600; color: var(--ink); }
input, textarea, select {
  font: inherit; color: var(--ink);
  width: 100%; min-height: 46px; padding: 10px 14px;
  background: var(--card); border: 1px solid var(--field); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
textarea { min-height: 0; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 22px;
  font: inherit; font-weight: 600;
  color: var(--primary-ink); background: var(--primary);
  border: 0; border-radius: var(--radius-sm); cursor: pointer; text-decoration: none;
  box-shadow: 0 3px 10px rgba(47, 95, 208, .22);
  transition: background-color .15s;
}
.btn:hover { background: var(--primary-hover); }
.btn--ghost { color: var(--primary); background: var(--primary-soft); box-shadow: none; }
.btn--ghost:hover { background: var(--primary-soft); filter: brightness(.97); }
.linkbtn {
  font: inherit; font-size: 14px; color: var(--muted);
  background: none; border: 0; padding: 4px; cursor: pointer; text-decoration: underline;
}
.linkbtn--danger {
  color: var(--red); text-decoration: none; font-weight: 600; font-size: 13px;
  padding: 5px 10px; border-radius: 6px; background: var(--red-soft);
}
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }

/* ---------- trang Hôm nay: 2 cột ---------- */
.dash { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 0 22px; align-items: start; }

/* ghi sổ */
.today__head { display: flex; align-items: center; gap: 12px; margin: -22px -24px 18px; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.today__head .eyebrow { order: 2; margin-left: auto; }
.today__head .today__title { margin: 0; padding: 0; border: 0; }
.pickday { order: 3; }
.pickday input { width: auto; min-height: 38px; padding: 6px 10px; font-size: 14px; }
.logform { display: grid; gap: 16px; }
.fld--big input {
  font-size: 30px; font-weight: 700; letter-spacing: -.02em;
  min-height: 64px; font-variant-numeric: tabular-nums;
}
.smoke, .chips { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.smoke legend, .chips legend { font-size: 14px; font-weight: 600; color: var(--ink); padding: 0; margin-bottom: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--field); border-radius: var(--radius-sm); cursor: pointer;
  font-size: 15px; background: var(--card);
  transition: border-color .15s, background-color .15s;
}
.chip:hover { border-color: var(--primary); }
.chip input { width: auto; min-height: 0; margin: 0; accent-color: var(--primary); }
.chip:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--ink); font-weight: 600; }
.chip--clean:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.chip--clean input { accent-color: var(--green); }
.chip--smoked:has(input:checked) { border-color: var(--red); background: var(--red-soft); }
.chip--smoked input { accent-color: var(--red); }
.fld--inline input { width: 120px; }
/* Ô số thuốc chỉ hiện khi chọn "Có hút" (trình duyệt cũ thì luôn hiện). */
.smoke:has(input[value="clean"]:checked) .fld--inline { display: none; }
.more { border: 1px dashed var(--field); border-radius: var(--radius-sm); padding: 4px 14px; }
.more summary { cursor: pointer; color: var(--ink-2); font-size: 14px; font-weight: 500; padding: 8px 0; }
.more[open] { padding-bottom: 14px; }
.more[open] summary { margin-bottom: 6px; }
.more .fld + .fld { margin-top: 12px; }
.logform > .btn { justify-self: start; min-width: 200px; }

/* ---------- bỏ thuốc ---------- */
.streak { display: flex; align-items: center; gap: 16px; margin: 0 0 16px; }
.streak__n {
  display: inline-grid; place-items: center; flex: none;
  min-width: 84px; height: 84px; padding: 0 12px; border-radius: 50%;
  background: var(--green-soft); color: var(--green);
  font-weight: 700; font-size: 40px; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.streak__l { font-size: 17px; font-weight: 600; line-height: 1.35; }
.phase { padding: 12px 16px; background: var(--tint); border-radius: var(--radius-sm); }
.phase p { margin: 0; }
.phase__t { font-weight: 700; margin-bottom: 2px !important; }
.phase--lapse { background: var(--red-soft); }
.mile { margin: 14px 0 0; font-size: 15px; }
.mile__k { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--green); }
.mile--next .mile__k { color: var(--muted); }

/* Lưới chấm ngày sạch: 7 cột, thứ 2 đầu hàng. */
.dots {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px 4px;
  justify-items: center; margin-top: 20px; padding: 14px 8px;
  background: var(--tint); border-radius: var(--radius-sm);
}
.dots__h { font-size: 11px; font-weight: 600; color: var(--muted); }
.dot {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--field); font-size: 12px; font-weight: 700; text-decoration: none;
  color: var(--red); background: var(--card);
  transition: transform .12s;
}
a.dot:hover { transform: scale(1.12); }
.dot--clean { background: var(--green); border-color: var(--green); }
.dot--smoked { border-color: var(--red); background: var(--red-soft); }
.dot--blank { border-style: dashed; border-color: var(--muted); }
.dot--before { border-color: var(--line); background: var(--line); }
.dot--future { border-color: var(--line); background: transparent; }
.dot--today { box-shadow: 0 0 0 2px var(--tint), 0 0 0 4px var(--primary); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; color: var(--muted); margin: 12px 0 0; }
.legend .dot { width: 16px; height: 16px; font-size: 9px; border-width: 1.5px; vertical-align: middle; margin-right: -8px; }

/* ---------- số liệu ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0 0 6px; }
.stats div { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.stats dt { font-size: 13px; color: var(--muted); font-weight: 500; }
.stats dd {
  margin: 2px 0 0; font-weight: 700; font-size: 24px; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stats dd small { display: block; font-size: 12.5px; font-weight: 500; letter-spacing: 0; }
.stats--3 { grid-template-columns: repeat(3, 1fr); }
.stats .was { display: block; font-size: 12px; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.chartbox { margin: 18px 0 0; }
.chartbox figcaption { font-size: 13px; color: var(--muted); margin-top: 8px; }
.wchart { width: 100%; height: auto; display: block; overflow: visible; }
.wchart .g { stroke: var(--line); stroke-width: 1; }
.wchart .ax { fill: var(--muted); font-size: 10px; font-family: "Be Vietnam Pro", system-ui, sans-serif; }
.wchart .goal { stroke: var(--red); stroke-width: 1.2; stroke-dasharray: 5 4; }
.wchart .goal-t { fill: var(--red); font-size: 10px; font-weight: 600; font-family: "Be Vietnam Pro", system-ui, sans-serif; }
.wchart .pt { fill: var(--card); stroke: var(--muted); stroke-width: 1.3; }
.wchart .avg { fill: none; stroke: var(--primary); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }

.bar { height: 10px; background: var(--tint); border-radius: 999px; overflow: hidden; margin: 6px 0 14px; }
.bar span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }

/* ---------- xu hướng + dự báo cân ---------- */
.trend { margin: 16px 0 0; padding: 14px 16px; background: var(--tint); border-radius: var(--radius-sm); }
.trend__rate { margin: 0 0 6px; }
.trend__rate b { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.trend__k { display: block; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.trend__goals { list-style: none; margin: 0; padding: 0; }
.trend__goals li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; }
.trend__goals li > span { min-width: 9em; color: var(--ink-2); }
.trend .muted { margin: 8px 0 0; font-size: 14px; }

/* Lời gợi ý một câu (chạy hôm nay, …) dùng lại khối .phase. */
p.phase { margin: 0 0 10px; }
.note--cta { font-weight: 500; }
.note .mile__k { color: var(--primary); margin-bottom: 2px; }

/* ---------- bảng ---------- */
.tablewrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel .tablewrap { margin: 0 -24px; border-radius: 0; box-shadow: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.panel .tablewrap + * { margin-top: 16px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { padding-left: 24px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 24px; }
.tbl thead th { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--tint); }
.tbl tbody tr:hover th, .tbl tbody tr:hover td { background: var(--tint); }
.tbl tbody th { font-weight: 600; }
.tbl .n { text-align: right; }
.tbl .down { color: var(--green); font-weight: 600; }
.tbl .up { color: var(--red); font-weight: 600; }
.tbl .hit::after { content: " ✓"; color: var(--green); }
.tbl tr.empty { color: var(--muted); }
.tbl .clip { max-width: 240px; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.tbl tr:last-child th, .tbl tr:last-child td { border-bottom: 0; }
.tbl tr.now th, .tbl tr.now td { background: var(--primary-soft); }
.tbl tr.future { color: var(--muted); }
.tbl .short { color: var(--red); font-weight: 600; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 15px; }

.tag { display: inline-block; padding: 2px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.tag--clean { background: var(--green-soft); color: var(--green); }
.tag--smoked { background: var(--red-soft); color: var(--red); }

.hbars { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.hbars li { display: grid; grid-template-columns: minmax(110px, 34%) 1fr auto; align-items: center; gap: 12px; font-size: 15px; }
.hbars__b { height: 10px; background: var(--tint); border-radius: 999px; overflow: hidden; }
.hbars__b span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.hbars__n { font-weight: 700; font-variant-numeric: tabular-nums; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.list li:last-child { border-bottom: 0; }
.list__when { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.qs { margin: 0; padding-left: 22px; }
.qs li { margin: 4px 0; }

/* ---------- tháng ---------- */
.monthnav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0 0 16px; font-size: 14px; font-weight: 600; }
.monthnav a { padding: 6px 12px; border-radius: var(--radius-sm); background: var(--primary-soft); text-decoration: none; }
.review .fld + .fld { margin-top: 0; }

/* ---------- đang thèm ---------- */
.crave-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 22px; align-items: start; }
.crave { text-align: center; }
.crave__title { margin: 0 auto 6px; max-width: 18ch; font-size: 24px; font-weight: 700; line-height: 1.25; letter-spacing: -.015em; text-wrap: balance; }
.crave__day { max-width: 520px; margin: 0 auto 10px; font-size: 15px; color: var(--ink-2); }
.crave__day b { color: var(--green); }
.breath { display: grid; justify-items: center; gap: 8px; padding: 10px 0 4px; }
.breath__ring {
  width: 220px; height: 220px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle, var(--card) 58%, var(--primary-soft) 59%);
  box-shadow: inset 0 0 0 2px var(--line);
}
.breath__core {
  width: 200px; height: 200px; border-radius: 50%;
  background: var(--primary-soft); border: 3px solid var(--primary);
  transform: scale(.5);
  transition: transform 4s ease-in-out;
}
.breath.is-in .breath__core { transform: scale(1); transition-duration: 4s; }
.breath.is-hold .breath__core { transform: scale(1); }
.breath.is-out .breath__core { transform: scale(.5); transition-duration: 6s; }
.breath__time {
  margin: 6px 0 0; font-size: 44px; font-weight: 700; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.breath__cue { margin: 0 0 6px; min-height: 1.6em; font-size: 17px; font-weight: 500; color: var(--ink-2); }
.tips { list-style: none; padding: 16px 0 0; margin: 18px auto 0; max-width: 420px; text-align: left; display: grid; gap: 8px; border-top: 1px solid var(--line); }
.tips li { padding-left: 20px; position: relative; color: var(--ink-2); }
.tips li::before { content: ""; position: absolute; left: 2px; top: .6em; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.chip--num { min-width: 52px; justify-content: center; }
.chip input[type="checkbox"] { accent-color: var(--primary); }
.sym { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.sym div { padding: 12px 14px; background: var(--tint); border-radius: var(--radius-sm); }
.sym dt { font-weight: 600; }
.sym dd { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.expect { margin-top: 12px; }
.expect summary { cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink-2); padding: 4px 0; }
.expect[open] summary { margin-bottom: 10px; }
.expect .sym { grid-template-columns: 1fr; }
.expect .muted { font-size: 14px; margin: 10px 0 0; }
.panel .note:last-child { margin-bottom: 0; margin-top: 16px; background: var(--amber-soft); }

/* ---------- đăng nhập ---------- */
.gatewrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate { width: 100%; max-width: 420px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px 28px; }
.gate__brand { display: flex; align-items: center; gap: 10px; margin: 0 0 22px; font-weight: 700; font-size: 17px; }
.gate__title { font-size: 26px; font-weight: 700; margin: 0 0 8px; letter-spacing: -.015em; }
.gatewrap .flash { width: 100%; max-width: 420px; }

/* ---------- chân trang ---------- */
.foot { padding: 4px 0 28px; font-size: 13px; color: var(--muted); }

/* ---------- màn hẹp ---------- */
@media (min-width: 1440px) {
  .dash__main .stats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1180px) {
  .dash { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .22s ease; box-shadow: none; }
  .nav-open .side { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  .nav-open { overflow: hidden; }
  .iconbtn.side__close { display: inline-grid; }
  .maincol { margin-left: 0; padding: 10px 14px 0; }
  .topbar { top: 8px; min-height: 58px; padding: 8px 10px; gap: 10px; }
  .iconbtn.topbar__menu { display: inline-grid; }
  .topbar__brand { display: flex; align-items: center; gap: 8px; margin-right: auto; color: var(--ink); text-decoration: none; }
  .topbar__brand .brand__mark { width: 32px; height: 32px; border-radius: 9px; }
  .topbar__brand .brand__mark .ico { width: 18px; height: 18px; }
  .topbar__brand .brand__name { font-size: 16px; }
  .topbar__date, .me { display: none; }
  .content { padding-top: 20px; }
  .crave-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 15px; }
  .panel, .today { padding: 18px 16px 20px; margin-bottom: 16px; }
  .panel__title { margin: -18px -16px 16px; padding: 15px 16px; }
  .today__head { margin: -18px -16px 16px; padding: 12px 16px; flex-wrap: wrap; }
  .today__head .eyebrow { order: 0; width: 100%; margin: 0; }
  .today__head .today__title { font-size: 17px; }
  .pickday { margin-left: auto; }
  .panel .tablewrap { margin: 0 -16px; }
  .tbl th:first-child, .tbl td:first-child { padding-left: 16px; }
  .tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
  .pagehead { gap: 12px; margin-bottom: 18px; }
  .pagehead__icon { width: 44px; height: 44px; border-radius: 10px; }
  .pagehead__sub { font-size: 14px; }
  .crave-btn { padding: 8px 12px; }
  .stats--3 { grid-template-columns: repeat(2, 1fr); }
  .logform > .btn { justify-self: stretch; }
}
@media (max-width: 420px) {
  .row2 { grid-template-columns: 1fr; }
  .streak__n { min-width: 70px; height: 70px; font-size: 32px; }
  .dot { width: 28px; height: 28px; }
  .hbars li { grid-template-columns: 1fr auto; }
  .hbars__b { grid-column: 1 / -1; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) {
  *, .breath__core { transition: none !important; }
}

/* Bảng nằm đầu thẻ: dính sát mép trên, không chừa khoảng trống. */
.panel > .tablewrap:first-child { margin-top: -22px; border-top: 0; border-radius: var(--radius) var(--radius) 0 0; }
@media (max-width: 560px) { .panel > .tablewrap:first-child { margin-top: -18px; } }

/* ---------- hình dáng ---------- */
.panel__bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  margin: -22px -24px 18px; padding: 12px 24px; border-bottom: 1px solid var(--line);
}
.panel__bar .panel__title { margin: 0; padding: 6px 0; border: 0; }
.panel__title small { font-size: 13px; font-weight: 500; margin-left: 6px; }
.pairpick { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.pairpick select { width: auto; min-height: 40px; padding: 6px 30px 6px 12px; font-size: 14px; }
.cmp__span { margin: 0 0 18px; color: var(--ink-2); }
.cmp__span .down { color: var(--green); }
.cmp__span .up { color: var(--red); }
.cmp { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); gap: 24px; align-items: start; }
.cmp__shape { margin: 0; padding: 16px 12px 12px; background: var(--tint); border-radius: var(--radius-sm); text-align: center; }
.shape { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto; }
.shape__b { fill: var(--primary-soft); stroke: var(--primary); stroke-width: 1.6; stroke-linejoin: round; }
.shape__a { fill: none; stroke: var(--ink-2); stroke-width: 1.4; stroke-dasharray: 4 3; stroke-linejoin: round; }
.cmp__shape figcaption { margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.cmp__shape figcaption small { display: block; margin-top: 6px; }
.key { display: inline-block; width: 18px; height: 10px; border-radius: 3px; vertical-align: middle; margin: 0 2px 0 8px; }
.key--a { border: 1.5px dashed var(--ink-2); }
.key--b { background: var(--primary-soft); border: 1.5px solid var(--primary); }
.cmp__table .note { margin: 14px 0 0; background: var(--green-soft); }
.tbl--plain { border: 1px solid var(--line); border-radius: var(--radius-sm); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.tbl--plain th:first-child, .tbl--plain td:first-child { padding-left: 14px; }
.tbl--plain th:last-child, .tbl--plain td:last-child { padding-right: 14px; }
.tbl--plain tbody th small { display: block; font-weight: 400; }
.sub { margin: 26px 0 12px; font-size: 16px; font-weight: 600; }
.sub small { font-size: 13px; margin-left: 6px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.compare, .shot { margin: 0; }
.compare figcaption, .shot figcaption { margin-top: 8px; font-size: 14px; font-weight: 600; text-align: center; }
.shot img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius-sm); background: var(--tint); display: block; }
/* Không JS: 2 ảnh đứng cạnh nhau. Có JS: chồng lên nhau, kéo thanh để mở. */
.compare__stage { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.compare__stage img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius-sm); background: var(--tint); display: block; }
.compare__a { order: -1; }
.compare__tag {
  position: absolute; top: 8px; padding: 2px 8px; border-radius: 6px;
  background: rgba(20, 24, 40, .62); color: #fff; font-size: 12px; font-weight: 600; pointer-events: none;
}
.compare__tag--a { left: 8px; }
.compare__tag--b { right: 8px; }
.is-slider .compare__stage { display: block; --pos: 50%; border-radius: var(--radius-sm); overflow: hidden; touch-action: pan-y; }
.is-slider .compare__stage img { border-radius: 0; }
.is-slider .compare__a { position: absolute; inset: 0; height: 100%; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.is-slider .compare__stage::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: var(--pos); width: 3px; margin-left: -1.5px;
  background: #fff; box-shadow: 0 0 6px rgba(0, 0, 0, .4); pointer-events: none;
}
.compare__range {
  position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0;
  opacity: 0; cursor: ew-resize; border: 0;
}
.compare__range:focus-visible { opacity: .01; }
.is-slider .compare__stage:has(.compare__range:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }

.body-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 0 22px; align-items: start; }
.fld--short input { max-width: 220px; }
.poses { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.poses legend { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 8px; }
.pose { position: relative; display: grid; gap: 6px; cursor: pointer; }
.pose input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.pose__img {
  display: grid; place-items: center; aspect-ratio: 3 / 4;
  border: 1.5px dashed var(--field); border-radius: var(--radius-sm); background: var(--tint) center / cover no-repeat;
  color: var(--muted); transition: border-color .15s;
}
.pose__img .ico { width: 28px; height: 28px; }
.pose__img.has-img { border-style: solid; border-color: var(--primary); }
.pose__img.has-img .ico { display: none; }
.pose:hover .pose__img, .pose:has(input:focus-visible) .pose__img { border-color: var(--primary); color: var(--primary); }
.pose__label { font-size: 13px; font-weight: 600; text-align: center; color: var(--ink-2); }
.measures { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tips--left { margin: 0; padding: 0; max-width: none; border: 0; }

.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.checks li:last-child { border-bottom: 0; padding-bottom: 0; }
.checks li:first-child { padding-top: 0; }
.checks__thumbs { display: flex; gap: 4px; }
.checks__thumbs img, .checks__thumbs span { width: 42px; height: 56px; border-radius: 6px; object-fit: cover; background: var(--tint); display: block; }
.checks__info { display: grid; gap: 2px; min-width: 0; font-size: 14px; }
.checks__info b { font-size: 15px; }
.checks__note { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checks__act { display: flex; align-items: center; gap: 8px; }
.checks__act form { margin: 0; }

@media (max-width: 1180px) { .body-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .cmp { grid-template-columns: 1fr; }
  .cmp__shape .shape { max-width: 200px; }
}
@media (max-width: 560px) {
  .panel__bar { margin: -18px -16px 16px; padding: 10px 16px; }
  .measures { grid-template-columns: 1fr; }
  .checks li { grid-template-columns: 1fr auto; }
  .checks__thumbs { grid-column: 1 / -1; }
  .photos { grid-template-columns: 1fr; }
}

/* Nhập số đo + hình người vẽ lại khi gõ */
.measure-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 340px); gap: 24px; align-items: start; }
.live { position: sticky; top: 96px; }
.shape__lbl line { stroke: var(--field); stroke-width: 1; }
.shape__lbl text { fill: var(--muted); font-size: 10px; font-family: "Be Vietnam Pro", system-ui, sans-serif; }
.shape__lbl .shape__v { fill: var(--ink); font-size: 13px; font-weight: 700; }
.shape__b path { transition: d .25s ease; }
.fld.is-changed input { border-color: var(--primary); background: var(--primary-soft); }
.small { font-size: 13px; margin: -6px 0 0; }
.checks__dot { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
@media (max-width: 760px) {
  .measure-grid { grid-template-columns: 1fr; }
  .live { position: static; order: -1; }
  .live .shape { max-width: 220px; }
}
