@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Manrope:wght@400;500;600;700;800&family=Noto+Serif+SC:wght@500;600;700&display=swap');

:root {
  --bg: #f5f1e9;
  --paper: #fffcf7;
  --ink: #20231f;
  --muted: #878b82;
  --line: #e7e1d6;
  --green: #6f806a;
  --green-dark: #455746;
  --green-soft: #e8eee4;
  --amber: #e6a052;
  --amber-soft: #faecd7;
  --clay: #cb775d;
  --shadow: 0 16px 50px rgba(63, 60, 49, 0.08);
  --radius: 18px;
  --sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --serif: 'Noto Serif SC', 'Songti SC', Georgia, serif;
  --mono: 'DM Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: flex; }

.sidebar {
  width: 250px;
  min-height: 100vh;
  padding: 29px 19px 23px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(91, 92, 80, 0.11);
  background: rgba(255, 252, 247, 0.7);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 11px; }
.brand-mark { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--green-dark); box-shadow: 0 5px 12px rgba(69, 87, 70, .2); }
.brand-mark svg { width: 17px; height: 17px; }
.brand-name { font-size: 16px; font-weight: 800; letter-spacing: -.04em; }
.brand-note { margin: 4px 0 0; color: var(--muted); font-size: 10px; letter-spacing: .09em; }

