
: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;
}
html[data-theme="dark"] {
  --bg: #161819;
  --surface: #22272b;
  --ink: #eceff1;
  --muted: #b6c0c8;
  --line: #3a434b;
}
* { 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; }
html[data-theme="dark"] body::before { background: linear-gradient(180deg, rgba(30,30,30,.5), rgba(30,30,30,0) 260px); }
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: #1e293b; color: #e2e8f0; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 5; transition: width .2s ease; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid #334155; }
.sidebar-logo { width: 32px; height: 32px; border-radius: 6px; background: #fff; padding: 2px; flex-shrink: 0; }
.sidebar-brand-text { font-size: 15px; font-weight: 800; color: #fff; white-space: nowrap; }
.sidebar-mini-toggle { width: 26px; height: 26px; margin-left: auto; display: grid; place-items: center; border: 1px solid #475569; background: #273449; color: #e2e8f0; border-radius: 6px; font-size: 11px; cursor: pointer; flex-shrink: 0; }
.sidebar-mini-toggle:hover { background: #334155; }
.sidebar-nav { flex: 1 1 auto; overflow-y: auto; padding: 10px 0; }
.sidebar-zone { margin-bottom: 8px; }
.sidebar-zone-label { display: block; padding: 6px 16px; font-size: 10px; font-weight: 800; text-transform: uppercase; color: #94a3b8; letter-spacing: .5px; }
.sidebar-zone a { display: flex; align-items: center; gap: 10px; padding: 8px 14px; margin: 0 8px; border-radius: 6px; color: #cbd5e1; text-decoration: none; font-size: 13px; font-weight: 700; white-space: nowrap; }
.sidebar-zone a:hover { background: #334155; color: #fff; }
.sidebar-zone a.active-view-link { background: #273449; color: #fff; border: 1px solid #475569; }
.sidebar-zone a i { width: 18px; text-align: center; color: #94a3b8; }
.sidebar-zone a.active-view-link i { color: #7aa7ee; }
.sidebar-footer { padding: 10px 14px; border-top: 1px solid #334155; }
.sidebar-theme-toggle { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; border-radius: 6px; border: 1px solid #475569; background: #273449; color: #e2e8f0; font-size: 12px; font-weight: 700; cursor: pointer; margin-bottom: 8px; }
.sidebar-theme-toggle:hover { background: #334155; }
.app-main { flex: 1 1 auto; margin-left: 260px; display: flex; flex-direction: column; min-height: 100vh; transition: margin-left .2s ease; }
.mobile-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 4; }
.app-content { flex: 1 1 auto; padding: 16px 24px 42px; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .42fr); grid-auto-flow: row dense; gap: 12px; align-items: start; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 24px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; backdrop-filter: blur(10px); }
.topbar-title h1 { font-size: 18px; line-height: 1.2; color: #111827; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #334155; font-size: 14px; cursor: pointer; }
.icon-btn:hover { background: #f8fbff; border-color: var(--accent); }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 18px; line-height: 1.2; color: #111827; }
h2 { font-size: 16px; line-height: 1.25; }
h2 i { color: var(--accent); margin-right: 7px; }
.user-dropdown { position: relative; }
.user-dropdown-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 7px 10px; border-radius: 6px; border: 1px solid transparent; background: transparent; color: #334155; font-weight: 700; font-size: 13px; cursor: pointer; }
.user-dropdown-toggle:hover { background: #eef4ff; border-color: #cfe0ff; }
.user-dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); width: 220px; display: none; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 12px 32px rgba(24,34,48,.14); padding: 8px; z-index: 10; }
.user-dropdown-menu.is-open { display: grid; gap: 2px; }
.user-dropdown-header { padding: 8px 10px; border-bottom: 1px solid #eef1f5; margin-bottom: 4px; }
.user-dropdown-header strong { display: block; font-size: 13px; color: var(--ink); }
.user-dropdown-header small { display: block; font-size: 11px; color: var(--muted); text-transform: capitalize; }
.user-dropdown-menu a, .user-dropdown-menu button { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: #334155; font-weight: 700; font-size: 13px; background: transparent; border: none; width: 100%; text-align: left; cursor: pointer; }
.user-dropdown-menu a:hover, .user-dropdown-menu button:hover { background: #f8fbff; }
.user-dropdown-menu i { color: #52677e; }
section[id] { scroll-margin-top: 92px; }
.admin-toolbar { order: 13; grid-column: 1 / -1; background: #1e293b; color: #fff; border: 1px solid #334155; border-radius: 8px; padding: 0; margin-bottom: 0; overflow: hidden; }
.admin-toolbar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; background: #273449; cursor: pointer; }
.admin-toolbar-head strong { font-size: 13px; display: inline-flex; align-items: center; gap: 7px; }
.admin-toolbar-collapse { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid #475569; background: #1e293b; color: #e2e8f0; border-radius: 6px; font-size: 12px; cursor: pointer; padding: 0; }
.admin-toolbar-collapse:hover { background: #334155; }
.admin-toolbar-body { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 10px; }
.admin-toolbar-body.is-collapsed { display: none; }
.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-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #111827 100%); padding: 24px; }
.login-card-v2 { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; box-shadow: 0 24px 64px rgba(0,0,0,.35); padding: 40px 32px; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.login-logo-v2 img { width: 48px; height: 48px; border-radius: 12px; }
.login-title-v2 { margin: 0; font-size: 24px; font-weight: 700; color: #111827; letter-spacing: -0.2px; }
.login-subtitle-v2 { margin: -10px 0 0; color: #64748b; font-size: 14px; }
.login-sso-btn-v2 { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 13px 18px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.login-sso-btn-v2:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.login-links-v2 { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #94a3b8; }
.login-links-v2 a { color: var(--accent-dark); font-weight: 700; text-decoration: none; }
.login-links-v2 a:hover { text-decoration: underline; }
.login-links-v2 .dot { color: #cbd5e1; }
.login-powered-v2 { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; color: #94a3b8; margin-top: 4px; }
.login-powered-v2 img { opacity: 0.7; }
.sso-btn { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font-size: 14px; font-weight: 750; text-decoration: none; cursor: pointer; }
.sso-btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
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; }
.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); }

.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: 0; display: grid; gap: 0; align-content: start; border-left: 3px solid #7aa7ee; overflow: hidden; }
.plan-card.highlighted { border-color: var(--accent); box-shadow: 0 10px 24px rgba(25,103,210,.11); }
.plan-badge { background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; text-transform: uppercase; padding: 5px 10px; text-align: center; }
.plan-header { padding: 16px 16px 0; }
.plan-header span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.plan-header strong { display: block; font-size: 20px; line-height: 1.2; margin-top: 4px; }
.plan-header small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.plan-features { list-style: none; margin: 0; padding: 12px 16px; display: grid; gap: 7px; }
.plan-features li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start; font-size: 13px; color: #334155; margin: 0; }
.plan-features li i { color: #0f766e; margin-top: 2px; }
.plan-features li.missing { color: #98a7ba; }
.plan-features li.missing i { color: #c7cdd6; }
.plan-card > .button-link { margin: 0 16px 16px; }
.plans-faq { grid-column: 1 / -1; }
.plans-faq h3 { margin: 0 0 14px; }
.faq-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.faq-grid article { padding: 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; }
.faq-grid article strong { display: block; font-size: 13px; margin-bottom: 6px; color: var(--ink); }
.faq-grid article p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.plans-trust { grid-column: 1 / -1; }
.plans-trust h3 { margin: 0 0 14px; }
.trust-strip { display: flex; gap: 16px; flex-wrap: wrap; }
.trust-strip span { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--muted); background: #f8fafc; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
.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: block; margin-bottom: 0; }
.library-hub-main { display: grid; grid-template-columns: 1fr; gap: 12px; }
.library-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; background: linear-gradient(145deg, #eef4ff 0%, #f6f9ff 100%); border: 1px solid #dbeafe; border-radius: 12px; }
.library-hero-info { display: flex; flex-direction: column; gap: 4px; }
.library-hero-label { font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.08em; color: #4b7bec; }
.library-hero-info strong { font-size: 18px; font-weight: 800; color: #1e293b; }
.library-hero-info span { font-size: 13px; color: #536170; }
.library-hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.library-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.library-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s ease, transform .15s ease; }
.library-card:hover { box-shadow: 0 4px 16px rgba(2,8,23,.08); transform: translateY(-1px); }
.library-card h3 { font-size: 15px; font-weight: 800; color: #1e293b; margin: 0; }
.library-card .library-meta { font-size: 12px; color: #536170; }
.library-card .library-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.library-card .library-actions button { font-size: 12px; padding: 6px 12px; }
.library-badge { display: inline-block; font-size: 11px; font-weight: 750; padding: 3px 10px; border-radius: 999px; text-transform: capitalize; }
.library-badge.trial { background: #fef3c7; color: #92400e; }
.library-badge.active { background: #dcfce7; color: #166534; }
.library-badge.suspended { background: #fee2e2; color: #991b1b; }
.library-badge.expired { background: #fee2e2; color: #991b1b; }
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 { width: 100%; background: var(--accent); border-color: var(--accent); color: #fff; }
#buildBtn:hover, .primary-action:hover, #preparePipelineBtn: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; }
.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; }
.library-pick-card { border: 1px solid #c7d7ef; background: linear-gradient(145deg, #f7fbff 0%, #eef5ff 100%); border-radius: 8px; padding: 10px; margin-bottom: 10px; display: grid; gap: 8px; }
.library-pick-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.library-pick-head strong { color: #0b4fb3; font-size: 13px; display: inline-flex; align-items: center; gap: 7px; }
.library-pick-head a { color: #0b4fb3; font-size: 12px; font-weight: 800; text-decoration: none; }
.library-pick-head a:hover { text-decoration: underline; }
.pipeline-output { min-height: 330px; max-height: 620px; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; background: #f8fafc; }
.dk-simplified { grid-template-columns: minmax(380px, .82fr) minmax(0, 1.18fr); }
.dk-primary-panel { display: flex; flex-direction: column; gap: 0; }
.dk-header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.dk-header i { font-size: 28px; color: var(--accent); }
.dk-header h2 { margin: 0; font-size: 18px; }
.dk-header p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.dk-defaults-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; margin: 6px 0 12px; font-size: 12px; color: var(--muted); }
.dk-defaults-bar strong { color: var(--ink); font-weight: 750; }
.dk-defaults-bar span { display: inline-flex; align-items: center; gap: 5px; }
.dk-settings-link { margin-left: auto; background: transparent; border: 1px solid var(--line); font-size: 12px; min-height: 30px; padding: 0 10px; }
.dk-secondary-actions { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.dk-batch-select { margin-bottom: 0; }
.dk-batch-select select { font-size: 12px; padding: 6px 8px; }
.dk-modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 20px; }
.dk-modal.hidden { display: none !important; }
.dk-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.dk-modal-card { position: relative; width: 100%; max-width: 820px; max-height: calc(100vh - 40px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.25); display: flex; flex-direction: column; }
.dk-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.dk-modal-head h3 { margin: 0; font-size: 15px; }
.dk-modal-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 18px; }
.dk-modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.dk-modal-foot button { min-width: 120px; }
html[data-theme="dark"] .dk-defaults-bar { background: var(--surface); }
html[data-theme="dark"] .dk-modal-card { background: var(--panel); border-color: var(--line); }
html[data-theme="dark"] .library-pick-card { background: linear-gradient(145deg, #1a2332 0%, #162035 100%); border-color: #334155; }
html[data-theme="dark"] .library-pick-head strong { color: #7aa7ee; }
html[data-theme="dark"] .library-pick-head a { color: #7aa7ee; }
html[data-theme="dark"] .login-card-v2 { background: #1e293b; border: 1px solid #334155; }
html[data-theme="dark"] .login-title-v2 { color: #f1f5f9; }
html[data-theme="dark"] .login-subtitle-v2 { color: #94a3b8; }
html[data-theme="dark"] .login-links-v2 { color: #64748b; }
html[data-theme="dark"] .login-powered-v2 { color: #64748b; }
html[data-theme="dark"] .library-hero { background: linear-gradient(145deg, #1a2332 0%, #162035 100%); border-color: #334155; }
html[data-theme="dark"] .library-hero-label { color: #7aa7ee; }
html[data-theme="dark"] .library-hero-info strong { color: #f1f5f9; }
html[data-theme="dark"] .library-hero-info span { color: #94a3b8; }
html[data-theme="dark"] .library-card { background: var(--panel); border-color: var(--line); }
html[data-theme="dark"] .library-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.25); }
html[data-theme="dark"] .library-card h3 { color: #f1f5f9; }
html[data-theme="dark"] .library-card .library-meta { color: #94a3b8; }
html[data-theme="dark"] .library-badge.trial { background: #451a03; color: #fcd34d; }
html[data-theme="dark"] .library-badge.active { background: #052e16; color: #86efac; }
html[data-theme="dark"] .library-badge.suspended { background: #450a0a; color: #fca5a5; }
html[data-theme="dark"] .library-badge.expired { background: #450a0a; color: #fca5a5; }
.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; }
.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) {
  .app-content, .auth-panel, .admin-toolbar, .dashboard-grid { grid-column: 1 / -1; }
  .app-content { grid-template-columns: 1fr; }
  .workspace, .dashboard-grid, .library-onboarding, .policy-grid, .pipeline-grid, .settings-grid, .label-workspace { grid-template-columns: 1fr; display: grid; }
  .library-hero { flex-direction: column; align-items: flex-start; }
  .library-hub { grid-template-columns: 1fr; }
  .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)); }
  .faq-grid { grid-template-columns: 1fr; }
  .batch-timeline { grid-template-columns: 1fr; }
  .plans-intro { align-items: flex-start; flex-direction: column; }
  .topbar { padding: 12px 14px; }
  .profile-strip { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-104%); transition: transform .25s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-backdrop.is-open { display: block; }
  .app-main { margin-left: 0; }
}
@media (max-width: 600px) {
  .app-content { padding: 10px 12px 28px; }
  .metric-grid, .plans-grid, .field-row { grid-template-columns: 1fr; }

  .panel { padding: 12px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .admin-toolbar-body { 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; }
  .trust-strip { flex-direction: column; gap: 8px; }
  .trust-strip span { width: 100%; justify-content: center; }
}
