:root {
  --sidebar: #071f29;
  --sidebar-2: #0a2b34;
  --paper: #fbfcfa;
  --surface: #ffffff;
  --ink: #102126;
  --muted: #647278;
  --line: #d9e0dd;
  --line-soft: #e9eeeb;
  --emerald: #0c9656;
  --emerald-dark: #086a42;
  --emerald-soft: #eaf6ef;
  --blue: #2369b3;
  --blue-soft: #edf5ff;
  --amber: #b56700;
  --amber-soft: #fff6e5;
  --red: #bb3e36;
  --red-soft: #fff0ee;
  --radius: 7px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); font-family: var(--sans); }
body { font-size: 14px; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--emerald) 75%, white);
  outline-offset: 2px;
}

.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 218px minmax(0, 1fr); }
.sidebar {
  position: sticky; top: 0; height: 100dvh; padding: 20px 14px 17px; background: var(--sidebar);
  color: #eef6f3; display: flex; flex-direction: column; overflow-y: auto; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 7px 18px; }
.brand-mark {
  display: grid; place-items: center; width: 31px; height: 35px; color: white; font-size: 22px; font-weight: 800;
  background: linear-gradient(145deg, #18aa70, #087044); clip-path: polygon(50% 0,100% 25%,78% 42%,100% 60%,50% 100%,0 75%,22% 57%,0 40%);
}
.brand-name { font-size: 20px; letter-spacing: -.02em; white-space: nowrap; }
.brand-name b { color: #38c782; }
.profile {
  display: grid; grid-template-columns: 34px minmax(0,1fr) 24px; gap: 9px; align-items: center;
  padding: 10px; margin-bottom: 15px; border: 1px solid #28434a; border-radius: var(--radius); background: #0b2a34;
}
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--emerald); font-weight: 700; }
.profile strong, .profile small { display: block; }
.profile strong { font-size: 12px; }
.profile small { color: #a7bbb9; font-size: 10px; margin-top: 3px; }
.icon-button { border: 0; background: transparent; min-width: 32px; min-height: 32px; cursor: pointer; border-radius: 6px; }
.icon-button:hover { background: rgba(255,255,255,.08); }
.nav-list { display: grid; gap: 5px; }
.nav-list button, .course-list button {
  width: 100%; border: 0; background: transparent; color: #eef6f3; text-align: left; cursor: pointer;
}
.nav-list button {
  min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius);
  transition: background .16s ease, transform .16s ease;
}
.nav-list button:hover { background: rgba(255,255,255,.07); }
.nav-list button:active { transform: translateY(1px); }
.nav-list button.active { background: #176b4d; }
.nav-icon { width: 20px; text-align: center; font-family: var(--mono); font-size: 17px; }
.course-list { padding: 21px 8px 12px; border-top: 1px solid #28434a; margin-top: 18px; }
.course-list p { margin: 0 0 8px; color: #93aaa9; font: 10px/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.course-list button { padding: 5px 0; font-size: 11px; color: #bdd0ce; }
.course-list button:hover { color: white; }
.local-status {
  margin-top: auto; padding: 12px; border: 1px solid #16805a; border-radius: var(--radius); background: #092c2b;
  display: grid; gap: 6px; font-size: 10px; line-height: 1.35;
}
.local-status strong { font-size: 12px; }
.status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #55d68d; }

.app-main { min-width: 0; }
.topbar {
  height: 64px; position: sticky; top: 0; z-index: 15; padding: 0 26px; display: grid;
  grid-template-columns: max-content minmax(260px, 480px) max-content max-content max-content;
  justify-content: end; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); background: rgba(251,252,250,.97);
}
.today { margin-right: auto; font-size: 12px; color: var(--muted); }
.global-search {
  height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: var(--radius); background: white; color: var(--muted);
}
.global-search input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
kbd { padding: 2px 6px; border-radius: 4px; background: #f0f3f1; font: 10px var(--mono); color: var(--muted); }
.ask-button, .button {
  min-height: 40px; padding: 8px 15px; border: 1px solid var(--line); border-radius: var(--radius); background: white; cursor: pointer;
}
.ask-button { color: var(--emerald-dark); border-color: #a8d6bf; font-weight: 600; }
.button:hover, .ask-button:hover { border-color: #9dafaa; background: #f7faf8; }
.button:active, .ask-button:active { transform: translateY(1px); }
.button.primary { border-color: var(--emerald-dark); background: var(--emerald-dark); color: white; }
.button.primary:hover { background: #075838; }
.button.danger { border-color: #e6aca8; color: var(--red); background: var(--red-soft); }
.notification { position: relative; }
.notification span { position: absolute; right: -1px; top: 0; display: grid; place-items: center; width: 16px; height: 16px; background: var(--emerald-dark); color: white; font-size: 9px; border-radius: 50%; }
.user-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.menu-button { display: none; border: 0; background: transparent; font-size: 20px; }

main { padding: 17px 26px 28px; min-height: calc(100dvh - 64px); }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.page-head h1 { margin: 0; font: 400 clamp(31px, 2.65vw, 43px)/1 var(--serif); letter-spacing: -.025em; }
.page-head p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.head-actions { display: flex; gap: 8px; }
.panel {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; min-width: 0;
}
.panel-head {
  min-height: 47px; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2, .panel-head h3 { margin: 0; font: 400 20px/1.1 var(--serif); }
.panel-head h3 { font-size: 17px; }
.panel-body { padding: 14px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.label { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.badge {
  display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border: 1px solid var(--line);
  border-radius: 5px; background: #f7faf8; font-size: 10px; white-space: nowrap;
}
.badge.green { border-color: #bad8c8; color: #09603d; background: var(--emerald-soft); }
.badge.blue { border-color: #b8d3ee; color: #145992; background: var(--blue-soft); }
.badge.amber { border-color: #efc67d; color: var(--amber); background: var(--amber-soft); }
.badge.red { border-color: #efb3ae; color: var(--red); background: var(--red-soft); }
.progress { height: 6px; border-radius: 5px; background: #e6ece9; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--emerald-dark); border-radius: inherit; }
.row { display: flex; align-items: center; gap: 10px; }
.stack { display: grid; gap: 10px; }
.divider { height: 1px; background: var(--line); }
.more { font-weight: 700; letter-spacing: .15em; }
.empty-note { padding: 28px; text-align: center; color: var(--muted); }

/* Overview */
.overview-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(270px,.82fr) minmax(250px,.72fr); gap: 14px; }
.briefing { grid-row: span 2; }
.briefing-intro { padding: 17px; border-bottom: 1px solid var(--line); background: #fcfdfb; }
.briefing-intro strong { display: block; font: 400 24px var(--serif); margin-bottom: 5px; }
.agenda-list { display: grid; }
.agenda-item { display: grid; grid-template-columns: 48px 8px minmax(0,1fr) max-content; gap: 10px; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); align-items: start; }
.agenda-item:last-child { border-bottom: 0; }
.agenda-item time { font: 11px var(--mono); color: var(--muted); }
.agenda-item i { width: 7px; height: 7px; margin-top: 3px; border-radius: 50%; background: var(--emerald); }
.agenda-item.blue i { background: var(--blue); }
.agenda-item.amber i { background: #d48a18; }
.agenda-item strong { display: block; margin-bottom: 4px; font-size: 13px; }
.agenda-item small { color: var(--muted); }
.metric-list { display: grid; gap: 13px; }
.metric-line { display: grid; grid-template-columns: minmax(0,1fr) 38px; gap: 7px; }
.metric-line .progress { grid-column: 1 / -1; }
.source-list, .gap-list, .activity-list { display: grid; }
.source-row, .gap-row, .activity-row { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); }
.source-row:last-child, .gap-row:last-child, .activity-row:last-child { border-bottom: 0; }
.source-row { display: grid; grid-template-columns: 38px minmax(0,1fr) max-content; gap: 10px; align-items: center; }
.thumb {
  width: 38px; height: 38px; object-fit: cover; border: 1px solid var(--line); border-radius: 5px; background: #f1f3f2;
}
.source-row strong, .source-row small { display: block; }
.source-row strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.source-row small { font-size: 10px; color: var(--muted); margin-top: 3px; }
.gap-row { display: grid; grid-template-columns: minmax(0,1fr) max-content; gap: 8px; }
.gap-row strong { font-size: 12px; }
.gap-row small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.roadmap-mini { display: grid; grid-template-columns: 76px repeat(8,1fr); gap: 4px; font-size: 9px; align-items: center; }
.roadmap-mini span { height: 20px; border-radius: 3px; background: #eef2f0; }
.roadmap-mini span.on { background: #cfe8d9; border: 1px solid #9dc9af; }
.roadmap-mini span.info { background: #d9e8f7; border: 1px solid #b3cee8; }
.roadmap-mini span.warn { background: #ffedc8; border: 1px solid #ecc77d; }
.roadmap-mini b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trust-inline { margin-top: 12px; padding: 10px; border: 1px solid #b7daca; border-radius: var(--radius); background: var(--emerald-soft); color: #0b6441; font-size: 11px; }

/* Uploads */
.uploads-grid { display: grid; grid-template-columns: 280px minmax(430px, 1.4fr) 320px; gap: 10px; }
.upload-queue { min-height: 720px; }
.queue-item { padding: 13px; border-bottom: 1px solid var(--line-soft); }
.queue-title { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; }
.queue-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item .progress { margin: 9px 0 7px; }
.queue-item small { color: var(--muted); }
.queue-item.selected { background: #f2f8f5; box-shadow: inset 3px 0 var(--emerald); }
.dropzone { margin: 13px; padding: 18px; border: 1px dashed #a9b9b2; border-radius: var(--radius); text-align: center; background: #fafcfb; }
.dropzone.drag { border-color: var(--emerald); background: var(--emerald-soft); }
.doc-review { display: grid; grid-template-columns: 1fr .86fr; min-height: 720px; }
.doc-pane { padding: 12px; background: #f2f3f1; border-right: 1px solid var(--line); }
.doc-toolbar { display: flex; gap: 7px; align-items: center; padding-bottom: 10px; font-size: 11px; }
.document-page { height: 635px; padding: 25px 22px; background: white; border: 1px solid #bac3bf; box-shadow: 0 3px 8px rgba(12,31,37,.08); overflow: hidden; }
.document-page img { width: 100%; height: 100%; object-fit: contain; }
.note-pane { background: #f5f3ee; overflow: hidden; }
.note-pane img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.ocr-panel textarea {
  width: 100%; min-height: 425px; padding: 11px; border: 1px solid var(--line); border-radius: var(--radius);
  resize: vertical; font: 11px/1.65 var(--mono); color: #27363a; background: white;
}
.language-tabs { display: flex; gap: 7px; flex-wrap: wrap; margin: 9px 0 15px; }
.ocr-actions { display: grid; grid-template-columns: .7fr 1.3fr; gap: 8px; margin-top: 12px; }
.confidence { margin: 9px 0 14px; color: var(--muted); font-size: 11px; }

/* Canvas */
.canvas-page { margin: -17px -26px -28px; min-height: calc(100dvh - 64px); background: #f7f8f6; }
.canvas-head { min-height: 70px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); background: white; }
.canvas-head h1 { margin: 0; font: 400 32px var(--serif); }
.canvas-head h1 span { margin-left: 18px; font: 14px var(--serif); color: var(--muted); }
.canvas-grid { display: grid; grid-template-columns: minmax(360px,1.04fr) minmax(360px,.95fr) minmax(320px,.86fr); height: calc(100dvh - 134px); gap: 10px; padding: 10px; }
.canvas-grid .panel { display: flex; flex-direction: column; min-height: 0; }
.slide-workspace { display: grid; grid-template-columns: 83px minmax(0,1fr); min-height: 0; flex: 1; }
.slide-thumbs { padding: 8px; overflow-y: auto; background: #fafbf9; border-right: 1px solid var(--line); }
.slide-thumb { height: 99px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 5px; background: white; padding: 6px; overflow: hidden; }
.slide-thumb.active { border: 2px solid var(--emerald-dark); }
.slide-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.slide-main { padding: 10px; background: #eef1ef; min-height: 0; }
.slide-main img { width: 100%; height: 100%; object-fit: contain; background: white; border: 1px solid #bcc6c1; }
.notes-main { min-height: 0; flex: 1; background: #f4f0e8; overflow: auto; }
.notes-main img { width: 100%; min-height: 100%; object-fit: cover; object-position: top; }
.chat { min-height: 0; display: flex; flex-direction: column; }
.messages { flex: 1; overflow-y: auto; padding: 14px; display: grid; align-content: start; gap: 12px; }
.message { max-width: 90%; padding: 11px; border: 1px solid var(--line); border-radius: var(--radius); line-height: 1.55; }
.message.user { justify-self: end; background: var(--emerald-soft); border-color: #bad8c8; }
.message.ai { background: white; }
.alert-card { padding: 12px; border: 1px solid #edc47f; border-radius: var(--radius); background: var(--amber-soft); line-height: 1.45; }
.alert-card strong { color: var(--amber); display: block; margin-bottom: 7px; }
.chat-compose { padding: 10px; border-top: 1px solid var(--line); display: grid; grid-template-columns: minmax(0,1fr) 40px; gap: 7px; }
.chat-compose input { width: 100%; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }

/* Calendar */
.calendar-grid { display: grid; grid-template-columns: minmax(620px,1.75fr) minmax(290px,.8fr); gap: 14px; }
.week-calendar { min-height: 740px; }
.week-grid { padding: 12px 14px; display: grid; grid-template-columns: 50px repeat(5,1fr); grid-template-rows: 28px repeat(7,55px); position: relative; }
.week-grid > div { border-bottom: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); }
.week-grid .day { text-align: center; padding: 5px; color: var(--muted); font-size: 10px; }
.week-grid .time { padding-top: 7px; font: 9px var(--mono); color: var(--muted); border-right: 1px solid var(--line); }
.event {
  z-index: 2; margin: 3px 6px; padding: 6px; border: 1px solid #9fcab2; border-radius: 6px; background: var(--emerald-soft);
  font-size: 9px; line-height: 1.35; overflow: hidden;
}
.event.blue { background: var(--blue-soft); border-color: #aecce9; }
.event.amber { background: var(--amber-soft); border-color: #ecc57c; }
.roadmap { padding: 13px; border-top: 1px solid var(--line); }
.roadmap h3 { font: 600 17px var(--serif); margin: 0 0 12px; }
.roadmap-grid { display: grid; grid-template-columns: 145px repeat(8,1fr); gap: 5px; font-size: 9px; align-items: center; }
.roadmap-grid span { height: 25px; border-radius: 4px; background: #edf1ef; border: 1px solid #dce4df; }
.roadmap-grid span.on { background: #d8ebdf; border-color: #a5ceb5; }
.roadmap-grid span.blue { background: #dceaf7; border-color: #b7d0e7; }
.roadmap-grid span.amber { background: #ffedc9; border-color: #edc77e; }
.today-block { padding: 12px; border-left: 3px solid var(--emerald-dark); background: #f4f8f5; margin-bottom: 8px; }
.today-block strong, .today-block small { display: block; }
.today-block strong { font-size: 11px; margin-bottom: 4px; }
.calendar-asset { width: 100%; max-height: 260px; object-fit: cover; object-position: top; border: 1px solid var(--line); border-radius: 5px; }
.extraction-row { display: grid; grid-template-columns: 65px minmax(0,1fr) max-content; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 11px; }

/* Flashcards */
.cards-grid { display: grid; grid-template-columns: 310px minmax(450px,1fr) 300px; gap: 14px; }
.deck-row { padding: 14px 12px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.deck-row:hover { background: #f8faf9; }
.deck-row.selected { background: var(--emerald-soft); }
.deck-row strong, .deck-row small { display: block; }
.deck-row small { color: var(--muted); margin: 5px 0 8px; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.field textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); resize: vertical; }
.field.question textarea { min-height: 100px; font: 400 22px/1.25 var(--serif); }
.field.answer textarea { min-height: 155px; line-height: 1.55; }
.source-box { padding: 10px; border: 1px solid #bad2ea; border-radius: 5px; background: var(--blue-soft); color: #165b98; font-size: 11px; }
.evidence-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 9px; }
.evidence-strip img { width: 100%; height: 82px; object-fit: cover; border: 1px solid var(--line); border-radius: 5px; }
.card-preview { min-height: 245px; padding: 26px; display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--line); border-radius: 10px; background: #fdfefc; cursor: pointer; }
.card-preview small { color: var(--muted); text-transform: uppercase; }
.card-preview strong { margin: 20px 0; font: 600 23px/1.12 var(--serif); }
.card-preview .back { display: none; line-height: 1.55; }
.card-preview.flipped .front { display: none; }
.card-preview.flipped .back { display: block; }
.export-list { display: grid; gap: 8px; }
.export-list .button { width: 100%; }

/* Quiz */
.quiz-grid { display: grid; grid-template-columns: minmax(600px,1fr) 320px; gap: 14px; }
.quiz-card { min-height: 720px; }
.quiz-content { padding: 25px 34px; }
.quiz-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.quiz-question { margin: 28px 0 21px; font: 400 clamp(25px,2.25vw,36px)/1.15 var(--serif); max-width: 900px; }
.answers { display: grid; gap: 9px; }
.answer-option {
  width: 100%; min-height: 58px; padding: 12px 15px; display: grid; grid-template-columns: 28px minmax(0,1fr);
  align-items: center; gap: 10px; text-align: left; border: 1px solid var(--line); border-radius: var(--radius); background: white; cursor: pointer;
}
.answer-option:hover { border-color: #91aa9e; background: #fafcfb; }
.answer-option.selected { border-color: var(--emerald); background: var(--emerald-soft); }
.answer-option.wrong { border-color: #ea9e98; background: var(--red-soft); }
.answer-letter { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #bdc9c3; border-radius: 50%; font-family: var(--serif); }
.explanation { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.explanation h3 { margin: 0 0 7px; color: var(--emerald-dark); font: 400 20px var(--serif); }
.source-citation { margin-top: 12px; padding: 10px; border: 1px solid #b8d0e8; border-radius: 5px; background: var(--blue-soft); color: #14558e; font-size: 11px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { padding: 12px; background: #f2f5f3; border-radius: 6px; }
.stat strong, .stat small { display: block; }
.stat strong { font: 400 23px var(--serif); }
.stat small { margin-top: 3px; color: var(--muted); }
.difficulty { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.difficulty button { min-height: 34px; border: 1px solid var(--line); border-radius: 5px; background: white; font-size: 10px; cursor: pointer; }
.difficulty button.active { background: var(--emerald-dark); color: white; border-color: var(--emerald-dark); }
.focus-list { display: grid; gap: 11px; }

.scrim { display: none; position: fixed; inset: 0; z-index: 18; background: rgba(4,19,24,.45); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; padding: 11px 15px; border-radius: var(--radius); background: var(--sidebar); color: white; box-shadow: 0 8px 30px rgba(0,0,0,.18); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
dialog { border: 0; padding: 0; border-radius: 10px; width: min(560px, calc(100vw - 28px)); color: var(--ink); }
dialog::backdrop { background: rgba(4,19,24,.48); }
.dialog-card { padding: 20px; }
.dialog-head { display: flex; justify-content: space-between; gap: 20px; }
.dialog-head small { color: var(--emerald-dark); }
.dialog-head h2 { margin: 4px 0 18px; font: 400 27px var(--serif); }
.dialog-card label { display: grid; gap: 7px; font-weight: 600; }
.dialog-card textarea { width: 100%; padding: 11px; border: 1px solid var(--line); border-radius: var(--radius); resize: vertical; }
.trust-note { color: var(--muted); font-size: 11px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 18px; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 196px minmax(0,1fr); }
  .user-label, .today { display: none; }
  .topbar { grid-template-columns: minmax(220px,1fr) max-content max-content; }
  .overview-grid { grid-template-columns: minmax(0,1.45fr) minmax(260px,.8fr); }
  .overview-grid > :last-child { grid-column: 1 / -1; }
  .uploads-grid { grid-template-columns: 240px minmax(420px,1fr); }
  .ocr-panel { grid-column: 1 / -1; }
  .canvas-grid { grid-template-columns: 1fr 1fr; height: auto; }
  .canvas-grid > :last-child { grid-column: 1 / -1; min-height: 580px; }
  .calendar-grid { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 250px minmax(420px,1fr); }
  .cards-grid > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: 260px; transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .scrim.show { display: block; }
  .menu-button { display: block; }
  .topbar { grid-template-columns: 38px minmax(0,1fr) max-content; padding: 0 12px; }
  .topbar .notification { display: none; }
  main { padding: 16px; }
  .page-head { align-items: start; }
  .page-head h1 { font-size: 34px; }
  .head-actions { flex-wrap: wrap; justify-content: end; }
  .overview-grid, .uploads-grid, .calendar-grid, .cards-grid, .quiz-grid { grid-template-columns: 1fr; }
  .overview-grid > *, .uploads-grid > *, .cards-grid > * { grid-column: auto !important; }
  .upload-queue { min-height: auto; }
  .doc-review { min-height: 620px; }
  .canvas-page { margin: -16px; }
  .canvas-head { align-items: start; }
  .canvas-head h1 span { display: block; margin: 5px 0 0; }
  .canvas-grid { grid-template-columns: 1fr; height: auto; }
  .canvas-grid > :last-child { grid-column: auto; }
  .canvas-grid .panel { min-height: 650px; }
  .roadmap-grid { grid-template-columns: 110px repeat(8, minmax(45px,1fr)); overflow-x: auto; }
  .quiz-card { min-height: auto; }
}

@media (max-width: 560px) {
  .topbar { height: 58px; }
  .ask-button { padding: 8px 10px; font-size: 0; }
  .ask-button::after { content: "✦"; font-size: 16px; }
  main { min-height: calc(100dvh - 58px); padding: 12px; }
  .page-head { display: grid; }
  .head-actions { justify-content: start; }
  .page-head h1 { font-size: 31px; }
  .panel-head h2 { font-size: 18px; }
  .agenda-item { grid-template-columns: 44px 7px minmax(0,1fr); }
  .agenda-item .badge { grid-column: 3; justify-self: start; }
  .doc-review { grid-template-columns: 1fr; min-height: auto; }
  .doc-pane { border-right: 0; border-bottom: 1px solid var(--line); }
  .document-page { height: 520px; }
  .note-pane { height: 520px; }
  .canvas-page { margin: -12px; }
  .canvas-head { min-height: 110px; display: grid; }
  .canvas-head .head-actions { display: none; }
  .canvas-grid { padding: 7px; gap: 7px; }
  .canvas-grid .panel { min-height: 560px; }
  .slide-workspace { grid-template-columns: 64px minmax(0,1fr); }
  .slide-thumb { height: 75px; }
  .week-grid { overflow-x: auto; grid-template-columns: 45px repeat(5, 130px); }
  .cards-grid .panel, .quiz-grid .panel { min-width: 0; }
  .quiz-content { padding: 18px 15px; }
  .quiz-question { font-size: 27px; }
  .answer-option { grid-template-columns: 26px minmax(0,1fr); }
  .field.question textarea { font-size: 19px; }
  .toast { left: 12px; right: 12px; bottom: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* Josephine editorial redesign */
:root {
  --sidebar: #fbfaf6;
  --sidebar-2: #f7f4ed;
  --paper: #fbfaf6;
  --surface: #fffefa;
  --ink: #25211f;
  --muted: #756f69;
  --line: #ded9d0;
  --line-soft: #eeeae3;
  --emerald: #146a57;
  --emerald-dark: #0f5848;
  --emerald-soft: #edf5f0;
  --aubergine: #54203f;
  --aubergine-soft: #f3eaf0;
  --rose: #ca6478;
  --rose-soft: #faedf0;
  --gold: #a9751e;
  --gold-soft: #fbf3e5;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "DM Sans", "Segoe UI", sans-serif;
}

body { font-family: var(--sans); background: var(--paper); }
.app-shell { grid-template-columns: 178px minmax(0, 1fr); }
.sidebar {
  padding: 26px 13px 22px;
  background: var(--sidebar);
  color: var(--ink);
  border-right: 1px solid var(--line);
  box-shadow: none;
}
.brand { gap: 8px; padding: 2px 10px 26px; }
.brand-mark {
  display: grid; place-items: center; width: 29px; height: 35px;
  color: var(--emerald); background: none; clip-path: none; font-size: 27px;
}
.brand-name { font: 500 18px/1 var(--serif); color: #292522; letter-spacing: 0; }
.profile {
  display: none;
}
.nav-list { gap: 5px; }
.nav-list button {
  min-height: 48px; padding: 10px 13px; gap: 12px;
  border: 1px solid transparent; border-radius: 7px;
  color: #393431; background: transparent;
  font: 500 13px/1 var(--serif);
}
.nav-list button > i { width: 21px; font-size: 21px; }
.nav-list button:hover { background: #f2eee7; }
.nav-list button.active {
  color: white; background: var(--emerald-dark); border-color: var(--emerald-dark);
}
.local-status {
  margin-top: auto; padding: 13px 10px 0;
  border: 0; border-top: 1px solid var(--line); border-radius: 0; background: transparent;
  color: var(--muted); font-size: 10px; line-height: 1.55;
}
.local-status strong { color: #554f4a; font-size: 10px; font-weight: 500; }
.status-dot { width: 7px; height: 7px; background: var(--emerald); }

.topbar {
  height: 58px; padding: 0 24px;
  grid-template-columns: max-content minmax(250px, 430px) max-content max-content max-content;
  background: rgba(251,250,246,.96);
}
.app-main:has(.josephine-home) .topbar { display: none; }
.app-main:has(.josephine-home) main { padding: 0; min-height: 100dvh; }
.global-search, .ask-button, .button { border-radius: 6px; }
.page-head h1 { font-family: var(--serif); color: var(--aubergine); letter-spacing: 0; }

.josephine-home { min-height: 100dvh; background: var(--surface); }
.josephine-hero {
  position: relative; min-height: 500px; overflow: hidden; background: #eee4d5;
}
.josephine-hero > img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center;
}
.josephine-hero::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 53%;
  background: linear-gradient(90deg, rgba(252,249,242,.97) 0%, rgba(252,249,242,.72) 62%, rgba(252,249,242,0) 100%);
  pointer-events: none;
}
.weather-line {
  position: absolute; z-index: 2; top: 31px; left: 47px;
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-radius: 18px; background: rgba(255,255,255,.55); color: #514a45;
  backdrop-filter: blur(8px); font: 13px var(--serif);
}
.weather-line i { font-size: 17px; }
.hero-copy {
  position: absolute; z-index: 2; left: 47px; top: 83px; width: min(440px, 43%);
}
.hero-copy h1 {
  margin: 0; color: var(--aubergine);
  font: 500 clamp(65px, 7vw, 106px)/.77 var(--serif);
  letter-spacing: -2px;
}
.hero-motto {
  margin: 16px 0 26px !important; color: #8a684c !important;
  font: italic 22px/1.2 var(--serif); letter-spacing: .02em;
}
.hero-copy h2 { margin: 0 0 8px; font: 500 29px/1.1 var(--serif); }
.hero-copy > p:last-child { margin: 0; color: #4f4a45; font-size: 13px; line-height: 1.55; }

.daily-journal {
  display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(315px, .9fr);
  min-height: 448px; background: #fffefa;
}
.journal-agenda { padding: 23px 34px 29px 47px; border-right: 1px solid var(--line); }
.journal-agenda > header, .today-important > header {
  display: flex; align-items: center; gap: 10px; min-height: 38px;
  padding-bottom: 10px; border-bottom: 1px solid var(--line);
}
.journal-agenda header > i, .today-important header > i { font-size: 20px; }
.journal-agenda header h2, .today-important header h2 {
  margin: 0; font: 500 20px/1 var(--serif);
}
.journal-agenda header span { margin-left: 8px; color: #79685b; font: italic 19px var(--serif); }
.day-list { position: relative; padding-left: 25px; }
.day-list::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 3px; width: 1px; background: #ddd7ce;
}
.day-entry {
  position: relative; width: 100%; min-height: 69px; padding: 10px 5px 10px 9px;
  display: grid; grid-template-columns: 72px 45px minmax(0,1fr) 20px; gap: 10px; align-items: center;
  border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; text-align: left; cursor: pointer;
}
.day-entry::before {
  content: ""; position: absolute; left: -25px; top: 31px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--emerald); box-shadow: 0 0 0 4px #fffefa;
}
.day-entry.blue::before { background: #3d7298; }
.day-entry.rose::before { background: var(--rose); }
.day-entry.aubergine::before { background: var(--aubergine); }
.day-entry.gold::before { background: var(--gold); }
.day-entry:hover { background: #fbf8f2; }
.day-entry time { color: var(--emerald); font: 500 23px var(--serif); }
.day-entry.blue time { color: #3d7298; }
.day-entry.rose time { color: var(--rose); }
.day-entry.aubergine time { color: var(--aubergine); }
.day-entry.gold time { color: var(--gold); }
.day-icon {
  display: grid; place-items: center; width: 39px; height: 39px; border-radius: 50%;
  color: var(--emerald); background: var(--emerald-soft); font-size: 21px;
}
.blue .day-icon { color: #3d7298; background: #edf3f7; }
.rose .day-icon { color: var(--rose); background: var(--rose-soft); }
.aubergine .day-icon { color: var(--aubergine); background: var(--aubergine-soft); }
.gold .day-icon { color: var(--gold); background: var(--gold-soft); }
.day-entry strong, .day-entry small { display: block; }
.day-entry strong { margin-bottom: 4px; font: 500 16px var(--serif); }
.day-entry small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.entry-arrow { opacity: 0; color: var(--muted); }
.day-entry:hover .entry-arrow { opacity: 1; }

.today-important { padding: 23px 31px 29px; }
.important-row {
  width: 100%; min-height: 92px; padding: 13px 4px;
  display: grid; grid-template-columns: 45px minmax(0,1fr) 18px; gap: 12px; align-items: center;
  border: 0; border-bottom: 1px solid var(--line-soft); background: transparent; text-align: left; cursor: pointer;
}
.important-row:hover { background: #fbf8f2; }
.important-icon {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: var(--rose-soft); color: var(--rose); font-size: 21px;
}
.important-row.gap .important-icon { background: var(--aubergine-soft); color: var(--aubergine); }
.important-row.next { margin-top: 14px; padding: 13px; border: 0; border-radius: 8px; background: var(--emerald-soft); }
.important-row.next .important-icon { background: #fff; color: var(--emerald); }
.important-row small, .important-row strong, .important-row em { display: block; }
.important-row small { margin-bottom: 4px; color: var(--rose); font-size: 10px; font-style: normal; }
.important-row.gap small { color: #8e5480; }
.important-row.next small { color: var(--emerald); }
.important-row strong { margin-bottom: 4px; font: 500 15px var(--serif); }
.important-row em { color: var(--muted); font-size: 10px; font-style: normal; }
.journal-note {
  margin: 25px 0 0 54px; color: #5c907d; transform: rotate(-2deg);
  font: italic 18px/1.25 var(--serif);
}

.quiet-page {
  max-width: 1120px; margin: 0 auto; display: grid; gap: 18px;
}
.quiet-page.two-column { grid-template-columns: minmax(320px,.8fr) minmax(480px,1.2fr); }
.plan-intro, .focus-story, .reminder-date {
  padding: 35px 0 28px; border-bottom: 1px solid var(--line);
}
.eyebrow { color: var(--emerald); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.plan-intro h2, .focus-story h2 {
  margin: 10px 0; color: var(--aubergine); font: 500 38px/1.05 var(--serif);
}
.plan-intro p, .focus-story p { max-width: 620px; color: var(--muted); line-height: 1.65; }
.plan-days, .calm-list { display: grid; border-top: 1px solid var(--line); }
.plan-days button, .calm-list button {
  min-height: 78px; display: grid; grid-template-columns: 120px minmax(0,1fr) max-content;
  gap: 18px; align-items: center; padding: 14px 8px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; text-align: left; cursor: pointer;
}
.plan-days button:hover, .calm-list button:hover { background: #f8f5ef; }
.plan-days time { color: var(--emerald); font: 500 19px var(--serif); }
.plan-days strong, .plan-days span, .calm-list strong, .calm-list small { display: block; }
.plan-days strong, .calm-list strong { font: 500 17px var(--serif); }
.plan-days span, .calm-list small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.calm-list button { grid-template-columns: 12px minmax(0,1fr) max-content; }
.calm-list em { color: var(--muted); font-size: 11px; font-style: normal; }
.signal { width: 8px; height: 8px; border-radius: 50%; background: var(--emerald); }
.signal.red { background: var(--rose); }
.signal.amber { background: var(--gold); }
.reminders-page { grid-template-columns: 260px minmax(0,1fr); align-items: start; }
.reminder-date { border: 0; }
.reminder-date span, .reminder-date strong { display: block; font-family: var(--serif); }
.reminder-date span { color: var(--emerald); font-size: 18px; }
.reminder-date strong { color: var(--aubergine); font-size: 48px; }
.reminder-date p { color: var(--muted); line-height: 1.55; }
.reminders-page .calm-list button { grid-template-columns: 45px minmax(0,1fr) max-content; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 164px minmax(0,1fr); }
  .hero-copy { width: 48%; }
  .hero-copy h1 { font-size: 72px; }
  .daily-journal { grid-template-columns: 1fr; }
  .journal-agenda { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 820px) {
  .sidebar { width: 250px; }
  .app-main:has(.josephine-home) .topbar { display: grid; }
  .app-main:has(.josephine-home) main { padding: 0; }
  .josephine-hero { min-height: 610px; }
  .josephine-hero > img { object-position: 66% center; }
  .josephine-hero::after { width: 72%; }
  .hero-copy { left: 28px; top: 80px; width: 58%; }
  .weather-line { left: 28px; }
  .journal-agenda, .today-important { padding-left: 24px; padding-right: 24px; }
  .quiet-page.two-column, .reminders-page { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .josephine-hero { min-height: 690px; background: #fffefa; }
  .josephine-hero > img { height: 390px; object-position: 68% center; }
  .josephine-hero::after { display: none; }
  .hero-copy {
    top: 390px; left: 0; width: 100%; padding: 19px 20px 22px;
    background: #fffefa;
  }
  .hero-copy h1 { font-size: 52px; line-height: .78; }
  .hero-motto { margin: 13px 0 18px !important; font-size: 17px; }
  .hero-copy h2 { margin: 0 0 7px; font-size: 25px; }
  .weather-line { top: 20px; left: 20px; font-size: 11px; }
  .journal-agenda, .today-important { padding: 20px 15px; }
  .day-list { padding-left: 17px; }
  .day-entry { grid-template-columns: 55px 37px minmax(0,1fr); gap: 7px; }
  .day-entry::before { left: -17px; }
  .day-entry time { font-size: 19px; }
  .day-icon { width: 34px; height: 34px; }
  .entry-arrow { display: none; }
}
