/* Goal Planner — light: white + orange/amber · dark: black + yellow/orange */
/* ===== LIGHT THEME (DEFAULT) — white + orange/amber ===== */
:root {
  --bg: #f7f6f3;
  --bg2: #ffffff;
  --bg3: #f0eee9;
  --bg4: #e2dfd6;
  --text: #14110d;
  --text2: #4a443a;
  --text3: #6b6558;
  --border: rgba(20,17,13,0.14);
  --accent: #b45309;
  --accent2: #c2410c;
  --accent-glow: rgba(180,83,9,0.13);
  --on-accent: #ffffff;
  --on-green: #ffffff;
  --heat-1: rgba(180,83,9,0.28);
  --heat-2: rgba(180,83,9,0.52);
  --heat-3: rgba(180,83,9,0.76);
  --green: #047857;
  --green-bg: rgba(4,120,87,0.12);
  --yellow: #a16207;
  --yellow-bg: rgba(161,98,7,0.13);
  --red: #b91c1c;
  --red-bg: rgba(185,28,28,0.10);
  --blue: #1d4ed8;
  --blue-bg: rgba(29,78,216,0.10);
  --pink: #be185d;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(0,0,0,0.08);
  --transition: 0.18s ease;
}

/* ===== DARK THEME — black + yellow/orange ===== */
html.dark {
  --bg: #0a0a0a;
  --bg2: #141414;
  --bg3: #1f1f1f;
  --bg4: #2f2f2f;
  --text: #f5f3ee;
  --text2: #cfcac0;
  --text3: #a8a296;
  --border: rgba(255,255,255,0.13);
  --accent: #fbbf24;
  --accent2: #fb923c;
  --accent-glow: rgba(251,191,36,0.16);
  --on-accent: #111111;
  --on-green: #0a0a0a;
  --heat-1: rgba(251,191,36,0.30);
  --heat-2: rgba(251,191,36,0.55);
  --heat-3: rgba(251,191,36,0.80);
  --green: #4ade80;
  --green-bg: rgba(74,222,128,0.15);
  --yellow: #facc15;
  --yellow-bg: rgba(250,204,21,0.15);
  --red: #f87171;
  --red-bg: rgba(248,113,113,0.15);
  --blue: #60a5fa;
  --blue-bg: rgba(96,165,250,0.15);
  --pink: #f472b6;
  --shadow: 0 4px 24px rgba(0,0,0,0.6);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  background: var(--bg); color: var(--text); height: 100%; display: flex; overflow: hidden;
  font-size: 14px; line-height: 1.5; transition: background .25s, color .25s;
}
* { scrollbar-width: thin; scrollbar-color: var(--bg4) transparent; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text2); } .faint { color: var(--text3); } .small { font-size: 12px; } .right { text-align: right; }
.row { display: flex; align-items: center; gap: 8px; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; } .stack > * + * { margin-top: 14px; } .mt { margin-top: 14px; } .mb { margin-bottom: 14px; }
.bold { font-weight: 700; }

/* ===== SIDEBAR ===== */
#sidebar { width: 240px; min-width: 240px; background: var(--bg2); display: flex; flex-direction: column; z-index: 50;
  border-right: 1px solid var(--border); overflow-y: auto; transition: transform .25s; }
.sidebar-logo { padding: 20px 18px 12px; display: flex; gap: 10px; align-items: center; }
.logo-icon { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on-accent); display: grid; place-items: center; font-size: 16px; }
.sidebar-logo strong { font-size: 15px; display: block; line-height: 1.2; }
.sidebar-logo span { font-size: 12px; color: var(--text3); display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-year { display: flex; align-items: center; gap: 6px; padding: 6px 18px 10px; font-size: 12px; color: var(--text2); }
.year-badge { background: var(--accent); color: var(--on-accent); border-radius: 4px; padding: 1px 6px; font-size: 11px; font-weight: 700; margin-left: auto; }
#sidebar nav { flex: 1; padding-bottom: 8px; }
.nav-section-label { font-size: 11px; font-weight: 700; color: var(--text3); letter-spacing: .8px; text-transform: uppercase; padding: 12px 18px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 18px; color: var(--text2); font-size: 13.5px; position: relative; text-decoration: none !important; }
.nav-item i { width: 18px; text-align: center; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); font-weight: 600; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; background: var(--accent); border-radius: 0 3px 3px 0; }
.sidebar-foot { padding: 12px 14px 16px; display: flex; gap: 8px; border-top: 1px solid var(--border); }
#sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; }
#sidebar-overlay.open { display: block; }

