:root {
  --bg: #eef1f8;
  --card: #ffffff;
  --card-2: #f7f8fd;
  --ink: #1b2038;
  --muted: #6a7190;
  --line: #e1e5f1;
  --brand: #2a61ae;
  --brand-2: #623794;
  --brand-dark: #1e3f78;
  --brand-soft: #e9eef9;
  --time: #d6ebf3;
  --action: #e8dcee;
  --check: #f4eadd;
  --teal: #2a9ea3;
  --red: #dc5f5d;
  --green: #3f9d5f;
  --purple: #4f4a9c;
  --amber: #eaa72f;
  --input-bg: #fafbff;
  --ph: #a3a9c4;
  --ph-strong: #8f9ab8;
  --shadow: 0 1px 2px rgba(30, 36, 80, .05), 0 6px 20px rgba(30, 36, 80, .06);
  --radius: 16px;
  color-scheme: light;
}


/* ---------- dark theme (screen only; print & PDF stay light) ---------- */
@media screen {
  :root[data-theme="dark"] {
    --bg: #0e1122;
    --card: #171b33;
    --card-2: #1c2140;
    --ink: #e8eaf8;
    --muted: #9aa2c6;
    --line: #2b3158;
    --brand: #6f9fe6;
    --brand-2: #a97fe0;
    --brand-dark: #cddcf8;
    --brand-soft: #1f2c52;
    --time: #1b3b49;
    --action: #2d2748;
    --check: #38302a;
    --input-bg: #11152e;
    --ph: #6c749a;
    --ph-strong: #7d86ad;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .28);
    color-scheme: dark;
  }
  :root[data-theme="dark"] .err { background: #3a1d22; color: #ff9b97; }
  :root[data-theme="dark"] .note-ok { background: #17352a; color: #7fe0a4; }
  :root[data-theme="dark"] .glass { background: #2b3158; }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Noto Sans Bengali", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--brand); text-decoration: none; }
button { font: inherit; cursor: pointer; color: inherit; }
input, textarea { font: inherit; color: inherit; max-width: 100%; }
input::placeholder, textarea::placeholder { color: var(--ph); opacity: 1; font-size: 12.5px; font-weight: 400; }
.slot .t input::placeholder, .slot .a input::placeholder { color: var(--ph-strong); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: 1200px; margin: 0 auto; padding: 10px 18px; display: flex; align-items: center; gap: 14px; }
.logo { display: flex; flex-direction: column; line-height: 1; }
.logo b { font-size: 21px; color: var(--brand); letter-spacing: -.4px; }
.logo span {
  background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff;
  font-size: 10.5px; letter-spacing: 1.6px; padding: 2px 7px; margin-top: 3px;
  border-radius: 4px; text-transform: uppercase; align-self: flex-start;
}
.nav { display: flex; gap: 4px; margin-left: 14px; }
.nav a { padding: 8px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.nav a:hover { background: var(--brand-soft); }
.nav a.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 30%, transparent); }
.nav a.on svg { color: #fff; }
.nav svg { width: 18px; height: 18px; }
.spacer { flex: 1; }
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 14px; border-radius: 10px; font-weight: 600; transition: background .15s, transform .05s;
  min-height: 38px;
}
.btn:hover { background: var(--card-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.icon { padding: 0; width: 38px; font-size: 20px; line-height: 1; }
.btn:disabled { opacity: .6; cursor: wait; }


.avatar {
  border-radius: 50%; display: grid; place-items: center; flex: none; object-fit: cover;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 700;
  border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line);
}
.theme-btn { color: var(--muted); }
.theme-btn:hover { color: var(--brand); }
.profile-box { position: relative; }
.profile-btn {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--card);
  padding: 4px 10px 4px 4px; border-radius: 999px; min-height: 44px;
}
.profile-btn:hover { background: var(--card-2); }
.pname { display: flex; flex-direction: column; text-align: left; line-height: 1.15; max-width: 160px; }
.pname b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pname small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); }
.menu {
  position: absolute; right: 0; top: calc(100% + 10px); width: 270px; z-index: 50;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 50px rgba(20, 24, 60, .22); padding: 8px; animation: pop .14s ease-out;
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 12px; margin-bottom: 6px; border-radius: 12px; background: var(--brand-soft); }
.menu-head div { display: flex; flex-direction: column; min-width: 0; }
.menu-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-head small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu a, .menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0;
  background: transparent; border-radius: 10px; color: var(--ink); font-weight: 600; text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--card-2); }
.menu svg { width: 18px; height: 18px; color: var(--muted); }
.menu .danger, .menu .danger svg { color: var(--red); }

