:root {
  color-scheme: light;
  --paper: #f7f5ee;
  --paper-deep: #eeece2;
  --card: #ffffff;
  --ink: #17231c;
  --muted: #6d766e;
  --line: #dfe3d9;
  --forest: #244c3c;
  --forest-soft: #e5eee6;
  --lime: #d7ed9a;
  --lime-deep: #b9d66e;
  --danger: #b64e4e;
  --shadow: 0 18px 50px rgba(36, 76, 60, .08);
  --radius: 24px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #101b16;
  --paper-deep: #17251d;
  --card: #1b2a21;
  --ink: #f2f6ef;
  --muted: #aab7aa;
  --line: #304337;
  --forest: #c8e09d;
  --forest-soft: #263a2c;
  --lime: #d7ed9a;
  --lime-deep: #b9d66e;
  --danger: #ff9b93;
  --shadow: 0 18px 50px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(215,237,154,.22), transparent 25rem),
    var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 28px 18px 20px; border-right: 1px solid var(--line); background: rgba(247,245,238,.74);
  backdrop-filter: blur(18px); z-index: 10;
}
:root[data-theme="dark"] .sidebar { background: rgba(16,27,22,.82); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--forest); font-weight: 800; letter-spacing: -.045em; font-size: 23px; padding: 0 10px; }
.brand img { width: 31px; height: 31px; }
.nest-mark { width: 64px; height: 64px; flex: 0 0 auto; }
.brand small { display: block; margin-top: 1px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.nest-switcher { margin: 40px 0 18px; border: 1px solid var(--line); border-radius: 16px; padding: 11px 12px; background: var(--card); text-align: left; color: var(--ink); width: 100%; }
.nest-switcher-label { color: var(--muted); display: block; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 4px; }
.nest-switcher-value { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; }
.nav { display: grid; gap: 5px; }
.nav button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 13px; color: var(--muted); background: transparent; border: 0; border-radius: 13px; text-align: left; font-weight: 700; }
.nav button:hover { background: var(--forest-soft); color: var(--forest); }
.nav button.active { background: var(--forest); color: var(--paper); }
.nav-icon { width: 21px; text-align: center; font-size: 18px; }
.sidebar-bottom { margin-top: auto; display: grid; gap: 12px; }
.connection-pill { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; padding: 0 10px; }
.connection-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lime-deep); flex: 0 0 auto; }
.connection-dot.demo { background: #e8a65d; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 11px 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.user-avatar { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 50%; background: var(--lime); color: var(--forest); font-size: 12px; font-weight: 900; }
.main { min-width: 0; }
.mobile-topbar { display: none; }
.content { max-width: 1180px; margin: 0 auto; padding: 42px clamp(22px, 5vw, 72px) 72px; }
.content.narrow { max-width: 830px; }
.page-header { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 26px; }
.page-kicker { color: var(--forest); font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.page-title { margin: 5px 0 4px; font-size: clamp(30px, 5vw, 49px); line-height: 1.02; letter-spacing: -.055em; }
.page-subtitle { margin: 0; color: var(--muted); max-width: 600px; }
.page-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; background: var(--forest-soft); color: var(--forest); font-size: 25px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 20px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-heading h2, .section-heading h3 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.section-detail { color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .11em; text-transform: uppercase; }
.hero-card { padding: 25px; color: white; background: var(--forest); border-radius: var(--radius); overflow: hidden; position: relative; }
.hero-card::after { content: ""; position: absolute; right: -56px; top: -76px; width: 250px; height: 250px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 25px rgba(255,255,255,.025), 0 0 0 57px rgba(255,255,255,.025); pointer-events: none; }
.hero-card-top { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 20px; }
.hero-card h2 { margin: 2px 0 4px; font-size: clamp(25px, 4vw, 34px); letter-spacing: -.04em; }
.hero-card p { margin: 0; color: rgba(255,255,255,.7); font-size: 13px; }
.hero-mark { width: 60px; height: 60px; object-fit: contain; }
.stats { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 30px; }
.stat strong { display: block; color: var(--lime); font-size: 26px; letter-spacing: -.04em; }
.stat span { color: rgba(255,255,255,.68); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); gap: 20px; align-items: start; margin-top: 20px; }
.dashboard-grid > .full { grid-column: 1 / -1; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--muted); padding: 8px 13px; border-radius: 99px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.chip.active { color: var(--paper); background: var(--forest); border-color: var(--forest); }
.subjects-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.subject-tile { position: relative; min-height: 164px; padding: 15px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); border-radius: 20px; background: var(--card); color: var(--ink); text-align: left; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
.subject-tile:hover { transform: translateY(-2px); border-color: var(--lime-deep); box-shadow: var(--shadow); }
.subject-tile-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.subject-avatar { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; background: var(--lime); overflow: hidden; flex: 0 0 auto; }
.subject-avatar img { width: 100%; height: 100%; object-fit: cover; }
.subject-avatar span { font-size: 25px; }
.insight-subject-carousel { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 7px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.insight-subject-card { flex: 0 0 138px; min-height: 118px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 9px; border: 1px solid var(--line); border-radius: 17px; background: var(--card); color: var(--ink); scroll-snap-align: start; }
.insight-subject-card:hover, .insight-subject-card.active { border-color: var(--lime-deep); box-shadow: var(--shadow); }
.insight-subject-card.active { background: var(--forest-soft); }
.insight-subject-card .subject-avatar { width: 54px; height: 54px; border-radius: 17px; }
.insight-subject-card .subject-avatar span { font-size: 27px; }
.insight-subject-card strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.insight-subject-card > span { color: var(--muted); font-size: 11px; }
.more { color: var(--muted); font-size: 19px; }
.subject-tile h3 { margin: 13px 0 3px; font-size: 18px; letter-spacing: -.03em; }
.subject-meta { color: var(--muted); font-size: 13px; }
.tile-count { color: var(--forest); font-weight: 800; }
.latest-list { display: grid; gap: 0; }
.entry-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 15px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.entry-row:first-child { padding-top: 2px; }
.entry-row:last-child { padding-bottom: 2px; border-bottom: 0; }
.entry-main { min-width: 0; }
.entry-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 14px; }
.entry-time { color: var(--muted); font-size: 12px; white-space: nowrap; font-weight: 500; }
.entry-value { color: var(--forest); margin-top: 3px; font-size: 14px; }
.entry-note, .entry-actor { color: var(--muted); display: block; font-size: 12px; margin-top: 3px; overflow-wrap: anywhere; }
.entry-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--forest-soft); font-size: 20px; }
.empty { display: grid; place-items: center; text-align: center; padding: 34px 20px; color: var(--muted); }
.empty-symbol { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: rgba(215,237,154,.42); color: var(--forest); font-size: 27px; margin-bottom: 12px; }
.empty h3 { color: var(--ink); margin: 0 0 7px; font-size: 18px; }
.empty p { margin: 0; max-width: 390px; font-size: 14px; }
.button { border: 0; border-radius: 14px; padding: 11px 16px; font-weight: 800; transition: transform .15s ease, background .15s ease; }
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--forest); color: var(--paper); }
.button.lime { background: var(--lime); color: var(--forest); }
.button.soft { background: var(--forest-soft); color: var(--forest); }
.button.ghost { background: transparent; color: var(--forest); border: 1px solid var(--line); }
.button.danger { background: rgba(182,78,78,.12); color: var(--danger); }
.button.small { padding: 8px 11px; border-radius: 11px; font-size: 13px; }
.button.icon { width: 35px; height: 35px; display: grid; place-items: center; padding: 0; border-radius: 50%; }
.inline-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.text-button { border: 0; background: transparent; color: var(--forest); padding: 0; font-weight: 800; }