.nav-label { margin: 48px 12px 12px; color: #a0a399; font-family: var(--mono); font-size: 9px; letter-spacing: .13em; text-transform: uppercase; }
.nav { display: grid; gap: 5px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px; color: #70766c; border: 0; border-radius: 11px; background: transparent; font-size: 13px; text-align: left; transition: .2s ease; }
.nav-item:hover { color: var(--green-dark); background: #f0eee6; }
.nav-item.active { color: var(--green-dark); background: #e9eee5; font-weight: 700; }
.nav-item svg { width: 16px; height: 16px; stroke-width: 1.7; }
.nav-badge { margin-left: auto; min-width: 22px; padding: 2px 5px; color: var(--green-dark); border-radius: 20px; background: #dce6d7; font-family: var(--mono); font-size: 10px; text-align: center; }

.sidebar-bottom { margin-top: auto; }
.streak-card { padding: 15px; border: 1px solid #e8e5dc; border-radius: 14px; background: #faf8f2; }
.streak-top { display: flex; align-items: center; justify-content: space-between; color: #71786e; font-size: 11px; }
.streak-top strong { color: var(--ink); font-size: 17px; }
.streak-line { height: 5px; margin: 13px 0 10px; overflow: hidden; border-radius: 10px; background: #e8e4db; }
.streak-line span { display: block; width: 76%; height: 100%; border-radius: inherit; background: var(--amber); }
.streak-caption { margin: 0; color: #9a9d94; font-size: 10px; line-height: 1.5; }
.profile { display: flex; align-items: center; gap: 10px; margin-top: 20px; padding: 0 9px; }
.avatar { width: 31px; height: 31px; display: grid; place-items: center; color: #fff; border-radius: 50%; background: #ad8e73; font-family: var(--serif); font-size: 13px; }
.profile-name { font-size: 12px; font-weight: 700; }
.profile-role { margin-top: 2px; color: var(--muted); font-size: 10px; }

.main { width: min(100%, 1440px); padding: 28px 45px 56px; margin: 0 auto; overflow: hidden; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 52px; }
.crumb { color: var(--muted); font-size: 11px; }
.crumb b { color: var(--green-dark); font-weight: 700; }
.top-actions { display: flex; align-items: center; gap: 11px; }
.account-chip { max-width: 190px; display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; overflow: hidden; color: #7e8178; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 252, 247, .54); font-size: 10px; }
.account-chip:hover { color: var(--green-dark); border-color: #d5dfd0; background: var(--green-soft); }
.account-chip.connected { color: var(--green-dark); border-color: #d5dfd0; background: #edf2ea; }
.account-chip svg { width: 14px; height: 14px; flex: 0 0 auto; }
.account-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.storage-chip { max-width: 260px; display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; overflow: hidden; color: #7e8178; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 252, 247, .54); font-size: 10px; }
.storage-chip:hover { color: var(--green-dark); border-color: #d5dfd0; background: var(--green-soft); }
.storage-chip.connected { color: var(--green-dark); border-color: #d5dfd0; background: #edf2ea; }
.storage-chip svg { width: 14px; height: 14px; flex: 0 0 auto; }
.storage-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.storage-chip i { width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: #b8bcb2; }
.storage-chip.connected i { background: #7d9a75; }
.date-chip { display: flex; align-items: center; gap: 8px; padding: 8px 12px; color: #7e8178; border: 1px solid var(--line); border-radius: 9px; background: rgba(255, 252, 247, .54); font-family: var(--mono); font-size: 10px; }
.date-chip svg { width: 13px; height: 13px; }
.icon-button { width: 35px; height: 35px; display: grid; place-items: center; color: #7c8178; border: 1px solid var(--line); border-radius: 10px; background: transparent; }
.icon-button:hover { color: var(--green-dark); background: var(--paper); }
.icon-button svg { width: 16px; height: 16px; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 26px; }
.eyebrow { margin: 0 0 10px; color: var(--green); font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0; font-family: var(--serif); font-size: clamp(29px, 3vw, 42px); font-weight: 600; letter-spacing: -.06em; line-height: 1.25; }
.heading-copy { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.8; }
.heading-side { display: flex; align-items: center; gap: 11px; padding-bottom: 4px; }
.mini-note { color: var(--muted); font-size: 11px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px; color: #fff; border: 0; border-radius: 10px; background: var(--green-dark); font-size: 12px; font-weight: 700; box-shadow: 0 7px 16px rgba(69, 87, 70, .18); transition: .2s ease; }
.primary-button:hover { background: #384939; transform: translateY(-1px); }
.primary-button svg { width: 15px; height: 15px; }
.secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 14px; color: var(--green-dark); border: 1px solid #d6dfd2; border-radius: 10px; background: transparent; font-size: 12px; font-weight: 700; }
.secondary-button:hover { background: var(--green-soft); }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 18px; }
.stat-card { min-height: 112px; padding: 18px 19px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255, 252, 247, .67); }
.stat-card:first-child { border-color: #dfe8da; background: #eef3eb; }
.stat-label { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.stat-icon { width: 27px; height: 27px; display: grid; place-items: center; color: var(--green); border-radius: 8px; background: rgba(255,255,255,.6); }
.stat-icon svg { width: 14px; height: 14px; }
.stat-value { margin: 10px 0 0; font-size: 27px; font-weight: 800; letter-spacing: -.06em; }
.stat-suffix { margin-left: 3px; color: #8b9086; font-size: 11px; font-weight: 500; letter-spacing: 0; }
.stat-foot { margin-top: 4px; color: #9b9f96; font-size: 10px; }
.stat-foot.up { color: var(--green); }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.47fr) minmax(300px, .83fr); gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 252, 247, .75); }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 0; }
.panel-title { margin: 0; font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: -.04em; }
.panel-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.text-button { padding: 4px 0; color: var(--green); border: 0; background: transparent; font-size: 11px; font-weight: 700; }

.review-panel { min-height: 354px; overflow: hidden; }
.review-panel .panel-header { padding-bottom: 18px; border-bottom: 1px solid #eeeae2; }
.mode-switch { display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: #eeece5; }
.mode-switch button { padding: 6px 10px; color: #999b92; border: 0; border-radius: 6px; background: transparent; font-size: 10px; }
.mode-switch button.active { color: var(--green-dark); background: #fffdf8; box-shadow: 0 2px 5px rgba(50,50,30,.06); font-weight: 700; }
.review-content { display: grid; grid-template-columns: minmax(170px, .72fr) 1fr; gap: 32px; padding: 26px 22px 23px; }
.review-number { color: #d7d9d1; font-family: var(--mono); font-size: 50px; font-weight: 500; letter-spacing: -.1em; line-height: .9; }
.review-number small { display: block; margin-top: 10px; color: #aaaea4; font-size: 10px; letter-spacing: 0; }
.book-select-wrap { margin-top: 24px; }
.field-label { display: block; margin-bottom: 7px; color: #8f938a; font-size: 10px; }
.book-select, .form-input, .form-textarea { width: 100%; padding: 10px 11px; color: var(--ink); border: 1px solid #deded5; border-radius: 8px; outline: 0; background: #fffdf8; font-size: 12px; }
.book-select:focus, .form-input:focus, .form-textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(111,128,106,.1); }
.review-card { min-height: 178px; padding: 22px 23px; position: relative; border-radius: 15px; color: #fff; background: linear-gradient(135deg, #637660, #435945); cursor: pointer; box-shadow: 0 11px 22px rgba(62, 83, 63, .15); }
.review-card:hover { box-shadow: 0 14px 28px rgba(62, 83, 63, .2); transform: translateY(-1px); }
.review-card:focus-visible { outline: 3px solid rgba(111,128,106,.3); outline-offset: 3px; }
.review-card::after { content: ''; width: 115px; height: 115px; position: absolute; right: -24px; bottom: -49px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 17px rgba(255,255,255,.04), 0 0 0 34px rgba(255,255,255,.03); }
.review-card-tag { color: #d6e2d0; font-family: var(--mono); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; }
.review-card h3 { max-width: 80%; margin: 14px 0 8px; font-family: var(--serif); font-size: 20px; font-weight: 600; letter-spacing: -.04em; }
.review-card p { max-width: 80%; margin: 0; color: #d3ddd0; font-size: 11px; line-height: 1.6; }
.review-card-bottom { display: flex; align-items: center; justify-content: space-between; position: absolute; z-index: 1; right: 23px; bottom: 20px; left: 23px; }
.review-count { color: #d3ddd0; font-family: var(--mono); font-size: 9px; }
.review-card .primary-button { padding: 8px 11px; color: var(--green-dark); background: #f8f4e9; box-shadow: none; font-size: 10px; }
.review-card .primary-button:hover { background: #fff; }

.rhythm-panel { min-height: 354px; }
.rhythm-content { padding: 21px 22px; }
.rhythm-summary { display: flex; align-items: flex-end; justify-content: space-between; padding-bottom: 23px; }
.rhythm-total { margin: 0; font-size: 29px; font-weight: 800; letter-spacing: -.08em; }
.rhythm-total span { margin-left: 5px; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0; }
.rhythm-desc { max-width: 135px; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; text-align: right; }
.bars { height: 157px; display: flex; align-items: flex-end; gap: 12px; padding: 0 7px 23px; border-bottom: 1px solid #ebe7de; }
.bar-wrap { height: 100%; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; }
.bar { width: 100%; max-width: 18px; min-height: 6px; border-radius: 4px 4px 2px 2px; background: #d8e0d2; }
.bar.today { background: var(--green-dark); }
.bar.strong { background: #aebeaa; }
.bar-label { color: #aaada5; font-family: var(--mono); font-size: 9px; }
.rhythm-legend { display: flex; justify-content: space-between; padding-top: 14px; color: var(--muted); font-size: 10px; }
.legend-dot { width: 6px; height: 6px; display: inline-block; margin-right: 5px; border-radius: 50%; background: var(--green-dark); }

.bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.books-panel, .focus-panel { min-height: 280px; }
.book-list { display: grid; gap: 2px; padding: 17px 22px 20px; }
.book-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.book-cover { width: 33px; height: 43px; display: grid; flex: 0 0 auto; place-items: center; color: rgba(255,255,255,.85); border-radius: 5px 7px 7px 5px; box-shadow: 2px 3px 0 rgba(0,0,0,.06); font-family: var(--serif); font-size: 12px; }
.book-meta { min-width: 0; flex: 1; }
.book-name { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--serif); font-size: 13px; font-weight: 600; }
.book-author { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.book-progress { width: 83px; }
.progress-label { display: flex; justify-content: space-between; margin-bottom: 5px; color: #9b9e95; font-family: var(--mono); font-size: 9px; }
.progress-track { height: 4px; overflow: hidden; border-radius: 5px; background: #e9e6de; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--amber); }
.book-review-date { width: 58px; color: #9b9e95; font-size: 9px; text-align: right; }
.focus-content { padding: 20px 22px; }
.focus-quote { margin: 0; padding: 16px 17px; border-left: 3px solid var(--amber); border-radius: 0 10px 10px 0; background: var(--amber-soft); font-family: var(--serif); font-size: 15px; line-height: 1.8; }
.focus-quote em { color: var(--clay); font-style: normal; }
.focus-tip { display: flex; gap: 10px; margin-top: 18px; color: var(--muted); font-size: 10px; line-height: 1.7; }
.focus-tip svg { width: 16px; height: 16px; flex: 0 0 auto; color: var(--amber); }

.library-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.library-filters { display: flex; align-items: center; gap: 8px; }
.filter-pill { padding: 7px 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 20px; background: transparent; font-size: 10px; }
.filter-pill.active { color: var(--green-dark); border-color: #d5dfd0; background: var(--green-soft); font-weight: 700; }
.library-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.library-card { min-height: 138px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 252, 247, .74); cursor: pointer; transition: .2s ease; }
.library-card:hover { border-color: #cfdccc; box-shadow: var(--shadow); transform: translateY(-2px); }
.library-card:focus-visible { outline: 3px solid rgba(111,128,106,.25); outline-offset: 2px; }
.library-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.library-card-main { min-width: 0; display: flex; align-items: center; gap: 11px; }
.library-card-copy { min-width: 0; }
.large-cover { width: 44px; height: 56px; display: grid; flex: 0 0 auto; place-items: center; color: rgba(255,255,255,.9); border-radius: 6px 9px 9px 6px; font-family: var(--serif); font-size: 14px; box-shadow: 3px 4px 0 rgba(0,0,0,.07); }
.card-menu { padding: 2px; color: #a7aaa1; border: 0; background: none; font-size: 17px; }
.card-menu:hover { color: var(--green-dark); }
.card-open { color: #a7aaa1; font-size: 17px; line-height: 1; }
.library-card h3 { margin: 0 0 4px; overflow: hidden; font-family: var(--serif); font-size: 16px; font-weight: 600; letter-spacing: -.04em; text-overflow: ellipsis; white-space: nowrap; }
.library-card .author { margin: 0; color: var(--muted); font-size: 10px; }
.entry-count { display: block; margin-top: 8px; color: var(--green); font-family: var(--mono); font-size: 9px; }
.book-desc { min-height: 0; margin: 12px 0 0; overflow: hidden; color: #8a8e84; font-size: 10px; line-height: 1.6; text-overflow: ellipsis; white-space: nowrap; }
.card-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 13px; border-top: 1px solid #eeeae2; }
.entry-count { color: var(--green); font-family: var(--mono); font-size: 10px; }
.link-button { color: var(--green-dark); border: 0; background: none; font-size: 10px; font-weight: 700; }
.empty-card { display: flex; min-height: 138px; flex-direction: column; align-items: center; justify-content: center; padding: 14px; border: 1px dashed #d6d8cf; border-radius: 16px; background: rgba(255,255,255,.28); text-align: center; }
.empty-card svg { width: 20px; height: 20px; margin-bottom: 8px; color: var(--green); }
.empty-card p { margin: 0 0 13px; color: var(--muted); font-size: 11px; }

.book-detail-head { display: flex; align-items: center; gap: 17px; padding: 21px 23px; margin-bottom: 17px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,252,247,.72); }
.book-detail-head h2 { margin: 0 0 5px; font-family: var(--serif); font-size: 22px; font-weight: 600; letter-spacing: -.05em; }
.book-detail-head p { margin: 0; color: var(--muted); font-size: 11px; }
.detail-actions { margin-left: auto; display: flex; gap: 8px; }
.entries-list { display: grid; gap: 10px; }
.entry-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,252,247,.67); }
.entry-index { width: 27px; height: 27px; display: grid; place-items: center; color: var(--green-dark); border-radius: 8px; background: var(--green-soft); font-family: var(--mono); font-size: 10px; }
.entry-item h3 { margin: 0 0 5px; font-family: var(--serif); font-size: 14px; font-weight: 600; }
.entry-item p { margin: 0; overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.55; text-overflow: ellipsis; white-space: nowrap; }
.mastery { width: 90px; text-align: right; }
.mastery-label { margin-bottom: 6px; color: var(--muted); font-size: 9px; }
.mastery .progress-track span { background: var(--green); }

.learning-shell { max-width: 900px; margin: 0 auto; }
.learning-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 27px; }
.back-button { display: inline-flex; align-items: center; gap: 7px; padding: 7px 0; color: var(--muted); border: 0; background: transparent; font-size: 11px; }
.back-button:hover { color: var(--green-dark); }
.back-button svg { width: 15px; height: 15px; }
.session-progress { width: 210px; }
.session-progress-label { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-family: var(--mono); font-size: 9px; }
.session-progress .progress-track { height: 5px; }
.session-progress .progress-track span { background: var(--green-dark); }
.learning-card { padding: 37px 44px 33px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,252,247,.83); box-shadow: var(--shadow); }
.learning-meta { display: flex; align-items: center; gap: 9px; }
.book-tag { padding: 5px 8px; color: var(--green-dark); border-radius: 5px; background: var(--green-soft); font-size: 10px; font-weight: 700; }
.chapter-tag { color: var(--muted); font-family: var(--mono); font-size: 9px; }
.learning-label { margin: 48px 0 13px; color: var(--amber); font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: .15em; text-transform: uppercase; }
.learning-card h2 { max-width: 760px; margin: 0; font-family: var(--serif); font-size: clamp(27px, 4vw, 42px); font-weight: 600; letter-spacing: -.07em; line-height: 1.35; }
.learning-prompt { margin: 13px 0 26px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.answer-box { width: 100%; min-height: 135px; padding: 14px 16px; resize: vertical; border: 1px solid #dddcd3; border-radius: 11px; outline: none; background: #fffdf9; font-size: 12px; line-height: 1.7; }
.answer-box:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(111,128,106,.1); }
.answer-box::placeholder { color: #b7bab1; }
.answer-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.hint { display: flex; align-items: center; gap: 6px; color: #a3a69d; font-size: 10px; }
.hint svg { width: 14px; height: 14px; color: var(--amber); }
.submit-answer { padding: 11px 17px; }
.answer-result { margin-top: 24px; padding-top: 23px; border-top: 1px solid #ece8de; }
.result-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.result-heading h3 { margin: 0; font-family: var(--serif); font-size: 15px; font-weight: 600; }
.result-heading span { color: var(--muted); font-size: 10px; }
.model-answer { padding: 14px 15px; color: #686f65; border-radius: 10px; background: #f0f3ed; font-size: 11px; line-height: 1.75; }
.rating-title { margin: 21px 0 10px; color: #777d73; font-size: 11px; font-weight: 700; }
.rating-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rating-button { padding: 11px 7px 10px; color: #747970; border: 1px solid #e0dfd6; border-radius: 9px; background: transparent; font-size: 10px; }
.rating-button:hover { border-color: #becdb9; background: var(--green-soft); }
.rating-button strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 11px; }
.rating-button small { color: #a3a69d; font-size: 9px; }
.rating-button.danger:hover { border-color: #e7c9be; background: #f9eae5; }
.session-done { padding: 53px 35px; text-align: center; }
.done-mark { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 17px; color: var(--green-dark); border-radius: 50%; background: var(--green-soft); }
.done-mark svg { width: 25px; height: 25px; }
.session-done h2 { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: -.05em; }
.session-done p { margin: 11px auto 22px; color: var(--muted); font-size: 11px; line-height: 1.7; }

.history-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 18px; }
.history-list { padding: 17px 22px 20px; }
.history-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) 70px; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #eeebe3; }
.history-row:last-child { border-bottom: 0; }
.history-date { color: var(--muted); font-family: var(--mono); font-size: 9px; line-height: 1.5; }
.history-date strong { display: block; color: var(--green-dark); font-size: 13px; }
.history-book { margin: 0 0 4px; font-family: var(--serif); font-size: 12px; }
.history-book-note { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.history-score { color: var(--green); font-family: var(--mono); font-size: 10px; text-align: right; }
.insight-box { margin: 20px 22px; padding: 16px; border-radius: 11px; background: var(--amber-soft); }
.insight-box strong { display: block; margin-bottom: 7px; color: var(--clay); font-family: var(--serif); font-size: 14px; }
.insight-box p { margin: 0; color: #997350; font-size: 10px; line-height: 1.7; }

.modal-backdrop { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(31, 36, 31, .32); backdrop-filter: blur(5px); }
.modal { width: min(100%, 520px); max-height: 90vh; overflow: auto; padding: 25px; border: 1px solid rgba(255,255,255,.6); border-radius: 18px; background: var(--paper); box-shadow: 0 25px 70px rgba(29,35,29,.2); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.modal-head h2 { margin: 0; font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -.05em; }
.modal-head p { margin: 7px 0 0; color: var(--muted); font-size: 10px; }
.modal-close { width: 28px; height: 28px; display: grid; place-items: center; color: var(--muted); border: 0; border-radius: 50%; background: #f1eee7; }
.modal-close:hover { color: var(--ink); }
.form-group { margin-bottom: 14px; }
.form-textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row .form-group { margin-bottom: 0; }
.color-options { display: flex; gap: 9px; padding-top: 7px; }
.color-option { width: 25px; height: 25px; border: 3px solid transparent; border-radius: 50%; }
.color-option.selected { border-color: var(--ink); box-shadow: 0 0 0 2px var(--paper); }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding-top: 8px; }
.data-status { display: flex; align-items: center; gap: 9px; padding: 12px 13px; margin-bottom: 17px; color: #7f847a; border: 1px solid #e8e5dc; border-radius: 10px; background: #f4f1ea; font-size: 11px; }
.data-status.connected { color: var(--green-dark); border-color: #d8e3d4; background: var(--green-soft); }
.data-status svg { width: 16px; height: 16px; flex: 0 0 auto; }
.auth-message { padding: 10px 12px; margin: -3px 0 15px; color: var(--green-dark); border: 1px solid #d8e3d4; border-radius: 9px; background: var(--green-soft); font-size: 11px; line-height: 1.55; }
.auth-message.error { color: #9a5846; border-color: #ecd2c8; background: #fbede8; }
.data-actions { display: flex; gap: 9px; }
.data-actions button { flex: 1; }
.data-help { margin: 15px 1px 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.data-help code { padding: 2px 4px; color: var(--green-dark); border-radius: 4px; background: #eef0ea; font-family: var(--mono); font-size: 9px; }
.data-secondary-actions { display: flex; justify-content: space-between; margin-top: 18px; padding-top: 14px; border-top: 1px solid #eeeae2; }

.toast { position: fixed; z-index: 20; right: 25px; bottom: 24px; display: flex; align-items: center; gap: 8px; padding: 12px 15px; color: #fff; border-radius: 10px; background: #394a3b; box-shadow: 0 10px 25px rgba(40,55,40,.2); font-size: 11px; animation: rise .25s ease both; }
.toast svg { width: 15px; height: 15px; color: #d8ead1; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1060px) {
  .main { padding: 27px 28px 48px; }
  .review-content { gap: 18px; }
  .library-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .sidebar { width: 70px; padding: 23px 10px; align-items: center; }
  .brand { padding: 0; }
  .brand-copy, .nav-label, .nav-item span:not(.nav-badge), .streak-card, .profile-copy { display: none; }
  .nav { margin-top: 43px; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-badge { position: absolute; margin: -23px -24px 0 0; }
  .profile { padding: 0; }
  .topbar { margin-bottom: 35px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .bottom-grid, .history-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .main { padding: 21px 16px 38px; }
  .account-chip { max-width: 35px; padding: 8px; }
  .account-chip span { display: none; }
  .sidebar { display: none; }
  .topbar { margin-bottom: 28px; }
  .date-chip { display: none; }
  .storage-chip { max-width: 180px; }
  .page-heading { display: block; }
  .heading-side { margin-top: 19px; }
  .review-content { grid-template-columns: 1fr; }
  .review-number { display: none; }
  .review-card { min-height: 193px; }
  .panel-header { padding-left: 17px; padding-right: 17px; }
  .review-panel .panel-header { align-items: flex-start; gap: 11px; }
  .mode-switch button { padding-left: 7px; padding-right: 7px; }
  .review-content, .rhythm-content, .book-list, .focus-content { padding-left: 17px; padding-right: 17px; }
  .library-grid { grid-template-columns: 1fr; }
  .learning-card { padding: 26px 20px 23px; }
  .learning-label { margin-top: 35px; }
  .answer-actions { align-items: flex-end; flex-direction: column; gap: 12px; }
  .answer-actions .primary-button { width: 100%; }
  .rating-grid { grid-template-columns: repeat(2, 1fr); }
  .book-detail-head { align-items: flex-start; flex-wrap: wrap; }
  .detail-actions { width: 100%; margin-left: 0; }
  .history-list { padding-left: 17px; padding-right: 17px; }
  .form-row { grid-template-columns: 1fr; }
}
