/* Workshop dashboard — one theme: warm neutral surfaces, one blue accent, one type family,
   4px spacing scale. Series colours come from the validated reference palette (slot order fixed). */
:root {
    color-scheme: light;
    --bg: #f5f5f3;
    --surface-1: #fcfcfb;
    --surface-2: #f0efec;
    --border: #e3e2de;
    --text-primary: #0b0b0b;
    --text-secondary: #52514e;
    --text-muted: #7a7974;
    --accent: #2a78d6;
    --accent-soft: #e6f0fc;
    --series-1: #2a78d6;
    --series-2: #eb6834;
    --good: #0f7a3d; --good-bg: #e5f4ea;
    --warn: #8a5a00; --warn-bg: #fdf1d6;
    --bad: #b42323;  --bad-bg: #fbe6e5;
    --info: #1c5cab; --info-bg: #e6f0fc;
    --muted-bg: #ecebe8;
    --radius: 10px;
    --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
    --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text-primary); font-family: var(--font); font-size: 14px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
h3 { font-size: 14px; font-weight: 600; margin: 0; }
.icon { flex: none; }

/* Shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: #15161a; color: #c9c9c4; padding: var(--s5) var(--s3); position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2) var(--s5); color: #fff; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; }
.brand-text { font-weight: 650; font-size: 15px; display: flex; flex-direction: column; }
.brand-text small { font-weight: 400; color: #8d8d88; font-size: 12px; }
.nav-label { text-transform: uppercase; font-size: 11px; letter-spacing: 0.06em; color: #75756f; padding: var(--s4) var(--s3) var(--s2); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); border-radius: 8px; color: #c9c9c4; }
.nav-item:hover { background: #22242a; color: #fff; text-decoration: none; }
.nav-item.active { background: #24324a; color: #fff; box-shadow: inset 3px 0 0 var(--accent); }

.main { padding: var(--s4) var(--s6) var(--s6); min-width: 0; }
.status-bar { display: flex; justify-content: flex-end; align-items: center; gap: var(--s4); color: var(--text-muted); font-size: 12px; min-height: 24px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text-secondary); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: #9a9a95; }
.live.on i { background: #1baf7a; }
.live.off i { background: #eda100; }
.live.pulse i { animation: pulse 1.5s ease-out; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(27, 175, 122, .55); } 100% { box-shadow: 0 0 0 10px rgba(27, 175, 122, 0); } }
.zone { color: var(--text-muted); }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin: var(--s2) 0 var(--s5); }
.lede { color: var(--text-secondary); margin: var(--s1) 0 0; }

/* KPI row */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s4); margin-bottom: var(--s5); }
.kpi { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4); }
.kpi-label { color: var(--text-secondary); font-size: 12px; font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: var(--s1); font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--text-muted); font-size: 12px; margin-top: 2px; display: flex; align-items: center; gap: 4px; }
.kpi-warn { border-color: #f0d9a4; }
.kpi-warn .kpi-sub { color: var(--warn); }
.kpi-attn .kpi-value { color: var(--text-primary); }
.kpi-attn { box-shadow: inset 3px 0 0 var(--accent); }

/* Grid + cards */
.grid { display: grid; gap: var(--s4); margin-bottom: var(--s4); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.wide-left { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s4); min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); margin-bottom: var(--s3); }
.card-sub { color: var(--text-muted); font-size: 12px; margin: 2px 0 0; }
.card-foot { color: var(--text-muted); font-size: 12px; margin: var(--s2) 0 0; }
.empty { color: var(--text-muted); padding: var(--s5) 0; text-align: center; font-size: 13px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.btn { background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 6px 14px; font: inherit; font-weight: 500; cursor: pointer; color: var(--text-primary); }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .6; cursor: default; }

/* Bars */
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 34%) 1fr auto; align-items: center; gap: var(--s3); padding: 3px 0; border-radius: 6px; outline: none; }
.bar-row:hover, .bar-row:focus-visible { background: var(--surface-2); }
.bar-label { color: var(--text-secondary); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px; }
.bar-track { position: relative; height: 14px; display: flex; gap: 2px; }
.bar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; min-width: 2px; transition: width .4s ease; }
.bar-track.split .seg:first-child { border-radius: 0; }
.bar-track.split .seg:last-of-type { border-radius: 0 4px 4px 0; }
.bar-value { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--text-primary); min-width: 48px; text-align: right; padding-right: 4px; }
.tip { position: absolute; left: 0; bottom: calc(100% + 6px); background: #15161a; color: #fff; font-size: 12px; padding: 5px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; opacity: 0; transform: translateY(2px); transition: opacity .12s, transform .12s; z-index: 5; }
.bar-row:hover .tip, .bar-row:focus-visible .tip { opacity: 1; transform: none; }
.legend { display: flex; gap: var(--s3); font-size: 12px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.skeleton-rows { display: flex; flex-direction: column; gap: 10px; padding: var(--s2) 0; }
.skeleton-rows span { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2), #e7e6e2, var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.skeleton-rows span:nth-child(2) { width: 80%; } .skeleton-rows span:nth-child(3) { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Tables */
.table-wrap { overflow-x: auto; }
.table, .mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .mini-table th { text-align: left; font-weight: 500; color: var(--text-muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td, .mini-table td { padding: 8px; border-bottom: 1px solid var(--surface-2); vertical-align: top; }
.table tbody tr:hover { background: var(--surface-2); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-sub { display: block; color: var(--text-muted); font-size: 12px; }
.list-foot { display: flex; justify-content: space-between; align-items: center; padding-top: var(--s3); color: var(--text-muted); font-size: 12px; }

/* Pills + badges (state colours always carry their word) */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill-good { background: var(--good-bg); color: var(--good); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad, .pill-urgent { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-muted { background: var(--muted-bg); color: var(--text-secondary); }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 5px; text-transform: uppercase; letter-spacing: .03em; flex: none; }
.op-created { background: var(--good-bg); color: var(--good); }
.op-updated { background: var(--info-bg); color: var(--info); }
.op-deleted { background: var(--muted-bg); color: var(--text-secondary); }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); max-height: 360px; overflow-y: auto; }
.feed li { display: flex; gap: var(--s3); align-items: flex-start; }
.feed a { color: var(--text-primary); }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--surface-2); }
.plain-list li:last-child { border-bottom: 0; }

.error-note { display: flex; align-items: center; gap: var(--s2); background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: var(--s2) var(--s3); margin-bottom: var(--s4); }

/* Toasts: unobtrusive, bottom right, never a full-page flash */
.toasts { position: fixed; right: var(--s5); bottom: var(--s5); display: flex; flex-direction: column; gap: var(--s2); z-index: 50; width: 340px; }
.toast { display: flex; gap: var(--s3); background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s3); box-shadow: 0 8px 24px rgba(0, 0, 0, .08); color: var(--text-primary); animation: slidein .2s ease-out; }
.toast:hover { text-decoration: none; border-color: #cfcdc7; }
.toast-body { display: flex; flex-direction: column; min-width: 0; }
.toast-entity { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.toast-text { font-size: 13px; }
.toast-changes { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

#blazor-error-ui { background: #fdf1d6; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); display: none; left: 0; padding: .6rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

@media (max-width: 1200px) { .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1000px) {
    .grid.two, .grid.three, .grid.wide-left { grid-template-columns: 1fr; }
    .shell { grid-template-columns: 64px 1fr; }
    .side { padding: var(--s4) var(--s2); }
    .brand-text, .nav-item span, .nav-label { display: none; }
    .nav-item { justify-content: center; }
    .main { padding: var(--s4); }
}
