/* Radar — Digitouch tender scouting. Design tokens from gruppodigitouch.it logo. */

[hidden] { display: none !important; }

:root {
  /* brand (from logo SVG) */
  --dt-blue: #004899;
  --dt-blue-700: #003a7a;
  --dt-violet: #5e4f9c;
  --dt-sky: #82d0f5;
  --dt-sky-soft: #eaf5fd;
  --dt-blue-soft: #e9f0f9;

  /* neutrals */
  --ink: #1c1c1e;
  --ink-2: #565259;
  --ink-3: #8d8994;
  --ink-4: #b4b1bb;
  --line: #e7e6ec;
  --line-soft: #f0eff4;
  --bg: #f7f7f9;
  --surface: #ffffff;
  --surface-2: #fbfbfd;

  /* semantic (data states only, deliberately desaturated) */
  --good: #0d7a52;
  --good-soft: #e7f4ee;
  --warn: #9a6510;
  --warn-soft: #fbf1e0;
  --bad: #a32a3c;
  --bad-soft: #fbeaec;

  /* shape lock */
  --r-card: 14px;
  --r-ctl: 10px;
  --r-pill: 999px;

  --shadow-1: 0 1px 2px rgba(28, 28, 30, .04), 0 1px 3px rgba(28, 28, 30, .03);
  --shadow-2: 0 1px 2px rgba(28, 28, 30, .04), 0 10px 28px -14px rgba(0, 72, 153, .22);
  --shadow-pop: 0 2px 6px rgba(28, 28, 30, .05), 0 22px 48px -18px rgba(0, 72, 153, .30);

  --sans: ui-sans-serif, -apple-system, "SF Pro Text", "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--dt-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--dt-blue);
  outline-offset: 2px;
  border-radius: 4px;
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ══════════════════════════════════════ LOGIN ══════════════════════════════════════ */

.auth {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
}

.auth__brand {
  position: relative;
  overflow: hidden;
  background: linear-gradient(155deg, #002d61 0%, var(--dt-blue) 42%, #2a5fa8 100%);
  color: #fff;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth__brand::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(760px 520px at 88% 8%, rgba(130, 208, 245, .30), transparent 62%),
    radial-gradient(620px 480px at 4% 96%, rgba(94, 79, 156, .42), transparent 60%);
}

.auth__brand > * { position: relative; z-index: 1; }

.auth__mark { display: flex; align-items: center; gap: 12px; }
.auth__mark img { height: 24px; }
.auth__mark .brandchip {
  display: inline-flex; align-items: center;
  background: #fff; border-radius: 8px; padding: 8px 12px;
}
.auth__mark span {
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, .28);
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .82);
}

.auth__pitch h1 {
  font-size: clamp(34px, 3.4vw, 52px);
  line-height: 1.08;
  letter-spacing: -.03em;
  font-weight: 600;
  margin: 0 0 18px;
  max-width: 15ch;
}
.auth__pitch p {
  margin: 0;
  max-width: 46ch;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, .78);
}

.auth__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  border-top: 1px solid rgba(255, 255, 255, .18);
  padding-top: 26px;
}
.auth__stat b {
  display: block;
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 500;
  letter-spacing: -.02em;
}
.auth__stat span { font-size: 12.5px; color: rgba(255, 255, 255, .66); }

.auth__panel {
  display: grid;
  place-items: center;
  padding: 40px 32px;
  background: var(--surface);
}

.card-auth {
  width: 100%;
  max-width: 396px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  padding: 30px 30px 24px;
}

.card-auth h2 {
  margin: 0 0 6px;
  font-size: 21px;
  letter-spacing: -.02em;
  font-weight: 600;
}
.card-auth .sub { margin: 0 0 24px; color: var(--ink-2); font-size: 13.5px; }

.btn-ms {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease), transform .12s var(--ease);
}
.btn-ms:hover { background: var(--surface-2); border-color: var(--ink-4); }
.btn-ms:active { transform: scale(.985); }

.auth__legal {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.55;
}

/* Entra account picker */
.entra { animation: pop .3s var(--ease) both; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }

.entra__head { display: flex; align-items: center; gap: 9px; margin-bottom: 20px; }
.entra__head b { font-size: 15px; font-weight: 600; }

