/* =============================================================================
   নিরোগ — design tokens and the app shell.
   Mobile first; the app column is centred and capped at 640px on wide screens.
   ============================================================================= */

:root {
  color-scheme: light;

  --accent:        #0e9b86;
  --accent-strong: #0b7a6a;
  --accent-soft:   #e3f5f1;
  --accent-border: #b7e3da;
  --accent-glow:   rgba(14, 155, 134, .28);
  --warm:          #f59e0b;
  --warm-soft:     #fff3dc;

  --bg:             #f4f8f7;
  --surface:        #ffffff;
  --surface-2:      #f7faf9;
  --surface-sunken: #edf3f1;
  --glass:          rgba(255, 255, 255, .86);
  --scrim:          rgba(10, 22, 20, .55);

  --text:        #0f1b19;
  --text-muted:  #5b6b68;
  --text-faint:  #7d8c89;
  --heading:     #0d2f2a;
  --on-accent:   #ffffff;

  --border:        #e2eae8;
  --border-strong: #cad7d4;

  --success:      #1d8a5e;
  --success-soft: #e6f6ee;
  --danger:       #c0392b;
  --danger-soft:  #fdecea;
  --warning:      #96620f;
  --warning-soft: #fdf3e2;
  --info:         #2b6fd6;
  --info-soft:    #e8f0fd;

  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-xl: 24px; --r-pill: 999px;

  --shadow-1: 0 1px 2px rgba(10, 22, 20, .05), 0 1px 3px rgba(10, 22, 20, .04);
  --shadow-2: 0 2px 6px rgba(10, 22, 20, .05), 0 10px 24px rgba(10, 22, 20, .07);
  --shadow-3: 0 14px 40px rgba(10, 22, 20, .14);
  --ring:     0 0 0 3px rgba(14, 155, 134, .32);

  --font: 'Noto Sans Bengali', 'Inter', 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  --fs-xs: .75rem; --fs-sm: .875rem; --fs-md: 1rem; --fs-lg: 1.125rem; --fs-xl: 1.375rem; --fs-2xl: 1.75rem;

  --ease: cubic-bezier(.22, .61, .36, 1);
  --fast: 140ms; --slow: 280ms;

  --top-h: 60px;
  --nav-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --accent:        #3cc9b0;
  --accent-strong: #7fdccb;
  --accent-soft:   #12302b;
  --accent-border: #1f5a50;
  --accent-glow:   rgba(60, 201, 176, .3);
  --warm:          #f5b544;
  --warm-soft:     #2b2010;
  --bg:             #0b1412;
  --surface:        #13201d;
  --surface-2:      #182723;
  --surface-sunken: #0e1916;
  --glass:          rgba(19, 32, 29, .9);
  --text:        #e6f0ee;
  --text-muted:  #97aca8;
  --text-faint:  #6f8481;
  --heading:     #d4ece7;
  --on-accent:   #06211c;
  --border:        #22332f;
  --border-strong: #33474266;
  --success:      #4ac48c; --success-soft: #0f2a20;
  --danger:       #ef7367; --danger-soft: #2c1512;
  --warning:      #e0a44a; --warning-soft: #2b1f0d;
  --info:         #6ea4f0; --info-soft: #122036;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, .55);
  --shadow-3: 0 12px 36px rgba(0, 0, 0, .6);
  --ring:     0 0 0 3px rgba(60, 201, 176, .45);
}

