@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Playfair+Display:wght@500;600;700&display=swap');

:root {
  color-scheme: light;
  --canvas: #f8f7f4;
  --surface: #fffdfa;
  --line: #eae6de;
  --ink: #232624;
  --muted: #686a65;
  --orange: #ad482e;
  --orange-light: #f7e8e0;
  --serif: "Playfair Display", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 400 1rem/1.5 var(--sans); }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
button:disabled { opacity: .55; cursor: wait; }
button[data-view], .icon-button { border: 0; background: none; }
[hidden] { display: none !important; }
svg { width: 19px; height: 19px; vertical-align: middle; flex: none; }
[data-icon] { display: inline-flex; flex: none; align-items: center; justify-content: center; }
.app { display: grid; grid-template-columns: 231px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100dvh; overflow-y: auto; z-index: 5; padding: 29px 17px 16px; background: var(--surface); border-right: 1px solid var(--line); }
.brand { display: flex; gap: 11px; text-align: left; align-items: center; width: fit-content; padding: 0 0 0 8px; font: 700 1.85rem/1 var(--serif); letter-spacing: -.05em; }
.brand-mark { width: 39px; height: 39px; border-radius: 11px; color: #fffaf5; background: var(--orange); }
.brand-mark svg { width: 23px; height: 23px; }
.brand-period, h1 span { color: var(--orange); }
.brand small, .sidebar-bottom small { display: block; margin-top: 5px; font: 500 .75rem/1.4 var(--sans); letter-spacing: 0; color: var(--muted); }
.navigation { display: grid; gap: 4px; margin-top: 47px; }
.nav-label { margin: 0 0 8px 11px; color: #77736e; font-size: .75rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.nav-item { display: flex; width: 100%; align-items: center; gap: 11px; min-height: 44px; padding: 8px 11px; border-radius: 8px; color: #565954; text-align: left; font-size: .875rem; font-weight: 600; }
.nav-item:hover { background: #f4f0eb; }
.nav-item[aria-current="page"] { color: #983d27; background: var(--orange-light); }
.nav-count { margin-left: auto; color: inherit; font-size: .75rem; }
.sidebar-bottom { display: flex; gap: 10px; align-items: center; padding: 16px 7px 4px; margin-top: auto; border-top: 1px solid var(--line); font-size: .875rem; }
.sidebar-bottom small { margin-top: 2px; }
.avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #88472e; background: #f2e4d8; }
.workspace { min-width: 0; }
.topbar { min-height: 74px; padding: 12px clamp(22px, 3.4vw, 53px); display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-path, .topbar-actions { display: flex; align-items: center; gap: 11px; }
.topbar-path { color: #555950; font-size: .875rem; font-weight: 600; }
.topbar-path svg { color: #827c73; }
.topbar-actions { gap: 14px; }
.button { display: inline-flex; gap: 8px; align-items: center; justify-content: center; min-height: 41px; padding: 8px 14px; border: 1px solid transparent; border-radius: 8px; font-size: .875rem; font-weight: 700; white-space: nowrap; }
.button svg { width: 17px; height: 17px; }
.primary { background: var(--orange); color: #fff; }
.primary:hover { background: #923922; }
.secondary { background: var(--surface); border-color: var(--line); }
.secondary:hover { background: #f1eae1; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 7px; flex: none; color: var(--muted); }
.icon-button:hover { background: #ece8e1; color: var(--ink); }
.mobile-menu, .mobile-scrim { display: none; }
.main { max-width: 1530px; margin: 0 auto; padding: 33px clamp(22px, 3.4vw, 53px) 48px; }
.intro { margin-bottom: 25px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font: 700 clamp(2.15rem, 4vw, 3.4rem)/1.08 var(--serif); letter-spacing: -.048em; }
.intro p { margin-bottom: 0; color: var(--muted); }
.library-search { display: flex; align-items: center; gap: 9px; max-width: 620px; min-height: 48px; margin-bottom: 23px; padding: 0 10px 0 14px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.library-search:focus-within { border-color: var(--orange); }
.library-search input { flex: 1; min-width: 0; align-self: stretch; padding: 8px 0; color: var(--ink); border: 0; outline: none; background: transparent; }
.library-search input::-webkit-search-cancel-button { display: none; }
.book-edition { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .79rem; color: var(--muted); }
.association-button { margin-bottom: 15px; }
.book-removal { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.remove-book-button { color: #922b29; background: transparent; padding-inline: 0; }
.remove-book-button:hover { text-decoration: underline; }
[data-book-removal] { margin-top: 4px; padding: 12px; border: 1px solid #eccdc8; border-radius: 8px; background: #f9eeeb; }
[data-book-removal] p { margin-bottom: 8px; }
[data-removal-error] { color: #922b29 !important; }
.destructive { color: white; background: #922b29; }
.destructive:hover { background: #752122; }
.association-title { font-weight: 700; margin-bottom: 6px; }
.association-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.catalog-feedback { margin: 16px 0 6px; font-size: .875rem; }
.catalog-results { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.catalog-results li { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: start; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.catalog-result-cover { display: grid; place-items: center; width: 48px; aspect-ratio: 2 / 3; border-radius: 4px; color: var(--muted); background: #ede9e1; overflow: hidden; }
.catalog-result-cover img { width: 100%; height: 100%; object-fit: contain; }
.catalog-results a { color: var(--ink); overflow-wrap: anywhere; }
.catalog-results p { margin: 3px 0 0; font-size: .82rem; }
.catalog-result-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.catalog-result-actions .button, .catalog-back { min-height: 34px; }
.clear-association { margin-top: 12px; }
@media (max-width: 530px) {
  .association-fields { grid-template-columns: 1fr; }
  .catalog-result-actions .button { white-space: normal; }
}
.field textarea { resize: vertical; }
.feature { position: relative; isolation: isolate; min-height: 270px; display: flex; align-items: center; overflow: hidden; border-radius: 16px; background: radial-gradient(ellipse at 78% 67%, #2c454b 0, #20363c 44%, #182c32 80%); color: #fff9ed; }
.feature::before, .feature::after { content: ""; position: absolute; z-index: -1; pointer-events: none; }
.feature::before { width: min(69%, 774px); aspect-ratio: 1; top: 50%; right: -9%; transform: translateY(-49%); border-radius: 50%; background: repeating-radial-gradient(ellipse at center, transparent 0 42px, #c2d5d619 43px 44px, transparent 45px 62px); mask-image: radial-gradient(circle, #000 35%, #0009 70%, transparent 97%); }
.feature::after { inset: 0; opacity: .3; background-image: url("./assets/grain.png"); }
.feature-content { position: relative; z-index: 1; padding: 28px 0 28px 34px; width: min(58%, 475px); }
.feature-tag { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; color: #f0b79c; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .13em; }
.feature-tag svg { width: 15px; height: 15px; }
.feature h2 { font: 600 clamp(2rem, 4.35vw, 3.45rem)/1.09 var(--serif); margin-bottom: 5px; letter-spacing: -.035em; overflow-wrap: anywhere; }
.feature-author { margin-bottom: 15px; color: #d9e0db; font-size: .9rem; }
.feature-progress { width: min(100%, 285px); margin-bottom: 14px; }
.progress-label { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; color: #e0e7e2; font-size: .8125rem; gap: 5px; }
.progress-track { height: 5px; border-radius: 20px; overflow: hidden; background: #ffffff30; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: #e8a07d; }
.feature .button { background: #faf0e5; color: #273935; }
.feature .button:hover { background: #fffaf2; }
.feature-art { position: absolute; display: grid; place-items: center; width: 47%; top: 0; bottom: 0; right: 2%; pointer-events: none; }
.feature-art .book-cover { width: clamp(116px, 15vw, 157px); transform: rotate(8deg); box-shadow: 15px 21px 31px #071315a8, 3px 1px 0 #ccac874a; }
.feature-art .cover-title { font-size: clamp(1.25rem, 2.3vw, 2rem); }
.feature-star { position: absolute; color: #edb597; opacity: .78; font-size: 1.2rem; }
.star-a { top: 20%; left: 78%; } .star-b { bottom: 23%; left: 17%; font-size: .85rem; } .star-c { bottom: 18%; right: 4%; font-size: .7rem; }
.shelf { margin-top: 29px; }
#featured:empty + .shelf { margin-top: 29px; }
.shelf-heading, .shelf-heading-text, .shelf-actions { display: flex; align-items: center; gap: 10px; }
.shelf-heading { justify-content: space-between; }
.shelf-heading h2 { margin: 0; font: 700 clamp(1.5rem, 2.4vw, 1.95rem)/1.2 var(--serif); letter-spacing: -.025em; }
.count-badge { padding: 2px 8px; border-radius: 20px; background: #ede9e1; color: #625e55; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.sort-control, .layout-options { display: flex; align-items: center; min-height: 37px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: #605f58; }
.sort-control { position: relative; }
.sort-control select { appearance: none; border: 0; background: none; color: inherit; min-height: 35px; padding: 5px 28px 5px 34px; font-size: .875rem; cursor: pointer; }
.sort-control [data-icon] { position: absolute; left: 10px; pointer-events: none; }
.sort-control [data-icon="chevron-down"] { left: auto; right: 9px; }
.sort-control svg { width: 15px; height: 15px; }
.layout-options { padding: 3px; }
.layout-options .icon-button { width: 31px; height: 29px; border-radius: 5px; }
.layout-options svg { width: 16px; height: 16px; }
.layout-options [aria-pressed="true"] { background: var(--orange-light); color: var(--orange); }
.filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 17px; }
.filters button { padding: 5px 12px; border: 1px solid var(--line); border-radius: 7px; color: #605f58; background: var(--surface); font-size: .875rem; }
.filters button:hover { border-color: #cfb8ab; }
.filters [aria-pressed="true"] { border-color: #eacfc3; background: var(--orange-light); color: #933d26; font-weight: 700; }
.book-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 24px 17px; }
.book-card { display: grid; min-width: 0; align-content: start; position: relative; }
.cover-button { position: relative; display: block; padding: 0; border: 0; width: 100%; border-radius: 8px; text-align: left; background: none; }
.cover-button:hover .book-cover { transform: translateY(-3px); box-shadow: 0 7px 16px #24241d30; }
.book-cover { position: relative; isolation: isolate; overflow: hidden; width: 100%; aspect-ratio: .71; border-radius: 6px 8px 8px 6px; color: var(--cover-ink, #fff4dd); background-color: var(--cover-color, #36464a); background-image: var(--cover-art, linear-gradient(150deg, #fff1, transparent 70%)); background-size: var(--cover-size, cover); background-position: var(--cover-position, center); text-align: center; box-shadow: 0 3px 8px #24241d2b; transition: transform .18s ease, box-shadow .18s ease; }
.book-cover::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, #0005, transparent 6%, #fff2 7%, transparent 10%), var(--cover-shade, linear-gradient(#0005, transparent 62%)); }
.book-cover::after { content: ""; position: absolute; inset: 4px; border: 1px solid #fff2; border-radius: 3px; pointer-events: none; }
.cover-type { display: grid; justify-items: center; gap: 5px; padding: 13% 9% 0; }
.cover-title { max-width: 100%; font: 700 clamp(.83rem, 1.7vw, 1.6rem)/1.04 var(--serif); letter-spacing: -.015em; overflow-wrap: anywhere; text-wrap: balance; }
.cover-author { font-size: clamp(.47rem, .67vw, .67rem); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.cover-emblem { position: absolute; top: 58%; left: 50%; transform: translate(-50%, -50%); opacity: .52; }
.cover-emblem svg { width: 40px; height: 40px; }
.book-meta { display: grid; grid-template-columns: minmax(0, 1fr) 25px; align-items: start; margin-top: 10px; }
.book-title { display: block; max-width: 100%; border: none; background: none; padding: 0; text-align: left; font-weight: 700; color: var(--ink); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-title:hover { color: var(--orange); }
.book-author { display: block; margin-top: 2px; font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-meta .icon-button { width: 25px; height: 25px; margin-top: -2px; }
.book-meta svg { width: 17px; height: 17px; }
.book-labels { grid-column: 1/-1; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; margin-top: 7px; }
.book-medium { padding: 1px 6px; border-radius: 4px; background: #ede9e1; color: #544d41; font-size: .79rem; font-weight: 700; white-space: nowrap; }
.book-status { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: .75rem; }
.book-status svg { width: 13px; height: 13px; }
.book-status.reading { color: #9c462e; }
.book-status.completed { color: #42694e; }
.book-grid.list { grid-template-columns: minmax(0, 1fr); gap: 0; }
.list .book-card { grid-template-columns: 54px minmax(0, 1fr); align-items: center; gap: 15px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list .book-meta { margin-top: 0; }
.list .cover-author { display: none; }
.list .cover-title { font-size: .62rem; }
.empty { grid-column: 1/-1; padding: 36px 15px; border: 1px dashed #d8cfc3; border-radius: 12px; text-align: center; color: var(--muted); background: var(--surface); }
.empty p { margin: 0 0 14px; }
dialog { width: min(530px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 18px 70px #15181343; }
dialog::backdrop { background: #20272580; }
dialog.media-dialog { width: min(870px, calc(100% - 28px)); }
.dialog-shell { position: relative; padding: 27px; }
.dialog-close { position: absolute; right: 11px; top: 11px; z-index: 2; }
.dialog-shell h2 { margin: 0 33px 12px 0; font: 700 1.75rem/1.15 var(--serif); overflow-wrap: anywhere; }
.dialog-shell p { color: var(--muted); }
.detail-heading { display: grid; grid-template-columns: 85px minmax(0, 1fr); align-items: center; gap: 18px; margin-bottom: 20px; }
.detail-heading .cover-title { font-size: .85rem; }
.detail-heading .cover-author { font-size: .45rem; }
.detail-heading p { margin: 0; }
.detail-heading .detail-format { margin-top: 6px; color: var(--orange); font-size: .8125rem; font-weight: 700; }
.dialog-form { display: grid; gap: 15px; }
.field { display: grid; gap: 6px; font-size: .875rem; font-weight: 700; }
.field input, .field select, .field textarea { min-width: 0; width: 100%; min-height: 39px; padding: 7px 10px; border: 1px solid #ddd3c8; border-radius: 7px; background: #fff; color: var(--ink); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 5px; }
.dialog-actions .push { margin-right: auto; }
.dialog-shell iframe { width: 100%; height: min(68dvh, 620px); border: 1px solid var(--line); }
.dialog-shell audio { display: block; width: 100%; }
.reader-text { max-height: 59dvh; padding: 20px clamp(12px, 5vw, 55px); overflow: auto; border-radius: 8px; background: #f4eee4; white-space: pre-wrap; overflow-wrap: anywhere; font: 1.13rem/1.8 Georgia, serif; }
.toast { z-index: 10; position: fixed; bottom: 22px; right: 22px; max-width: calc(100% - 44px); background: #233530; color: white; border-radius: 8px; padding: 11px 15px; box-shadow: 0 5px 20px #15181333; }
@media (min-width: 1580px) { .book-grid { gap: 24px; } }
@media (max-width: 1150px) { .app { grid-template-columns: 205px minmax(0, 1fr); } .book-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 800px) {
  .app { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 231px; transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility .2s; }
  .menu-open .sidebar { transform: translateX(0); visibility: visible; }
  .mobile-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 4; border: 0; background: #20272570; }
  .mobile-menu { display: inline-grid; }
  .desktop-path { display: none; }
  .topbar { min-height: 64px; }
  .main { padding-top: 27px; }
  .feature-art .book-cover { width: clamp(104px, 23vw, 151px); }
  .cover-title { font-size: clamp(.85rem, 2.4vw, 1.45rem); }
}
@media (max-width: 530px) {
  .topbar { gap: 8px; padding: 10px 13px; flex-wrap: wrap; }
  .topbar-path { gap: 4px; }
  .topbar-actions { gap: 7px; flex: 1; justify-content: flex-end; }
  .import-extra { display: none; }
  .import-button { padding-inline: 9px; }
  .main { padding-inline: 16px; }
  .intro { margin-bottom: 20px; }
  .feature { min-height: 240px; }
  .feature-content { padding-left: 15px; width: 59%; }
  .feature-art { right: 0; width: 42%; }
  .feature-tag { font-size: .66rem; letter-spacing: .06em; }
  .feature h2 { font-size: clamp(1.4rem, 6vw, 2.1rem); }
  .feature-art .book-cover { width: clamp(78px, 23vw, 115px); }
  .feature-art .cover-title { font-size: clamp(.8rem, 4vw, 1.5rem); }
  .star-a, .star-c { display: none; }
  .shelf-heading { align-items: flex-start; flex-wrap: wrap; }
  .shelf-heading-text { min-height: 37px; }
  .sort-control select { font-size: .8125rem; }
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 10px; }
  .cover-title { font-size: clamp(.76rem, 3vw, 1.2rem); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
.form-note { font-size: .875rem; margin-block: 9px 4px; }
.dialog-form .form-note { margin: 0; }
[data-form-error], #account-error { margin: 0; font-size: .875rem; color: #983d27 !important; }
.import-fields { display: grid; gap: 15px; }
.import-progress progress { width: 100%; accent-color: var(--orange); }
.import-progress p { margin: 4px 0 0; font-size: .875rem; overflow-wrap: anywhere; }
.cover-image { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #252926; }
.detail-series { margin-top: 5px !important; font-size: .875rem; }
.description-block { margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.description-block h3 { margin: 0 0 6px; font: 700 1.22rem/1.3 var(--serif); }
.dialog-shell .book-description { margin: 0; color: var(--ink); font-size: .9375rem; white-space: pre-line; overflow-wrap: anywhere; }
.dialog-shell .description-empty { color: var(--muted); }
.book-source { margin: 8px 0 0; font-size: .8125rem; }
.book-source a { color: var(--orange); }
.catalog-description { margin-top: 9px; font-size: .875rem; }
.catalog-description summary { cursor: pointer; color: var(--orange); }
.catalog-description .book-description { margin-top: 7px; }
.drive-import { display: grid; justify-items: start; gap: 8px; padding: 12px 0; border-block: 1px solid var(--line); }
.drive-import [role="status"] { overflow-wrap: anywhere; }
.author-control select { max-width: 170px; padding-left: 10px; text-overflow: ellipsis; }
@media (max-width: 530px) {
  .shelf-actions { flex-wrap: wrap; }
  .author-control select { max-width: 145px; }
}

.account-button { width: 100%; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; }
.account-button:hover strong { color: var(--orange); }
.account-button .avatar { flex: none; }
.account-button small { overflow-wrap: anywhere; }
#account-error { margin-top: 12px; }
.account-mark { display: inline-grid; place-items: center; margin-bottom: 15px; }
.admin-integration { padding-top: 16px; border-top: 1px solid var(--line); }
.admin-integration h3 { margin: 0; font-size: 1rem; }
.admin-integration [data-settings-status]:empty { display: none; }
.admin-footer { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }

.admin-nav { display: flex; gap: 8px; margin: 16px 0; }
.admin-nav [aria-pressed="true"] { background: var(--orange-light); color: #983d27; border-color: #ead2c7; }
.admin-users-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.admin-users { list-style: none; padding: 0; margin: 8px 0 0; }
.admin-users li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.admin-users li div { min-width: 0; overflow-wrap: anywhere; }
.admin-users small { display: block; color: var(--muted); }
.admin-user-form { margin-top: 12px; }

.navigation a.nav-item { text-decoration: none; }

:root[data-theme="sepia"] {
  --canvas: #f1e4cd;
  --surface: #f8edd9;
  --line: #ded0b7;
  --ink: #423326;
  --muted: #6c5640;
  --orange: #934930;
  --orange-light: #eddbc0;
}
:root[data-theme="sepia"] :is(.field input, .field textarea, .field select, .library-search, .sort-control, .empty, .book-removal) { background-color: var(--surface); }
:root[data-theme="sepia"] :is(.nav-item, .nav-label, .topbar-path) { color: var(--muted); }
:root[data-theme="sepia"] .feature { background: radial-gradient(ellipse at 78% 67%, #70533d 0, #573c2d 55%, #442d22 90%); }
:root[data-theme="sepia"] :is(.icon-button:hover, .nav-item:hover, .secondary:hover) { background-color: var(--orange-light); }
.app-theme-button[aria-pressed="true"], .epub-reader [data-epub-theme][aria-pressed="true"] { color: var(--orange); background: var(--orange-light); }
.detail-heading { position: relative; padding-right: 42px; }
.detail-edit { position: absolute; top: 25px; right: 0; }
.detail-status { margin-top: 5px !important; color: var(--muted); font-size: .8rem; }
.detail-actions { display: flex; margin-top: 16px; }
.detail-actions .button { min-width: 115px; }
[data-book-editor] .association-button { margin-top: 18px; }
dialog.epub-dialog {
  width: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0;
  inset: 0; border: 0; border-radius: 0; overflow: hidden;
  --surface: #fffdfa; --line: #ebdfd0; --ink: #282525; --muted: #67594c; --orange-light: #f6e4d3;
}
dialog.epub-dialog[data-reader-theme="sepia"] {
  --surface: #f3e5cc; --line: #ddcbb0; --ink: #493427; --muted: #6b5340; --orange-light: #eddbc0;
}
.epub-dialog .dialog-shell { height: 100%; padding: 0; background: var(--surface); color: var(--ink); }
.epub-dialog .dialog-shell:fullscreen { width: 100%; height: 100%; background: var(--surface); }
.epub-dialog #modal-content, .epub-reader { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.epub-reader { position: relative; overflow: hidden; }
.epub-dialog .dialog-close { top: 7px; right: max(9px, env(safe-area-inset-right)); }
.epub-reader-toolbar {
  position: absolute; inset: 0 0 auto; z-index: 2; background: var(--surface);
  box-shadow: 0 2px 10px #26170f16;
}
.epub-dialog .dialog-close { z-index: 3; }
.epub-reader-heading {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 7px 51px 7px 12px; border-bottom: 1px solid var(--line);
}
.epub-reader-heading > div { min-width: 0; }
.epub-reader-heading h2 { margin: 0 0 2px; font-size: clamp(1.15rem, 4vw, 1.55rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.epub-reader-heading p { margin: 0; font-size: .8rem; }
.epub-reader-toc { padding: 5px 12px; border-bottom: 1px solid var(--line); }
.epub-reader-toc .field { display: flex; align-items: center; min-width: 0; gap: 8px; font-size: .8rem; }
.epub-reader-toc select { flex: 1; min-width: 0; padding: 3px 8px; min-height: 33px; background: var(--surface); border-color: var(--line); }
.epub-reader-location { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
.epub-reader [data-form-error] { position: absolute; top: 103px; z-index: 3; padding: 5px 12px; background: var(--surface); }
.epub-reader iframe {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%; border: 0;
}
.epub-reader-actions {
  display: flex; align-items: center; justify-content: center; gap: clamp(5px, 3vw, 16px);
  position: absolute; inset: auto 0 0; z-index: 1; background: var(--surface);
  padding: 5px 8px max(5px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
}
.epub-reader-actions span { color: var(--muted); font-size: .78rem; text-align: center; }
.epub-reader-heading .button, .epub-reader-actions .button { min-height: 37px; padding-inline: 10px; }
.epub-reveal {
  position: absolute; bottom: max(6px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 3;
}
.epub-reveal:not(:focus-visible) { clip-path: inset(50%); pointer-events: none; }
.epub-dialog[data-epub-immersive] :is(.dialog-close, .epub-reader-toolbar, .epub-reader-actions) { display: none; }
@media (max-width: 540px) {
  .epub-reader-heading .button svg { display: none; }
  .topbar-path { min-width: 0; }
  #breadcrumb { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}

.topbar[data-importing] { position: sticky; top: 0; z-index: 4; }
.topbar-import-progress { flex: 1 1 240px; max-width: 390px; min-width: 0; }
.topbar-import-progress p {
  margin: 0 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); font-size: .8125rem; font-weight: 600;
}
.topbar-import-progress progress { display: block; width: 100%; height: 6px; accent-color: var(--orange); }
@media (max-width: 700px) {
  .topbar[data-importing] { flex-wrap: wrap; }
  .topbar-import-progress { order: 1; flex-basis: 100%; max-width: none; padding-bottom: 4px; }
}

.bulk-selection { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; padding: 10px 12px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.bulk-select-all { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: .875rem; }
.bulk-selection input, .book-select input { accent-color: var(--orange); }
#selection-count { flex: 1; font-size: .875rem; color: var(--muted); }
.book-select { position: absolute; z-index: 2; top: 6px; left: 6px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; background: var(--surface); box-shadow: 0 1px 5px #19181860; cursor: pointer; }
.book-select input { width: 17px; height: 17px; cursor: pointer; }
.book-selected .cover-button { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 6px; }
.list .book-select { top: 50%; left: 10px; transform: translateY(-50%); }
.bulk-removal-list { margin: 8px 0; padding-left: 22px; overflow-wrap: anywhere; }