.acct {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: var(--r-ctl);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.acct:hover { background: var(--dt-blue-soft); border-color: #d2e0f1; }
.acct__av {
  width: 34px; height: 34px;
  border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: var(--dt-blue); color: #fff;
  font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
  flex: 0 0 auto;
}
.acct__av--alt { background: var(--dt-violet); }
.acct b { display: block; font-size: 13.5px; font-weight: 550; }
.acct small { color: var(--ink-3); font-size: 12.5px; }

.entra__sep { height: 1px; background: var(--line-soft); margin: 12px 0; }

.entra__spinner {
  display: flex; align-items: center; gap: 11px;
  padding: 22px 4px; color: var(--ink-2); font-size: 13.5px;
}
.spin {
  width: 17px; height: 17px;
  border: 2px solid var(--dt-blue-soft);
  border-top-color: var(--dt-blue);
  border-radius: var(--r-pill);
  animation: rot .7s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════ SHELL ══════════════════════════════════════ */

.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100dvh; }

.side {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100dvh;
}

.side__mark { display: flex; align-items: center; gap: 10px; padding: 4px 8px 0; }
.side__mark img { height: 19px; }
.side__mark span {
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); padding-left: 10px; border-left: 1px solid var(--line);
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__lbl {
  font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-4); padding: 0 10px; margin: 10px 0 6px;
}
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-radius: var(--r-ctl);
  color: var(--ink-2);
  font-size: 13.5px; font-weight: 500;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.nav a:hover { background: var(--line-soft); color: var(--ink); text-decoration: none; }
.nav a.is-on { background: var(--dt-blue-soft); color: var(--dt-blue); font-weight: 600; }
.nav a i { font-size: 17px; }
.nav a .cnt {
  margin-left: auto;
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-3);
  background: var(--line-soft);
  padding: 1px 7px; border-radius: var(--r-pill);
}
.nav a.is-on .cnt { background: #fff; color: var(--dt-blue); }

.side__user {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: var(--r-ctl);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.side__user { min-width: 0; }
.side__user b { display: block; font-size: 12.5px; font-weight: 600; }
.side__user small { color: var(--ink-3); font-size: 11.5px; }
.side__user-info { display: block; min-width: 0; }
.side__user-mail {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 10.5px;
}
.side__user button {
  margin-left: auto; background: none; border: 0; cursor: pointer;
  color: var(--ink-3); font-size: 16px; padding: 2px; border-radius: 6px;
}
.side__user button:hover { color: var(--bad); }

.main { min-width: 0; display: flex; flex-direction: column; }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 0 26px; height: 68px;
  background: rgba(247, 247, 249, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.top .date { color: var(--ink-3); font-size: 13px; }
.top__right { margin-left: auto; display: flex; align-items: center; gap: 16px; }

.runpill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 9px;
  border: 1px solid #d6e6d9;
  background: var(--good-soft);
  color: var(--good);
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 550;
}
.runpill .dot {
  width: 6px; height: 6px; border-radius: var(--r-pill); background: var(--good);
}
@media (prefers-reduced-motion: no-preference) {
  .runpill .dot { animation: breathe 2.6s ease-in-out infinite; }
}
@keyframes breathe { 50% { opacity: .35; } }

.search {
  position: relative;
  width: 268px;
}
.search input {
  width: 100%; height: 36px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  font-size: 13px;
}
.search input::placeholder { color: var(--ink-4); }
.search input:focus { outline: none; border-color: var(--dt-blue); box-shadow: 0 0 0 3px var(--dt-blue-soft); }
.search i { position: absolute; left: 11px; top: 9px; color: var(--ink-4); font-size: 16px; }

.page { padding: 24px 26px 64px; }
.view[hidden] { display: none; }

/* ══════════════════════════════════════ KPI ══════════════════════════════════════ */

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }

.kpi {
  position: relative;
  text-align: left;
  padding: 15px 16px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  cursor: pointer;
  transition: box-shadow .2s var(--ease), transform .16s var(--ease), border-color .2s var(--ease);
}
.kpi:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.kpi:active { transform: translateY(0) scale(.995); }
.kpi.is-on { border-color: var(--dt-blue); box-shadow: 0 0 0 3px var(--dt-blue-soft); }

.kpi__lbl { display: block; font-size: 12.5px; color: var(--ink-2); margin-bottom: 10px; }
.kpi__row { display: flex; align-items: flex-end; gap: 8px; }
.kpi__val { font-family: var(--mono); font-size: 29px; font-weight: 500; letter-spacing: -.03em; line-height: 1; }
.kpi__of { font-size: 12px; color: var(--ink-4); padding-bottom: 2px; }
.kpi__ico {
  position: absolute; right: 13px; bottom: 13px;
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--dt-blue-soft); color: var(--dt-blue); font-size: 15px;
}
.kpi--alert .kpi__ico { background: var(--warn-soft); color: var(--warn); }
.kpi--alert .kpi__val { color: var(--warn); }

/* ══════════════════════════════════════ TOOLBAR ══════════════════════════════════════ */

.bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.bar__spacer { margin-left: auto; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease), border-color .16s var(--ease);
}
.chip:hover { border-color: var(--ink-4); color: var(--ink); }
.chip.is-on { background: var(--dt-blue); border-color: var(--dt-blue); color: #fff; }
.chip .n { font-family: var(--mono); font-size: 11px; opacity: .72; }

select.ctl {
  height: 32px; padding: 0 30px 0 11px;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2.5 4.5L6 8l3.5-3.5' fill='none' stroke='%238d8994' stroke-width='1.4' stroke-linecap='round'/></svg>") no-repeat right 10px center;
  font-size: 12.5px; color: var(--ink-2);
  appearance: none; cursor: pointer;
}
select.ctl:focus { outline: none; border-color: var(--dt-blue); box-shadow: 0 0 0 3px var(--dt-blue-soft); }

/* ══════════════════════════════════════ TABLE ══════════════════════════════════════ */

.tablewrap {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  /* clip, non hidden: hidden creerebbe uno scroll container e romperebbe il thead sticky */
  overflow: clip;
}

table.t { width: 100%; border-collapse: collapse; table-layout: fixed; }

table.t thead th {
  position: sticky; top: 68px; z-index: 5;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  font-size: 11px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase;
  color: var(--ink-3);
  text-align: left;
  white-space: nowrap;
}
table.t thead th.r { text-align: right; }
table.t thead th[data-k] {
  cursor: pointer; user-select: none;
  transition: color .15s ease;
}
table.t thead th[data-k]:hover { color: var(--ink-1); }
table.t thead th[data-k]::after {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  margin-left: 5px;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  vertical-align: middle;
  opacity: .35;
}
table.t thead th.th--asc::after { border-bottom: 4px solid currentColor; opacity: 1; }
table.t thead th.th--desc::after { border-top: 4px solid currentColor; opacity: 1; }

table.t tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
  overflow: hidden;
}
table.t tbody tr.row { cursor: pointer; transition: background .14s var(--ease); }
table.t tbody tr.row:hover { background: var(--surface-2); }
table.t tbody tr.row.is-open { background: var(--dt-blue-soft); }
table.t tbody tr.row.is-open td { border-bottom-color: transparent; }
table.t tbody tr:last-child td { border-bottom: 0; }