/* ===== MAIN ===== */
#main { flex: 1; min-width: 0; overflow-y: auto; display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; }
#topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: var(--bg); border-bottom: 1px solid var(--border); }
#topbar-title { flex: 1; font-weight: 700; font-size: 15px; }
.hamburger { display: none; width: 38px; height: 38px; border-radius: var(--radius-sm); background: var(--bg2); border: 1px solid var(--border); color: var(--text); font-size: 16px; cursor: pointer; }
#view { flex: 1; padding: 0 0 40px; }
.loading { padding: 60px; text-align: center; color: var(--text2); }
.page-header { padding: 22px 28px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.page-header h2 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; }
.page-header p { color: var(--text2); font-size: 13px; margin-top: 3px; max-width: 640px; }
.page-content { padding: 18px 28px 20px; }

/* ===== CARDS / GRID ===== */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.card-sm { padding: 12px 14px; }
.card-title { font-size: 12px; font-weight: 700; color: var(--text2); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.card-title .right-slot { margin-left: auto; text-transform: none; letter-spacing: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid-6 { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.grid-2 > *, .grid-3 > *, .grid-4 > *, .grid-6 > * { min-width: 0; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat-label { font-size: 12px; color: var(--text2); font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -.5px; line-height: 1.15; }
.stat-sub { font-size: 12px; color: var(--text2); }
.c-green { color: var(--green); } .c-yellow { color: var(--yellow); } .c-red { color: var(--red); } .c-blue { color: var(--blue); } .c-accent { color: var(--accent); }

/* ===== PROGRESS ===== */
.progress-bar { height: 8px; background: var(--bg4); border-radius: 5px; overflow: visible; position: relative; }
.progress-fill { height: 100%; border-radius: 5px; transition: width .5s ease; }
.pbar-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .65; border-radius: 2px; }
.bg-green { background: var(--green); } .bg-yellow { background: var(--yellow); } .bg-red { background: var(--red); } .bg-blue { background: var(--blue); } .bg-accent { background: linear-gradient(90deg, var(--accent), var(--accent2)); } .bg-gray { background: var(--text3); }

/* ===== BUTTONS / INPUTS ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all var(--transition); white-space: nowrap; font-family: inherit; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent2); }
.btn-ghost { background: var(--bg3); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg4); }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-icon { background: var(--bg3); border: 1px solid var(--border); color: var(--text2); width: 30px; height: 30px; border-radius: var(--radius-sm); display: inline-grid; place-items: center; cursor: pointer; font-size: 13px; flex-shrink: 0; }
.btn-icon:hover { background: var(--bg4); color: var(--text); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.input, textarea, select { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 13.5px; padding: 9px 12px; width: 100%; outline: none; font-family: inherit; resize: vertical; }
.input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.input::placeholder, textarea::placeholder { color: var(--text3); }
select option { background: var(--bg2); color: var(--text); }
input[type=range] { accent-color: var(--accent); width: 100%; padding: 0; border: none; background: none; }
input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
label { font-size: 13px; color: var(--text2); font-weight: 600; display: block; margin-bottom: 5px; }
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 12px; color: var(--text3); margin-top: 4px; }
.form-section { font-size: 12px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--accent); margin: 18px 0 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.form-error { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 13px; margin-bottom: 12px; }
.range-row { display: flex; align-items: center; gap: 10px; } .range-row output { min-width: 24px; font-weight: 700; color: var(--accent); }
.inline-add { display: flex; gap: 8px; margin-top: 10px; } .inline-add .input { flex: 1; }

/* ===== TAGS / CHIPS / TABS ===== */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag-green { background: var(--green-bg); color: var(--green); } .tag-yellow { background: var(--yellow-bg); color: var(--yellow); }
.tag-red { background: var(--red-bg); color: var(--red); } .tag-blue { background: var(--blue-bg); color: var(--blue); }
.tag-accent { background: var(--accent-glow); color: var(--accent); } .tag-gray { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 6px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg3); color: var(--text2); font-size: 13px; cursor: pointer; font-family: inherit; }
.chip.on { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.tab-bar { display: flex; gap: 2px; background: var(--bg3); border: 1px solid var(--border); border-radius: 10px; padding: 3px; width: fit-content; max-width: 100%; overflow-x: auto; }
.tab-btn { padding: 6px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text2); border: none; background: none; white-space: nowrap; font-family: inherit; }
.tab-btn.active { background: var(--bg2); color: var(--accent); font-weight: 700; box-shadow: 0 0 0 1px var(--border); }

/* ===== LISTS ===== */
.li { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.li:last-child { border-bottom: none; }
.li-main { flex: 1; min-width: 0; }
.li-title { font-size: 14px; color: var(--text); word-break: break-word; }
.li-title.done { text-decoration: line-through; color: var(--text3); }
.li-meta { font-size: 12px; color: var(--text3); margin-top: 2px; }
.li-actions { display: flex; gap: 4px; opacity: .85; }
.check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--text3); background: none; cursor: pointer; display: grid; place-items: center; flex-shrink: 0; margin-top: 1px; color: transparent; font-size: 11px; padding: 0; }
.check:hover { border-color: var(--accent); }
.check.done { background: var(--green); border-color: var(--green); color: var(--on-green); }
.empty-state { text-align: center; padding: 28px 12px; color: var(--text2); }
.empty-state i { font-size: 28px; color: var(--text3); display: block; margin-bottom: 8px; }

/* ===== GOALS ===== */
.goal-card { display: block; color: inherit !important; text-decoration: none !important; transition: border-color var(--transition), transform var(--transition); }
.goal-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.goal-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; word-break: break-word; }
.goal-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kv { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.kv .k { font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .4px; }
.kv .v { font-size: 18px; font-weight: 800; margin-top: 2px; } .kv .s { font-size: 12px; color: var(--text2); }
.text-block { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.field-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); margin: 12px 0 3px; } .field-label:first-child { margin-top: 0; }
.strength { display: grid; gap: 6px; } .strength .it { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.strength .it i { margin-top: 3px; } .strength .ok i { color: var(--green); } .strength .no { color: var(--text2); } .strength .no i { color: var(--text3); }

/* ===== COACH / TIMELINE ===== */
.coach { display: flex; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg3); color: var(--text) !important; text-decoration: none !important; align-items: flex-start; }
.coach + .coach { margin-top: 8px; }
.coach i { margin-top: 3px; width: 16px; text-align: center; }
.coach.warn { border-left: 3px solid var(--yellow); } .coach.warn i { color: var(--yellow); }
.coach.bad { border-left: 3px solid var(--red); } .coach.bad i { color: var(--red); }
.coach.good { border-left: 3px solid var(--green); } .coach.good i { color: var(--green); }
.coach.info { border-left: 3px solid var(--accent); } .coach.info i { color: var(--accent); }
.timeline .tl { position: relative; padding: 0 0 14px 18px; border-left: 2px solid var(--bg4); margin-left: 6px; }
.timeline .tl::before { content: ''; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.timeline .tl:last-child { padding-bottom: 0; }

/* ===== PICKERS ===== */
.num-picker { display: flex; gap: 4px; flex-wrap: wrap; }
.num-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg3); color: var(--text2); font-weight: 600; cursor: pointer; font-family: inherit; }
.num-btn.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.mood-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.mood-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg3); font-size: 22px; cursor: pointer; opacity: .6; line-height: 1; }
.mood-btn.on { opacity: 1; border-color: var(--accent); background: var(--accent-glow); transform: scale(1.08); }

