:root {
  color-scheme: light; font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
  --brand: #1888c5; --action: #1565c0; --orange: #ff9442; --ink: #1e293b; --muted: #475569;
  --line: #dbe5ef; --control-line: #8191a3; --surface: #f8fafc; --soft-blue: #edf6fd;
  --error: #9b3026; --success: #226447; --shadow: 0 1px 3px #00000008, 0 8px 24px #00000005;
  --radius-control: 10px; --radius-button: 14px; --radius-panel: 18px;
  color: var(--ink); background: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
.workspace-nav { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 24px; border-bottom: 1px solid var(--line); }
.workspace-tab { border-radius: var(--radius-control) var(--radius-control) 0 0; background: transparent; color: var(--muted); border-bottom: 3px solid transparent; }
.workspace-tab:hover { background: var(--soft-blue); color: var(--action); }
.workspace-tab[aria-current="page"] { color: var(--action); border-bottom-color: var(--action); background: var(--soft-blue); }
.invite-panel { max-width: none; }
.invite-controls { display: flex; align-items: start; gap: 16px; max-width: 720px; }
.invite-controls > div { flex: 1; min-width: 0; }
.invite-controls input { margin-bottom: 0; }
.invite-controls > button { flex-shrink: 0; margin-top: 0; min-height: 48px; }
.member-row { display: flex; justify-content: space-between; gap: 24px; padding: 24px 0; border-top: 1px solid var(--line); }
.member-row > div { min-width: 0; }
.member-row h3 { font-size: 18px; overflow-wrap: anywhere; }
.member-actions { display: flex; align-items: start; justify-content: end; flex-wrap: wrap; gap: 12px; max-width: 340px; }
.member-date { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.status-badge[data-state="active"] { color: var(--success); background: #eaf6ef; }
.status-badge[data-state="removed"], .status-badge[data-state="failed"], .status-badge[data-state="account-missing"] { color: var(--error); background: #fff0ee; }
.access-history { margin-top: 24px; border-top: 1px solid var(--line); }
.access-history ol { list-style: none; padding: 0; }
.access-history li { padding: 16px 0; border-top: 1px solid var(--line); }
.access-history li p { margin: 0; line-height: 1.65; }
@media (max-width: 600px) { .invite-controls,.member-row { flex-direction: column; gap: 16px; } .invite-controls > div { width: 100%; } .member-actions { max-width: none; justify-content: start; } }
a { color: var(--action); text-underline-offset: 4px; }
button, input, textarea, select { font: inherit; }
button, .button-link, .download { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 11px 18px; border: 1px solid transparent; border-radius: var(--radius-button); background: var(--action); color: white; font-size: 14px; line-height: 1.45; font-weight: 600; text-decoration: none; cursor: pointer; transition: background-color 120ms ease-out, color 120ms ease-out, border-color 120ms ease-out; }
button:hover, .download:hover { background: #104e98; }
button:active:not(:disabled), .download:active { background: #0c417e; }
button:disabled { opacity: .5; cursor: default; }
button[aria-busy="true"] { cursor: progress; }
.secondary, .button-link { background: white; border-color: var(--control-line); color: #164e85; }
.secondary:hover, .button-link:hover { background: var(--soft-blue); border-color: var(--action); }
.danger { background: var(--error); color: white; }
.danger:hover { background: #78241c; }
.danger-link { color: var(--error); background: transparent; border-color: transparent; }
.danger-link:hover { color: #78241c; background: #fff3f1; }
.text-button { background: transparent; color: var(--action); padding: 10px 12px; text-decoration: underline; text-underline-offset: 4px; }
.text-button:hover { color: #104e98; background: var(--soft-blue); }
:is(a,button,input,textarea,select,[tabindex]):focus-visible { outline: 3px solid var(--action); outline-offset: 4px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 50; background: white; padding: 14px; }
.demo-banner { padding: 7px 16px; text-align: center; background: var(--soft-blue); color: #164e85; font-size: 12px; }
.masthead { display: flex; justify-content: space-between; align-items: center; gap: 24px; min-height: 86px; padding: 14px max(24px, calc((100% - 1072px)/2)); border-bottom: 1px solid var(--line); background: white; }
.wordmark { display: flex; align-items: center; gap: 18px; text-decoration: none; min-width: 0; }
.wordmark img { display: block; width: 154px; height: 49px; }
.wordmark span { padding-left: 18px; border-left: 1px solid var(--line); color: var(--muted); font-size: 13px; }
nav { display: flex; align-items: center; }
.nav-link { display: inline-flex; min-height: 44px; align-items: center; padding: 10px 12px; border-radius: var(--radius-control); color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.nav-link:hover { background: var(--soft-blue); color: var(--action); }
main { width: 100%; max-width: 1120px; padding: 0 24px 40px; margin-inline: auto; flex: 1; }
.intro { padding: 36px 0 20px; }
.library-intro { border-bottom: 1px solid var(--line); }
h1, h2, h3 { text-wrap: balance; overflow-wrap: anywhere; }
h1 { margin: 0 0 12px; max-width: 850px; color: #1565a9; font-size: clamp(30px, 4.2vw, 44px); line-height: 1.16; letter-spacing: -1.1px; font-weight: 750; }
h2 { margin: 0; font-size: clamp(22px, 2.6vw, 28px); line-height: 1.3; letter-spacing: -.5px; }
h3 { margin: 0; font-size: 21px; line-height: 1.3; letter-spacing: -.3px; }
p, li, figcaption { text-wrap: pretty; overflow-wrap: anywhere; }
.intro > p:last-child { max-width: 65ch; color: var(--muted); line-height: 1.7; font-size: 16px; margin: 0; }
.eyebrow { margin: 0 0 10px; color: #126a9a; font-size: 13px; line-height: 1.5; font-weight: 650; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 28px 0 20px; }
.section-heading > a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }
.section-note { margin: 8px 0; color: var(--muted); font-size: 14px; line-height: 1.65; max-width: 70ch; }
.issue-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,265px),1fr)); gap: 24px; margin-bottom: 28px; }
.issue-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-panel); overflow: hidden; background: white; color: var(--ink); text-decoration: none; transition: border-color 150ms ease-out, box-shadow 150ms ease-out; }
.issue-card:hover { border-color: #8ab9df; box-shadow: var(--shadow); }
.cover-wrap { display: flex; align-items: center; justify-content: center; background: var(--soft-blue); padding: 24px; }
.cover-wrap img { display: block; width: 100%; max-width: 210px; height: auto; aspect-ratio: 420/595; object-fit: contain; box-shadow: 0 6px 16px #00000012; outline: 1px solid #0000001a; outline-offset: -1px; }
.card-body { padding: 24px; min-width: 0; }
.issue-card h3 { margin: 0 0 10px; font-size: 22px; }
.issue-card p { font-size: 15px; color: var(--muted); line-height: 1.65; }
.card-meta { font-size: 13px !important; margin: 8px 0 14px; }
.read-link { display: flex; align-items: center; gap: 10px; margin-top: 20px; font-size: 14px; font-weight: 650; color: var(--action); }
.featured { display: block; }
.featured .issue-card { display: grid; grid-template-columns: .7fr 1.3fr; background: #f6faff; }
.featured .cover-wrap { padding: 28px; }
.featured .cover-wrap img { max-height: 300px; max-width: 212px; }
.featured .card-body { display: flex; flex-direction: column; justify-content: center; padding: 32px 40px; }
.featured .issue-card h3 { font-size: clamp(26px,3vw,36px); line-height: 1.18; letter-spacing: -.7px; }
.featured .read-link { align-self: start; width: fit-content; min-height: 44px; padding: 11px 18px; border-radius: var(--radius-button); background: var(--action); color: white; }
.featured .issue-card:hover .read-link { background: #104e98; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; margin-bottom: 24px; }
.filters label { min-width: 180px; margin: 0; }
label { display: block; margin: 20px 0 8px; font-size: 14px; line-height: 1.5; color: var(--ink); font-weight: 600; }
.field-hint { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 6px; }
input, textarea, select { width: 100%; min-width: 0; min-height: 46px; padding: 11px 12px; border: 1px solid var(--control-line); border-radius: var(--radius-control); background: white; color: var(--ink); line-height: 1.5; font-size: 16px; }
input::placeholder, textarea::placeholder { color: #64748b; }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--error); }
textarea { resize: vertical; }
button, .card-meta, .reader-nav, .page-dialog-nav, progress { font-variant-numeric: tabular-nums; }
.reader-top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 20px 0; color: var(--muted); font-size: 13px; }
.reader-top a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.reader-intro { padding-bottom: 16px; max-width: 850px; }
.reader-intro > p:not(.eyebrow) { color: var(--muted); line-height: 1.65; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.reader-toolbar { display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 16px; border-top: 1px solid var(--line); padding: 20px 0 12px; }
.reader-toolbar[data-view="scroll"] { position: sticky; top: 0; z-index: 5; background: white; border-bottom: 1px solid var(--line); }
.view-switch { display: inline-flex; gap: 4px; background: var(--surface); padding: 4px; border: 1px solid var(--line); border-radius: 18px; }
.view-switch button { border-radius: 13px; background: transparent; color: var(--muted); }
.view-switch button[aria-pressed="true"] { background: white; color: var(--action); box-shadow: 0 1px 4px #0000001a; }
.reader-page-select { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14px; }
.reader-page-select select { width: auto; min-width: 108px; }
.reader { margin: 0 auto 20px; }
.reader-hint { color: var(--muted); text-align: center; font-size: 13px; margin: 8px 0 16px; }
.book-stage { display: flex; align-items: center; justify-content: center; min-height: 260px; padding: 24px 12px; border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--soft-blue); }
.book-page { overflow: hidden; background: white; position: relative; }
.book-page img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; }
.page-placeholder { display: grid; place-content: center; text-align: center; height: 100%; gap: 12px; padding: 20px; color: var(--muted); font-size: 14px; }
.reader-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; padding: 20px 0; }
.reader-nav p { min-width: 125px; text-align: center; color: var(--muted); font-size: 14px; margin: 0; }
.reader-nav button { min-width: 100px; }
.standard-reader { max-width: 850px; margin: 0 auto 32px; }
.standard-reader figure { margin: 24px 0; background: var(--surface); min-height: 120px; border: 1px solid var(--line); }
.standard-reader figure { scroll-margin-top: var(--reader-offset, 160px); }
.standard-reader img { display: block; width: 100%; height: auto; min-height: 120px; }
.standard-reader figcaption, .preview-grid figcaption { text-align: center; color: var(--muted); padding: 12px; font-size: 13px; }
.scroll-page-error { padding: 20px; }
.admin-panel { padding: 28px; margin: 0 0 28px; background: white; border: 1px solid var(--line); border-radius: var(--radius-panel); }
.publisher-main { padding-top: 32px; }
.auth-panel { width: 100%; max-width: 480px; margin: 16px auto 32px; padding: 32px; box-shadow: var(--shadow); }
.auth-panel h1 { font-size: clamp(26px,3vw,30px); color: var(--ink); letter-spacing: -.7px; }
.auth-intro { margin: 12px 0 24px; color: var(--muted); font-size: 15px; line-height: 1.7; }
.auth-actions { display: grid; gap: 16px; margin-top: 24px; }
.auth-actions > button { width: 100%; min-height: 48px; }
.auth-actions .text-button { justify-self: center; width: auto; }
.password-field { display: flex; position: relative; }
.password-field input { padding-right: 78px; }
.password-toggle { position: absolute; right: 2px; top: 2px; bottom: 2px; min-height: 40px; min-width: 64px; padding: 6px 10px; color: var(--action); background: transparent; border-radius: 8px; font-size: 13px; }
.password-toggle:hover { color: var(--action); background: var(--soft-blue); }
.demo-note { padding: 12px; background: var(--soft-blue); font-size: 13px; line-height: 1.7; color: var(--muted); }
.notice { margin: 16px 0 0; padding: 12px 16px; border-radius: var(--radius-control); border-left: 3px solid var(--brand); background: var(--soft-blue); color: #164e85; line-height: 1.65; font-size: 14px; white-space: pre-wrap; }
.notice:empty, .field-error:empty { display: none; }
.notice[data-tone="error"] { color: var(--error); border-color: var(--error); background: #fff3f1; }
.notice[data-tone="success"] { color: var(--success); border-color: var(--success); background: #edf8f1; }
.field-error { color: var(--error); font-size: 13px; line-height: 1.5; margin: 8px 0; }
.account-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.account-bar p { margin: 0; color: var(--muted); font-size: 14px; }
.workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-top: 28px; }
.workspace-heading h1 { margin-bottom: 8px; }
.new-window-note { font-size: 12px; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 24px; }
.form-grid > div { min-width: 0; }
.upload-zone { margin-top: 24px; padding: 20px; background: var(--soft-blue); border: 1px solid #a4bed4; border-radius: 12px; }
.upload-zone label { margin-top: 0; }
.upload-zone input { background: white; }
.upload-zone small { display: block; margin-top: 12px; font-size: 13px; line-height: 1.7; color: var(--muted); }
.file-details { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.upload-feedback { margin: 20px 0; }
progress { width: 100%; height: 10px; accent-color: var(--action); }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%,210px),1fr)); gap: 20px; margin-bottom: 24px; }
.preview-grid figure { margin: 0; }
.preview-page { display: block; width: 100%; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.preview-page:hover { background: var(--soft-blue); }
.preview-page img, .preview-grid > figure > img { display: block; width: 100%; height: auto; outline: 1px solid #0000001a; outline-offset: -1px; }
.preview-page span { display: block; padding-top: 12px; color: var(--action); font-size: 13px; }
.review-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; padding: 20px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; margin-bottom: 32px; }
.review-actions:empty { display: none; }
.admin-row { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 16px; padding: 24px; background: white; }
.publication-row-heading { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: 16px; }
.admin-row h3 { margin: 8px 0 4px; }
.admin-row p { margin: 8px 0; font-size: 14px; color: var(--muted); line-height: 1.6; }
.admin-row .actions { margin-top: 16px; }
.row-secondary { border-top: 1px solid var(--line); padding-top: 16px; }
.status-badge { display: inline-flex; padding: 5px 10px; border-radius: 7px; color: #164e85; background: var(--soft-blue); font-size: 12px; line-height: 1.5; font-weight: 650; }
.status-badge[data-state="published"] { background: #edf8f1; color: var(--success); }
.status-badge[data-state="failed"] { background: #fff3f1; color: var(--error); }
.error { color: var(--error); font-size: 14px; line-height: 1.6; }
.confirm-dialog { width: min(460px,calc(100% - 32px)); max-width: none; padding: 28px; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-panel); box-shadow: 0 16px 60px #00000026; }
.confirm-dialog h2 { font-size: 23px; }
.confirm-dialog p { color: var(--muted); line-height: 1.7; }
.dialog-actions { justify-content: end; margin-top: 24px; }
dialog::backdrop { background: #14223599; }
.page-dialog { padding: 0; width: min(1040px,calc(100% - 24px)); max-width: none; max-height: calc(100dvh - 24px); border: 1px solid var(--line); border-radius: var(--radius-panel); color: var(--ink); background: white; }
.page-dialog-heading, .page-dialog-nav { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px 20px; }
.page-dialog-heading h2 { font-size: 20px; }
.page-dialog-body { max-height: calc(100dvh - 220px); overflow: auto; background: var(--surface); padding: 16px; }
.page-dialog-body img { display: block; width: 100%; height: auto; outline: 1px solid #0000001a; outline-offset: -1px; }
.page-dialog-nav p { font-size: 14px; margin: 0; }
.empty-state, .loading-state { padding: 24px; background: var(--surface); border-radius: 12px; color: var(--muted); line-height: 1.7; }
.issue-grid > .empty-state { grid-column: 1/-1; }
.state-panel { max-width: 680px; padding: 48px 0; }
.state-panel p { color: var(--muted); line-height: 1.7; }
.demo-examples { padding-top: 12px; margin-top: 28px; border-top: 1px solid var(--line); }
footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px max(24px,calc((100% - 1072px)/2)); background: var(--surface); border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.footer-access { display: inline-flex; min-height: 44px; align-items: center; padding: 8px 0; }
@media(max-width:680px) {
  .masthead { min-height: 76px; padding: 12px 20px; gap: 12px; flex-wrap: wrap; }
  .wordmark { gap: 12px; }
  .wordmark img { width: 125px; height: 40px; }
  .wordmark span { padding-left: 12px; font-size: 11px; }
  .nav-link { padding: 8px; font-size: 13px; }
  main { padding: 0 20px 28px; }
  .intro { padding: 28px 0 20px; }
  h1 { letter-spacing: -.7px; }
  .section-heading { gap: 12px; flex-wrap: wrap; padding: 24px 0 16px; }
  .featured .issue-card { grid-template-columns: 84px minmax(0,1fr); gap: 18px; padding: 20px; }
  .featured .cover-wrap { padding: 0; background: transparent; align-items: start; }
  .featured .cover-wrap img { max-height: none; width: 100%; }
  .featured .card-body { padding: 0; }
  .featured .issue-card h3 { font-size: 24px; }
  .featured .issue-card .card-description { display: none; }
  .featured .read-link { margin-top: 12px; padding: 10px 12px; }
  .filters label { min-width: 0; flex: 1 1 140px; }
  .filters .text-button { align-self: end; }
  .reader-top { padding: 8px 0 16px; }
  .reader-nav { gap: 8px; }
  .reader-nav button { min-width: 82px; padding: 10px 12px; }
  .reader-nav p { min-width: 100px; font-size: 13px; }
  .book-stage { padding: 12px 8px; }
  .reader-toolbar { gap: 12px; }
  .view-switch { width: 100%; }
  .view-switch button { flex: 1; }
  .reader-page-select { width: 100%; justify-content: space-between; }
  .publisher-main { padding-top: 24px; }
  .admin-panel { padding: 20px; }
  .auth-panel { margin-top: 0; padding: 24px; }
  .form-grid { grid-template-columns: minmax(0,1fr); }
  .workspace-heading { flex-direction: column; align-items: start; gap: 12px; }
  .admin-row { padding: 20px; }
  .admin-row .actions > button, .admin-row .actions > a { flex: 1 1 auto; }
  .upload-zone { padding: 16px; }
  .preview-heading { align-items: start; }
  .page-dialog-heading, .page-dialog-nav { padding: 12px; }
  .page-dialog-nav button { padding: 10px; }
  .page-dialog-heading h2 { font-size: 18px; }
  .page-dialog-body { max-height: calc(100dvh - 250px); padding: 8px; }
}
@media(max-width:359px) { .featured .issue-card { grid-template-columns: 64px minmax(0,1fr); gap: 14px; padding: 16px; } .featured .issue-card h3 { font-size: 22px; } .featured .read-link { font-size: 13px; } .wordmark span { font-size: 10px; } }
@media(prefers-reduced-motion:reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