.cell-ent {
  font-weight: 600; font-size: 13.5px; letter-spacing: -.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cell-sub { color: var(--ink-3); font-size: 11.5px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-obj { color: var(--ink-2); font-size: 12.5px; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.r { text-align: right; }
.imp { font-family: var(--mono); font-size: 13px; font-weight: 500; }

.score {
  display: inline-flex; align-items: baseline; gap: 1px;
  min-width: 46px; justify-content: center;
  padding: 4px 9px;
  border-radius: 8px;
  font-family: var(--mono); font-size: 14.5px; font-weight: 600;
  letter-spacing: -.02em;
}
/* semaforo a quattro fasce, stesso codice colore in tabella, kanban e popup */
.score--forte { background: var(--good-soft); color: var(--good); }
.score--selettivo { background: var(--warn-soft); color: var(--warn); }
.score--partner { background: #eef2f7; color: #5a6b80; }
.score--nogo { background: var(--line-soft); color: var(--ink-3); }

.delta { display: inline-flex; gap: 5px; color: var(--ink-4); font-size: 15px; }
.delta i[data-k="new"] { color: var(--dt-blue); }
.delta i[data-k="soon"] { color: var(--warn); }
.delta i[data-k="mod"] { color: var(--dt-violet); }
.delta i[data-k="rec"] { color: var(--ink-3); }

.scad { font-family: var(--mono); font-size: 12.5px; font-weight: 550; }
.scad--soon { color: var(--bad); }
.scad--near { color: var(--warn); }

.stato {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--r-pill);
  max-width: 100%; box-sizing: border-box;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.st-valutare { background: var(--line-soft); color: var(--ink-2); }
.st-analisi { background: var(--dt-blue-soft); color: var(--dt-blue); }
.st-preparazione { background: #efe9f7; color: var(--dt-violet); }
.st-presentata { background: var(--good-soft); color: var(--good); }
.st-scartata { background: var(--bad-soft); color: var(--bad); }

.av {
  width: 25px; height: 25px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  background: var(--dt-blue-soft); color: var(--dt-blue);
}
.av--none { background: var(--line-soft); color: var(--ink-4); font-weight: 500; }
.av--v { background: #efe9f7; color: var(--dt-violet); }
.av--s { background: var(--dt-sky-soft); color: #1f6f9e; }

.caret { color: var(--ink-4); font-size: 15px; transition: transform .22s var(--ease); display: inline-block; }
tr.is-open .caret { transform: rotate(90deg); color: var(--dt-blue); }

.lotti-badge {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 7px; padding: 1px 7px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  font-size: 10.5px; font-weight: 600; color: var(--ink-3);
  vertical-align: 1px;
}

/* ══════════════════════════════════════ DRILL-DOWN ══════════════════════════════════════ */

tr.drillrow > td { padding: 0 !important; border-bottom: 1px solid var(--line) !important; background: var(--surface-2); }

.drill {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 0;
  animation: slidein .26s var(--ease) both;
}
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .drill { animation: none; } }

.drill__l { padding: 20px 22px; border-right: 1px solid var(--line); }
.drill__r { padding: 20px 22px; display: flex; flex-direction: column; gap: 18px; }

.blk + .blk { margin-top: 18px; }
.blk__h {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 650;
  margin-bottom: 10px;
}
.blk__h i { font-size: 14px; }

.why {
  border: 1px solid #d5e3f3;
  background: linear-gradient(180deg, #f4f9fe, var(--surface));
  border-radius: 12px;
  padding: 14px 16px;
}
.why__top { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.why__score { font-family: var(--mono); font-size: 26px; font-weight: 600; letter-spacing: -.03em; color: var(--dt-blue); line-height: 1; }
.why__tag {
  font-size: 10.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
  color: var(--dt-violet); background: #efe9f7; padding: 3px 8px; border-radius: var(--r-pill);
}
.why ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.why li { display: flex; gap: 9px; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.why li i { font-size: 15px; color: var(--good); flex: 0 0 auto; margin-top: 1px; }
.why li[data-t="warn"] i { color: var(--warn); }
.why li[data-t="info"] i { color: var(--dt-blue); }
.why b { color: var(--ink); font-weight: 600; }

.why__src {
  margin-top: 12px; padding-top: 11px; border-top: 1px dashed #d5e3f3;
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--ink-3);
}
.srcchip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--ink-2); cursor: pointer;
}
.srcchip:hover { border-color: var(--dt-blue); color: var(--dt-blue); }
.srcchip i { font-size: 13px; }

.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 22px; }
.fact { min-width: 0; }
.fact dt { font-size: 11px; color: var(--ink-3); margin-bottom: 2px; }
.fact dd { margin: 0; font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.fact dd.mono { font-family: var(--mono); font-size: 12.5px; }

.lotto {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto;
  align-items: center; gap: 12px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
}
.lotto + .lotto { margin-top: 6px; }
.lotto__n { font-family: var(--mono); font-size: 11.5px; font-weight: 650; color: var(--ink-3); }
.lotto__o { font-size: 12.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hist { display: flex; flex-direction: column; gap: 9px; }
.histrow { display: flex; align-items: baseline; gap: 10px; font-size: 12.5px; color: var(--ink-2); }
.histrow b { font-family: var(--mono); color: var(--ink); font-weight: 600; font-size: 13px; min-width: 54px; }

.winbar { display: flex; height: 6px; border-radius: var(--r-pill); overflow: hidden; background: var(--line-soft); margin-top: 2px; }
.winbar i { display: block; height: 100%; }

.acts { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; margin-top: auto; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--surface); color: var(--ink);
  font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease), transform .12s var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-4); }
.btn:active { transform: translateY(1px); }
.btn i { font-size: 15px; }
.btn--pri { background: var(--dt-blue); border-color: var(--dt-blue); color: #fff; }
.btn--pri:hover { background: var(--dt-blue-700); border-color: var(--dt-blue-700); }
.btn--dan { color: var(--bad); }
.btn--dan:hover { background: var(--bad-soft); border-color: #eccdd2; }

/* ══════════════════════════════════════ PIPELINE ══════════════════════════════════════ */

.kanban { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 12px; align-items: start; }

.col {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 12px;
  min-height: 180px;
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.col.drop-on { border-color: var(--dt-blue); background: var(--dt-blue-soft); }

.col__h { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.col__h b { font-size: 12.5px; font-weight: 650; }
.col__h .n {
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
  background: var(--line-soft); padding: 1px 7px; border-radius: var(--r-pill);
}
.col__sum { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); margin-bottom: 11px; }

.kcard {
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  padding: 11px;
  cursor: grab;
  box-shadow: var(--shadow-1);
  transition: box-shadow .18s var(--ease), transform .16s var(--ease);
}
.kcard + .kcard { margin-top: 8px; }
.kcard:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
.kcard.dragging { opacity: .42; cursor: grabbing; }
.kcard__t { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.kcard__e { font-size: 12.5px; font-weight: 650; letter-spacing: -.005em; }
.kcard__o { font-size: 12px; color: var(--ink-2); line-height: 1.4; margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kcard__f { display: flex; align-items: center; gap: 8px; }
.kcard__f .imp { font-size: 12px; margin-right: auto; }

.col__empty {
  padding: 22px 10px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--r-ctl);
  color: var(--ink-4); font-size: 12px;
}

/* ══════════════════════════════════════ MERCATO ══════════════════════════════════════ */

.grid2 { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.grid2--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.panel__h {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.panel__h h3 { margin: 0; font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.panel__h p { margin: 0; font-size: 12px; color: var(--ink-3); }
.panel__h .bar__spacer + * { flex: 0 0 auto; }
.panel__b { padding: 16px; flex: 1; }
.panel__b--flush { padding: 0; flex: 1; }

.tbl__more {
  width: 100%; padding: 10px; border: 0; border-top: 1px dashed var(--line);
  background: var(--surface-2); color: var(--dt-blue); font-size: 12.5px; font-weight: 600;
  cursor: pointer; text-align: left;
}
.tbl__more:hover { background: var(--line-soft); }

.rib { display: flex; flex-direction: column; gap: 13px; }
.ribrow__t { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; margin-bottom: 6px; }
.ribrow__t b { margin-left: auto; font-family: var(--mono); font-size: 13px; font-weight: 600; }
.ribrow__t small { color: var(--ink-4); font-family: var(--mono); font-size: 11px; }
.ribline { position: relative; height: 3px; background: var(--line-soft); border-radius: var(--r-pill); }
.ribline i {
  position: absolute; top: -2px; height: 7px;
  background: var(--dt-blue); border-radius: var(--r-pill);
}
.ribline u {
  position: absolute; top: -4px; width: 2px; height: 11px;
  background: var(--dt-violet); border-radius: 1px;
}

.gap {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
}
.gap + .gap { border-top: 1px solid var(--line-soft); }
.gap__i {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--warn-soft); color: var(--warn); font-size: 16px; flex: 0 0 auto;
}
.gap b { display: block; font-size: 13px; font-weight: 600; }
.gap small { color: var(--ink-3); font-size: 12px; }
.gap .imp { margin-left: auto; color: var(--ink-2); }

/* ══════════════════════════════════════ MISC ══════════════════════════════════════ */

.empty {
  padding: 60px 20px; text-align: center;
}
.empty i { font-size: 34px; color: var(--ink-4); }
.empty b { display: block; margin: 12px 0 4px; font-size: 14.5px; }
.empty p { margin: 0 auto 16px; max-width: 44ch; color: var(--ink-3); font-size: 13px; }

.sk { background: linear-gradient(90deg, var(--line-soft) 25%, #e9e8ee 37%, var(--line-soft) 63%); background-size: 400% 100%; border-radius: 6px; }
@media (prefers-reduced-motion: no-preference) { .sk { animation: shim 1.3s linear infinite; } }
@keyframes shim { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* modal */
.ov {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(28, 28, 30, .34);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 24px;
  animation: fade .18s var(--ease) both;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 424px;
  background: var(--surface);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
  padding: 22px;
  animation: pop .24s var(--ease) both;
}
.modal h3 { margin: 0 0 4px; font-size: 16px; font-weight: 650; letter-spacing: -.015em; }
.modal p.s { margin: 0 0 18px; font-size: 12.5px; color: var(--ink-3); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field select, .field textarea, .field input {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--surface); font-size: 13px;
}
.field textarea { resize: vertical; min-height: 68px; }
.field select:focus, .field textarea:focus, .field input:focus {
  outline: none; border-color: var(--dt-blue); box-shadow: 0 0 0 3px var(--dt-blue-soft);
}
.field small { display: block; margin-top: 5px; font-size: 11.5px; color: var(--ink-3); }
.modal__f { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 18px; }

.toast-stack {
  position: fixed; top: auto; right: 22px; bottom: 22px; left: auto; z-index: 100;
  display: flex; flex-direction: column; gap: 8px;
  width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  margin: 0; padding: 0; border: 0; background: transparent; color: inherit;
  overflow-y: auto; pointer-events: none;
}
.toast-stack.toast-stack--modal-fallback {
  position: sticky; top: 0; right: auto; bottom: auto; left: auto;
  width: 100%; max-height: calc(100dvh - 100px); margin-bottom: 12px;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px 11px 14px; pointer-events: auto;
  background: var(--ink); color: var(--surface);
  border-radius: var(--r-ctl); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-pop); overflow-wrap: anywhere;
  animation: toast-in .25s var(--ease) both;
}
.toast__icon {
  display: grid; place-items: center; flex: 0 0 21px; height: 21px;
  border-radius: 50%; background: var(--good-soft); color: var(--good);
  font-size: 13px; font-weight: 700;
}
.toast--warning .toast__icon { background: var(--warn-soft); color: var(--warn); }
.toast--error .toast__icon { background: var(--bad-soft); color: var(--bad); }
.toast--info .toast__icon { background: var(--dt-blue-soft); color: var(--dt-blue); }
.toast__message { flex: 1; min-width: 0; white-space: pre-wrap; }
.toast__close {
  display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px;
  padding: 0; border: 0; border-radius: 6px; cursor: pointer;
  background: transparent; color: inherit; font-size: 22px; line-height: 1;
}
.toast__close:hover { background: rgba(255, 255, 255, .14); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }
@media (max-width: 640px) {
  .toast-stack { right: 12px; bottom: 12px; }
  .toast__close { flex-basis: 44px; width: 44px; height: 44px; }
}

/* responsive */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .drill { grid-template-columns: minmax(0, 1fr); }
  .drill__l { border-right: 0; border-bottom: 1px solid var(--line); }
  .grid2, .grid2--even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .side__mark { padding: 0; }
  .nav { flex-direction: row; }
  .nav__lbl, .side__user, .nav a .cnt { display: none; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth__brand { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kanban { grid-template-columns: minmax(0, 1fr); }
  .page { padding: 16px 14px 48px; }
  .top { padding: 0 14px; }
  .search { width: 150px; }
}

/* ─────────────────────────────── mappa Italia ─────────────────────────── */

.maplegend { display: flex; gap: 14px; align-items: center; font-size: 11.5px; color: var(--ink-3); }
.maplegend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot--att { background: var(--dt-blue); }
.dot--nos { background: var(--warn); }

.mappa { display: flex; justify-content: center; align-items: center; height: 100%; }
.mappa svg { width: 100%; max-width: 380px; height: auto; overflow: visible; }

.reg {
  fill: var(--surface-2);
  stroke: var(--surface);
  stroke-width: 1;
  transition: fill .16s var(--ease);
  cursor: pointer;
}
.reg:hover { fill: var(--dt-sky) !important; }
.reg:focus-visible { outline: 2px solid var(--dt-blue); outline-offset: 2px; }

.pin { pointer-events: none; }
.pin__n { font: 600 9px var(--mono, ui-monospace); fill: #fff; text-anchor: middle; }

/* il lampeggio distingue le gare che stiamo lavorando da quelle solo censite */
.pin--nostre circle { animation: pulse 2.4s var(--ease) infinite; transform-origin: center; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .45; }
}

@media (prefers-reduced-motion: reduce) {
  .pin--nostre circle { animation: none; }
}

.chip--reg { background: var(--dt-blue-soft); border-color: var(--dt-blue); color: var(--dt-blue); }
.chip--reg .ph { font-size: 13px; vertical-align: -1px; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 40px 24px; text-align: center;
}
.empty .ph { font-size: 26px; color: var(--ink-4); margin-bottom: 4px; }
.empty b { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.empty span { font-size: 12.5px; color: var(--ink-3); max-width: 34ch; line-height: 1.5; }

.pill--off { background: var(--surface-2); border-color: var(--line); color: var(--ink-3); }
.dot--off { background: var(--ink-4) !important; }

/* paginazione */
.pager { display: flex; align-items: center; gap: 4px; padding: 10px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager__n { font-size: 12px; color: var(--ink-3); margin-right: auto; }
.pager__b { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--line); background: #fff;
  border-radius: 7px; font: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer; transition: .15s; }
.pager__b:hover:not(:disabled) { border-color: var(--dt-blue); color: var(--dt-blue); }
.pager__b.is-on { background: var(--dt-blue); border-color: var(--dt-blue); color: #fff; }
.pager__b:disabled { opacity: .35; cursor: default; }
.pager__e { color: var(--ink-3); padding: 0 2px; }
.srcchip--go { text-decoration: none; justify-content: flex-start; gap: 6px; }
.srcchip--go:hover { border-color: var(--dt-blue); color: var(--dt-blue); }
.srcchip--go .ph-arrow-square-out { margin-left: auto; opacity: .55; }

/* semafori fascia riusabili */
.semaforo { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink-2); }
.semaforo i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.semaforo b { font-weight: 600; color: var(--ink); }
.sem--forte i { background: var(--good); }
.sem--selettivo i { background: var(--warn); }
.sem--partner i { background: #7d90a8; }
.sem--nogo i { background: var(--ink-4); }

/* popup regione */
.regstat { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.regstat > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.regstat b { display: block; font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.regstat span { font-size: 11.5px; color: var(--ink-3); }
.regfasce { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.regenti__t { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 6px; }
.regenti > div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-top: 1px solid var(--line-soft); font-size: 12.5px; }
.regenti > div span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* niente rettangolo di focus residuo dopo un click col mouse */
.reg:focus:not(:focus-visible), .reg:active { outline: none; }
.reg:focus-visible { outline: 2px solid var(--dt-blue); outline-offset: 2px; }

/* kanban: mostra altre */
.col__more { width: 100%; margin-top: 6px; padding: 7px; border: 1px dashed var(--line); background: transparent;
  border-radius: 8px; font: inherit; font-size: 12px; color: var(--ink-3); cursor: pointer; }
.col__more:hover { border-color: var(--dt-blue); color: var(--dt-blue); }

/* campanella notifiche */
.bell-wrap { position: relative; }
.bell { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink-2); cursor: pointer; display: grid; place-items: center; font-size: 17px; }
.bell:hover { border-color: var(--dt-blue); color: var(--dt-blue); }
.bell--on { color: var(--dt-blue); }
.bell__n { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--bad); color: #fff; font-size: 10.5px; font-weight: 600;
  display: grid; place-items: center; border: 2px solid #fff; }
.notif { position: absolute; right: 0; top: calc(100% + 8px); width: 340px; z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgb(3 22 46 / .14); overflow: hidden; }
.notif__h { display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; font-weight: 600; }
.notif__l { list-style: none; margin: 0; padding: 0; max-height: 380px; overflow-y: auto; }
.notif__i { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.notif__i:hover { background: var(--surface-2); }
.notif__i > i { color: var(--ink-3); font-size: 16px; margin-top: 1px; }
.notif__i p { margin: 0 0 2px; font-size: 12.5px; line-height: 1.45; color: var(--ink); }
.notif__i span { font-size: 11px; color: var(--ink-3); }
.notif__i.is-new { background: color-mix(in srgb, var(--dt-blue) 5%, #fff); }
.notif__i.is-new > i { color: var(--dt-blue); }
.notif__v { margin: 0; padding: 18px 14px; font-size: 12.5px; color: var(--ink-3); }
.lnk { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; font-weight: 500;
  color: var(--dt-blue); cursor: pointer; }
.lnk:hover { text-decoration: underline; }

/* azioni di riga nelle tabelle */
.rowact { display: inline-flex; gap: 4px; }
.ico { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  color: var(--ink-3); cursor: pointer; display: grid; place-items: center; font-size: 15px; text-decoration: none; }
.ico:hover { border-color: var(--dt-blue); color: var(--dt-blue); }
.ico--dan:hover { border-color: var(--bad); color: var(--bad); }
.vuoto { padding: 22px 6px; color: var(--ink-3); font-size: 13px; text-align: center; }
input[type=file] { width: 100%; font: inherit; font-size: 12.5px; padding: 9px 10px;
  border: 1px dashed var(--line); border-radius: 9px; background: var(--surface-2); }

/* popup vincitore: la tabella gare vinte ha bisogno di spazio e di testo a capo */
.modal:has(#tVinte) { max-width: 680px; }
/* scheda gara in popup (kanban, notifiche): stesso drill-down della dashboard */
.modal.modal--gara { max-width: 1080px; padding: 0; }
.modal--gara .modal__h { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 18px 22px 14px; background: var(--surface); border-bottom: 1px solid var(--line); }
.modal--gara .modal__h p.s { margin: 0; }
.modal--gara table.t { width: 100%; border-collapse: collapse; }
.modal--gara tr.drillrow > td { border-bottom: 0 !important; }
.modal--gara .modal__f { margin: 0; padding: 14px 22px 18px; border-top: 1px solid var(--line); }
.btn--ico { width: 36px; height: 36px; padding: 0; justify-content: center; flex: none; }
.kcard { cursor: pointer; }
.kcard[draggable="true"]:active { cursor: grabbing; }
.kcard:focus-visible { outline: 2px solid var(--dt-blue); outline-offset: 2px; }
#tVinte .cell-ent, #tVinte .cell-sub { white-space: normal; }
.modal { max-height: calc(100vh - 48px); overflow-y: auto; }
#tAgg .lnk { text-align: left; white-space: normal; }
#tAgg .cell-ent, #tAgg .cell-sub { white-space: normal; }

/* Shared controls and responsive layout; retain the dashboard's Digitouch tokens. */
input.ctl {
  width: 100%; min-width: 0; height: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--surface); color: var(--ink-2); font-size: 12.5px;
}
.filter-panel {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; padding: 16px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface);
}
.filter-panel label { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 12.5px; color: var(--ink-2); }
.filter-panel .ctl { width: 100%; min-width: 0; height: 36px; }
.filter-chips:empty { display: none; }
.filter-chips .chip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
input.ctl:focus-visible { outline: 2px solid var(--dt-blue); outline-offset: 2px; }
#tAgg th:nth-child(1) { width: 27%; }
#tAgg th:nth-child(2), #tAgg th:nth-child(3) { width: 20%; }
#tAgg th:nth-child(4) { width: 11%; }
#tAgg th:nth-child(5) { width: 9%; }
#tAgg th:nth-child(6) { width: 13%; }
#tAgg .lnk { color: var(--ink); font-size: 13.5px; font-weight: 600; }
#tAgg .lnk:hover { color: var(--dt-blue); }
.menu-toggle { display: none; }
.main, .page, .view, .panel, .panel__b, .panel__h > div, .bar, .top > div,
.drill__l, .drill__r, .fact, .kcard, .gap > div { min-width: 0; }
.panel__h { flex-wrap: wrap; }
.panel__h > div:first-child { flex: 1 1 200px; }
.top { height: auto; min-height: 68px; flex-wrap: wrap; padding-block: 12px; }
.top__right { min-width: 0; }
.runpill { flex-wrap: wrap; }
.kanban { overflow-x: auto; padding-bottom: 6px; }
.table-scroll, .tablewrap, .panel__b--flush { overflow-x: auto; }
table.t thead th { top: 0; }
.facts dd, .modal h3, .modal p, .srcchip, .why li, .gap, .top .date { overflow-wrap: anywhere; }
.modal { overscroll-behavior: contain; }
.toast-stack { max-width: calc(100vw - 24px); }
.kcard__state { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--ink-3); }
.kcard__state select { max-width: 100%; flex: 1; min-width: 0; }
button, a, select { touch-action: manipulation; }

@media (max-width: 1200px) {
  .kpis[style] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #tabDaily { min-width: 1080px; }
  #tabArch { min-width: 900px; }
  #tAgg { min-width: 900px; }
  #tVincitori { min-width: 800px; }
}
@media (max-width: 900px) {
  .side { flex-wrap: wrap; overflow: visible; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .side__mark { flex: 1; }
  .menu-toggle { display: inline-flex; }
  .side .nav, .side .side__user { display: none; }
  .side.menu-open .nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .side.menu-open .side__user { display: flex; width: 100%; margin: 0; }
  .side.menu-open .nav a .cnt { display: inline; }
  .nav a { min-height: 44px; }
  .top { position: static; }
  .top > div:first-child { flex: 1 1 180px; }
  .top__right { flex: 1 1 100%; }
  .top__right .search { width: auto; flex: 1; }
  .bell-wrap { margin-left: auto; }
  .runpill { order: 3; }
  table.t thead th { top: 0; }
  .bar .search { width: 100% !important; flex: 1 1 260px; }
  .bar__spacer { display: none; }
  .bar select { max-width: 100%; }
  .notif { width: min(340px, calc(100vw - 28px)); }
  .auth__panel { padding: 24px 16px; }
  .card-auth { padding: 24px 20px; }
  .ov { padding: 12px; }
  .modal { max-height: calc(100dvh - 24px); padding: 18px; }
  .drill__l, .drill__r { padding: 16px; }
}
@media (max-width: 640px) {
  .page { padding: 16px 12px calc(32px + env(safe-area-inset-bottom)); }
  .side { padding-top: max(12px, env(safe-area-inset-top)); }
  .btn, .chip, select.ctl, .search input, input.ctl, .ico, .pager__b { min-height: 44px; height: auto; }
  input, select, textarea, .search input, input.ctl, select.ctl, .field input, .field select, .field textarea { font-size: 16px; }
  .search input { height: 44px; }
  .search i { top: 13px; }
  .kpi { padding: 12px; }
  .kpi__row { flex-wrap: wrap; gap: 4px; padding-right: 24px; }
  .kpi__val { font-size: 24px; }
  .kpi__ico { width: 24px; height: 24px; right: 8px; bottom: 10px; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .fact[style] { grid-column: auto !important; }
  .acts, .modal__f { flex-wrap: wrap; }
  .acts .btn, .modal__f .btn { flex: 1 1 120px; justify-content: center; }
  .ribrow__t, .histrow, .gap { flex-wrap: wrap; }
  .panel__h, .panel__b { padding: 12px; }
  .panel__b--flush { padding: 0; }
  table.t, #tabDaily, #tabArch, #tAgg, #tVincitori { display: block; min-width: 0; width: 100%; }
  table.t thead, table.t tbody { display: block; width: 100%; }
  table.t thead tr { display: flex; flex-wrap: wrap; padding: 6px; gap: 4px; }
  table.t thead th { display: none; position: static; border: 0; }
  table.t thead th[data-k] { display: block; width: auto !important; min-height: 44px; padding: 12px 8px; border-radius: var(--r-ctl); }
  .filter-panel { grid-template-columns: minmax(0, 1fr); }
  .filter-panel .ctl { min-height: 44px; }
  table.t tbody tr:not(.drillrow) { display: grid; grid-template-columns: minmax(0, 1fr); padding: 12px; border-bottom: 1px solid var(--line); gap: 8px; }
  table.t tbody td { display: block; width: 100%; padding: 0; border: 0; overflow: visible; text-align: left; overflow-wrap: anywhere; }
  table.t tbody td[data-label]::before { content: attr(data-label); display: block; color: var(--ink-3); font-size: 11px; font-weight: 500; margin-bottom: 2px; }
  table.t tbody td:empty { display: none; }
  table.t .cell-ent, table.t .cell-sub, table.t .cell-obj { white-space: normal; max-width: none; overflow-wrap: anywhere; }
  table.t tbody tr.drillrow, table.t tbody tr.drillrow > td { display: block; width: 100%; }
  .modal:has(.drill) .drill__l, .modal:has(.drill) .drill__r { padding: 12px 0; }
  #tAgg .lnk { font-size: 13.5px; }
}
@media (max-width: 360px) {
  .kpis, .kpis[style], .side.menu-open .nav { grid-template-columns: minmax(0, 1fr) !important; }
  .side__mark { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
