@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;500;600&family=Roboto+Condensed:wght@300;400;500&display=swap');

:root {
  --ink: #536168;
  --ink-soft: #66757b;
  --muted: #8a9699;
  --paper: #fbf8f4;
  --surface: #f4f0ea;
  --white: #fffdfa;
  --line: #e7dfd6;
  --teal: #71949a;
  --teal-pale: #e8f0ef;
  --sage: #d5e1d4;
  --blush: #ead0ca;
  --lavender: #dcd4e5;
  --sand: #efe1bf;
  --shadow: 0 8px 28px rgba(92, 103, 105, .055);
  --radius: 12px;
  color: var(--ink);
  background: var(--paper);
  font-family: Manrope, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: var(--paper); letter-spacing: .002em; }
button, input, textarea, select { font: inherit; }
button { color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid #a8c4c3; outline-offset: 3px; }

.skip-link { position: fixed; top: -50px; left: 1rem; z-index: 100; padding: .65rem .9rem; color: var(--ink); background: var(--sand); border-radius: 0 0 7px 7px; font-size: .82rem; font-weight: 500; }
.skip-link:focus { top: 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; }

.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; padding-top: 60px; }
.topbar { position: fixed; z-index: 20; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 60px; padding: 0 1.35rem; color: var(--ink); background: rgba(251, 248, 244, .96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: .65rem; padding: 0; color: inherit; text-align: left; background: transparent; border: 0; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; color: #6b767a; background: var(--sand); border-radius: 50%; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-size: .9rem; font-weight: 500; }
.brand strong, .brand small { display: block; }
.brand strong { color: #5b696e; font-size: .78rem; font-weight: 500; letter-spacing: .1em; }
.brand small { margin-top: .07rem; color: var(--muted); font-size: .64rem; font-weight: 300; letter-spacing: .03em; }
.global-search { position: relative; display: flex; align-items: center; width: min(440px, 48vw); }
.global-search input { width: 100%; padding: .58rem 3.25rem .58rem .9rem; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 999px; font-size: .8rem; font-weight: 300; }
.global-search input::placeholder { color: #a0a8a9; }
.global-search kbd { position: absolute; right: .65rem; padding: .12rem .28rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; font-family: inherit; font-size: .62rem; font-weight: 400; }
.icon-button { display: none; padding: .42rem .55rem; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 7px; }

.sidebar { position: sticky; top: 60px; height: calc(100vh - 60px); padding: .95rem .8rem; background: #f7f3ee; border-right: 1px solid var(--line); overflow-y: auto; }
.progress-panel { padding: .82rem; background: rgba(255, 253, 250, .8); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 16px rgba(92, 103, 105, .025); }
.eyebrow { display: block; margin-bottom: .38rem; color: #82999a; font-size: .59rem; font-weight: 500; text-transform: uppercase; letter-spacing: .16em; }
.progress-panel strong { color: #607075; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-size: 1rem; font-weight: 400; }
.progress-track { height: 4px; margin: .65rem 0 .55rem; overflow: hidden; background: #ebe5de; border-radius: 99px; }
.progress-track span { display: block; width: 0; height: 100%; background: #aac6be; transition: width .35s ease; }
.text-button { padding: 0; color: #759294; background: transparent; border: 0; font-size: .73rem; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.main-nav { display: grid; gap: .12rem; padding: .85rem 0; }
.main-nav button { display: flex; align-items: center; gap: .58rem; width: 100%; padding: .55rem .5rem; color: #66757a; text-align: left; background: transparent; border: 0; border-radius: 7px; font-size: .79rem; font-weight: 400; }
.main-nav button span { width: 1.45rem; color: #abb3b3; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-size: .7rem; font-weight: 300; }
.main-nav button:hover, .main-nav button.active { color: #637f83; background: #e9f0ed; font-weight: 500; }
.sidebar-note { margin-top: .25rem; padding: .45rem .65rem; color: #94a09f; border-left: 2px solid #d8c99d; font-size: .73rem; font-weight: 300; line-height: 1.5; }

.content { min-width: 0; padding: clamp(1.15rem, 2.7vw, 2.7rem); }
.page { max-width: 1180px; margin: 0 auto; animation: appear .18s ease-out; }
@keyframes appear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-header h1 { margin: .1rem 0 0; color: #667e83; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-size: clamp(1.42rem, 2.2vw, 2rem); font-weight: 300; line-height: 1.16; letter-spacing: .015em; }
.page-header p { max-width: 655px; margin: .45rem 0 0; color: var(--muted); font-size: .84rem; font-weight: 300; line-height: 1.62; }
.eyebrow.inline { display: inline-flex; align-items: center; gap: .3rem; }
.eyebrow.inline::before { width: 1.15rem; height: 1px; content: ""; background: currentColor; }

.hero { position: relative; overflow: hidden; padding: clamp(1.35rem, 2.9vw, 2.35rem); color: var(--ink); background: #edf4f1; border: 1px solid #dce9e4; border-radius: 15px; box-shadow: none; }
.hero::after { position: absolute; right: -90px; bottom: -115px; width: 240px; height: 240px; content: ""; border: 1px solid rgba(132, 167, 165, .34); border-radius: 50%; box-shadow: 0 0 0 21px rgba(202, 220, 215, .28); }
.hero-content { position: relative; z-index: 1; max-width: 650px; }
.hero .eyebrow { color: #7f9b9a; }
.hero h1 { max-width: 610px; margin: .3rem 0 .65rem; color: #698186; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-size: clamp(1.65rem, 3vw, 2.35rem); font-weight: 300; line-height: 1.18; letter-spacing: .012em; }
.hero p { max-width: 600px; color: #7c8d8f; font-size: .85rem; font-weight: 300; line-height: 1.68; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .95rem; }
.primary-button, .secondary-button, .tag-button, .filter-button { padding: .52rem .82rem; border-radius: 999px; font-size: .73rem; font-weight: 500; transition: transform .16s ease, background .16s ease; }
.primary-button { color: #667477; background: #d9e8df; border: 1px solid #c8dbd1; }
.secondary-button { color: #718487; background: rgba(255, 255, 255, .5); border: 1px solid #ccdcda; }
.primary-button:hover, .secondary-button:hover, .tag-button:hover, .filter-button:hover { transform: translateY(-1px); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; margin: .9rem 0 1.25rem; }
.metric { padding: .75rem .82rem; background: rgba(255, 253, 250, .82); border: 1px solid var(--line); border-radius: 10px; }
.metric strong { display: block; color: #748e92; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-size: 1.35rem; font-weight: 400; }
.metric span { color: var(--muted); font-size: .7rem; font-weight: 300; }

.split-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(270px, .75fr); gap: .85rem; align-items: start; }
.panel { padding: .98rem; background: rgba(255, 253, 250, .78); border: 1px solid var(--line); border-radius: var(--radius); }
.panel h2 { margin: 0 0 .55rem; color: #72898d; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-size: 1.08rem; font-weight: 400; line-height: 1.3; letter-spacing: .01em; }
.panel p { color: #7b898c; font-size: .84rem; font-weight: 300; line-height: 1.62; }
.category-list { display: grid; gap: .35rem; }
.category-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .48rem .35rem; border-bottom: 1px solid #eee8e1; }
.category-row:last-child { border-bottom: 0; }
.category-row button { padding: 0; color: #789194; text-align: left; background: transparent; border: 0; font-size: .8rem; font-weight: 500; }
.category-count { color: #a1abaa; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-size: .72rem; font-weight: 300; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-bottom: .8rem; }
.local-search { position: relative; flex: 1 1 260px; }
.local-search input { width: 100%; padding: .67rem .85rem; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 9px; font-size: .8rem; font-weight: 300; }
.local-search input:focus { border-color: #b7d0cb; }
.filter-group { display: flex; flex-wrap: wrap; gap: .4rem; }
.toolbar .work-select { width: auto; min-width: 220px; }
.filter-button { color: #829093; background: rgba(255, 253, 250, .75); border: 1px solid var(--line); }
.filter-button.active { color: #667e82; background: #e7f0ed; border-color: #d1e0da; }
.result-note { margin: .2rem 0 .9rem; color: var(--muted); font-size: .78rem; font-weight: 300; }
.work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .65rem; }
.work-card { position: relative; display: flex; flex-direction: column; min-height: 158px; padding: .8rem; background: rgba(255, 253, 250, .82); border: 1px solid var(--line); border-top: 2px solid var(--card-accent, #c7d9d5); border-radius: 10px; box-shadow: none; }
.work-card:hover { background: #fffefa; border-color: #d9e2de; box-shadow: 0 6px 16px rgba(95, 112, 112, .045); transform: translateY(-1px); }
.work-card .work-number { color: #aab2b2; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-size: .66rem; font-weight: 300; }
.work-card h2 { margin: .45rem 0 .23rem; color: #71888c; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-size: 1rem; font-weight: 400; line-height: 1.25; letter-spacing: .008em; }
.work-card p { margin: 0; color: #929c9e; font-size: .73rem; font-weight: 300; line-height: 1.42; }
.work-card footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-top: .7rem; margin-top: auto; }
.card-open { padding: 0; color: #7d9a9a; background: transparent; border: 0; font-size: .72rem; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.mini-actions { display: flex; gap: .28rem; }
.mini-action { display: grid; place-items: center; width: 27px; height: 27px; color: #8b9796; background: transparent; border: 1px solid #e9e3dc; border-radius: 50%; font-size: .75rem; }
.mini-action.active { background: #e8f0ea; border-color: #cee0d4; }
.category-pill { display: inline-flex; width: fit-content; padding: .25rem .45rem; color: #80999a; background: #f0f5f1; border-radius: 99px; font-size: .6rem; font-weight: 500; letter-spacing: .04em; }
.empty-state { padding: 2rem 1rem; color: var(--muted); text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); font-size: .85rem; font-weight: 300; }

.detail-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .7rem; margin-bottom: 1rem; }
.back-button { padding: 0; color: #7d989a; background: transparent; border: 0; font-size: .78rem; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.detail-card { padding: clamp(1rem, 2.3vw, 1.8rem); background: rgba(255, 253, 250, .84); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; color: var(--muted); font-size: .72rem; font-weight: 300; }
.detail-card > h1 { margin: .45rem 0 .25rem; color: #70888d; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-size: clamp(1.45rem, 2.8vw, 2.15rem); font-weight: 300; line-height: 1.18; letter-spacing: .012em; }
.detail-card > .author { margin: 0 0 1.1rem; color: var(--muted); font-size: .82rem; font-weight: 300; }

.source-content { color: #778589; }
.source-content h2, .source-content h3, .source-content h4 { color: #789094; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-weight: 400; line-height: 1.28; scroll-margin-top: 76px; letter-spacing: .012em; }
.source-content h2 { margin: 1.6rem 0 .6rem; font-size: clamp(1.2rem, 2.2vw, 1.7rem); }
.source-content h3 { margin: 1.2rem 0 .45rem; font-size: 1.06rem; }
.source-content h4 { margin: 1rem 0 .3rem; font-size: .92rem; }
.source-content p { max-width: 830px; margin: .58rem 0; color: #7a888b; font-size: .88rem; font-weight: 300; line-height: 1.72; }
.source-content strong { color: #738b8f; font-weight: 500; }
.source-content em { color: #879497; }
.source-list { max-width: 830px; padding-left: 1.15rem; color: #7a888b; font-size: .88rem; font-weight: 300; line-height: 1.62; }
.source-list li { margin: .3rem 0; }
.source-content code { padding: .08rem .22rem; color: #758a8c; background: #edf3ef; border-radius: 4px; font-size: .88em; }
.reading-wrap { padding: clamp(1rem, 2.2vw, 1.8rem); background: rgba(255, 253, 250, .8); border: 1px solid var(--line); border-radius: 13px; }
.reading-wrap .source-content > h2:first-child { margin-top: 0; }

.axis-index { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .55rem; margin-bottom: .85rem; }
.axis-index button { padding: .68rem; color: #7c9397; text-align: left; background: rgba(255, 253, 250, .78); border: 1px solid var(--line); border-radius: 8px; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-size: .8rem; font-weight: 400; line-height: 1.34; letter-spacing: .01em; }
.axis-index button:hover { background: #edf4f1; border-color: #d6e4de; }
.axis-index button small { display: block; margin-top: .3rem; color: var(--muted); font-family: Manrope, sans-serif; font-size: .65rem; font-weight: 300; }
.week-list { display: grid; gap: .5rem; margin: .8rem 0 1.1rem; }
.week-card { display: grid; grid-template-columns: 43px 1fr; align-items: start; gap: .62rem; padding: .7rem; background: rgba(255, 253, 250, .8); border: 1px solid var(--line); border-radius: 9px; }
.week-number { display: grid; place-items: center; width: 34px; height: 34px; color: #7b9295; background: #e7f0ed; border-radius: 50%; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-size: .9rem; font-weight: 400; }
.week-card p { margin: .08rem 0; color: #7d8a8d; font-size: .84rem; font-weight: 300; line-height: 1.55; }

.workbook-layout { display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: .9rem; }
.work-select { width: 100%; padding: .58rem; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 8px; font-size: .8rem; font-weight: 300; }
.workbook-card { padding: 1rem; background: rgba(255, 253, 250, .82); border: 1px solid var(--line); border-radius: var(--radius); }
.workbook-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; }
.workbook-head h2 { margin: .2rem 0; color: #71898d; font-family: "Roboto Condensed", "Arial Narrow", sans-serif; font-size: 1.2rem; font-weight: 400; line-height: 1.25; }
.note-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .62rem; margin-top: .7rem; }
.note-field { display: grid; gap: .35rem; }
.note-field.full { grid-column: 1 / -1; }
.note-field label { color: #82999a; font-size: .7rem; font-weight: 500; }
.note-field textarea { min-height: 92px; padding: .58rem; color: var(--ink); resize: vertical; background: #fffefa; border: 1px solid var(--line); border-radius: 7px; font-size: .82rem; font-weight: 300; line-height: 1.5; }
.note-save { margin-top: .7rem; color: #8ca69a; font-size: .7rem; font-weight: 400; }

.exercise-list, .check-list { display: grid; gap: .52rem; }
.exercise { padding: .68rem .75rem; color: #7e898b; background: #fffaf1; border-left: 2px solid #e8d5a9; border-radius: 0 7px 7px 0; font-size: .84rem; font-weight: 300; line-height: 1.58; }
.check-item { display: flex; align-items: flex-start; gap: .6rem; padding: .62rem; color: #7d898b; background: rgba(255, 253, 250, .8); border: 1px solid var(--line); border-radius: 8px; font-size: .83rem; font-weight: 300; line-height: 1.52; }
.check-item input { width: 1rem; height: 1rem; margin-top: .12rem; accent-color: #aac6be; }
.check-item.checked { color: #98a89c; background: #f0f5f0; text-decoration: line-through; }
.search-summary { margin-bottom: .9rem; padding: .72rem .85rem; color: #788e91; background: #edf4f1; border-left: 2px solid #bbd3cd; font-size: .82rem; font-weight: 300; }
.source-section-result { padding: .65rem; margin: .45rem 0; background: rgba(255, 253, 250, .8); border: 1px solid var(--line); border-radius: 7px; }
.source-section-result button { padding: 0; color: #799396; background: transparent; border: 0; font-size: .78rem; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

.toast { position: fixed; right: 1rem; bottom: 1rem; z-index: 50; max-width: 280px; padding: .7rem .85rem; color: #718589; background: #edf4f1; border: 1px solid #d5e4dd; border-radius: 8px; box-shadow: var(--shadow); font-size: .78rem; font-weight: 400; animation: toast-in .2s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 15; top: 60px; left: 0; width: min(290px, 92vw); transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .icon-button { display: block; }
  .content { padding: 1.1rem; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-layout, .workbook-layout { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .topbar { gap: .55rem; padding: 0 .75rem; }
  .brand small { display: none; }
  .global-search { flex: 1; width: auto; }
  .global-search input { padding-right: .8rem; }
  .global-search kbd { display: none; }
  .content { padding: .95rem; }
  .hero { border-radius: 12px; }
  .hero h1 { font-size: 1.65rem; }
  .metric-grid { gap: .55rem; }
  .metric { padding: .68rem; }
  .metric strong { font-size: 1.22rem; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .work-grid { grid-template-columns: 1fr; }
  .note-grid { grid-template-columns: 1fr; }
  .note-field.full { grid-column: auto; }
}

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