.detail-header { display: flex; align-items: center; gap: 17px; margin-bottom: 24px; }
.detail-header .subject-avatar { width: 78px; height: 78px; border-radius: 23px; }
.detail-header .subject-avatar span { font-size: 38px; }
.detail-header h1 { margin: 0; font-size: clamp(30px, 5vw, 45px); letter-spacing: -.055em; }
.detail-header p { margin: 5px 0 0; color: var(--muted); }
.tracker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tracker-card { position: relative; border: 1px solid var(--line); border-radius: 18px; padding: 15px; background: var(--card); min-height: 122px; display: flex; flex-direction: column; justify-content: space-between; }
.tracker-card-head { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.tracker-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--tracker-color) 15%, transparent); color: var(--tracker-color); font-size: 18px; }
.tracker-menu { border: 0; padding: 3px; color: var(--muted); background: transparent; font-size: 18px; }
.tracker-card h3 { font-size: 16px; margin: 10px 0 0; letter-spacing: -.025em; }
.tracker-card p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.log-button { width: 100%; border: 0; background: var(--forest-soft); color: var(--forest); border-radius: 10px; padding: 9px; font-weight: 800; margin-top: 12px; }
.log-button:hover { background: var(--lime); }
.metric-card { margin-top: 20px; }
.metric-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metric-toolbar h2 { margin: 0; font-size: 19px; }
.range-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 11px; background: var(--paper-deep); }
.range-tabs button { border: 0; background: transparent; padding: 7px 9px; color: var(--muted); border-radius: 8px; font-size: 12px; font-weight: 800; }
.range-tabs button.active { background: var(--card); color: var(--forest); box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.bar-chart { height: 210px; display: flex; align-items: stretch; gap: 9px; padding: 20px 5px 3px; margin-top: 7px; border-bottom: 1px solid var(--line); }
.bar-group { min-width: 0; flex: 1; display: flex; align-items: end; justify-content: center; gap: 3px; position: relative; }
.bar { min-width: 4px; width: 16px; max-width: 28px; border-radius: 5px 5px 2px 2px; background: var(--forest); height: calc(var(--height) * 1%); align-self: end; opacity: .88; }
.bar-label { position: absolute; bottom: -23px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 9px 15px; margin-top: 28px; color: var(--muted); font-size: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dot); }
.totals-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.total-item { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 15px; padding: 11px; }
.total-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: var(--tracker-color); background: color-mix(in srgb, var(--tracker-color) 15%, transparent); }
.total-value { font-weight: 900; font-size: 18px; }
.total-label { display: block; color: var(--muted); font-size: 12px; }
.forecast-card { margin-top: 20px; }
.forecast-card .lock { color: var(--muted); }
.forecast-time { color: var(--forest); font-size: 23px; font-weight: 900; letter-spacing: -.04em; }
.forecast-meta { color: var(--muted); font-size: 12px; }
.forecast-copy { color: var(--muted); font-size: 14px; max-width: 650px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 7px; }
.calendar-weekday { color: var(--muted); font-size: 10px; font-weight: 900; text-align: center; }
.calendar-day { min-height: 42px; display: grid; place-items: center; gap: 2px; padding: 4px; border-radius: 10px; color: var(--muted); font-size: 12px; }
.calendar-day.today { background: rgba(215,237,154,.42); color: var(--forest); }
.day-dot { width: var(--size); height: var(--size); border-radius: 50%; background: var(--forest); opacity: .78; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.search { position: relative; flex: 1; min-width: 160px; }
.search input { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 11px 13px 11px 39px; color: var(--ink); background: var(--card); outline: none; }
.search input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--lime-deep); box-shadow: 0 0 0 3px rgba(215,237,154,.33); }
.search::before { content: "⌕"; position: absolute; left: 14px; top: 7px; color: var(--muted); font-size: 22px; z-index: 1; }
.select { border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; color: var(--ink); background: var(--card); }
.activity-group { margin-bottom: 22px; }
.day-heading { color: var(--muted); font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 6px; }
.activity-card { padding: 0 17px; }
.load-more { width: 100%; margin-top: 8px; }

