:root {
  color-scheme: light;
  --ink: var(--voima-ink, #3e3e3e);
  --muted: #6d6d6d;
  --orange: var(--voima-orange, #f15025);
  --orange-strong: #ce3a13;
  --line: #e6e6e4;
  --surface: #f6f6f4;
  --sidebar-width: 238px;
  font-family: var(--voima-font, "Gilroy", Helvetica, Arial, sans-serif);
  font-size: 16px;
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: #fff; }
body { margin: 0; color: var(--ink); line-height: 1.5; -webkit-font-smoothing: antialiased; }
body:has(.modal-overlay) { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button { border: 0; background: none; }
a { color: inherit; }
img { max-width: 100%; height: auto; }
svg { display: block; flex: 0 0 auto; width: 20px; height: 20px; }
h1, h2, h3, h4, p { margin-top: 0; }
h1, h2, h3, h4, strong, b { font-weight: 800; }
button:disabled { cursor: wait; opacity: .55; }
:focus-visible { outline: 3px solid #fabc3c; outline-offset: 3px; }
::selection { background: #ffe4d9; color: #252525; }
[hidden], .hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.loading { min-height: 70vh; display: grid; align-content: center; justify-items: center; gap: 18px; color: var(--muted); }
.loading::before { content: ""; display: block; width: 28px; height: 28px; border: 2px solid var(--line); border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.app-layout { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-width); display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #fff; padding: 40px 22px 22px; }
.brand-logo { display: block; width: 144px; height: auto; object-fit: contain; margin: 0 12px; }
.brand-caption { display: block; margin: 22px 12px 35px; color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.nav { display: grid; gap: 7px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 13px; width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 6px; text-align: left; text-decoration: none; color: #666; font-size: .9375rem; transition: background .15s, color .15s; }
.nav-item:hover { background: #f7f7f5; color: var(--ink); }
.nav-item.active { color: var(--orange-strong); background: #fff0e9; font-weight: 800; }
.nav-item.active::before { content: ""; position: absolute; left: -22px; top: 13px; bottom: 13px; width: 3px; background: var(--orange); border-radius: 0 2px 2px 0; }
.nav-icon { display: inline-flex; width: 21px; align-items: center; justify-content: center; font-size: 1.2rem; }
.sidebar-bottom { margin-top: auto; padding-top: 30px; }
.sidebar-bottom > .button { width: 100%; justify-content: flex-start; font-size: .875rem; }
.user-info { display: flex; align-items: center; gap: 11px; border-top: 1px solid var(--line); padding: 22px 7px 8px; margin-top: 16px; min-width: 0; }
.avatar, .author-initials { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 39px; border-radius: 50%; background: #efefed; color: #545454; font-weight: 800; font-size: .875rem; }
.user-name { font-size: .875rem; font-weight: 800; overflow-wrap: anywhere; }
.user-role { font-size: .75rem; color: var(--muted); }
.main { margin-left: var(--sidebar-width); padding: 0 46px 64px; max-width: 1900px; }
.topbar { min-height: 84px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 42px; }
.topbar-title, .breadcrumb { color: #747474; font-size: .8125rem; }
.topbar-title { letter-spacing: .02em; }
.topbar-actions { display: flex; align-items: center; gap: 14px; font-size: .8125rem; color: var(--muted); }
.breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-bottom: 22px; }
.breadcrumb a, .breadcrumb button { color: inherit; text-decoration: none; padding: 0; }
.breadcrumb a:hover, .breadcrumb button:hover { color: var(--orange-strong); }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 7px; color: var(--orange-strong); text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 800; }
.page-title { font-size: clamp(2rem, 3vw, 2.8rem); line-height: 1.12; letter-spacing: -.035em; margin: 0; max-width: 900px; }
.page-description { margin: 12px 0 0; color: var(--muted); font-size: .9375rem; max-width: 680px; }
.header-actions, .inline-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.header-actions { flex-shrink: 0; padding-bottom: 3px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 43px; padding: 10px 18px; border: 1px solid transparent; border-radius: 5px; text-decoration: none; font-size: .875rem; font-weight: 800; line-height: 1.35; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.button.primary { background: var(--orange-strong); color: #fff; border-color: var(--orange-strong); box-shadow: 0 2px 3px #00000006; }
.button.primary:hover { background: #b9310e; border-color: #b9310e; }
.button.secondary { border-color: #d9d9d6; color: var(--ink); background: #fff; }
.button.secondary:hover { border-color: #b8b8b3; background: #fafaf8; }
.button.ghost { color: var(--muted); background: transparent; }
.button.ghost:hover { color: var(--ink); background: #f1f1ee; }
.button.danger { border-color: #edb7b2; color: #a52f28; background: #fff; }
.button.danger:hover { background: #fff1ef; }
.button.small { font-size: .8125rem; min-height: 34px; padding: 7px 11px; }
.button svg { width: 17px; height: 17px; }
.icon-button, .modal-close, .mobile-menu { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 7px; border-radius: 5px; color: #707070; }
.icon-button:hover, .modal-close:hover, .mobile-menu:hover { background: #f0f0ed; color: var(--ink); }
.mobile-menu { display: none; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; margin-bottom: 30px; }
.stat-card { padding: 21px 23px 20px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.stat-label { color: var(--muted); font-size: .8125rem; margin-bottom: 9px; }
.stat-value { font-size: 2rem; line-height: 1.1; font-weight: 800; letter-spacing: -.03em; }
.stat-note { margin-top: 8px; font-size: .75rem; color: #737373; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 0 0 23px; margin-bottom: 2px; }
.search-wrap { position: relative; flex: 1 1 240px; max-width: 420px; }
.search-wrap > svg { position: absolute; left: 13px; top: 13px; width: 17px; height: 17px; color: #8b8b86; pointer-events: none; }
.search-input { width: 100%; min-height: 43px; border: 1px solid #dededb; border-radius: 5px; background: #fff; padding: 10px 14px; font-size: .875rem; }
.search-wrap:has(>svg) .search-input { padding-left: 39px; }
.filter-select, .select, select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23747474' stroke-width='1.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 35px !important; }
.filter-select { min-height: 43px; max-width: 240px; padding: 10px 14px; border: 1px solid #dededb; border-radius: 5px; background-color: #fff; font-size: .875rem; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: 6px; background: #f7f7f5; margin-left: auto; }
.segment { display: inline-flex; gap: 7px; align-items: center; justify-content: center; padding: 7px 11px; min-height: 34px; border-radius: 4px; font-size: .8125rem; color: #797975; }
.segment.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px #00000012; }
.segment svg { width: 17px; height: 17px; }
.muted, .inline-note { color: var(--muted); }
.inline-note { font-size: .8125rem; }
.content { min-width: 0; }

.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 26px; }
.book-card { min-width: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; transition: border-color .18s, box-shadow .18s, transform .18s; text-decoration: none; text-align: left; cursor: pointer; }
.book-card:hover { border-color: #c8c8c3; transform: translateY(-2px); box-shadow: 0 10px 24px #00000007; }
.book-cover { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 1.2; padding: 23px; background: #f3f3f1; overflow: hidden; }
.book-cover img { display: block; max-height: 100%; max-width: 100%; width: auto; object-fit: contain; box-shadow: 3px 8px 13px #00000010; }
.cover-placeholder { width: 116px; height: 158px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 13px; padding: 16px; color: #92928c; background: #e8e8e3; border-left: 4px solid #d9d9d2; border-radius: 1px 3px 3px 1px; box-shadow: 3px 7px 12px #00000005; font-size: .75rem; letter-spacing: .05em; text-align: center; }
.cover-placeholder svg { width: 27px; height: 27px; stroke-width: 1.2; }
.book-copy { padding: 20px 20px 19px; }
.book-title { font-size: 1.125rem; line-height: 1.24; font-weight: 800; margin: 0 0 7px; overflow-wrap: anywhere; }
.book-subtitle { font-size: .8125rem; line-height: 1.45; color: var(--muted); margin: 0 0 10px; }
.book-authors { color: #6e6e69; font-size: .8125rem; margin-bottom: 17px; }
.book-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding-top: 15px; margin-top: 15px; border-top: 1px solid #eeeeeb; font-size: .75rem; color: var(--muted); }
.format-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { display: inline-block; border: 1px solid #e6e6e0; border-radius: 3px; padding: 3px 7px; font-size: .6875rem; font-weight: 800; line-height: 1.4; color: #65655f; background: #fafaf8; }
.badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 4px; padding: 4px 8px; line-height: 1.4; font-size: .75rem; font-weight: 800; white-space: nowrap; }
.badge.green { color: #286347; background: #eaf5ed; }
.badge.amber { color: #88631d; background: #fff3d9; }
.badge.grey { color: #696963; background: #eeeFEB; }
.badge.orange { color: #ad401f; background: #ffede5; }
.badge.red { color: #a03931; background: #feeeeb; }
.pill-count { display: inline-flex; justify-content: center; min-width: 23px; padding: 2px 6px; border-radius: 4px; background: #ecece8; color: #676762; font-size: .75rem; margin-left: 5px; }
.table-wrap { border: 1px solid var(--line); border-radius: 7px; overflow-x: auto; background: #fff; }
.data-table { border-collapse: collapse; width: 100%; text-align: left; font-size: .875rem; white-space: nowrap; }
.data-table th { background: #f8f8f6; padding: 13px 19px; border-bottom: 1px solid var(--line); color: #797973; font-size: .75rem; font-weight: 800; letter-spacing: .02em; }
.data-table td { padding: 17px 19px; border-bottom: 1px solid #eeeee9; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fdfdfb; }
.data-table td:first-child { max-width: 400px; }
.data-table td:has(.table-title) { white-space: normal; min-width: 190px; }
.table-title { display: block; font-weight: 800; color: var(--ink); text-decoration: none; text-align: left; padding: 0; font-size: .875rem; }
.table-title:hover { color: var(--orange-strong); }
.table-secondary { display: block; margin-top: 4px; color: var(--muted); font-size: .75rem; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.isbn-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8125rem; letter-spacing: -.02em; white-space: nowrap; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 320px; padding: 54px 30px; border: 1px dashed #d9d9d4; border-radius: 8px; background: #fdfdfc; text-align: center; }
.empty-icon { display: flex; align-items: center; justify-content: center; width: 66px; height: 66px; background: #f0f0ec; color: #8e8e85; border-radius: 50%; margin-bottom: 21px; }
.empty-icon svg { width: 28px; height: 28px; stroke-width: 1.5; }
.empty-title { margin: 0 0 10px; font-size: 1.3rem; font-weight: 800; }
.empty-copy { max-width: 440px; color: var(--muted); font-size: .9375rem; margin: 0 0 23px; }

.panel { border: 1px solid var(--line); border-radius: 7px; background: #fff; min-width: 0; overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 21px 24px; border-bottom: 1px solid var(--line); }
.panel-title { font-size: 1rem; line-height: 1.3; margin: 0; font-weight: 800; }
.panel-body { padding: 23px 24px; }
.details-grid { display: grid; grid-template-columns: minmax(0, 1fr) 270px; align-items: start; gap: 28px; }
.detail-main { display: grid; gap: 27px; min-width: 0; }
.detail-aside { display: grid; gap: 23px; min-width: 0; }
.book-detail-cover { display: flex; align-items: center; justify-content: center; min-height: 250px; padding: 28px; border: 1px solid var(--line); border-radius: 7px; background: #f4f4f1; }
.book-detail-cover img { display: block; max-height: 330px; max-width: 100%; object-fit: contain; box-shadow: 4px 9px 18px #00000015; }
.book-detail-cover .cover-placeholder { width: 150px; height: 205px; }
.detail-section { padding: 23px 0; border-top: 1px solid var(--line); }
.detail-section:first-child { padding-top: 0; border-top: 0; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 1.125rem; font-weight: 800; margin: 0 0 20px; }
.kv-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 32px; }
.kv { min-width: 0; }
.kv-label { color: var(--muted); font-size: .75rem; margin-bottom: 5px; }
.kv-value { font-size: .9375rem; overflow-wrap: anywhere; white-space: pre-line; }
.format-list { display: grid; gap: 14px; }
.format-card { border: 1px solid var(--line); border-radius: 6px; padding: 20px 22px; background: #fff; }
.format-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; font-weight: 800; }
.format-heading > .button, .format-heading > .icon-button { margin-left: auto; }
.format-info { display: flex; flex-wrap: wrap; gap: 16px 30px; color: var(--muted); font-size: .8125rem; }
.format-info .kv-value { color: var(--ink); font-size: .875rem; }
.text-link { color: var(--orange-strong); font-weight: 800; text-decoration: none; font-size: inherit; padding: 0; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.author-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 18px; }
.author-card { padding: 25px; border: 1px solid var(--line); border-radius: 7px; min-width: 0; transition: border-color .15s; }
.author-card:hover { border-color: #c9c9c3; }
.author-initials { width: 48px; height: 48px; font-size: 1rem; margin-bottom: 17px; background: #f1f0ec; }
.author-name { font-size: 1.125rem; font-weight: 800; margin: 0 0 10px; overflow-wrap: anywhere; }
.author-contact { font-size: .875rem; color: var(--muted); overflow-wrap: anywhere; }
.author-contact a { text-decoration: none; }
.author-contact a:hover { color: var(--orange-strong); }
.settings-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 25px; align-items: start; }
.preset-list { display: grid; }
.preset-item { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 17px 0; border-bottom: 1px solid #eeeee9; }
.preset-item:first-child { padding-top: 0; }
.preset-item:last-child { border: 0; padding-bottom: 0; }
.preset-item strong { display: block; font-size: .875rem; }
.preset-item p { margin: 5px 0 0; color: var(--muted); font-size: .8125rem; }
.notice { border: 1px solid #dee4e6; background: #f5f8fa; color: #4b616b; border-radius: 5px; padding: 15px 18px; font-size: .875rem; line-height: 1.55; margin: 0 0 22px; }
.notice p:last-child { margin-bottom: 0; }
.notice.info { border-color: #dbe4e8; background: #f5f8fa; color: #4d6571; }
.notice.warning { border-color: #f0dba8; background: #fffbf0; color: #7c652e; }
.notice.success { border-color: #cde2d3; background: #f1f8f2; color: #396448; }
.notice.error { border-color: #ebc6be; background: #fff4f0; color: #9b392c; }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, .88fr) minmax(440px, 1.12fr); background: #fff; }
.auth-brand { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; position: relative; min-height: 100vh; background: #f5f5f2; padding: clamp(40px,7vw,110px); overflow: hidden; }
.auth-brand::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--voima-accent-gradient,linear-gradient(150deg,#f15025,#fabc3c)); }
.auth-brand .brand-logo { width: 195px; margin: 0 0 55px; mix-blend-mode: multiply; }
.auth-brand h1 { font-size: clamp(2.5rem,4.4vw,4.75rem); line-height: 1.06; letter-spacing: -.045em; max-width: 550px; margin: 0 0 25px; }
.auth-brand h1 span { color: var(--orange); }
.auth-brand p { max-width: 360px; color: #73736d; font-size: 1rem; line-height: 1.65; }
.auth-panel { align-self: center; justify-self: center; width: min(100%,470px); padding: 50px 40px; }
.auth-title { font-size: 2rem; line-height: 1.2; letter-spacing: -.03em; margin-bottom: 13px; }
.auth-description { color: var(--muted); font-size: .9375rem; margin-bottom: 31px; }
.auth-panel .form-actions { padding-top: 8px; border: 0; margin-top: 10px; }
.auth-panel .form-actions .button { width: 100%; }
.auth-panel .brand-logo { display: none; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px 22px; }
.form-grid.one { grid-template-columns: minmax(0,1fr); }
.field { display: flex; flex-direction: column; min-width: 0; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.field-label, .field > label { font-size: .8125rem; font-weight: 800; color: #555550; }
.field-help { color: var(--muted); font-size: .75rem; line-height: 1.5; margin: 0; }
.input, .textarea, .select { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid #d7d7d1; border-radius: 5px; background-color: #fff; font-size: .9375rem; line-height: 1.4; transition: border-color .15s, box-shadow .15s; }
.input:hover, .textarea:hover, .select:hover, .search-input:hover { border-color: #bdbdb6; }
.input:focus, .textarea:focus, .select:focus, .search-input:focus, .filter-select:focus { border-color: #e27c5d; outline: 0; box-shadow: 0 0 0 3px #f1502510; }
.input[readonly], .input:disabled, .select:disabled { color: #77776e; background-color: #f5f5f1; cursor: default; }
.input::placeholder, .textarea::placeholder, .search-input::placeholder { color: #92928b; }
.textarea { min-height: 105px; resize: vertical; }
.checkbox-field { display: flex; align-items: center; gap: 10px; min-height: 28px; font-size: .875rem; cursor: pointer; }
.checkbox-field input[type=checkbox], .author-choice input[type=checkbox] { width: 17px; height: 17px; margin: 0; accent-color: var(--orange-strong); flex: 0 0 auto; cursor: pointer; }
.form-section { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.form-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-section-title { font-size: 1rem; font-weight: 800; margin: 0 0 18px; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 28px; border-top: 1px solid var(--line); padding-top: 22px; }
.form-error { border-radius: 4px; background: #fff0ea; color: #9a3724; font-size: .875rem; padding: 12px 15px; margin-top: 17px; }
.form-error:empty { display: none; }
.cover-upload { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; padding: 17px; border: 1px dashed #d8d8d1; border-radius: 5px; background: #fcfcfa; }
.cover-preview { display: flex; align-items: center; justify-content: center; width: 68px; height: 88px; background: #eeeee8; border-radius: 3px; color: #8b8b80; overflow: hidden; }
.cover-preview img { width: 100%; height: 100%; object-fit: contain; }
.cover-upload input[type=file] { width: 100%; max-width: 300px; font-size: .8125rem; }
.author-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px 12px; max-height: 220px; overflow-y: auto; padding: 9px; border: 1px solid #deded7; border-radius: 5px; }
.author-choice { display: flex; gap: 8px; align-items: center; font-size: .875rem; padding: 7px; cursor: pointer; border-radius: 4px; }
.author-choice:hover { background: #f5f5f1; }
.selected-authors { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.selected-author { display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 14px; background: #f4f4ef; border-radius: 4px; font-size: .8125rem; }
.selected-author > span:first-child { flex: 1; }
.selected-author .icon-button { width: 27px; height: 27px; padding: 5px; }
.stepper { display: flex; align-items: center; gap: 4px; }
.code-block { display: block; white-space: pre-wrap; word-break: break-all; padding: 15px; background: #f4f4ef; border: 1px solid var(--line); border-radius: 5px; font: .8125rem/1.6 ui-monospace,SFMono-Regular,Menlo,monospace; user-select: all; }

.modal-overlay { position: fixed; inset: 0; z-index: 100; background: #25252560; backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 28px; overflow-y: auto; }
.modal { width: min(100%,560px); max-height: calc(100dvh - 56px); display: flex; flex-direction: column; background: #fff; border-radius: 10px; box-shadow: 0 24px 90px #00000026; overflow: hidden; }
.modal.wide { width: min(100%,800px); }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 30px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.modal-title { margin: 0; font-size: 1.4rem; letter-spacing: -.025em; line-height: 1.25; font-weight: 800; }
.modal-close { flex: 0 0 34px; width: 34px; height: 34px; font-size: 1.6rem; }
.modal-body { overflow-y: auto; overscroll-behavior: contain; padding: 27px 30px 30px; min-height: 0; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 18px 30px; border-top: 1px solid var(--line); background: #fdfdfb; }
.modal-body > form > .form-actions { margin-bottom: 0; }
.toast-region { position: fixed; bottom: 25px; right: 27px; z-index: 200; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; pointer-events: none; max-width: min(430px,calc(100vw - 32px)); }
.toast { padding: 14px 19px; border-radius: 6px; background: #333a33; color: #fff; box-shadow: 0 7px 26px #0000001a; font-size: .875rem; line-height: 1.45; animation: toast-in .2s ease-out; pointer-events: auto; }
.toast.error { background: #9c3a2b; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.skeleton { border-radius: 5px; background: linear-gradient(100deg,#f0f0ec 20%,#f8f8f5 50%,#f0f0ec 80%); background-size: 200% 100%; animation: shimmer 1.5s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (min-width: 1650px) {
  .main { padding-left: 64px; padding-right: 64px; }
  .book-grid { grid-template-columns: repeat(auto-fill,minmax(250px,1fr)); gap: 30px; }
}
@media (max-width: 1160px) {
  :root { --sidebar-width: 210px; }
  .sidebar { padding-left: 17px; padding-right: 17px; }
  .nav-item.active::before { left: -17px; }
  .main { padding-left: 29px; padding-right: 29px; }
  .page-header { align-items: flex-start; }
  .header-actions { justify-content: flex-end; max-width: 240px; }
  .stats-grid { gap: 12px; }
  .stat-card { padding: 18px; }
  .details-grid { grid-template-columns: minmax(0,1fr) 220px; gap: 22px; }
  .settings-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .details-grid { grid-template-columns: minmax(0,1fr); }
  .detail-aside { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
  .book-detail-cover { min-height: 220px; }
  .book-detail-cover img { max-height: 250px; }
  .book-grid { grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap: 18px; }
  .auth-brand { padding: 40px; }
  .auth-page { grid-template-columns: .9fr 1.1fr; }
  .auth-brand h1 { font-size: 2.7rem; }
}
@media (max-width: 700px) {
  .sidebar { width: 250px; transform: translateX(-100%); transition: transform .2s ease-out; box-shadow: 5px 0 30px #00000010; }
  body.menu-open .sidebar { transform: translateX(0); }
  body.menu-open::before { content: ""; position: fixed; inset: 0; background: #00000035; z-index: 35; }
  .main { margin-left: 0; padding: 0 20px 40px; }
  .topbar { min-height: 69px; margin-bottom: 29px; gap: 10px; }
  .mobile-menu { display: inline-flex; margin-left: -7px; }
  .topbar-title { margin-right: auto; }
  .topbar-actions { gap: 6px; }
  .topbar-actions > .muted { display: none; }
  .page-header { gap: 15px; margin-bottom: 25px; flex-wrap: wrap; }
  .page-title { font-size: 2.05rem; }
  .page-description { margin-top: 10px; font-size: .875rem; }
  .header-actions { max-width: none; width: 100%; justify-content: flex-start; }
  .stats-grid { gap: 10px; margin-bottom: 23px; }
  .stat-card { padding: 16px; }
  .stat-value { font-size: 1.8rem; }
  .stat-note { font-size: .6875rem; }
  .toolbar { gap: 9px; }
  .search-wrap { max-width: none; flex-basis: 100%; }
  .filter-select { flex: 1; min-width: 120px; max-width: none; }
  .segmented { margin-left: 0; }
  .book-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
  .book-cover { aspect-ratio: .95; padding: 19px; }
  .book-copy { padding: 15px 13px; }
  .book-title { font-size: 1rem; }
  .book-authors { margin-bottom: 12px; font-size: .75rem; }
  .book-subtitle { font-size: .75rem; }
  .book-meta { gap: 5px; margin-top: 11px; padding-top: 11px; }
  .cover-placeholder { width: 91px; height: 127px; }
  .badge { font-size: .6875rem; padding: 4px 6px; }
  .tag { padding: 2px 4px; font-size: .625rem; }
  .data-table td, .data-table th { padding-left: 14px; padding-right: 14px; }
  .panel-header { padding: 19px 20px; }
  .panel-body { padding: 21px 20px; }
  .format-card { padding: 17px; }
  .format-info { gap: 16px 23px; }
  .detail-aside { grid-template-columns: minmax(0,1fr); }
  .book-detail-cover { min-height: 240px; }
  .book-detail-cover img { max-height: 250px; }
  .kv-grid { gap: 19px 20px; }
  .auth-page { display: flex; min-height: 100dvh; align-items: center; justify-content: center; border-top: 5px solid var(--orange); }
  .auth-brand { display: none; }
  .auth-panel { padding: 40px 27px; }
  .auth-panel .brand-logo { display: block; width: 165px; margin: 0 0 45px; }
  .auth-title { font-size: 1.85rem; }
  .auth-description { margin-bottom: 27px; }
  .modal-overlay { padding: 12px; align-items: center; }
  .modal { max-height: calc(100dvh - 24px); border-radius: 8px; }
  .modal-header { padding: 19px 20px; }
  .modal-title { font-size: 1.2rem; }
  .modal-body { padding: 23px 20px; }
  .modal-footer { padding: 16px 20px; }
  .form-grid { grid-template-columns: minmax(0,1fr); gap: 18px; }
  .form-actions { gap: 8px; }
  .author-choices { grid-template-columns: minmax(0,1fr); }
  .toast-region { bottom: 17px; right: 16px; }
}
@media (max-width: 390px) {
  .main { padding-left: 15px; padding-right: 15px; }
  .book-grid { grid-template-columns: minmax(0,1fr); }
  .book-cover { aspect-ratio: 1.45; }
  .book-copy { padding: 19px; }
  .kv-grid { grid-template-columns: minmax(0,1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
  .sidebar, .topbar, .header-actions, .toolbar, .toast-region, .modal-overlay, .table-actions, .button { display: none !important; }
  .main { margin: 0; padding: 0; }
  .book-card, .format-card, .panel, .author-card { break-inside: avoid; box-shadow: none; }
  .table-wrap { overflow: visible; }
  body { font-size: 11pt; }
}

/* Bindings for the application renderer. */
.brand-link { display: block; text-decoration: none; }
.nav-item .pill-count { margin-left: auto; }
.sidebar-site { display: inline-block; margin: 0 7px; font-size: .8125rem; }
.user-info > div { flex: 1; min-width: 0; }
.user-info .icon-button { flex: 0 0 30px; width: 30px; }
.topbar > .breadcrumb { margin: 0; }
.button.icon-button { min-height: 36px; flex: 0 0 36px; padding: 7px; }
.stat-label, .stat-value, .stat-note { display: block; }
.book-open { display: flex; flex-direction: column; align-items: stretch; width: 100%; height: 100%; min-width: 0; padding: 0; border: 0; background: transparent; text-align: left; }
.book-open:focus-visible { outline-offset: -4px; border-radius: 7px; }
.cover-placeholder-line { display: block; width: 23px; height: 2px; flex: 0 0 2px; background: #b5b5aa; }
.cover-placeholder > span:not(.cover-placeholder-line) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; overflow: hidden; overflow-wrap: anywhere; font-weight: 800; line-height: 1.3; letter-spacing: -.01em; color: #74746a; }
.cover-placeholder > small { margin-top: auto; font-size: .5rem; letter-spacing: .12em; line-height: 1.3; }
.book-open .book-copy { display: flex; flex: 1; flex-direction: column; }
.book-open .book-copy > .book-meta { margin-top: auto; padding-top: 14px; padding-bottom: 11px; }
.book-open .book-copy > .book-meta:empty { display: none; }
.text-button { background: none; border: 0; padding: 0; text-align: left; line-height: inherit; }
.detail-back { margin: -17px 0 17px -11px; }
.kv-grid { margin: 0; }
.kv dt, .kv dd { margin-left: 0; }
.format-heading h3 { margin: 0 0 8px; font-size: 1rem; }
.format-info p { color: var(--ink); margin: 3px 0 0; }
.format-info .kv-label { display: block; }
.format-info .isbn-code + .badge { margin-top: 7px; }
.format-card > .inline-actions:not(:empty) { padding-top: 18px; margin-top: 17px; border-top: 1px solid #eeeee9; }
.author-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.author-contact { display: flex; flex-direction: column; gap: 3px; }
.author-book-links { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; margin-top: 16px; }
.author-book-links:empty { display: none; }
.author-book-links .button { white-space: normal; text-align: left; padding: 4px 0; min-height: 0; justify-content: flex-start; }
.settings-users { grid-column: 1 / -1; }
.panel > .preset-list { padding: 21px 24px; }
.preset-item .muted { font-size: .8125rem; margin-top: 4px; }
.preset-item small { display: block; margin-top: 5px; font-size: .75rem; color: var(--muted); }
.stack-actions { display: flex; flex-direction: column; gap: 9px; }
.stack-actions .button { width: 100%; white-space: normal; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .875rem; }
.auth-submit { width: 100%; margin-top: 25px; min-height: 46px; }
.auth-help { margin-top: 25px; padding-top: 22px; border-top: 1px solid var(--line); }
.auth-page:not(:has(.auth-brand)) { display: flex; justify-content: center; align-items: center; }
.auth-page:not(:has(.auth-brand)) .auth-panel .brand-logo { display: block; margin: 0 0 38px; }
.selected-author > .stepper:first-child { flex: 0 0 18px; color: #828279; }
.selected-author > .stepper + span { flex: 1; }
@media (max-width: 700px) {
  .panel > .preset-list { padding: 21px 20px; }
  .settings-users .panel-header { align-items: flex-start; flex-wrap: wrap; }
  .topbar-actions > .topbar-title { display: none; }
  .selected-author { flex-wrap: wrap; }
  .selected-author > .inline-actions { margin-left: 26px; }
}

/* Keep frequently used labels readable in every viewport. */
.badge, .field-label, .field > label, .filter-select, .tag, .data-table th { font-size: .875rem; }
body.modal-open { overflow: hidden; }
