/* Panoul Gigi - grafit #1C1F23, roșu #C8102E, IBM Plex Sans / Mono */
:root {
  --ink: #1C1F23;
  --ink-2: #3A3F45;
  --muted: #5B6168;
  --line: #E2E3E5;
  --line-2: #EEEFF0;
  --bg: #F4F4F2;
  --card: #FFFFFF;
  --red: #C8102E;
  --red-dark: #9E0C24;
  --red-text: #A50E26;
  --side: #1C1F23;
  --side-2: #262B31;
  --side-3: #2E343B;
  --side-text: #C9CDD2;
  --side-muted: #A3A8AF;
  --ok-bg: #E6F2EC; --ok: #1E6B44;
  --bad-bg: #FBE9EC; --bad: #A50E26;
  --warn-bg: #FFF4D6; --warn: #6B4E00;
  --none-bg: #EEEFF0; --none: #3A3F45;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: var(--red); }
a:hover { color: var(--red-dark); }
h1, h2 { margin: 0; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.demo-banner { background: #FFD24D; color: #3D2E00; text-align: center; font-weight: 600; font-size: 13px; letter-spacing: 0.04em; padding: 6px 12px; }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; flex-wrap: wrap; align-items: stretch; min-height: 100vh; }
.side { flex: 1 1 220px; max-width: 280px; background: var(--side); color: #E8E9EB; padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; color: inherit; text-decoration: none; }
.brand:hover { color: inherit; }
.brand-mark { width: 36px; height: 36px; border-radius: 8px; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; flex-shrink: 0; }
.brand-mark.big { width: 40px; height: 40px; border-radius: 9px; font-size: 18px; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 600; font-size: 16px; }
.brand-sub { font-size: 12px; color: var(--side-muted); }
.nav-links { display: flex; flex-direction: column; gap: 4px; }
.nav-links a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--side-text); text-decoration: none; font-size: 14px; min-height: 44px; }
.nav-links a:hover { background: var(--side-2); color: #fff; }
.nav-links a.active { background: var(--side-3); color: #fff; font-weight: 500; }
.nav-links .dot { width: 6px; height: 6px; border-radius: 3px; flex-shrink: 0; }
.nav-links a.active .dot { background: #E8485F; }
.nav-user { margin-top: auto; padding: 12px; border-radius: 8px; background: var(--side-2); display: flex; flex-direction: column; gap: 4px; }
.nav-email { font-size: 13px; font-weight: 500; word-break: break-all; }
.nav-meta { font-size: 12px; color: var(--side-muted); }
.nav-user form { margin: 0; }

.main { flex: 999 1 560px; min-width: 0; padding: 32px 40px 48px; display: flex; flex-direction: column; gap: 24px; }

/* ---------------------------------------------------------------- page head */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-title { display: flex; flex-direction: column; gap: 6px; max-width: 760px; }
.eyebrow { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.page-title h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.01em; }
.intro { margin: 0; color: var(--muted); font-size: 15px; }
.seg { display: flex; gap: 4px; padding: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.seg a { min-height: 36px; padding: 6px 14px; border-radius: 7px; font-size: 14px; color: var(--ink-2); text-decoration: none; display: flex; align-items: center; }
.seg a:hover { background: var(--line-2); color: var(--ink); }
.seg a.on { background: var(--ink); color: #fff; font-weight: 500; }

/* ---------------------------------------------------------------- cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.card h2 { font-size: 17px; font-weight: 600; }
.kpi { padding: 20px; gap: 8px; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { font-size: 32px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; word-break: break-word; }
.kpi-value.bad { color: var(--red-text); }
.kpi-sub { font-size: 13px; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.row > .card { flex: 1 1 360px; }
.row > .grow1 { flex: 1 1 320px; }
.row > .grow2 { flex: 2 1 480px; }
.row > .grow3 { flex: 3 1 520px; }

/* ---------------------------------------------------------------- charts */
.chart-wrap { overflow-x: auto; }
svg.chart { width: 100%; min-width: 480px; height: auto; display: block; font-family: var(--mono); }
svg.chart .bar { fill: var(--side-3); }
svg.chart .bar-today { fill: var(--red); }
svg.chart .bar-err { fill: #E8485F; }
svg.chart .axis { stroke: var(--line); stroke-width: 1; }
svg.chart .lbl { fill: var(--muted); font-size: 11px; }
svg.chart .v { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
svg.chart .line { fill: none; stroke: var(--red); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .dot { fill: #fff; stroke: var(--red); stroke-width: 2; }
.meters { display: flex; flex-direction: column; gap: 14px; }
.meter-row { display: flex; flex-direction: column; gap: 6px; }
.meter-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.meter-top a, .meter-top > span:first-child { color: var(--ink); text-decoration: none; font-weight: 500; }
.meter-top a:hover { color: var(--red); }
svg.meter { width: 100%; height: 8px; display: block; border-radius: 4px; overflow: hidden; }
svg.meter .meter-bg { fill: var(--line-2); }
svg.meter .meter-fg { fill: var(--side-3); }
svg.meter .meter-fg.accent { fill: var(--red); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 500; padding: 8px; white-space: nowrap; }
table.data td { padding: 10px 8px; border-top: 1px solid var(--line-2); vertical-align: middle; }
table.data th:first-child, table.data td:first-child { padding-left: 0; }
table.data th:last-child, table.data td:last-child { padding-right: 0; }
table.data th.num { text-align: right; }
table.data td.mono { white-space: nowrap; }
.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.none { background: var(--none-bg); color: var(--none); }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 4px; background: var(--none-bg); color: var(--muted); }
.role { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--none-bg); color: var(--none); }
.role-admin { background: var(--bad-bg); color: var(--bad); }
.role-contabilitate { background: #E8EEF8; color: #23457A; }
.role-operational { background: var(--ok-bg); color: var(--ok); }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line-2); }
.feed-t { color: var(--muted); padding-top: 2px; width: 44px; flex-shrink: 0; font-size: 12px; }
.feed-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.empty { display: flex; flex-direction: column; gap: 4px; padding: 20px; border: 1px dashed #C9CDD2; border-radius: 10px; background: #FAFAF9; color: var(--muted); font-size: 14px; }
.empty strong { color: var(--ink); font-weight: 600; }
.note { font-size: 13px; padding: 8px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn); }
.flash { padding: 10px 14px; border-radius: 9px; font-size: 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.bad { background: var(--bad-bg); color: var(--bad); }

/* ---------------------------------------------------------------- forms */
input, select, button { font: inherit; }
input, select { min-height: 40px; padding: 8px 12px; border: 1px solid #C9CDD2; border-radius: 9px; font-size: 15px; color: var(--ink); background: #fff; }
input:focus, select:focus { outline: 2px solid var(--red); outline-offset: 1px; border-color: var(--red); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; margin: 0; }
.form-grid .span-all { grid-column: 1 / -1; margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 16px; border-radius: 9px; border: 1px solid transparent; font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); color: #fff; }
.btn.danger { background: var(--red-text); color: #fff; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { border-color: #C9CDD2; color: var(--ink); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn.big { min-height: 48px; font-size: 16px; }
.danger-text { color: var(--red-text) !important; }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; font-size: 13px; min-height: 32px; }
.link-btn.light { color: #F2A3AF; }
.ops { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
form.inline { display: flex; gap: 6px; align-items: center; margin: 0; }
form.inline select { min-height: 32px; padding: 4px 8px; font-size: 13px; }
.confirm-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 8px; background: var(--bad-bg); font-size: 13px; }
.confirm-inline form { margin: 0; }

/* ---------------------------------------------------------------- login */
body.login { background: var(--ink); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 16px; }
.login-col { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 20px; }
.login-brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.login-brand .brand-name { font-size: 18px; }
.login-brand .brand-sub { font-size: 13px; }
.login-card { background: #fff; border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 18px; }
.login-card h1 { font-size: 22px; font-weight: 600; }
.login-card p { margin: 0; }
.login-notes { margin: 0; padding: 0 4px; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--side-muted); }
.stack { display: flex; flex-direction: column; gap: 16px; margin: 0; }
.stack-tight { display: flex; flex-direction: column; gap: 6px; }
.field input { min-height: 48px; font-size: 16px; }
.code-input { font-family: var(--mono); font-size: 26px !important; letter-spacing: 0.5em; text-align: center; min-height: 56px !important; }
.split { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

@media (max-width: 760px) {
  .side { max-width: none; flex-basis: 100%; padding: 16px; gap: 14px; }
  .nav-links { flex-direction: row; flex-wrap: wrap; }
  .nav-links a { min-height: 40px; padding: 8px 10px; }
  .nav-user { margin-top: 0; }
  .main { padding: 20px 16px 40px; }
  .page-title h1 { font-size: 24px; }
}
