
:root {
  color-scheme: light;
  font-family: Inter, Arial, sans-serif;
  --ink: #182230;
  --muted: #667085;
  --line: #d7dde7;
  --line-strong: #b8c2d0;
  --panel: #ffffff;
  --bg: #f3f5f8;
  --surface: #f9fafb;
  --accent: #1967d2;
  --accent-dark: #104c9c;
  --green: #0f766e;
  --gold: #9a6700;
  --danger: #b42318;
}
* { box-sizing: border-box; }
html, body { overflow-x: hidden; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,0) 260px); z-index: -1; }
.topbar { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.8fr); align-items: center; gap: 18px; padding: 14px 24px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); box-shadow: 0 8px 22px rgba(24,34,48,.07); position: sticky; top: 0; z-index: 4; backdrop-filter: blur(10px); }
.brand-block { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 46px; height: 46px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid #e7ebf1; padding: 4px; flex: 0 0 auto; }
.eyebrow { margin: 0 0 2px; color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 20px; line-height: 1.15; color: #111827; }
h2 { font-size: 16px; line-height: 1.25; }
h2 i { color: var(--accent); margin-right: 7px; }
nav { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
nav a { min-height: 34px; color: #334155; text-decoration: none; font-weight: 700; padding: 7px 9px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent; }
nav a:hover { background: #eef4ff; border-color: #cfe0ff; color: var(--accent-dark); }
nav a.active-view-link { background: #eaf2ff; border-color: #b8d3ff; color: var(--accent-dark); }
nav a i { width: 14px; text-align: center; color: #52677e; }
main { width: min(1360px, calc(100% - 28px)); margin: 16px auto 42px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .42fr); grid-auto-flow: row dense; gap: 12px; align-items: start; }
section[id] { scroll-margin-top: 92px; }
.admin-toolbar { order: 13; grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: #1e293b; color: #fff; border: 1px solid #334155; border-radius: 8px; padding: 9px 10px; margin-bottom: 0; }
.admin-toolbar strong { margin-right: 4px; font-size: 13px; }
.admin-toolbar button { min-height: 30px; border-color: #475569; background: #273449; color: #fff; padding: 0 9px; }
.tenant-switch { display: flex; align-items: center; grid-template-columns: none; gap: 6px; margin: 0; color: #e2e8f0; }
.tenant-switch select { min-width: 150px; min-height: 30px; padding: 4px 8px; }
.tenant-input { width: 142px; min-height: 30px; padding: 4px 8px; border-color: #536278; background: #fff; }
.tenant-code { width: 78px; }
.auth-status { margin-left: auto; font-size: 12px; color: #e2e8f0; }
.auth-panel { order: 2; grid-column: 1 / -1; margin-bottom: 0; }
.login-gate-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, .58fr); gap: 14px; align-items: stretch; }
.login-gate-copy, .login-card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 1px 2px rgba(24,34,48,.04); }
.login-gate-copy { min-height: 360px; padding: 24px; display: grid; align-content: center; gap: 16px; background: linear-gradient(135deg, #ffffff 0%, #f7fbff 58%, #eef5ff 100%); }
.login-kicker { width: max-content; max-width: 100%; display: inline-flex; align-items: center; gap: 7px; color: var(--accent-dark); font-size: 12px; font-weight: 800; text-transform: uppercase; border: 1px solid #b8d3ff; background: #eaf2ff; border-radius: 999px; padding: 6px 10px; }
.login-gate-copy h2 { max-width: 720px; font-size: 34px; line-height: 1.08; color: #111827; }
.login-gate-copy p { max-width: 760px; margin: 0; color: #475569; font-size: 16px; line-height: 1.6; }
.login-proof-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.login-proof-grid article { min-height: 112px; padding: 13px; display: grid; align-content: start; gap: 6px; background: rgba(255,255,255,.82); border-color: #d9e5f5; }
.login-proof-grid strong { font-size: 14px; color: #172554; }
.login-proof-grid span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.login-card { padding: 14px; display: grid; align-content: start; gap: 12px; }
.auth-grid { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: end; }
.auth-grid button { min-width: 108px; }
#loginResult { min-height: 78px; max-height: 150px; }
.login-plan-strip { display: flex; flex-wrap: wrap; gap: 8px; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; opacity: .56; }
button i { margin-right: 6px; }
.tab i, .icon-only i { margin-right: 0; }
article, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.panel { padding: 14px; box-shadow: 0 1px 2px rgba(24,34,48,.04); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 11px; padding-bottom: 10px; border-bottom: 1px solid #eef1f5; }
.status-grid { order: 1; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 0; }
.status-grid article { padding: 11px 12px; display: grid; gap: 3px; min-height: 88px; border-left: 3px solid #7aa7ee; }
.status-grid span, small { color: var(--muted); }
.status-grid span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.status-grid i { color: var(--accent); }
.status-grid strong { font-size: 16px; line-height: 1.25; }
.inline-upgrade { color: var(--accent-dark); font-size: 12px; font-weight: 800; text-decoration: none; }
.inline-upgrade:hover { text-decoration: underline; }
.button-link { border: 1px solid #acb8c8; background: #fff; color: #1f2937; border-radius: 6px; min-height: 36px; padding: 0 12px; font-weight: 750; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.button-link:hover { border-color: var(--accent); background: #f8fbff; }
.primary-link { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary-link:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.visual-strip { order: 14; grid-column: 1 / -1; display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 10px; margin-bottom: 0; }
.visual-strip figure { position: relative; min-height: 124px; max-height: 150px; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #1e293b; }
.visual-strip img { width: 100%; height: 100%; min-height: 124px; display: block; object-fit: cover; filter: saturate(.95) contrast(.98); }
.visual-strip figcaption { position: absolute; left: 9px; right: 9px; bottom: 9px; display: inline-flex; align-items: center; gap: 7px; width: max-content; max-width: calc(100% - 18px); padding: 6px 8px; border-radius: 5px; background: rgba(24,34,48,.82); color: #fff; font-weight: 750; font-size: 12px; backdrop-filter: blur(4px); }
.dashboard-grid { order: 2; grid-column: 1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); gap: 12px; margin-bottom: 0; }
.plans-page { order: 3; grid-column: 1 / -1; display: grid; gap: 12px; }
.plans-intro { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.plans-intro p { margin: 6px 0 0; }
.plans-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.plan-card { padding: 16px; display: grid; gap: 10px; align-content: start; min-height: 210px; border-left: 3px solid #7aa7ee; }
.plan-card.highlighted { border-color: var(--accent); box-shadow: 0 10px 24px rgba(25,103,210,.11); }
.plan-card span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.plan-card strong { font-size: 20px; line-height: 1.2; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.metric-grid article { padding: 11px; min-height: 84px; display: grid; gap: 3px; background: var(--surface); }
.metric-grid span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-grid strong { font-size: 22px; line-height: 1.1; }
.panel-subhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 14px 0 8px; padding-top: 12px; border-top: 1px solid #eef1f5; }
.panel-subhead h3 { margin: 0; font-size: 14px; }
.panel-subhead a { color: var(--accent-dark); font-size: 12px; font-weight: 800; text-decoration: none; }
.batch-status-list { display: grid; gap: 8px; }
.batch-status-item { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #f8fafc; display: grid; gap: 7px; }
.batch-status-head { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.batch-status-head strong { font-size: 14px; }
.status-pill { border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 850; text-transform: uppercase; background: #e9eef6; color: #334155; white-space: nowrap; }
.status-pill.running { background: #eaf2ff; color: #0b4fb3; }
.status-pill.completed { background: #e7f6ef; color: #0f766e; }
.status-pill.draft { background: #fff7e6; color: #9a6700; }
.batch-timeline { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; color: var(--muted); font-size: 12px; }
.batch-timeline span { overflow-wrap: anywhere; }
.workspace { order: 4; grid-column: 1 / -1; display: grid; grid-template-columns: 360px 1fr; gap: 12px; align-items: stretch; }
.library-onboarding { order: 6; grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 12px; margin-bottom: 0; }
label { display: grid; gap: 5px; margin-bottom: 9px; color: #536170; font-size: 12px; font-weight: 750; }
input, textarea, pre { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); font: 13px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; padding: 9px; }
input { font-family: inherit; }
input:focus, textarea:focus, select:focus { outline: 2px solid #cfe0ff; border-color: var(--accent); }
select { width: 100%; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; color: var(--ink); font: 13px/1.45 Inter, Arial, sans-serif; padding: 9px; }
textarea { resize: vertical; }
.consent-box { border: 1px solid #dbe2ec; background: #f8fafc; border-radius: 8px; padding: 11px; margin: 9px 0 11px; display: grid; gap: 6px; }
.check-label { display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: start; margin: 0; color: var(--ink); line-height: 1.45; }
.check-label input { width: 16px; height: 16px; padding: 0; margin: 2px 0 0; }
button { border: 1px solid #acb8c8; background: #fff; color: #1f2937; border-radius: 6px; min-height: 36px; padding: 0 12px; font-weight: 750; cursor: pointer; }
button:hover { border-color: var(--accent); background: #f8fbff; }
#buildBtn, .primary-action, #preparePipelineBtn, #loginBtn { width: 100%; background: var(--accent); border-color: var(--accent); color: #fff; }
#buildBtn:hover, .primary-action:hover, #preparePipelineBtn:hover, #loginBtn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.tabs, .actions, .button-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.tab.active { background: #eaf2ff; border-color: var(--accent); color: #0b4fb3; }
.result { display: none; min-height: 470px; white-space: pre-wrap; }
.result.active { display: block; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.policy-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 12px; margin-top: 12px; }
.pipeline-grid { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 0; align-items: stretch; }
#drive-koha { order: 5; }
.prepay-grid { order: 9; grid-template-columns: minmax(400px, .9fr) minmax(0, 1.1fr); }
.downloads-panel { order: 8; grid-column: 1 / -1; margin-top: 0; }
.label-workspace { order: 7; grid-column: 1 / -1; display: grid; grid-template-columns: minmax(340px, .95fr) minmax(340px, .9fr); gap: 12px; margin-top: 0; align-items: start; }
.label-preview-panel { grid-column: 1 / -1; }
.label-preview { min-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; padding: 12px; color: var(--muted); }
.print-sheet { display: grid; grid-template-columns: repeat(var(--label-columns), var(--label-width)); gap: var(--label-gap); align-items: start; color: var(--ink); width: max-content; max-width: 100%; }
.print-spacer { width: var(--label-width); height: var(--label-height); border: 1px dashed #d4dbe7; background: #fff; opacity: .45; }
.print-label { width: var(--label-width); height: var(--label-height); border: 1px solid #98a7ba; border-radius: 3px; background: #fff; padding: 2.5mm; overflow: hidden; display: grid; align-content: center; gap: 1.5mm; font: var(--label-font) Arial, sans-serif; break-inside: avoid; }
.print-label.spine { text-align: center; font-weight: 700; white-space: pre-line; }
.print-label.barcode { justify-items: center; text-align: center; }
.print-label.card { align-content: start; justify-items: stretch; text-align: left; line-height: 1.25; }
.print-label.card strong { font-size: 1.08em; }
.label-meta { color: var(--muted); font-size: .88em; }
.barcode-bars { height: var(--barcode-height); width: 100%; max-width: 62mm; display: flex; align-items: stretch; justify-content: center; background: #fff; border: 1px solid #111; padding: 1px; overflow: hidden; }
.barcode-bars span { display: block; height: 100%; flex: 0 0 auto; }
.barcode-bars .bar { background: #111; }
.barcode-bars .space { background: #fff; }
.barcode-human { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 0; font-size: .95em; overflow-wrap: anywhere; }
.field-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.ssh-row { border-top: 1px solid var(--line); padding-top: 9px; }
.profile-strip { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; border-top: 1px solid var(--line); padding-top: 11px; margin-top: 4px; }
.profile-strip button { margin-bottom: 9px; }
.pipeline-output { min-height: 330px; max-height: 620px; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; background: #f8fafc; }
.settings-grid { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 0; }
#credits { order: 10; }
#settings { order: 11; }
#retention { order: 15; grid-column: 1 / -1; }
.split { order: 16; grid-column: 1 / -1; }
.saved-list { display: grid; gap: 9px; color: var(--muted); }
.compact-list { max-height: 180px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #f8fafc; }
.compact-list .saved-item { padding: 8px; }
.saved-item { border: 1px solid var(--line); border-radius: 8px; padding: 11px; background: #f8fafc; display: grid; gap: 7px; }
.saved-item strong { color: var(--ink); font-size: 14px; }
.saved-item small { overflow-wrap: anywhere; }
.saved-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.saved-actions button { min-height: 31px; padding: 0 9px; font-size: 12px; }
.subtle { color: var(--muted); font-size: 12px; }
.warning { color: var(--gold); font-weight: 750; }
.hidden { display: none !important; }
ul { padding-left: 18px; }
li { margin: 7px 0; line-height: 1.45; }
@media (max-width: 980px) {
  main, .auth-panel, .admin-toolbar, .dashboard-grid { grid-column: 1 / -1; }
  main { grid-template-columns: 1fr; }
  .topbar, .workspace, .dashboard-grid, .library-onboarding, .split, .policy-grid, .pipeline-grid, .settings-grid, .label-workspace, .visual-strip { grid-template-columns: 1fr; display: grid; }
  .login-gate-panel { grid-template-columns: 1fr; }
  .login-proof-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  nav { justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  nav a { flex: 0 0 auto; }
  .auth-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plans-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .batch-timeline { grid-template-columns: 1fr; }
  .plans-intro { align-items: flex-start; flex-direction: column; }
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding: 12px 14px; }
  .brand-block { min-width: 0; }
  .profile-strip { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  main { width: min(100% - 18px, 1360px); margin-top: 10px; }
  .status-grid, .metric-grid, .plans-grid, .field-row, .login-proof-grid { grid-template-columns: 1fr; }
  .login-gate-copy { min-height: 0; padding: 18px; }
  .login-gate-copy h2 { font-size: 26px; }
  .login-gate-copy p { font-size: 14px; }
  .panel { padding: 12px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .brand-logo { width: 40px; height: 40px; }
  h1 { font-size: 18px; }
  .admin-toolbar { display: grid; grid-template-columns: 1fr; align-items: stretch; }
  .admin-toolbar strong, .tenant-switch, .tenant-switch select, .admin-toolbar input, .auth-status { width: 100%; }
  .admin-toolbar button { width: 100%; padding: 0 8px; }
  .auth-status { margin-left: 0; }
}
