:root {
  --bg: #F6F1EA;
  --surface: #FFFFFF;
  --surface-2: #F3ECE1;
  --line: #E8DCC8;
  --line-2: #D6C3A5;
  --text: #2B1F21;
  --text-2: #5A4A4C;
  --muted: #735E60;
  --brand: #4A2A2E;
  --accent: #8E4F55;
  --on-accent: #FFFFFF;
  --chart: #B5532F;
  --grid: #EFE6D9;
  --side: #2B1F21;
  --side-text: #EBDDD6;
  --ok-bg: #DFF1E3; --ok: #1F5130;
  --warn-bg: #FCEFD5; --warn: #7A4A0B;
  --info-bg: #DDEBF7; --info: #1F4766;
  --bad-bg: #F5DCDC; --bad: #7A2320;
  --r: 16px;
  --shadow: 0 10px 30px -18px rgba(74, 42, 46, .35);
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #171113;
  --surface: #221A1C;
  --surface-2: #2A2023;
  --line: #3A2D31;
  --line-2: #54434A;
  --text: #F3EAE6;
  --text-2: #D5C6C3;
  --muted: #A8979A;
  --brand: #F6DEDA;
  --accent: #A65E64;
  --chart: #D0663B;
  --grid: #30252A;
  --side: #0F0B0C;
  --ok-bg: #1D3A25; --ok: #BFE6C8;
  --warn-bg: #3E2E10; --warn: #F5D9A3;
  --info-bg: #182C3E; --info: #BFD9F0;
  --bad-bg: #4A1F22; --bad: #FFD3CF;
  --shadow: 0 10px 30px -18px rgba(0, 0, 0, .7);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 Manrope, system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
:root[data-theme='dark'] a { color: #EBA9A6; }
h1, h2, h3 { font-family: 'Bricolage Grotesque', Manrope, sans-serif; letter-spacing: -0.02em; margin: 0; color: var(--brand); }
[hidden] { display: none !important; }
svg { flex-shrink: 0; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border: 1.5px solid var(--accent); border-radius: 999px; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn--danger { background: transparent; color: var(--bad); border-color: currentColor; }
.btn--sm { min-height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn--block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg, .side__nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-sun, :root[data-theme='dark'] .i-moon { display: none; }
:root[data-theme='dark'] .i-sun { display: block; }
input, select, textarea { width: 100%; min-height: 42px; padding: 0 12px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; }
textarea { padding: 10px 12px; min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }
input[type=color] { padding: 2px; width: 46px; flex-shrink: 0; cursor: pointer; }
label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.f { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.f small { color: var(--muted); font-size: 12.5px; }
.chk { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; color: var(--text); cursor: pointer; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.err { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); font-size: 14px; font-weight: 600; }
.muted { color: var(--muted); }
.muted-link { color: var(--muted) !important; font-size: 14px; text-align: center; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login__card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); padding: 32px 28px; border-radius: 24px; box-shadow: var(--shadow); }
.login__card h1 { font-size: 26px; margin: 8px 0 10px; }
.login__card .btn { margin-top: 12px; }
.logo__img { display: block; width: 76px; aspect-ratio: 560 / 330; background: currentColor; -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
.logo__img--lg { width: 110px; color: var(--brand); }

/* layout */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--side) 240px, transparent 240px); }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; padding: 22px 14px; background: var(--side); color: var(--side-text); }
.side__logo { display: flex; align-items: center; gap: 10px; padding: 0 10px; color: #F6DEDA !important; text-decoration: none; }
.side__logo small { font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 11px; color: #C98A86; }
.side__nav { display: flex; flex-direction: column; gap: 2px; }
.side__nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--side-text) !important; text-decoration: none; font-weight: 600; }
.side__nav a:hover { background: rgba(255, 255, 255, .06); }
.side__nav a[aria-current='page'] { background: #8E4F55; color: #fff !important; }
.side__foot { margin-top: auto; padding: 0 12px; font-size: 14px; }
.side__foot a { color: #C98A86 !important; }
.badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: #EFAE8E; color: #2B1F21; font-size: 12px; font-weight: 800; text-align: center; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px clamp(16px, 3vw, 32px); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top__title { font-size: 22px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top__actions { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); font-size: 13.5px; }
.menu-btn { display: none; }
.view { padding: clamp(16px, 3vw, 32px); display: flex; flex-direction: column; gap: 20px; outline: none; }

/* cards, tables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; min-width: 0; }
.card > h2, .card__head h2 { font-size: 17px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card__sub { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.cols--wide { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar input[type=search] { max-width: 280px; }
.toolbar select { width: auto; }
.toolbar .spacer { flex: 1; }
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td.r, th.r { text-align: right; }
.thumb { width: 44px; height: 50px; border-radius: 10px; padding: 3px; display: block; }
.thumb svg, .thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--ok { background: var(--ok-bg); color: var(--ok); }
.pill--warn { background: var(--warn-bg); color: var(--warn); }
.pill--info { background: var(--info-bg); color: var(--info); }
.pill--bad { background: var(--bad-bg); color: var(--bad); }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 14px; font-size: 14px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.timeline li { display: grid; grid-template-columns: 112px 1fr; gap: 10px; }
.timeline time { color: var(--muted); }
.alerts { display: flex; flex-wrap: wrap; gap: 10px; }
.alert { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px; font-weight: 700; font-size: 14px; text-decoration: none; }

/* KPIs */
.kpis { display: grid; grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr)); gap: 16px; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi__label { font-size: 13px; font-weight: 700; color: var(--muted); }
.kpi__value { font-family: Manrope, sans-serif; font-weight: 800; font-size: 28px; letter-spacing: -0.02em; color: var(--text); line-height: 1.15; }
.kpi--hero .kpi__value { font-size: 48px; }
.kpi__delta { font-size: 13px; font-weight: 700; color: var(--muted); }
.kpi__delta.up { color: var(--ok); }
.kpi__delta.down { color: var(--bad); }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--chart); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover + .bar, .chart .bar.is-on { filter: brightness(1.12); }
.chart .guide { stroke: var(--line-2); stroke-width: 1; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 14px; }
.hbar__track { grid-column: 1 / -1; height: 10px; }
.hbar__fill { height: 100%; max-height: 10px; border-radius: 0 4px 4px 0; background: var(--chart); min-width: 3px; }
details.tbl summary { cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 700; margin-top: 10px; }
.tip { position: fixed; z-index: 100; pointer-events: none; padding: 8px 12px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 13px; box-shadow: var(--shadow); white-space: nowrap; }
.tip b { display: block; font-size: 14px; }

/* product editor */
.colors-ed { display: flex; flex-direction: column; gap: 8px; }
.color-row { display: grid; grid-template-columns: auto minmax(0, 1fr) 110px auto; gap: 8px; align-items: center; }
.stock-grid td, .stock-grid th { padding: 6px; }
.stock-grid input { width: 72px; min-height: 36px; text-align: right; padding: 0 8px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: -2px; margin-right: 6px; border: 1px solid var(--line-2); }
.preview { aspect-ratio: 1; border-radius: var(--r); display: grid; place-items: center; padding: 8%; }
.preview svg, .preview img { width: 100%; height: 100%; object-fit: contain; }
.preview-colors { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.preview-colors button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line-2); cursor: pointer; }
.preview-colors button[aria-pressed='true'] { box-shadow: 0 0 0 2.5px var(--accent); }
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.img { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.img img { width: 100%; height: 100%; object-fit: cover; }
.img button { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #fff; cursor: pointer; font-size: 16px; line-height: 1; }
.upload { display: grid; place-items: center; aspect-ratio: 1; border: 1.5px dashed var(--line-2); border-radius: 12px; color: var(--muted); font-size: 13px; font-weight: 700; text-align: center; cursor: pointer; padding: 8px; }
.upload input { display: none; }
.savebar { position: sticky; bottom: 0; z-index: 10; display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 35%); }
.savebar .spacer { flex: 1; }
.sec-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-family: Manrope, sans-serif; font-weight: 800; margin: 6px 0 -4px; }

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 120; padding: 12px 18px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 700; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.is-err { background: var(--bad); color: #fff; }

@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols, .cols--wide { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; background: none; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .25s; }
  .side.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45); }
  .menu-btn { display: inline-grid; }
  .who { display: none; }
}
@media (max-width: 560px) {
  .kpis, .grid2, .grid3 { grid-template-columns: 1fr; }
  .kpi--hero .kpi__value { font-size: 40px; }
  .color-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .color-row .hex { display: none; }
  .timeline li { grid-template-columns: 1fr; gap: 0; }
}
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