/* ===== WEEK / HABITS ===== */
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day-col { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; min-height: 130px; display: flex; flex-direction: column; gap: 6px; }
.day-col.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.day-head { display: flex; align-items: baseline; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--text2); }
.day-head b { font-size: 16px; color: var(--text); }
.day-task { font-size: 12.5px; padding: 6px 8px; border-radius: 6px; background: var(--bg3); border: 1px solid var(--border); border-left: 3px solid var(--text3); cursor: pointer; word-break: break-word; text-align: left; color: var(--text); font-family: inherit; }
.day-task.done { border-left-color: var(--green); opacity: .65; text-decoration: line-through; }
.day-task.high { border-left-color: var(--red); } .day-task.mit { border-left-color: var(--accent); font-weight: 600; }
.add-day { border: 1px dashed var(--border); background: none; color: var(--text3); border-radius: 6px; padding: 4px; cursor: pointer; font-size: 12px; margin-top: auto; font-family: inherit; }
.add-day:hover { color: var(--accent); border-color: var(--accent); }
.hg-wrap { overflow-x: auto; }
table.hg { border-collapse: separate; border-spacing: 3px; font-size: 11px; }
.hg th { font-weight: 600; color: var(--text2); text-align: center; min-width: 22px; } .hg td.name { text-align: left; font-size: 13px; padding-right: 10px; white-space: nowrap; color: var(--text); }
.hg-cell { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg3); cursor: pointer; display: grid; place-items: center; font-size: 10px; color: var(--on-green); padding: 0; }
.hg-cell.done { background: var(--green); border-color: var(--green); } .hg-cell.off { opacity: .35; cursor: default; } .hg-cell.future { opacity: .5; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); grid-auto-columns: 12px; gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.hc { width: 12px; height: 12px; border-radius: 3px; background: var(--bg4); }
.heat-1 { background: var(--heat-1); } .heat-2 { background: var(--heat-2); } .heat-3 { background: var(--heat-3); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; font-size: 11px; color: var(--text2); }
.bars .b i { display: block; width: 100%; border-radius: 5px 5px 0 0; min-height: 3px; }
.target-line { position: relative; }
svg text { fill: var(--text2); font-family: inherit; }
svg .grid { stroke: var(--bg4); fill: none; } svg .ring-bg { stroke: var(--bg4); fill: none; }
.prose h3 { font-size: 16px; margin: 18px 0 6px; } .prose h3:first-child { margin-top: 0; }
.prose p, .prose li { font-size: 14px; color: var(--text2); line-height: 1.65; } .prose p { margin-bottom: 8px; } .prose ul, .prose ol { margin: 4px 0 10px 20px; }
.prose b, .prose strong { color: var(--text); } .prose .formula { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 6px 0 10px; font-size: 13px; color: var(--text); overflow-x: auto; }

