:root {
  --navy: #26343f;
  --green: #1d7f5b;
  --green-hover: #126146;
  --mint: #a6eed3;
  --green-soft: #e7f5ee;
  --text: #17202c;
  --muted: #617083;
  --line: #d7ded5;
  --surface: #fff;
  --canvas: #f4f6f2;
  --danger: #a8403c;
  --radius: 12px;
  --frame: min(1760px, calc(100% - 24px));
  font: 16px/1.6 "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; background: var(--canvas); }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
a { color: inherit; }
img { max-width: 100%; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid #65c6a1; outline-offset: 3px; }
input, select { min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
input::placeholder { color: #84908f; }
input:focus, select:focus { border-color: var(--green); }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 1000; padding: 12px; border-radius: 8px; background: #fff; }
.skip-link:focus { top: 10px; }

/* Main-site navigation belongs in the header; library navigation is separate. */
.site-header { position: sticky; top: 0; z-index: 20; background: linear-gradient(120deg, #22313d, #26343f 52%, #304452); color: #fffdf4; box-shadow: 0 2px 10px #17202c14; }
.header-inner { position: relative; width: 100%; height: 64px; margin: 0 auto; padding: 8px 18px; display: grid; grid-template-columns: 190px minmax(0,1fr) auto; gap: 14px; align-items: center; }
.brand { display: inline-flex; align-items: center; width: 190px; min-height: 44px; text-decoration: none; }
.brand-logo { display: block; width: 190px; height: auto; }
.global-nav { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: #91b2a5 transparent; }
.global-nav-link { display: inline-flex; align-items: center; justify-content: center; flex: none; min-height: 44px; padding: 8px 12px; border: 1px solid #ffffff14; border-radius: 999px; background: #ffffff08; color: #e6efeb; font-size: 14px; line-height: 1.5; white-space: nowrap; text-decoration: none; }
.global-nav-link:hover { background: var(--green-hover); color: #fff; }
.global-nav-link.active { background: var(--green); color: #fff; }
.global-nav-toggle { display: none; }
.library-sidebar { grid-column: 1; position: sticky; top: 82px; align-self: start; min-width: 0; padding: 18px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px 18px; }
.sidebar-heading strong { display: block; font-size: 18px; font-weight: 600; }
.sidebar-close, .library-menu-toggle { display: none; }
.nav-tabs { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 0; }
.nav-tab { position: relative; display: inline-flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #52665c; font-size: 14px; text-align: left; white-space: nowrap; transition: background .15s ease; }
.nav-tab svg { width: 18px; height: 18px; flex: none; }
.nav-tab:hover { background: var(--green-soft); color: var(--green-hover); }
.nav-tab.active { background: var(--green); color: #fff; }
.nav-count { min-width: 20px; margin-left: auto; padding: 0 6px; border-radius: 999px; background: var(--green-soft); color: var(--green-hover); font-size: 12px; line-height: 20px; text-align: center; }
.nav-tab.active .nav-count { background: #fff3; color: #fff; }
.header-account { display: flex; align-items: center; justify-self: end; gap: 9px; min-width: 0; }
.avatar { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 50%; background: #a6eed322; color: var(--mint); font-size: 14px; }
.account-details { min-width: 0; max-width: 165px; }
.account-details strong, .account-details span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.account-details strong { font-weight: 500; }
.account-details span { color: #bad0c8; }
.account-button { min-height: 44px; min-width: 56px; padding: 8px 12px; border: 1px solid #9dc4b755; border-radius: 999px; background: #ffffff0b; color: #e8fff4; font-size: 14px; }
.account-button:hover { background: var(--green-hover); border-color: #a6eed380; }
.app-shell { display: grid; grid-template-columns: 232px minmax(0,1fr); align-items: start; gap: 18px; width: var(--frame); min-height: calc(100vh - 64px); margin: 16px auto 0; }
.library-workspace { grid-column: 2; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 18px; min-height: 44px; margin-bottom: 18px; font-size: 14px; }
.topbar > div { display: flex; align-items: center; min-width: 0; }
.breadcrumb { color: var(--muted); }
.breadcrumb-slash { margin: 0 12px; color: #a5b1ad; }
.topbar strong { font-weight: 600; }
.connection-pill { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; max-width: 100%; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted); font-size: 14px; line-height: 1.5; }
.status-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #a5b4ae; }
.connection-pill.connected { color: var(--green-hover); border-color: #b9d8c7; background: #f7fcf9; }
.connection-pill.connected .status-dot { background: var(--green); }
main { min-width: 0; min-height: calc(100vh - 230px); padding: 0 0 42px; }
.page-panel { min-width: 0; animation: appear .2s ease-out; }
.page-footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 18px 0 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }

/* A compact page title replaces the illustrated billboard. */
.hero { padding: 26px 30px; border: 1px solid #d6e7dc; border-radius: var(--radius); background: linear-gradient(110deg, #e7f5ee, #f6fbf7 62%, #fff); }
.hero-copy { max-width: 900px; }
.eyebrow { margin: 0 0 8px; color: #398368; font-size: 14px; line-height: 1.5; font-weight: 600; letter-spacing: 1px; }
.eyebrow.dark { color: var(--muted); }
.hero h1 { margin: 0 0 8px; font-size: 30px; line-height: 1.4; font-weight: 650; }
.hero-description { margin: 0; color: #526a60; font-size: 16px; line-height: 1.8; }
.hero-tag { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; color: #39745b; font-size: 14px; }
.hero-tag > span { color: var(--green); }
.search-section { margin: 18px 0 26px; }
.search-form { display: grid; grid-template-columns: 24px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 2px 8px #17202c04; }
.search-icon { display: flex; color: #789188; }
.search-form input { width: 100%; min-height: 44px; padding: 8px 4px; border: 0; border-radius: 4px; font-size: 16px; background: transparent; }
.search-options { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.search-options label { flex: none; }
.search-options select { max-width: min(420px,100%); font-size: 14px; }
.search-options > span { margin-left: auto; }
.section-heading { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 12px; margin: 0 0 18px; }
.section-heading h2 { margin: 0; font-size: 22px; line-height: 1.5; font-weight: 600; }
.section-heading .eyebrow { margin-bottom: 4px; }
.result-caption { color: var(--muted); font-size: 14px; }
.section-heading.compact { margin: 22px 0 14px; }
.heading-count { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; padding: 0 7px; border-radius: 999px; background: var(--green-soft); color: var(--green-hover); font-size: 14px; vertical-align: middle; }
.holds-heading { padding-top: 8px; }
.load-more-wrap { display: flex; justify-content: center; margin-top: 24px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 10px 18px; border: 1px solid transparent; border-radius: 8px; font-size: 14px; font-weight: 600; line-height: 1.5; text-decoration: none; text-align: center; transition: background .15s, border-color .15s; }
.button-primary { background: linear-gradient(135deg, var(--green), var(--green-hover)); color: #fff; box-shadow: 0 12px 24px #1d7f5b2e; }
.button-primary:hover:not(:disabled) { background: var(--green-hover); }
.button-secondary { border-color: #c4d6ca; background: #fff; color: var(--green-hover); }
.button-secondary:hover:not(:disabled) { border-color: #aacbb7; background: var(--green-soft); }
.button-small { padding: 9px 14px; }
.text-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 4px; border: 0; border-radius: 6px; background: transparent; color: var(--green); font-size: 14px; line-height: 1.5; text-decoration: none; }
.text-button:hover { color: var(--green-hover); text-decoration: underline; }
.full-width { width: 100%; }

.library-workspace:has(#panel-shelf:not([hidden])) .topbar { justify-content: flex-end; margin-bottom: 4px; }
.library-workspace:has(#panel-shelf:not([hidden])) .topbar > div,
.library-workspace:has(#panel-shelf:not([hidden])) .topbar:has(.connection-pill.connected) { display: none; }
.shelf-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 2px 0 16px; }
.shelf-heading h1 { margin: 0; color: var(--navy); font-size: clamp(27px, 3vw, 38px); line-height: 1.2; font-weight: 650; }
.shelf-heading .button { white-space: nowrap; padding-inline: 13px; }
.shelf-search { padding-block: 4px; box-shadow: none; }
.shelf-search .button { box-shadow: none; }
.shelf-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 12px 0 0; }
.shelf-filter { display: flex; align-items: center; justify-content: flex-start; gap: 9px; min-height: 44px; padding: 6px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 7px 7px 0 0; background: transparent; color: var(--navy); font-size: 14px; font-weight: 600; white-space: nowrap; }
.shelf-filter svg { flex: none; width: 18px; height: 18px; color: var(--green-hover); }
.shelf-filter:hover, .shelf-filter[aria-pressed="true"] { background: var(--green-soft); color: var(--green-hover); }
.shelf-filter[aria-pressed="true"] { border-bottom-color: var(--green); }
.shelf-group { margin: 20px 0 0; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.shelf-section-heading { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 2px; }
.shelf-section-heading h2 { margin: 0; font-size: 20px; font-weight: 650; }
.shelf-section-heading .text-button { margin-left: auto; }
.shelf-count { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
#shelf-results { container: shelf-results / inline-size; }
.shelf-book-list { display: grid; grid-template-columns: repeat(var(--shelf-columns, 2), minmax(0, 1fr)); gap: 18px 12px; padding: 6px 5px; }
.shelf-book-list.shelf-preview { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: max(138px, calc((100% - 60px) / 6)); overflow-x: auto; scrollbar-width: thin; scrollbar-color: #bacdc0 transparent; }
/* Each column count divides the 24 books served on a full page. */
@container shelf-results (min-width: 480px) {
  .shelf-book-list { --shelf-columns: 3; }
}
@container shelf-results (min-width: 640px) {
  .shelf-book-list { --shelf-columns: 4; }
}
@container shelf-results (min-width: 950px) {
  .shelf-book-list { --shelf-columns: 6; }
}
@container shelf-results (min-width: 1260px) {
  .shelf-book-list { --shelf-columns: 8; }
}
.shelf-book { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; min-width: 0; }
.shelf-book-copy { width: 100%; }
.shelf-cover { position: relative; display: grid; place-items: center; width: min(100%, 152px); aspect-ratio: 2 / 3; padding: 0; border: 0; border-radius: 4px 7px 7px 4px; background: #e8efe8; }
.shelf-cover:hover .book-cover { box-shadow: 2px 5px 13px #21372e40; }
.shelf-cover .book-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.shelf-cover .book-cover-placeholder { position: absolute; inset: 0; width: 100%; height: 100%; padding: 8px; font-size: 13px; }
.shelf-cover .book-cover-placeholder::before, .shelf-cover .book-cover-placeholder::after { content: none; }
.shelf-crown { position: absolute; right: 5px; bottom: 5px; display: grid; place-items: center; width: 28px; height: 28px; border: 1px solid #f4d581; border-radius: 50%; background: #fff1bd; box-shadow: 0 2px 5px #271a124d; }
.shelf-crown svg { width: 17px; height: 17px; fill: #e6ad35; stroke: #825611; }
.shelf-book-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; margin: 2px 0; font-size: 15px; line-height: 1.4; }
.shelf-book-copy p, .shelf-empty { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.shelf-book-author { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shelf-empty { padding: 16px 0; }
.shelf-login { display: flex; justify-content: center; padding: 30px 0; }
.shelf-book-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: auto; }
.shelf-book-actions .button { padding: 4px 7px; font-size: 13px; box-shadow: none; }
.shelf-book-actions .text-button { font-size: 13px; }
.shelf-scores { display: grid; gap: 3px; margin-top: 4px; }
.shelf-score-group { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; }
.shelf-score-label { color: var(--muted); font-size: 12px; }
.shelf-score-group .history-score { font-size: 13px; }
.shelf-pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
@media (max-width: 620px) {
  .shelf-book-list.shelf-preview { grid-auto-columns: clamp(124px, 36vw, 152px); }
  .shelf-book-list.shelf-preview .shelf-cover { width: calc(100% - 10px); }
}
@media (max-width: 480px) {
  .shelf-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Private reading history and independently recorded quiz attempts. */
.history-heading-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.history-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-bottom: 16px; padding: 22px; border: 1px solid #c9dfd1; border-radius: var(--radius); background: #f7fbf7; }
.history-summary > div { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.history-summary strong { color: var(--green-hover); font-size: 28px; line-height: 1.3; }
.history-summary span, .history-summary p { color: var(--muted); font-size: 14px; line-height: 1.7; }
.history-summary p { grid-column: 1 / -1; margin: 0; }
.history-help { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.9; }
.history-search-form { margin-bottom: 4px; border: 1px solid var(--line); }
.history-results-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; min-height: 52px; margin-bottom: 14px; color: var(--muted); font-size: 14px; }
.history-error { margin: 0 0 16px; padding: 12px 16px; border: 1px solid #dec7bf; border-radius: 8px; background: #fff7f3; color: var(--danger); }
.history-error p { margin: 0; font-size: 14px; line-height: 1.8; }
.history-layout { display: grid; grid-template-columns: minmax(0,1fr) 340px; align-items: start; gap: 22px; }
.history-main { min-width: 0; }
.history-book-list { display: flex; flex-direction: column; gap: 16px; }
.history-book-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.history-book-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.history-book-cover { display: grid; place-items: center; flex: none; width: 58px; height: 86px; }
.history-book-cover .book-cover { height: 100%; max-width: 100%; object-fit: contain; }
.history-book-cover .book-cover-placeholder { width: 56px; height: 84px; padding: 6px; font-size: 10px; line-height: 1.3; }
.history-book-cover .book-cover-placeholder::before, .history-book-cover .book-cover-placeholder::after { content: none; }
.history-book-copy { min-width: 0; }
.history-book-copy h3 { margin: 0 0 8px; font-size: 17px; line-height: 1.65; overflow-wrap: anywhere; }
.history-book-copy p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.history-quiz-section + .history-quiz-section { margin-top: 16px; }
.history-quiz-section h4 { margin: 0; padding: 0 0 8px; color: #45634e; font-size: 14px; line-height: 1.7; }
.history-attempts { margin: 0; padding: 0; list-style: none; }
.history-attempt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid #e5ece6; }
.history-attempt-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; color: var(--muted); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.history-quiz-number { color: #50695b; }
.history-score { display: inline-flex; align-items: center; justify-content: flex-end; flex: none; flex-wrap: wrap; gap: 5px; color: var(--green-hover); font-size: 18px; font-weight: 650; line-height: 1.5; }
.history-trophy { font-size: 18px; font-weight: 400; line-height: 1.5; }
.history-import-help { margin-top: 22px; }
.history-agent-card { margin: 0 0 20px; padding: 20px; border: 1px solid #c9dfd1; border-radius: var(--radius); background: #f7fbf7; }
.history-agent-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; }
.history-agent-heading h2 { margin: 0; color: #315c44; font-size: 20px; line-height: 1.6; }
.history-agent-heading .eyebrow { margin-bottom: 5px; }
.history-agent-status { margin: 16px 0 8px; color: #315c44; font-size: 16px; font-weight: 600; line-height: 1.8; }
.history-agent-help, .history-agent-result-line p, .history-agent-error { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.85; overflow-wrap: anywhere; }
.history-agent-result-line { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; }
.history-agent-result-line .text-button { flex: none; }
.history-agent-error { margin-top: 8px; color: var(--danger); }
.history-agent-card .history-sync-card { margin: 12px 0 0; background: #fff; }
@media (max-width: 600px) {
  .history-agent-card { padding: 16px; }
  .history-agent-heading > .button { width: 100%; }
}
.history-sync-card { margin: 0 0 18px; border: 1px solid #c9dfd1; border-radius: var(--radius); background: #f7fbf7; }
.history-agent-worker { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.history-sync-card > summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; min-height: 56px; padding: 14px 18px; color: #315c44; cursor: pointer; }
.history-sync-card > summary strong { font-size: 16px; line-height: 1.7; }
.history-sync-card > summary span { color: var(--muted); font-size: 14px; line-height: 1.7; }
.history-sync-body { padding: 0 18px 18px; }
.history-sync-body > p { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.85; overflow-wrap: anywhere; }
.history-sync-times { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px 20px; margin: 16px 0 0; }
.history-sync-times > div { min-width: 0; }
.history-sync-times dt { margin: 0 0 4px; color: var(--muted); font-size: 14px; line-height: 1.7; }
.history-sync-times dd { margin: 0; color: #315c44; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.history-sync-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.history-sync-body .history-sync-message { color: var(--green-hover); }
.history-sync-body .history-sync-error { color: var(--danger); }
@media (max-width: 600px) {
  .history-sync-times { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .history-sync-actions > .button { flex: 1 1 100%; }
}
.history-calendar { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.history-calendar-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.history-calendar-heading h2 { margin: 0; font-size: 18px; line-height: 1.6; }
.history-calendar-navigation { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin-top: 10px; }
.history-calendar-navigation strong { font-size: 15px; line-height: 1.7; text-align: center; }
.history-calendar-navigation .button { padding: 7px 10px; font-size: 14px; }
.history-calendar-status { min-height: 20px; margin: 8px 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.history-calendar-weekdays, .history-calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: 4px; }
.history-calendar-weekdays { padding-bottom: 8px; color: var(--muted); font-size: 14px; text-align: center; }
.history-day { display: flex; align-items: center; flex-direction: column; justify-content: flex-start; gap: 2px; min-width: 0; min-height: 72px; padding: 5px 1px; border: 1px solid transparent; border-radius: 7px; background: #f8faf7; color: #7b877d; font-size: 14px; line-height: 1.5; }
.history-day:disabled { cursor: default; opacity: 1; }
.history-day.has-records { background: #edf7ee; color: #315c44; }
.history-day.has-records:hover:not(:disabled), .history-day.selected { border-color: var(--green); background: #deefdf; }
.history-day strong { font-size: 14px; font-weight: 500; }
.history-day-count { font-size: 14px; white-space: nowrap; }
.history-day .history-trophy { font-size: 15px; }
.history-calendar-help, .history-calendar-undated, .history-calendar-details > p { margin: 14px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.history-calendar-undated { padding-top: 12px; border-top: 1px solid var(--line); }
.history-calendar-details h3 { margin: 18px 0 10px; color: #45634e; font-size: 15px; line-height: 1.7; }
.history-calendar-scores { margin: 0; padding: 0; list-style: none; }
.history-calendar-scores > li { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 0; border-top: 1px solid #e5ece6; }
.history-calendar-scores > li > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.history-calendar-scores strong { font-weight: 500; }
.history-calendar-scores > li > div > span { color: var(--muted); }
.history-calendar-scores .history-score { font-size: 16px; }
@media (max-width: 1200px) {
  .history-layout { grid-template-columns: minmax(0,1fr); }
  .history-calendar { max-width: 560px; width: 100%; }
}
@media (max-width: 600px) {
  .history-heading-actions { width: 100%; }
  .history-heading-actions > .button { flex: 1; padding-right: 10px; padding-left: 10px; }
  .history-summary { padding: 16px; gap: 12px; }
  .history-summary strong { font-size: 24px; }
  .history-book-card { padding: 16px; }
  .history-book-heading { gap: 12px; }
  .history-book-copy h3 { font-size: 16px; }
  .history-calendar { padding: 14px; }
  .history-calendar-grid, .history-calendar-weekdays { gap: 3px; }
}

/* Catalogue, including unavailable and already-borrowed states. */
.book-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 18px; }
.book-card { display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; transition: box-shadow .15s, border-color .15s; }
.book-card:hover { border-color: #a9c7b5; box-shadow: 0 6px 18px #17202c08; }
.book-cover-wrap { position: relative; display: flex; align-items: center; justify-content: center; height: 248px; padding: 22px; background: #eef3ee; }
.book-cover { height: 100%; max-width: 100%; object-fit: contain; border-radius: 2px 4px 4px 2px; box-shadow: 3px 5px 12px #203a3025; }
.book-cover-placeholder { display: flex; align-items: center; justify-content: center; flex-direction: column; width: 138px; height: 202px; max-width: 100%; padding: 18px; border-radius: 2px 6px 6px 2px; background: #336550; color: #f1f6ed; box-shadow: 3px 5px 12px #203a3020; font-size: 16px; line-height: 1.6; text-align: center; overflow-wrap: anywhere; }
.book-cover-placeholder::before { content: ""; width: 28px; height: 1px; margin-bottom: 14px; background: #a6d3b7; }
.book-cover-placeholder::after { content: "NEWABBY LIBRARY"; margin-top: 18px; font-size: 8px; letter-spacing: 1px; }
.availability { position: absolute; top: 12px; left: 12px; max-width: calc(100% - 24px); padding: 4px 9px; border: 1px solid #bdd9c8; border-radius: 999px; background: #f5fff8ef; color: var(--green-hover); font-size: 14px; line-height: 1.5; }
.availability.waiting { border-color: #d8d3b8; background: #fffdf2ef; color: #776932; }
.book-card-body { display: flex; flex: 1; flex-direction: column; min-width: 0; padding: 16px; }
.book-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; margin: 0 0 6px; font-size: 16px; line-height: 1.6; font-weight: 600; }
.book-authors { overflow: hidden; margin: 0 0 12px; color: var(--muted); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.book-summary-meta { margin: 0 0 10px; color: var(--muted); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.book-summary { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0 0 14px; color: #50695b; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.book-details-button { margin-bottom: 8px; }
.format-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.format-tag { padding: 2px 6px; border-radius: 4px; background: #f1f5f1; color: #657969; font-size: 12px; line-height: 1.5; }
.book-library { overflow: hidden; margin: auto 0 14px; color: var(--muted); font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.book-card-body > .button { width: 100%; padding: 9px 8px; }
.unavailable-label { padding: 10px 8px; border-radius: 8px; background: #f4f6f2; color: #79877d; font-size: 14px; text-align: center; }
.empty-state { display: flex; align-items: center; justify-content: center; flex-direction: column; min-height: 250px; padding: 32px 24px; border: 1px dashed var(--line); border-radius: var(--radius); background: #fff; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 50px; height: 50px; margin-bottom: 14px; border-radius: 12px; background: var(--green-soft); color: var(--green); }
.empty-icon svg { width: 25px; height: 25px; }
.empty-state h3 { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.empty-state p { max-width: 600px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.8; }
.empty-state .button { margin-top: 18px; }
.empty-state.error-state { border-color: #dec7bf; }
.empty-state.error-state .empty-icon { background: #f9ede8; color: var(--danger); }

/* Borrowing, download progress, and verified-file states. */
.page-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; margin: 6px 0 20px; }
.page-heading h1 { margin: 0 0 8px; font-size: 28px; line-height: 1.4; font-weight: 650; }
.page-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 16px; }
.info-banner { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 14px 18px; border: 1px solid #cce1d2; border-radius: 8px; background: #eaf5ed; color: #3d6852; }
.info-banner.neutral { border-color: var(--line); background: #fff; color: var(--muted); }
.banner-icon { display: grid; place-items: center; flex: none; width: 20px; height: 20px; border: 1px solid currentColor; border-radius: 50%; font-size: 14px; }
.info-banner p { min-width: 0; flex: 1; margin: 0; font-size: 14px; line-height: 1.8; }
.info-banner .text-button { flex: none; }
.loan-list, .job-list { display: flex; flex-direction: column; gap: 14px; }
.loan-row { display: flex; align-items: center; gap: 18px; min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.loan-cover-wrap { display: grid; place-items: center; flex: none; width: 62px; height: 90px; }
.loan-cover-wrap img { height: 100%; max-width: 100%; object-fit: contain; box-shadow: 2px 3px 7px #203a3020; }
.loan-cover-wrap .book-cover-placeholder { width: 60px; height: 88px; padding: 7px; font-size: 10px; line-height: 1.3; }
.loan-cover-wrap .book-cover-placeholder::before { width: 16px; margin-bottom: 6px; }
.loan-cover-wrap .book-cover-placeholder::after { content: none; }
.loan-cover-button, .loan-title-button { padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; }
.loan-title-button { display: block; min-height: 44px; max-width: 100%; line-height: inherit; white-space: normal; overflow-wrap: anywhere; }
.loan-title-button:hover { color: var(--green); }
.loan-copy { flex: 1; min-width: 0; }
.loan-copy .book-authors { margin-bottom: 8px; }
.loan-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 14px; }
.loan-meta .due-date { color: #47805e; }
.loan-reading-status { display: table; max-width: 100%; margin-top: 10px; padding: 5px 10px; border-radius: 6px; background: #f0f3f1; color: var(--muted); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.loan-reading-status.ready { background: var(--green-soft); color: var(--green-hover); font-weight: 600; }
.loan-reading-status.queued, .loan-reading-status.processing { background: #eaf1fa; color: #416789; }
.loan-reading-status.needs_authorization, .loan-reading-status.failed { background: #fbede8; color: var(--danger); }
.loan-actions { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 310px; }
.loan-actions small { color: var(--muted); font-size: 14px; text-align: center; }
.loans-toolbar { margin: 0 0 18px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.loans-bulk-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.loans-selection-count { margin-left: auto; color: var(--muted); font-size: 14px; line-height: 1.7; }
.loans-bulk-help { margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.preparation-card { margin: 0 0 18px; padding: 20px; border: 1px solid #c9dfd1; border-radius: var(--radius); background: #f7fbf7; }
.preparation-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 14px; }
.preparation-heading h2 { margin: 0; font-size: 18px; font-weight: 600; }
.preparation-heading span { color: var(--green-hover); font-size: 14px; line-height: 1.7; }
.preparation-card progress { display: block; width: 100%; height: 12px; overflow: hidden; border: 0; border-radius: 999px; background: #e0ebe2; color: var(--green); accent-color: var(--green); }
.preparation-card progress::-webkit-progress-bar { border-radius: 999px; background: #e0ebe2; }
.preparation-card progress::-webkit-progress-value { border-radius: 999px; background: var(--green); }
.preparation-card progress::-moz-progress-bar { border-radius: 999px; background: var(--green); }
.preparation-breakdown { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 14px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.preparation-summary { margin: 14px 0 0; color: #45634f; font-size: 14px; line-height: 1.8; }
.loan-selection { display: flex; align-items: center; gap: 8px; width: fit-content; min-height: 44px; margin-top: 8px; color: var(--muted); font-size: 14px; cursor: pointer; }
.loan-selection input { flex: none; width: 20px; height: 20px; min-height: 20px; margin: 0; padding: 0; accent-color: var(--green); cursor: pointer; }
.loan-selection input:disabled { cursor: not-allowed; opacity: .5; }
.job-card { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.jobs-toolbar { margin: 0 0 18px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.jobs-filter-row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.jobs-filter-row label { font-size: 14px; font-weight: 600; }
.jobs-filter-row select { max-width: 100%; }
.jobs-filter-count, .jobs-selection-count { color: var(--muted); font-size: 14px; line-height: 1.7; }
.jobs-bulk-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.jobs-selection-count { margin-left: auto; }
.jobs-bulk-help { margin: 12px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.jobs-bulk-result { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; padding: 10px 14px; border-radius: 8px; background: var(--green-soft); color: var(--green-hover); font-size: 14px; line-height: 1.8; }
.job-selection { display: flex; align-items: center; gap: 8px; width: fit-content; min-height: 44px; margin-top: 12px; color: var(--muted); font-size: 14px; cursor: pointer; }
.job-selection input { flex: none; width: 20px; height: 20px; min-height: 20px; margin: 0; padding: 0; accent-color: var(--green); cursor: pointer; }
.job-selection input:disabled { cursor: not-allowed; opacity: .5; }
.job-main { display: grid; grid-template-columns: 72px minmax(0,1fr) auto; align-items: center; gap: 16px; }
.job-cover-wrap { display: grid; place-items: center; width: 72px; height: 108px; }
.job-cover-wrap .book-cover { height: 100%; max-width: 100%; object-fit: contain; }
.job-cover-wrap .book-cover-placeholder { width: 70px; height: 106px; padding: 8px; font-size: 11px; line-height: 1.4; }
.job-cover-wrap .book-cover-placeholder::before { width: 16px; margin-bottom: 6px; }
.job-cover-wrap .book-cover-placeholder::after { content: none; }
.job-text { min-width: 0; flex: 1; }
.job-text h3 { margin: 0 0 4px; font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.job-text p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.job-badge { max-width: 180px; padding: 5px 10px; border-radius: 6px; background: var(--green-soft); color: var(--green-hover); font-size: 14px; line-height: 1.5; white-space: normal; text-align: center; }
.job-badge.running { background: #eaf1fa; color: #416789; }
.job-badge.failed { background: #fbede8; color: var(--danger); }
.job-detail { margin: 16px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.job-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.job-progress { height: 4px; overflow: hidden; margin-top: 20px; border-radius: 999px; background: #edf2ed; }
.job-progress::before { content: ""; display: block; width: 25%; height: 100%; background: #78bb98; animation: progress 2s ease-in-out infinite; }
.job-stages { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; list-style: none; padding: 0; margin: 22px 0 0; }
.job-stage { display: flex; align-items: center; gap: 8px; min-width: 0; color: #7a8e82; font-size: 14px; line-height: 1.55; }
.job-stage-mark { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border: 1px solid #c9d9ce; border-radius: 50%; background: #f5f8f3; font-size: 12px; }
.job-stage.done { color: #357653; }
.job-stage.done .job-stage-mark { border-color: #9cc7ac; background: var(--green-soft); }
.job-stage.current { color: #315f86; font-weight: 600; }
.job-stage.current .job-stage-mark { border: 5px solid #a9c8df; background: #fff; }
.job-stage.blocked { color: #966039; }
.job-stage.blocked .job-stage-mark { border-color: #d1ae8a; background: #fbf1e5; }
.job-source { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; line-height: 1.8; }
.job-source summary { display: list-item; width: fit-content; min-height: 44px; padding: 9px 0; cursor: pointer; }
.job-source p { margin: 8px 0; }

/* Settings and the existing activation/import controls. */
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
.settings-card { min-width: 0; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.settings-card-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.settings-icon { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 10px; font-size: 24px; font-weight: 600; }
.libby-icon { background: #e9f3df; color: #6f8a35; }
.adobe-icon { background: #f8e9e5; color: #af6252; }
.settings-card h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; }
.settings-card > p { margin: 0 0 18px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.small-status { color: var(--muted); font-size: 14px; }
.small-status.ready { color: var(--green); }
.setup-steps { padding-left: 22px; margin: 0 0 20px; color: var(--muted); font-size: 16px; line-height: 1.9; }
.field-label { display: block; margin-bottom: 8px; color: #425d4d; font-size: 14px; font-weight: 500; }
.inline-field { display: flex; gap: 10px; }
.inline-field input { flex: 1; width: 100%; min-width: 0; letter-spacing: 5px; }
.inline-field .button { flex: none; }
.field-help { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.connected-cards { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.connected-card { max-width: 100%; padding: 6px 10px; border: 1px solid #d7e7da; border-radius: 6px; background: #f5f9f4; color: #537360; font-size: 14px; overflow-wrap: anywhere; }
.disconnect-button { margin-top: 18px; }
.authorization-required { padding: 12px 14px; border: 1px solid #e3cf96; border-radius: 8px; background: #fbf4e1; color: #806330 !important; font-size: 14px !important; }
.adobe-local-help { padding: 12px 14px; border-radius: 8px; background: #f1f6f1; font-size: 14px !important; }
.format-flow { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; margin: 18px 0; color: #56735f; font-size: 14px; }
.flow-divider { color: #9ab09e; }
.file-drop { display: flex; align-items: center; flex-direction: column; padding: 20px 14px; margin-bottom: 14px; border: 1px dashed #bdd3c2; border-radius: 8px; background: #fafcf8; cursor: pointer; }
.file-drop:hover { border-color: var(--green); background: #f2f8ee; }
.file-drop svg { margin-bottom: 10px; color: #64916d; }
.file-drop strong { max-width: 100%; color: #4a6f53; font-size: 16px; overflow-wrap: anywhere; }
.file-drop > span { margin-top: 6px; color: var(--muted); font-size: 14px; text-align: center; }
.file-drop input { width: 100%; max-width: 100%; min-height: 44px; padding: 12px 0 0; border: 0; background: transparent; font-size: 14px; }
.file-drop input::file-selector-button { display: none; }
.settings-footnote { display: flex; align-items: flex-start; gap: 10px; max-width: 1000px; margin: 24px auto 0; color: var(--muted); }
.settings-footnote p { margin: 0; font-size: 14px; line-height: 1.8; }
.ade-device-import { margin: 18px 0; padding: 16px; border: 1px solid #d2e3d7; border-radius: 8px; background: #f4f9f3; }
.ade-device-import summary { min-height: 44px; padding: 9px 0; color: var(--green-hover); font-size: 14px; font-weight: 600; cursor: pointer; }
.ade-device-import p { color: var(--muted); font-size: 14px; line-height: 1.8; }
.ade-token-panel { margin-top: 16px; padding-top: 14px; border-top: 1px solid #cfe0d3; }
.ade-token-panel input { width: 100%; min-width: 0; background: #fff; font: 14px ui-monospace, Consolas, monospace; letter-spacing: 0; }

/* Native dialog behavior and every login/device/confirm ID stay intact. */
.modal { width: min(480px,calc(100% - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--text); box-shadow: 0 20px 80px #17202c35; }
.modal::backdrop { background: #17202c99; backdrop-filter: blur(3px); }
.modal-close { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 28px; }
.modal-close:hover { background: #f1f5ee; }
.modal-brand { width: 48px; height: 48px; margin-bottom: 20px; }
.modal-brand img { display: block; width: 48px; height: 48px; }
.modal h2 { margin: 0 0 10px; font-size: 24px; line-height: 1.5; font-weight: 600; }
.modal-description { margin: 0 0 24px; color: var(--muted); font-size: 16px; line-height: 1.8; }
.modal input { width: 100%; }
.password-label { margin-top: 18px; }
.login-submit { margin-top: 24px; }
.centered { text-align: center; }
.form-error { margin: 16px 0 0; padding: 11px 13px; border-radius: 8px; background: #fbede8; color: var(--danger); font-size: 14px; line-height: 1.7; }
.confirm-book { margin: 22px 0 12px; color: #335c45; font-size: 18px; line-height: 1.7; font-weight: 600; overflow-wrap: anywhere; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.book-detail-modal { width: min(720px,calc(100% - 24px)); padding-top: 38px; }
.book-detail-header { display: grid; grid-template-columns: 130px minmax(0,1fr); align-items: start; gap: 24px; }
.book-detail-cover { display: grid; place-items: center; width: 130px; height: 196px; }
.book-detail-cover .book-cover-placeholder { width: 126px; height: 190px; }
.book-detail-heading { min-width: 0; }
.book-detail-modal h2 { font-size: 24px; overflow-wrap: anywhere; }
.book-detail-authors, .book-detail-library { margin: 0 0 12px; color: var(--muted); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.book-detail-status { margin: 22px 0 0; padding: 12px 14px; border-radius: 8px; background: var(--green-soft); color: #456a56; font-size: 14px; line-height: 1.7; }
.book-detail-metadata { display: grid; grid-template-columns: 76px minmax(0,1fr); gap: 12px 16px; margin: 24px 0 0; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.8; }
.book-detail-metadata dt { color: var(--muted); }
.book-detail-metadata dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.book-detail-description { margin-top: 24px; }
.book-detail-description h3 { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
.book-detail-description p { margin: 0; color: #425d4d; font-size: 16px; line-height: 1.9; white-space: pre-line; overflow-wrap: anywhere; }
.login-mode-switch { display: flex; margin: 18px auto 0; padding: 8px 10px; }
.device-code-panel { margin-top: 20px; padding: 16px; border: 1px solid #ccdfd1; border-radius: 8px; background: #eff7ef; }
.device-code-panel input { min-height: 54px; background: #fff; color: #245a3f; font: 600 25px ui-monospace, Consolas, monospace; letter-spacing: 7px; text-align: center; }
.device-code-panel .field-help, .ade-token-panel .field-help { font-size: 14px; }
.toast-container { position: fixed; bottom: 24px; left: 50%; z-index: 1000; display: flex; flex-direction: column; gap: 10px; width: min(500px,calc(100% - 24px)); transform: translateX(-50%); pointer-events: none; }
.toast { padding: 14px 18px; border-radius: 8px; background: #205b43; color: #f5fff8; box-shadow: 0 5px 24px #17202c20; font-size: 14px; line-height: 1.7; pointer-events: auto; overflow-wrap: anywhere; animation: appear .2s ease-out; }
.toast.error { background: #87483e; }
.skeleton { pointer-events: none; }
.skeleton .book-cover-wrap { background: #e9efe7; }
.skeleton-line { height: 14px; margin-bottom: 10px; border-radius: 5px; background: #edf2e9; }
.skeleton-line.short { width: 60%; height: 10px; }
.skeleton .book-cover-placeholder { background: #dce8da; box-shadow: none; }
.skeleton .book-cover-placeholder::before, .skeleton .book-cover-placeholder::after { display: none; }
.skeleton .book-card-body { min-height: 160px; }
.skeleton .book-cover-wrap, .skeleton-line { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
@keyframes appear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes progress { from { transform: translateX(-110%); } to { transform: translateX(410%); } }

@media (min-width: 1440px) {
  .book-grid { grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); }
}
@media (max-width: 1150px) {
  .account-details { display: none; }
}
@media (max-width: 900px) {
  .header-inner { grid-template-columns: 136px minmax(0,1fr) auto; gap: 10px; padding: 8px 12px; }
  .brand, .brand-logo { width: 136px; }
  .global-nav-toggle { display: inline-flex; align-items: center; justify-content: center; justify-self: end; gap: 6px; min-height: 44px; padding: 8px 10px; border: 1px solid #ffffff26; border-radius: 999px; background: #ffffff0b; color: #e8fff4; font-size: 14px; white-space: nowrap; }
  .global-nav-toggle svg { width: 18px; height: 18px; }
  .header-account { grid-column: 3; grid-row: 1; }
  .global-nav { display: none; position: absolute; top: 72px; left: 12px; right: 12px; z-index: 25; max-width: none; max-height: calc(100dvh - 88px); overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 12px 34px #17202c26; }
  .global-nav.is-open { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
  .global-nav-link { justify-content: flex-start; min-width: 0; border-color: transparent; border-radius: 8px; background: #f4f6f2; color: var(--text); white-space: normal; overflow-wrap: anywhere; }
  .global-nav-link:hover { background: var(--green-soft); color: var(--green-hover); }
  .global-nav-link.active { background: var(--green); color: #fff; }
  .app-shell { grid-template-columns: minmax(0,1fr); gap: 14px; }
  .library-menu-toggle { display: inline-flex; align-items: center; justify-content: center; grid-column: 1; justify-self: start; gap: 8px; min-height: 44px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--green-hover); font-size: 14px; }
  .library-menu-toggle svg { width: 20px; height: 20px; }
  .library-sidebar { display: none; grid-column: 1; position: static; }
  .library-sidebar.is-open { display: block; }
  .library-workspace { grid-column: 1; }
  .sidebar-heading { padding-bottom: 12px; }
  .sidebar-close { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: #f3f7f0; color: var(--muted); font-size: 26px; }
  .settings-grid { grid-template-columns: minmax(0,1fr); }
  .search-options > span { flex-basis: 100%; margin-left: 0; }
  .loan-actions { max-width: 230px; }
}
@media (max-width: 600px) {
  .header-account { gap: 8px; }
  .account-details { display: none; }
  .avatar { width: 30px; height: 30px; }
  .app-shell { margin-top: 12px; }
  .topbar { margin-bottom: 14px; gap: 8px; }
  .breadcrumb, .breadcrumb-slash { display: none; }
  .connection-pill { padding: 9px 12px; }
  .hero { padding: 20px; }
  .hero h1 { font-size: 26px; }
  .hero-description { font-size: 16px; }
  .hero-tag { margin-top: 12px; }
  .search-form { grid-template-columns: 20px minmax(0,1fr) auto; gap: 7px; padding: 8px; }
  .search-icon svg { width: 20px; height: 20px; }
  .search-form .button { padding: 9px 12px; }
  .search-options { gap: 8px; }
  .search-options select { flex: 1; width: 0; max-width: 100%; }
  .book-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .book-cover-wrap { height: 210px; padding: 18px 14px; }
  .book-cover-placeholder { width: 118px; height: 174px; padding: 12px; font-size: 14px; }
  .book-card-body { padding: 13px; }
  .book-title { font-size: 16px; }
  .book-card-body > .button { padding: 9px 6px; }
  .book-library { margin-bottom: 12px; }
  .availability { top: 10px; left: 10px; max-width: calc(100% - 20px); padding: 3px 7px; }
  .section-heading h2 { font-size: 20px; }
  .page-heading { margin-top: 6px; }
  .page-heading h1 { font-size: 26px; }
  .info-banner { align-items: flex-start; flex-wrap: wrap; padding: 14px; gap: 9px; }
  .info-banner .banner-icon { margin-top: 3px; }
  .info-banner p { flex-basis: calc(100% - 30px); }
  .info-banner .text-button { margin-left: 29px; }
  .loan-row { flex-wrap: wrap; gap: 12px; padding: 16px; }
  .loan-cover-wrap { width: 50px; height: 74px; }
  .loan-cover-wrap .book-cover-placeholder { width: 48px; height: 72px; font-size: 9px; }
  .loan-copy { flex-basis: calc(100% - 62px); }
  .loan-actions { flex: 1 1 100%; align-items: stretch; max-width: none; padding-left: 62px; }
  .loan-actions small { text-align: left; }
  .loans-toolbar { padding: 14px 16px; }
  .preparation-card { padding: 16px; }
  .loans-bulk-controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .loans-bulk-controls > .button, .loans-bulk-controls > .text-button { width: 100%; }
  .loans-selection-count { grid-column: 1 / -1; grid-row: 1; margin-left: 0; }
  #loans-bulk-prepare { grid-column: 1 / -1; }
  .job-card { padding: 16px; }
  .jobs-toolbar { padding: 14px 16px; }
  .jobs-filter-row { gap: 8px; }
  .jobs-filter-row select { flex: 1; min-width: 0; }
  .jobs-filter-count { flex-basis: 100%; }
  .jobs-bulk-controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
  .jobs-bulk-controls > .button, .jobs-bulk-controls > .text-button { width: 100%; }
  .jobs-selection-count { grid-column: 1 / -1; grid-row: 1; margin-left: 0; }
  #jobs-bulk-download { grid-column: 1 / -1; }
  .job-main { grid-template-columns: 60px minmax(0,1fr); align-items: start; gap: 8px 12px; }
  .job-cover-wrap { grid-row: 1 / span 2; width: 60px; height: 90px; }
  .job-cover-wrap .book-cover-placeholder { width: 58px; height: 88px; padding: 6px; font-size: 10px; }
  .job-badge { grid-column: 2; width: fit-content; max-width: 100%; }
  .job-stages { gap: 6px; margin-top: 18px; }
  .job-stage { flex-direction: column; gap: 7px; text-align: center; font-size: 14px; }
  .job-actions .button { flex: 1 1 auto; }
  .settings-card { padding: 20px; }
  .settings-card h2 { font-size: 20px; }
  .inline-field { gap: 8px; }
  .inline-field input { padding: 10px; letter-spacing: 3px; }
  .inline-field .button { padding: 9px 12px; }
  .settings-footnote { gap: 8px; }
  .modal { padding: 24px; }
  .modal h2 { font-size: 22px; }
  .book-detail-modal { position: fixed; inset: auto 0 0; width: 100%; max-width: none; max-height: 90dvh; margin: 0; padding: 38px 20px calc(22px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; border-bottom: 0; }
  .book-detail-header { grid-template-columns: 82px minmax(0,1fr); gap: 16px; }
  .book-detail-cover { width: 82px; height: 124px; }
  .book-detail-cover .book-cover-placeholder { width: 80px; height: 122px; padding: 8px; font-size: 11px; }
  .book-detail-cover .book-cover-placeholder::after { content: none; }
  .book-detail-modal h2 { font-size: 20px; }
  .modal-actions > .button { flex: 1; }
  .toast-container { bottom: 16px; }
}
@media (max-width: 380px) {
  .book-cover-wrap { height: 196px; padding: 16px 10px; }
  .book-cover-placeholder { height: 164px; }
  .book-card-body { padding: 12px; }
  .loan-actions { padding-left: 0; }
  .inline-field { flex-wrap: wrap; }
  .inline-field input { flex-basis: 100%; }
  .inline-field .button { width: 100%; }
}
@media (max-width: 420px) {
  .global-nav.is-open { grid-template-columns: minmax(0,1fr); }
  .global-nav-toggle { padding-right: 8px; padding-left: 8px; }
  .header-account .avatar { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