/* profile page */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 14px; align-items: start; }
.pbody { padding: 16px; }
.avatar-edit { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.avatar-edit .avatar { border-width: 3px; }
.avatar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; min-width: 190px; }
.avatar-actions .small { flex-basis: 100%; margin: 4px 0 0; }
.note-ok { background: #e6f6ec; color: #23753f; padding: 10px 13px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.field input:disabled { opacity: .65; cursor: not-allowed; }
.pdf-user { display: flex; align-items: center; gap: 10px; }

/* bottom nav (mobile only) */
.bottomnav { display: none; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero {
  background: radial-gradient(circle at 20% 15%, #4f8be0 0, transparent 45%),
              linear-gradient(145deg, #18407c, #2a61ae 50%, #623794);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: center; gap: 22px;
}
.auth-hero .logo b { color: #fff; font-size: 34px; }
.auth-hero .logo span { background: rgba(255,255,255,.2); }
.auth-hero h2 { font-size: 30px; line-height: 1.3; margin: 10px 0 0; }
.auth-hero ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.auth-hero li { display: flex; gap: 10px; align-items: center; opacity: .95; }
.auth-hero li::before { content: "✓"; width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; font-size: 13px; flex: none; }
.auth-side { display: grid; place-items: center; padding: 28px 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .logo.mobile { display: none; align-items: center; margin-bottom: 18px; }
.auth-card h1 { font-size: 26px; margin: 0 0 4px; }
.auth-card p.sub { color: var(--muted); margin: 0 0 24px; }
.field { display: block; margin-bottom: 15px; }
.field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.field input {
  width: 100%; padding: 13px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--input-bg); outline: none; font-size: 16px;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.auth-card .btn.primary { width: 100%; padding: 13px; font-size: 16px; margin-top: 6px; }
.err { background: #fdecec; color: #b3312f; padding: 10px 13px; border-radius: 10px; margin-bottom: 15px; font-size: 14px; }
.alt { text-align: center; margin-top: 20px; color: var(--muted); }
.alt a { font-weight: 700; }

/* ---------- planner ---------- */
.pdf-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 13px; font-weight: 600; color: var(--brand-dark); }
.pdf-name { font-size: 16px; color: var(--ink); }
.pdf-head { display: none; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 4px 14px; }
.page { max-width: 1200px; margin: 0 auto; padding: 18px 18px 90px; }

.daybar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--card); border-radius: var(--radius); padding: 12px 14px;
  margin-bottom: 14px; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.daybar .date-input { cursor: pointer;
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px;
  background: var(--input-bg); min-height: 38px;
}
.daybar .title { font-weight: 700; font-size: 16px; margin: 0 6px; }
.weekdays { display: flex; gap: 3px; }
.weekdays i {
  font-style: normal; width: 27px; height: 27px; display: grid; place-items: center;
  border-radius: 8px; background: var(--brand-soft); color: var(--muted); font-size: 12px; font-weight: 700;
}
.weekdays i.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.status { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap;
  /* fixed width so changing text (saved / saving / error) never reflows the day bar */
  width: 150px; justify-content: flex-end; overflow: hidden; text-overflow: ellipsis; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.status.s-saving::before, .status.s-dirty::before, .status.s-loading::before { background: var(--amber); }
.status.s-error { color: #c0392b; }
.status.s-error::before { background: #c0392b; }

.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.sum {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow);
}
.sum small { color: var(--muted); font-weight: 600; font-size: 12.5px; display: block; }
.sum b { font-size: 22px; line-height: 1.3; }
.sum b i { font-style: normal; font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 3px; }
.meter { height: 6px; border-radius: 6px; background: var(--brand-soft); margin-top: 6px; overflow: hidden; }
.meter div { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .3s; }

.sheet { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 14px; align-items: start; transition: opacity .2s; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.card-h {
  color: #fff; font-weight: 700; padding: 9px 14px; letter-spacing: .3px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.card-h small { font-weight: 600; opacity: .85; font-size: 12.5px; }
.h-red { background: linear-gradient(90deg, #d9534f, #e8716e); }
.h-teal { background: linear-gradient(90deg, #218f94, #35b0b4); }
.h-brand { background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.h-purple { background: linear-gradient(90deg, var(--brand), var(--brand-2)); }

/* time / action */
.slot:nth-child(odd) .t { background: color-mix(in srgb, var(--time) 82%, var(--card)); }
.slot:nth-child(odd) .a { background: color-mix(in srgb, var(--action) 82%, var(--card)); }
.slot:hover .t, .slot:hover .a { filter: brightness(.97); }
.slot.filled .a, .slot.done .a { background: color-mix(in srgb, var(--brand) 13%, var(--card)); }
.slot.filled .c, .slot.done .c { background: color-mix(in srgb, var(--brand) 20%, var(--card)); }
.slot .t input { text-align: center; font-weight: 600; color: var(--brand-dark); }
.slots-h div { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; }
.row-tools { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px dashed var(--line); }
.add-rows.minus { color: var(--red); border-left: 1px dashed var(--line); }
.add-rows:disabled { opacity: .4; cursor: not-allowed; }
.add-rows {
  width: 100%; border: 0; background: var(--card-2);
  padding: 13px; font-weight: 700; color: var(--brand); min-height: 48px;
}
.add-rows:hover { background: var(--brand-soft); }

.slots-h, .slot { display: grid; grid-template-columns: 96px 40px 1fr; }
.slots-h div { padding: 9px 10px; font-weight: 700; text-align: center; color: var(--brand-dark); }
.slots-h div:nth-child(1) { background: var(--time); }
.slots-h div:nth-child(2) { background: var(--check); }
.slots-h div:nth-child(3) { background: var(--action); }
.slot { border-top: 1px solid var(--card); min-height: 44px; }
.slot input[type="text"] { border: 0; outline: none; padding: 10px; width: 100%; background: transparent; min-height: 44px; }
.slot .t { background: var(--time); }
.slot .a { background: var(--action); }
.slot .c { display: grid; place-items: center; background: var(--check); }
.slot input[type="text"]:focus { background: color-mix(in srgb, var(--card) 55%, transparent); }
.slot.done .a input { text-decoration: none; }

.circle { appearance: none; width: 22px; height: 22px; border: 2px solid var(--muted); border-radius: 50%; margin: 0; cursor: pointer; background: var(--card); transition: .15s; }
.circle:checked { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 78% no-repeat, linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: var(--brand); }

.notes-label { background: var(--purple); color: #fff; display: inline-block; padding: 4px 12px; font-size: 13px; font-weight: 600; border-radius: 0 0 10px 0; }
textarea.plain { width: 100%; border: 0; outline: none; resize: vertical; padding: 12px 14px; min-height: 150px; background: transparent; }
.improve { padding: 12px 14px; }
.improve label { font-size: 13px; font-weight: 700; color: var(--muted); }
.improve textarea { width: 100%; border: 0; border-bottom: 1px dashed var(--line); outline: none; resize: vertical; padding: 8px 0; min-height: 64px; background: transparent; }

/* right column */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; align-items: center; }
.chip-label { background: var(--green); color: #fff; padding: 5px 12px; border-radius: 8px; font-weight: 700; font-size: 13px; }
.tick {
  display: inline-flex; align-items: center; gap: 7px; user-select: none;
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; background: var(--input-bg);
  cursor: pointer; font-weight: 600; font-size: 14px; min-height: 38px; transition: .15s;
}
.tick input { accent-color: var(--brand-2); width: 17px; height: 17px; margin: 0; }
.tick.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; box-shadow: 0 3px 10px color-mix(in srgb, var(--brand) 28%, transparent); }
.tick.on input { accent-color: #fff; }

.row { display: grid; grid-template-columns: 30px 1fr 34px; align-items: center; border-top: 1px solid var(--line); min-height: 44px; }
.row:first-of-type { border-top: 0; }
.card-h + .row { border-top: 0; }
.row .n { text-align: center; color: var(--muted); font-weight: 700; font-size: 13px; }
.row input[type="text"] { border: 0; outline: none; padding: 10px 6px; width: 100%; background: transparent; min-height: 44px; }
.row input[type="text"]:focus { background: var(--card-2); }
.row .cb { display: grid; place-items: center; padding-right: 8px; }
.row.done input[type="text"] { text-decoration: none; }
.sq { appearance: none; width: 20px; height: 20px; border: 2px solid var(--muted); border-radius: 6px; margin: 0; cursor: pointer; background: var(--card); transition: .15s; }
.sq:checked { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 80% no-repeat, linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: var(--brand); }

.g3row { display: grid; grid-template-columns: 1.5fr .8fr 1fr; }
.g3h .gh { background: var(--brand-soft); font-size: 12.5px; font-weight: 700; text-align: center; padding: 6px; color: var(--brand-dark); }
.g3row input { border: 0; border-top: 1px solid var(--line); border-right: 1px solid var(--line); outline: none; padding: 10px; width: 100%; min-width: 0; background: transparent; min-height: 42px; }
.g3row input:nth-child(3) { border-right: 0; }
.g3row input:focus { background: var(--card-2); }

.meals { display: grid; grid-template-columns: 1fr 1fr; }
.meal-h { color: #fff; font-size: 13px; font-weight: 700; padding: 6px 12px; }
.meal textarea { width: 100%; border: 0; outline: none; resize: none; padding: 10px 12px; min-height: 66px; background: transparent; }
.meal:nth-child(2n) { border-left: 1px solid var(--line); }
.meal:nth-child(n + 3) { border-top: 1px solid var(--line); }

.health { padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.hrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hgroup { display: flex; align-items: center; gap: 8px; }
.hlabel { background: var(--purple); color: #fff; font-weight: 700; padding: 4px 10px; border-radius: 8px; min-width: 64px; text-align: center; font-size: 13px; }
.yn { display: flex; gap: 5px; }
.yn button {
  width: 38px; height: 34px; border: 1px solid var(--line); background: var(--input-bg);
  border-radius: 8px; font-weight: 700; color: var(--muted);
}
.yn button.on.y, .yn button.on.n { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; }

.hrow input.km { width: 104px; border: 1px solid var(--line); border-radius: 9px; padding: 7px 10px; outline: none; background: var(--input-bg); min-height: 36px; }
.glasses { display: flex; gap: 6px; flex-wrap: wrap; }
.glass {
  width: 26px; height: 34px; border: 0; padding: 0; background: var(--line);
  clip-path: polygon(0 0, 100% 0, 86% 100%, 14% 100%); transition: .15s;
}
.glass.on { background: linear-gradient(#8fd0f6, #3a8bdc); }
.stars { display: flex; gap: 0; flex-wrap: wrap; }
.star { background: none; border: 0; font-size: 28px; line-height: 1; color: var(--line); padding: 2px 1px; min-width: 30px; min-height: 36px; }
.star.on { color: var(--amber); }
.small { font-size: 13px; color: var(--muted); font-weight: 600; }

.tabs { display: none; }

/* ---------- dashboard ---------- */
.hello { margin: 4px 0 4px; font-size: 26px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 16px 0 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(var(--brand), var(--brand-2)); }
.stat small { color: var(--muted); font-weight: 600; }
.stat b { display: block; font-size: 32px; color: var(--brand); line-height: 1.2; margin-top: 4px; }
.stat em { font-style: normal; color: var(--muted); font-size: 13px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 170px; padding: 16px 14px 10px; }
.bar { flex: 1; background: var(--brand-soft); border-radius: 5px 5px 0 0; min-height: 4px; transition: filter .15s; }
.bar.f { background: linear-gradient(var(--brand-2), var(--brand)); }
.bar:hover { filter: brightness(1.15); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 560px; }
.table th, .table td { padding: 10px 14px; text-align: left; border-top: 1px solid var(--line); font-size: 14px; white-space: nowrap; }
.table th { background: var(--card-2); color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .5px; border-top: 0; }
.table tr:hover td { background: var(--card-2); }
.muted { color: var(--muted); }
.h2 { font-size: 17px; margin: 24px 0 10px; }

/* ================= responsive ================= */
@media (max-width: 1000px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 860px) {
  .sheet { grid-template-columns: 1fr; }
  .auth-wrap { display: flex; flex-direction: column; min-height: 100dvh; }
  .auth-hero { padding: 40px 24px 76px; gap: 8px; border-radius: 0 0 28px 28px; }
  .auth-hero .logo b { font-size: 30px; }
  .auth-hero h2 { font-size: 20px; margin-top: 8px; font-weight: 600; opacity: .95; }
  .auth-hero ul { display: none; }
  .auth-side { display: block; padding: 0 16px 28px; margin-top: -46px; }
  .auth-card {
    max-width: 440px; margin: 0 auto; background: var(--card); border: 1px solid var(--line);
    border-radius: 22px; padding: 26px 22px 22px; box-shadow: 0 16px 40px rgba(20, 28, 60, .16);
  }
  .auth-card .logo.mobile { display: none; }
  .auth-card h1 { font-size: 23px; }
  .auth-card p.sub { margin-bottom: 20px; font-size: 14.5px; }
  .auth-card .alt { text-align: center; font-size: 13.5px; color: var(--muted); margin-top: 16px; }
}

@media (max-width: 700px) {
  .topbar-in { padding: 9px 14px; }
  .topbar .nav, .pname, .chev { display: none; }
  .profile-btn { padding: 3px; }
  .menu { position: fixed; right: 12px; left: 12px; top: 58px; width: auto; }
  .page { padding: 12px 12px 96px; }

  .bottomnav {
    display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 40;
    background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 6px; gap: 2px;
    box-shadow: 0 10px 30px rgba(20, 28, 60, .18);
  }
  .bottomnav a {
    flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 8px 2px 7px; border-radius: 13px; color: var(--muted); font-size: 11px; font-weight: 700; line-height: 1.15;
    text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background .15s, color .15s;
  }
  .bottomnav a.on { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
  .bottomnav a.on svg { color: #fff; }
  .bottomnav svg { width: 22px; height: 22px; flex: none; }
  .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

  .daybar { padding: 10px; gap: 6px; }
  .daybar .date-input { flex: 1; min-width: 0; }
  .daybar .title { order: 9; flex-basis: 100%; margin: 4px 0 0; font-size: 15px; }
  .daybar .weekdays { order: 10; }
  .daybar .spacer { display: none; }
  .daybar .status { order: 11; margin-left: auto; width: auto; min-width: 150px; }
  .daybar .btn.print { display: none; }

  .summary { gap: 8px; }
  .sum { padding: 10px 12px; }
  .sum b { font-size: 19px; }

  .slots-h, .slot { grid-template-columns: 78px 40px 1fr; }
  .meals { grid-template-columns: 1fr; }
  .meal:nth-child(2n) { border-left: 0; }
  .meal + .meal { border-top: 1px solid var(--line); }

  .hrow input.km { width: 120px; }
  .hello { font-size: 21px; }
  .stat b { font-size: 26px; }
}

@media (max-width: 380px) {
  .summary { grid-template-columns: 1fr 1fr; }
  .logo b { font-size: 18px; }
}


/* ===== mobile polish ===== */
@media (max-width: 700px) {
  .g3h { display: none; }
  .grid3 { padding: 10px; display: flex; flex-direction: column; gap: 10px; background: var(--card-2); }
  .g3row {
    grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; position: relative;
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  }
  .g3row::before {
    content: attr(data-n); position: absolute; top: -8px; left: 10px;
    background: var(--teal); color: #fff; font-size: 11px; font-weight: 700;
    min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px;
  }
  .g3row input, .g3row input:nth-child(3) {
    border: 1px solid var(--line); border-radius: 10px; background: var(--input-bg);
    min-height: 46px; padding: 10px 12px;
  }
  .g3row input:nth-child(1) { grid-column: 1 / -1; font-weight: 600; }
  .g3row input:focus { background: var(--card); border-color: var(--brand); }
}

@media (max-width: 860px) {
  .tabs {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
    position: sticky; top: 64px; z-index: 25; margin: 0 0 12px; padding: 5px;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  }
  .tabs button {
    border: 0; background: transparent; border-radius: 10px; padding: 7px 2px;
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    font-size: 12.5px; font-weight: 700; color: var(--muted);
  }
  .tabs button span { font-size: 17px; line-height: 1.2; }
  .tabs button.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }

  .sheet > .col > .card { display: none; }
  .sheet[data-tab="schedule"] .card[data-sec="schedule"],
  .sheet[data-tab="tasks"] .card[data-sec="tasks"],
  .sheet[data-tab="health"] .card[data-sec="health"],
  .sheet[data-tab="notes"] .card[data-sec="notes"] { display: block; }
  .sheet, .col { gap: 12px; }
}

@media (max-width: 700px) {
  body { font-size: 16px; }
  /* 16px inputs stop iOS from zooming on focus */
  input, textarea { font-size: 16px; }
  input::placeholder, textarea::placeholder { font-size: 13px; }

  .page { padding-top: 10px; }
  .daybar { border-radius: 14px; }
  .daybar .btn.icon { width: 42px; min-height: 42px; }
  .daybar .date-input { min-height: 42px; font-size: 15px; }

  .summary { grid-template-columns: repeat(4, minmax(112px, 1fr)); overflow-x: auto; margin: 0 -12px 12px; padding: 2px 12px 6px; scroll-snap-type: x proximity; scrollbar-width: none; }
  .summary::-webkit-scrollbar { display: none; }
  .sum { scroll-snap-align: start; }

  .card { border-radius: 14px; }
  .slot, .slot input[type="text"] { min-height: 50px; }
  .slots-h, .slot { grid-template-columns: 70px 46px 1fr; }
  .circle { width: 26px; height: 26px; }
  .row { grid-template-columns: 30px 1fr 42px; min-height: 50px; }
  .row input[type="text"] { min-height: 50px; }
  .sq { width: 24px; height: 24px; }
  .tick { min-height: 44px; padding: 8px 14px; font-size: 15px; }
  .meal textarea { min-height: 84px; }
  .meals { gap: 10px; padding: 10px; background: var(--card-2); }
  .meal { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
  .meal:nth-child(2n), .meal:nth-child(n + 3), .meal + .meal { border: 1px solid var(--line); }
  textarea.plain { min-height: 220px; }
  .improve textarea { min-height: 100px; }

  .hrow { gap: 12px; }
  .hgroup { flex: 1 1 100%; justify-content: space-between; }
  .hlabel { min-width: 72px; }
  .yn button { width: 56px; height: 42px; }
  .hrow input.km { flex: 1; width: auto; min-height: 42px; }
  .glasses { gap: 8px; }
  .glass { width: 28px; height: 38px; }
  .star { font-size: 30px; min-width: 32px; min-height: 40px; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 13px; }
  .bars { height: 130px; gap: 2px; }
}

@media print {
  @page { size: A4; margin: 9mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  html, body { background: #fff !important; color: #000; font-size: 11px; }
  .topbar, .bottomnav, .tabs, .daybar, .row-tools, .stat-grid, [data-nopdf] { display: none !important; }
  .page { padding: 0; max-width: none; }
  .print-fit { width: 1100px; zoom: var(--pz, .66); }

  /* header */
  .pdf-head {
    display: flex !important; align-items: center; justify-content: space-between;
    border-bottom: 2px solid var(--brand); padding: 0 0 6px; margin-bottom: 8px;
  }
  .pdf-head .logo b { font-size: 20px; }
  .pdf-meta { font-size: 11px; }
  .pdf-name { font-size: 14px; }

  /* summary strip */
  .summary { grid-template-columns: repeat(4, 1fr) !important; gap: 6px; margin: 0 0 8px !important; padding: 0 !important; overflow: visible; }
  .sum { padding: 5px 8px; border-radius: 8px; box-shadow: none; }
  .sum b { font-size: 14px; }
  .sum small { font-size: 10px; }
  .meter { height: 4px; margin-top: 3px; }

  /* layout */
  .sheet { grid-template-columns: 1fr 1fr !important; gap: 8px; opacity: 1 !important; }
  .col { gap: 8px; }
  .sheet > .col > .card { display: block !important; }
  .card { box-shadow: none; border-radius: 8px; break-inside: avoid; page-break-inside: avoid; }
  .card-h { padding: 4px 10px; font-size: 11px; }

  /* clean fields */
  input, textarea { font-size: 11px !important; }
  input::placeholder, textarea::placeholder { color: transparent !important; }
  .slot, .slot input[type="text"], .row, .row input[type="text"], .g3row input { min-height: 24px !important; }
  .slot input[type="text"], .row input[type="text"], .g3row input { padding: 3px 6px; }
  .slots-h div { padding: 4px; font-size: 10px; }
  .circle { width: 14px; height: 14px; }
  .sq { width: 13px; height: 13px; }
  .tick { min-height: 24px; padding: 2px 8px; font-size: 10.5px; }
  .chips { padding: 6px 8px; gap: 5px; }
  .chip-label { padding: 2px 8px; font-size: 10.5px; }
  textarea.plain { min-height: 110px; padding: 6px 8px; }
  .improve { padding: 6px 10px; }
  .improve textarea { min-height: 50px; }
  .meal textarea { min-height: 44px; padding: 5px 8px; }
  .meal-h { padding: 3px 8px; font-size: 10px; }
  .health { padding: 8px; gap: 8px; }
  .hlabel { font-size: 10px; padding: 2px 8px; min-width: 52px; }
  .yn button { width: 26px; height: 22px; font-size: 10px; }
  .hrow input.km { min-height: 22px !important; width: 90px; }
  .glass { width: 16px; height: 22px; }
  .star { font-size: 18px; min-width: 18px; min-height: 22px; }
}

/* ---------- PHP build additions ---------- */
[hidden] { display: none !important; }
.theme-btn .ico-sun, .theme-btn .ico-moon { display: grid; place-items: center; }
:root:not([data-theme="dark"]) .theme-btn .ico-sun { display: none; }
:root[data-theme="dark"] .theme-btn .ico-moon { display: none; }
.pdf-head { display: none; }

/* admin */
.viewing { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between;
  background: #fff7e0; color: #7a5200; border: 1px solid #f0d58a; border-radius: 12px; padding: 10px 14px; margin: 0 0 14px; font-size: 14px; }
:root[data-theme="dark"] .viewing { background: #3a2f12; color: #f3d98b; border-color: #6b5520; }
.admin-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; padding: 16px; }
.admin-form .field { margin: 0; }
.admin-form select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: inherit; font: inherit; }
.role-tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--card-2); border: 1px solid var(--line); }
.role-tag.superadmin { background: #ffe3e3; color: #a12626; border-color: #f2b5b5; }
.role-tag.admin { background: #e3ecff; color: #2a4aa8; border-color: #b9cbf5; }
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-actions form { display: inline-flex; gap: 6px; margin: 0; }
.row-actions input[type=password] { width: 130px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: inherit; font: inherit; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.flash.ok { background: #e6f6ea; color: #1d6b34; border: 1px solid #b7e0c2; }
.flash.bad { background: #fde8e8; color: #a12626; border: 1px solid #f2b5b5; }

/* user list */
.ul-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.ul-count { display: inline-block; min-width: 26px; padding: 1px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 14px; text-align: center; vertical-align: middle; }
.ul-search { flex: 1 1 240px; max-width: 360px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: inherit; font: inherit; }
.ul-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: var(--card); color: inherit; border-radius: 999px; padding: 6px 14px; font: inherit; font-size: 13.5px; cursor: pointer; }
.chip b { margin-left: 4px; color: var(--muted); }
.chip.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; color: #fff; }
.chip.on b { color: #fff; opacity: .85; }
.ul { display: grid; gap: 10px; }
.ul-item { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; transition: box-shadow .15s; }
.ul-item:hover { box-shadow: 0 6px 18px rgba(40, 60, 120, .09); }
.ul-item[hidden], .ul-panel[hidden], .ul-empty[hidden] { display: none; }
.ul-main { display: flex; align-items: center; gap: 14px; padding: 12px 16px; flex-wrap: wrap; }
.ul-who { flex: 1 1 240px; min-width: 0; }
.ul-name { font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.ul-name small { font-weight: 400; color: var(--muted); }
.ul-sub { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ul-meta { display: flex; gap: 22px; }
.ul-meta span { display: flex; flex-direction: column; font-size: 14px; }
.ul-meta small { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
.ul-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.ul-panel { display: flex; flex-wrap: wrap; gap: 14px 28px; padding: 14px 16px; background: var(--card-2); border-top: 1px solid var(--line); }
.ul-panel form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.ul-panel label { font-size: 12.5px; color: var(--muted); }
.ul-panel select, .ul-panel input[type=text] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: inherit; font: inherit; }
.btn.sm.primary { color: #fff; }
.btn.danger { color: #c0392b; border-color: #efc2bd; }
.role-tag.hr { background: #e6f6ea; color: #1d6b34; border-color: #b7e0c2; }
.role-tag.manager { background: #f1e6fb; color: #6b2fa3; border-color: #d9bff2; }
.role-tag.team_lead { background: #fff1de; color: #9a5a00; border-color: #f0cf9a; }
@media (max-width: 720px) {
  .ul-meta { order: 3; width: 100%; }
  .ul-btns { margin-left: 0; }
}

/* password show/hide */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 46px !important; }
.pw-toggle { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.pw-toggle:hover { color: var(--brand); background: var(--card-2); }

/* entry control */
.lock-note { background: #fdecec; color: #8f1f1f; border: 1px solid #f2b5b5; border-radius: 12px; padding: 10px 14px; margin: 0 0 12px; font-size: 14px; }
:root[data-theme="dark"] .lock-note { background: #3b1b1f; color: #f5b5b5; border-color: #7a3037; }
.lock-note[hidden] { display: none; }
.set-form { padding: 16px; display: grid; gap: 14px; }
.set-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card-2); }
.set-txt { flex: 1 1 260px; display: grid; gap: 2px; }
.set-txt small { color: var(--muted); font-size: 13px; }
.set-inline { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.set-inline label { display: flex; gap: 6px; align-items: center; }
.set-inline select, .set-inline input[type=time] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: inherit; font: inherit; }
.switch { position: relative; width: 48px; height: 28px; flex: 0 0 auto; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #c5cbe0; transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch input:checked + i { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }

/* multi-day PDF dialog */
.range-dlg { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); padding: 18px 20px; width: min(92vw, 400px); box-shadow: var(--shadow); }
.range-dlg::backdrop { background: rgba(10, 14, 30, .45); }
.range-dlg h3 { margin: 0 0 12px; }
.range-dlg label { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 0; font-weight: 600; }
.range-dlg input[type="date"] { border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; background: var(--input-bg); min-height: 38px; color: var(--ink); }
.range-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.range-note { font-size: 13px; color: var(--muted); margin: 8px 0 0; min-height: 20px; }
.range-note.err { color: #c0392b; }
.range-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.range-actions .primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; }

/* PDF dropdown in the day bar */
.pdf-menu { position: relative; }
.pdf-trigger { display: inline-flex; align-items: center; gap: 8px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; }
.pdf-trigger:hover { background: linear-gradient(135deg, var(--brand), var(--brand-2)); filter: brightness(1.08); }
.pdf-trigger:disabled { opacity: .7; cursor: progress; }
.pdf-trigger .chev { opacity: .8; }
.pdf-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; min-width: 230px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px;
  box-shadow: 0 14px 34px rgba(20, 28, 60, .18);
}
.pdf-pop[hidden] { display: none; }
.pdf-pop button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--ink); padding: 9px 12px; border-radius: 9px; cursor: pointer; }
.pdf-pop button:hover { background: var(--brand-soft); }
.pdf-pop button:disabled { opacity: .5; cursor: not-allowed; }
.pdf-pop small { color: var(--muted); font-size: 12px; }
@media (max-width: 720px) { .daybar .pdf-menu { order: 12; } }

/* team activity + analytics */
.filter-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.chips-f { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-f { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.chip-f b { margin-left: 4px; color: var(--muted); }
.chip-f:hover { background: var(--card-2); }
.chip-f.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; }
.chip-f.on b { color: #fff; opacity: .85; }
.stat.st-ok::after { background: #2e9f5b; }
.stat.st-pending::after { background: #5b8def; }
.stat.st-warn::after { background: #e0952b; }
.stat.st-bad::after { background: #d64545; }
.stat.st-ok b { color: #2e9f5b; } .stat.st-warn b { color: #c27a12; } .stat.st-bad b { color: #d64545; } .stat.st-pending b { color: #3b6fd6; }
.st-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; }
.st-badge.st-ok { background: #e3f6ea; color: #1d6b34; }
.st-badge.st-pending { background: #e5eeff; color: #2a4aa8; }
.st-badge.st-warn { background: #fff1d9; color: #9a5a00; }
.st-badge.st-bad { background: #ffe3e3; color: #a12626; }
:root[data-theme="dark"] .st-badge.st-ok { background: #17382a; color: #7fdba0; }
:root[data-theme="dark"] .st-badge.st-pending { background: #1b2a4d; color: #9cbcff; }
:root[data-theme="dark"] .st-badge.st-warn { background: #45331a; color: #f2c27a; }
:root[data-theme="dark"] .st-badge.st-bad { background: #4a2020; color: #ff9d9d; }
.who { display: inline-flex; align-items: center; gap: 10px; }
.who small { display: block; line-height: 1.2; }
.meter { width: 120px; height: 7px; border-radius: 999px; background: var(--brand-soft); overflow: hidden; margin-bottom: 3px; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 999px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* mobile polish: compact day bar + slimmer bottom nav */
@media (max-width: 720px) {
  .daybar { padding: 8px; gap: 6px; border-radius: 14px; }
  .daybar .btn { min-height: 36px; padding: 6px 12px; font-size: 13.5px; }
  .daybar .btn.icon { width: 36px; min-height: 36px; padding: 0; font-size: 16px; }
  .daybar .date-input { min-height: 36px; padding: 5px 8px; font-size: 13.5px; }
  .daybar .title { order: 9; flex: 1 1 calc(100% - 140px); margin: 2px 0 0; font-size: 13.5px; min-width: 0; }
  .daybar .status { order: 10; flex: 0 0 auto; width: auto; min-width: 0; margin: 2px 0 0 auto; font-size: 12px; }
  .daybar .weekdays { order: 11; flex: 1 1 auto; gap: 3px; }
  .weekdays i { width: 24px; height: 24px; font-size: 10.5px; border-radius: 7px; }
  .daybar .pdf-menu { order: 12; }
  .daybar .pdf-trigger { min-height: 34px; padding: 6px 12px; font-size: 13px; gap: 6px; }
  .daybar .pdf-trigger svg { width: 14px; height: 14px; }

  .bottomnav { left: 8px; right: 8px; padding: 5px; border-radius: 16px; }
  .bottomnav a { font-size: 10px; gap: 2px; padding: 7px 1px 6px; border-radius: 11px; letter-spacing: -.1px; }
  .bottomnav svg { width: 19px; height: 19px; }

  .tabs button { font-size: 13px; }
  .sum { padding: 9px 11px; }
  .sum b { font-size: 18px; }
}

/* responsive tables / grids (activity + analytics) */
.two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.two-col > div { min-width: 0; }
.btn-link { font-weight: 700; white-space: nowrap; }
.td-act { text-align: right; }
@media (max-width: 720px) {
  .page, .card { min-width: 0; }
  .two-col { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .hello { font-size: 21px; }
  .h2 { font-size: 15.5px; margin: 20px 0 8px; }
  .stat-grid { gap: 8px; margin: 12px 0 14px; }
  .stat { padding: 11px 12px; }
  .stat small { font-size: 12px; }
  .stat b { font-size: 22px; margin-top: 2px; }
  .stat em { font-size: 11.5px; }
  .filter-bar { gap: 8px; }
  .chips-f { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: none; padding-bottom: 2px; }
  .chips-f::-webkit-scrollbar { display: none; }
  .chip-f { padding: 6px 11px; font-size: 12.5px; white-space: nowrap; flex: none; }

  /* a table becomes a list of small cards */
  .card.table-wrap:has(.table.stack) { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .table.stack td.td-empty { padding: 4px 0; text-align: left; }
  .table.stack tr:has(.td-empty) { padding: 8px 12px; }
  .table.stack tr:has(.td-empty) td.td-main { border: 0; padding: 0 0 2px; margin: 0; }
  .table.stack tr:has(.td-empty) td.td-act { border: 0; padding: 0; margin: 0; }
  .table.stack { min-width: 0; border-collapse: separate; border-spacing: 0 8px; }
  .table.stack thead { display: none; }
  .table.stack tbody, .table.stack tr, .table.stack td { display: block; }
  .table.stack tr {
    background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px;
    margin-bottom: 8px; box-shadow: var(--shadow);
  }
  .table.stack tr:hover td { background: transparent; }
  .table.stack td { border: 0; padding: 5px 0; font-size: 13px; white-space: normal; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .table.stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; flex: none; }
  .table.stack td.td-main { display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 0 0 8px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
  .table.stack td.td-act { justify-content: flex-end; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--line); }
  .table.stack td[colspan] { display: block; text-align: center; }
  .table.stack .meter { width: 90px; margin: 0 0 2px auto; }
  .table.stack td small { display: block; text-align: right; }
}
@media (max-width: 720px) {
  .table.stack td.td-empty, .table.stack td[colspan].td-empty { text-align: left; display: block; }
  .card-h { flex-wrap: wrap; gap: 2px 8px; }
  .card-h small { font-size: 11.5px; }
}

/* install-as-app prompts */
.install-top { display: inline-flex; align-items: center; gap: 7px; background: var(--brand-soft); color: var(--brand); border-color: transparent; font-weight: 700; padding: 7px 12px; }
.install-top[hidden], .install-banner[hidden] { display: none; }
.install-top svg { width: 17px; height: 17px; flex: none; }
.install-top:hover { filter: brightness(.97); }
.install-banner { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.ib-in { max-width: 1200px; margin: 0 auto; padding: 9px 18px; display: flex; align-items: center; gap: 12px; }
.ib-ico { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.18); display: grid; place-items: center; flex: none; }
.ib-ico svg { width: 19px; height: 19px; }
.ib-txt { flex: 1; min-width: 0; line-height: 1.25; }
.ib-txt b { display: block; font-size: 14.5px; }
.ib-txt small { display: block; opacity: .88; font-size: 12.5px; }
.ib-go { background: #fff; color: var(--brand); border-color: transparent; font-weight: 800; min-height: 36px; padding: 6px 16px; }
.ib-go:hover { background: #fff; filter: brightness(.96); }
.ib-x { background: transparent; border: 0; color: #fff; opacity: .85; font-size: 16px; padding: 6px 8px; cursor: pointer; }
@media (max-width: 720px) {
  .install-top span { display: none; }
  .install-top { padding: 7px 9px; }
  .ib-in { padding: 8px 12px; gap: 9px; }
  .ib-txt small { display: none; }
  .ib-txt b { font-size: 13.5px; }
}
@media print { .install-banner, .install-top { display: none !important; } }
.nav a { white-space: nowrap; }
@media (max-width: 1320px) { .install-top span { display: none; } .install-top { padding: 7px 10px; } }

/* install prompt: floating card, bottom-right */
.install-banner {
  position: fixed; right: 20px; bottom: 20px; z-index: 70; width: min(400px, calc(100vw - 24px));
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 18px 48px rgba(20, 28, 60, .28);
  animation: ib-up .45s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes ib-up { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.install-banner .ib-in { max-width: none; margin: 0; padding: 12px 12px 12px 14px; gap: 12px; }
.install-banner .ib-ico { width: 44px; height: 44px; border-radius: 13px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.install-banner .ib-ico svg { width: 22px; height: 22px; }
.install-banner .ib-txt b { font-size: 14.5px; color: var(--ink); }
.install-banner .ib-txt small { display: block; font-size: 12.5px; color: var(--muted); opacity: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.install-banner .ib-go {
  display: inline-flex; align-items: center; gap: 6px; background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; border-color: transparent; font-weight: 800; min-height: 38px; padding: 7px 14px; border-radius: 11px; flex: none;
}
.install-banner .ib-go:hover { background: linear-gradient(135deg, var(--brand), var(--brand-2)); filter: brightness(1.08); }
.install-banner .ib-go svg { width: 16px; height: 16px; }
.install-banner .ib-x { color: var(--muted); opacity: 1; font-size: 15px; padding: 6px; border-radius: 8px; flex: none; }
.install-banner .ib-x:hover { background: var(--card-2); }
@media (max-width: 720px) {
  .install-banner { left: 12px; right: 12px; width: auto; bottom: calc(86px + env(safe-area-inset-bottom)); }
  .install-banner .ib-in { padding: 10px 10px 10px 12px; gap: 10px; }
  .install-banner .ib-ico { width: 40px; height: 40px; }
  .install-banner .ib-txt b { font-size: 13.5px; }
  .install-banner .ib-txt small { display: block; font-size: 12px; }
}