/* ---- base -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--fs-md); line-height: 1.55; color: var(--text);
  background: var(--bg);
  background-image: radial-gradient(900px 400px at 10% -10%, var(--accent-glow), transparent 60%),
                    radial-gradient(700px 300px at 100% 0%, rgba(245, 158, 11, .10), transparent 60%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { margin: 0; color: var(--heading); line-height: 1.3; font-weight: 700; }
p { margin: 0 0 .75em; }
a { color: var(--accent-strong); text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-sm); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.text-accent { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 14px; } .mt-3 { margin-top: 22px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 14px; } .mb-3 { margin-bottom: 22px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---- top bar ----------------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 40; padding-top: var(--safe-top);
  background: var(--glass); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.top-inner { height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 12px; max-width: 640px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--heading); font-weight: 800; }
.brand img { width: 34px; height: 34px; }
.top-title { flex: 1; min-width: 0; }
.top-title h1 { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title p { margin: 0; font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--r-pill); display: inline-grid; place-items: center; border: 0;
  background: transparent; color: var(--heading); font-size: 1.25rem; cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--surface-sunken); }
.bell .badge { position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; line-height: 1; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 8px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface); color: var(--heading); font-size: var(--fs-sm); font-weight: 600; cursor: pointer;
  white-space: nowrap;
}
.chip.is-accent { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-strong); }
.chip.is-warn { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.chip.is-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.chip.is-ok { background: var(--success-soft); border-color: transparent; color: var(--success); }
.chip.is-info { background: var(--info-soft); border-color: transparent; color: var(--info); }
.profile-chip { max-width: 44vw; }
.profile-chip i:first-child { font-size: 1.1rem; color: var(--accent); }
.profile-chip-name { overflow: hidden; text-overflow: ellipsis; }
.chip-caret { font-size: .7rem; color: var(--text-faint); }

/* ---- page -------------------------------------------------------------- */
.page { max-width: 640px; margin: 0 auto; padding: 14px 14px 32px; }
.page.has-nav { padding-bottom: calc(var(--nav-h) + 28px + var(--safe-bottom)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin: 4px 0 14px; }
.page-head h2 { font-size: var(--fs-xl); }
.page-head p { margin: 2px 0 0; color: var(--text-muted); font-size: var(--fs-sm); }
.section-title { font-size: var(--fs-sm); font-weight: 700; color: var(--text-faint); letter-spacing: .04em; text-transform: uppercase; margin: 18px 0 8px; }

/* ---- bottom nav -------------------------------------------------------- */
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe-bottom)); z-index: 40;
  width: min(100% - 20px, 600px); height: var(--nav-h); display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--glass); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-2);
}
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-muted); font-size: 11px; font-weight: 600; border-radius: var(--r-lg); }
.nav-item i { font-size: 1.3rem; line-height: 1; }
.nav-item.is-active { color: var(--accent-strong); }
.nav-item.is-active i { transform: translateY(-1px); }

/* ---- cards ------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-body { padding: 14px 16px; }
.card-title { font-size: var(--fs-md); font-weight: 700; }
.card-sub { color: var(--text-muted); font-size: var(--fs-sm); }
.card.is-accent { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border-color: var(--accent-border); }
.card.is-warn { background: var(--warning-soft); border-color: transparent; }
.card.is-danger { background: var(--danger-soft); border-color: transparent; }
.card + .card { margin-top: 12px; }

.hero {
  border-radius: var(--r-xl); padding: 18px 18px 16px; color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 12px 28px var(--accent-glow); position: relative; overflow: hidden;
}
.hero::after { content: ''; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.hero h2 { color: #fff; font-size: 1.3rem; }
.hero p { color: rgba(255, 255, 255, .85); margin: 4px 0 0; font-size: var(--fs-sm); }
.hero .btn-light { background: #fff; color: var(--accent-strong); }
.hero-stats { display: flex; gap: 10px; margin-top: 14px; }
.hero-stat { flex: 1; background: rgba(255, 255, 255, .14); border-radius: var(--r-md); padding: 8px 10px; }
.hero-stat b { display: block; font-size: 1.25rem; line-height: 1.2; }
.hero-stat span { font-size: var(--fs-xs); opacity: .9; }

/* ---- buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--r-md); border: 1px solid transparent; font-weight: 600; font-size: var(--fs-md); cursor: pointer;
  transition: transform var(--fast) var(--ease), box-shadow var(--fast), background var(--fast); white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 16px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-soft { background: var(--accent-soft); color: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--heading); border-color: var(--border-strong); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-warm { background: var(--warm); color: #231500; }
.btn-light { background: #fff; color: var(--accent-strong); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: var(--fs-sm); border-radius: 10px; }
.btn-lg { min-height: 52px; font-size: var(--fs-lg); border-radius: var(--r-lg); }
.btn-block { width: 100%; }
.btn-round { width: 44px; padding: 0; border-radius: var(--r-pill); }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ''; position: absolute; width: 18px; height: 18px; border: 2px solid currentColor; border-color: var(--on-accent) transparent var(--on-accent) transparent; border-radius: 50%; animation: spin .8s linear infinite; color: var(--heading); }
@keyframes spin { to { transform: rotate(360deg); } }

/* big action tiles on the home page */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile {
  display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--r-lg); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-1); color: var(--heading); min-height: 96px;
}
.tile i { font-size: 1.5rem; color: var(--accent); }
.tile b { font-weight: 700; }
.tile span { font-size: var(--fs-xs); color: var(--text-muted); }
.tile.is-primary { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border-color: var(--accent-border); }

