:root {
  font-size: 100%;
  --type-caption: .75rem;
  --type-small: .8125rem;
  --type-control: .875rem;
  --type-body: .9375rem;
  --type-title-small: 1rem;
  --type-title: 1.0625rem;
  --type-title-large: 1.125rem;
  --type-19: 1.1875rem;
  --type-heading: 1.25rem;
  --type-21: 1.3125rem;
  --type-heading-large: 1.375rem;
  --bg: #f5f3ee;
  --panel: #fbfaf7;
  --card: #ffffff;
  --ink: #1f2925;
  --muted: #59665e;
  --line: #e4e1d9;
  --brand: #2f7055;
  --brand-text: var(--brand);
  --brand-deep: #245b45;
  --brand-soft: #e4efe9;
  --ochre: #b9823d;
  --shadow: 0 16px 50px rgba(40, 52, 46, .09);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  display: flex;
  flex-direction: column;
  padding: 26px 18px 18px;
  background: #183a2d;
  color: #eef5f1;
  border-right: 1px solid rgba(255,255,255,.08);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 7px 24px; }
.brand-mark {
  display: block; width: 38px; height: 38px; flex: 0 0 auto; object-fit: contain;
}
.brand strong { display: block; font-size: var(--type-title-large); letter-spacing: -.3px; }
.brand span { display: block; margin-top: 1px; font-size: var(--type-small); color: #a8bbb2; text-transform: uppercase; letter-spacing: 1.1px; }
.capture-button {
  display: grid; grid-template-columns: 35px 1fr auto; align-items: center; gap: 10px; width: 100%;
  border: 1px solid rgba(231,201,151,.32); border-radius: 13px; padding: 10px; cursor: pointer;
  background: linear-gradient(135deg,rgba(255,255,255,.12),rgba(255,255,255,.055));
  color: white; text-align: left; box-shadow: 0 8px 18px rgba(0,0,0,.08);
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.capture-button:hover { transform: translateY(-1px); border-color: rgba(231,201,151,.58); background: rgba(255,255,255,.14); }
.capture-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; background: #e7c997; color: #173a2d; font-size: var(--type-heading); line-height: 1; }
.capture-copy { display: grid; min-width: 0; gap: 2px; }
.capture-copy strong { font-size: var(--type-small); line-height: 1.15; }
.capture-copy small { overflow: hidden; color: #9fb2a9; font-size: var(--type-caption); font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
kbd {
  margin-left: auto; border: 1px solid rgba(60,70,64,.2); border-radius: 5px;
  padding: 2px 5px; color: #8b918d; background: rgba(255,255,255,.5);
  font: 600 var(--type-caption) "Segoe UI", sans-serif;
}
.capture-button kbd { color: #b8c7c0; background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.14); }
.workspace-switch { display:grid; grid-template-columns:1fr 1fr; gap:3px; margin-bottom:13px; padding:3px; border:1px solid rgba(255,255,255,.1); border-radius:9px; background:rgba(0,0,0,.09); }
.workspace-switch button { height:29px; border:0; border-radius:7px; background:transparent; color:#91a99e; cursor:pointer; font-size:var(--type-caption); font-weight:800; }
.workspace-switch button.active { background:rgba(255,255,255,.13); color:white; }
.work-nav-label { margin:16px 10px 5px; color:#6f94ae; font-size:var(--type-caption); font-weight:900; letter-spacing:1px; text-transform:uppercase; }
.work-folder-navigation { display:grid; gap:4px; }
.work-folder-navigation .nav-item { padding-left:10px; }
.work-folder-navigation .nav-item .nav-icon { font-size:var(--type-body); }
.work-nav-empty { padding:8px 10px; color:#6688a0; font-size:var(--type-caption); }
.nav-section { display: grid; gap: 4px; margin-top: 18px; }
.nav-item {
  display: grid; grid-template-columns: 24px 1fr auto; align-items: center;
  width: 100%; padding: 9px 10px; border: 0; border-radius: 9px;
  background: transparent; color: #c0d0c8; cursor: pointer; text-align: left;
  font-size: var(--type-body); font-weight: 600;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: white; }
.nav-item.active { color: white; background: rgba(255,255,255,.11); }
.nav-icon { color: #91a99e; font-size: var(--type-title-large); }
.nav-item.active .nav-icon { color: #e7c997; }
.nav-item b { font-size: var(--type-small); font-weight: 700; color: #7f9d8f; }
.nav-label {
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px 8px 3px; color: #829d91; font-size: var(--type-small);
  font-weight: 800; letter-spacing: 1.1px; text-transform: uppercase;
}
.nav-label button { border: 0; color: #829d91; background: none; cursor: pointer; font-size: var(--type-title-small); }
.collections { margin-top: 5px; overflow: auto; }
.collections .nav-item.child { padding-left: 25px; color: #a9beb4; }
.collections .nav-item.child .collection-dot { width: 5px; height: 5px; opacity: .9; }

.collection-dot { width: 7px; height: 7px; border-radius: 50%; }
.sidebar-footer { margin-top: auto; padding: 16px 8px 3px; border-top: 1px solid rgba(255,255,255,.09); }
.storage-line { display: flex; justify-content: space-between; font-size: var(--type-caption); text-transform: uppercase; letter-spacing: .6px; color: #91a99e; }
.storage-track { height: 3px; margin: 8px 0; overflow: hidden; border-radius: 9px; background: rgba(255,255,255,.1); }
.storage-track i { display: block; width: 100%; height: 100%; background: #d9bd8d; }
.sidebar-footer small { color: #789287; font-size: var(--type-caption); }

.main { flex: 1; margin-left: 250px; }
.topbar {
  height: 72px; display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  padding: 0 42px; background: rgba(251,250,247,.86); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10;
}
.search-box {
  margin-right: auto; width: min(520px, 50vw); height: 40px;
  display: flex; align-items: center; gap: 9px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 10px; background: white;
}
.search-box span { font-size: var(--type-heading-large); color: #7d857f; transform: rotate(-15deg); }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: var(--type-body); }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: white; cursor: pointer; }
.avatar { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 50%; background: #d9bd8d; color: #244536; font-size: var(--type-small); font-weight: 800; }
.content { max-width: 1320px; margin: 0 auto; padding: 46px 44px 70px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--brand-text); font-size: var(--type-small); letter-spacing: 1.6px; font-weight: 800; }
h1, h2 { font-family: Georgia, serif; }
h1 { margin: 0; font-size: 2.375rem; line-height: 1; letter-spacing: -.8px; }
.page-heading p:last-child { margin: 9px 0 0; color: var(--muted); font-size: var(--type-body); }
.heading-actions { display: flex; gap: 9px; }
.primary-button, .secondary-button, .text-button {
  min-height: 39px; padding: 0 15px; border-radius: 9px; cursor: pointer; font-weight: 700; font-size: var(--type-control);
}
.primary-button { border: 1px solid var(--brand); background: var(--brand); color: white; }
.primary-button:hover { background: var(--brand-deep); }
.secondary-button { border: 1px solid var(--line); background: var(--card); }
.text-button { border: 0; background: transparent; color: var(--muted); }
.review-banner {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 15px;
  margin: 31px 0 27px; padding: 17px 20px; border: 1px solid #d5e2dc;
  border-radius: 13px; background: linear-gradient(100deg, #edf5f1, #f9faf6);
}
.review-orbit { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: white; font-size: var(--type-19); }
.review-banner strong { font-size: var(--type-body); }
.review-banner p { margin: 3px 0 0; color: var(--muted); font-size: var(--type-small); }
.review-banner button { border: 0; background: none; color: var(--brand-text); font-size: var(--type-small); font-weight: 800; cursor: pointer; }
.review-banner-actions { display: flex; align-items: center; gap: 12px; }
.review-banner-actions #reviewSettingsButton { color: var(--muted); font-weight: 700; }
.filter-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.segmented { display: flex; gap: 4px; }
.segmented button { border: 0; border-radius: 8px; padding: 8px 12px; color: var(--muted); background: transparent; cursor: pointer; font-size: var(--type-small); font-weight: 700; }
.segmented button.active { background: var(--card); color: var(--ink); box-shadow: 0 2px 10px rgba(30,40,35,.07); }
.filter-row select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 30px 8px 10px; color: var(--muted); background: var(--card); font-size: var(--type-small); }
.links-toolbar {
  display: grid; gap: 15px; margin: -5px 0 18px; padding: 17px;
  border: 1px solid var(--line); border-radius: 13px; background: rgba(255,255,255,.58);
}
.link-folder-browser, .tag-filter-wrap { display: grid; gap: 10px; }
.links-toolbar > div > span { color: var(--muted); font-size: var(--type-caption); font-weight: 800; letter-spacing: .8px; text-transform: uppercase; }
.links-toolbar-title { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.links-toolbar-title > div { display: grid; gap: 3px; }
.links-toolbar-title > .link-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.links-toolbar-title span { color: var(--ink); font-size: var(--type-small); font-weight: 900; letter-spacing: .8px; text-transform: uppercase; }
.links-toolbar-title small { color: var(--muted); font-size: var(--type-caption); }
.import-button {
  height: 32px; padding: 0 12px; border: 1px dashed #9eb8ab; border-radius: 8px; background: transparent;
  color: var(--brand-text); cursor: pointer; font-size: var(--type-small); font-weight: 800;
}
.import-button:hover { border-style: solid; background: var(--brand-soft); }
.link-folder-tiles { display: grid; grid-template-columns: repeat(auto-fill,minmax(145px,1fr)); gap: 8px; }
.link-folder-tile { position: relative; min-width: 0; overflow: visible; border: 1px solid var(--line); border-radius: 11px; background: var(--card); }
.link-folder-tile > button[data-link-folder] { width: 100%; min-height: 72px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 5px 8px; padding: 10px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.link-folder-tile > button[data-link-folder]:hover, .link-folder-tile.active > button[data-link-folder] { background: var(--brand-soft); }
.link-folder-tile > button[data-link-folder] small { grid-column: 2 / -1; color: var(--muted); font-size: var(--type-caption); }
.link-folder-tile.active { border-color: #8eae9d; box-shadow: 0 0 0 2px rgba(47,112,85,.06); }
.folder-reminder-badge { padding: 5px 7px; border-radius: 7px; background: #f4e5d2; color: #99653f; font-size: var(--type-caption); font-weight: 800; }
.folder-review-card { border-color: #dac7a9; background: linear-gradient(145deg,#fffaf2,var(--card)); }
.progress-hub { display: grid; gap: 17px; }
.progress-overview { display: grid; grid-template-columns: 1.05fr 1.95fr; gap: 17px; }
.knowledge-health, .weekly-goals, .progress-panel { border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.knowledge-health { min-height: 300px; display: grid; grid-template-columns: 165px 1fr; align-items: center; gap: 20px; padding: 28px; background: linear-gradient(145deg,#edf5f1,var(--card)); }
.health-ring { --health:0; width: 150px; height: 150px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--brand) calc(var(--health) * 1%),#dce6e1 0); position: relative; }
.health-ring::before { content:""; position:absolute; inset:13px; border-radius:50%; background:var(--card); }
.health-ring div { position: relative; display: grid; text-align: center; }
.health-ring strong { font: 700 2.1875rem Georgia,serif; }
.health-ring span { color: var(--muted); font-size: var(--type-caption); font-weight: 800; letter-spacing: .8px; text-transform: uppercase; }
.health-copy h2 { margin: 0 0 9px; font-size: 1.5625rem; }
.health-copy p { margin: 0 0 16px; color: var(--muted); font-size: var(--type-small); line-height: 1.6; }
.health-legend { display: grid; gap: 7px; }
.health-legend div { display: grid; grid-template-columns: 1fr auto; gap: 8px; color: var(--muted); font-size: var(--type-caption); }
.health-legend i { grid-column: 1/-1; height: 4px; overflow: hidden; border-radius: 5px; background: var(--line); }
.health-legend i span { display:block; height:100%; background:var(--brand); }
.progress-metrics { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
.progress-metric { min-height: 145px; display: flex; flex-direction: column; padding: 19px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.progress-metric > span { color: var(--muted); font-size: var(--type-caption); font-weight: 900; letter-spacing: .9px; text-transform: uppercase; }
.progress-metric strong { margin-top: 14px; font: 700 1.8125rem Georgia,serif; }
.progress-metric p { margin: auto 0 0; color: var(--muted); font-size: var(--type-caption); line-height: 1.45; }
.progress-bottom { display:grid; grid-template-columns: 1.25fr .75fr; gap:17px; }
.weekly-goals, .progress-panel { padding: 23px; }
.progress-panel-header { display:flex; align-items:end; justify-content:space-between; gap:15px; margin-bottom:17px; }
.progress-panel-header h2 { margin:0; font-size:var(--type-21); }
.progress-panel-header p { margin:5px 0 0; color:var(--muted); font-size:var(--type-caption); }
.progress-panel-header span { color: var(--brand-text); font-size:var(--type-caption); font-weight:800; }
.goal-list { display:grid; gap:9px; }
.goal-row { display:grid; grid-template-columns:34px 1fr auto; gap:11px; align-items:center; padding:12px; border:1px solid var(--line); border-radius:10px; }
.goal-icon { width:34px; height:34px; display:grid; place-items:center; border-radius:9px; background:var(--brand-soft); color: var(--brand-text); font-weight:900; }
.goal-copy strong { display:block; font-size:var(--type-small); }
.goal-copy span { display:block; margin-top:3px; color:var(--muted); font-size:var(--type-caption); }
.goal-progress { min-width:90px; text-align:right; }
.goal-progress b { color: var(--brand-text); font-size:var(--type-caption); }
.goal-track { height:4px; margin-top:6px; overflow:hidden; border-radius:5px; background:var(--line); }
.goal-track i { display:block; height:100%; background:var(--brand); }
.next-actions { display:grid; gap:9px; }
.next-action { padding:13px; border-left:3px solid #c59a5c; border-radius:8px; background:#f7f4ed; }
.next-action strong { display:block; font-size:var(--type-small); }
.next-action p { margin:5px 0 0; color:var(--muted); font-size:var(--type-caption); line-height:1.5; }
.link-folder-tile strong { overflow: hidden; font-size: var(--type-small); text-overflow: ellipsis; white-space: nowrap; }
.link-folder-tile b { color: var(--muted); font-size: var(--type-caption); }
.folder-tile-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; background: color-mix(in srgb,var(--folder-color,#6f9b84) 18%,white); color: var(--folder-color,#47755f); }
.link-subfolders { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-top: 2px; }
.link-subfolders > span { margin-right: 3px; color: var(--muted); font-size: var(--type-caption); font-weight: 900; text-transform: uppercase; }
.link-subfolders button { padding: 6px 9px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); color: var(--muted); cursor: pointer; font-size: var(--type-caption); font-weight: 700; }
.link-subfolders button.active { border-color: var(--brand); background: var(--brand); color: white; }
.subfolder-chip { display: inline-flex; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--card); }
.subfolder-chip > button { border: 0; border-radius: 0; }
.subfolder-chip > button:first-child b { margin-left: 4px; color: inherit; opacity: .65; font-size: var(--type-caption); }
.subfolder-chip > button:last-child { padding-left: 5px; color: #a3aaa6; }
.subfolder-chip > button:last-child:hover { color: #a4554b; }
.subfolder-chip.active { border-color: var(--brand); }
.subfolder-chip.active > button { background: var(--brand); color: white; }
.tag-filter-wrap { padding-top: 12px; border-top: 1px solid var(--line); }
.tag-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-filter {
  height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--muted); cursor: pointer; font-size: var(--type-small); font-weight: 700;
}
.tag-filter.active { border-color: var(--brand); background: var(--brand); color: white; }
.library-grid { display: grid; grid-template-columns: repeat(3, minmax(250px, 1fr)); gap: 16px; }
.links-list {
  overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--card);
}
.link-group + .link-group { border-top: 8px solid var(--bg); }
.link-group-title { display: flex; align-items: center; justify-content: space-between; padding: 13px 18px; border-bottom: 1px solid var(--line); background: #faf9f6; }
.link-group-title div { display: flex; align-items: center; gap: 8px; }
.link-group-title span { color: var(--brand-text); }
.link-group-title strong { font: 700 var(--type-body) Georgia,serif; }
.link-group-title > b { color: var(--muted); font-size: var(--type-caption); }
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 22px 18px; }
.book-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: -4px 0 24px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.book-view-tabs { display: flex; gap: 6px; }
.book-view-tabs button { padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: var(--type-small); font-weight: 800; }
.book-view-tabs button.active { background: var(--card); color: var(--ink); box-shadow: 0 3px 12px rgba(30,40,35,.07); }
.book-detail-actions select { height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: var(--card); color: var(--ink); font-size: var(--type-small); }
.book-card { min-width: 0; cursor: pointer; }
.book-cover {
  position: relative; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 8px;
  background: linear-gradient(145deg, #315f4b, #173a2d); box-shadow: 0 14px 30px rgba(29,44,37,.16);
  transition: transform .18s ease, box-shadow .18s ease;
}
.book-card:hover .book-cover { transform: translateY(-4px); box-shadow: 0 20px 36px rgba(29,44,37,.22); }
.book-cover img { width: 100%; height: 100%; display: block; object-fit: cover; }
.book-cover-placeholder { height: 100%; display: grid; place-items: center; padding: 18px; color: #f2e7d2; text-align: center; font: 700 var(--type-title-large)/1.25 Georgia, serif; }
.book-format { position: absolute; top: 9px; right: 9px; padding: 4px 6px; border-radius: 5px; background: rgba(20,32,26,.72); color: white; font-size: var(--type-caption); font-weight: 800; }
.book-card h3 { margin: 12px 0 4px; font: 700 var(--type-title-small)/1.25 Georgia, serif; }
.book-card p { margin: 0; overflow: hidden; color: var(--muted); font-size: var(--type-small); text-overflow: ellipsis; white-space: nowrap; }
.book-card-progress { height: 3px; margin-top: 9px; overflow: hidden; border-radius: 4px; background: var(--line); }
.book-card-progress i { display: block; height: 100%; background: var(--brand); }
.book-shelf-name { display: inline-block; margin-top: 7px; color: var(--brand-text); font-size: var(--type-caption); font-weight: 700; }

.book-detail {
  position: relative; width: min(980px, 94vw); max-height: 94vh; overflow: auto;
  border-radius: 18px; padding: 36px; background: var(--panel); box-shadow: 0 32px 100px rgba(16,27,21,.28);
}
.book-detail-close { position: absolute; top: 18px; right: 18px; }
.book-detail-hero { display: grid; grid-template-columns: 170px 1fr; gap: 30px; align-items: start; }
.book-detail-cover { aspect-ratio: 2 / 3; overflow: hidden; border-radius: 8px; background: linear-gradient(145deg,#315f4b,#173a2d); box-shadow: 0 17px 35px rgba(29,44,37,.2); }
.book-detail-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-detail-intro { padding-top: 10px; }
.book-detail-intro h2 { margin: 9px 45px 5px 0; font-size: 2.25rem; line-height: 1.08; }
.book-detail-author { margin: 0 0 24px; color: var(--muted); font-size: var(--type-control); }
.book-detail-progress { width: min(420px,100%); height: 5px; overflow: hidden; border-radius: 6px; background: var(--line); }
.book-detail-progress i { display: block; height: 100%; background: var(--brand); }
.book-progress-copy { display: block; margin-top: 6px; color: var(--muted); font-size: var(--type-caption); }
.book-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.book-knowledge-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 31px; }
.book-memory-card { padding: 17px; border: 1px solid var(--line); border-radius: 11px; background: var(--card); }
.book-memory-card.accent { grid-column: 1 / -1; background: var(--brand-soft); border-color: #c9dbd1; }
.book-memory-card label { display: block; margin-bottom: 9px; color: var(--muted); font-size: var(--type-caption); font-weight: 800; letter-spacing: .8px; text-transform: uppercase; }
.book-memory-card textarea { width: 100%; border: 0; outline: 0; resize: vertical; background: transparent; color: var(--ink); font-size: var(--type-control); line-height: 1.6; }
.memory-card-title { display: flex; justify-content: space-between; }
.memory-card-title b { color: var(--brand-text); font-size: var(--type-small); }
.book-notes-preview { display: grid; gap: 7px; max-height: 170px; overflow: auto; }
.book-notes-preview .reader-note { margin: 0; }
.book-detail-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.book-detail-footer .danger-button { margin-right: auto; margin-left: 0; }

.reader-shell { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: #eeece6; color: #263029; }
.reader-topbar {
  height: 64px; flex: 0 0 64px; display: flex; align-items: center; gap: 20px;
  padding: 0 24px; border-bottom: 1px solid #d8d4ca; background: #fbfaf7;
}
.reader-back { border: 0; background: transparent; color: var(--brand-text); cursor: pointer; font-size: var(--type-small); font-weight: 800; }
.reader-book-name { display: grid; min-width: 0; }
.reader-book-name strong { overflow: hidden; max-width: 380px; text-overflow: ellipsis; white-space: nowrap; font: 700 var(--type-title-small) Georgia, serif; }
.reader-book-name span { margin-top: 2px; color: #7d847f; font-size: var(--type-caption); }
.reader-tools { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.reader-tools > button:not(.primary-button) { height: 34px; min-width: 36px; border: 1px solid #ddd9d0; border-radius: 8px; background: white; cursor: pointer; font-size: var(--type-small); font-weight: 800; }
.reader-tools .reader-delete { border-color: transparent !important; background: transparent !important; color: #a15f55 !important; }
.reader-layout { min-height: 0; flex: 1; display: grid; grid-template-columns: 270px 1fr; }
.reader-sidebar { overflow: auto; padding: 24px 20px; border-right: 1px solid #d8d4ca; background: #f7f5f0; }
.reader-progress-label { display: flex; justify-content: space-between; color: #7b837e; font-size: var(--type-caption); }
.reader-progress-track { height: 4px; margin: 7px 0 20px; overflow: hidden; border-radius: 5px; background: #dedbd3; }
.reader-progress-track i { display: block; width: 0; height: 100%; background: var(--brand); }
.reader-tabs { display: flex; border-bottom: 1px solid #ddd9d0; }
.reader-tabs button { flex: 1; padding: 9px 3px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: #7b837e; cursor: pointer; font-size: var(--type-caption); font-weight: 800; }
.reader-tabs button.active { border-color: var(--brand); color: var(--brand-text); }
.reader-panel { padding: 13px 0; }
.toc-link { display: block; width: 100%; padding: 7px 5px; border: 0; background: transparent; color: #66706a; cursor: pointer; text-align: left; font-size: var(--type-small); line-height: 1.35; }
.toc-link:hover { color: var(--brand-text); }
.reader-note { margin-bottom: 9px; padding: 10px; border: 1px solid #dedbd3; border-left: 3px solid #c39450; border-radius: 7px; background: white; }
.reader-note[data-note-chapter] { cursor: pointer; }
.reader-note[data-note-chapter]:hover { border-color: #b8cdc2; }
.reader-note-location { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: var(--brand-text); font-size: var(--type-caption); font-weight: 800; line-height: 1.3; }
.reader-note-location span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-note-location b { flex: 0 0 auto; color: #929a95; font-weight: 700; }
.reader-note q { display: block; font: 600 var(--type-small)/1.45 Georgia, serif; }
.reader-note p { margin: 6px 0 0; color: #737c76; font-size: var(--type-caption); line-height: 1.4; }
.reader-page { min-width: 0; overflow: auto; scroll-behavior: smooth; }
.reader-content {
  width: min(760px, calc(100% - 80px)); min-height: 100%; margin: 0 auto; padding: 64px 0 120px;
  font: 18px/1.82 Georgia, serif; color: #2a312d;
}
.reader-content h1 { margin: 0 0 1.5em; font-size: 2.15em; line-height: 1.15; }
.reader-content h2 { margin: 2.3em 0 1em; font-size: 1.6em; line-height: 1.25; }
.reader-content h3 { margin: 1.8em 0 .8em; font-size: 1.15em; }
.reader-content p { margin: 0 0 1.05em; }
.reader-content img { display: block; max-width: 100%; max-height: 70vh; margin: 2em auto; object-fit: contain; }
.reader-content .empty-line { height: 1em; }
.reader-content blockquote { margin: 1.5em 0; padding-left: 1.2em; border-left: 3px solid #b9935c; color: #59635d; }
.pdf-frame { width: 100%; height: 100%; border: 0; background: white; }
.reader-shell.night { background: #1d2420; color: #e8eee9; }
.reader-shell.night .reader-note, .reader-shell.night .reader-tools > button:not(.primary-button) { background: #2b3731; border-color: #3d4a44; color: #e8eee9; }
.links-head, .link-row {
  display: grid; grid-template-columns: minmax(270px, 1.3fr) minmax(300px, 1.45fr) minmax(140px, .7fr) 130px 30px;
  gap: 18px; align-items: center;
}
.links-head {
  padding: 11px 18px; background: #f0eee8; color: #7a827d;
  font-size: var(--type-caption); font-weight: 800; letter-spacing: .8px; text-transform: uppercase;
}
.link-row {
  min-height: 104px; padding: 16px 18px; border-top: 1px solid var(--line);
  cursor: pointer; transition: background .15s ease;
}
.link-row:hover { background: #f7faf8; }
.link-primary { min-width: 0; padding: 4px 0; }
.link-primary strong { display: block; overflow: hidden; color: #172d24; text-overflow: ellipsis; white-space: nowrap; font: 700 var(--type-title-large)/1.25 Georgia, serif; }
.link-domain {
  display: inline-block; max-width: 100%; overflow: hidden; margin-top: 9px; padding: 5px 8px;
  border: 1px solid #c9ded3; border-radius: 7px; background: #edf6f1; color: #1e7050;
  font-size: var(--type-small); font-weight: 750; line-height: 1.3; text-decoration: none; text-overflow: ellipsis; white-space: nowrap;
}
.link-domain:hover { border-color: var(--brand); background: #e2f1e9; text-decoration: underline; }
.link-summary {
  min-height: 67px; padding: 11px 12px; border-left: 3px solid #c59a5c; border-radius: 8px;
  background: #f7f4ed; color: #343b37; font-size: var(--type-small); font-weight: 550; line-height: 1.58;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.link-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.link-folder { color: var(--muted); font-size: var(--type-caption); }
.link-folder strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: var(--type-small); }
.knowledge-card {
  position: relative; min-height: 258px; display: flex; flex-direction: column;
  padding: 20px; border: 1px solid var(--line); border-radius: 13px; background: var(--card);
  box-shadow: 0 4px 15px rgba(40,52,46,.025); cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.knowledge-card:hover { transform: translateY(-3px); border-color: #c9d7d0; box-shadow: var(--shadow); }
.personal-hub { display: grid; grid-template-columns: repeat(2, minmax(280px, 1fr)); gap: 22px; }
.personal-area {
  min-height: 330px; display: flex; flex-direction: column; padding: 30px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 18px; background: var(--card); cursor: pointer;
  box-shadow: 0 8px 28px rgba(40,52,46,.04); transition: transform .18s ease, box-shadow .18s ease;
}
.personal-area:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.speech-area { background: linear-gradient(145deg, #fffaf2, #fff); border-color: #ead8bd; }
.dream-area { background: linear-gradient(145deg, #f5f2fb, #fff); border-color: #d9d2e8; }
.personal-area-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 14px; background: rgba(255,255,255,.7); font: 1.75rem Georgia, serif; }
.personal-kicker { margin: 28px 0 8px !important; color: var(--brand-text); font-size: var(--type-caption) !important; font-weight: 900; letter-spacing: 1.5px; }
.personal-area h2 { margin: 0 0 12px; font: 700 1.8125rem/1.1 Georgia, serif; }
.personal-area > p:not(.personal-kicker) { max-width: 460px; margin: 0; color: var(--muted); font-size: var(--type-control); line-height: 1.65; }
.personal-formats { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 22px; }
.personal-formats span { padding: 6px 9px; border-radius: 20px; background: rgba(255,255,255,.75); color: #6d746f; font-size: var(--type-caption); font-weight: 700; }
.personal-area footer { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 25px; }
.personal-area footer strong { font-size: var(--type-small); }
.personal-area footer button { border: 0; background: transparent; color: var(--brand-text); cursor: pointer; font-size: var(--type-small); font-weight: 900; }
.work-hub { display:grid; gap:18px; }
.work-hub-toolbar { display:flex; align-items:center; justify-content:space-between; gap:15px; padding-bottom:15px; border-bottom:1px solid var(--line); }
.work-hub-toolbar p { margin:0; color:var(--muted); font-size:var(--type-small); }
.work-folder-grid { display:grid; grid-template-columns:repeat(3,minmax(240px,1fr)); gap:16px; }
.work-folder-card { min-height:210px; display:flex; flex-direction:column; padding:20px; border:1px solid #cad8e5; border-radius:15px; background:linear-gradient(145deg,#f2f7fb,var(--card)); cursor:pointer; transition:.18s ease; }
.work-folder-card:hover { transform:translateY(-3px); box-shadow:var(--shadow); border-color:#91b2cf; }
.work-folder-card-top { display:flex; align-items:center; justify-content:space-between; }
.work-folder-card-top > div { display:flex; align-items:center; gap:7px; }
.work-folder-card-top button { width:24px; height:24px; border:0; border-radius:6px; background:transparent; color:#9ba8b1; cursor:pointer; font-size:var(--type-title-small); }
.work-folder-card-top button:hover { background:#f5e8e5; color:#a4554b; }
.work-folder-icon { width:39px; height:39px; display:grid; place-items:center; border-radius:11px; background:#deebf5; color:#326b9a; font-size:var(--type-title-large); }
.work-folder-card-top b { color:var(--muted); font-size:var(--type-caption); }
.work-folder-card h2 { margin:23px 0 8px; font-size:1.4375rem; }
.work-folder-card p { margin:0; color:var(--muted); font-size:var(--type-small); line-height:1.55; }
.work-folder-card footer { display:flex; justify-content:space-between; margin-top:auto; padding-top:18px; color:#326b9a; font-size:var(--type-caption); font-weight:800; }
.work-empty { padding:65px 25px; border:1px dashed #b8cbda; border-radius:15px; color:var(--muted); text-align:center; }
.work-empty h2 { margin:8px 0; }
body.work-mode { --brand:#326f9f; --brand-deep:#24577f; --brand-soft:#e6f0f7; --ochre:#6297bd; }

body.work-mode .capture-icon { background:#b9d7ec; color:#15364f; }
.personal-materials { margin-bottom: 28px; }
.personal-materials-header { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.personal-materials-header h2 { margin: 0; font: 700 1.4375rem Georgia, serif; }
.personal-materials-header p { margin: 4px 0 0; color: var(--muted); font-size: var(--type-small); }
.personal-materials-header span { color: var(--muted); font-size: var(--type-caption); font-weight: 700; }
.dream-guide-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; }
.dream-guide-card { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--card); cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.dream-guide-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.dream-guide-card.wide { grid-column: span 2; }
.dream-guide-image { height: 190px; overflow: hidden; background: #202724; }
.dream-guide-card.wide .dream-guide-image { height: 235px; }
.dream-guide-image img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.dream-guide-copy { padding: 13px; }
.dream-guide-copy span { color: #8278ad; font-size: var(--type-caption); font-weight: 900; letter-spacing: 1px; }
.dream-guide-copy h3 { margin: 5px 0 4px; font: 700 var(--type-title-small) Georgia, serif; }
.dream-guide-copy p { margin: 0; color: var(--muted); font-size: var(--type-caption); line-height: 1.45; }
.image-lightbox { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 25px; background: rgba(10,16,13,.9); backdrop-filter: blur(7px); }
.image-lightbox figure { max-width: min(1200px, 94vw); max-height: 92vh; margin: 0; text-align: center; }
.image-lightbox img { max-width: 100%; max-height: 85vh; border-radius: 8px; object-fit: contain; box-shadow: 0 25px 80px rgba(0,0,0,.4); }
.image-lightbox figcaption { margin-top: 10px; color: white; font-size: var(--type-small); }
.image-lightbox-close { position: fixed; top: 20px; right: 25px; border: 0; background: transparent; color: white; cursor: pointer; font-size: 2.125rem; }
.diction-intro { display: grid; grid-template-columns: 1.15fr .85fr; gap: 28px; padding: 27px; border: 1px solid #ead8bd; border-radius: 16px; background: linear-gradient(145deg,#fffaf1,#fff); }
.diction-intro h2, .diction-program h2 { margin: 0 0 10px; font: 700 1.5625rem Georgia, serif; }
.diction-intro p:not(.personal-kicker), .diction-program-header p:not(.personal-kicker) { margin: 0; color: var(--muted); font-size: var(--type-small); line-height: 1.65; }
.diction-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; padding: 0; list-style: none; }
.diction-modes li { padding: 13px; border: 1px solid rgba(213,154,87,.22); border-radius: 10px; background: rgba(255,255,255,.78); font-size: var(--type-small); font-weight: 800; }
.diction-modes b { display: block; margin-bottom: 8px; color: #d08d4e; font-size: var(--type-caption); }
.diction-program { margin-top: 17px; padding: 27px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.diction-program-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.diction-switch { display: flex; padding: 3px; border-radius: 9px; background: #efede8; }
.diction-switch button { padding: 8px 11px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: var(--type-caption); font-weight: 800; }
.diction-switch button.active { background: white; color: var(--brand-text); box-shadow: 0 2px 8px rgba(30,45,38,.08); }
.diction-lines { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.diction-line { display: grid; grid-template-columns: 35px 1fr; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); font-size: var(--type-small); line-height: 1.55; }
.diction-line:nth-child(odd) { border-right: 1px solid var(--line); }
.diction-line b { color: #d08d4e; font-size: var(--type-caption); }
.diction-line span { font-weight: 650; letter-spacing: .15px; }
.diction-level-up { display: flex; gap: 15px; margin-top: 14px; padding: 14px; border-radius: 10px; background: var(--brand-soft); font-size: var(--type-small); line-height: 1.5; }
.diction-level-up strong { flex: 0 0 auto; color: var(--brand-text); }
.tongue-twister { margin-top: 17px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.tongue-twister summary { display: flex; align-items: center; justify-content: space-between; padding: 21px 24px; cursor: pointer; list-style: none; }
.tongue-twister summary span { display: grid; gap: 4px; }
.tongue-twister summary small { color: #d08d4e; font-size: var(--type-caption); font-weight: 900; letter-spacing: 1px; }
.tongue-twister summary strong { font: 700 var(--type-heading) Georgia, serif; }
.tongue-twister summary > b { color: var(--brand-text); font-size: var(--type-caption); }
.tongue-twister > p { max-width: 900px; margin: 0; padding: 0 24px 28px; font: var(--type-title-small)/1.8 Georgia, serif; }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.type-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; background: #f3f1ec; color: #66716b; font-size: var(--type-caption); font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
.favorite-button { border: 0; background: none; color: #a5aaa7; cursor: pointer; font-size: var(--type-19); }
.favorite-button.active { color: var(--ochre); }
.knowledge-card h3 { margin: 16px 0 7px; font: 700 var(--type-heading)/1.18 Georgia, serif; letter-spacing: -.3px; }
.card-why { margin: 0 0 12px; color: var(--muted); font-size: var(--type-small); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.work-knowledge-card { min-height: 285px; padding: 22px; }
.work-knowledge-card h3 { margin: 14px 0 12px; font-size: 1.4375rem; }
.work-card-folder { color: #52738d; font-size: var(--type-caption); font-weight: 850; letter-spacing: .45px; text-transform: uppercase; }
.work-card-note {
  margin: 0 0 16px; color: #2d373d; font: var(--type-title-small)/1.62 Georgia, serif; white-space: pre-line;
  display: -webkit-box; -webkit-line-clamp: 9; -webkit-box-orient: vertical; overflow: hidden;
}
.work-card-note.empty { color: #959d9f; font-style: italic; }
.work-card-link {
  display: grid; grid-template-columns: 25px minmax(0,1fr) auto; align-items: center; gap: 9px;
  width: 100%; margin-top: auto; padding: 9px 10px;
  border: 1px solid #e1e6e8; border-radius: 9px; background: #f8fafb;
  color: #52636d; text-decoration: none; transition: border-color .16s ease, background .16s ease, color .16s ease;
}
.work-card-link-icon {
  display: grid; place-items: center; width: 25px; height: 25px; border-radius: 7px;
  background: #e9eef1; color: #647985; font-size: var(--type-title-small); font-weight: 800;
}
.work-card-link strong { overflow: hidden; font-size: var(--type-small); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.work-card-link-arrow { color: #8a989f; font-size: var(--type-body); }
.work-card-link:hover { border-color: #b9cbd5; background: #f1f6f8; color: #274f68; }
.work-card-link:hover .work-card-link-arrow { color: #376f91; }
.work-card-resources { display: grid; gap: 7px; margin-top: auto; }
.work-fields-editor { display: grid; gap: 12px; }
#workFieldsList { display: grid; gap: 12px; }
.work-field-row { padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fafbfb; }
.work-field-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.work-field-heading label { font-size: var(--type-small); font-weight: 850; }
.work-field-heading button { width: 25px; height: 25px; border: 0; border-radius: 50%; background: #eef0f1; color: #7a858a; cursor: pointer; }
.work-field-row textarea, .work-field-row input[type="url"] { width: 100%; box-sizing: border-box; }
.add-field-wrap { position: relative; }
.add-field-button { width: 100%; padding: 11px; border: 1px dashed #aebfc9; border-radius: 10px; background: #f7fafb; color: #3d6882; cursor: pointer; font-weight: 750; }
.add-field-menu { position: absolute; z-index: 4; left: 0; bottom: calc(100% + 7px); width: min(330px,100%); padding: 6px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); box-shadow: var(--shadow); }
.add-field-menu button { width: 100%; display: grid; grid-template-columns: 25px 1fr; gap: 1px 8px; padding: 9px; border: 0; border-radius: 8px; background: transparent; text-align: left; cursor: pointer; }
.add-field-menu button:hover { background: #f1f5f7; }
.add-field-menu button span { grid-row: 1 / 3; align-self: center; color: #52778d; font-size: var(--type-title-small); }
.add-field-menu button b { font-size: var(--type-small); }
.add-field-menu button small { color: var(--muted); font-size: var(--type-caption); }
.pending-attachment, .work-card-attachment { display: grid; grid-template-columns: 28px minmax(0,1fr) auto; align-items: center; gap: 9px; }
.pending-attachment span { font-size: var(--type-heading); color: #55788d; }
.pending-attachment div { min-width: 0; display: grid; }
.pending-attachment strong, .work-card-attachment strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pending-attachment small { color: var(--muted); }
.attachment-drop-zone { display: grid; place-items: center; gap: 4px; padding: 20px; border: 1px dashed #aebfc9; border-radius: 9px; background: #f7fafb; color: #466d84; cursor: pointer; text-align: center; }
.attachment-drop-zone span { color: var(--muted); font-size: var(--type-caption); }
.attachment-drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.attachment-editor-preview { display: block; width: 100%; max-height: 220px; margin-bottom: 9px; border-radius: 9px; object-fit: contain; background: #edf1f2; }
.work-card-attachment { width: 100%; padding: 9px 10px; border: 1px solid #e1e6e8; border-radius: 9px; background: #f8fafb; color: #52636d; cursor: pointer; text-align: left; }
.work-card-attachment span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 7px; background: #e9eef1; }
.work-card-attachment small { color: #879298; }
.work-card-image { position: relative; width: 100%; padding: 0; overflow: hidden; border: 1px solid #e1e6e8; border-radius: 10px; background: #eef2f3; cursor: pointer; }
.work-card-image img { display: block; width: 100%; height: 150px; object-fit: cover; }
.work-card-image span { position: absolute; right: 7px; bottom: 7px; left: 7px; padding: 6px 8px; overflow: hidden; border-radius: 7px; background: rgba(20,32,40,.72); color: white; font-size: var(--type-caption); text-align: left; text-overflow: ellipsis; white-space: nowrap; backdrop-filter: blur(4px); }
.detail-work-image { width: 100%; padding: 0; overflow: hidden; border: 0; border-radius: 11px; background: #eef2f3; cursor: pointer; }
.detail-work-image img { display: block; width: 100%; max-height: 430px; object-fit: contain; }
.detail-work-resources { display: grid; gap: 8px; margin: 12px 0 20px; }
.progress-wrap { margin: 1px 0 11px; }
.progress-meta { display: flex; justify-content: space-between; margin-bottom: 5px; color: var(--muted); font-size: var(--type-caption); }
.progress { height: 4px; border-radius: 5px; background: #eceae5; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.tag { padding: 4px 7px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-deep); font-size: var(--type-caption); font-weight: 700; }
.card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 13px; margin-top: 13px; border-top: 1px solid #efede8; color: #8b918d; font-size: var(--type-caption); }
.status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; background: #c5a369; }
.status-dot.learning { background: #588bb0; }
.status-dot.learned { background: #4b9270; }
.status-dot.inbox { background: #bb775f; }
.empty-state { text-align: center; padding: 80px 0; }
.empty-state > div { font-size: 2.5rem; color: #aab8b0; }
.empty-state h2 { margin: 8px 0; font-size: 1.5625rem; }
.empty-state p { margin: 0 0 20px; color: var(--muted); font-size: var(--type-control); }
.faq-section { margin-top: 0; padding-top: 0; }
.faq-header { display: flex; align-items: end; justify-content: space-between; gap: 25px; margin-bottom: 20px; }
.faq-header h2 { margin: 0; font-size: 1.6875rem; }
.faq-header p:last-child { margin: 7px 0 0; color: var(--muted); font-size: var(--type-small); }
.faq-search { width: min(300px,100%); height: 39px; display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.faq-search span { color: var(--muted); font-size: var(--type-title-large); }
.faq-search input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: var(--type-small); }
.faq-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; align-items: start; }
.faq-list details { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.faq-list summary { min-height: 55px; display: grid; grid-template-columns: 27px 1fr auto; align-items: center; gap: 9px; padding: 0 14px; cursor: pointer; list-style: none; }
.faq-list summary span { color: #b69561; font-size: var(--type-caption); font-weight: 900; }
.faq-list summary strong { font-size: var(--type-body); line-height: 1.35; }
.faq-list summary b { color: var(--brand-text); font-size: var(--type-title-large); transition: transform .18s ease; }
.faq-list details[open] summary b { transform: rotate(45deg); }
.faq-list details > div { padding: 0 18px 18px 50px; }
.faq-list details p { margin: 0; color: var(--muted); font-size: var(--type-body); line-height: 1.65; overflow-wrap: anywhere; }
.faq-list details kbd { margin: 0 3px; }
.faq-empty { padding: 30px; color: var(--muted); text-align: center; font-size: var(--type-small); }
.hidden { display: none !important; }

.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 30px; background: rgba(20,30,25,.46); backdrop-filter: blur(5px); }
.modal { width: min(680px, 92vw); max-height: 92vh; overflow: auto; border-radius: 16px; padding: 28px; background: var(--panel); box-shadow: 0 30px 90px rgba(13,25,19,.25); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 23px; }
.modal-header h2 { margin: 0; font-size: 1.75rem; }
.modal-lead { max-width: 470px; margin: 8px 0 0; color: var(--muted); line-height: 1.5; }
.work-folder-modal { width: min(560px, 92vw); }
.work-folder-modal .modal-header { padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.work-folder-modal .modal-actions { margin-top: 8px; }
.modal-close { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #ece9e2; color: #6e756f; cursor: pointer; font-size: var(--type-heading-large); }
.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field label { font-size: var(--type-small); font-weight: 800; }
.field label span { color: #9ba09c; font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid #ddd9d0; border-radius: 9px; padding: 11px 12px;
  outline: 0; resize: vertical; background: white; color: var(--ink); font-size: var(--type-control);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #6c9a84; box-shadow: 0 0 0 3px rgba(47,112,85,.09); }
.important-field textarea { background: #f0f6f3; border-color: #c8dbd1; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 7px; }
.bookmark-import-modal { width: min(760px,94vw); }
.bookmark-import-copy { margin: 7px 0 0; color: var(--muted); font-size: var(--type-small); }
.bookmark-import-actions { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.bookmark-import-actions .text-button { min-height: 30px; padding-inline: 8px; }
.bookmark-import-actions strong { margin-left: auto; color: var(--brand-text); font-size: var(--type-small); }
.bookmark-import-tree { max-height: 52vh; display: grid; gap: 9px; overflow: auto; padding-right: 5px; }
.bookmark-folder-choice { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--card); }
.bookmark-folder-choice > header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--brand-soft); }
.bookmark-folder-choice label { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: var(--type-small); font-weight: 900; }
.bookmark-folder-choice input { width: 15px; height: 15px; accent-color: var(--brand); }
.bookmark-folder-choice header b { color: var(--muted); font-size: var(--type-caption); }
.bookmark-subfolder-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.bookmark-subfolder-choices label { min-width: 0; padding: 10px 14px; border-top: 1px solid var(--line); font-size: var(--type-small); font-weight: 650; }
.bookmark-subfolder-choices label:nth-child(odd) { border-right: 1px solid var(--line); }
.bookmark-subfolder-choices span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bookmark-subfolder-choices b { margin-left: auto; color: var(--muted); font-size: var(--type-caption); }
.bookmark-import-footer { margin-top: 17px; padding-top: 15px; border-top: 1px solid var(--line); }
.bookmark-import-footer .primary-button:disabled { opacity: .45; cursor: not-allowed; }
.review-settings-modal { width: min(680px,94vw); }
.setting-switch, .setting-number { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.setting-switch > span, .setting-number > span:first-child { display: grid; gap: 4px; }
.setting-switch strong, .setting-number strong { font-size: var(--type-small); }
.setting-switch small, .setting-number small { color: var(--muted); font-size: var(--type-caption); }
.setting-switch input { width: 18px; height: 18px; accent-color: var(--brand); }
.setting-number > span:last-child { color: var(--muted); font-size: var(--type-small); }
.setting-number input { width: 70px; padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--ink); }
.folder-review-settings { margin: 20px 0; }
.folder-review-settings > header { display: grid; gap: 3px; margin-bottom: 9px; }
.folder-review-settings > header strong { font-size: var(--type-small); }
.folder-review-settings > header small { color: var(--muted); font-size: var(--type-caption); }
.folder-review-row { display: grid; grid-template-columns: 1fr 145px 85px; align-items: center; gap: 10px; padding: 9px 11px; border-top: 1px solid var(--line); }
.folder-review-row > strong { overflow: hidden; font-size: var(--type-small); text-overflow: ellipsis; white-space: nowrap; }
.folder-review-row select, .folder-review-row input { min-width: 0; padding: 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--ink); font-size: var(--type-caption); }
.item-review-control { display: grid; grid-template-columns: 1fr 150px 90px; gap: 8px; align-items: center; margin-top: 18px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.item-review-control label { font-size: var(--type-caption); font-weight: 800; }
.item-review-control select, .item-review-control input { min-width: 0; padding: 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); font-size: var(--type-caption); }
.adaptive-review-actions { display: grid; grid-template-columns: repeat(4,1fr); gap: 7px; margin-top: 18px; }
.adaptive-review-actions button { padding: 10px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); cursor: pointer; font-size: var(--type-caption); font-weight: 800; }
.adaptive-review-actions button:hover { border-color: var(--brand); background: var(--brand-soft); }
.adaptive-review-actions small { display: block; margin-top: 3px; color: var(--muted); font-size: var(--type-caption); font-weight: 500; }
.detail-modal { position: relative; width: min(760px, 92vw); }
.detail-close { position: absolute; top: 20px; right: 20px; }
.detail-type { color: var(--brand-text); font-size: var(--type-small); font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.detail-modal h2 { margin: 10px 45px 15px 0; font-size: 2.125rem; line-height: 1.06; }
.detail-url { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--brand-text); font-size: var(--type-small); }
.detail-block { margin-top: 23px; padding: 18px; border-radius: 11px; background: white; border: 1px solid var(--line); }
.detail-block.accent { background: #edf5f1; border-color: #d0e0d8; }
.detail-block label { display: block; margin-bottom: 8px; color: var(--muted); font-size: var(--type-caption); font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.detail-block p { margin: 0; white-space: pre-wrap; font-size: var(--type-body); line-height: 1.65; }
.detail-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.detail-actions { display: flex; gap: 8px; margin-top: 24px; }
.danger-button { margin-left: auto; border: 0; background: transparent; color: #aa655a; cursor: pointer; font-size: var(--type-small); font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 50; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 11px 16px; border-radius: 9px; background: #1e332a; color: white; box-shadow: var(--shadow); font-size: var(--type-small); transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

body.dark { --brand-text:#a2d0b6; --bg:#17201c; --panel:#202a25; --card:#26312c; --ink:#edf3ef; --muted:#9da9a2; --line:#35423c; --brand-soft:#304a3e; }
body.dark .topbar { background: rgba(32,42,37,.88); }
body.dark .search-box, body.dark .icon-button, body.dark .field input, body.dark .field select, body.dark .field textarea { background: #26312c; color: var(--ink); }
body.dark .type-pill, body.dark .modal-close { background:#35403b; }
body.dark .review-banner { background: linear-gradient(100deg,#263b32,#25302b); border-color:#385244; }
body.dark .important-field textarea { background:#263b32; }
body.dark .links-toolbar, body.dark .links-head { background:#202a25; }
body.dark .link-group-title { background:#26312c; }
body.dark .link-row:hover { background:#2a3731; }
body.dark .link-primary strong { color: var(--ink); }
body.dark .link-domain { border-color: #3e6955; background: #2b4438; color: #8fd0ae; }
body.dark .link-summary { background: #302f2a; color: #e2e7e3; }
body.dark .next-action { background: #302f2a; }

@media (max-width: 1180px) {
  .library-grid { grid-template-columns: repeat(2, minmax(270px, 1fr)); }
}

@media (max-width: 900px) {
  .sidebar { width: 205px; padding-inline: 13px; }
  .main { margin-left: 205px; }
  .topbar { padding-inline: 22px; }
  .content { padding: 34px 24px 60px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .faq-header { align-items: flex-start; flex-direction: column; }
  .faq-list { grid-template-columns: 1fr; }
  .heading-actions { align-self: stretch; }
  .heading-actions button { flex: 1; }
  .review-banner { grid-template-columns: auto 1fr; }
  .review-banner button { grid-column: 2; justify-self: start; padding: 0; }
  .filter-row { align-items: flex-start; gap: 12px; flex-direction: column; }
  .segmented { flex-wrap: wrap; }
  .library-grid { grid-template-columns: 1fr; }
  .personal-hub { grid-template-columns: 1fr; }
  .work-folder-grid { grid-template-columns:repeat(2,minmax(220px,1fr)); }
  .progress-overview, .progress-bottom { grid-template-columns: 1fr; }
  .dream-guide-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .diction-intro { grid-template-columns: 1fr; }
  .diction-lines { grid-template-columns: 1fr; }
  .diction-line:nth-child(odd) { border-right: 0; }
  .books-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .links-toolbar { grid-template-columns: 1fr; }
  .links-head { display: none; }
  .link-row { grid-template-columns: 1fr; gap: 8px; padding: 17px; }
  .link-summary { -webkit-line-clamp: 3; }
  .link-folder { padding-top: 8px; border-top: 1px dashed var(--line); }
  .reader-layout { grid-template-columns: 210px 1fr; }
  .reader-content { width: calc(100% - 42px); }
  .reader-book-name { display: none; }
  .book-detail { padding: 27px; }
  .book-detail-hero { grid-template-columns: 125px 1fr; gap: 20px; }
  .book-detail-intro h2 { font-size: 1.75rem; }
  .book-knowledge-grid { grid-template-columns: 1fr; }
  .book-memory-card.accent { grid-column: auto; }
}

@media (max-width: 650px) {
  .sidebar { width: 176px; }
  .main { margin-left: 176px; }
  .brand { padding-inline: 2px; }
  .brand span, .capture-button kbd, .sidebar-footer small { display: none; }
  .capture-button { padding-inline: 10px; }
  .topbar { padding-inline: 14px; }
  .avatar { display: none; }
  .content { padding-inline: 15px; }
  h1 { font-size: 1.9375rem; }
  .secondary-button { display: none; }
}

/* Shared space controls and compact views retain the existing visual language. */
.sidebar { overflow-y:auto; }
/* Keep folder navigation reachable: scroll the sidebar, not a collapsed nested list. */
.sidebar > * { flex-shrink: 0; }
.sidebar .collections { overflow: visible; }
.space-controls { display:grid; grid-template-columns:minmax(0,1fr) 32px 32px; gap:4px; margin-bottom:13px; }
.space-controls button,.library-tools button { background:rgba(255,255,255,.09); border:1px solid rgba(255,255,255,.18); border-radius:7px; color:inherit; min-height:34px; cursor:pointer; }
.library-tools { display:grid; grid-template-columns:1fr 1fr; gap:5px; margin:15px 0; }
.library-tools button { font-size:var(--type-control); }
.settings-dialog { width:min(440px,calc(100% - 28px)); border:1px solid var(--line); background:var(--panel); color:var(--ink); padding:24px; border-radius:15px; }
.settings-dialog::backdrop { background:#14201aaa; }
.settings-dialog form { display:grid; gap:14px; }
.settings-dialog h2 { margin:0; }
.settings-dialog label { display:grid; gap:5px; }
.settings-dialog .check-label { display:flex; align-items:center; }
.settings-dialog input:not([type=checkbox]),.settings-dialog select,#layoutSelect { min-width:0; padding:9px; border:1px solid var(--line); border-radius:8px; background:var(--card); color:var(--ink); }

.extra-result { display:flex; align-items:center; gap:12px; padding:14px; margin:8px 0; background:var(--card); border:1px solid var(--line); border-radius:10px; overflow-wrap:anywhere; }
.extra-result div,.result-open { flex:1; min-width:0; }
.result-open { border:0; background:none; text-align:left; cursor:pointer; }
.extra-result small { display:block; color:var(--muted); margin-top:5px; }
.library-grid[data-layout=list],.library-grid[data-layout=table] { grid-template-columns:minmax(0,1fr); gap:8px; }
.library-grid[data-layout=list] .knowledge-card,.library-grid[data-layout=table] .knowledge-card { min-height:0; padding:13px 16px; }
.library-grid[data-layout=list] .knowledge-card h3,.library-grid[data-layout=table] .knowledge-card h3 { font-size:var(--type-title-large); margin:6px 0; }
.library-grid[data-layout=table] .knowledge-card { display:grid; grid-template-columns:minmax(85px,1fr) minmax(140px,2fr) minmax(100px,2fr); align-items:center; gap:12px; }
.library-grid[data-layout=table] .card-footer { grid-column:1/-1; margin:0; }
.mobile-menu,.mobile-space,#mobileShade { display:none; }
@media(max-width:650px){
 .sidebar { width:min(300px,85vw); z-index:25; transform:translateX(-100%); transition:transform .18s ease; }
 body.menu-open .sidebar { transform:translateX(0); }
 body.menu-open #mobileShade { display:block; position:fixed; inset:0; background:#0008; z-index:24; }
 .main { margin-left:0; min-width:0; width:100%; }
 .mobile-menu { display:grid; flex-shrink:0; place-items:center; }
 .mobile-space { display:block; font-size:var(--type-control); max-width:76px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
 .topbar { gap:8px; padding:10px 12px; }
 .search-box { min-width:0; flex:1; width:auto; }
 .search-box input { min-width:0; width:100%; }
 .search-box kbd { display:none; }
 .work-folder-grid,.library-grid,.dream-guide-grid { grid-template-columns:minmax(0,1fr); }
 .library-grid[data-layout=table] .knowledge-card { display:block; }
 .content { padding:24px 14px 40px; }
 .modal-backdrop { padding:8px; }
 .modal { width:100%; max-height:94dvh; padding:18px; }
 .form-row,.book-detail-hero { grid-template-columns:minmax(0,1fr); }
 .detail-actions,.modal-actions,.book-detail-footer { flex-wrap:wrap; }
 .secondary-button { display:inline-flex; }
 .reader-layout { grid-template-columns:minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); }
 .reader-sidebar { max-height:24vh; padding:8px; }
 .reader-topbar { flex-wrap:wrap; height:auto; gap:5px; }
 .reader-content { width:calc(100% - 24px); overflow-wrap:anywhere; }
 .link-folder-tiles { grid-template-columns:repeat(auto-fit,minmax(110px,1fr)); }
 .knowledge-card,.work-folder-card { overflow-wrap:anywhere; }
 .nav-item,.space-controls button { min-height:44px; }
 .library-tools button { min-height:40px; }
 .card-why,.nav-item,.field label,.field input,.field textarea { font-size:var(--type-body); }
}
.saved-filters {display:flex;gap:7px;flex-wrap:wrap;margin:10px 0;}
.saved-filters span {display:flex;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:var(--card);}
.saved-filters button {border:0;background:transparent;padding:7px;cursor:pointer;}
.legacy-illustration {display:block;max-width:100%;height:auto;max-height:70vh;object-fit:contain;}
.detail-block pre {white-space:pre-wrap;overflow-wrap:anywhere;}
.table-scroll {overflow:auto;}
.block-table {border-collapse:collapse;width:100%;}
.block-table td {border:1px solid var(--line);padding:8px;}
.add-field-menu {max-height:260px;overflow:auto;}
@media(max-width:900px){.review-banner{grid-template-columns:38px minmax(0,1fr);}.review-banner-actions{grid-column:1/-1;flex-wrap:wrap;}.review-banner button{grid-column:auto;}}
.material-table-wrap {min-width:0;overflow:auto;background:var(--card);border:1px solid var(--line);border-radius:12px;}
.material-table {width:100%;border-collapse:collapse;font-size:var(--type-body);text-align:left;}
.material-table th,.material-table td {padding:12px 10px;border-bottom:1px solid var(--line);overflow-wrap:anywhere;}
.material-table th {color:var(--muted);font-size:var(--type-small);}
.material-table tbody tr {cursor:pointer;}
.material-table tbody tr:hover {background:var(--brand-soft);}
@media(max-width:650px){.material-table thead{display:none;}.material-table,.material-table tbody,.material-table tr,.material-table td{display:block;}.material-table tr{padding:10px;border-bottom:1px solid var(--line);}.material-table td{padding:3px 6px;border:0;}.material-table td:first-child{font-weight:700;}.material-table td:not(:first-child){font-size:var(--type-control);color:var(--muted);}}

/* Folder mutations belong to the library navigation, never the bookmark filters. */
.folder-nav-row { display:flex; align-items:center; gap:3px; min-width:0; }
.folder-nav-row .nav-item { flex:1; min-width:0; grid-template-columns:24px minmax(0,1fr) auto; }
.folder-nav-row .nav-item span { overflow-wrap:anywhere; }
.folder-nav-delete { flex:0 0 28px; height:32px; border:0; border-radius:6px; background:transparent; color:#b6c8c0; font-size:var(--type-title-large); cursor:pointer; }
.folder-nav-delete:hover,.folder-nav-delete:focus-visible { background:#ffffff22; color:#fff; }
.folder-danger { color:#a4554b; border-color:#dfc5c0; }
.heading-actions,.link-toolbar-actions { flex-wrap:wrap; }
.link-open-button { border:1px solid var(--line); border-radius:7px; color: var(--brand-text); background:var(--card); cursor:pointer; min-height:30px; }
.link-folder,.link-summary { overflow-wrap:anywhere; min-width:0; }
.link-folder small { display:block; }
.bookmark-origin { color:var(--muted); font-size:var(--type-control); overflow-wrap:anywhere; }
@media(max-width:650px){ .links-toolbar-title { flex-direction:column; align-items:stretch; } .folder-nav-delete { min-height:44px; flex-basis:40px; } .link-toolbar-actions { justify-content:flex-start; } }

/* Keep the guide readable while using the existing library theme. */
.faq-intro { padding: 20px; margin-bottom: 20px; border: 1px solid var(--line); background: var(--card); border-radius: 12px; }
.faq-intro h3 { margin: 0 0 10px; font-size: var(--type-heading-large); }
.faq-intro p { margin: 8px 0 0; font-size: var(--type-body); line-height: 1.65; color: var(--muted); }
.faq-search input { font-size: var(--type-body); }
@media (max-width:650px) { .faq-list details > div { padding: 0 16px 16px; } .faq-intro { padding: 16px; } }

/* Compact library shell. Reader text keeps its original book typography. */
body { font-family: "Segoe UI", system-ui, -apple-system, sans-serif; font-size: var(--type-body); }
h1,h2,.knowledge-card h3,.link-primary strong,.link-group-title strong,.book-card h3,.detail-modal h2,.progress-metric strong { font-family: inherit; }
h1 { font-size: clamp(1.5rem, calc(1.2rem + 1vw), 2rem); line-height: 1.25; letter-spacing: -.5px; font-weight: 650; }
.sidebar { width:235px; padding:16px 12px; color:#e7f0eb; scrollbar-width:thin; background:var(--space-color,#183a2d); }
.main { margin-left:235px; min-width:0; }
.brand { padding:0 2px 16px; gap:9px; }
.brand-mark { width:32px; height:32px; }
.brand strong { font-size:var(--type-title-small); }
.brand span { font-size:var(--type-small); letter-spacing:.4px; }
.space-controls { margin-bottom:10px; }
.capture-button { display:flex; justify-content:center; min-height:40px; padding:8px; border:0;border-radius:8px;background:var(--capture-bg,#e7c997);color:#173a2d;box-shadow:none; }
.capture-button:hover { background:var(--capture-hover,#f0d7ae); }
.capture-icon { width:auto;height:auto;font-size:var(--type-title-large);background:transparent; }
.capture-copy strong { font-size:var(--type-body);font-weight:650; }
.capture-copy small,.capture-button kbd { display:none; }
.nav-section { gap:3px;margin-top:8px; }
.nav-item { min-height:38px; padding:8px; font-size:var(--type-body); font-weight:500; grid-template-columns:20px minmax(0,1fr) auto; gap:5px; border-radius:7px; color:#e2ede6; }
.nav-item b { font-size:var(--type-small); font-weight:500; }
.nav-icon { display:flex; align-items:center;color:#abc6b8; }
.ui-icon { width:18px;height:18px;flex-shrink:0;vertical-align:middle; }
.nav-label { margin-top:14px; border-top:1px solid #ffffff26; padding:14px 6px 4px; color:#a5c1b2; letter-spacing:.5px;font-weight:500;font-size:var(--type-small); }
.nav-label button { font-size:var(--type-19); min-width:30px; min-height:30px; }
.folder-nav-row .nav-item { grid-template-columns:20px minmax(0,1fr) auto; }
.folder-nav-row .nav-icon { color:#e0c393; }
.work-folder-navigation { gap:2px; }
.sidebar-bottom { margin-top:auto; padding-top:14px; border-top:1px solid #ffffff26; }
.sidebar-bottom .nav-item { grid-template-columns:20px minmax(0,1fr); }
.topbar { height:60px; padding:0 28px;background:var(--panel);backdrop-filter:none; }
.search-box { width:min(600px,75%);background:var(--card);height:40px; }
.content { max-width:1100px; padding:28px 30px 60px; }
.eyebrow { font-size:var(--type-small); font-weight:550; letter-spacing:.5px; }
.page-heading { gap:16px; margin-bottom:14px; }
.page-heading p:last-child:empty { display:none; }
.home-dashboard { display:grid; gap:12px; }
.dashboard-grid { display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:10px; }
.dashboard-tile { position:relative;display:grid; justify-items:start;gap:7px; padding:16px;text-align:left; border:1px solid var(--line);border-radius:11px;background:var(--card);color:var(--ink); min-width:0; }
button.dashboard-tile { cursor:pointer; }
.dashboard-tile .ui-icon { color: var(--brand-text); width:21px;height:21px; }
.dashboard-tile strong { font-size:var(--type-title-small);font-weight:600; }
.dashboard-tile small { font-size:var(--type-control);color:var(--muted); }
.dashboard-count { position:absolute;right:14px;top:15px;font-size:var(--type-control);color:var(--muted); }
.dashboard-heading { display:flex;justify-content:space-between;align-items:center;margin-top:9px;gap:8px; }
.dashboard-heading h2 { font-size:var(--type-title-large);margin:0;font-weight:600;color:var(--ink); }
.dashboard-heading .secondary-button { min-height:32px; }
.dashboard-folders { display:grid;gap:8px; }
.dashboard-folder { display:flex;gap:10px;align-items:center;padding:12px 14px;border:1px solid var(--line);border-radius:9px;background:var(--card);text-align:left;color:var(--ink);cursor:pointer;min-height:48px;min-width:0; }
.dashboard-folder strong { flex:1;font-size:var(--type-body);font-weight:550;overflow-wrap:anywhere;min-width:0; }
.dashboard-folder .ui-icon { color:var(--ochre); }
.dashboard-folder small,.dashboard-folder>span { color:var(--muted); }
.dashboard-folder>span { font-size:var(--type-heading);color: var(--brand-text); }
.dashboard-tile:hover,.dashboard-folder:hover { border-color:var(--brand); }
.dashboard-empty { margin:0;padding:16px;border:1px solid var(--line);border-radius:9px;background:var(--card);color:var(--muted);font-size:var(--type-body); }
.dashboard-tile .metric-value { font-size:1.75rem; }
.settings-actions { display:grid;gap:8px;margin:16px 0; }
.settings-actions button { text-align:left;justify-content:flex-start; }
.settings-storage { color:var(--muted);font-size:var(--type-control);margin:12px 0; }
#materialKind { padding:9px;border:1px solid var(--line);border-radius:8px;background:var(--card);color:var(--ink);min-width:0; }
.knowledge-card { min-height:150px;padding:17px;gap:8px; }
.knowledge-card h3 { font-size:var(--type-title-large);line-height:1.35;margin:5px 0; }
.card-why { font-size:var(--type-body);line-height:1.5;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden; }
.card-footer { font-size:var(--type-small); }
.link-primary strong { font-size:var(--type-title-small); }
.link-summary,.link-folder,.link-tags { font-size:var(--type-control); }
@media (max-width:900px) { .content { padding:22px 18px 45px; } .dashboard-grid { grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); } .topbar {padding-inline:18px;} }
@media (max-width:650px) { .sidebar {width:min(300px,85vw);padding:16px 12px;} .main {margin-left:0;} .nav-item {min-height:44px;} .topbar {padding:8px 12px;} .content {padding:20px 14px 36px;} .dashboard-grid {grid-template-columns:repeat(2,minmax(0,1fr));} .dashboard-tile {padding:13px;min-height:100px;} .dashboard-heading h2 {font-size:var(--type-title-small);} .dashboard-folder{min-height:48px;} .page-heading {align-items:flex-start;flex-wrap:wrap;} .heading-actions {flex-wrap:wrap;} .filter-row{flex-wrap:wrap;} .settings-dialog{max-height:90dvh;overflow:auto;} }
.dashboard-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.dashboard-actions { display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end; }
.dashboard-actions .text-button { color: var(--brand-text); }
.item-extra-properties { padding:12px;border:1px solid var(--line);border-radius:8px;margin:12px 0; }
.item-extra-properties summary { cursor:pointer;font-size:var(--type-body);font-weight:550; }
.item-extra-properties[open] summary { margin-bottom:12px; }
#favoriteBooks { margin-top:20px; }
#favoriteBooks h2 { font-size:var(--type-title-large);font-weight:600; }
.reader-find-panel { display:flex;gap:8px;align-items:center;padding:8px 14px;background:var(--panel);color:var(--ink);flex-wrap:wrap; }
.reader-find-panel input { flex:1;min-width:120px;padding:8px;border:1px solid var(--line);border-radius:6px;color:var(--ink);background:var(--card); }
.reader-find-panel button { border:1px solid var(--line);border-radius:6px;background:var(--card);color:var(--ink);min-height:34px;min-width:34px;cursor:pointer; }
.reader-match { background:#eadb8a;color:#202622; }
.reader-match.current { background:#e9a953;outline:2px solid #c38330; }
.note-actions { display:flex;gap:4px;flex-wrap:wrap; }
.note-actions .text-button { min-height:30px;font-size:var(--type-small);padding:0 6px; }
@media (max-width:650px){.dashboard-actions{gap:4px;}.dashboard-actions .text-button,.dashboard-actions .secondary-button{padding:0 7px;font-size:var(--type-small);}.reader-find-panel{padding:6px;}.reader-tools button{min-height:36px;} }
@media (max-width:650px){.sidebar{visibility:hidden;transition:transform .18s ease,visibility .18s;}body.menu-open .sidebar{visibility:visible;}.main{width:100%;}}
@media (hover:hover) and (pointer:fine){.folder-nav-delete{opacity:0;}.folder-nav-row:hover .folder-nav-delete,.folder-nav-row:focus-within .folder-nav-delete{opacity:1;}}

/* Module visibility applies to controls as well as navigation. */
body.hide-favorites .favorite-button { display:none !important; }
.overview-entry { min-width:0; }
.overview-entry .dashboard-folder { width:100%; }
#progressHub > .secondary-button { margin-top:12px; }
#progressHub .dashboard-folder small { white-space:normal; }

/* Keep backup controls together without introducing inactive server actions. */
.settings-data { border-top:1px solid var(--line); padding-top:14px; margin:0 0 16px; }
.settings-data h3 { font-size:var(--type-title-small); margin:0 0 8px; }
.settings-data-note { color:var(--muted); font-size:var(--type-control); line-height:1.55; margin:8px 0; overflow-wrap:anywhere; }
.settings-data .settings-actions { margin:10px 0; }
#appSettings { max-height:90vh; max-height:90dvh; overflow:auto; }

.settings-actions > a.secondary-button { display:flex; text-decoration:none; align-items:center; justify-content:flex-start; }

/* Space hue identifies a library; the global theme controls its brightness. */
body.dark .sidebar { background:color-mix(in srgb,var(--space-color,#183a2d) 55%,#111714); --capture-bg:#d9ba84; --capture-hover:#e7c997; }
.sidebar .nav-item b,.sidebar .brand span,.sidebar .nav-label { color:#b9ccc2; }
.brand-mark { background:transparent; border:0; box-shadow:none; }
.space-controls { grid-template-columns:minmax(0,1fr) 34px 34px; gap:5px; }
.space-picker { position:relative; min-width:0; z-index:2; }
.space-controls > button, #spaceSelect { display:flex; align-items:center; justify-content:center; height:36px; padding:0; }
.space-controls > button .ui-icon { width:17px; height:17px; }
#spaceSelect { width:100%; position:relative; padding:0 28px; text-align:center; font-size:var(--type-body); font-weight:550; }
#spaceSelectedName { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.space-chevron { position:absolute; right:8px; display:flex; align-items:center; }
.space-chevron .ui-icon { width:16px; height:16px; }
#spaceSelect[aria-expanded=true] .space-chevron { transform:rotate(180deg); }
.space-controls > button:hover,#spaceSelect:hover,#spaceSelect[aria-expanded=true] { background:#ffffff20; }
.space-controls button:focus-visible { outline:2px solid #e7c997; outline-offset:2px; }
.space-options { position:absolute; top:calc(100% + 6px); left:0; min-width:100%; width:calc(100% + 78px); max-height: min(280px,45vh); overflow:auto; padding:5px; border:1px solid var(--line); border-radius:10px; background:var(--card); color:var(--ink); box-shadow:0 8px 24px #0003; }
.space-options button { width:100%; display:grid; grid-template-columns:12px minmax(0,1fr) 16px; align-items:center; gap:8px; min-height:38px; padding:8px; border:0; background:transparent; text-align:left; font-size:var(--type-body); }
.space-options button:hover,.space-options button[aria-current=true] { background:var(--brand-soft); }
.space-options button:focus-visible { outline:2px solid var(--ochre); outline-offset:-2px; }
.space-dot { width:10px; height:10px; border-radius:50%; background:var(--space-dot); border:1px solid #a6b2a7; }
.space-option-name { overflow-wrap:anywhere; min-width:0; }
.space-options button .ui-icon { width:15px; height:15px; }
.space-appearance { margin:0; padding:0; border:0; min-width:0; }
.space-appearance legend { margin-bottom:9px; padding:0; }
.space-palette { display:flex; flex-wrap:wrap; gap:10px; }
.space-palette button { display:grid; place-items:center; width:34px; height:34px; border:2px solid var(--card); outline:1px solid var(--line); border-radius:50%; background:var(--swatch); color:#fff; cursor:pointer; padding:0; }
.space-palette button .ui-icon { visibility:hidden; }
.space-palette button[aria-pressed=true] { outline:2px solid var(--ochre); }
.space-palette button[aria-pressed=true] .ui-icon { visibility:visible; }
.space-palette button:focus-visible { outline:3px solid var(--ochre); outline-offset:2px; }
.settings-dialog .space-custom-color { display:flex; align-items:center; gap:9px; margin-top:10px; color:var(--muted); font-size:var(--type-body); }
.settings-dialog #spaceColor { width:34px; height:32px; padding:3px; cursor:pointer; }
.settings-dialog #spaceColor::-webkit-color-swatch-wrapper { padding:0; }
.settings-dialog #spaceColor::-webkit-color-swatch { border:0; border-radius:4px; }
#spaceDialog .check-label { min-height:25px; }
#spaceDialog input[type=checkbox] { accent-color:#2f7055; width:16px; height:16px; }
#spaceDialog input:focus-visible { outline:2px solid var(--ochre); outline-offset:2px; }
.overview-interval { margin:0; color:var(--muted); font-size:var(--type-body); }
@media (max-width:650px) { .space-controls { grid-template-columns:minmax(0,1fr) 44px 44px; } .space-controls > button,#spaceSelect { height:44px; } .space-options { width:calc(100% + 98px); } .space-options button { min-height:44px; } }

/* Book library and reading tools */
.book-toolbar{flex-wrap:wrap;gap:12px;align-items:center}
.book-toolbar input,.book-toolbar select{min-width:0;max-width:100%;height:36px;border:1px solid var(--line);border-radius:8px;padding:0 10px;background:var(--card);color:var(--ink);font:inherit}
.book-toolbar input{width:190px}
.book-card-status{display:block;color:var(--muted);font-size:var(--type-small);margin-top:6px}
.book-resume{margin-top:7px;min-height:32px!important;width:100%;font-size:var(--type-small)!important}
.books-grid.book-list-layout{grid-template-columns:1fr;gap:10px}
.book-list-layout .book-card{display:flex;align-items:center;gap:16px;border:1px solid var(--line);border-radius:12px;background:var(--card);padding:12px}
.book-list-layout .book-cover{width:64px;flex-shrink:0;box-shadow:none}.book-list-layout .book-card-copy{flex:1;min-width:0}.book-list-layout .book-card h3{margin-top:0}.book-list-layout .book-resume{width:auto}
.book-detail-tabs{margin:24px 0 12px;flex-wrap:wrap;gap:6px}.book-detail-tabs button{font-size:var(--type-body)!important}
.book-detail .book-knowledge-grid{margin-top:12px}.book-detail .book-notes-preview{max-height:none;overflow:visible;margin-top:12px}.book-detail .book-memory-card textarea{min-height:75px}
.book-detail .reader-note q,.reader-note q{font-size:var(--type-body);line-height:1.55;overflow-wrap:anywhere}.reader-note p{font-size:var(--type-body);line-height:1.5;color:inherit;overflow-wrap:anywhere}.reader-note-location{font-size:var(--type-small)}.reader-note{border-left-color:var(--note-color,#c39450);overflow-wrap:anywhere}.reader-note .note-actions{flex-wrap:wrap}.reader-note .note-actions button{font-size:var(--type-small)}
.reader-shell{--reading-bg:#eeece6;--reading-panel:#f7f5f0;--reading-ink:#263029;--reading-border:#d8d4ca;--reading-accent:#286b53;background:var(--reading-bg);color:var(--reading-ink)}
.reader-shell.reader-light{--reading-bg:#fff;--reading-panel:#fafafa;--reading-ink:#252c29;--reading-border:#dedede}
.reader-shell.night{--reading-bg:#181e26;--reading-panel:#232b35;--reading-ink:#e7e9ed;--reading-border:#3b4654;--reading-accent:#a3d3b9;background:var(--reading-bg);color:var(--reading-ink)}
.reader-shell .reader-page{background:var(--reading-bg);scroll-behavior:auto}.reader-shell .reader-content{color:var(--reading-ink);width:min(var(--reader-width,760px),calc(100% - 64px));padding:36px 0 90px}
.reader-shell .reader-topbar,.reader-shell .reader-sidebar,.reader-bottom{background:var(--reading-panel);border-color:var(--reading-border);color:var(--reading-ink)}
.reader-shell .reader-back,.reader-shell .reader-tabs button.active,.reader-shell .toc-link:hover{color:var(--reading-accent)}
.reader-shell .reader-tabs button,.reader-shell .toc-link,.reader-shell .reader-progress-label,.reader-shell .reader-book-name span{color:var(--reading-ink);font-size:var(--type-control)}
.reader-shell .reader-tabs button.active{border-color:var(--reading-accent)}.reader-shell .reader-tools>button{display:grid;place-items:center;min-width:40px;height:40px;background:var(--reading-panel);color:var(--reading-ink);border-color:var(--reading-border);font-size:var(--type-title-large)}
.reader-shell .reader-tools>button.hidden{display:none!important}.reader-layout{grid-template-columns:290px minmax(0,1fr)}.reader-shell.sidebar-closed .reader-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}.reader-shell.sidebar-closed .reader-sidebar{display:none}.reader-sidebar{padding:16px}
.reader-bottom{display:flex;justify-content:space-between;align-items:center;min-height:32px;padding:6px 24px;border-top:1px solid var(--reading-border);font-size:var(--type-control);gap:10px}.reader-bottom span:first-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.book-highlight{background:var(--note-color);color:#242b27;border-radius:2px;cursor:pointer}.reader-shell.night .book-highlight{color:#18221f}.book-highlight .reader-match{color:#202622}
.reader-selection-menu{position:fixed;z-index:110;max-width:calc(100vw - 16px);width:max-content;padding:10px;border:1px solid var(--reading-border);border-radius:12px;background:var(--reading-panel);color:var(--reading-ink);box-shadow:0 6px 22px #0003}
.reader-colors,.reader-selection-actions{display:flex;gap:8px;align-items:center;justify-content:center}.reader-colors{padding:2px 0 9px;border-bottom:1px solid var(--reading-border)}.reader-colors button{display:grid;justify-items:center;gap:4px;padding:3px 1px;border:0;background:transparent;color:inherit;font-size:var(--type-small);cursor:pointer}.reader-colors button span{width:26px;height:26px;border-radius:50%;border:1px solid #0002;background:var(--note-color)}.reader-selection-actions{padding-top:7px}.reader-selection-actions button{border:0;background:transparent;color:inherit;cursor:pointer;padding:7px;font-size:var(--type-control)}
#readerNoteQuote{margin:0 0 14px;padding:10px;border-left:3px solid #c39450;background:var(--brand-soft);max-height:120px;overflow:auto;overflow-wrap:anywhere}#readerNoteComment{width:100%;resize:vertical;color:var(--ink);background:var(--card);border:1px solid var(--line);border-radius:8px;padding:10px}
.book-bookmark-row{display:flex;align-items:center;justify-content:space-between;gap:8px;border-bottom:1px solid var(--line);padding:8px 0}.book-bookmark-row button:first-child{text-align:left;overflow-wrap:anywhere;white-space:normal}.reader-shell.night .book-bookmark-row button,.reader-shell.night .reader-note button{color:var(--reading-accent)}
@media(max-width:650px){.reader-shell .reader-content{width:calc(100% - 32px);padding:24px 0 60px}.reader-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,38vh) minmax(0,1fr)}.reader-sidebar{max-height:none}.reader-topbar{min-height:52px;flex:0 0 auto;padding:6px 10px;gap:8px}.reader-tools{gap:4px}.reader-shell .reader-tools>button{min-width:36px;height:36px}.reader-back{padding:6px 0;white-space:nowrap}.reader-bottom{padding:5px 12px}.book-toolbar input{width:100%}.book-detail-tabs button{padding:7px!important;font-size:var(--type-control)!important}.book-detail .book-knowledge-grid{grid-template-columns:1fr}.book-detail-hero .book-detail-cover{max-width:105px}.book-detail .book-detail-intro h2{font-size:1.5rem}.book-detail .book-detail-hero{grid-template-columns:100px minmax(0,1fr);gap:12px}}
.book-card-title{display:flex;align-items:flex-start;justify-content:space-between;gap:4px}.book-card-title h3{overflow-wrap:anywhere;flex:1}.book-card-menu{position:relative;margin-top:8px;flex-shrink:0}.book-card-menu summary{list-style:none;padding:3px 7px;border-radius:6px;color:var(--ink);font-weight:bold;cursor:pointer}.book-card-menu summary::-webkit-details-marker{display:none}.book-card-menu[open]{z-index:5}.book-card-menu>div,.book-select-list{position:absolute;top:calc(100% + 4px);right:0;min-width:150px;max-width:min(240px,85vw);background:var(--card);border:1px solid var(--line);border-radius:8px;padding:4px;box-shadow:0 6px 16px #0002;z-index:10}.book-card-menu button,.book-select-list button{display:block;width:100%;padding:8px;border:0;border-radius:5px;background:transparent;color:var(--ink);text-align:left;font-size:var(--type-body);cursor:pointer;overflow-wrap:anywhere}.book-card-menu button:hover,.book-select-list button:hover,.book-select-list button:focus-visible,.book-select-list button[aria-selected=true]{background:var(--brand-soft);color:var(--ink)}.book-select{position:relative;min-width:0;max-width:100%;text-transform:none}.book-select>select[hidden]{display:none!important}.book-select-trigger{height:36px;border:1px solid var(--line);border-radius:8px;background:var(--card);color:var(--ink);padding:0 28px 0 10px;position:relative;max-width:100%;font-size:var(--type-control);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;cursor:pointer}.book-select-trigger:after{content:"";position:absolute;right:11px;top:13px;width:7px;height:7px;transform:rotate(45deg);border-right:1.6px solid currentColor;border-bottom:1.6px solid currentColor}.book-select-list{min-width:100%;width:max-content;max-height:240px;overflow:auto}.book-select-trigger[aria-expanded=true]{border-color:var(--brand)}.book-view-tabs{flex-wrap:wrap}.book-detail .book-select{max-width:100%}.book-toolbar .book-select-list{right:auto;left:0}

.reader-shell.night .reader-topbar,.reader-shell.night .reader-sidebar,.reader-shell.night .reader-page,.reader-shell.night .reader-content{color:var(--reading-ink)}
#readerAppearanceDialog[data-reading-theme=night],#readerNoteDialog[data-reading-theme=night]{--bg:#181e26;--panel:#232b35;--card:#2a3440;--ink:#e7e9ed;--muted:#aab8c5;--line:#45505b;--brand-soft:#2a3d38;background:var(--panel);color:var(--ink)}
#readerAppearanceDialog[data-reading-theme=light],#readerNoteDialog[data-reading-theme=light],#readerAppearanceDialog[data-reading-theme=paper],#readerNoteDialog[data-reading-theme=paper]{--panel:#f7f5f0;--card:#fff;--ink:#263029;--line:#dedbd3;--muted:#6d766f;--brand-soft:#e4efe8;background:var(--panel);color:var(--ink)}

#readerNoteDialog .book-select-trigger{width:100%;text-align:left;height:40px}#readerNoteDialog{max-height:90dvh;overflow:auto;padding:20px}#readerNoteDialog form{gap:10px}#readerNoteDialog #readerNoteComment{min-height:64px}#readerNoteDialog .book-select-list{position:static;width:100%;max-width:100%;max-height:min(350px,38dvh);margin-top:5px;box-shadow:none} .book-select-list .book-tag-option{display:flex;align-items:center;gap:10px;min-height:44px}.book-tag-icon{width:29px;height:29px;display:grid;place-items:center;flex:none;border-radius:7px;color:#24312a}.book-tag-option small{display:block;color:var(--muted);font-size:var(--type-small);margin-top:3px}.reader-shell.night .reader-page{background:var(--reading-bg)}.reader-shell.night .reader-topbar,.reader-shell.night .reader-sidebar{background:var(--reading-panel);border-color:var(--reading-border)}.reader-shell.night .reader-note{background:var(--reading-panel);color:var(--reading-ink);border-left-color:var(--note-color,#c39450)}.reader-shell.night .reader-note-location{color:var(--reading-accent)}.reader-shell.night .reader-content blockquote{color:var(--reading-ink)}

/* Shelf controls and annotation metadata share the library's theme tokens. */
.book-shelves-panel{flex:1 0 100%;min-width:0}.book-shelves-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(150px,100%),1fr));gap:8px}.book-shelf-card{display:flex;align-items:center;gap:8px;min-width:0;padding:12px 10px;border:1px solid var(--line);border-radius:9px;background:var(--card);color:var(--ink);text-align:left;cursor:pointer;font:inherit;font-size:var(--type-control)}.book-shelf-card span{flex:1;min-width:0;overflow-wrap:anywhere}.book-shelf-card b{font-size:var(--type-small);color:var(--muted);flex:none}.book-shelf-card .ui-icon{width:17px;height:17px;color: var(--brand-text);flex:none}.book-shelf-card[aria-pressed=true]{border-color:var(--brand);background:var(--brand-soft);font-weight:700}.book-shelf-card:hover{border-color:var(--brand)}.book-shelf-manage{white-space:nowrap}.book-shelf-form-row{display:flex;gap:8px;flex-wrap:wrap;align-items:center}.book-shelf-form-row input{flex:1;min-width:100px}.book-shelf-manage-list{display:grid;gap:8px;margin:12px 0;max-height:40dvh;overflow:auto}.book-shelf-manage-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:9px;border:1px solid var(--line);border-radius:8px}.book-shelf-manage-name{display:flex;align-items:center;gap:8px;flex:1;min-width:0}.book-shelf-manage-name strong{font-size:var(--type-body);overflow-wrap:anywhere}.book-shelf-manage-name .ui-icon{width:18px;height:18px;color: var(--brand-text);flex:none}.book-shelf-manage-name small{color:var(--muted)}.book-shelf-actions{display:flex;gap:4px;align-items:center;flex-wrap:wrap}.book-shelf-actions button{background:var(--card);color:var(--ink);border:1px solid var(--line);border-radius:6px;min-width:28px;min-height:32px;padding:4px 7px;cursor:pointer;font-size:var(--type-control)}.book-shelf-actions button:disabled{opacity:.35;cursor:default}.book-shelf-actions .book-shelf-delete{color:#b76560;display:grid;place-items:center}.book-shelf-delete .ui-icon{width:16px;height:16px}.book-shelf-error{font-size:var(--type-control);color:#b76560}.book-card-note-count{display:flex;align-items:center;gap:5px;margin-top:8px;color:var(--muted);font-size:var(--type-control);line-height:1.3}.book-card-note-count .ui-icon{width:14px;height:14px;flex:none}.book-tab-count{display:inline-block;padding:1px 5px;border-radius:6px;background:var(--brand-soft);color:var(--ink);font-size:var(--type-small);font-weight:600;line-height:1.4;margin-left:2px}.reader-note-location{align-items:center;min-width:0}.reader-note-location .reader-note-heading{display:flex;align-items:center;gap:6px;min-width:0;white-space:normal;overflow:visible}.reader-note-heading>span:last-child{white-space:normal;overflow-wrap:anywhere}.reader-note-heading .book-tag-icon{width:24px;height:24px;flex:none}.reader-note-heading .book-tag-icon svg{width:15px;height:15px}.reader-colors button .book-tag-icon{display:grid;place-items:center;width:28px;height:28px;border-radius:7px}.reader-shell.night .book-tab-count{background:var(--reading-border);color:var(--reading-ink)}.reader-note q,.book-detail .reader-note q{font-weight:400}
@media(max-width:650px){.book-shelf-actions button{min-height:38px;min-width:36px}.book-shelves-cards{grid-template-columns:repeat(auto-fill,minmax(min(125px,100%),1fr))}.book-shelf-manage-row{align-items:flex-start}.book-shelf-manage-name{flex-basis:100%}.book-shelf-actions{justify-content:flex-end;width:100%}}

.book-shelf-controls{border:0;margin:0;padding:0;min-width:0}.book-shelf-controls:disabled{opacity:.75}

/* Shared typography: scale text, not the whole layout or book content. */
:root[data-ui-scale="compact"] { font-size: 93.75%; }
:root[data-ui-scale="large"] { font-size: 112.5%; }
body { line-height: 1.5; }
button, input, select, textarea { line-height: 1.35; }
.brand, .nav-item { line-height: 1.35; }
.nav-item { font-size: var(--type-control); }
.nav-item b, .nav-label { font-size: var(--type-small); }
.nav-item span, .brand > div { min-width: 0; overflow-wrap: anywhere; }
.primary-button, .secondary-button, .text-button { font-weight: 600; }
.book-view-tabs button, .segmented button { font-size: var(--type-control); font-weight: 600; }
.dashboard-heading h2, #favoriteBooks h2 { font-size: var(--type-heading); }
.book-card h3 { font-size: var(--type-title); font-weight: 650; line-height: 1.3; }
.book-card p { font-size: var(--type-small); white-space: normal; overflow-wrap: anywhere; }
.book-card-status, .book-card-note-count, .book-shelf-name { font-size: var(--type-small); }
.book-resume { font-size: var(--type-control) !important; min-height: 38px !important; }
.book-select-trigger, .book-toolbar input { min-height: 2.5rem; }
.book-toolbar input { width: min(230px, 100%); }
.book-toolbar > *, .book-view-tabs { min-width: 0; max-width: 100%; }
.book-view-tabs button { white-space: normal; }
.book-card-note-count { overflow-wrap: anywhere; }
.book-cover-placeholder { overflow-wrap: anywhere; }
.reader-tabs { flex-wrap: wrap; }
.reader-shell .reader-tabs button { font-size: var(--type-small); font-weight: 600; }
.reader-note-location, .reader-note-location b { color: var(--reading-accent, var(--brand-text)); }
.reader-colors, .reader-selection-actions { flex-wrap: wrap; }
.reader-colors { column-gap: 6px; }
.reader-colors button { font-size: var(--type-caption); }
.reader-note q { font-weight: 400; }
.settings-appearance { border: 0; padding: 0; margin: 12px 0 16px; min-width: 0; }
.settings-appearance legend { font-weight: 600; font-size: var(--type-title-small); padding: 0; margin: 0 0 8px; }
.settings-scale-options { display: flex; flex-wrap: wrap; gap: 6px; }
.settings-scale-options label { position: relative; flex: 1 1 auto; min-width: 0; display: block; cursor: pointer; }
.settings-scale-options input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; }
.settings-scale-options span { display: block; text-align: center; padding: 9px 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-size: var(--type-control); overflow-wrap: anywhere; }
.settings-scale-options input:checked + span { background: var(--brand-soft); border-color: var(--brand); font-weight: 600; }
.settings-scale-options input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.settings-dialog { max-height: 90dvh; overflow: auto; }
.settings-actions > * { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 650px) {
  .book-toolbar { gap: 9px; }
  .book-toolbar input { flex: 1 1 180px; }
  .book-card h3 { font-size: var(--type-title-small); }
  .book-card-menu summary { padding-inline: 5px; }
  .book-detail-intro h2, .detail-modal h2 { overflow-wrap: anywhere; }
  .reader-tools { flex-shrink: 0; }
  .settings-appearance { margin-bottom: 12px; }
}

/* Keep auxiliary labels readable on the actual surface in either theme. */
.settings-actions > .secondary-button { display: flex; align-items: center; color: var(--ink); padding-block: 8px; }
.book-shelf-card { min-height: 48px; }
.book-shelf-card span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-detail .reader-note { background: var(--card); color: var(--ink); border-color: var(--line); border-left-color: var(--note-color,#c39450); }
.reader-shell .reader-note { color: var(--reading-ink); }
.reader-shell .reader-note .text-button { color: var(--reading-accent); }
.reader-shell:not(.night) { --brand-text: #286b53; }

/* Visual pages share one text flow so quotes and saved locations stay stable. */
#readerPagingHint{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.reader-viewport:focus-visible{outline:2px solid var(--reading-accent);outline-offset:5px}
.reader-paged .reader-page{overflow:hidden;padding:28px clamp(20px,4vw,60px);min-height:0;display:flex}
.reader-paged .reader-viewport{height:100%;width:100%;min-width:0;margin:0 auto;overflow:hidden;touch-action:pan-y pinch-zoom}
.reader-shell.reader-paged .reader-content{width:100%;min-height:0;height:100%;max-width:none;margin:0;padding:0;column-count:var(--reader-columns,1);column-gap:var(--reader-gap,48px);column-fill:auto;overflow:visible;overflow-wrap:anywhere;orphans:2;widows:2}
.reader-paged .reader-content h1,.reader-paged .reader-content h2,.reader-paged .reader-content h3{break-after:avoid;overflow-wrap:anywhere}
.reader-paged .reader-content img{max-height:calc(var(--reader-page-height) - 2em);break-inside:avoid;margin:1em auto}
.reader-paged .reader-content table{max-width:100%;table-layout:fixed;overflow-wrap:anywhere}
.reader-paged .reader-bottom{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:2px 16px;padding:10px clamp(20px,4vw,60px) 12px;flex:0 0 auto}
.reader-page-info{display:flex;justify-content:space-between;align-items:center;gap:12px;min-width:0;grid-column:1 / -1;font-size:var(--type-small)}
.reader-page-info #readerChapterLabel{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.reader-page-info #readerPageLabel{flex:none;font-variant-numeric:tabular-nums;color:var(--reading-ink)}
.reader-page-navigation{display:flex;align-items:center;gap:12px;min-width:0}
.reader-page-navigation button{border:1px solid var(--reading-border);border-radius:50%;background:transparent;color:var(--reading-ink);min-width:40px;height:40px;cursor:pointer;font:inherit;font-size:20px}
.reader-page-navigation button:disabled{opacity:.35;cursor:default}
.reader-page-navigation button:focus-visible,.reader-page-navigation input:focus-visible{outline:2px solid var(--reading-accent);outline-offset:3px}
#readerSeek{width:100%;min-width:0;accent-color:var(--reading-accent);cursor:pointer;height:28px;margin:0}
.reader-paged #readerBottomProgress{font-size:var(--type-small);font-variant-numeric:tabular-nums;min-width:3ch;text-align:right}
.reader-paged .reader-book-name{display:grid;flex:1}
@media(max-width:650px){.reader-paged .reader-page{padding:20px 22px}.reader-paged .reader-bottom{padding:8px 16px}.reader-paged .reader-book-name strong{font-family:inherit;font-size:var(--type-body)}.reader-paged .reader-topbar{flex-wrap:nowrap}.reader-paged .reader-back{font-size:0;min-width:32px}.reader-paged .reader-back:before{content:"←";font-size:22px}.reader-paged .reader-tools>button{min-width:34px;width:34px;height:36px}.reader-paged .reader-book-name span{font-size:var(--type-small);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.reader-paged .reader-tools{gap:3px}.reader-paged .reader-page-info{font-size:var(--type-small)}}

/* Overview rows distinguish actions from read-only library information. */
#progressHub div.dashboard-folder { cursor: default; }
#progressHub div.dashboard-folder:hover { border-color: var(--line); }
#progressHub .dashboard-heading { flex-wrap: wrap; }
#progressHub .dashboard-folder small { flex: 0 1 auto; max-width: 46%; overflow-wrap: anywhere; font-size: var(--type-small); }
.overview-exclude { align-items: flex-start; }
.overview-exclude span { min-width: 0; }
.overview-exclude small { display: block; color: var(--muted); font-size: var(--type-small); margin-top: 3px; }
.overview-conflicts { padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); min-width: 0; }
.overview-conflicts summary { cursor: pointer; font-weight: 600; }
.overview-conflicts p { color: var(--muted); font-size: var(--type-control); }
.overview-conflict-group { display: grid; gap: 7px; padding-block: 10px; border-top: 1px solid var(--line); min-width: 0; }
.overview-conflict-group > small { overflow-wrap: anywhere; color: var(--muted); }
.overview-conflict-group .dashboard-folder { width: 100%; }
@media (max-width: 650px) {
  #progressHub .dashboard-folder { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 5px 9px; }
  #progressHub .dashboard-folder > .ui-icon { grid-column: 1; grid-row: 1; }
  #progressHub .dashboard-folder strong { grid-column: 2; grid-row: 1; }
  #progressHub .dashboard-folder small { grid-column: 2 / -1; grid-row: 2; max-width: none; }
  #progressHub .dashboard-folder > span:last-child:not(.ui-icon) { grid-column: 3; grid-row: 1; }
}

/* Shared in-app actions and collapsible folder navigation. */
.app-action-dialog { padding:24px; margin:auto; max-width:calc(100% - 28px); }
.app-action-dialog [hidden] { display:none !important; }
.app-action-dialog h2 { font-size:var(--type-title-large); line-height:1.35; overflow-wrap:anywhere; }
#appActionMessage { margin:0; color:var(--muted); line-height:1.55; white-space:pre-line; overflow-wrap:anywhere; font-size:var(--type-body); }
#appActionError { margin:0; color:var(--ink); font-size:var(--type-control); }
.app-action-dialog .modal-actions { flex-wrap:wrap; }
.app-action-dialog .modal-actions button { min-height:44px; font-size:var(--type-control); }
.app-action-dialog .app-action-destructive { background:#a44339; border-color:#a44339; color:#fff; }
.app-action-dialog .app-action-destructive:hover { background:#8b352d; }
.folder-nav-row { padding-inline-start:calc(var(--folder-depth,0) * 9px); gap:1px; }
.folder-nav-row .nav-item { padding-inline-start:3px; }
.folder-nav-toggle,.folder-nav-spacer { flex:0 0 19px; width:19px; }
.folder-nav-toggle { display:grid; place-items:center; min-height:38px; padding:0; border:0; border-radius:5px; background:transparent; color:#c0d0c8; cursor:pointer; }
.folder-nav-toggle .ui-icon { width:16px; height:16px; transform:rotate(-90deg); }
.folder-nav-toggle[aria-expanded=true] .ui-icon { transform:none; }
.folder-nav-toggle:hover,.folder-nav-toggle:focus-visible { background:#ffffff22; color:white; }
@media(max-width:650px){ .folder-nav-toggle,.folder-nav-spacer { flex-basis:28px; width:28px; } .folder-nav-toggle { min-height:44px; } .folder-nav-row { padding-inline-start:calc(var(--folder-depth,0) * 6px); } }

/* Shared material controls and ordered content. */
.filter-row {justify-content:flex-start;gap:12px;flex-wrap:wrap;align-items:center}
.filter-row .book-select:last-child {margin-left:auto}
.filter-row .book-select-trigger {min-height:40px;text-align:left}
.book-select {min-width:0;max-width:100%}
.book-select-trigger {min-width:0;max-width:100%;height:auto;min-height:40px;line-height:1.35;text-align:left;font-size:var(--type-control)}
.book-select-list {right:auto;left:0;max-width:min(360px,calc(100vw - 32px));min-width:min(100%,calc(100vw - 32px))}
.filter-row .book-select:last-child .book-select-list {right:0;left:auto}
.field,.form-row>* , .work-fields-editor, #workFieldsList,.work-field-row {min-width:0;max-width:100%}
.form-row {grid-template-columns:repeat(2,minmax(0,1fr))}
.modal .book-select-trigger,.settings-dialog .book-select-trigger {width:100%;white-space:normal;overflow-wrap:anywhere;padding-block:9px}
.modal .book-select-list,.settings-dialog .book-select-list {position:static;width:100%;max-width:100%;min-width:0;margin-top:5px;box-shadow:none}
.work-field-row {background:var(--card);overflow-wrap:anywhere}
.work-field-heading {gap:8px;flex-wrap:wrap}
.work-field-heading label {font-size:var(--type-control)}
.block-actions,.order-actions {display:inline-flex;gap:5px;align-items:center;flex:none}
.order-action,.work-field-heading .order-action,.work-field-heading [data-remove-work-field] {min-width:32px;min-height:34px;width:auto;height:auto;background:var(--panel);color:var(--ink);border:1px solid var(--line);border-radius:7px;cursor:pointer;font-size:var(--type-control);padding:4px 8px}
.order-action:disabled {opacity:.35;cursor:default}
.order-action .ui-icon {width:16px;height:16px;display:block}
.order-list {display:grid;gap:8px;margin:16px 0}
.order-list h3 {margin:0;font-size:var(--type-title-small)}
.order-row {display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:9px;border:1px solid var(--line);border-radius:8px;min-width:0}
.order-row strong {flex:1;min-width:70px;overflow-wrap:anywhere;font-size:var(--type-body)}
.order-row>.ui-icon,.type-sample .ui-icon,.type-pill .ui-icon {width:17px;height:17px;flex:none}
.type-sample,.type-pill[style] {display:inline-flex;align-items:center;gap:5px;border-left:3px solid var(--material-type-color);padding:4px 7px;background:var(--brand-soft);color:var(--ink);border-radius:5px}
.type-form-row {display:grid;grid-template-columns:100px minmax(0,1fr);gap:10px}
#materialTypeColor {width:100%;height:42px}
.folder-breadcrumb {display:flex;align-items:center;gap:8px;flex-wrap:wrap;color:var(--muted);font-size:var(--type-control);margin-bottom:20px;overflow-wrap:anywhere}
.folder-breadcrumb button {border:0;background:transparent;color:var(--brand-text);padding:5px 0;cursor:pointer;font:inherit;overflow-wrap:anywhere}
.folder-section-heading {display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin:15px 0}
.folder-section-heading h2 {margin:0;font-size:var(--type-title-small)}
.folder-section-heading .check-label {font-size:var(--type-control)}
.folder-child-grid {display:grid;grid-template-columns:repeat(auto-fill,minmax(min(230px,100%),1fr));gap:10px}
.folder-child-grid .dashboard-folder strong {white-space:normal;overflow-wrap:anywhere;min-width:0}
.card-footer {flex-wrap:wrap;gap:8px}
.add-field-menu {position:static;width:100%;max-height:none;box-shadow:none;margin-top:8px}
.add-field-menu button {color:var(--ink);min-height:42px}
.add-field-menu button:hover {background:var(--brand-soft)}
.add-field-menu button b {font-size:var(--type-control)}
.detail-block pre,.detail-block .table-scroll {max-width:100%;overflow:auto}
@media (max-width:650px){.form-row{grid-template-columns:minmax(0,1fr)}.filter-row{flex-direction:row;align-items:center}.filter-row .book-select:last-child{margin-left:0}.filter-row .book-select{flex:1 1 130px}.filter-row .book-select-trigger{width:100%;white-space:normal}.filter-row .book-select-list{position:static;max-width:100%;width:100%}.folder-section-heading .dashboard-actions{flex-wrap:wrap}.order-row .secondary-button{padding:7px}.order-action{min-width:36px;min-height:38px}}
.work-field-row textarea,.work-field-row input[type="url"] {display:block;min-width:0;max-width:100%;border:1px solid var(--line);border-radius:8px;padding:10px 12px;background:var(--panel);color:var(--ink);font:inherit;font-size:var(--type-body);line-height:1.55}
.work-field-row textarea {resize:vertical;min-height:96px}
.work-field-row textarea:focus,.work-field-row input[type="url"]:focus {outline:2px solid var(--brand);outline-offset:1px}
.add-field-button {background:var(--panel);color:var(--brand-text);border-color:var(--line)}
#itemClassificationFields {grid-template-columns:minmax(0,1fr)}
#itemClassificationFields .field {margin-bottom:16px}
#folderBreadcrumb {margin-bottom:10px}
#pageSubtitle:empty {display:none}

/* One settings surface; account controls are mounted here by the secure client. */
.settings-hub {width:min(48rem,calc(100% - 2rem));max-height:calc(100dvh - 3rem);padding:0;overflow:hidden;border-radius:1rem;font-size:var(--type-body)}
.settings-hub[open] {display:grid;grid-template-rows:auto auto minmax(0,1fr) auto}
.settings-header {display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1.25rem 1.5rem;border-bottom:1px solid var(--line)}
.settings-header h2 {font-size:1.5rem;line-height:1.3;letter-spacing:-.025em}
.settings-close {display:grid;place-items:center;width:2.75rem;height:2.75rem;flex:none;padding:0;border:0;border-radius:.625rem;background:transparent;color:var(--muted);font:inherit;font-size:1.75rem;cursor:pointer}
.settings-close:hover {background:var(--brand-soft);color:var(--ink)}
.settings-tabs {display:flex;gap:.25rem;padding:.5rem 1.5rem 0;border-bottom:1px solid var(--line)}
.settings-tabs button {min-height:2.75rem;padding:.625rem .875rem;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--muted);font:inherit;font-size:var(--type-control);font-weight:500;cursor:pointer;white-space:nowrap}
.settings-tabs button[aria-selected=true] {color:var(--brand-text,var(--brand));border-bottom-color:var(--brand);font-weight:650}
.settings-tabs button:hover {background:var(--brand-soft)}
.settings-body {min-height:23rem;overflow-y:auto;overscroll-behavior:contain}
.settings-hub .settings-panel {padding:1.5rem;margin:0;border:0;min-width:0}
.settings-panel h3 {margin:0;font-size:1.25rem;line-height:1.4}
.settings-intro {margin:.375rem 0 1rem;color:var(--muted);font-size:var(--type-small);line-height:1.6}
.settings-row {display:flex;align-items:center;justify-content:space-between;gap:1.5rem;min-height:5rem;padding:1rem 0;border-bottom:1px solid var(--line)}
.settings-row>div {min-width:0}
.settings-row strong {font-size:var(--type-body);font-weight:600;line-height:1.5}
.settings-row p {margin:.25rem 0 0;color:var(--muted);font-size:var(--type-small);line-height:1.5;overflow-wrap:anywhere}
.settings-hub .secondary-button {min-height:2.75rem;padding:.625rem .875rem;font-size:var(--type-control);font-weight:500;line-height:1.4}
.settings-row>.secondary-button {flex:none;min-width:6.5rem;text-align:center}
.settings-hub .account-email-status {margin-left:0;font-size:inherit}
.settings-signout {margin-top:1.5rem}
.settings-signout .secondary-button {color:#ac4434;border-color:#ac443450;background:transparent}
.settings-signout p {font-size:var(--type-small);line-height:1.5;color:var(--muted);margin:.75rem 0 0}
.settings-signout p:empty {display:none}
.settings-hub .settings-appearance {margin:1.5rem 0 0}
.settings-hub .settings-appearance legend {font-size:var(--type-body)}
.settings-hub .settings-data h3 {font-size:1.25rem}
.settings-hub .settings-data .settings-actions {display:flex;flex-wrap:wrap;gap:.625rem;margin:1rem 0}
.settings-hub .settings-storage {font-size:var(--type-small);line-height:1.6;overflow-wrap:anywhere}
#legacyMigration {margin-top:1.5rem;padding-top:1rem;border-top:1px solid var(--line);font-size:var(--type-small);line-height:1.6}
#legacyMigration summary {cursor:pointer;min-height:2.75rem;align-content:center;color:var(--brand-text,var(--brand))}
#legacyMigration form {margin-top:.75rem}
#legacyMigration input[type=file] {max-width:100%;font-size:inherit}
.settings-footer {display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:.75rem 1.5rem;border-top:1px solid var(--line);font-size:var(--type-small);color:var(--muted)}
.settings-footer button {min-height:2.75rem;padding:.5rem 0;font-size:inherit}
.settings-hub button:focus-visible {outline:2px solid var(--brand);outline-offset:2px}
@media(max-width:650px){
 .settings-hub{width:calc(100% - 1.5rem);max-height:calc(100dvh - 1.5rem)}
 .settings-header{padding:1rem 1.125rem}.settings-tabs{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0;padding:.25rem .75rem 0}.settings-tabs button{padding:.625rem .5rem}
 .settings-hub .settings-panel{padding:1.125rem}.settings-body{min-height:0}.settings-row{gap:.75rem;min-height:5rem}.settings-row>.secondary-button{min-width:5rem;padding:.625rem .75rem}
 .settings-footer{padding:.5rem 1.125rem}.settings-hub .settings-data .settings-actions{display:grid;grid-template-columns:1fr}
}
