:root {
  --bg: #fff; --surface: #f7f8fa; --side: #fff; --text: #172033;
  --muted: #687386; --line: #e5e7eb; --blue: #2563eb; --pale: #eff5ff;
  --radius: 8px;
  font-family: "Segoe UI", Arial, sans-serif; font-size: 15px; line-height: 1.5; color: var(--text);
}
.promotion-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
#promotion { scroll-margin-top: 20px; }
#promotion > * + * { margin-top: 14px; }
#promotion details > form { margin-top: 16px; }
@media (max-width: 650px) { .promotion-fields { grid-template-columns: 1fr; } }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 9px 15px; border: 1px solid #d7dce4; border-radius: var(--radius);
  background: #fff; color: var(--text); cursor: pointer; font-weight: 500; line-height: 1.4;
  text-decoration: none; transition: background .15s, border-color .15s;
}
button:hover, .button:hover { background: var(--surface); border-color: #b7c1d1; text-decoration: none; }
.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
button:disabled { opacity: .5; cursor: not-allowed; }
button[aria-busy="true"] { cursor: progress; }
.link-button { min-height: 24px; padding: 0; border: 0; background: none; color: var(--blue); font-weight: 400; }
.link-button:hover { background: none; text-decoration: underline; }
.danger { color: #b42335; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid #a9c7ff; outline-offset: 3px; }
input, textarea, select {
  min-width: 0; width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid #cfd6e0;
  border-radius: 6px; background: #fff; color: var(--text); line-height: 1.45;
}
input::placeholder, textarea::placeholder { color: #8791a1; }
input:focus, textarea:focus, select:focus { outline: 2px solid #d5e4ff; border-color: var(--blue); }
textarea { resize: vertical; }
input[type=file] { font-size: 13px; padding: 7px; }
input[type=file]::file-selector-button { font: inherit; border: 0; border-right: 1px solid var(--line); padding: 3px 10px 3px 3px; margin-right: 10px; background: none; color: var(--text); cursor: pointer; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 18px; flex: 0 0 18px; accent-color: var(--blue); margin: 2px 0 0; }
label { display: flex; flex-direction: column; gap: 7px; font-size: 14px; font-weight: 500; }
label.checkbox { flex-direction: row; align-items: flex-start; gap: 10px; font-weight: 500; }
small { display: block; font-size: 12px; line-height: 1.5; color: var(--muted); font-weight: 400; }
form, h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; line-height: 1.3; letter-spacing: -.6px; font-weight: 650; }
h2 { font-size: 18px; line-height: 1.4; letter-spacing: -.2px; font-weight: 600; }
h3 { font-size: 16px; line-height: 1.4; font-weight: 600; }
p { line-height: 1.6; color: var(--muted); }
p+p { margin-top: 10px; }
.icon { width: 19px; height: 19px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 216px; height: 100dvh; display: flex; flex-direction: column; padding: 30px 16px 22px; border-right: 1px solid var(--line); background: var(--side); }
.brand { display: inline-block; padding-left: 12px; font-size: 28px; letter-spacing: -1.3px; line-height: 1.1; font-weight: 750; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand span { color: var(--blue); }
.brand-sub { margin: 6px 0 30px 12px; color: var(--muted); font-size: 12px; }
.sidebar nav { display: flex; flex-direction: column; gap: 5px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 6px; color: #5c6779; font-size: 14px; }
.nav-item:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav-item.selected { background: var(--pale); color: var(--blue); font-weight: 600; }
.sidebar-bottom { margin-top: auto; padding: 18px 12px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.sidebar-bottom>span { display: flex; align-items: center; gap: 8px; }
.sidebar-bottom form { margin-top: 14px; }
.mobile-logout { display: none; }
.main { max-width: 1600px; margin-left: 216px; padding: 36px 40px 48px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-header>div { min-width: 0; }
.page-header p { margin-top: 7px; font-size: 14px; }
.page-header button { flex-shrink: 0; }
.connection { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #9aa4b3; flex-shrink: 0; }
.dot.online { background: #1b936c; }
.section { margin-top: 28px; }
.section>h2 { margin-bottom: 16px; }
.section>p { margin-bottom: 16px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-title>a { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.compact { max-width: 640px; }
.inline-form { display: flex; align-items: flex-end; gap: 12px; min-width: 0; }
.inline-form>label { min-width: 0; }
.inline-form button { flex-shrink: 0; }
.grow { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid>div { grid-column: 1 / -1; }
.notice { padding: 13px 16px; border: 1px solid #dae5f7; border-radius: var(--radius); background: #f4f8ff; color: #385173; margin-bottom: 22px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.notice.error, .error { color: #a12c3b; }
.notice.error { background: #fff6f6; border-color: #efd1d5; }
.banner { display: flex; align-items: center; gap: 14px; padding: 18px 20px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); margin-bottom: 24px; }
.banner-icon { width: 21px; height: 21px; flex-shrink: 0; fill: none; stroke: var(--muted); stroke-width: 1.7; }
.banner h2 { font-size: 16px; }
.banner p { margin-top: 4px; font-size: 13px; }
.banner .button { margin-left: auto; flex-shrink: 0; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 24px; padding: 24px 0; margin: 0 0 8px; border-bottom: 1px solid var(--line); }
.metrics>div { min-width: 0; }
.metrics span { color: var(--muted); font-size: 13px; }
.metrics strong { display: block; font-size: 30px; font-weight: 600; line-height: 1.5; letter-spacing: -.5px; }
.mode-row { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); }
.mode-row p { font-size: 13px; margin-top: 4px; }
.sync-footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 18px; font-size: 12px; color: var(--muted); }
.table-wrap { max-width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
th { padding: 12px 16px; background: var(--surface); color: #5f6c7e; font-size: 12px; font-weight: 500; border-bottom: 1px solid var(--line); }
td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td small { font-size: 11px; margin-top: 4px; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.empty strong { display: block; margin-top: 10px; font-size: 15px; color: var(--text); }
.empty p { margin-top: 4px; font-size: 13px; }
.empty-icon { width: 30px; height: 30px; stroke: #99a5b6; fill: none; stroke-width: 1.5; }
.nowrap { white-space: nowrap; }
.state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.state::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #a8b0bc; flex-shrink: 0; }
.state.success { color: #187253; }
.state.success::before { background: #22916b; }
.state.warning { color: #936315; }
.state.warning::before { background: #c58e2d; }
.muted { color: var(--muted); }
details>summary { cursor: pointer; color: #566781; font-size: 13px; line-height: 1.6; }
details[open]>summary { margin-bottom: 16px; }
details>form, details>p { margin-top: 14px; }
code { font: 12px/1.5 Consolas, monospace; overflow-wrap: anywhere; }
.secret-value { white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font: 13px/1.7 Consolas, monospace; margin: 14px 0; }
.facts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 22px; padding: 18px 0; border-block: 1px solid var(--line); margin-bottom: 28px; }
.facts span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.facts strong { display: block; font-size: 17px; font-weight: 600; }
.settings-list { display: grid; grid-template-columns: 170px 1fr; gap: 10px 18px; font-size: 13px; margin: 20px 0; }
.settings-list dt { color: var(--muted); }
.settings-list dd { margin: 0; }
.product-row { padding: 16px 0; border-bottom: 1px solid var(--line); }
.card-list { display: grid; gap: 0; margin-top: 20px; border-top: 1px solid var(--line); }
.catalog-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 21px 12px; border-bottom: 1px solid var(--line); color: var(--text); transition: background .15s; }
.catalog-card:hover { background: var(--surface); text-decoration: none; }
.card-copy { min-width: 0; }
.card-copy h2 { font-size: 16px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.card-copy small { margin-top: 6px; }
.card-summary { display: flex; align-items: center; gap: 26px; flex-shrink: 0; }
.card-summary>strong { color: var(--blue); font-weight: 500; font-size: 13px; }
.stock-number { min-width: 65px; text-align: right; font-size: 21px; font-weight: 600; }
.stock-number small { font-size: 11px; font-weight: 400; }
.catalog-tools { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.catalog-tools label { flex: 1; max-width: 420px; }
.catalog-tools small { margin-left: auto; }
.card-heading { margin: 14px 0 8px; font-size: 26px; overflow-wrap: anywhere; }
.breadcrumb { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; }
.breadcrumb .icon { width: 15px; height: 15px; }
.card-meta { font-size: 12px; }
.card-meta>summary { font-size: 12px; }
.card-meta[open] { margin-bottom: 8px; }
.product-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(270px, 1fr); gap: 36px; align-items: start; }
.product-primary { min-width: 0; }
.product-primary .section:first-child { margin-top: 0; }
.product-primary .compact { max-width: none; }
.product-primary textarea[name=template] { min-height: 105px; }
.product-primary textarea[name=lines] { min-height: 90px; }
.supply-panel { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.supply-panel h2 { margin-bottom: 15px; }
.supply-name { color: var(--text); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.supply-panel small { margin-top: 8px; }
.supply-panel details { padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.supply-panel .stack { gap: 12px; }
.supply-panel form small { margin-top: 0; }
.shared-links { display: flex; flex-direction: column; gap: 8px; font-size: 13px; margin-top: 10px; }
.shared-links a { overflow-wrap: anywhere; }
.subtle-note { font-size: 12px; color: var(--muted); line-height: 1.5; }
.mode-hint { display: block; padding: 10px 12px; background: var(--surface); border-radius: 6px; font-size: 12px; color: #687386; }
.mode-hint a { margin-left: 5px; }
.records-details { border-top: 1px solid var(--line); margin-top: 30px; padding-top: 18px; }
.records-details>summary { font-size: 15px; font-weight: 600; color: var(--text); }
.records-details>small { margin: 8px 0 14px; }
.records-details .table-wrap { max-height: 360px; }
.records-details th { position: sticky; top: 0; z-index: 1; }
.settings-section { max-width: 800px; padding: 0 0 26px; margin-top: 26px; border-bottom: 1px solid var(--line); }
.settings-section .mode-row { border: 0; padding: 0; justify-content: flex-start; margin: 18px 0 12px; }
.settings-section>p { font-size: 14px; }
.settings-section>details { margin-top: 18px; }
.settings-section form.compact { max-width: 440px; }
.method-note { margin-top: 20px; max-width: 900px; }
.method-note p { font-size: 13px; }
.empty-line { padding: 20px 0; color: var(--muted); }
.auth-main { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 28px; background: var(--surface); }
.auth-box { width: 400px; padding: 32px; border: 1px solid var(--line); background: #fff; border-radius: 12px; }
.auth-box .brand { padding: 0; }
.auth-box h1 { font-size: 23px; margin: 28px 0 10px; }
.auth-box>p { font-size: 13px; }
.auth-box form { margin-top: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media(min-width:1600px) { .main { padding-inline: 56px; } }
@media(max-width:1150px) {
  .main { padding: 28px; }
  .sidebar { width: 188px; padding-inline: 12px; }
  .main { margin-left: 188px; }
  .product-layout { gap: 24px; grid-template-columns: minmax(0,1.35fr) minmax(250px,1fr); }
  .card-summary { gap: 16px; }
}
@media(max-width:900px) {
  .product-layout { grid-template-columns: 1fr; }
  .supply-panel { grid-row: 1; }
  .product-primary { grid-row: 2; }
  .catalog-card { gap: 18px; }
  .card-summary { flex-direction: column; align-items: flex-end; gap: 7px; }
  .card-summary>strong { display: none; }
  .stock-number { font-size: 18px; }
  .mode-row { flex-wrap: wrap; }
  .banner { flex-wrap: wrap; }
  .banner .button { margin-left: 35px; }
}
@media(max-width:700px) {
  .sidebar { position: relative; width: 100%; height: auto; padding: 18px 16px 10px; border: 0; border-bottom: 1px solid var(--line); }
  .brand { font-size: 26px; padding: 0; }
  .brand-sub { margin: 4px 0 16px; font-size: 11px; }
  .sidebar nav { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 3px; }
  .nav-item { padding: 8px 2px; font-size: 11px; gap: 5px; flex-direction: column; }
  .nav-item .icon { width: 17px; height: 17px; }
  .sidebar-bottom { display: none; }
  .mobile-logout { display: block; position: absolute; right: 18px; top: 23px; font-size: 12px; }
  .main { margin: 0; padding: 24px 18px 36px; }
  h1 { font-size: 25px; }
  h2 { font-size: 17px; }
  .page-header { gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
  .page-header p { font-size: 13px; }
  .page-header button { font-size: 13px; min-height: 38px; }
  .card-heading { font-size: 23px; }
  .facts { gap: 18px; grid-template-columns: repeat(2,minmax(0,1fr)); padding-block: 16px; margin-bottom: 24px; }
  .facts strong { font-size: 17px; }
  .catalog-tools { gap: 12px; }
  .catalog-tools small { font-size: 11px; white-space: nowrap; }
  .catalog-card { padding: 18px 0; }
  .card-copy h2 { font-size: 14px; }
  .card-copy small { font-size: 11px; }
  .stock-number { min-width: 44px; font-size: 18px; }
  .stock-number small { font-size: 10px; }
  .card-summary { gap: 5px; }
  .card-summary .state { font-size: 11px; }
  .supply-panel { padding: 18px; }
  .product-layout { gap: 24px; }
  .metrics { gap: 14px; }
  .metrics span { font-size: 11px; }
  .metrics strong { font-size: 27px; }
  .mode-row { padding: 16px; gap: 16px; }
  .inline-form { flex-wrap: wrap; width: 100%; }
  .inline-form label { min-width: 0; flex: 1 1 160px; }
  .mode-row .inline-form { flex-wrap: nowrap; }
  .inline-form select { min-width: 0; }
  .mode-row .inline-form select { flex: 1; }
  .mode-row .inline-form button { flex-shrink: 0; }
  .banner { padding: 16px; gap: 12px; }
  .banner>div { flex: 1; min-width: 200px; }
  .banner .button { margin-left: 33px; }
  .sync-footer { flex-wrap: wrap; gap: 8px; }
  .settings-list { grid-template-columns: 140px 1fr; gap: 10px; font-size: 12px; }
  .settings-section { padding-bottom: 24px; }
  .form-grid { grid-template-columns: 1fr; }
  td,th { padding: 11px 12px; font-size: 12px; }
  .table-wrap { max-width: 100%; }
  .auth-main { padding: 18px; }
  .auth-box { padding: 26px; }
}
@media(prefers-reduced-motion:reduce) { * { transition: none !important; } }

.product-primary{grid-column:1;grid-row:1}.supply-panel{grid-column:2;grid-row:1}.card-summary>strong{display:inline-flex;gap:6px;align-items:center}.card-summary>strong .icon{width:16px;height:16px}
@media(max-width:900px){.supply-panel{grid-column:1;grid-row:1}.product-primary{grid-column:1;grid-row:2}.card-summary>strong{display:none}}

.finance-filters { display:flex; align-items:flex-end; flex-wrap:wrap; gap:14px; }
.finance-filters label { width:180px; }
.finance-filters label:first-child { width:210px; }
.finance-metrics { margin-top:16px; }
.finance-metrics strong { font-size:32px; overflow-wrap:anywhere; }
.finance-positive { color:#187253; }
.finance-negative { color:#b42335; }
.finance-method { font-size:13px; max-width:960px; margin-top:14px; }
.finance-notice { margin-top:20px; }
.finance-secondary { display:flex; gap:28px; flex-wrap:wrap; margin-top:20px; font-size:14px; }
.finance-secondary > span { max-width:420px; }
.finance-expense { border:1px solid var(--line); border-radius:8px; padding:18px 20px; }
.finance-expense > summary { color:var(--blue); font-weight:600; }
.finance-expense-form { margin-top:20px; max-width:900px; }
.finance-breakdown { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(0,1fr); gap:40px; }
.finance-legend { display:flex; gap:18px; font-size:12px; margin-bottom:12px; }
.finance-trend { max-height:360px; overflow-y:auto; }
.finance-trend-row { display:grid; grid-template-columns:86px minmax(60px,1fr) 150px; gap:14px; align-items:center; padding:8px 0; font-size:12px; }
.finance-trend-row > small { text-align:right; }
.finance-bars meter { display:block; width:100%; height:13px; border:0; }
.finance-bars meter::-webkit-meter-bar { background:#f1f3f6; border:0; }
.finance-income-meter::-webkit-meter-optimum-value { background:#23946d; }
.finance-expense-meter::-webkit-meter-optimum-value { background:#d7725b; }
.finance-income-meter::-moz-meter-bar { background:#23946d; }
.finance-expense-meter::-moz-meter-bar { background:#d7725b; }
.finance-categories { margin:0; }
.finance-categories > div { display:flex; justify-content:space-between; gap:20px; padding:12px 0; border-bottom:1px solid var(--line); font-size:14px; }
.finance-categories dd { margin:0; white-space:nowrap; font-weight:600; }
.finance-journal { list-style:none; padding:0; margin:0; }
.finance-entry { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:8px 20px; border-top:1px solid var(--line); padding:16px 0; }
.finance-entry-copy { min-width:0; overflow-wrap:anywhere; }
.finance-entry-copy > strong { font-size:14px; font-weight:500; }
.finance-entry-copy > small { margin-top:5px; }
.finance-amount { font-size:17px; white-space:nowrap; }
.finance-void { grid-column:1 / -1; font-size:12px; }
.finance-void > summary { color:var(--muted); }
.finance-void form { margin-top:12px; max-width:560px; }
.finance-pagination { display:flex; align-items:center; gap:24px; justify-content:center; margin-top:20px; font-size:14px; }
@media(max-width:900px) { .finance-breakdown { grid-template-columns:1fr; gap:0; } }
@media(max-width:700px) {
  .finance-filters { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
  .finance-filters label, .finance-filters label:first-child { width:auto; }
  .finance-filters label:first-child { grid-column:1 / -1; }
  .finance-filters button { grid-column:1 / -1; }
  .finance-metrics { grid-template-columns:1fr; gap:16px; }
  .finance-metrics > div { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:4px 12px; }
  .finance-metrics small { grid-column:1 / -1; }
  .finance-metrics strong { font-size:26px; }
  .finance-expense-form { grid-template-columns:1fr; }
  .finance-trend-row { grid-template-columns:72px minmax(40px,1fr); gap:6px 12px; }
  .finance-trend-row > small { grid-column:2; text-align:left; }
  .finance-void form { flex-direction:column; align-items:stretch; }
  .sidebar .nav-item { padding-inline:2px; font-size:10px; }
}

.finance-unit-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr));gap:20px;margin:20px 0 0}.finance-unit-grid dt{color:var(--muted);font-size:14px}.finance-unit-grid dd{font-size:24px;font-weight:650;margin:5px 0 0;overflow-wrap:anywhere}

.category-tabs{display:flex;gap:10px;flex-wrap:wrap;margin:20px 0}.category-tabs a{border:1px solid var(--line);border-radius:9px;padding:10px 14px;overflow-wrap:anywhere}.category-tabs a[aria-current]{background:var(--surface);font-weight:650}.category-tabs small{margin-left:6px}.category-cost{margin-bottom:16px}.category-cost form{max-width:620px;margin-top:16px}.catalog-card h3{font-size:17px;margin:0 0 8px}.category-table{min-width:840px}.category-group .section-title{flex-wrap:wrap}
