/* enic — panoul de administrare. Fără framework: variabile + câteva componente. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e2e5ea;
  --text: #1c2027;
  --muted: #667085;
  --accent: #2f6fed;
  --accent-text: #ffffff;
  --ok: #1f9d55;
  --warn: #c98a04;
  --crit: #d93025;
  --ok-bg: #e6f6ec;
  --warn-bg: #fdf4dc;
  --crit-bg: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1e232b;
    --border: #2a303a;
    --text: #e6e9ee;
    --muted: #8b95a5;
    --accent: #5b8cff;
    --ok: #3ecf7a;
    --warn: #e6b13a;
    --crit: #ff6b5e;
    --ok-bg: #12291c;
    --warn-bg: #2d2511;
    --crit-bg: #33171a;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 1rem; font-weight: 650; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; font-weight: 600; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.text-crit { color: var(--crit); }

/* --- layout ---------------------------------------------------------------- */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); padding: 1rem .75rem;
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.15rem; color: var(--text); padding: .25rem .5rem 1rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--accent-text); font-weight: 800;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { color: var(--text); padding: .5rem .75rem; border-radius: 8px; }
.sidebar nav a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar nav a.active { background: var(--surface-2); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding: .5rem; border-top: 1px solid var(--border); }
.who { font-weight: 600; font-size: .9rem; }
.content { padding: 1.5rem 2rem; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem 1rem; }
  .brand { padding: 0; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; }
  .content { padding: 1rem; }
}

/* --- componente ------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.25rem; margin-bottom: 1rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { display: flex; flex-direction: column; gap: .15rem; margin: 0; }
.stat .label { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: .85rem; }
meter { width: 100%; height: 6px; margin-top: .4rem; }
meter::-webkit-meter-bar { background: var(--surface-2); border: 0; border-radius: 3px; height: 6px; }
meter::-webkit-meter-optimum-value, meter::-webkit-meter-suboptimum-value { background: var(--ok); border-radius: 3px; }
meter::-webkit-meter-even-less-good-value { background: var(--crit); border-radius: 3px; }
meter:-moz-meter-optimum::-moz-meter-bar { background: var(--ok); }
meter:-moz-meter-sub-optimum::-moz-meter-bar { background: var(--warn); }
meter:-moz-meter-sub-sub-optimum::-moz-meter-bar { background: var(--crit); }

.pill { display: inline-block; padding: .15rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-crit { background: var(--crit-bg); color: var(--crit); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .6rem; flex: none; }
.dot-ok { background: var(--ok); } .dot-warn { background: var(--warn); } .dot-crit { background: var(--crit); }
.checks { list-style: none; margin: 0; padding: 0; columns: 2 380px; column-gap: 2rem; }
.checks li { display: flex; align-items: baseline; padding: .3rem 0; break-inside: avoid; }

.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.table th, .table td { padding: .55rem .5rem; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }

.flash { padding: .65rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid transparent; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--crit-bg); color: var(--crit); }
.flash-warn { background: var(--warn-bg); color: var(--warn); }

/* --- formulare --------------------------------------------------------------- */
label { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; font-weight: 500; margin-bottom: .9rem; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: .55rem .7rem; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input.code { font-size: 1.4rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
button, .button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: .55rem 1rem;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); display: inline-block;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.primary:hover, .button.primary:hover { filter: brightness(1.08); text-decoration: none; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; }

/* --- autentificare ----------------------------------------------------------- */
.bare { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.auth { width: 100%; max-width: 420px; }
.auth-brand { display: flex; align-items: center; justify-content: center; gap: .6rem; font-weight: 700; font-size: 1.3rem; margin-bottom: 1.25rem; }
.auth-card { padding: 1.75rem; }
.auth-card.wide { max-width: 520px; }
.auth:has(.wide) { max-width: 520px; }
.auth-card button.primary, .auth-card .button.primary { width: 100%; text-align: center; margin-top: .25rem; }
.auth-card h2 { margin-top: 1.25rem; }
.qr-row { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.qr { border-radius: 8px; background: #fff; }
.secret { display: block; word-break: break-all; background: var(--surface-2); padding: .5rem; border-radius: 6px; letter-spacing: .08em; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; list-style: none; padding: 0; margin: 1rem 0 1.5rem; }
.codes code { display: block; text-align: center; background: var(--surface-2); padding: .5rem; border-radius: 6px; font-size: 1rem; }

/* --- pagini de detaliu ---------------------------------------------------------- */
.spacer { flex: 1; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.card-head h2 { margin: 0; }
h3 { font-size: .9rem; margin: .75rem 0 .4rem; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); gap: 0 1rem; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 1.25rem; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: .5rem 1.25rem; }
.chart { min-height: 170px; width: 100%; }
.chart-empty { display: grid; place-items: center; color: var(--muted); font-size: .9rem; background: var(--surface-2); border-radius: 8px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; padding: .3rem .65rem; font-size: .8rem; font-weight: 500; background: var(--surface); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent); color: var(--accent-text); }
.stats .stat:not(.card) { padding: .25rem 0; }
.table.compact th, .table.compact td { padding: .35rem .4rem; font-size: .9rem; }
.table td.cmd { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 .75rem; align-items: end; }
.form-grid .form-actions { grid-column: 1 / -1; }
.form-row { display: flex; gap: .5rem; align-items: center; margin: .5rem 0; flex-wrap: wrap; }
.form-row input { flex: 1; min-width: 120px; width: auto; }
.form-row .w-schedule { flex: 0 0 150px; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
form.inline { display: inline; margin: 0; }
.nowrap { white-space: nowrap; }
.row-error td { background: var(--crit-bg); }
.who { color: var(--text); }
.who.active { color: var(--accent); }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-suffix span { display: flex; align-items: center; padding: 0 .6rem; background: var(--surface-2); border: 1px solid var(--border); border-left: 0; border-radius: 0 8px 8px 0; color: var(--muted); font-size: .9rem; white-space: nowrap; }
button.small { padding: .2rem .55rem; font-size: .8rem; font-weight: 500; }
button.danger { color: var(--crit); border-color: var(--crit); background: transparent; }
label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 400; }
label.check input { width: auto; }
.narrow { max-width: 560px; }
.secret.big { font-size: 1.15rem; padding: .75rem; margin: .25rem 0 .5rem; user-select: all; }

/* uPlot: culorile temei */
.uplot { font-family: inherit; color: var(--text); }
.u-legend { font-size: .8rem; color: var(--muted); }
.u-legend .u-marker { border-radius: 2px; }
