:root {
  --navy: #12355b;
  --navy-dark: #0b2542;
  --blue: #2f6f9f;
  --blue-soft: #eaf2f7;
  --ink: #162333;
  --muted: #657181;
  --line: #d9e0e6;
  --surface: #ffffff;
  --surface-soft: #f6f8fa;
  --border: #d9e0e6;
  --background: #f4f7f9;
  --danger: #a62b2b;
  --success: #176b4a;
  --radius: 14px;
  --topbar-height: 68px;
  --sticky-filter-height: 0px;
  --sticky-bulk-height: 0px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--background); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { margin: 0; line-height: 1.18; }
h1 { font-size: clamp(1.65rem, 3vw, 2.35rem); letter-spacing: -.035em; }
h2 { font-size: 1.1rem; }
p { line-height: 1.55; }

.topbar { min-height: 68px; padding: 10px max(18px, calc((100vw - 1380px) / 2)); background: var(--navy-dark); color: white; display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: 0; z-index: 20; box-shadow: 0 4px 18px rgba(7, 26, 46, .16); }
.brand { color: white; display: flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 39px; height: 39px; border-radius: 11px; display: grid; place-items: center; background: #edf5fa; color: var(--navy); font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand small { color: #b9cad8; margin-top: 1px; }
.topbar nav { display: flex; align-items: center; gap: 4px; }
.topbar nav a, .link-button { color: #eaf1f6; font: inherit; font-weight: 600; }
.topbar nav a { padding: 9px 8px; border-radius: 8px; }
.topbar nav a:hover { background: rgba(255, 255, 255, .1); text-decoration: none; }
.topbar nav a.active { background: #edf5fa; color: var(--navy-dark); box-shadow: inset 0 -3px 0 #62a5d0; }
.link-button { border: 0; background: transparent; padding: 0; cursor: pointer; }
.nav-toggle { display: none; align-items: center; justify-content: space-between; gap: 10px; font-weight: 800; }

.container { width: min(1380px, calc(100% - 32px)); margin: 34px auto 70px; }
.auth-shell { min-height: 90vh; display: grid; place-items: center; }
.auth-card { width: min(430px, 100%); padding: 34px; }
.public-shell { width: min(860px, calc(100% - 32px)); margin-top: 42px; }
.public-page { display: grid; gap: 18px; }
.public-hero, .public-section { padding: clamp(24px, 5vw, 42px); }
.public-hero { background: linear-gradient(145deg, #fff 0%, #edf5fa 100%); }
.public-hero h1 { color: var(--navy-dark); }
.public-hero .lead { max-width: 690px; color: #405164; font-size: 1.08rem; }
.public-section h2 { color: var(--navy); margin-bottom: 10px; }
.public-section h3 { margin: 24px 0 7px; font-size: 1rem; }
.public-section p, .public-section li { line-height: 1.65; }
.public-section ul { padding-left: 21px; }
.public-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.public-contact { font-style: normal; line-height: 1.65; }
.site-footer { width: min(1380px, calc(100% - 32px)); margin: 0 auto 28px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); display: flex; justify-content: space-between; gap: 18px; font-size: .86rem; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 15px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.eyebrow { color: var(--blue); font-size: .75rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; margin: 0 0 7px; }
.muted { color: var(--muted); }

.card { background: var(--surface); border: 1px solid #e1e7ec; border-radius: var(--radius); box-shadow: 0 8px 26px rgba(17, 44, 69, .06); }
.form-card { padding: 24px; }
.stack { display: grid; gap: 20px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 22px; }
.stat { color: inherit; padding: 20px; display: grid; gap: 9px; }
.stat:hover { border-color: #aac5d8; text-decoration: none; }
.stat span { color: var(--muted); }
.stat strong { color: var(--navy); font-size: 1.55rem; }
.stat-active { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(47, 111, 159, .14); }
.catalogue-stat-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.inbox-quality-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.silver-kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.silver-line-card { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.silver-allocation-card { grid-template-columns: minmax(260px, 3fr) minmax(180px, 1fr) auto; }

.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; gap: 7px; border: 1px solid #b9c6d0; border-radius: 9px; background: white; color: var(--ink); font: inherit; font-weight: 700; padding: 8px 15px; cursor: pointer; }
.button:hover { text-decoration: none; border-color: #7f95a5; }
.button-primary { background: var(--navy); border-color: var(--navy); color: white; }
.button-primary:hover { background: #17466f; }
.button-danger { background: var(--danger); border-color: var(--danger); color: white; }
.button:disabled { cursor: not-allowed; opacity: .48; }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; align-items: center; }
.actions-left { justify-content: flex-start; }
.sticky-actions { position: sticky; bottom: 12px; background: rgba(244, 247, 249, .94); padding: 12px; border-radius: 12px; backdrop-filter: blur(7px); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 18px; }
.form-grid label, .stack > label, .line-field { display: grid; gap: 6px; color: #344252; font-size: .86rem; font-weight: 700; }
.span-2 { grid-column: span 2; }
input, select, textarea { width: 100%; border: 1px solid #bfcbd4; border-radius: 8px; background: white; color: var(--ink); font: inherit; padding: 10px 11px; min-height: 42px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(47, 111, 159, .16); border-color: var(--blue); }
input[type="checkbox"] { width: 20px; min-height: 20px; }
.checkbox-row { display: flex !important; align-items: flex-start; gap: 10px; }
.checkbox-row > input { flex: 0 0 auto; margin-top: 2px; }
.checkbox-row > span { display: grid; gap: 4px; }
.errorlist { color: var(--danger); list-style: none; padding: 0; margin: 0; font-size: .8rem; }

.line-list { display: grid; gap: 10px; }
.line-card { display: grid; grid-template-columns: 1fr 3fr .75fr 1fr .75fr 1fr auto; gap: 10px; align-items: end; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fafcfd; }
.line-DELETE { align-self: center; }
.line-DELETE label { display: inline-flex; }
.field-muted { opacity: .48; }
.tax-help { margin-top: 14px; }

.table-wrap { overflow-x: auto; }
.list-table-wrap { max-height: none; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead { display: table-header-group; }
th, td { text-align: left; padding: 13px 15px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #526170; font-size: .77rem; text-transform: uppercase; letter-spacing: .05em; background: #f8fafb; }
.sort-link { display: inline-flex; align-items: center; gap: 7px; color: inherit; font-weight: 800; white-space: nowrap; }
.sort-link:hover { color: var(--navy); text-decoration: none; }
.sort-link.active { color: var(--navy); }
.sort-indicator { min-width: 1em; color: #8795a2; font-size: .75rem; }
.sort-link.active .sort-indicator { color: var(--blue); }
th.number .sort-link { justify-content: flex-end; width: 100%; }
tbody tr:last-child td { border-bottom: 0; }
.number { text-align: right; white-space: nowrap; }
.empty { color: var(--muted); text-align: center; padding: 35px; }
.totals { margin-left: auto; width: min(390px, 100%); padding: 18px; display: grid; gap: 8px; }
.totals > div { display: flex; justify-content: space-between; gap: 20px; }
.grand-total { border-top: 1px solid var(--ink); padding-top: 10px; color: var(--navy); font-size: 1.05rem; }

.badge { display: inline-flex; align-items: center; border-radius: 999px; background: #edf1f4; color: #4c5b68; font-size: .76rem; font-weight: 800; padding: 5px 9px; }
.badge-final { background: #e4f3ec; color: var(--success); }
.badge-cancelled { background: #f8e9e9; color: var(--danger); }
.badge-imported { background: #e7eef8; color: #28527a; }
.badge-warning { background: #fff2cf; color: #76510d; }
.badge-error { background: #f8e9e9; color: var(--danger); }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs a { color: #475665; padding: 8px 13px; border-radius: 8px; font-weight: 700; }
.tabs a.active { background: var(--navy); color: white; }
.subnav { display: flex; align-items: center; gap: 7px; margin: -6px 0 14px; padding: 7px; overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; background: white; }
.subnav a { color: #475665; padding: 9px 14px; border-radius: 8px; font-weight: 800; white-space: nowrap; }
.subnav a.active { color: white; background: var(--navy); }
.year-tabs { margin-bottom: 20px; }
.search { display: flex; gap: 9px; margin-bottom: 14px; max-width: 590px; }
.filter-bar { display: flex; align-items: end; flex-wrap: wrap; gap: 11px; margin-bottom: 14px; padding: 13px; }
.sticky-filter { position: sticky; top: calc(var(--topbar-height) + 8px); z-index: 15; box-shadow: 0 9px 24px rgba(17, 44, 69, .12); }
.filter-toggle { display: none; }
.filter-bar label { display: grid; gap: 5px; min-width: 145px; color: #344252; font-size: .78rem; font-weight: 800; }
.filter-bar select, .filter-bar input { min-height: 40px; padding: 8px 10px; }
.filter-grow { flex: 1 1 250px; }
.filter-explanation { margin: -4px 0 12px; color: var(--muted); font-size: .86rem; }
.list-result-summary { margin: 0 0 10px; color: #344252; text-align: right; }
.list-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 10px; color: #344252; }
.page-size-links { display: inline-flex; align-items: center; gap: 7px; }
.page-size-links a { min-width: 34px; border-radius: 7px; padding: 5px 8px; color: var(--ink); font-weight: 800; text-align: center; }
.page-size-links a.active { background: var(--navy); color: white; }
.purchase-finalize-box { display: grid; justify-items: end; gap: 8px; }
.watch-add-form { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(180px, 1fr) auto; align-items: end; gap: 12px; }
.watch-add-form label { display: grid; gap: 6px; color: #344252; font-size: .86rem; font-weight: 700; }
.price-watch-stats { margin-top: 0; }
.padded-heading { padding: 20px 24px 0; }
.list-filter-gap { margin-top: 18px; }
.bulk-actions { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 15px; border-bottom: 1px solid var(--line); }
.bulk-actions span { color: var(--muted); font-weight: 700; }
.summary-strip { display: flex; justify-content: space-between; gap: 18px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.transfer-filter { margin: 0; border-top: 1px solid var(--line); border-radius: 0; }
.transfer-bulk-actions { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 15px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); }
.transfer-bulk-actions span { color: var(--muted); font-weight: 700; }
.bulk-expense-actions { flex-wrap: wrap; align-items: end; }
.selection-summary { display: grid; gap: 3px; min-width: 112px; }
.selection-summary small { color: var(--muted); font-weight: 700; }
.bulk-booking-controls { display: flex; flex: 1 1 610px; align-items: end; gap: 10px; }
.bulk-booking-controls label { display: grid; flex: 1 1 190px; gap: 5px; color: #344252; font-size: .76rem; font-weight: 800; }
.bulk-booking-controls select { min-height: 40px; padding: 7px 9px; }
.silver-lot-list { gap: 30px; }
.silver-line-card { display: grid; grid-template-columns: 1fr; gap: 0; padding: 0; overflow: hidden; border: 2px solid #afc2d1; box-shadow: 0 12px 28px rgba(17, 44, 69, .11); }
.silver-lot-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 18px; border-bottom: 1px solid #b9ccd9; background: #eaf2f7; }
.silver-lot-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.silver-lot-heading strong { color: var(--navy-dark); }
.silver-lot-number { display: inline-flex; align-items: center; border-radius: 999px; background: var(--navy); color: #fff; font-size: .78rem; font-weight: 800; padding: 6px 10px; }
.silver-delete-choice { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #d6a5a5; border-radius: 9px; background: #fff; color: var(--danger); font-size: .82rem; font-weight: 800; padding: 8px 11px; cursor: pointer; }
.silver-delete-choice input { width: 18px; min-height: 18px; margin: 0; accent-color: var(--danger); }
.silver-delete-status { margin: 0; padding: 12px 18px; border-bottom: 1px solid #e1baba; background: #fff0f0; color: #7b2020; font-weight: 750; }
.silver-line-card.is-marked-for-deletion { border-color: #d39b9b; }
.silver-line-card.is-marked-for-deletion .silver-lot-header { border-bottom-color: #d9aaaa; background: #f8e5e5; }
.silver-line-card.is-marked-for-deletion .silver-lot-content { opacity: .42; pointer-events: none; }
.silver-entry-group { padding: 18px; border-bottom: 1px solid var(--line); }
.silver-entry-group:last-of-type { border-bottom: 0; }
.silver-group-heading { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.silver-group-heading > span { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 29px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 800; }
.silver-group-heading h3, .silver-group-heading p { margin: 0; }
.silver-group-heading p { color: var(--muted); font-size: .88rem; }
.catalog-search-help { margin: -2px 0 14px; color: #43586b; font-size: .88rem; }
.catalog-picker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.catalog-picker { display: grid; align-content: start; gap: 9px; padding: 14px; border: 1px solid #cad6df; border-radius: 10px; background: #f8fafc; }
.catalog-picker label { display: grid; gap: 6px; color: #344252; font-size: .86rem; font-weight: 700; }
.catalog-picker select[size]:not([size="1"]) { min-height: 118px; padding: 5px; }
.catalog-search-status { min-height: 20px; margin: 0; color: var(--blue); font-size: .8rem; font-weight: 750; }
.catalog-search-status.no-results { color: var(--danger); }
.silver-material-grid { margin-top: 16px; }
.compact-grid { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
.field-link { display: inline-block; margin-top: 5px; font-size: .8rem; }
.catalog-selection-warning { margin: 14px 0 0; }
.quantity-summary { margin-top: 14px; padding: 12px 14px; border-radius: 9px; background: #eef5fb; color: #173f65; font-weight: 750; }
.material-calculation { margin-top: 9px; padding: 12px 14px; border: 1px solid #bdd8cb; border-radius: 9px; background: #eef8f3; color: #18583f; font-size: .88rem; font-weight: 700; line-height: 1.45; }
.theoretical-confirm { display: flex; align-items: flex-start; gap: 9px; margin-top: 12px; padding: 11px 13px; border-radius: 9px; background: #fff4d8; }
.theoretical-confirm input { width: auto; margin-top: 3px; }
.silver-advanced { padding: 15px 18px 18px; background: #f8fafc; }
.silver-advanced summary { cursor: pointer; color: var(--navy); font-weight: 800; }
.silver-advanced[open] summary { margin-bottom: 12px; }
.pagination-summary { justify-content: flex-end; flex-wrap: wrap; }
.select-cell { width: 48px; text-align: center; }
.select-cell input { width: 19px; min-height: 19px; margin: 0; }
.match-cell { min-width: 210px; }
.match-cell small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.45; }
.payment-match-cell { min-width: 210px; }
.payment-match-cell small { display: block; margin-top: 5px; color: var(--muted); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.pagination span { color: var(--muted); font-weight: 700; }

.alert { border-radius: 9px; padding: 12px 15px; margin-bottom: 12px; border: 1px solid #c8d8e5; background: var(--blue-soft); }
.alert-error { color: #7b2020; background: #faeaea; border-color: #e6baba; }
.alert-success { color: #155b41; background: #e7f5ee; border-color: #b8decf; }
.alert-warning { color: #6e4c12; background: #fff6dc; border-color: #ead293; }
.alert-info { color: #214f71; }
.messages { margin-bottom: 18px; }
.auth-links { margin: 0; text-align: center; }
.security-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.security-codes code { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafb; color: var(--navy-dark); font-size: 1rem; font-weight: 800; letter-spacing: .05em; text-align: center; }
.detail-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; margin-bottom: 16px; }
.detail-card { padding: 20px; margin-bottom: 18px; }
.detail-card .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.detail-card dt { color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.detail-card dd { margin: 5px 0 0; font-weight: 700; }
.details { display: grid; grid-template-columns: 130px 1fr; gap: 9px 15px; margin-bottom: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 600; }
.payment-summary { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.hash { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .76rem; overflow-wrap: anywhere; }
.danger-zone { padding: 20px; margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-color: #e5caca; }
.danger-zone h2, .danger-zone p { margin: 0; }
.danger-zone p { color: var(--muted); margin-top: 5px; }
.finalize-form { width: min(430px, 100%); display: grid; gap: 11px; }
.finalize-form > label { display: grid; gap: 5px; color: #344252; font-size: .86rem; font-weight: 700; }
.finalize-form small { color: var(--muted); font-weight: 400; line-height: 1.4; }
.checkbox-option { grid-template-columns: 22px 1fr; align-items: center; }
.checkbox-option input { margin: 0; }
.system-summary { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.system-summary h2, .system-summary p { margin: 0; }
.system-summary p { color: var(--muted); margin-top: 4px; }
.system-summary-ok { border-color: #b8decf; background: #f2faf6; }
.system-summary-error { border-color: #e6baba; background: #fff5f5; }
.status-symbol { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--navy); color: white; font-size: 1.35rem; font-weight: 800; }
.system-summary-error .status-symbol { background: var(--danger); }
.check-list { overflow: hidden; }
.check-row { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: start; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.check-row:last-child { border-bottom: 0; }
.check-row h2, .check-row p { margin: 0; }
.check-row p { color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.system-note { margin-top: 16px; }
.integration-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.integration-card { padding: 20px; }
.integration-card .section-heading { margin-bottom: 8px; }
.integration-card p { margin: 0 0 7px; color: var(--muted); }
.integration-card small { color: var(--muted); }
.order-note { margin-top: 8px; max-width: 340px; }
.order-note summary { color: var(--blue); cursor: pointer; font-weight: 700; }
.order-note p { margin: 7px 0 0; color: var(--muted); font-size: .86rem; }
.sync-history { margin-top: 20px; }
.marketplace-review { margin-top: 14px; }
.email-card { margin-top: 16px; }
.email-card form { margin-top: 16px; }
.integration-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.compact-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.compact-actions form { margin: 0; }
.compact-actions select { min-width: 230px; }
.catalogue-bulk-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 12px; padding: 14px 16px; }
.catalogue-bulk-actions p { margin: 4px 0 0; font-size: .85rem; }
.catalogue-data-list { display: grid; gap: 12px; min-width: 120px; }
.catalogue-data-list > div + div { padding-top: 10px; border-top: 1px dashed var(--line); }
.book-catalogue-table .selection-cell { width: 52px; text-align: center; }
.book-catalogue-table td { max-width: 300px; }
.catalogue-confirm-purchase { margin-bottom: 18px; }
.catalogue-confirm-purchase h2 { margin: 0; }
.catalogue-confirm-purchase .section-heading p { margin: 4px 0 0; }
.transaction-meta { max-width: 340px; overflow-wrap: anywhere; }
.transaction-meta small { color: var(--muted); }
.finance-import { margin-bottom: 18px; }
.finance-section { margin-top: 18px; }
.section-padding { padding: 20px 20px 0; }
.section-padding p { margin: 5px 0 0; }
.compact-stack { gap: 9px; min-width: 270px; }
.review-panel { border: 1px solid var(--line); border-radius: 9px; background: #fafcfd; }
.review-panel summary { cursor: pointer; color: var(--blue); font-weight: 800; padding: 10px 12px; }
.inline-review-form { display: grid; gap: 10px; min-width: min(420px, 75vw); padding: 0 12px 12px; }
.inline-review-form > label { display: grid; gap: 5px; color: #344252; font-size: .82rem; font-weight: 700; }
.receipt-list { display: grid; gap: 10px; margin: 16px 0; }
.receipt-row { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fafcfd; }
.finance-entry { display: block; padding: 22px; color: inherit; }
.finance-entry:hover { text-decoration: none; border-color: #aac5d8; }
.finance-entry .section-heading { margin-bottom: 8px; }
.finance-entry p { margin: 0; color: var(--muted); }
.finance-kpis small, .stat small { color: var(--muted); line-height: 1.4; }
.stat-emphasis { border-color: #a8c9bc; background: #f4fbf7; }
.source-badge { display: inline-flex; padding: 5px 8px; border-radius: 7px; background: #edf1f4; color: #445462; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.source-badge + .source-badge { margin-left: 5px; }
.source-paypal { background: #edf2fc; color: #214e8a; }
.source-n26 { background: #edf7f4; color: #17634b; }
.source-imap { background: #edf2fc; color: #214e8a; }
.source-telegram { background: #e9f6f8; color: #17616b; }
.source-upload { background: #f2eff9; color: #5a3b7e; }
.inbox-assigned-section { margin-top: 34px; }
.list-note { margin-top: 14px; font-size: .88rem; }
.import-history-heading { margin: 28px 0 10px; }
.import-help { margin-top: 16px; }
.import-help summary { cursor: pointer; color: var(--navy); }
.import-help code { white-space: normal; overflow-wrap: anywhere; }
.import-help li { margin-bottom: 6px; }
.isbn-toolbar { display: grid; grid-template-columns: minmax(260px, 1fr) auto auto auto; gap: 10px; align-items: end; margin-bottom: 14px; }
.isbn-field { display: grid; gap: 6px; color: #344252; font-size: .86rem; font-weight: 700; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.book-camera { max-width: 620px; margin: 12px 0 18px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #0e1c29; color: white; }
.book-camera video { display: block; width: 100%; max-height: 420px; border-radius: 8px; object-fit: cover; background: black; }
.book-camera .actions { margin-top: 10px; }
.book-camera .muted { color: #d3dde5; }
.hidden-field { display: none !important; }
.book-cost-summary { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: flex-end; margin-top: 16px; padding: 14px; border-radius: 9px; background: #eef5fb; }
.book-intake-card { border-color: #b8cfdf; }

@media (min-width: 1101px) {
  .list-table-wrap { overflow: visible; }
  .bulk-actions {
    position: sticky;
    top: calc(var(--topbar-height) + var(--sticky-filter-height) + 16px);
    z-index: 14;
    background: var(--surface);
    box-shadow: 0 7px 18px rgba(17, 44, 69, .09);
  }
  .list-table-wrap thead th {
    position: static;
    box-shadow: inset 0 -1px 0 var(--line);
  }
}

@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; }
  .nav-toggle { display: inline-flex; background: transparent; border: 1px solid #5b7790; border-radius: 8px; color: white; padding: 8px 11px; }
  .topbar nav { display: none; width: 100%; align-items: stretch; flex-direction: column; gap: 0; padding-bottom: 8px; }
  .topbar nav.open { display: flex; }
  .topbar nav a, .topbar nav form { padding: 10px; }
  .topbar nav a.active { box-shadow: inset 4px 0 0 #62a5d0; }
  .bulk-booking-controls { flex-basis: 100%; }
}

@media (max-width: 900px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .integration-grid { grid-template-columns: 1fr; }
  .line-card { grid-template-columns: 1fr 2fr 1fr; }
  .line-description { grid-column: span 2; }
  .detail-grid { grid-template-columns: 1fr; }
  .compact-grid { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .catalog-picker-grid { grid-template-columns: 1fr; }
  .catalogue-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .container { width: min(100% - 20px, 1380px); margin-top: 22px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading > .button { width: 100%; }
  .stat-grid, .form-grid, .form-grid.compact { grid-template-columns: 1fr; }
  .compact-grid { grid-template-columns: 1fr; }
  .silver-lot-header { align-items: stretch; flex-direction: column; }
  .silver-delete-choice { justify-content: center; }
  .span-2 { grid-column: auto; }
  .line-card { grid-template-columns: 1fr 1fr; }
  .line-description { grid-column: span 2; }
  .topbar { flex-wrap: wrap; }
  .nav-toggle { display: inline-flex; background: transparent; border: 1px solid #5b7790; border-radius: 8px; color: white; padding: 8px 11px; }
  .topbar nav { display: none; width: 100%; align-items: stretch; flex-direction: column; gap: 0; padding-bottom: 8px; }
  .topbar nav.open { display: flex; }
  .topbar nav a, .topbar nav form { padding: 10px; }
  .danger-zone { align-items: stretch; flex-direction: column; }
  .danger-zone form, .danger-zone button { width: 100%; }
  .public-shell { width: min(100% - 20px, 860px); }
  .site-footer { width: min(100% - 20px, 1180px); flex-direction: column; }
  .footer-links { justify-content: flex-start; }
  .filter-bar { align-items: stretch; }
  .filter-bar label, .filter-bar .button { width: 100%; }
  .catalogue-stat-grid { grid-template-columns: 1fr; }
  .catalogue-bulk-actions { align-items: stretch; flex-direction: column; }
  .catalogue-bulk-actions .button { width: 100%; }
  .sticky-filter.filter-collapsible { top: calc(var(--topbar-height) + 5px); padding: 8px; max-height: calc(100dvh - var(--topbar-height) - 12px); overflow: auto; }
  .filter-toggle { display: inline-flex; width: 100%; min-height: 42px; align-items: center; justify-content: space-between; border: 1px solid #b9c6d0; border-radius: 9px; background: white; color: var(--navy); font: inherit; font-weight: 800; padding: 8px 12px; }
  .sticky-filter.filter-collapsible:not(.filters-open) > label,
  .sticky-filter.filter-collapsible:not(.filters-open) > .button { display: none; }
  .bulk-booking-controls { display: grid; grid-template-columns: 1fr; width: 100%; }
  .bulk-booking-controls label, .bulk-booking-controls .button { width: 100%; }
  .bulk-actions { align-items: stretch; flex-direction: column; }
  .bulk-actions .actions, .bulk-actions .button { width: 100%; }
  .transfer-bulk-actions { align-items: stretch; flex-direction: column; }
  .transfer-bulk-actions .button { width: 100%; }
  .security-codes { grid-template-columns: 1fr; }
  .isbn-toolbar { grid-template-columns: 1fr; }
  .watch-add-form { grid-template-columns: 1fr; }
  .purchase-copy-heading { align-items: stretch; flex-direction: column; }
  .purchase-finalize-box { justify-items: stretch; }
  .purchase-finalize-box .button { width: 100%; }
}

@media print {
  .topbar, .site-footer, .actions, .alert-warning { display: none !important; }
  .container { width: 100%; margin: 0; }
  .card { border: 0; box-shadow: none; }
}
.result-count {
  margin: 0 0 1rem;
  color: var(--muted);
}

.routing-suggestions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.routing-suggestions p {
  margin: 0;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--surface-soft, #f6f8fa);
}

.route-fields[hidden],
.route-confirmation[hidden],
[data-route-group][hidden] {
  display: none !important;
}

/* 1.1.0: document workbench and calmer, preview-first lists. */
.disclosure-card { margin-bottom: 18px; overflow: hidden; }
.disclosure-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 20px; cursor: pointer; color: var(--navy-dark); list-style: none; }
.disclosure-card > summary::-webkit-details-marker { display: none; }
.disclosure-card > summary span:first-child { display: grid; gap: 3px; }
.disclosure-card > summary small { color: var(--muted); font-weight: 500; }
.disclosure-card[open] > summary { border-bottom: 1px solid var(--line); background: #f9fbfc; }
.disclosure-card[open] > summary > span:last-child { transform: rotate(45deg); }
.disclosure-content { padding: 20px; }
.upload-disclosure { margin-bottom: 20px; border-color: #bfd2e1; }
.inbox-overview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inbox-filter { align-items: end; }
.filter-more { flex: 1 0 100%; border-top: 1px solid var(--line); padding-top: 9px; }
.filter-more > summary { cursor: pointer; color: var(--blue); font-size: .82rem; font-weight: 800; }
.filter-more-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 11px; margin-top: 10px; }
.filter-more-grid label { min-width: 0; }

.inbox-worklist { overflow: hidden; }
.inbox-item { display: grid; grid-template-columns: 34px 148px minmax(260px, 1.45fr) minmax(210px, .9fr) minmax(225px, 1fr) 108px; gap: 16px; align-items: start; padding: 17px; border-bottom: 1px solid var(--line); }
.inbox-item:last-child { border-bottom: 0; }
.inbox-item:hover { background: #fbfdfe; }
.inbox-item.is-discarded { opacity: .72; background: #fafafa; }
.inbox-select { display: grid; place-items: center; padding-top: 41px; }
.inbox-select input { margin: 0; }
.document-thumbnail-wrap { min-width: 0; }
.document-thumbnail { width: 148px; height: 111px; display: grid; place-items: center; overflow: hidden; border: 1px solid #cad5de; border-radius: 10px; background: #eef2f5; padding: 0; color: var(--navy); cursor: pointer; }
.document-thumbnail:hover { border-color: var(--blue); box-shadow: 0 6px 16px rgba(17, 44, 69, .12); }
.document-thumbnail img { display: block; width: 100%; height: 100%; object-fit: cover; }
.document-type-tile { cursor: default; background: linear-gradient(145deg, #eef4f8, #fff); }
.document-type-tile strong { font-size: 1.1rem; letter-spacing: .05em; }
.document-type-tile span { color: var(--muted); font-size: .75rem; }
.evidence-thumbnail { width: 92px; height: 69px; }
.book-photo-table .document-thumbnail { width: 112px; height: 84px; }
.book-photo-card { display: flex; align-items: center; gap: 20px; margin-bottom: 18px; }
.book-photo-card > div { min-width: 0; }
.book-photo-card h2 { margin-top: 0; }
.book-cover-image, .book-cover-thumbnail { width: 180px; height: 240px; flex: 0 0 180px; border-radius: 8px; object-fit: cover; }
.book-cover-thumbnail img { object-fit: cover; }
.book-photo-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.book-photo-gallery-item { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 12px; align-content: start; background: var(--surface); }
.book-photo-gallery-item.is-primary { border-color: var(--brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 16%, transparent); }
.book-photo-gallery-item .book-cover-thumbnail { width: 100%; height: 220px; }
.book-photo-gallery-item .compact-actions { align-items: stretch; }
.book-photo-gallery-item .compact-actions form { display: inline-flex; margin: 0; }
.book-photo-gallery-item details { border-top: 1px solid var(--line); padding-top: 9px; }
.inline-confirm-form { display: grid; gap: 8px; margin-top: 10px; }
.book-list-title { display: flex; align-items: flex-start; gap: 10px; min-width: 240px; }
.book-list-cover { width: 44px; height: 60px; flex: 0 0 44px; border: 1px solid var(--line); border-radius: 4px; background: #eef2f5; object-fit: cover; }
.book-cover-slot { display: inline-flex; flex: none; flex-direction: column; align-items: flex-start; gap: 3px; }
.book-cover-source { font-size: .68rem; line-height: 1.2; max-width: 90px; }
.book-cover-missing { max-width: 90px; }
.inbox-item-main, .inbox-item-insight, .inbox-item-target, .inbox-item-action { min-width: 0; }
.inbox-item-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; overflow-wrap: anywhere; }
.inbox-item-title strong { color: var(--navy-dark); }
.inbox-meta { margin: 7px 0; color: var(--muted); font-size: .8rem; }
.document-excerpt { display: -webkit-box; margin: 8px 0; overflow: hidden; color: #435363; font-size: .86rem; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.inbox-data-line { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0 0; color: #344252; font-size: .82rem; font-weight: 750; }
.inbox-item-insight, .inbox-item-target { display: flex; align-items: flex-start; flex-direction: column; gap: 7px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: #f9fbfc; }
.inbox-item-insight small, .inbox-item-target small { color: var(--muted); line-height: 1.4; }
.insight-label { color: #73808c; font-size: .69rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.inbox-item-insight .insight-label:not(:first-child) { margin-top: 7px; padding-top: 8px; border-top: 1px solid var(--line); width: 100%; }
.inbox-item-action { display: flex; align-items: stretch; flex-direction: column; gap: 10px; }
.inbox-item-action .badge { justify-content: center; text-align: center; }
.inbox-item-assigned { grid-template-columns: 148px minmax(260px, 1.4fr) minmax(240px, 1fr) 100px; }
.compact-worklist .inbox-item-target { align-self: stretch; }

.document-preview-dialog { width: min(1180px, calc(100% - 30px)); max-height: calc(100dvh - 30px); border: 0; border-radius: 14px; padding: 0; box-shadow: 0 22px 80px rgba(4, 19, 33, .35); }
.document-preview-dialog::backdrop { background: rgba(5, 20, 34, .72); }
.preview-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; border-bottom: 1px solid var(--line); background: white; }
.preview-dialog-body { display: grid; min-height: 260px; place-items: center; padding: 18px; background: #26323e; }
.preview-dialog-body img { display: block; max-width: 100%; max-height: calc(100dvh - 110px); border-radius: 6px; object-fit: contain; }

.document-detail-workbench { display: grid; grid-template-columns: minmax(340px, 1.1fr) minmax(360px, .9fr); gap: 18px; margin-bottom: 18px; }
.document-preview-panel { padding: 20px; }
.document-preview-panel .section-heading { margin-bottom: 12px; }
.document-preview-panel .section-heading p { margin: 3px 0 0; }
.document-preview-large { display: block; width: 100%; max-height: 650px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #eef2f5; }
.document-type-hero { display: grid; min-height: 260px; place-items: center; align-content: center; gap: 16px; padding: 28px; border: 1px solid var(--line); border-radius: 10px; background: #f7f9fb; text-align: center; }
.document-type-hero strong { color: var(--navy); font-size: 1.8rem; }
.document-type-hero p { max-width: 620px; color: #415365; white-space: pre-wrap; }
.preview-actions { margin-top: 13px; }
.technical-details { margin-top: 13px; color: var(--muted); }
.technical-details summary { cursor: pointer; font-size: .8rem; font-weight: 750; }
.suggestion-panel { margin: 0; }
.compact-suggestions { grid-template-columns: 1fr; }
.routing-suggestions article { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.routing-suggestions article > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.routing-suggestions article small { color: var(--muted); line-height: 1.4; }
.routing-suggestions article .button { justify-self: start; min-height: 36px; padding: 6px 11px; }
.evidence-type-strip { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.evidence-type-strip .insight-label { width: 100%; }
.suggestion-safety { margin-bottom: 0; font-size: .84rem; }
.target-suggestion-panel { margin-bottom: 18px; }
.target-suggestion-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.target-suggestion { display: flex; align-items: flex-start; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid #c9d8e3; border-radius: 10px; background: #f8fbfd; }
.target-suggestion small { color: var(--muted); line-height: 1.4; }
.target-suggestion .button { margin-top: auto; }
.inbox-routing-form { scroll-margin-top: calc(var(--topbar-height) + 18px); transition: border-color .25s, box-shadow .25s; }
.inbox-routing-form.route-selection-updated { border-color: #6da1c6; box-shadow: 0 0 0 4px rgba(47, 111, 159, .14), 0 10px 28px rgba(17, 44, 69, .09); }
.technical-history { margin-top: 18px; }
.ocr-text { max-height: 430px; overflow: auto; white-space: pre-wrap; padding: 14px; border-radius: 8px; background: #f6f8fa; }

@media (max-width: 1100px) {
  .filter-more-grid { grid-template-columns: repeat(3, minmax(145px, 1fr)); }
  .inbox-item { grid-template-columns: 34px 128px minmax(260px, 1fr) 112px; }
  .document-thumbnail { width: 128px; height: 96px; }
  .inbox-select { grid-column: 1; grid-row: 1 / span 3; }
  .document-thumbnail-wrap { grid-column: 2; grid-row: 1 / span 3; }
  .inbox-item-main { grid-column: 3; grid-row: 1; }
  .inbox-item-insight { grid-column: 3; grid-row: 2; }
  .inbox-item-target { grid-column: 3; grid-row: 3; }
  .inbox-item-action { grid-column: 4; grid-row: 1 / span 3; }
  .inbox-item-assigned { grid-template-columns: 128px minmax(260px, 1fr) 110px; }
  .inbox-item-assigned .document-thumbnail-wrap { grid-column: 1; }
  .inbox-item-assigned .inbox-item-main { grid-column: 2; }
  .inbox-item-assigned .inbox-item-target { grid-column: 2; grid-row: 2; }
  .inbox-item-assigned .inbox-item-action { grid-column: 3; grid-row: 1 / span 2; }
}

@media (max-width: 900px) {
  .document-detail-workbench { grid-template-columns: 1fr; }
  .filter-more-grid { grid-template-columns: repeat(2, minmax(145px, 1fr)); }
}

@media (max-width: 680px) {
  .sticky-filter.filter-collapsible:not(.filters-open) > .filter-more { display: none; }
  .inbox-overview-grid { grid-template-columns: 1fr; }
  .filter-more-grid { grid-template-columns: 1fr; }
  .inbox-item { grid-template-columns: 30px 96px minmax(0, 1fr); gap: 11px; padding: 13px; }
  .document-thumbnail { width: 96px; height: 72px; }
  .inbox-select { grid-column: 1; grid-row: 1 / span 4; padding-top: 26px; }
  .document-thumbnail-wrap { grid-column: 2; grid-row: 1; }
  .inbox-item-main { grid-column: 3; grid-row: 1; }
  .inbox-item-insight, .inbox-item-target, .inbox-item-action { grid-column: 2 / 4; }
  .inbox-item-insight { grid-row: 2; }
  .inbox-item-target { grid-row: 3; }
  .inbox-item-action { grid-row: 4; flex-direction: row; flex-wrap: wrap; }
  .inbox-item-action .button { flex: 1; }
  .inbox-item-assigned { grid-template-columns: 96px minmax(0, 1fr); }
  .inbox-item-assigned .document-thumbnail-wrap { grid-column: 1; grid-row: 1; }
  .inbox-item-assigned .inbox-item-main { grid-column: 2; grid-row: 1; }
  .inbox-item-assigned .inbox-item-target { grid-column: 1 / 3; grid-row: 2; }
  .inbox-item-assigned .inbox-item-action { grid-column: 1 / 3; grid-row: 3; }
  .document-preview-panel, .suggestion-panel, .target-suggestion-panel { padding: 15px; }
  .document-type-hero { min-height: 180px; padding: 18px; }
}

/* 1.5: Five work areas, restrained surfaces, and optional form details. */
:root {
  --navy: #173b60;
  --navy-dark: #15304c;
  --blue: #245986;
  --blue-soft: #edf3f9;
  --ink: #1c2d40;
  --muted: #5b6d80;
  --line: #e2e7ed;
  --border: #e2e7ed;
  --background: #f5f6f8;
  --radius: 10px;
  --sidebar-width: 174px;
  font-size: 14px;
}
[hidden] { display: none !important; }
body { line-height: 1.5; }
h1 { font-size: clamp(1.65rem, 2.2vw, 2rem); font-weight: 650; letter-spacing: -.035em; }
h2, h3 { font-weight: 650; }
button, input, select, textarea { max-width: 100%; }
input, select, textarea { min-width: 0; font-weight: 400; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; min-height: 18px; flex: 0 0 18px; accent-color: var(--navy); }
input[type="file"] { overflow: hidden; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid #7eafd5; outline-offset: 3px; }
.skip-link { position: fixed; top: 8px; left: 8px; transform: translateY(-150%); padding: 10px 15px; border-radius: 6px; background: var(--navy); color: white; z-index: 100; }
.skip-link:focus { transform: none; }
.topbar { display: block; padding: 0; min-height: 64px; background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--line); box-shadow: none; z-index: 30; }
.shell-topline { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 26px; }
.brand { color: var(--ink); min-width: 0; font-size: .95rem; }
.brand-mark { width: 33px; height: 33px; flex: 0 0 33px; border-radius: 8px; background: var(--navy); color: white; font-size: .86rem; }
.brand strong { font-weight: 650; line-height: 1.25; }
.brand small { color: var(--muted); font-size: .76rem; }
.topbar .primary-nav { position: fixed; inset: var(--topbar-height) auto 0 0; width: var(--sidebar-width); display: flex; align-items: stretch; flex-direction: column; gap: 6px; padding: 24px 12px; border-right: 1px solid var(--line); background: var(--surface); }
.topbar .primary-nav a { display: flex; align-items: center; gap: 11px; min-height: 45px; padding: 11px 12px; border-radius: 7px; color: var(--muted); font-size: .94rem; font-weight: 550; }
.topbar .primary-nav a:hover { background: #f4f6f9; color: var(--navy); }
.topbar .primary-nav a.active { background: var(--blue-soft); color: var(--navy); box-shadow: none; }
.nav-icon { display: block; flex: 0 0 19px; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.focus-mode .container > .subnav { display: none; }
.user-menu { position: relative; flex-shrink: 0; font-size: .9rem; }
.user-menu > summary { display: flex; gap: 10px; align-items: center; cursor: pointer; padding: 8px 10px; min-height: 40px; border: 1px solid var(--line); border-radius: 7px; list-style: none; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu[open] > summary { background: var(--blue-soft); color: var(--navy); }
.user-menu-panel { position: absolute; top: calc(100% + 9px); right: 0; width: 228px; max-width: calc(100vw - 24px); padding: 7px; border: 1px solid var(--line); border-radius: 9px; background: white; box-shadow: 0 8px 24px #15304c14; }
.user-menu-name { display: block; padding: 9px 10px; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.user-menu-panel > a, .user-menu-panel .link-button { display: block; width: 100%; padding: 9px 10px; border-radius: 5px; color: var(--ink); font: inherit; text-align: left; }
.user-menu-panel > a:hover, .user-menu-panel > a.active, .user-menu-panel .link-button:hover { color: var(--navy); background: var(--blue-soft); text-decoration: none; }
.user-menu-panel form { margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line); }
.app-shell > .container { width: calc(100% - var(--sidebar-width) - 64px); margin: 28px 32px 56px calc(var(--sidebar-width) + 32px); min-width: 0; }
.app-shell > .site-footer { width: calc(100% - var(--sidebar-width) - 64px); margin-left: calc(var(--sidebar-width) + 32px); }
.eyebrow { text-transform: none; letter-spacing: 0; font-size: .85rem; font-weight: 500; color: var(--muted); }
.page-heading { margin-bottom: 24px; align-items: center; }
.page-heading > div { min-width: 0; }
.page-heading h1 { overflow-wrap: anywhere; }
.card { border-color: var(--line); box-shadow: none; min-width: 0; }
.card .card { box-shadow: none; }
.form-card { padding: 22px; }
.form-card-width { max-width: 920px; }
.form-card-wide { max-width: 1160px; }
.form-shell { max-width: 960px; }
.context-summary { padding: 15px 17px; border: 1px solid var(--line); border-radius: 8px; background: #f5f8fb; }
.context-summary > :first-child { margin-top: 0; }
.context-summary > :last-child { margin-bottom: 0; }
.context-summary p { margin: 5px 0; }
.context-summary .details { margin-top: 8px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid > *, .detail-grid > *, .line-card > *, .stat-grid > * { min-width: 0; }
.form-grid label, .stack > label, .line-field { align-content: start; font-size: .86rem; font-weight: 550; }
.form-field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.form-field > label { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin: 0; }
.form-field .helptext, .form-field small { color: var(--muted); font-size: .8rem; font-weight: 400; }
.customer-kind { border: 0; padding: 0; margin: 0; min-width: 0; }
.customer-kind legend { font-size: .86rem; font-weight: 550; margin-bottom: 8px; }
.customer-kind > div { display: flex; flex-wrap: wrap; gap: 8px; }
.customer-kind label { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; font-size: .9rem; cursor: pointer; }
.customer-kind label:has(input:checked) { border-color: #9ab5ca; background: var(--blue-soft); color: var(--navy); }
.customer-kind input { margin: 0; }
.line-card[data-line-row] { display: flex; flex-wrap: wrap; align-items: flex-end; }
.line-card[data-line-row] > .line-field { flex: 1 1 110px; }
.line-card[data-line-row] > .line-description { flex: 3 1 260px; }
[data-invoice-line-details] { grid-column: 1 / -1; flex: 1 0 100%; width: 100%; margin-top: 4px; }
.optional-label { color: var(--muted); font-weight: 400; font-size: .76rem; }
.form-section + .form-section { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 22px; }
.form-section-heading { margin: 0 0 16px; }
.form-section-heading p { margin: 4px 0 0; color: var(--muted); font-size: .86rem; }
.book-metadata-summary { padding: 14px 16px; margin: 14px 0; border: 1px solid var(--line); border-radius: 7px; background: #f8fafc; }
.book-metadata-summary strong { display: block; color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.book-metadata-summary p, .book-metadata-summary small { margin: 5px 0 0; color: var(--muted); font-size: .86rem; }
.field-details { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 20px; }
.field-details > summary { color: var(--navy); cursor: pointer; font-weight: 550; padding: 3px 0; }
.field-details[open] > summary { margin-bottom: 16px; }
.field-details .field-details { margin-top: 14px; }
.button { min-height: 40px; border-color: #cad4de; border-radius: 7px; font-weight: 550; font-size: .92rem; }
.button-primary { border-color: var(--navy); }
.button-danger { border-color: var(--danger); }
.text-button { border: 0; background: transparent; color: var(--navy); font: inherit; font-size: .86rem; padding: 4px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.badge { font-weight: 650; padding: 4px 8px; border-radius: 5px; }
.badge-final { background: #edf6f1; }
.badge-warning { background: #fcf4e6; color: #80591f; }
.subnav { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 0 0 14px; margin: 0 0 22px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; overflow: visible; font-size: .89rem; }
.subnav a { padding: 8px 11px; font-weight: 550; border-radius: 6px; white-space: normal; }
.subnav a.active { background: var(--blue-soft); color: var(--navy); }
.area-subnav { margin-bottom: 22px; }
.area-subnav a { font-size: .93rem; }
.nav-more { margin-left: 0; min-width: 0; }
.nav-more > summary { cursor: pointer; padding: 8px 10px; color: var(--muted); font-weight: 500; }
.nav-more[open] { flex-basis: 100%; }
.nav-more[open] > summary { color: var(--navy); }
.nav-more-links { display: flex; flex-wrap: wrap; gap: 5px; padding: 7px 0 0; }
.nav-more-links a { background: white; font-size: .86rem; }
.tabs, .year-tabs { flex-wrap: wrap; }
.tabs a { font-weight: 550; }
.sticky-filter, .bulk-actions { box-shadow: none; }
.filter-bar { border-color: var(--line); }
.list-table-wrap, .table-wrap { max-width: 100%; overflow-x: auto; }
th { font-size: .75rem; text-transform: none; letter-spacing: 0; background: #fafbfc; }
th, td { padding: 12px 14px; }
.number, .stat strong { font-variant-numeric: tabular-nums; }
.selection-idle [data-selection-action], .selection-idle .bulk-booking-controls { display: none; }
.bulk-actions.selection-idle, .transfer-bulk-actions.selection-idle { min-height: 0; padding-top: 8px; padding-bottom: 8px; font-size: .83rem; }
.alert { box-shadow: none; font-size: .88rem; }
.alert-info { background: #f0f4f8; border-color: #dce5ee; color: #425b72; }
.alert-warning { background: #fcf6e9; border-color: #eadcc0; }
.detail-card dt { text-transform: none; font-weight: 550; }
.detail-card dd { overflow-wrap: anywhere; font-weight: 550; }
.details { grid-template-columns: minmax(90px, 130px) minmax(0, 1fr); }
.details dd { overflow-wrap: anywhere; }
.silver-line-card { border: 1px solid #ccd7e1; box-shadow: none; }
.silver-allocation-card { display: block; }
.silver-lot-header { border-bottom-color: var(--line); background: #f6f8fb; }
.silver-lot-number { border-radius: 5px; font-weight: 600; font-size: .75rem; }
.silver-group-heading > span { width: 25px; height: 25px; flex-basis: 25px; background: #edf3f9; color: var(--navy); font-size: .8rem; }
.silver-delete-choice { border-color: var(--line); font-weight: 500; }
.catalog-picker { background: #fafbfc; border-color: var(--line); }
.quantity-summary { font-size: .86rem; font-weight: 550; background: #edf3f9; }
.material-calculation { font-weight: 550; }
.dashboard-work { padding: 22px; margin-bottom: 28px; }
.dashboard-work .section-heading { margin-bottom: 12px; }
.dashboard-work .section-heading .muted { font-size: .8rem; }
.task-list { display: grid; }
.task-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; color: var(--ink); border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row:hover { text-decoration: none; color: var(--navy); }
.task-row strong { display: block; font-weight: 600; }
.task-row small { display: block; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.task-arrow { flex: 0 0 32px; display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 6px; font-size: 1.2rem; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 9px; padding-top: 17px; border-top: 1px solid var(--line); margin-top: 9px; }
.dashboard-metrics { margin-bottom: 28px; }
.dashboard-metrics .section-heading { margin-bottom: 14px; }
.dashboard-primary-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 0; }
.stat { padding: 18px; gap: 7px; }
.stat strong { font-size: clamp(1.4rem, 1.8vw, 1.8rem); font-weight: 600; }
.stat span { font-size: .87rem; }
.dashboard-additional-metrics { margin-top: 14px; padding-top: 11px; }
.dashboard-additional-metrics .stat-grid { margin-bottom: 0; }
.metric-picker { padding: 16px; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.metric-picker > p:first-child { margin-top: 0; }
.metric-picker-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.metric-picker-options label { display: flex; align-items: flex-start; gap: 8px; font-size: .85rem; }
.metric-picker-options input { margin: 2px 0 0; }
.metric-picker-options label:has(input:disabled) { color: var(--muted); }
.dashboard-documents > .section-heading { padding: 20px 22px 0; }
.inbox-workbench { grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr); align-items: start; }
.inbox-workspace { display: grid; gap: 16px; min-width: 0; }
.inbox-workspace > .card, .inbox-workspace > details { margin-bottom: 0; }
.inbox-workbench > .document-preview-panel { position: sticky; top: calc(var(--topbar-height) + 18px); }
.inbox-workbench .document-preview-large { max-height: calc(100dvh - var(--topbar-height) - 220px); min-height: 200px; }
.inbox-data-summary { display: grid; grid-template-columns: 1fr; gap: 9px; padding: 12px 0; margin: 0; font-size: .9rem; }
.inbox-data-summary > div { display: grid; grid-template-columns: minmax(80px, .7fr) minmax(0, 1fr); gap: 9px 16px; }
.inbox-data-summary dt { color: var(--muted); }
.inbox-data-summary dd { margin: 0; text-align: right; font-weight: 550; overflow-wrap: anywhere; }
.inbox-candidate-list { display: grid; gap: 9px; }
.inbox-candidate { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px; border: 1px solid var(--line); border-radius: 7px; }
.inbox-candidate > div:first-child { flex: 1 1 180px; min-width: 0; }
.inbox-candidate strong, .inbox-candidate small { display: block; overflow-wrap: anywhere; }
.inbox-candidate small { margin-top: 4px; color: var(--muted); }
.inbox-candidate.is-selected { background: var(--blue-soft); border-color: #99b7ce; }
.inbox-quality-grid { gap: 10px; margin-bottom: 0; }
.inbox-quality-grid > div { display: grid; gap: 5px; padding: 11px 12px; background: #f8fafc; border-radius: 6px; }
.inbox-quality-grid > div > strong { color: var(--navy); font-size: 1rem; font-weight: 600; }
.inbox-quality-grid .stat { padding: 12px; }
.inbox-quality-grid .stat strong { font-size: 1.15rem; }
.inbox-workbench .document-preview-panel .actions { justify-content: flex-start; }
.compact-disclosure { border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; margin-top: 18px; }
.compact-disclosure > summary { padding: 13px 0; }
.compact-disclosure .disclosure-content { padding: 0 0 14px; }

@media (max-width: 1200px) {
  .inbox-item { grid-template-columns: 28px 110px minmax(0, 1fr) 100px; gap: 12px; }
  .inbox-select { grid-column: 1; grid-row: 1 / span 3; }
  .document-thumbnail-wrap { grid-column: 2; grid-row: 1 / span 3; }
  .document-thumbnail { width: 110px; height: 83px; }
  .inbox-item-main { grid-column: 3; grid-row: 1; }
  .inbox-item-insight { grid-column: 3; grid-row: 2; }
  .inbox-item-target { grid-column: 3; grid-row: 3; }
  .inbox-item-action { grid-column: 4; grid-row: 1 / span 3; }
  .inbox-item-assigned { grid-template-columns: 110px minmax(0, 1fr) 100px; }
  .inbox-item-assigned .document-thumbnail-wrap { grid-column: 1; }
  .inbox-item-assigned .inbox-item-main { grid-column: 2; }
  .inbox-item-assigned .inbox-item-target { grid-column: 2; grid-row: 2; }
  .inbox-item-assigned .inbox-item-action { grid-column: 3; grid-row: 1 / span 2; }
  .filter-more-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  :root { --sidebar-width: 148px; }
  .topbar .primary-nav { padding: 20px 8px; }
  .topbar .primary-nav a { gap: 8px; padding: 10px; }
  .app-shell > .container { width: calc(100% - var(--sidebar-width) - 40px); margin-left: calc(var(--sidebar-width) + 20px); margin-right: 20px; }
  .app-shell > .site-footer { width: calc(100% - var(--sidebar-width) - 40px); margin-left: calc(var(--sidebar-width) + 20px); }
  .document-detail-workbench { grid-template-columns: 1fr; }
  .inbox-workbench > .document-preview-panel { position: static; }
  .inbox-workbench .document-preview-large { max-height: 300px; }
  .metric-picker-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compact-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .silver-allocation-card { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .shell-topline { padding: 10px 16px; min-height: 60px; }
  .topbar .primary-nav { position: static; width: 100%; display: flex; flex-direction: row; padding: 5px 8px; gap: 3px; border: 0; border-top: 1px solid var(--line); }
  .topbar .primary-nav a { display: flex; flex: 1 1 0; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; min-height: 51px; padding: 6px 2px; font-size: .78rem; }
  .nav-icon { flex-basis: 18px; width: 18px; height: 18px; }
  .app-shell > .container { width: calc(100% - 32px); margin: 22px 16px 44px; }
  .app-shell > .site-footer { width: calc(100% - 32px); margin-left: 16px; }
  .subnav { margin-bottom: 20px; gap: 3px; }
  .subnav a { padding: 8px 10px; }
  .form-card { padding: 19px; }
  .nav-more { margin-left: 0; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-primary-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-primary-metrics .stat { padding: 15px; }
  .dashboard-primary-metrics .stat strong { font-size: 1.4rem; }
  .filter-more-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inbox-workbench .document-preview-large { max-height: 260px; min-height: 0; }
}
@media (max-width: 560px) {
  .shell-topline { padding: 9px 12px; gap: 8px; }
  .brand { gap: 8px; font-size: .85rem; }
  .brand small { font-size: .7rem; }
  .brand-mark { width: 29px; height: 29px; flex-basis: 29px; font-size: .74rem; }
  .user-menu > summary { padding: 7px 8px; gap: 6px; font-size: .8rem; }
  .app-shell > .container { width: calc(100% - 24px); margin: 20px 12px 38px; }
  .app-shell > .site-footer { width: calc(100% - 24px); margin-left: 12px; }
  .page-heading { align-items: stretch; gap: 14px; }
  .page-heading .actions { justify-content: flex-start; }
  .page-heading .actions .button { flex: 1 1 auto; }
  .page-heading > .button { width: auto; align-self: flex-start; }
  .section-heading { gap: 12px; flex-wrap: wrap; }
  .form-card { padding: 16px; }
  .form-grid, .form-grid.compact, .compact-grid, .metric-picker-options, .filter-more-grid { grid-template-columns: 1fr; }
  .form-grid > .span-2, .span-2 { grid-column: auto; }
  input, select, textarea { font-size: 16px; min-height: 44px; }
  .button { min-height: 44px; }
  .actions { gap: 8px; }
  form:has(> .sticky-actions) { padding-bottom: 96px; }
  .sticky-actions { bottom: 6px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 7px 22px rgba(21, 48, 76, .16); }
  .line-card, .silver-allocation-card { grid-template-columns: 1fr; }
  .line-description { grid-column: auto; }
  .dashboard-work { padding: 17px; }
  .dashboard-work .section-heading .muted { display: none; }
  .dashboard-primary-metrics { grid-template-columns: 1fr; gap: 9px; }
  .dashboard-primary-metrics .stat { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 14px 16px; gap: 5px 12px; }
  .dashboard-primary-metrics .stat small { grid-column: 1 / -1; }
  .dashboard-additional-metrics .stat-grid { grid-template-columns: 1fr; }
  .dashboard-documents > .section-heading { padding: 17px 17px 0; }
  .quick-actions .button { flex: 1 1 auto; }
  .book-photo-card { align-items: flex-start; }
  .book-cover-image, .book-cover-thumbnail { width: 112px; height: 150px; flex-basis: 112px; }
  .book-photo-table .document-thumbnail { width: 74px; height: 56px; }
  .inbox-item { grid-template-columns: 26px 74px minmax(0, 1fr); gap: 10px; padding: 12px; }
  .inbox-select { grid-column: 1; grid-row: 1 / span 4; padding-top: 17px; }
  .document-thumbnail-wrap { grid-column: 2; grid-row: 1; }
  .document-thumbnail { width: 74px; height: 56px; }
  .inbox-item-main { grid-column: 3; grid-row: 1; }
  .inbox-item-insight, .inbox-item-target, .inbox-item-action { grid-column: 2 / 4; }
  .inbox-item-insight { grid-row: 2; }
  .inbox-item-target { grid-row: 3; }
  .inbox-item-action { grid-row: 4; flex-direction: row; flex-wrap: wrap; }
  .inbox-item-assigned { grid-template-columns: 74px minmax(0, 1fr); }
  .inbox-item-assigned .document-thumbnail-wrap { grid-column: 1; grid-row: 1; }
  .inbox-item-assigned .inbox-item-main { grid-column: 2; grid-row: 1; }
  .inbox-item-assigned .inbox-item-target { grid-column: 1 / 3; grid-row: 2; }
  .inbox-item-assigned .inbox-item-action { grid-column: 1 / 3; grid-row: 3; }
  .inbox-data-summary { gap: 8px 12px; }
  .inbox-candidate > .button { width: 100%; }
  .inbox-quality-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compact-actions select { min-width: 0; }
}
@media print {
  .app-shell > .container { width: 100%; margin: 0; }
  .skip-link, .subnav, .metric-picker, [data-metrics-toggle] { display: none !important; }
}

/* List selection keeps action controls outside business forms. */
.list-selection-tools { display:flex; align-items:center; gap:.65rem; flex-wrap:wrap; padding:.8rem; min-width:0; }
.list-selection-tools small { flex-basis:100%; color:var(--muted, #52677b); }
.list-row-selected { background:#edf5fc; }
.selection-cell { width:2.8rem; }
.selection-cell input { width:1.1rem; height:1.1rem; cursor:pointer; }

.book-cover-slot { display: inline-block; flex: 0 0 auto; }
.book-cover-missing { display: block; width: 58px; font-size: .68rem; line-height: 1.2; }
.book-cover-slot [hidden] { display: none; }
