@font-face{font-family:Dana;src:url('/font.woff2') format('woff2');font-display:swap}

/* ---------- Tokens (light; dark below) ---------- */
:root{
  color-scheme:light;
  --bg:#f6f4ee;--surface:#fffefa;--surface-2:#f1efe7;--ink:#16372f;--muted:#5d6a63;--line:#e3e1d7;--line-strong:#d2cfc2;
  --brand:#174a3e;--brand-2:#1f5c4d;--on-brand:#fffdf7;--brand-muted:#c5d6cc;
  --gold:#94601e;--gold-bright:#d6a76a;--gold-soft:#f5ead9;
  --success:#2c7650;--success-soft:#e4f1e8;--warn:#94590f;--warn-soft:#fbefdb;--danger:#ad3a2d;--danger-soft:#fae9e5;
  --ring:#c8954f;--shadow-sm:0 1px 2px #16372f0d;--shadow:0 10px 30px #16372f12;--shadow-lg:0 30px 80px #0c2a2233;
  --c-math:#b0773c;--c-bio:#4f8a68;--c-physics:#5b7fa8;--c-chem:#9a6f97;--c-general:#a08743;--c-analysis:#94601e;
  --radius:14px;--radius-sm:10px;--tap:44px;--ease:cubic-bezier(.2,.7,.2,1);
  --tabbar-h:64px;
}
@media (prefers-color-scheme:dark){:root{
  color-scheme:dark;
  --bg:#0e1714;--surface:#15211d;--surface-2:#1b2a25;--ink:#e6eee9;--muted:#9fb2a8;--line:#26372f;--line-strong:#35493f;
  --brand:#123a31;--brand-2:#2e7a64;--on-brand:#f4faf6;--brand-muted:#a9c4b6;
  --gold:#e2b479;--gold-bright:#e2b479;--gold-soft:#33291b;
  --success:#71c79a;--success-soft:#173126;--warn:#ebb466;--warn-soft:#352915;--danger:#f2907f;--danger-soft:#3a1f1a;
  --ring:#e2b479;--shadow-sm:none;--shadow:0 10px 30px #0005;--shadow-lg:0 30px 80px #000a;
  --c-math:#d9a066;--c-bio:#7fbd98;--c-physics:#8eaed6;--c-chem:#c9a0c6;--c-general:#cdb36d;--c-analysis:#e2b479;
}}

