:root {
  color-scheme: light;
  --navy-950: #111526;
  --navy-900: #191e34;
  --navy-800: #292f4b;
  --ink: #172037;
  --muted: #737d93;
  --line: #e5e8f0;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --canvas: #f5f7fb;
  --violet: #6857e5;
  --violet-dark: #5040c8;
  --violet-soft: #efedff;
  --success: #0d7655;
  --success-soft: #e4f8f0;
  --warning: #955c00;
  --warning-soft: #fff2d9;
  --danger: #b33650;
  --danger-soft: #ffe8ed;
  --focus-ring: #4937bd;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --navy-950: #080b16;
  --navy-900: #0d1222;
  --navy-800: #1a2238;
  --ink: #f1f4ff;
  --muted: #a8b1c8;
  --line: #2a334b;
  --surface: #11182a;
  --surface-raised: #172036;
  --canvas: #090e1b;
  --violet: #8f82ff;
  --violet-dark: #b4aaff;
  --violet-soft: #28234d;
  --success: #5bd6a5;
  --success-soft: #123c32;
  --warning: #ffb84d;
  --warning-soft: #432f10;
  --danger: #ff7892;
  --danger-soft: #471d2a;
  --focus-ring: #a99eff;
}

* { box-sizing: border-box; }
html { min-width: 0; background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 14px; line-height: 1.45; }
a { color: var(--violet); }
button, input, select, textarea { font: inherit; }
code { overflow-wrap: anywhere; word-break: break-word; }
.topbar h1, .form-heading h2 { overflow-wrap: anywhere; word-break: break-word; }

.admin-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  display: flex;
  width: 264px;
  flex-direction: column;
  overflow-y: auto;
  padding: 24px 14px 18px;
  color: #d9dced;
  background: var(--navy-950);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 22px; color: #fff; font-size: 20px; font-weight: 750; text-decoration: none; }
