/*
  Colori Epil Point, dalla dashboard aziendale (epilpoint-dashboard, resources/css/app.css):
  oro di marca #CC912E (brand-500) e scala derivata, neutri "ink" della vecchia dashboard,
  verde #008000 per le variazioni positive. Regole d'uso riprese da li':
  - barra superiore oro con logo bianco; testo e icone sulla barra in ink-900 (il bianco su oro e' 2,7:1)
  - pulsanti principali a pillola oro con testo ink-900, hover brand-400
  - collegamenti brand-700 (7,4:1 su bianco); voce di menu attiva brand-800 su brand-100
  - intestazioni delle tabelle di confronto bianche in grassetto su oro (scelta del committente)
*/
:root {
  color-scheme: light;
  --brand-50: #fdf6ee;
  --brand-100: #f9ead6;
  --brand-300: #ebc084;
  --brand-400: #dfa958;
  --brand-500: #cc912e;
  --brand-600: #946300;
  --brand-700: #754e00;
  --brand-800: #603e00;
  --ink-900: #262327;
  --page: #f5f5f5;
  --surface: #ffffff;
  --ink: #262327;
  --ink-2: #575258;
  --muted: #6d676e;
  --grid: #e0e0e0;
  --axis: #cfcccf;
  --border: #e0e0e0;
  --accent: var(--brand-700);
  --series-1: #cc912e;
  --series-2: #9e9a9f;
  --good: #008000;
  --good-text: #008000;
  --warning: #a86100;
  --critical: #b3261e;
  --critical-text: #b3261e;
  --shadow: 0 1px 2px rgba(38, 35, 39, .06);
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #1a181b;
    --surface: #262327;
    --ink: #fafafa;
    --ink-2: #cfcccf;
    --muted: #9e9a9f;
    --grid: #3f3b40;
    --axis: #575258;
    --border: #3f3b40;
    --accent: var(--brand-300);
    --series-1: #dfa958;
    --series-2: #757575;
    --good-text: #3fb53f;
    --critical-text: #e66767;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink);
  font: 14px/1.45 "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif; }
.hidden { display: none !important; }
a { color: var(--accent); }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.err { color: var(--critical-text); min-height: 1.2em; }

/* Barra superiore oro a tutta larghezza, come la dashboard aziendale: sempre oro, anche in tema scuro */
.top { display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: var(--brand-500);
  color: var(--ink-900); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink-900);
  text-decoration: none; white-space: nowrap; }
.brand img { height: 30px; width: auto; display: block; }
.brand span { padding-left: 10px; border-left: 1px solid rgba(38, 35, 39, .35); font-size: 14px; }
#nav { display: flex; gap: 2px; flex-wrap: wrap; }
#nav a { padding: 6px 12px; border-radius: 999px; color: var(--ink-900); text-decoration: none; font-weight: 500; }
#nav a:hover { background: rgba(148, 99, 0, .2); }
#nav a.active { background: var(--brand-100); color: var(--brand-800); }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.top-right #who { color: var(--ink-900); font-weight: 500; }
.top select { background: #fff; color: var(--ink-900); border-color: transparent; }
.top .btn { background: #fff; color: var(--brand-800); border-color: transparent; font-weight: 600; }
.top .btn:hover { background: var(--brand-50); }
main { padding: 20px; max-width: 1400px; margin: 0 auto; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px;
  box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; } /* le tabelle larghe scorrono dentro la card invece di allargare la pagina */
.stack > .card { margin-bottom: 16px; }
.tiles { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); margin-bottom: 16px; }
.two { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); margin-bottom: 16px; }
.tile .lbl { color: var(--ink-2); font-size: 12px; }
.tile .val { font-size: 26px; font-weight: 650; margin: 4px 0; }
.tile .sub { font-size: 12px; color: var(--muted); }
.delta-up { color: var(--good-text); font-weight: 600; }
.delta-down { color: var(--critical-text); font-weight: 600; }
.chart-box { position: relative; height: 340px; }

.btn { border: 1px solid var(--border); background: var(--surface); color: var(--ink); padding: 8px 16px;
  border-radius: 999px; cursor: pointer; font: inherit; font-weight: 500; text-decoration: none;
  display: inline-block; }