/* ---------- Base ---------- */
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:var(--ink);font-family:Dana,Tahoma,sans-serif;font-size:15px;line-height:1.8;-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer;border:0;background:none;padding:0}
button:disabled{cursor:not-allowed}
a{color:inherit}
button,a,input,textarea,select,label{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
:focus-visible{outline:2px solid var(--ring);outline-offset:2px}
h1,h2,h3,p{margin:0}
h1{font-size:30px;line-height:1.45;font-weight:800;letter-spacing:-.2px}
h2{font-size:19px;line-height:1.6;font-weight:700}
h3{font-size:16px;line-height:1.7;font-weight:700}
small,.muted{color:var(--muted)}
.icon{width:20px;height:20px;flex:none;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.icon.sm{width:16px;height:16px}
.icon.lg{width:24px;height:24px}
.num{font-variant-numeric:tabular-nums}
.hidden{display:none!important}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* ---------- Loading ---------- */
.loading{min-height:100vh;min-height:100dvh;display:grid;place-content:center;justify-items:center;gap:10px;text-align:center;font-size:24px;font-weight:800;padding:24px}
.loading small{font-size:14px;font-weight:400}
.loading:before{content:'';width:40px;height:40px;border-radius:50%;border:3px solid var(--line);border-top-color:var(--brand-2);animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---------- Buttons ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:var(--tap);padding:0 18px;border-radius:12px;background:var(--brand-2);color:var(--on-brand);font-size:14px;font-weight:700;white-space:nowrap;transition:background-color .18s var(--ease),transform .12s var(--ease),box-shadow .18s var(--ease);box-shadow:var(--shadow-sm)}
.btn:hover{background:var(--brand)}
.btn:active{transform:scale(.97)}
.btn:disabled{opacity:.45;transform:none}
.btn.light{background:var(--surface);color:var(--ink);border:1px solid var(--line-strong);box-shadow:none}
.btn.light:hover{background:var(--surface-2)}
.btn.gold{background:var(--gold-bright);color:#2b1d08}
.btn.danger{background:var(--danger);color:#fff}
.btn.ghost{background:transparent;color:var(--ink);box-shadow:none}
.btn.ghost:hover{background:var(--surface-2)}
.btn.small{min-height:38px;padding:0 13px;font-size:13px;border-radius:10px}
.btn.block{width:100%}
.icon-btn{display:inline-grid;place-items:center;width:var(--tap);height:var(--tap);border-radius:12px;color:var(--ink);transition:background-color .18s var(--ease)}
.icon-btn:hover{background:var(--surface-2)}
.btn.is-busy{position:relative;color:transparent!important}
.btn.is-busy:after{content:'';position:absolute;width:18px;height:18px;border-radius:50%;border:2px solid #fff6;border-top-color:#fff;animation:spin .8s linear infinite}

/* ---------- Badges, callouts ---------- */
.badge{display:inline-flex;align-items:center;gap:4px;font-size:12px;line-height:1.6;padding:2px 10px;border-radius:999px;background:var(--surface-2);color:var(--ink);white-space:nowrap;font-weight:600}
.badge .icon{width:14px;height:14px}
.badge.success{background:var(--success-soft);color:var(--success)}
.badge.amber{background:var(--warn-soft);color:var(--warn)}
.badge.red{background:var(--danger-soft);color:var(--danger)}
.badge.now{background:var(--brand-2);color:var(--on-brand)}
.callout{display:flex;gap:12px;align-items:flex-start;background:var(--gold-soft);border:1px solid color-mix(in srgb,var(--gold) 25%,transparent);color:var(--ink);border-radius:var(--radius-sm);padding:13px 16px;font-size:14px;margin-bottom:14px}
.callout .icon{color:var(--gold);margin-top:3px}
.callout.alert{background:var(--danger-soft);border-color:color-mix(in srgb,var(--danger) 25%,transparent)}
.callout.alert .icon{color:var(--danger)}
.callout.info{background:var(--surface-2);border-color:var(--line)}
.callout.info .icon{color:var(--muted)}
.eyebrow{font-size:13px;color:var(--gold);font-weight:700;margin-bottom:2px}
.note{font-size:13px;color:var(--muted);line-height:1.9}
.section-gap{margin-top:20px}
.source-link{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var(--gold);text-decoration:none;font-weight:600;min-height:var(--tap)}
.source-link:hover{text-decoration:underline}

/* ---------- Shell ---------- */
.shell{display:grid;grid-template-columns:256px minmax(0,1fr);min-height:100vh}
.sidebar{background:var(--brand);color:var(--on-brand);padding:28px 18px;position:sticky;top:0;height:100vh;display:flex;flex-direction:column}
.brand{font-size:25px;font-weight:800;line-height:1.4}
.brand span{color:var(--gold-bright)}
.brand-sub{font-size:12px;color:var(--brand-muted);margin-top:2px}
.profile{display:flex;align-items:center;gap:12px;margin:26px 0 20px;padding:16px 0;border-top:1px solid #ffffff1c;border-bottom:1px solid #ffffff1c}
.avatar{display:grid;place-items:center;width:44px;height:44px;flex:none;background:var(--gold-bright);color:#2b1d08;border-radius:50%;font-size:20px;font-weight:800}
.profile strong{font-size:15px;display:block;line-height:1.5}
.nav{display:grid;gap:4px}
.nav button{display:flex;align-items:center;gap:12px;min-height:46px;padding:0 14px;border-radius:12px;color:var(--brand-muted);text-align:right;font-weight:600;transition:background-color .18s var(--ease),color .18s var(--ease)}
.nav button:hover{background:#ffffff10;color:var(--on-brand)}
.nav button.active{background:#ffffff1a;color:var(--on-brand);box-shadow:inset -3px 0 0 var(--gold-bright)}
.sidebar-foot{margin-top:auto;color:var(--brand-muted);font-size:12px;line-height:2}
.sidebar-foot button{display:inline-flex;align-items:center;gap:8px;color:var(--on-brand);min-height:var(--tap);margin-top:6px;font-weight:600}
.main{padding:28px 40px 48px;max-width:1440px;width:100%;margin:0 auto}
.topbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:22px}
.date-pill{display:inline-flex;align-items:center;gap:8px;font-size:14px;color:var(--muted);font-weight:600}
.online{width:8px;height:8px;background:var(--success);border-radius:50%;box-shadow:0 0 0 4px var(--success-soft)}
.top-actions{display:flex;gap:6px;align-items:center}
.mobile-brand{display:none}
.tabbar{display:none}

/* ---------- Page intro & day navigator ---------- */
.intro{display:flex;justify-content:space-between;align-items:flex-end;gap:20px;margin-bottom:20px}
.intro p{color:var(--muted);margin-top:4px}
.day-tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.day-nav{display:inline-flex;align-items:center;gap:2px;background:var(--surface);border:1px solid var(--line);border-radius:14px;padding:3px}
.day-nav .icon-btn{width:40px;height:40px}
.day-nav .day-range{padding:0 10px;font-size:13px;font-weight:700;color:var(--muted);white-space:nowrap}

/* ---------- Focus card (now / next) ---------- */
.focus{display:grid;grid-template-columns:auto 1fr auto;align-items:center;gap:16px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:18px 20px;margin-bottom:16px;box-shadow:var(--shadow)}
.focus-icon{display:grid;place-items:center;width:48px;height:48px;border-radius:14px;background:var(--success-soft);color:var(--success)}
.focus.alert .focus-icon{background:var(--danger-soft);color:var(--danger)}
.focus.next .focus-icon{background:var(--gold-soft);color:var(--gold)}
.focus h2{font-size:18px}
.focus p{font-size:14px;color:var(--muted)}
.focus .progress{margin:10px 0 0}

/* ---------- Hero ---------- */
.hero{background:linear-gradient(135deg,var(--brand) 0%,var(--brand-2) 140%);color:var(--on-brand);border-radius:var(--radius);padding:22px 26px;display:grid;grid-template-columns:1fr auto;gap:22px;align-items:center;position:relative;overflow:hidden;margin-bottom:16px}
.hero:after{content:'';position:absolute;width:260px;height:260px;border:1px solid #ffffff14;border-radius:50%;left:-90px;top:-110px;pointer-events:none}
.hero .eyebrow{color:var(--gold-bright)}
.hero p{font-size:17px;line-height:2;max-width:760px}
.hero-stat{text-align:center;padding-right:22px;border-right:1px solid #ffffff26;min-width:110px}
.hero-stat strong{display:block;font-size:40px;line-height:1.1;font-weight:800}
.hero-stat small{color:var(--brand-muted);font-size:12px}

/* ---------- Metrics ---------- */
.metrics{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-bottom:20px}
.metric{display:flex;gap:12px;align-items:flex-start;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-sm);padding:14px 16px}
.metric-icon{display:grid;place-items:center;width:36px;height:36px;border-radius:10px;background:var(--surface-2);color:var(--gold);flex:none}
.metric .label{font-size:12px;color:var(--muted);font-weight:600}
.metric .value{font-size:22px;font-weight:800;line-height:1.5}
.metric .value small{font-size:12px;font-weight:600}
.metric > div > small{font-size:12px;display:block;line-height:1.6}

/* ---------- Panels ---------- */
.workspace{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(280px,1fr);gap:20px;align-items:start}
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:20px;margin-bottom:18px;box-shadow:var(--shadow)}
.panel-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
.panel-header h2{font-size:18px}
.list-row{padding:13px 0;border-bottom:1px solid var(--line);font-size:14px}
.list-row:last-child{border-bottom:0}
.list-row .row-head{display:flex;justify-content:space-between;align-items:center;gap:10px}
.empty{text-align:center;padding:28px 10px;color:var(--muted)}
.empty .icon{width:32px;height:32px;color:var(--line-strong);margin-bottom:6px}
.empty h3{color:var(--ink);margin-bottom:4px}
.father-message{font-size:16px;line-height:2.1;margin:8px 0}
.signature{display:flex;align-items:center;gap:6px;color:var(--gold);font-size:13px;font-weight:700}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:20px;align-items:start}

/* ---------- Timeline ---------- */
.timeline{display:grid}
.task{display:grid;grid-template-columns:62px 1fr;gap:14px;position:relative;padding-bottom:12px}
.time{font-size:14px;text-align:center;padding-top:14px;font-weight:700;line-height:1.5}
.time small{display:block;font-size:12px;font-weight:500}
.task-card{--color:var(--gold);padding:14px 16px;background:var(--surface);border:1px solid var(--line);border-inline-start:4px solid var(--color);border-radius:12px;transition:border-color .18s var(--ease),box-shadow .18s var(--ease)}
.task-card[data-subject=math]{--color:var(--c-math)}.task-card[data-subject=bio]{--color:var(--c-bio)}.task-card[data-subject=physics]{--color:var(--c-physics)}.task-card[data-subject=chem]{--color:var(--c-chem)}.task-card[data-subject=general]{--color:var(--c-general)}.task-card[data-subject=analysis]{--color:var(--c-analysis)}
.task-card.complete{background:var(--success-soft)}
.task-card.overdue{border-color:color-mix(in srgb,var(--danger) 45%,var(--line));border-inline-start-color:var(--danger)}
.task-card.current{box-shadow:0 0 0 2px var(--color),var(--shadow)}
.task-head{display:flex;justify-content:space-between;align-items:center;gap:10px}
.task-head h3{display:flex;align-items:center;gap:8px}
.dot{width:9px;height:9px;border-radius:50%;background:var(--color);flex:none}
.task-body{font-size:13px;color:var(--muted);margin:6px 0 8px;line-height:1.9}
.task-foot{display:flex;justify-content:space-between;align-items:center;gap:8px}
.task-foot > small{display:inline-flex;align-items:center;gap:5px;font-size:12px}
.log-note{font-size:13px;background:var(--surface-2);border-radius:9px;padding:8px 11px;margin:4px 0 10px;line-height:1.9}
.break{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted);padding:0 76px 12px 0}
.break:after{content:'';flex:1;height:1px;background:repeating-linear-gradient(to left,var(--line-strong) 0 5px,transparent 5px 10px)}
.close-day{width:100%;margin-top:8px}
.progress{height:8px;background:var(--surface-2);border-radius:99px;overflow:hidden;margin:10px 0}
.progress span{display:block;height:100%;background:var(--success);border-radius:99px;transition:width .4s var(--ease)}
.subject-row{display:flex;justify-content:space-between;font-size:14px;margin-top:14px}

/* ---------- Calendar ---------- */
.month-tools{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px;gap:8px}
.month-tools h2{font-size:19px}
.calendar{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:8px}
.calendar-head{text-align:center;font-size:12px;color:var(--muted);padding:6px 0;font-weight:700}
.calendar-cell{position:relative;background:var(--surface);border:1px solid var(--line);border-radius:12px;min-height:96px;text-align:right;padding:10px;display:flex;flex-direction:column;align-items:flex-start;gap:4px;transition:border-color .18s var(--ease),transform .12s var(--ease)}
.calendar-cell:hover{border-color:var(--line-strong)}
.calendar-cell:active{transform:scale(.97)}
.calendar-cell strong{font-size:20px;line-height:1.3}
.calendar-cell small{font-size:12px;line-height:1.5}
.calendar-cell.before{background:transparent;opacity:.55}
.calendar-cell.selected{box-shadow:0 0 0 2px var(--brand-2)}
.calendar-cell.today{background:var(--success-soft);border-color:color-mix(in srgb,var(--success) 40%,transparent)}
.calendar-cell.exam{border-color:var(--gold)}
.kind-dot{display:inline-block;width:8px;height:8px;border-radius:50%;background:var(--muted);margin-left:4px;vertical-align:middle}
.kind-study{background:var(--c-math)}.kind-test{background:var(--c-physics)}.kind-review{background:var(--c-bio)}.kind-catchup{background:var(--warn)}.kind-rest{background:var(--line-strong)}.kind-exam{background:var(--gold)}
.cal-flag{position:absolute;top:8px;left:8px;display:grid;place-items:center;width:20px;height:20px;border-radius:50%;background:var(--success);color:#fff}
.cal-flag .icon{width:12px;height:12px;stroke-width:3}
.legend{display:flex;flex-wrap:wrap;gap:6px 16px;font-size:13px;color:var(--muted);margin-top:14px}

/* ---------- Forms ---------- */
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.field{display:grid;gap:6px;align-content:start}
.field.full{grid-column:1/-1}
.field label{font-size:13px;color:var(--muted);font-weight:600}
input,select,textarea{width:100%;min-height:var(--tap);border:1px solid var(--line-strong);background:var(--surface);border-radius:11px;padding:9px 12px;color:var(--ink);min-width:0;font-size:16px;transition:border-color .18s var(--ease),box-shadow .18s var(--ease)}
input:focus,select:focus,textarea:focus{outline:0;border-color:var(--ring);box-shadow:0 0 0 3px color-mix(in srgb,var(--ring) 28%,transparent)}
input[type=time],input[type=number],input[type=date]{direction:ltr;text-align:right}
input[type=checkbox]{width:20px;height:20px;min-height:0;accent-color:var(--brand-2)}
textarea{min-height:84px;resize:vertical;line-height:1.8}
.form-actions{display:flex;gap:10px;margin-top:20px;justify-content:flex-end}
.error{color:var(--danger);font-size:14px;min-height:0;margin-top:10px;font-weight:600}
.error:empty{margin:0}
.check-row{display:flex;gap:10px;align-items:center;font-size:14px;min-height:var(--tap);cursor:pointer}
.check-row input{width:20px}
.extras-row{display:grid;grid-template-columns:1fr 1.5fr 90px 1fr 1fr auto;gap:8px;margin-bottom:10px;padding-bottom:10px;border-bottom:1px dashed var(--line)}
.mistake-row{border:1px solid var(--line);background:var(--surface);padding:14px;border-radius:12px;margin:12px 0}
.sleep-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px}
.unregistered{color:var(--danger)}
.pw-wrap{position:relative}
.pw-wrap input{padding-left:50px}
.pw-wrap .icon-btn{position:absolute;left:2px;top:50%;transform:translateY(-50%);color:var(--muted)}

/* ---------- Auth ---------- */
.auth{max-width:440px;margin:8vh auto;padding:34px;background:var(--surface);border:1px solid var(--line);border-radius:20px;box-shadow:var(--shadow)}
.auth-mark{display:grid;place-items:center;width:56px;height:56px;border-radius:16px;background:var(--brand-2);color:var(--on-brand);margin-bottom:16px}
.auth .brand{margin-bottom:4px}
.auth h2{margin-top:6px}
.auth p{margin:4px 0 22px;color:var(--muted);font-size:14px}
.auth form{display:grid;gap:14px}
.auth .btn{width:100%;margin-top:6px;min-height:50px;font-size:15px}
.auth .note{margin-top:18px;display:flex;gap:8px;align-items:center}

/* ---------- Dialog ---------- */
dialog{border:0;border-radius:20px;padding:0;width:min(680px,94vw);max-height:90vh;background:var(--bg);color:var(--ink);box-shadow:var(--shadow-lg);overflow:hidden}
dialog[open]{display:flex;flex-direction:column;animation:pop .22s var(--ease)}
dialog::backdrop{background:#0b211bb3;backdrop-filter:blur(3px)}
@keyframes pop{from{opacity:0;transform:translateY(12px) scale(.98)}}
.dialog-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;padding:20px 22px 0}
.dialog-head h2{font-size:19px}
.dialog-body{overflow:auto;padding:4px 22px 22px;overscroll-behavior:contain}
.dialog-sub{color:var(--muted);font-size:13px;margin-bottom:18px;line-height:1.9}
dialog .form-actions{position:sticky;bottom:-22px;margin:20px -22px -22px;padding:14px 22px calc(14px + env(safe-area-inset-bottom));background:var(--bg);border-top:1px solid var(--line)}
dialog .form-actions .btn{flex:1;max-width:320px}

/* ---------- Toast ---------- */
#toast{position:fixed;bottom:24px;left:50%;transform:translate(-50%,16px);max-width:min(92vw,520px);padding:12px 18px;border-radius:14px;color:var(--on-brand);background:var(--brand);z-index:100;font-size:14px;font-weight:600;box-shadow:var(--shadow-lg);opacity:0;pointer-events:none;transition:opacity .2s var(--ease),transform .2s var(--ease)}
#toast.show{opacity:1;transform:translate(-50%,0)}

/* ---------- Reports ---------- */
.report-range{display:flex;align-items:flex-end;flex-wrap:wrap;gap:10px;margin-bottom:18px}
.report-range .field{width:180px}
.segmented{display:inline-flex;background:var(--surface-2);border-radius:12px;padding:3px;gap:2px}
.segmented button{min-height:38px;padding:0 16px;border-radius:9px;font-size:14px;font-weight:700;color:var(--muted);transition:background-color .18s var(--ease),color .18s var(--ease)}
.segmented button.period-active{background:var(--surface);color:var(--ink);box-shadow:var(--shadow-sm)}
.report-table{width:100%;border-collapse:collapse;font-size:14px}
.report-table th,.report-table td{text-align:right;padding:11px 8px;border-bottom:1px solid var(--line);vertical-align:top}
.report-table th{font-weight:600;color:var(--muted);font-size:13px;white-space:nowrap}
.table-wrap{overflow:auto;margin:0 -4px;padding:0 4px}
.chart{display:flex;gap:10px;height:170px;align-items:flex-end;margin:16px 0 10px}
.chart-col{flex:1;text-align:center;font-size:12px;min-width:22px;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%}
.chart-col span{font-weight:700}
.chart-bar{background:var(--c-bio);border-radius:6px 6px 2px 2px;min-height:3px;margin:4px auto;width:70%;max-width:28px;height:var(--height)}
.chart-col small{font-size:11px}

/* ---------- Exams ---------- */
.exam-row{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:12px 0;border-bottom:1px solid var(--line)}
.exam-row:last-child{border-bottom:0}
.exam-days{font-size:13px;color:var(--muted);white-space:nowrap}

/* ---------- Tablet ---------- */
@media (max-width:1100px){
  .main{padding:24px}
  .shell{grid-template-columns:220px minmax(0,1fr)}
  .workspace{grid-template-columns:1fr}
  .workspace aside{display:grid;grid-template-columns:1fr 1fr;gap:16px}
  .workspace aside .panel{margin-bottom:0}
  .metrics{grid-template-columns:repeat(2,1fr)}
}

/* ---------- Phone ---------- */
@media (max-width:760px){
  body{font-size:15px}
  h1{font-size:24px}
  .shell{display:block}
  .sidebar{display:none}
  .main{padding:0 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom))}
  .topbar{position:sticky;top:0;z-index:20;margin:0 -16px 16px;padding:10px 16px calc(10px);padding-top:calc(10px + env(safe-area-inset-top));background:color-mix(in srgb,var(--bg) 88%,transparent);backdrop-filter:blur(12px);border-bottom:1px solid var(--line)}
  .mobile-brand{display:block;font-size:17px;font-weight:800;line-height:1.3}
  .mobile-brand span{color:var(--gold)}
  .date-pill{font-size:12px}
  .date-pill .online{display:none}
  .tabbar{display:grid;grid-template-columns:repeat(5,1fr);position:fixed;bottom:0;left:0;right:0;z-index:30;height:calc(var(--tabbar-h) + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom);background:color-mix(in srgb,var(--surface) 94%,transparent);backdrop-filter:blur(14px);border-top:1px solid var(--line)}
  .tabbar button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;font-size:11px;font-weight:700;color:var(--muted);transition:color .18s var(--ease)}
  .tabbar button .icon{width:22px;height:22px;padding:0;transition:transform .18s var(--ease)}
  .tabbar button.active{color:var(--success)}
  .tabbar button.active .icon{transform:translateY(-1px);stroke-width:2.3}
  .intro{display:block;margin-bottom:14px}
  .intro p{font-size:14px}
  .day-tools{margin-top:12px}
  .focus{grid-template-columns:auto 1fr;padding:16px}
  .focus .btn{grid-column:1/-1;width:100%}
  .focus-icon{width:42px;height:42px}
  .hero{grid-template-columns:1fr auto;padding:18px;gap:14px}
  .hero p{font-size:15px;line-height:1.95}
  .hero-stat{padding-right:14px;min-width:0}
  .hero-stat strong{font-size:30px}
  .hero-stat small{font-size:11px}
  .metrics{grid-template-columns:1fr 1fr;gap:10px;margin-bottom:16px}
  .metric{padding:12px;gap:10px;flex-direction:column}
  .metric-icon{width:32px;height:32px}
  .metric .value{font-size:20px}
  .workspace aside{display:block}
  .workspace aside .panel{margin-bottom:16px}
  .panel{padding:16px;margin-bottom:16px;border-radius:16px}
  .task{grid-template-columns:48px 1fr;gap:10px}
  .time{font-size:13px;padding-top:12px}
  .time small{font-size:11px}
  .task-card{padding:12px 14px}
  .task-foot{flex-wrap:wrap}
  .task-foot .btn{flex:1}
  .break{padding-right:58px}
  .grid2{grid-template-columns:1fr;gap:0}
  .calendar{gap:4px}
  .calendar-cell{min-height:64px;padding:6px 5px;border-radius:10px;align-items:center;text-align:center}
  .calendar-cell strong{font-size:17px}
  .calendar-cell small{display:none}
  .calendar-cell .kind-dot{margin:0}
  .cal-flag{top:3px;left:3px;width:14px;height:14px}
  .cal-flag .icon{width:9px;height:9px}
  .calendar-head{font-size:11px;padding:2px 0}
  .calendar-head .long{display:none}
  .month-tools h2{font-size:17px}
  .form-grid{grid-template-columns:1fr 1fr;gap:12px}
  .form-grid > .field:has(textarea),.form-grid > .field:has(select[name=status]){grid-column:1/-1}
  .extras-row{grid-template-columns:1fr 1fr}
  .extras-row input[aria-label="شرح فعالیت"]{grid-column:1/-1;order:-1}
  .auth{margin:5vh 16px;padding:26px 22px}
  .sleep-grid{grid-template-columns:1fr}
  dialog{width:100vw;max-width:100vw;max-height:94vh;max-height:94dvh;margin:auto 0 0;border-radius:22px 22px 0 0}
  dialog[open]{animation:sheet .26s var(--ease)}
  @keyframes sheet{from{transform:translateY(40px);opacity:.4}}
  .dialog-head{padding:18px 18px 0}
  .dialog-body{padding:4px 18px 18px}
  dialog .form-actions{margin:18px -18px -18px;padding:12px 18px calc(12px + env(safe-area-inset-bottom))}
  dialog .form-actions .btn{max-width:none}
  .report-range .field{width:calc(50% - 5px)}
  .report-table{font-size:13px}
  .report-table td,.report-table th{padding:9px 5px}
  #toast{bottom:calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom))}
}
@media (max-width:360px){.form-grid{grid-template-columns:1fr}.metrics{grid-template-columns:1fr}}

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion:reduce){*,*:before,*:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}}
@media print{
  :root{color-scheme:light}
  .sidebar,.topbar,.tabbar,.day-tools,.btn,.report-range,#toast,.segmented{display:none!important}
  .shell{display:block}.main{padding:0}
  .panel{box-shadow:none;break-inside:avoid;border-color:#ccc}
  .hero{color:#16372f;background:#fff;border:1px solid #ccc}
  body{background:#fff;color:#16372f;font-size:12px}
  .metrics{grid-template-columns:repeat(4,1fr)}
  .chart-bar{print-color-adjust:exact;-webkit-print-color-adjust:exact}
  .intro h1{font-size:23px}
}
.calendar-head .short{display:none}
@media (max-width:760px){.calendar-head .short{display:inline}}
.auth .brand span{color:var(--gold)}
.form-grid > .field:has(input[name=minutes]){grid-column:1/-1}
.cal-flag.legend-flag,.calendar-cell .cal-flag.legend-flag{position:static;display:inline-grid;width:16px;height:16px;vertical-align:middle;margin-left:4px}
.legend-flag .icon{width:10px;height:10px}

/* ---------- Dashboard charts (palette validated: dataviz validate_palette, light #fffefa / dark #15211d) ---------- */
:root{--v-math:#eb6834;--v-bio:#1baf7a;--v-physics:#2a78d6;--v-chem:#e87ba4;--v-general:#eda100;--v-plan:#a9b1ac;
  --h0:#e7efe9;--h1:#b5d8c2;--h2:#7fbd98;--h3:#3f9467;--h4:#1d6b45}
@media (prefers-color-scheme:dark){:root{--v-math:#d95926;--v-bio:#199e70;--v-physics:#3987e5;--v-chem:#d55181;--v-general:#c98500;--v-plan:#5e6d66;
  --h0:#1f302a;--h1:#24513d;--h2:#2f7553;--h3:#4fa275;--h4:#86d3a6}}
.s-math{fill:var(--v-math);stroke:var(--v-math)}.s-bio{fill:var(--v-bio);stroke:var(--v-bio)}.s-physics{fill:var(--v-physics);stroke:var(--v-physics)}.s-chem{fill:var(--v-chem);stroke:var(--v-chem)}.s-general{fill:var(--v-general);stroke:var(--v-general)}
.s-plan{fill:var(--v-plan)}.s-mag{fill:var(--brand-2)}.s-sleep{fill:var(--v-physics)}
.chart-box{width:100%;min-height:60px;overflow:hidden}
.chart-svg{display:block;max-width:100%;height:auto;overflow:visible}
.chart-svg text{font-family:inherit}
.chart-svg .grid{stroke:var(--line);stroke-width:1}
.chart-svg .grid.base{stroke:var(--line-strong)}
.chart-svg .axis{fill:var(--muted);font-size:12px}
.chart-svg .axis.strong{fill:var(--ink);font-weight:600}
.chart-svg .value{fill:var(--ink);font-size:11px;font-weight:700}
.chart-svg .line{fill:none;stroke-width:2.5;stroke-linejoin:round;stroke-linecap:round}
.chart-svg .dot{stroke:var(--surface);stroke-width:2;cursor:pointer}
.chart-svg .hit{fill:transparent;cursor:pointer}
.chart-svg [data-tip]{cursor:pointer;transition:opacity .15s var(--ease)}
.chart-svg .bar{stroke:none}
.chart-svg .ref{stroke:var(--gold);stroke-width:1.5;stroke-dasharray:5 4}
.chart-svg .active-mark,.chart-svg g.active-mark .bar{opacity:.75}
.chart-svg .dot.active-mark{opacity:1;stroke:var(--ink)}
.chart-svg.year{max-width:none}
.cell{fill:var(--h0)}.cell.l1{fill:var(--h1)}.cell.l2{fill:var(--h2)}.cell.l3{fill:var(--h3)}.cell.l4{fill:var(--h4)}
.cell.lrest{fill:var(--surface-2)}.cell.lfuture{fill:none;stroke:var(--line-strong);stroke-width:1}.cell.lnone{fill:var(--surface-2);stroke:var(--danger);stroke-width:1.2}
.cell.today{stroke:var(--ink);stroke-width:2}
.year-scroll{overflow-x:auto;padding-bottom:6px;direction:rtl}
.chart-legend{display:flex;flex-wrap:wrap;gap:6px 16px;font-size:13px;color:var(--muted);margin:4px 0 10px}
.chart-legend span{display:inline-flex;align-items:center;gap:6px}
.swatch{width:12px;height:12px;border-radius:3px;display:inline-block}
.swatch.s-math{background:var(--v-math)}.swatch.s-bio{background:var(--v-bio)}.swatch.s-physics{background:var(--v-physics)}.swatch.s-chem{background:var(--v-chem)}.swatch.s-general{background:var(--v-general)}.swatch.s-plan{background:var(--v-plan)}.swatch.s-mag{background:var(--brand-2)}
.swatch.h0{background:var(--h0)}.swatch.h1{background:var(--h1)}.swatch.h2{background:var(--h2)}.swatch.h3{background:var(--h3)}.swatch.h4{background:var(--h4)}.swatch.hnone{background:var(--surface-2);box-shadow:inset 0 0 0 1.2px var(--danger)}
.swatch.line{height:3px;border-radius:2px}
.dash-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;align-items:start}
.dash-grid .panel{margin-bottom:0}
.dash-section{margin-bottom:18px}
.insight{display:flex;gap:10px;align-items:flex-start;background:var(--surface-2);border-radius:12px;padding:12px 14px;font-size:14px;margin-top:12px}
.insight .icon{color:var(--gold);margin-top:3px}
.panel-sub{font-size:13px;color:var(--muted);margin:-8px 0 12px}
select.compact{width:auto;min-height:38px;font-size:14px;padding:4px 10px}
#chart-tip{position:fixed;z-index:200;max-width:260px;padding:8px 12px;border-radius:10px;background:var(--ink);color:var(--bg);font-size:13px;font-weight:600;line-height:1.7;pointer-events:none;opacity:0;transition:opacity .12s var(--ease);white-space:pre-line}
#chart-tip.show{opacity:1}
@media (max-width:1100px){.dash-grid{grid-template-columns:1fr}}
@media print{.chart-svg .dot,.cell{print-color-adjust:exact;-webkit-print-color-adjust:exact}}
/* One colour per subject everywhere: timeline cards follow the validated chart palette. */
:root{--c-math:var(--v-math);--c-bio:var(--v-bio);--c-physics:var(--v-physics);--c-chem:var(--v-chem);--c-general:var(--v-general)}
/* SVG text inherits the page's rtl direction, which flips text-anchor; charts position text explicitly. */
.chart-svg text{direction:ltr;unicode-bidi:plaintext}
.s-mag{stroke:var(--brand-2)}