.brand small { color: #8f97b7; font-size: inherit; }
.brand-mark { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #fff; background: linear-gradient(145deg, #8e7fff, #5944d9); font-weight: 800; box-shadow: 0 8px 22px rgba(93, 71, 223, .34); }
.nav-symbol-library { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.navigation { display: grid; gap: 3px; }
.nav-link { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 42px; padding: 6px 9px; border: 1px solid transparent; border-radius: 11px; color: #b9bfd8; font-size: 12.5px; font-weight: 650; text-decoration: none; }
.nav-link:hover, .nav-link:focus-visible { color: #fff; background: var(--navy-800); }
.nav-link.active { border-color: rgba(143, 130, 255, .16); color: #fff; background: linear-gradient(90deg, rgba(104, 87, 229, .24), #303652 68%); box-shadow: inset 3px 0 0 #8f82ff; }
.nav-link.pending { color: #8d95b3; }
.nav-link small { color: #767f9f; font-size: 9px; letter-spacing: .05em; text-transform: uppercase; }
.nav-glyph { display: block; width: 28px; height: 28px; padding: 5px; border: 1px solid rgba(185, 191, 216, .16); border-radius: 9px; color: #aeb6d2; background: rgba(255, 255, 255, .035); fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.nav-link:hover .nav-glyph, .nav-link:focus-visible .nav-glyph { border-color: rgba(169, 158, 255, .42); color: #dedaff; background: rgba(143, 130, 255, .10); }
.nav-link.active .nav-glyph { border-color: rgba(169, 158, 255, .58); color: #bdb4ff; background: linear-gradient(145deg, rgba(143, 130, 255, .24), rgba(104, 87, 229, .10)); box-shadow: 0 0 18px rgba(104, 87, 229, .24); }
.sidebar-footer { display: grid; gap: 8px; margin-top: auto; padding: 22px 10px 0; color: #9098b7; font-size: 11px; }
.read-only { display: flex; align-items: center; gap: 7px; }
.read-only i, .safety-badge i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #49c999; }
.logout-button { min-height: 38px; border: 0; padding: 5px 0; color: #c6cbe0; background: transparent; cursor: pointer; font-weight: 650; }
.logout-button:hover { color: #fff; }

.main-content { min-height: 100vh; margin-left: 264px; padding: 32px 38px 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 5px; color: #8a91a4; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.topbar h1, .login-card h1 { margin: 0; font-size: 27px; line-height: 1.2; letter-spacing: -.025em; }
.theme-controls { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; margin-left: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; padding: 0; margin: -1px; border: 0; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.global-search { display: flex; align-items: center; gap: 7px; }
.global-search label { margin: 0; }
.global-search input { width: min(28vw, 300px); min-height: 38px; }
.safety-badge { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font-size: 11px; }
.theme-toggle { display: inline-grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 0; color: var(--violet-dark); background: var(--surface); box-shadow: 0 5px 16px rgba(30, 37, 66, .08); cursor: pointer; }
.theme-toggle:hover { border-color: #bcb4f8; color: var(--violet); background: var(--violet-soft); }
.theme-toggle:focus-visible { border-color: var(--focus-ring); outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.theme-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-sun { display: block; }
html[data-theme="dark"] .theme-icon-moon { display: none; }
.auth-theme-toggle { position: fixed; top: 18px; right: 18px; z-index: 20; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric-card, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 7px 24px rgba(30, 37, 66, .035); }
.metric-card { min-height: 127px; padding: 18px; }
.metric-card > span { display: block; min-height: 37px; color: var(--muted); font-size: 12px; font-weight: 650; }
.metric-card strong { display: block; overflow: hidden; font-size: 24px; line-height: 1.25; letter-spacing: -.025em; text-overflow: ellipsis; }
.metric-card small { display: block; margin-top: 7px; color: #9aa1b1; font-size: 10.5px; }
.metric-card.accent { border-color: transparent; color: #fff; background: linear-gradient(145deg, #7363eb, #5140c8); }
.metric-card.accent > span, .metric-card.accent small { color: #e5e1ff; }
.metric-card.warning strong { color: var(--warning); }
.metric-card.danger strong { color: var(--danger); }
.content-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 18px; }
.panel { padding: 20px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
.panel-heading h2 { margin: 0; font-size: 16px; }
.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.panel-heading a { font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
code { padding: 1px 4px; border-radius: 4px; background: #f0f1f6; }
.table-wrap { max-width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 9px 8px; border-bottom: 1px solid var(--line); color: #8991a3; font-size: 10px; font-weight: 800; letter-spacing: .05em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { max-width: 330px; padding: 12px 8px; border-bottom: 1px solid #eff1f5; overflow: hidden; text-overflow: ellipsis; vertical-align: top; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; max-width: 180px; overflow: hidden; padding: 4px 8px; border-radius: 999px; color: #555e75; background: #eef0f5; font-size: 10px; font-weight: 750; text-overflow: ellipsis; }
.empty-state { padding: 28px 10px; color: var(--muted); text-align: center; white-space: normal; }
.rank-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 10px; padding: 11px 0; border-bottom: 1px solid #eff1f5; }
.rank-list > div:last-child { border-bottom: 0; }
.rank-list span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list small { grid-column: 1 / -1; color: var(--muted); }

.overview-content-grid { grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); margin-bottom: 18px; }
.revenue-series { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.revenue-point { display: grid; min-width: 0; align-content: end; gap: 8px; }
.revenue-point label { display: grid; min-width: 0; gap: 3px; color: var(--muted); font-size: 10px; }
.revenue-point label span { overflow: hidden; color: var(--ink); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.revenue-point progress { width: 100%; height: 12px; accent-color: var(--violet); }
.operations-list { display: grid; gap: 0; margin: 0; }
.operations-list > div { display: grid; grid-template-columns: minmax(120px, .9fr) minmax(0, 1.1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.operations-list > div:last-child { border-bottom: 0; }
.operations-list dt { color: var(--muted); font-size: 11px; font-weight: 750; }
.operations-list dd { display: grid; min-width: 0; justify-items: start; gap: 5px; margin: 0; }
.operations-list .status { max-width: 100%; overflow: visible; text-overflow: clip; white-space: normal; }
.operations-list time, .operations-list small { color: var(--muted); font-size: 10px; }
.operations-links { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 15px; font-size: 11px; font-weight: 750; }
.operations-links a { text-decoration: none; }
.overview-error { max-width: 720px; }
.overview-error h2 { margin: 0 0 8px; }
.overview-error > p { color: var(--muted); }
.overview-error .correlation { overflow-wrap: anywhere; }
.dashboard-page { display: grid; gap: 18px; max-width: 1440px; }
.dashboard-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 26px 28px; border: 1px solid #5950ab; border-radius: 18px; color: #f8f7ff; background: radial-gradient(circle at 86% 20%, rgba(173, 157, 255, .28), transparent 31%), linear-gradient(120deg, #211e54, #383080); box-shadow: 0 14px 34px rgba(54, 43, 151, .18); }
.dashboard-kicker { margin: 0 0 6px; color: #c9c3ff; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.dashboard-hero h2 { margin: 0; font-size: clamp(24px, 2.5vw, 34px); letter-spacing: -.04em; }
.dashboard-hero p:not(.dashboard-kicker) { max-width: 570px; margin: 7px 0 0; color: #dedaff; font-size: 13px; }
.dashboard-hero-actions { display: flex; flex: 0 0 auto; flex-wrap: wrap; gap: 9px; }
.dashboard-hero .button.primary { color: #302769; background: #fff; }
.dashboard-hero .button.primary:hover { color: #1f1951; background: #eeeaff; }
.dashboard-hero .button.secondary { color: #f3f1ff; background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.dashboard-hero .button.secondary:hover { color: #fff; background: rgba(255, 255, 255, .2); }
.dashboard-metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.dashboard-metric-grid .metric-card { min-height: 112px; }
.dashboard-metric-grid .metric-card > span { min-height: auto; }
.dashboard-content-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .85fr); align-items: stretch; gap: 18px; }
.dashboard-orders-panel, .dashboard-next-panel, .dashboard-products-panel { min-width: 0; }
.dashboard-checklist { display: grid; gap: 2px; padding: 0; margin: 0; list-style: none; }
.dashboard-checklist li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 13px 0; border-top: 1px solid var(--line); }
.dashboard-checklist li:first-child { padding-top: 0; border-top: 0; }
.dashboard-checklist > li > span { display: grid; width: 25px; height: 25px; place-items: center; border-radius: 50%; color: var(--violet-dark); background: var(--violet-soft); font-size: 11px; font-weight: 800; }
.dashboard-checklist strong, .dashboard-checklist small, .dashboard-checklist a { display: block; }
.dashboard-checklist strong { font-size: 12px; }
.dashboard-checklist small { margin: 3px 0 7px; color: var(--muted); font-size: 11px; }
.dashboard-checklist a { color: var(--violet-dark); font-size: 11px; font-weight: 750; text-decoration: none; }
.dashboard-checklist a:hover { text-decoration: underline; text-underline-offset: 3px; }
.dashboard-product-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.dashboard-product-list > div:not(.empty-state) { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-raised); }
.dashboard-product-list span, .dashboard-product-list strong, .dashboard-product-list small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-product-list span { font-size: 12px; font-weight: 750; }
.dashboard-product-list strong { margin-top: 7px; font-size: 12px; }
.dashboard-product-list small { margin-top: 3px; color: var(--muted); font-size: 10.5px; }

.resource-intro { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 15px; }
.resource-intro p { margin: 0 0 4px; color: #3f485e; }
.resource-intro span { color: var(--muted); font-size: 11px; }
.filters { display: flex; align-items: end; gap: 9px; margin-bottom: 15px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.filters label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
.filters label:first-child { flex: 1 1 220px; }
.bank-statement-filters { flex-wrap: wrap; }
.bank-statement-filters label { min-width: 0; flex: 1 1 150px; }
.bank-statement-filters label:first-child { flex: 2 1 260px; }
.bank-statement-filters input,
.bank-statement-filters select { width: 100%; max-width: 100%; }
.bank-statement-filters .button { flex: 0 0 auto; }
input, select, textarea { min-height: 38px; border: 1px solid #dce0e9; border-radius: 8px; padding: 8px 10px; color: var(--ink); background: #fff; outline: none; }
textarea { line-height: 1.55; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #8879ec; outline: 2px solid var(--focus-ring); outline-offset: 1px; box-shadow: none; }
input:disabled, select:disabled, textarea:disabled { color: #697287; background: #f1f2f6; cursor: not-allowed; opacity: 1; }
.button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; border: 0; border-radius: 8px; padding: 9px 14px; cursor: pointer; font-weight: 700; text-decoration: none; }
.button.primary { color: #fff; background: var(--violet); }
.button.primary:hover:not(:disabled) { background: var(--violet-dark); }
.button.secondary { color: #555e75; background: #edeef4; }
.button.secondary:hover:not(:disabled) { color: var(--ink); background: #e1e3eb; }
.button.danger { color: #fff; background: var(--danger); }
.button.danger:hover:not(:disabled) { background: #982c44; }
.button.success { color: #fff; background: var(--success); }
.button.success:hover:not(:disabled) { background: #0a5e44; }
.button:disabled { cursor: not-allowed; filter: grayscale(.2); opacity: .55; }
.button:focus-visible, .back-link:focus-visible, .table-link:focus-visible, .form-heading a:focus-visible,
.panel a:focus-visible, .pagination a:focus-visible, .brand:focus-visible, .nav-link:focus-visible,
a:focus-visible, button:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.brand:focus-visible, .nav-link:focus-visible { outline-color: #b8afff; }
.logout-button:focus-visible { outline: 3px solid #b8afff; outline-offset: 2px; }
.table-panel { padding: 4px 12px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 18px; color: var(--muted); font-size: 12px; }
.pagination a { display: inline-flex; min-height: 38px; align-items: center; font-weight: 700; text-decoration: none; }

.resource-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.table-link { color: var(--violet-dark); font-weight: 750; text-underline-offset: 3px; }
.table-link:hover { color: #392aa8; }

.detail-actions { display: flex; min-height: 38px; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.back-link { display: inline-flex; min-height: 38px; align-items: center; border-radius: 7px; color: #5e6780; font-weight: 700; text-decoration: none; }
.back-link:hover { color: var(--violet-dark); text-decoration: underline; text-underline-offset: 3px; }
.version-badge { display: inline-flex; flex: 0 0 auto; align-items: center; padding: 5px 9px; border: 1px solid #d9d5fb; border-radius: 999px; color: #5145a6; background: var(--violet-soft); font-size: 10.5px; font-weight: 800; }
.safety-notice { max-width: 1040px; margin: 0 0 14px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; font-weight: 650; }
.safety-notice.warning { border-color: #ebc77d; color: #6d4300; background: var(--warning-soft); }
.safety-notice.warning a { color: inherit; text-decoration-thickness: 2px; }
.safety-notice.danger { border-color: #f1b8c5; color: #8f263d; background: var(--danger-soft); }

.catalog-form { width: 100%; max-width: 1040px; padding: 24px; }
.form-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.form-heading > * { min-width: 0; }
.form-heading h2 { margin: 0; font-size: 17px; }
.form-heading p { margin: 5px 0 0; color: var(--muted); font-size: 11.5px; }
.form-heading a { flex: 0 0 auto; border-radius: 6px; font-size: 12px; font-weight: 750; text-decoration: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 18px; }
.form-grid label { display: grid; min-width: 0; align-content: start; gap: 6px; color: #535d73; font-size: 11.5px; font-weight: 750; }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; }
.form-grid textarea { min-height: 116px; }
.form-grid small { color: var(--muted); font-size: 10.5px; font-weight: 500; }
.code-input { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 12px; tab-size: 2; }
.check-grid { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.check { display: inline-flex; min-height: 40px; align-items: center; gap: 9px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; color: #505a71; background: #fafbfe; cursor: pointer; font-size: 11.5px; font-weight: 750; }
.check:hover { border-color: #cbc6f4; background: #f7f5ff; }
.check:focus-within { border-color: var(--focus-ring); background: #f7f5ff; }
.check input { width: 17px; height: 17px; min-height: 0; flex: 0 0 auto; margin: 0; padding: 0; accent-color: var(--violet); cursor: pointer; }
.check input:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; box-shadow: none; }
.form-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.form-footer form { margin: 0; }
.stacked-action { display: grid; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.stacked-action label { display: grid; gap: 6px; color: #535d73; font-size: 11.5px; font-weight: 750; }
.stacked-action small { color: var(--muted); font-size: 10.5px; font-weight: 500; }
.stacked-action .button { justify-self: start; }
.stock-preview-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stock-preview-grid .metric-card { min-height: 96px; }
.stock-preview-grid .metric-card > span { min-height: 30px; }
.stock-preview-tables { align-items: start; margin-bottom: 18px; }
.stock-commit-panel { max-width: 1040px; }
.stock-preview-list { max-width: 620px; }
.secret-reveal { max-width: 900px; border-color: #e3bfc8; }
.secret-value { display: inline-block; max-width: 100%; overflow-wrap: anywhere; color: #81243d; background: #fff4f6; }

.catalog-detail-grid { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(0, 2fr); align-items: start; gap: 18px; }
.product-summary, .variants-panel { min-width: 0; }
.detail-list { display: grid; grid-template-columns: minmax(84px, auto) minmax(0, 1fr); gap: 10px 14px; margin: 0; }
.detail-list dt { color: #8991a3; font-size: 10px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.detail-list dd { min-width: 0; margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.product-summary .form-footer { justify-content: space-between; }
.status.active,
.status.available,
.status.allocated,
.status.delivered,
.status.completed,
.status.paid,
.status.succeeded,
.status.processed,
.status.committed,
.status.verified,
.status.passed,
.status.sent,
.status.resolved,
.status.replaced,
.status.consumed,
.status.approved,
.status.clear,
.status.subscribed,
.status.normal { color: var(--success); background: var(--success-soft); }
.status.draft,
.status.scheduled,
.status.sending,
.status.sending_placeholder,
.status.pending,
.status.proof_submitted,
.status.verifying,
.status.paid_waiting_stock,
.status.awaiting_payment,
.status.payment_review,
.status.fulfilling,
.status.delivery_unknown,
.status.retry,
.status.reserved,
.status.delivering,
.status.preview,
.status.committing,
.status.open,
.status.acknowledged,
.status.in_review,
.status.awaiting_admin,
.status.awaiting_customer,
.status.replacement_pending,
.status.creating,
.status.running,
.status.read_only,
.status.maintenance,
.status.leased,
.status.started,
.status.received,
.status.refunded_manual,
.status.rolled_back,
.status.p2 { color: var(--warning); background: var(--warning-soft); }
.status.archived,
.status.blocked,
.status.failed,
.status.cancelled,
.status.rejected,
.status.expired,
.status.delivery_blocked,
.status.dead,
.status.invalid,
.status.disabled,
.status.quarantined,
.status.confirmed_duplicate,
.status.confirmed_invalid,
.status.deleted,
.status.ambiguous,
.status.p0,
.status.p1 { color: var(--danger); background: var(--danger-soft); }
.status.inactive { color: #626b80; background: #eef0f5; }
.status.p3,
.status.public,
.status.private,
.status.secret,
.status.skipped,
.status.ignored,
.status.released,
.status.legacy_imported { color: #555e75; background: #eef0f5; }
.archive-strip { display: flex; width: 100%; max-width: 1040px; align-items: center; justify-content: space-between; gap: 20px; margin-top: 16px; padding: 16px 18px; border: 1px solid #f1bdc8; border-radius: var(--radius); background: #fff7f9; }
.archive-strip strong { color: #8f263d; }
.archive-strip p { margin: 3px 0 0; color: #79616a; font-size: 11px; }

.coming-soon { max-width: 720px; padding: 48px 36px; text-align: center; }
.coming-soon h2 { margin: 0 0 10px; font-size: 22px; }
.coming-soon > p:not(.eyebrow) { max-width: 560px; margin: 7px auto; color: var(--muted); }
.coming-soon .button { margin-top: 20px; }
.coming-icon { display: grid; width: 54px; height: 54px; place-items: center; margin: 0 auto 16px; border-radius: 16px; color: #fff; background: linear-gradient(145deg, #8d7fff, #5944d9); font-size: 24px; font-weight: 800; }

.auth-shell { min-height: 100vh; background: radial-gradient(circle at 18% 14%, #e8e4ff 0, transparent 35%), var(--canvas); }
.auth-content { display: grid; min-height: 100vh; place-content: center; padding: 24px; }
.login-card { width: min(420px, calc(100vw - 36px)); padding: 40px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 24px 60px rgba(33, 30, 92, .12); text-align: center; }
.login-mark { width: 52px; height: 52px; margin: 0 auto 18px; border-radius: 15px; font-size: 24px; }
.login-card .subtle { margin: 11px 0 24px; color: var(--muted); line-height: 1.6; }
.login-card form { display: grid; gap: 8px; text-align: left; }
.login-card label { font-size: 12px; font-weight: 700; }
.wide { width: 100%; margin-top: 8px; }
.login-hint { margin: 18px 0 0; color: #969dae; font-size: 10.5px; }
.toast-region { position: relative; z-index: 30; }
.flash { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin: 0 0 16px; padding: 11px 13px; border-radius: 9px; font-weight: 650; }
.flash.error { color: var(--danger); background: var(--danger-soft); }
.flash.success { color: var(--success); background: var(--success-soft); }
.toast-dismiss { min-height: 32px; flex: 0 0 auto; border: 0; padding: 4px 7px; color: inherit; background: transparent; cursor: pointer; font-weight: 750; }
.toast-dismiss:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.confirm-dialog { width: min(92vw, 520px); border: 1px solid var(--line); border-radius: 16px; padding: 0; color: var(--ink); background: var(--surface); box-shadow: 0 24px 80px rgba(10, 16, 34, .35); }
.confirm-dialog::backdrop { background: rgba(8, 13, 29, .66); backdrop-filter: blur(2px); }
.confirm-dialog form { display: grid; gap: 14px; padding: 24px; }
.confirm-dialog h2, .confirm-dialog p { margin: 0; }
.confirm-dialog p { color: var(--muted); line-height: 1.6; }
form[aria-busy="true"] { cursor: progress; }
.button.is-loading { cursor: progress; opacity: .72; }

.form-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); align-items: start; gap: 18px; }
.form-panel, .preview-panel, .wide-panel { min-width: 0; background: var(--surface); }
.form-panel form { display: grid; gap: 12px; }
.form-panel form > label:not(.checkbox-row) { display: grid; gap: 6px; color: var(--muted); font-weight: 700; }
.checkbox-row { display: flex; min-height: 38px; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-raised); }
.checkbox-row input { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; accent-color: var(--violet); }
.form-actions { display: flex; flex-wrap: wrap; gap: 9px; padding-top: 6px; }
.preview-panel { position: sticky; top: 22px; }
.emoji-preview { display: grid; min-height: 96px; place-items: center; margin: 12px 0; border: 1px solid var(--line); border-radius: 12px; background: var(--violet-soft); font-size: 36px; }
.inline-form { display: inline-flex; margin: 2px 4px 2px 0; }
.table-actions { min-width: 260px; white-space: nowrap; }
.table-actions .button { margin: 2px 4px 2px 0; }
.inline-details { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-raised); }
.inline-details summary { min-height: 38px; cursor: pointer; font-weight: 700; }
.inline-details form { display: grid; gap: 8px; padding-top: 8px; }
.preview-card { max-width: 640px; margin-bottom: 18px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-raised); overflow-wrap: anywhere; }
.safe-log { max-width: 100%; margin: 0; overflow-x: auto; padding: 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface-raised); white-space: pre-wrap; overflow-wrap: anywhere; }
.runbook-sections { display: grid; gap: 14px; margin-top: 18px; }
.runbook-sections section { padding-top: 12px; border-top: 1px solid var(--line); }
.runbook-sections h3 { margin: 0 0 6px; font-size: 15px; }
.runbook-sections p { margin: 0; overflow-wrap: anywhere; }

html.theme-ready body,
html.theme-ready .sidebar,
html.theme-ready .metric-card,
html.theme-ready .panel,
html.theme-ready .filters,
html.theme-ready .login-card,
html.theme-ready input,
html.theme-ready select,
html.theme-ready textarea,
html.theme-ready .button,
html.theme-ready .theme-toggle,
html.theme-ready .checkbox-row,
html.theme-ready .emoji-preview,
html.theme-ready .inline-details,
html.theme-ready .preview-card,
html.theme-ready .safe-log {
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

html[data-theme="dark"] .sidebar {
  border-right: 1px solid #202943;
  background: var(--navy-950);
}
html[data-theme="dark"] .nav-link:hover,
html[data-theme="dark"] .nav-link:focus-visible,
html[data-theme="dark"] .nav-link.active { background: var(--navy-800); }
html[data-theme="dark"] .nav-link.active .nav-glyph { border-color: rgba(143, 130, 255, .66); color: #c9c2ff; background: linear-gradient(145deg, rgba(143, 130, 255, .28), rgba(104, 87, 229, .12)); }
html[data-theme="dark"] .safety-badge,
html[data-theme="dark"] .filters,
html[data-theme="dark"] .login-card { background: var(--surface); }
html[data-theme="dark"] .theme-toggle {
  color: var(--violet-dark);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .24);
}
html[data-theme="dark"] .theme-toggle:hover { border-color: var(--violet); color: var(--ink); background: var(--violet-soft); }
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .panel { box-shadow: 0 14px 36px rgba(0, 0, 0, .24); }
html[data-theme="dark"] .metric-card.accent {
  border-color: #5f51c8;
  color: var(--ink);
  background: linear-gradient(145deg, var(--violet-soft), var(--surface-raised));
}
html[data-theme="dark"] .metric-card.accent > span,
html[data-theme="dark"] .metric-card.accent small { color: #c8c2ef; }
html[data-theme="dark"] code { color: #ddd9ff; background: #1b2540; }
html[data-theme="dark"] th { color: #aeb7cd; }
html[data-theme="dark"] td,
html[data-theme="dark"] .rank-list > div { border-bottom-color: var(--line); }
html[data-theme="dark"] .status { color: #dce2f2; background: #263149; }
html[data-theme="dark"] .status.active,
html[data-theme="dark"] .status.available,
html[data-theme="dark"] .status.allocated,
html[data-theme="dark"] .status.delivered,
html[data-theme="dark"] .status.completed,
html[data-theme="dark"] .status.paid,
html[data-theme="dark"] .status.succeeded,
html[data-theme="dark"] .status.processed,
html[data-theme="dark"] .status.committed,
html[data-theme="dark"] .status.verified,
html[data-theme="dark"] .status.passed,
html[data-theme="dark"] .status.sent,
html[data-theme="dark"] .status.resolved,
html[data-theme="dark"] .status.replaced,
html[data-theme="dark"] .status.consumed,
html[data-theme="dark"] .status.approved,
html[data-theme="dark"] .status.clear,
html[data-theme="dark"] .status.subscribed,
html[data-theme="dark"] .status.normal { color: var(--success); background: var(--success-soft); }
html[data-theme="dark"] .status.draft,
html[data-theme="dark"] .status.scheduled,
html[data-theme="dark"] .status.sending,
html[data-theme="dark"] .status.sending_placeholder,
html[data-theme="dark"] .status.pending,
html[data-theme="dark"] .status.proof_submitted,
html[data-theme="dark"] .status.verifying,
html[data-theme="dark"] .status.paid_waiting_stock,
html[data-theme="dark"] .status.awaiting_payment,
html[data-theme="dark"] .status.payment_review,
html[data-theme="dark"] .status.fulfilling,
html[data-theme="dark"] .status.delivery_unknown,
html[data-theme="dark"] .status.retry,
html[data-theme="dark"] .status.reserved,
html[data-theme="dark"] .status.delivering,
html[data-theme="dark"] .status.preview,
html[data-theme="dark"] .status.committing,
html[data-theme="dark"] .status.open,
html[data-theme="dark"] .status.acknowledged,
html[data-theme="dark"] .status.in_review,
html[data-theme="dark"] .status.awaiting_admin,
html[data-theme="dark"] .status.awaiting_customer,
html[data-theme="dark"] .status.replacement_pending,
html[data-theme="dark"] .status.creating,
html[data-theme="dark"] .status.running,
html[data-theme="dark"] .status.read_only,
html[data-theme="dark"] .status.maintenance,
html[data-theme="dark"] .status.leased,
html[data-theme="dark"] .status.started,
html[data-theme="dark"] .status.received,
html[data-theme="dark"] .status.refunded_manual,
html[data-theme="dark"] .status.rolled_back,
html[data-theme="dark"] .status.p2 { color: var(--warning); background: var(--warning-soft); }
html[data-theme="dark"] .status.archived,
html[data-theme="dark"] .status.blocked,
html[data-theme="dark"] .status.failed,
html[data-theme="dark"] .status.cancelled,
html[data-theme="dark"] .status.rejected,
html[data-theme="dark"] .status.expired,
html[data-theme="dark"] .status.delivery_blocked,
html[data-theme="dark"] .status.dead,
html[data-theme="dark"] .status.invalid,
html[data-theme="dark"] .status.disabled,
html[data-theme="dark"] .status.quarantined,
html[data-theme="dark"] .status.confirmed_duplicate,
html[data-theme="dark"] .status.confirmed_invalid,
html[data-theme="dark"] .status.deleted,
html[data-theme="dark"] .status.ambiguous,
html[data-theme="dark"] .status.p0,
html[data-theme="dark"] .status.p1 { color: var(--danger); background: var(--danger-soft); }
html[data-theme="dark"] .resource-intro p { color: #dce2f2; }
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  border-color: #35405b;
  color: var(--ink);
  background: #0c1323;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #7f8aa3; }
html[data-theme="dark"] input:disabled,
html[data-theme="dark"] select:disabled,
html[data-theme="dark"] textarea:disabled { color: #909bb3; background: #1b2438; }
html[data-theme="dark"] .button.primary { color: var(--navy-950); background: var(--violet); }
html[data-theme="dark"] .button.primary:hover:not(:disabled) { color: var(--navy-950); background: var(--violet-dark); }
html[data-theme="dark"] .button.secondary { color: #dce2f2; background: #263149; }
html[data-theme="dark"] .button.secondary:hover:not(:disabled) { color: #fff; background: #333f5b; }
html[data-theme="dark"] .button.danger { color: var(--navy-950); background: var(--danger); }
html[data-theme="dark"] .button.danger:hover:not(:disabled) { color: #fff; background: #c93f5b; }
html[data-theme="dark"] .button.success { color: var(--navy-950); background: var(--success); }
html[data-theme="dark"] .button.success:hover:not(:disabled) { color: var(--navy-950); background: #3bbf8d; }
html[data-theme="dark"] .table-link,
html[data-theme="dark"] .back-link { color: var(--violet-dark); }
html[data-theme="dark"] .table-link:hover,
html[data-theme="dark"] .back-link:hover { color: #d8d2ff; }
html[data-theme="dark"] .version-badge { border-color: #504787; color: #d5d0ff; background: var(--violet-soft); }
html[data-theme="dark"] .safety-notice.warning { border-color: #7b5b23; color: #ffd38a; background: var(--warning-soft); }
html[data-theme="dark"] .safety-notice.danger { border-color: #7e3448; color: #ffb0c0; background: var(--danger-soft); }
html[data-theme="dark"] .form-grid label,
html[data-theme="dark"] .stacked-action label { color: #c1c9db; }
html[data-theme="dark"] .check { border-color: var(--line); color: #cbd2e2; background: #131c2f; }
html[data-theme="dark"] .check:hover,
html[data-theme="dark"] .check:focus-within { border-color: #655a9b; background: var(--violet-soft); }
html[data-theme="dark"] .secret-reveal { border-color: #7e3448; }
html[data-theme="dark"] .secret-value { color: #ffc2ce; background: #351823; }
html[data-theme="dark"] .dashboard-hero { border-color: #4e469d; background: radial-gradient(circle at 86% 20%, rgba(151, 138, 255, .28), transparent 31%), linear-gradient(120deg, #15143b, #292362); }
html[data-theme="dark"] .status.inactive { color: #c2cadb; background: #263149; }
html[data-theme="dark"] .status.p3,
html[data-theme="dark"] .status.public,
html[data-theme="dark"] .status.private,
html[data-theme="dark"] .status.secret,
html[data-theme="dark"] .status.skipped,
html[data-theme="dark"] .status.ignored,
html[data-theme="dark"] .status.released,
html[data-theme="dark"] .status.legacy_imported { color: #c2cadb; background: #263149; }
html[data-theme="dark"] .form-panel,
html[data-theme="dark"] .preview-panel,
html[data-theme="dark"] .wide-panel { background: var(--surface); }
html[data-theme="dark"] .checkbox-row,
html[data-theme="dark"] .inline-details,
html[data-theme="dark"] .preview-card,
html[data-theme="dark"] .safe-log { border-color: var(--line); background: var(--surface-raised); }
html[data-theme="dark"] .emoji-preview { border-color: #504787; background: var(--violet-soft); }
html[data-theme="dark"] .archive-strip { border-color: #7e3448; background: #2b1520; }
html[data-theme="dark"] .archive-strip strong { color: #ff9caf; }
html[data-theme="dark"] .archive-strip p { color: #caa7b0; }
html[data-theme="dark"] .auth-shell {
  background: radial-gradient(circle at 18% 14%, rgba(105, 87, 229, .24) 0, transparent 35%), var(--canvas);
}
html[data-theme="dark"] .login-card { box-shadow: 0 28px 70px rgba(0, 0, 0, .42); }
html[data-theme="dark"] .login-hint { color: #8d98af; }

@media (prefers-reduced-motion: reduce) {
  html.theme-ready body,
  html.theme-ready .sidebar,
  html.theme-ready .metric-card,
  html.theme-ready .panel,
  html.theme-ready .filters,
  html.theme-ready .login-card,
  html.theme-ready input,
  html.theme-ready select,
  html.theme-ready textarea,
  html.theme-ready .button,
  html.theme-ready .theme-toggle,
  html.theme-ready .checkbox-row,
  html.theme-ready .emoji-preview,
  html.theme-ready .inline-details,
  html.theme-ready .preview-card,
  html.theme-ready .safe-log {
    transition: none;
  }
}

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stock-preview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bank-statement-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .main-content { padding-right: 25px; padding-left: 25px; }
}

@media (max-width: 900px) {
  .sidebar { width: 220px; }
  .main-content { margin-left: 220px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stock-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid { grid-template-columns: 1fr; }
  .dashboard-content-grid { grid-template-columns: 1fr; }
  .revenue-series { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .catalog-detail-grid { grid-template-columns: minmax(0, 1fr); }
  .form-layout { grid-template-columns: minmax(0, 1fr); }
  .preview-panel { position: static; }
  .filters { flex-wrap: wrap; }
}

@media (max-width: 680px) {
  .admin-shell { display: flex; min-height: 100vh; flex-direction: column; }
  .sidebar { position: static; width: 100%; max-height: none; padding: 15px; }
  .brand { padding-bottom: 13px; }
  .navigation { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-link { min-height: 38px; }
  .sidebar-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 15px; }
  .main-content { margin-left: 0; padding: 22px 14px 36px; }
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .theme-controls { width: 100%; margin-left: 0; flex-wrap: wrap; }
  .global-search { width: 100%; order: 3; }
  .global-search label { flex: 1; }
  .global-search input { width: 100%; }
  .safety-badge { display: none; }
  .metric-grid { gap: 9px; }
  .dashboard-hero { align-items: flex-start; flex-direction: column; padding: 22px 18px; }
  .dashboard-hero-actions { width: 100%; }
  .dashboard-hero-actions .button { flex: 1 1 160px; }
  .dashboard-product-list { grid-template-columns: 1fr; }
  .revenue-series { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stock-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .metric-card { min-height: 120px; padding: 14px; }
  .metric-card strong { font-size: 20px; }
  .filters { display: grid; }
  .filters label:first-child { flex-basis: auto; }
  .resource-intro, .form-heading { align-items: stretch; flex-direction: column; gap: 10px; }
  .resource-actions { justify-content: flex-start; }
  .catalog-form { padding: 18px 15px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); gap: 15px; }
  .form-grid label.full { grid-column: auto; }
  .check-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
  .form-footer > .button, .form-footer > form { flex: 1 1 100%; width: 100%; }
  .form-footer > form input, .form-footer > form select, .form-footer > form button, .form-footer > form .button { width: 100%; }
  .detail-list { grid-template-columns: minmax(74px, auto) minmax(0, 1fr); }
  .archive-strip { align-items: stretch; flex-direction: column; }
  .archive-strip .button { width: 100%; }
  .login-card { padding: 32px 23px; }
}

@media (max-width: 430px) {
  .auth-theme-toggle { top: 12px; right: 12px; }
  .detail-actions { align-items: flex-start; flex-direction: column; }
  .detail-list { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .detail-list dt:not(:first-child) { margin-top: 9px; }
  .stock-preview-grid { grid-template-columns: minmax(0, 1fr); }
  .metric-grid, .revenue-series { grid-template-columns: minmax(0, 1fr); }
  .operations-list > div { grid-template-columns: minmax(0, 1fr); gap: 5px; }
}