.mini { border: 1px solid var(--border); background: var(--bg3); color: var(--text2); border-radius: 6px; width: 24px; cursor: pointer; font-size: 10px; flex-shrink: 0; }
.mini:hover { color: var(--accent); border-color: var(--accent); }

/* ===== MODAL / TOAST ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 12px; }
.modal { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; width: 560px; max-width: 100%; max-height: 92vh; overflow-y: auto; box-shadow: var(--shadow); animation: modalIn .18s ease; }
.modal-title { font-size: 17px; font-weight: 800; margin-bottom: 16px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; font-size: 13px; box-shadow: var(--shadow); display: flex; gap: 8px; align-items: center; animation: modalIn .2s ease; max-width: 340px; }
.toast.success i { color: var(--green); } .toast.error { border-color: var(--red); } .toast.error i { color: var(--red); }

/* ===== AUTH ===== */
.auth-body { display: block; overflow: auto; }
.auth-wrap { min-height: 100%; display: grid; place-items: center; padding: 20px; }
.auth-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 18px; padding: 32px 28px; width: 400px; max-width: 100%; box-shadow: var(--shadow); }
.auth-logo { width: 48px; height: 48px; border-radius: 14px; background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--on-accent); display: grid; place-items: center; font-size: 22px; margin-bottom: 14px; }
.auth-card h1 { font-size: 22px; font-weight: 800; } .auth-sub { color: var(--text2); margin: 4px 0 18px; font-size: 13px; }
.auth-error { background: var(--red-bg); color: var(--red); border: 1px solid var(--red); border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }
.auth-btn { width: 100%; padding: 11px; font-size: 14px; margin-top: 4px; } .auth-switch { text-align: center; margin-top: 16px; font-size: 13px; color: var(--text2); }

/* ===== BOTTOM NAV (mobile) ===== */
#bottom-nav { display: none; }

@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: 1fr 1fr; } .grid-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 860px) {
  #sidebar { position: fixed; top: 0; bottom: 0; left: 0; transform: translateX(-100%); box-shadow: var(--shadow); }
  #sidebar.open { transform: none; }
  .hamburger { display: grid; place-items: center; }
  #topbar { padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .page-header { padding: 16px 14px 0; } .page-content { padding: 14px 14px 20px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: 1fr; } .day-col { min-height: 0; }
  #view { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  #bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: var(--bg2); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  #bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0; color: var(--text3); font-size: 11px; font-weight: 600; text-decoration: none !important; border-radius: 10px; }
  #bottom-nav a i { font-size: 17px; } #bottom-nav a.active { color: var(--accent); background: var(--accent-glow); }
  #toast-container { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); } .toast { max-width: none; }
  .hide-sm { display: none; }
  .input, textarea, select { font-size: 16px; }   /* stops iOS zoom-on-focus */
  .modal { padding: 18px; max-height: 94vh; }
  .stat-value { font-size: 22px; }
}
@media (max-width: 420px) { .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; } .form-row { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
