:root {
  color-scheme: light;
  --accent: #970ab8;
  --accent-hover: #7c0998;
  --accent-soft: #f7eafa;
  --page: #f5f5f7;
  --surface: #ffffff;
  --surface-alt: #f1f1f5;
  --line: #e2e2e9;
  --ink: #201d26;
  --muted: #55515f;
  --green: var(--accent);
  --success: #22734f;
  --success-bg: #eaf6ef;
  --warning: #856019;
  --warning-bg: #fff5df;
  --danger: #ad384b;
  --danger-bg: #fff0f2;
  background: var(--page);
  color: var(--ink);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #d675ec;
  --accent-hover: #e89cfa;
  --accent-soft: #302037;
  --page: #111114;
  --surface: #1b1b20;
  --surface-alt: #24242b;
  --line: #34343e;
  --ink: #faf8ff;
  --muted: #cbc6d6;
  --success: #83d6a8;
  --success-bg: #1d342b;
  --warning: #edc67e;
  --warning-bg: #372f20;
  --danger: #f39aa8;
  --danger-bg: #3b232b;
}
body { background: var(--page); color: var(--ink); }
.galaxy-logo,.workspace-logo { object-fit: contain; flex-shrink: 0; background: transparent; padding: 2px; border-radius: 0; filter: drop-shadow(0 0 2px #ae0dd044) drop-shadow(0 0 5px #ae0dd022); }
:root[data-theme="dark"] .galaxy-logo,:root[data-theme="dark"] .workspace-logo { filter: brightness(1.3) saturate(1.15) drop-shadow(0 0 2px #d947ff99) drop-shadow(0 0 7px #bd20ef66); }
.auth-screen { background: #100511 url('/galaxy-bg.png') center right / cover no-repeat; position: relative; display: block; padding: 0; }
.auth-panel { width: 480px; max-width: 100%; min-height: 100dvh; margin-right: auto; padding: 56px 54px 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #fffffff2; border-right: 1px solid #ffffff20; }
:root[data-theme="dark"] .auth-panel { background: #111114f2; }
.auth-panel .auth-content { width: 100%; }
.auth-panel .auth-brand { margin-bottom: 30px; flex-direction: column; gap: 14px; text-align: center; }
.auth-panel .auth-brand .galaxy-logo { width: 180px; height: 128px; padding: 4px; }
.auth-panel .auth-brand>div { font-size: 28px; }
.auth-panel .auth-brand small { font-size: 10px; margin-top: 8px; }
.auth-panel .auth-footer { margin-top: 40px; }
.auth-theme-toggle { position: absolute; right: 24px; top: 24px; border: 1px solid #ffffff42; background: #17111fe8; color: #fff; width: 40px; height: 40px; z-index: 1; }
.auth-theme-toggle:hover { background: #302037; }
.auth-brand { gap: 17px; color: var(--ink); }
.auth-brand small,.brand small { color: var(--muted); }
#sidebar,header,.panel,.stat,.recipe-card,.permission,dialog,.notification-panel { background: var(--surface); color: var(--ink); border-color: var(--line); }
#sidebar { border-top: 3px solid #ab0ed0; }
.brand { gap: 10px; }
.brand .galaxy-logo { width: 58px; height: 44px; }
.nav-btn { color: var(--muted); }
.nav-btn.active { background: var(--accent-soft); color: var(--accent); }
.nav-btn:hover,.icon-btn:hover,tbody tr:hover { background: var(--surface-alt); }
.workspace,.profile,.branch-row,th,td,footer,.user-section,.document-line,.journal-line,.document-total,.document-summary,.view-tabs,.ingredient { border-color: var(--line); }
.workspace { background: var(--surface-alt); }
.btn { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn:hover { background: var(--surface-alt); }
.btn.primary,#auth-submit { background: #9e0bc1; border-color: #9e0bc1; color: #fff; }
.btn.primary:hover,#auth-submit:hover { background: #82099f; border-color: #82099f; }
.branch-tabs,.progress { background: var(--surface-alt); }
.branch-tab { color: var(--muted); }
.branch-tab.active { background: var(--surface); color: var(--accent); }
.stat-icon,.branch-number,.item-mark,.recipe-art,.info-band,.avatar { background: var(--accent-soft); color: var(--accent); border-color: var(--line); }
.stat:nth-child(2) .stat-icon { background: var(--success-bg); color: var(--success); }
.stat:nth-child(3) .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat:nth-child(4) .stat-icon { background: var(--surface-alt); color: var(--muted); }
.stat-foot b { color: var(--success); }
.live-dot { background: var(--success); }
.bar,.progress span,.legend span:before { background: var(--accent); }
.bar.light,.legend span:last-child:before { background: #b9a7c3; }
.bar.negative { background: var(--danger); }
.chart { background-image: repeating-linear-gradient(to top,transparent 0,transparent 42px,var(--line) 43px,var(--line) 44px); }
th { background: var(--surface-alt); }
.badge { background: var(--success-bg); color: var(--success); }
.badge.warn,.alert-strip { background: var(--warning-bg); color: var(--warning); border-color: var(--line); }
.badge.red,.error-message:not(:empty) { background: var(--danger-bg); color: var(--danger); }
.badge.purple { background: var(--accent-soft); color: var(--accent); }
.field input,.field select,#auth-form input,.payment-line input,.payment-line select,.recipe-line input,.recipe-line select,.document-note textarea,.select { background: var(--surface); color: var(--ink); border-color: var(--line); }
.search input { color: var(--ink); }
.field input:focus,.field select:focus,.document-note textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.check-option input { accent-color: #a90dce; }
.check-option,.mono,.breadcrumb b { color: var(--ink); }
.subtitle,.eyebrow,.muted,.block,.auth-content>p,.auth-footer,#auth-form>small,.nav-label,.sandbox,.role-label,.demo-label,.breadcrumb,.period,.stat-top,.stat-value small,.stat-foot,.panel-head p,.legend,.chart-day small,.chart-axis,.chart-caption,.branch-data small,.branch-total small,th,.item-cell small,.empty,.table-footer,.ingredient,.permission p,footer,.notification-panel p,.line-details,.document-summary small,.document-summary p,.document-meta,.screen-note { color: var(--muted); }
.alert-copy,.alert-copy svg { color: var(--warning); }
#account-message { color: var(--success); }
.account-actions #logout,#form-error,.error-message { color: var(--danger); }
#toast { background: var(--ink); color: var(--surface); }
dialog::backdrop { background: #08070da6; }
.shell,#sidebar,dialog { font-weight: 450; }
#sidebar nav .nav-btn { font-size: 14px; height: 41px; gap: 10px; padding-inline: 10px; }
.workspace { font-size: 13px; }
.workspace small,.profile small,.nav-label,.sandbox { font-size: 11px; }
.profile { font-size: 13px; }
.breadcrumb,.period { font-size: 12px; }
.subtitle { font-size: 14px; line-height: 1.7; }
.eyebrow { font-size: 11px; }
.btn,.select,.search input { font-size: 13px; }
.btn,.select { min-height: 39px; }
.branch-tab { font-size: 12px; height: 34px; }
.stat-top { font-size: 13px; }
.stat-foot,.stat-value small { font-size: 12px; }
.stat-value { font-size: 29px; }
.panel-head h2 { font-size: 16px; }
.panel-head p,.legend,.chart-day small,.chart-axis,.chart-caption { font-size: 11px; }
.chart-day { min-width: 0; }
.branch-data strong { font-size: 13px; }
.branch-data small,.branch-total small { font-size: 11px; }
table { font-size: 13px; }
th { font-size: 12px; font-weight: 500; }
.item-cell small,.badge,.table-footer,.mono { font-size: 11px; }
.item-cell small { color: var(--muted); }
.empty,.alert-copy { font-size: 13px; }
.text-btn,.view-tabs button { font-size: 13px; }
.field,.check-option,.document-meta,.ingredient { font-size: 13px; }
.line-main .field,.line-tracking .field,.journal-line .field { font-size: 12px; }
.document-summary small,.document-summary p,.line-details { font-size: 12px; }
.document-summary b { font-size: 14px; }
.recipe-body h2 { font-size: 16px; }
.recipe-body .subtitle { font-size: 12px; }
.recipe-cost { font-size: 13px; }
.permission p { font-size: 14px; }
.account-actions .text-btn,#account-message,footer,footer span:first-child { font-size: 11px; }
@media(max-width:1100px) { .branch-tab { font-size: 11px; } }
@media(max-width:480px) {
  .stat-top { font-size: 12px; }
  .stat-value { font-size: 26px; }
  .stat-foot { flex-wrap: wrap; }
  .branch-tab { font-size: 11px; }
  .chart { gap: 6px; }
  .chart-day { gap: 3px; }
  .chart-day small { font-size: 10px; }
  .bar { width: 11px; }
  footer { gap: 12px; flex-wrap: wrap; }
  footer span:last-child { font-size: 10px; }
}
@media(max-width:480px) {
  .header-tools { gap: 4px; }
  .header-tools .demo-label { display: none; }
  .auth-brand .galaxy-logo { width: 68px; height: 50px; }
}
@media(max-width:1000px) and (min-width:701px) {
  .auth-panel { width: 400px; padding-inline: 36px; }
  .auth-screen { background-position: 65% center; }
}
@media(max-width:700px) {
  .auth-screen { background: var(--page); padding-top: 220px; }
  .auth-screen::before { content: ''; position: absolute; inset: 0 0 auto; height: 220px; background: #100511 url('/galaxy-bg.png') 70% center / cover no-repeat; }
  .auth-panel,:root[data-theme="dark"] .auth-panel { width: 100%; min-height: calc(100dvh - 220px); background: var(--page); padding: 28px 24px; border: 0; }
  .auth-panel .auth-content { max-width: 380px; }
  .auth-panel .auth-brand { display: none; }
  .auth-panel .auth-footer { margin-top: 28px; }
  .auth-theme-toggle { top: 16px; right: 16px; }
}
@media(prefers-reduced-motion:reduce) { button,#sidebar { transition: none; } }