.btn:hover { border-color: var(--brand-400); }
/* pulsanti principali: pillola in oro con testo scuro (ink-900 su oro 5,7:1), hover brand-400 */
.btn.primary { background: var(--brand-500); color: var(--ink-900); border-color: transparent; font-weight: 600; }
.btn.primary:hover { background: var(--brand-400); }
.btn.small { padding: 4px 12px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--brand-600); outline-offset: 2px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 9px; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-500); outline: none;
  box-shadow: 0 0 0 3px rgba(204, 145, 46, .25); }
label { display: block; margin-bottom: 10px; color: var(--ink-2); }
label input, label select { display: block; width: 100%; margin-top: 4px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }

.table-wrap { overflow: auto; max-height: 70vh; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--grid); text-align: left; white-space: nowrap; }
/* intestazioni come le tabelle di confronto della dashboard aziendale: bianco in grassetto su oro */
th { position: sticky; top: 0; background: var(--brand-500); color: #fff; font-weight: 700;
  cursor: pointer; user-select: none; border-bottom-color: var(--brand-500); }
td { color: var(--ink-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--page); }

.chip { display: inline-flex; gap: 4px; align-items: center; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; border: 1px solid var(--border); white-space: nowrap; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.chip.good .dot { background: var(--good); }
.chip.warning .dot { background: var(--warning); }
.chip.critical .dot { background: var(--critical); }
.chip.info .dot { background: var(--accent); }

/* accesso: filo oro in cima e marchio oro su fondo chiaro, come la dashboard aziendale */
.login { min-height: 100vh; display: grid; place-items: center; border-top: 4px solid var(--brand-500);
  padding: 16px; }
.login-box { width: min(360px, 100%); }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { height: 56px; width: auto; }
.login-logo p { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 18px 0 0;
  font-size: 12px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.login-logo p::before, .login-logo p::after { content: ""; height: 1px; width: 32px; background: var(--brand-300); }
.login-card { width: 100%; border-radius: 16px; padding: 24px; }
.login-card .btn.primary { width: 100%; margin-top: 4px; }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: grid; place-items: center;
  z-index: 20; padding: 16px; }
.modal-box { width: min(1000px, 100%); max-height: 90vh; overflow: auto; position: relative; }
.modal-close { position: absolute; right: 12px; top: 12px; }

.md h2 { margin-top: 18px; font-size: 15px; }
.md ul { padding-left: 20px; }
.md p { margin: 6px 0; }
.ai-item { border-top: 1px solid var(--grid); padding-top: 12px; margin-top: 12px; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px;
  vertical-align: -1px; }
.intro { margin: -8px 0 16px; max-width: 900px; }
.form2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
label.check { display: flex; gap: 8px; align-items: center; }
label.check input { display: inline; width: auto; margin: 0; }
code, pre.code, textarea.code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
code { background: var(--page); border: 1px solid var(--grid); border-radius: 4px; padding: 0 4px; }
code.ins { cursor: pointer; }
code.ins:hover { border-color: var(--accent); color: var(--accent); }
textarea.code { display: block; width: 100%; margin-top: 4px; resize: vertical; tab-size: 4; line-height: 1.5; }
pre.code { background: var(--page); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
  white-space: pre-wrap; word-break: break-all; }
details.hint { margin: 8px 0 12px; }
details.hint summary { cursor: pointer; color: var(--ink-2); }
.hint-box { background: var(--page); border: 1px solid var(--grid); border-radius: 6px; padding: 6px 12px;
  margin-bottom: 12px; font-size: 13px; }
.hint-box p { margin: 6px 0; line-height: 1.9; }
.wrap { white-space: normal; display: inline-block; max-width: 460px; vertical-align: top; }
.btn.link { border: 0; background: none; padding: 0; color: var(--accent); }
.tab-list { max-height: 280px; overflow: auto; margin-top: 8px; font-size: 13px; }
.tab-list > div { padding: 2px 0; }
.tab-list .cols { margin: 2px 0 6px 14px; line-height: 1.9; }
.tab-list .cols:empty { display: none; }
@media (max-width: 700px) {
  main { padding: 12px; }
  .two { grid-template-columns: 1fr; }
  .top-right { margin-left: 0; }
}
.filters label.check { margin-bottom: 0; }
.login-card .err { margin: 10px 0 0; min-height: 0; }