/* ---- lists ------------------------------------------------------------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; width: 100%; text-align: left; border: 0; background: var(--surface);
  color: var(--text); border-bottom: 1px solid var(--border); cursor: pointer; font: inherit;
}
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item.is-current { background: var(--accent-soft); }
.list-main { flex: 1; min-width: 0; display: grid; }
.list-title { font-weight: 600; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-sub { font-size: var(--fs-sm); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.list-end { flex: none; display: flex; align-items: center; gap: 8px; }
.card .list-item:first-child { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.card .list-item:last-child { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-strong);
}
.avatar.is-lg { width: 56px; height: 56px; font-size: 1.3rem; }
.icon-badge { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; background: var(--accent-soft); color: var(--accent-strong); }
.icon-badge.is-warn { background: var(--warning-soft); color: var(--warning); }
.icon-badge.is-danger { background: var(--danger-soft); color: var(--danger); }
.icon-badge.is-ok { background: var(--success-soft); color: var(--success); }
.icon-badge.is-muted { background: var(--surface-sunken); color: var(--text-muted); }
.icon-badge.is-info { background: var(--info-soft); color: var(--info); }

/* ---- doses timeline ---------------------------------------------------- */
.dose-group { margin-top: 14px; }
.dose-time { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--heading); margin: 0 0 6px 4px; }
.dose-time .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.dose-time.is-past .dot { background: var(--text-faint); }
.dose { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 8px; }
.dose-main { flex: 1; min-width: 0; }
.dose-name { font-weight: 700; color: var(--heading); }
.dose-sub { font-size: var(--fs-sm); color: var(--text-muted); }
.dose-actions { display: flex; gap: 6px; }
.dose.is-taken { background: var(--success-soft); border-color: transparent; }
.dose.is-taken .dose-name { text-decoration: line-through; color: var(--text-muted); }
.dose.is-missed { background: var(--danger-soft); border-color: transparent; }
.dose.is-skipped { opacity: .7; }
.dose-state { font-size: var(--fs-xs); font-weight: 700; }