.settings-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 20px; }
.settings-section { margin-bottom: 20px; }
.settings-section:last-child { margin-bottom: 0; }
.member-list { display: grid; gap: 12px; }
.member { display: flex; align-items: center; gap: 11px; }
.member-copy { min-width: 0; }
.member-name { font-weight: 800; }
.member-email { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.role { margin-left: auto; color: var(--muted); font-size: 12px; }
.settings-list { display: grid; gap: 4px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-copy strong { display: block; font-size: 14px; }
.setting-copy span { color: var(--muted); display: block; font-size: 12px; margin-top: 2px; }
.segmented { display: inline-flex; gap: 3px; padding: 3px; border-radius: 11px; background: var(--paper-deep); }
.segmented button { border: 0; border-radius: 8px; background: transparent; color: var(--muted); padding: 7px 10px; font-size: 12px; font-weight: 800; }
.segmented button.active { color: var(--forest); background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.nest-list { display: grid; gap: 7px; }
.nest-option { width: 100%; border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 13px; padding: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; font-weight: 800; }
.nest-option.current { border-color: var(--lime-deep); background: rgba(215,237,154,.2); }
.check { color: var(--forest); }
.pro-feature-list { display: grid; gap: 14px; }
.pro-feature { display: flex; align-items: flex-start; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--forest-soft); }
.pro-feature > span { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 auto; border-radius: 9px; background: var(--lime); color: var(--forest); font-weight: 900; }
.pro-feature strong { display: block; font-size: 14px; }
.pro-feature p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.modal-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(12,25,18,.42); z-index: 30; }
.modal { width: min(640px, 100%); max-height: min(90vh, 850px); overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 26px; box-shadow: 0 28px 90px rgba(0,0,0,.24); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; padding: 22px 24px 12px; position: sticky; top: 0; background: var(--card); z-index: 2; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.modal-head p { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.modal-body { padding: 20px 24px 24px; }
.close { width: 34px; height: 34px; border: 0; display: grid; place-items: center; background: var(--paper-deep); border-radius: 50%; color: var(--muted); font-size: 20px; }
.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px; color: var(--ink); background: var(--card); outline: none; }
.field textarea { min-height: 86px; resize: vertical; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding-top: 6px; }
.form-error { color: var(--danger); font-size: 13px; margin: 8px 0 14px; }
.form-help { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, .88fr) minmax(420px, 1.12fr); }
.auth-panel { padding: clamp(28px, 6vw, 82px); display: flex; flex-direction: column; justify-content: space-between; }
.auth-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--forest); font-size: 27px; font-weight: 900; letter-spacing: -.05em; }
.auth-brand img { width: 38px; height: 38px; }
.auth-copy { max-width: 540px; margin: auto 0; }
.auth-copy h1 { margin: 0; font-size: clamp(42px, 6vw, 78px); line-height: .97; letter-spacing: -.065em; }
.auth-copy p { color: var(--muted); max-width: 480px; margin: 22px 0 0; font-size: 18px; line-height: 1.55; }
.auth-note { color: var(--muted); font-size: 12px; }
.auth-visual { padding: clamp(20px, 6vw, 80px); display: grid; place-items: center; background: var(--forest); overflow: hidden; position: relative; }
.auth-visual::before, .auth-visual::after { content: ""; position: absolute; width: 440px; height: 440px; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }
.auth-visual::before { transform: translate(25%, -33%); }
.auth-visual::after { transform: translate(43%, -26%); }
.auth-visual-card { position: relative; z-index: 1; width: min(440px, 100%); padding: 26px; border-radius: 28px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); color: white; backdrop-filter: blur(12px); }
.auth-visual-card .nest-mark { width: 102px; height: 102px; display: block; margin: 4px auto 23px; }
.auth-visual-card h2 { margin: 0; text-align: center; font-size: 27px; letter-spacing: -.04em; }
.auth-feed { margin-top: 26px; display: grid; gap: 9px; }
.auth-feed-row { display: grid; grid-template-columns: 32px 1fr auto; gap: 9px; align-items: center; padding: 11px; border-radius: 14px; background: rgba(255,255,255,.1); font-size: 12px; }
.auth-feed-avatar { width: 32px; height: 32px; display: grid; place-items: center; background: var(--lime); color: var(--forest); border-radius: 10px; font-size: 16px; }
.auth-feed-row span { color: rgba(255,255,255,.66); font-size: 11px; }
.auth-modal { width: min(480px, 100%); }
.auth-switch { text-align: center; margin-top: 16px; color: var(--muted); font-size: 13px; }
.auth-switch button { border: 0; background: transparent; color: var(--forest); font-weight: 800; }
.demo-link { width: 100%; margin-top: 12px; }
.divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translate(-50%, 16px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--paper); border-radius: 99px; padding: 11px 16px; font-size: 13px; font-weight: 800; transition: opacity .2s ease, transform .2s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.loading { min-height: 80vh; display: grid; place-items: center; color: var(--muted); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .mobile-topbar { display: flex; position: sticky; top: 0; z-index: 15; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; background: color-mix(in srgb, var(--paper) 84%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); }
  .mobile-topbar .brand { padding: 0; font-size: 20px; }
  .mobile-nav { position: fixed; bottom: 12px; left: 12px; right: 12px; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 7px; border: 1px solid var(--line); border-radius: 18px; background: color-mix(in srgb, var(--card) 88%, transparent); box-shadow: 0 14px 45px rgba(0,0,0,.16); backdrop-filter: blur(18px); }
  .mobile-nav button { border: 0; color: var(--muted); background: transparent; border-radius: 13px; padding: 7px 3px; font-size: 10px; font-weight: 800; }
  .mobile-nav button.active { color: var(--forest); background: var(--forest-soft); }
  .mobile-nav .nav-icon { display: block; width: auto; font-size: 18px; margin-bottom: 1px; }
  .content { padding-top: 28px; padding-bottom: 105px; }
  .settings-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid > .full { grid-column: auto; }
  .auth-layout { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; padding: 26px; }
  .auth-copy { margin: 16vh 0 auto; }
}
@media (max-width: 560px) {
  .page-header { align-items: start; }
  .page-icon { width: 44px; height: 44px; font-size: 20px; }
  .stats { gap: 10px; }
  .stat strong { font-size: 22px; }
  .subjects-grid, .tracker-grid, .totals-grid, .field-row { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar .button { align-self: end; }
  .metric-toolbar { align-items: start; flex-direction: column; }
  .modal-head, .modal-body { padding-left: 18px; padding-right: 18px; }
}
