:root {
  --bg: #faf6f1; --surface: #ffffff; --ink: #2a1f2d; --muted: #7a6f7d; --line: #eadfd6;
  --accent: #c2255c; --accent-soft: #fbe6ee; --track: #f1e9e2; --warn: #c2410c; --warn-soft: #ffedd5; --ok: #2b8a6e;
  --side: #2a1f2d; --radius: 14px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.45; }
h1 { font-size: 1.7rem; margin: 0; letter-spacing: -.01em; }
h3 { font-size: .95rem; margin: 0; font-weight: 650; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--side); color: #e9dfe9; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; font-weight: 700; line-height: 1.1; }
.logo { font-size: 1.7rem; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: #cdbfcf; text-decoration: none; font-weight: 500; }
.nav-item svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; }
.side-foot { margin-top: auto; padding: 10px; font-size: .8rem; color: #b5a6b8; }
.live { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: #868e96; flex: none; }
.pulse.on { background: #40c9a2; box-shadow: 0 0 0 0 rgba(64,201,162,.6); animation: pulse 2.4s infinite; }
.pulse.busy { background: #ffd43b; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(64,201,162,0); } 100% { box-shadow: 0 0 0 0 rgba(64,201,162,0); } }
.err { color: #ffa8a8; width: 100%; }

.main { padding: 28px 32px 60px; min-width: 0; max-width: 1400px; }
.page-head { margin-bottom: 22px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; }
.kpi-label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.kpi-value { font-size: 1.65rem; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-note { color: var(--muted); font-size: .8rem; }
.kpi-note.warn { color: var(--warn); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card .sub { color: var(--muted); font-size: .78rem; }
.table-card { margin-bottom: 16px; }

.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 36%) 1fr auto; align-items: center; gap: 10px; font-size: .86rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { background: var(--track); border-radius: 6px; height: 14px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .6s ease; }
.bar-value { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 3.5em; text-align: right; }
.axis-label { margin-top: 10px; font-size: .72rem; color: var(--muted); text-align: right; text-transform: uppercase; letter-spacing: .05em; }

.donut { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut svg { width: 150px; height: 150px; flex: none; }
.donut circle { transition: stroke-dasharray .6s ease; }
.donut-total { font-size: 7px; font-weight: 700; fill: var(--ink); }
.donut-cap { font-size: 2.6px; fill: var(--muted); text-transform: uppercase; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .86rem; }
.legend b { margin-left: 6px; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; }

.empty { color: var(--muted); padding: 22px; text-align: center; }
.toolbar { margin-bottom: 10px; }
select { font: inherit; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; margin-left: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--track); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .74rem; font-weight: 600; background: var(--track); color: var(--ink); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.s-draft { background: #e7ecff; color: #3b5bdb; }
.tag.s-confirmed { background: var(--accent-soft); color: var(--accent); }
.tag.s-fulfilled { background: #dcf5ec; color: var(--ok); }
.meter { display: inline-block; width: 90px; height: 8px; background: var(--track); border-radius: 4px; vertical-align: middle; overflow: hidden; margin-right: 6px; }
.meter-fill { display: block; height: 100%; background: var(--ok); }
.meter-fill.low { background: var(--warn); }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: 340px; }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 12px; font-size: .86rem; box-shadow: 0 8px 24px rgba(42,31,45,.25); border-left: 4px solid var(--accent); animation: slide .3s ease; }
.toast.create { border-left-color: #40c9a2; } .toast.delete { border-left-color: #ff8787; } .toast.update { border-left-color: #ffd43b; }
.toast .op { opacity: .85; } .toast .muted { opacity: .6; } .toast .changed { margin-top: 3px; font-size: .78rem; opacity: .85; }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .brand { padding: 4px 10px; } .brand-text, .side-foot { display: none; }
  .nav-item span { display: none; } .main { padding: 18px 14px 50px; }
  .grid { grid-template-columns: 1fr; }
}