/* ---- forms ------------------------------------------------------------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-size: var(--fs-sm); font-weight: 600; color: var(--heading); }
.hint { font-size: var(--fs-xs); color: var(--text-faint); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--r-md); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-md);
}
.textarea { min-height: 88px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--ring); outline: none; }
.input.is-big { font-size: 1.5rem; text-align: center; min-height: 56px; letter-spacing: .02em; }
.input-row { display: flex; gap: 8px; align-items: center; }
.input-row .input { flex: 1; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 26px; transition: background var(--fast); }
.switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: transform var(--fast); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:disabled + span { opacity: .5; }

.segmented { display: flex; background: var(--surface-sunken); border-radius: var(--r-md); padding: 3px; gap: 3px; }
.segmented button, .segmented label { flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--text-muted); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; display: grid; place-items: center; }
.segmented .is-on, .segmented input:checked + span { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-1); }
.segmented label { position: relative; }
.segmented label input { position: absolute; opacity: 0; inset: 0; }
.segmented label span { width: 100%; height: 100%; display: grid; place-items: center; border-radius: 10px; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { min-height: 36px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: var(--surface); color: var(--heading); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.pill.is-on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pill input { display: none; }

/* ---- dialogs / sheets -------------------------------------------------- */
dialog { border: 0; padding: 0; background: transparent; color: var(--text); max-width: none; }
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); margin: 0; width: min(100%, 640px); max-height: 88vh;
  background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--shadow-3); overflow: auto;
  padding-bottom: var(--safe-bottom);
}
.sheet[open] { animation: rise var(--slow) var(--ease); }
@keyframes rise { from { transform: translate(-50%, 24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.sheet-head { position: sticky; top: 0; background: var(--surface); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 8px; z-index: 1; }
.sheet-head h2 { font-size: var(--fs-lg); }
.sheet-body { padding: 8px 16px 16px; }
.sheet-foot { display: flex; gap: 8px; padding: 10px 16px 16px; justify-content: flex-end; border-top: 1px solid var(--border); }
.modal { position: fixed; inset: 0; margin: auto; width: min(100% - 28px, 420px); background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-3); padding: 20px; height: fit-content; }

/* ---- toasts ------------------------------------------------------------ */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 24px + var(--safe-bottom)); z-index: 60; display: grid; gap: 8px; width: min(100% - 28px, 440px); pointer-events: none; }
.site-body .toasts { bottom: 24px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--heading); color: #fff; box-shadow: var(--shadow-3); font-size: var(--fs-sm); font-weight: 600; animation: rise2 var(--slow) var(--ease); pointer-events: auto; }
.toast.is-success { background: var(--success); }
.toast.is-error { background: var(--danger); }
.toast.is-warning { background: var(--warning); }
.toast.is-info { background: var(--info); }
@keyframes rise2 { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---- misc components --------------------------------------------------- */
.empty { text-align: center; padding: 32px 18px; color: var(--text-muted); }
.empty i { font-size: 2.4rem; color: var(--accent); display: block; margin-bottom: 8px; }
.empty h3 { font-size: var(--fs-lg); margin-bottom: 6px; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); background: var(--info-soft); color: var(--info); font-size: var(--fs-sm); }
.note.is-warn { background: var(--warning-soft); color: var(--warning); }
.note.is-danger { background: var(--danger-soft); color: var(--danger); }
.note.is-ok { background: var(--success-soft); color: var(--success); }
.note i { font-size: 1.1rem; flex: none; margin-top: 2px; }
.note p { margin: 0; }
.progress { height: 8px; background: var(--surface-sunken); border-radius: 4px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width var(--slow) var(--ease); }
.bars { display: flex; align-items: flex-end; gap: 6px; height: 60px; }
.bars .bar { flex: 1; display: grid; grid-template-rows: 1fr auto; gap: 4px; height: 100%; }
.bars .bar i { display: block; align-self: end; background: var(--accent); border-radius: 4px 4px 2px 2px; min-height: 3px; opacity: .9; }
.bars .bar i.is-low { background: var(--warning); }
.bars .bar i.is-none { background: var(--border-strong); }
.bars .bar span { font-size: 10px; color: var(--text-faint); text-align: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: var(--fs-sm); }
.kv dt { color: var(--text-muted); } .kv dd { margin: 0; color: var(--heading); font-weight: 600; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: var(--fs-xs); font-weight: 700; background: var(--surface-sunken); color: var(--text-muted); }
.tag.is-ok { background: var(--success-soft); color: var(--success); }
.tag.is-warn { background: var(--warning-soft); color: var(--warning); }
.tag.is-danger { background: var(--danger-soft); color: var(--danger); }
.tag.is-info { background: var(--info-soft); color: var(--info); }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.skeleton { background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--surface-2) 50%, var(--surface-sunken) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--r-md); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* upload / camera area */
.drop { border: 2px dashed var(--accent-border); border-radius: var(--r-xl); background: var(--accent-soft); padding: 22px 16px; text-align: center; cursor: pointer; }
.drop i { font-size: 2.2rem; color: var(--accent); }
.drop b { display: block; margin-top: 6px; color: var(--heading); }
.drop span { font-size: var(--fs-sm); color: var(--text-muted); }
.preview { position: relative; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--border); background: var(--surface-sunken); }
.preview img { width: 100%; max-height: 50vh; object-fit: contain; background: #111; }
.pages { display: grid; gap: 10px; }
.pages img { width: 100%; border-radius: var(--r-md); border: 1px solid var(--border); }

/* AI waiting */
.thinking { text-align: center; padding: 28px 18px; }
.thinking .orb { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 14px; background: radial-gradient(circle at 30% 30%, #fff8, transparent 40%), linear-gradient(135deg, var(--accent), var(--warm)); animation: pulse 1.6s ease-in-out infinite; box-shadow: 0 10px 30px var(--accent-glow); }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.08); } }

/* medicine confirm rows */
.med-row { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 12px 14px; margin-bottom: 10px; }
.med-row.is-off { opacity: .55; }
.med-row.is-unclear { border-color: var(--warning); }
.med-head { display: flex; align-items: flex-start; gap: 10px; }
.med-head .check { padding: 0; }
.med-name { font-weight: 700; color: var(--heading); font-size: var(--fs-lg); }
.med-meta { font-size: var(--fs-sm); color: var(--text-muted); }
.med-expl { margin-top: 8px; font-size: var(--fs-sm); display: grid; gap: 4px; }
.med-expl b { color: var(--heading); }
.med-edit { margin-top: 10px; display: grid; gap: 8px; }

/* vitals */
.vital-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.vital-tile { padding: 10px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); text-align: center; color: var(--heading); display: grid; gap: 2px; }
.vital-tile i { font-size: 1.2rem; color: var(--accent); }
.vital-tile b { font-size: 1.1rem; }
.vital-tile span { font-size: 10px; color: var(--text-muted); }
.vital-tile.is-on { border-color: var(--accent); background: var(--accent-soft); }
.chart { width: 100%; height: 160px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .line2 { fill: none; stroke: var(--warm); stroke-width: 2.5; stroke-linejoin: round; }
.chart .dotp { fill: var(--accent); }
.chart .dotp2 { fill: var(--warm); }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart text { font-size: 10px; fill: var(--text-faint); font-family: var(--font); }
.chart .band { fill: var(--success-soft); opacity: .6; }

/* report items */
.rep-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.rep-item:last-child { border-bottom: 0; }
.rep-val { font-weight: 700; color: var(--heading); white-space: nowrap; }

/* settings menu */
.menu .list-item i.lead { font-size: 1.2rem; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); flex: none; }
.menu .list-item i.trail { color: var(--text-faint); }

/* auth pages */
.auth { max-width: 420px; margin: 24px auto; }
.auth .brand-big { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; }
.auth .brand-big img { width: 72px; height: 72px; }
.auth .brand-big h1 { font-size: var(--fs-2xl); }

/* language switcher (settings) */
.lang-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lang-opt {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 14px 14px; border-radius: var(--r-lg);
  background: var(--surface); border: 2px solid var(--border); color: var(--heading); box-shadow: var(--shadow-1);
  transition: border-color var(--fast), background var(--fast), transform var(--fast) var(--ease);
}
.lang-opt:active { transform: scale(.98); }
.lang-opt.is-on { border-color: var(--accent); background: linear-gradient(135deg, var(--accent-soft), var(--surface)); }
.lang-glyph {
  flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 1.35rem;
  background: var(--surface-sunken); color: var(--text-muted); font-family: var(--font);
}
.lang-opt.is-on .lang-glyph { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 14px var(--accent-glow); }
.lang-text { display: grid; min-width: 0; line-height: 1.25; }
.lang-text b { font-size: var(--fs-lg); }
.lang-text small { color: var(--text-muted); font-size: var(--fs-xs); }
.lang-check { position: absolute; top: 8px; right: 10px; color: var(--accent); font-size: 1.1rem; opacity: 0; transform: scale(.6); transition: opacity var(--fast), transform var(--fast) var(--ease); }
.lang-opt.is-on .lang-check { opacity: 1; transform: none; }
.lang-opt.is-busy { opacity: .6; pointer-events: none; }

/* two-step sign-in */
.code-input { letter-spacing: .25em; font-variant-numeric: tabular-nums; }
.tf-qr { display: grid; place-items: center; background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 8px; margin: 8px auto; width: min(100%, 240px); }
.tf-qr svg { width: 100%; height: auto; display: block; }
.tf-secret { display: flex; align-items: center; justify-content: center; gap: 8px; }
.tf-secret code { font-size: var(--fs-sm); letter-spacing: .08em; background: var(--surface-sunken); padding: 6px 10px; border-radius: var(--r-sm); color: var(--heading); word-break: break-all; }
.tf-codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tf-codes code { display: block; text-align: center; padding: 10px 6px; border-radius: var(--r-sm); background: var(--surface-sunken); color: var(--heading); font-weight: 700; letter-spacing: .06em; user-select: text; -webkit-user-select: text; }

@media (min-width: 720px) {
  .page { padding: 20px 20px 40px; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
}
@media (hover: none) and (pointer: coarse) {
  body { user-select: none; -webkit-user-select: none; }
  input, textarea, .selectable { user-select: text; -webkit-user-select: text; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
