/* Dashboard Marketing Team.
   Token copiati da adx/packages/design-tokens/tokens.css (gli stessi del sito e dell'app Adify):
   niente colori nuovi. Il verde di marchio è --adx-brand (#c8f250 nel codice del prodotto).
   Il punto segue social-kit/BRAND_PUNTO.md: un punto del marchio per vista, sull'h1. */

:root {
  color-scheme: light;
  --adx-bg: #eceef2; --adx-surface: #ffffff; --adx-surface-2: #f3f4f7; --adx-track: #e3e6eb;
  --adx-border: #e1e4e9; --adx-border-strong: #80868f;
  --adx-text: #11141b; --adx-text-body: #3f4450; --adx-text-muted: #5a606c;
  --adx-brand: #c8f250; --adx-on-brand: #11141b; --adx-brand-ink: #335c00;
  --adx-primary: #11141b; --adx-on-primary: #ffffff;
  --adx-ok: #0a6b4a; --adx-ok-bg: #dbf1e7; --adx-ok-dot: #12936a;
  --adx-warn: #7a4100; --adx-warn-bg: #fdefd3; --adx-warn-strong: #e59a1c;
  --adx-danger: #b3202b; --adx-danger-bg: #fbe3e3;
  --adx-info: #1f5aa6; --adx-info-bg: #e3edfa;
  --adx-focus: #11141b;
  --adx-chart-1: #11141b; --adx-chart-2: #335c00;
  --adx-logo-y-ink: #11141b; --adx-logo-y-bg: #c8f250;
  --adx-logo-y-pad: 0.02em 0.1em 0.06em; --adx-logo-y-gap: 0.04em; --adx-logo-y-radius: 0.08em;
  --adx-scrim: rgb(17 20 27 / 0.55);
  --adx-shadow-overlay: 0 12px 32px rgb(17 20 27 / 0.14);
  --adx-tooltip-bg: #11141b; --adx-tooltip-text: #ffffff;

  --font-display: 'Bricolage Grotesque', 'Hanken Grotesk', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --r-card: 16px; --r-sub: 12px; --r-control: 10px;
  --side: 248px;
  --punto-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='22 -168 207 181'%3E%3Cpath transform='scale(1 -1)' d='M124 -13Q73 -13 47.5 9Q22 31 22 77Q22 124 47.5 146Q73 168 124 168Q177 168 203 146Q229 124 229 77Q229 -13 124 -13Z'/%3E%3C/svg%3E");
  --punto-ratio: .874;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --adx-bg: #1b2130; --adx-surface: #262d3e; --adx-surface-2: #313a4f; --adx-track: #343c51;
  --adx-border: #3a4258; --adx-border-strong: #7a839b;
  --adx-text: #f2f4f8; --adx-text-body: #c9ced9; --adx-text-muted: #a6adbb;
  --adx-brand: #c8f250; --adx-on-brand: #141821; --adx-brand-ink: #c8f250;
  --adx-primary: #f2f4f8; --adx-on-primary: #141821;
  --adx-ok: #6ddcab; --adx-ok-bg: #183f36; --adx-ok-dot: #3fbf8a;
  --adx-warn: #f7cd7a; --adx-warn-bg: #3b301b; --adx-warn-strong: #e8a93a;
  --adx-danger: #ff9a94; --adx-danger-bg: #47232c;
  --adx-info: #9cc3ff; --adx-info-bg: #1e3150;
  --adx-focus: #f2f4f8;
  --adx-chart-1: #f2f4f8; --adx-chart-2: #c8f250;
  --adx-logo-y-ink: #c8f250; --adx-logo-y-bg: transparent; --adx-logo-y-pad: 0; --adx-logo-y-gap: 0;
  --adx-scrim: rgb(5 7 12 / 0.7);
  --adx-shadow-overlay: 0 12px 32px rgb(0 0 0 / 0.45);
  --adx-tooltip-bg: #f2f4f8; --adx-tooltip-text: #141821;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --adx-bg: #1b2130; --adx-surface: #262d3e; --adx-surface-2: #313a4f; --adx-track: #343c51;
    --adx-border: #3a4258; --adx-border-strong: #7a839b;
    --adx-text: #f2f4f8; --adx-text-body: #c9ced9; --adx-text-muted: #a6adbb;
    --adx-brand: #c8f250; --adx-on-brand: #141821; --adx-brand-ink: #c8f250;
    --adx-primary: #f2f4f8; --adx-on-primary: #141821;
    --adx-ok: #6ddcab; --adx-ok-bg: #183f36; --adx-ok-dot: #3fbf8a;
    --adx-warn: #f7cd7a; --adx-warn-bg: #3b301b; --adx-warn-strong: #e8a93a;
    --adx-danger: #ff9a94; --adx-danger-bg: #47232c;
    --adx-info: #9cc3ff; --adx-info-bg: #1e3150;
    --adx-focus: #f2f4f8;
    --adx-chart-1: #f2f4f8; --adx-chart-2: #c8f250;
    --adx-logo-y-ink: #c8f250; --adx-logo-y-bg: transparent; --adx-logo-y-pad: 0; --adx-logo-y-gap: 0;
    --adx-scrim: rgb(5 7 12 / 0.7);
    --adx-shadow-overlay: 0 12px 32px rgb(0 0 0 / 0.45);
    --adx-tooltip-bg: #f2f4f8; --adx-tooltip-text: #141821;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--adx-bg); color: var(--adx-text-body);
  font: 400 15px/1.5 var(--font-body); -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
h1, h2, h3 { font-family: var(--font-display); color: var(--adx-text); margin: 0; font-weight: 700; }
h1 { font-size: 34px; line-height: 1.05; letter-spacing: -0.035em; font-weight: 800; font-variation-settings: 'opsz' 32; }
h2 { font-size: 19px; line-height: 1.2; letter-spacing: -0.015em; }
h3 { font-size: 15px; line-height: 1.25; letter-spacing: -0.01em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--adx-focus); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--adx-text-muted); }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Il punto (BRAND_PUNTO.md) ── */
.pt-w { white-space: nowrap; }
.pt {
  display: inline-block; line-height: 1; color: var(--adx-logo-y-ink); background: var(--adx-logo-y-bg);
  padding: var(--adx-logo-y-pad); margin-inline-start: var(--adx-logo-y-gap); border-radius: var(--adx-logo-y-radius);
}
[data-brand="knockads"] .pt { display: none; }
.tessera { display: inline-block; flex: 0 0 auto; }
.tessera .t-bg { fill: var(--adx-brand); }
.tessera .t-dot { fill: var(--adx-on-brand); }

/* ── Impianto ── */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 20px;
  padding: 22px 16px 18px; background: var(--adx-surface); border-inline-end: 1px solid var(--adx-border);
}
.logo { display: flex; align-items: baseline; gap: 10px; padding: 2px 8px; text-decoration: none; }
.wordmark {
  font-family: var(--font-display); font-weight: 800; font-size: 27px; letter-spacing: -0.04em;
  color: var(--adx-text); line-height: 1; font-variation-settings: 'opsz' 32;
}
.wordmark .y {
  display: inline-block; color: var(--adx-logo-y-ink); background: var(--adx-logo-y-bg);
  padding: var(--adx-logo-y-pad); margin-inline-start: var(--adx-logo-y-gap); border-radius: var(--adx-logo-y-radius);
}
.logo .team { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--adx-text-muted); text-transform: uppercase; }


.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px;
  background: var(--adx-surface-2); border: 1px solid var(--adx-border); border-radius: 12px;
}
.seg button {
  border: 0; background: none; padding: 7px 10px; border-radius: 9px; font-size: 13px; font-weight: 600;
  color: var(--adx-text-muted); cursor: pointer; white-space: nowrap; min-height: 34px;
}
.seg button[aria-pressed="true"] { background: var(--adx-surface); color: var(--adx-text); box-shadow: 0 1px 2px rgb(17 20 27 / .12), 0 0 0 1px var(--adx-border); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; text-decoration: none;
  color: var(--adx-text-body); font-weight: 600; font-size: 14.5px; position: relative;
}
.nav a:hover { background: var(--adx-surface-2); color: var(--adx-text); }
.nav a[aria-current="page"] { background: var(--adx-text); color: var(--adx-surface); }
.nav a[aria-current="page"] .ico { color: var(--adx-brand); }
:root[data-theme="dark"] .nav a[aria-current="page"] .ico { color: var(--adx-on-primary); }
.nav .ico { width: 20px; height: 20px; flex: 0 0 auto; }
.nav .badge { margin-inline-start: auto; }
.badge {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--adx-brand); color: var(--adx-on-brand); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.side-foot form { margin: 0; }
.link-btn { border: 0; background: none; padding: 6px 8px; color: var(--adx-text-muted); font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.vivo { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--adx-text-muted); padding: 0 8px; }
.vivo i { width: 8px; height: 8px; border-radius: 2px; background: var(--adx-ok-dot); flex: 0 0 auto; }
.vivo.fermo i { background: var(--adx-warn-strong); }

.main { min-width: 0; padding: 30px clamp(16px, 3.4vw, 44px) 60px; max-width: 1440px; }
.top { display: none; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.head p { margin: 6px 0 0; color: var(--adx-text-muted); }
.demo {
  display: flex; align-items: center; gap: 10px; margin: -8px 0 20px; padding: 9px 14px; border-radius: 12px;
  background: var(--adx-warn-bg); color: var(--adx-warn); font-size: 13.5px; font-weight: 600;
}

/* ── Elementi ── */
.card { background: var(--adx-surface); border: 1px solid var(--adx-border); border-radius: var(--r-card); }
.pad { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--adx-surface-2); color: var(--adx-text-body);
  border: 1px solid var(--adx-border);
}
.pill.ok { background: var(--adx-ok-bg); color: var(--adx-ok); border-color: transparent; }
.pill.info { background: var(--adx-info-bg); color: var(--adx-info); border-color: transparent; }
.pill.warn { background: var(--adx-warn-bg); color: var(--adx-warn); border-color: transparent; }
.pill.danger { background: var(--adx-danger-bg); color: var(--adx-danger); border-color: transparent; }
.pill.brand { background: var(--adx-brand); color: var(--adx-on-brand); border-color: transparent; }
.pill.vivo-p::before {
  content: ''; width: 7px; height: 7px; border-radius: 2px; background: currentColor; animation: batti 1.4s ease-in-out infinite;
}
@keyframes batti { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .pill.vivo-p::before { animation: none; } }
.tag { font-size: 12px; font-weight: 600; color: var(--adx-text-muted); text-transform: uppercase; letter-spacing: .04em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px;
  border-radius: var(--r-control); border: 1.5px solid var(--adx-border-strong); background: var(--adx-surface);
  color: var(--adx-text); font-weight: 700; font-size: 14.5px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: transform .12s ease, background-color .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:hover { background: var(--adx-surface-2); }
.btn.primary { background: var(--adx-primary); color: var(--adx-on-primary); border-color: var(--adx-primary); }
.btn.primary:hover { background: color-mix(in srgb, var(--adx-primary) 86%, var(--adx-surface)); }
.btn.lime { background: var(--adx-brand); color: var(--adx-on-brand); border-color: var(--adx-brand); }
.btn.lime:hover { background: color-mix(in srgb, var(--adx-brand) 88%, var(--adx-text)); }
.btn.danger { color: var(--adx-danger); border-color: color-mix(in srgb, var(--adx-danger) 45%, var(--adx-border)); }
.btn.danger:hover { background: var(--adx-danger-bg); }
.btn.danger.conferma { background: var(--adx-danger); color: var(--adx-surface); border-color: var(--adx-danger); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--adx-border); background: var(--adx-surface); color: var(--adx-text-body);
  font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip:hover { border-color: var(--adx-border-strong); }
.chip[aria-pressed="true"] { background: var(--adx-text); color: var(--adx-surface); border-color: var(--adx-text); }
.chip .n { font-variant-numeric: tabular-nums; opacity: .7; font-weight: 500; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 16px; }
.toolbar .lab { font-size: 12px; font-weight: 700; color: var(--adx-text-muted); text-transform: uppercase; letter-spacing: .05em; }
.field {
  min-height: 40px; padding: 0 12px; border-radius: var(--r-control); border: 1.5px solid var(--adx-border);
  background: var(--adx-surface); color: var(--adx-text);
}
.field:focus { border-color: var(--adx-border-strong); outline: none; }
textarea.field { padding: 10px 12px; min-height: 92px; width: 100%; resize: vertical; line-height: 1.45; }
.vuoto {
  padding: 40px 20px; text-align: center; color: var(--adx-text-muted); border: 1.5px dashed var(--adx-border);
  border-radius: var(--r-card); background: color-mix(in srgb, var(--adx-surface) 50%, transparent);
}
.vuoto strong { display: block; color: var(--adx-text); font-family: var(--font-display); font-size: 17px; margin-bottom: 4px; }

/* ── Oggi ── */
.kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.kpi .card { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; }
.kpi .v { font-family: var(--font-display); font-weight: 800; font-size: 34px; color: var(--adx-text); letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 17px; color: var(--adx-text-muted); font-weight: 600; letter-spacing: 0; }
.kpi .l { font-size: 13px; font-weight: 600; color: var(--adx-text-muted); }
.kpi a.card:hover { border-color: var(--adx-border-strong); }
.kpi .card.accent { background: var(--adx-brand); border-color: var(--adx-brand); }
.kpi .card.accent .v, .kpi .card.accent .l { color: var(--adx-on-brand); }
.kpi .card.alert .v { color: var(--adx-danger); }

.oggi { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.sez-t { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.agenti { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.agente { padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 10px; min-height: 168px; position: relative; overflow: hidden; }
.agente.attivo { border-color: color-mix(in srgb, var(--adx-info) 40%, var(--adx-border)); }
.agente.attivo::after {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--adx-info), transparent); background-size: 50% 100%; background-repeat: no-repeat;
  animation: scorri 1.8s linear infinite;
}
@keyframes scorri { from { background-position: -100% 0; } to { background-position: 200% 0; } }
@media (prefers-reduced-motion: reduce) { .agente.attivo::after { animation: none; background: var(--adx-info); } }
.agente.errore { border-color: color-mix(in srgb, var(--adx-danger) 45%, var(--adx-border)); }
.agente .riga { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.agente .cosa { color: var(--adx-text); font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.agente .det { font-size: 13px; color: var(--adx-text-muted); line-height: 1.4; }
.agente .err { font-size: 13px; color: var(--adx-danger); line-height: 1.4; }
.agente .piede { margin-top: auto; display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--adx-text-muted); border-top: 1px solid var(--adx-border); padding-top: 9px; }
.agente .ruolo { display: flex; align-items: center; gap: 9px; }
.av {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto;
  background: var(--adx-surface-2); color: var(--adx-text); font-family: var(--font-display); font-weight: 800; font-size: 13px;
  border: 1px solid var(--adx-border);
}
.agente.attivo .av { background: var(--adx-text); color: var(--adx-brand); border-color: var(--adx-text); }
:root[data-theme="dark"] .agente.attivo .av { color: var(--adx-on-primary); }

.feed { padding: 6px 0; max-height: calc(100vh - 140px); overflow: auto; }
.feed ol { list-style: none; margin: 0; padding: 0; }
.ev { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; padding: 10px 18px; border-top: 1px solid var(--adx-border); }
.ev:first-child { border-top: 0; }
.ev time { font-size: 12.5px; color: var(--adx-text-muted); font-variant-numeric: tabular-nums; padding-top: 1px; }
.ev .t { font-size: 13.5px; color: var(--adx-text-body); line-height: 1.42; }
.ev .chi { display: flex; gap: 6px; align-items: center; margin-bottom: 2px; font-size: 12px; font-weight: 700; color: var(--adx-text); }
.ev .chi .k { color: var(--adx-text-muted); font-weight: 600; }
.ev.nuovo { animation: nuovo 2.4s ease-out; }
@keyframes nuovo { from { background: color-mix(in srgb, var(--adx-brand) 35%, transparent); } to { background: transparent; } }
.ev.errore .t { color: var(--adx-danger); }

/* ── Approvazioni ── */
.appr { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 0; overflow: hidden; margin-bottom: 16px; }
.appr .anteprima { background: var(--adx-surface-2); border-inline-end: 1px solid var(--adx-border); padding: 18px; display: flex; align-items: center; justify-content: center; }
.appr .corpo { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.intest { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13.5px; font-weight: 600; color: var(--adx-text); }
.intest .sep { color: var(--adx-border-strong); }
.testo {
  white-space: pre-wrap; font-size: 15px; line-height: 1.55; color: var(--adx-text); margin: 0;
  padding: 14px 16px; background: var(--adx-surface-2); border-radius: var(--r-sub); max-height: 360px; overflow: auto;
}
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--adx-text-muted); }
.azioni { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.azioni .spazio { flex: 1; }
.modifica { display: flex; flex-direction: column; gap: 8px; }
.modifica .riga { display: flex; gap: 8px; justify-content: flex-end; }
.esito { padding: 12px 14px; border-radius: var(--r-sub); font-weight: 600; font-size: 14px; }
.esito.ok { background: var(--adx-ok-bg); color: var(--adx-ok); }
.esito.warn { background: var(--adx-warn-bg); color: var(--adx-warn); }
.esito.danger { background: var(--adx-danger-bg); color: var(--adx-danger); }
.appr.decisa { grid-template-columns: 120px minmax(0, 1fr); }
.appr.decisa .anteprima { padding: 10px; }
.appr.decisa .testo { max-height: 120px; font-size: 14px; }
.istr { font-size: 14px; color: var(--adx-text); padding: 10px 12px; border-inline-start: 3px solid var(--adx-warn-strong); background: var(--adx-warn-bg); border-radius: 4px 10px 10px 4px; }

/* Anteprime media */
.media { width: 100%; max-width: 380px; }
.media img, .media video { display: block; width: 100%; height: auto; max-height: 560px; object-fit: contain; border-radius: 10px; background: #000; }
.media img { background: transparent; }
.giostra { position: relative; }
.giostra .binario { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; scrollbar-width: none; border-radius: 10px; }
.giostra .binario::-webkit-scrollbar { display: none; }
.giostra .binario > * { flex: 0 0 100%; scroll-snap-align: center; }
.giostra .freccia {
  position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 10px; border: 0;
  background: color-mix(in srgb, var(--adx-surface) 92%, transparent); color: var(--adx-text); box-shadow: var(--adx-shadow-overlay);
  display: grid; place-items: center; cursor: pointer;
}
.giostra .freccia.sx { left: 8px; } .giostra .freccia.dx { right: 8px; }
.giostra .freccia[disabled] { opacity: 0; pointer-events: none; }
.giostra .indice { display: flex; justify-content: center; gap: 5px; margin-top: 10px; }
.giostra .indice i { width: 16px; height: 4px; border-radius: 2px; background: var(--adx-border); transition: background-color .2s, width .2s; }
.giostra .indice i.on { background: var(--adx-text); width: 24px; }
.giostra .conta { position: absolute; top: 8px; right: 8px; background: rgb(17 20 27 / .72); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.solo-testo {
  width: 100%; max-width: 380px; aspect-ratio: 4 / 3; border-radius: 10px; background: var(--adx-surface); border: 1px solid var(--adx-border);
  display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 22px; color: var(--adx-text-muted); font-size: 13px;
}
.solo-testo strong { font-family: var(--font-display); color: var(--adx-text); font-size: 20px; line-height: 1.2; letter-spacing: -0.02em; }

/* ── Calendario ── */
.sett { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
.giorno { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.giorno .lista { display: flex; flex-direction: column; gap: 8px; }
.giorno .gt { width: 100%; }
.ico { width: 20px; height: 20px; flex: 0 0 auto; }
.btn .ico { width: 18px; height: 18px; }
.giorno .gt {
  display: flex; align-items: baseline; gap: 6px; padding: 8px 10px; border-radius: 10px; font-weight: 700; color: var(--adx-text);
  background: var(--adx-surface); border: 1px solid var(--adx-border); position: sticky; top: 0; z-index: 1;
}
.giorno .gt .d { font-family: var(--font-display); font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.giorno .gt .w { font-size: 12.5px; color: var(--adx-text-muted); text-transform: capitalize; }
.giorno .gt .c { margin-inline-start: auto; font-size: 12px; color: var(--adx-text-muted); font-weight: 600; }
.giorno.oggi .gt { background: var(--adx-text); color: var(--adx-surface); border-color: var(--adx-text); }
.giorno.oggi .gt .w, .giorno.oggi .gt .c { color: color-mix(in srgb, var(--adx-surface) 72%, var(--adx-text)); }
.giorno.passato { opacity: .82; }
.giorno .nessuno { font-size: 12.5px; color: var(--adx-text-muted); padding: 10px; text-align: center; border: 1px dashed var(--adx-border); border-radius: 10px; }
.pezzo { display: block; width: 100%; text-align: start; padding: 0; overflow: hidden; cursor: pointer; border-radius: 12px; }
.pezzo:hover { border-color: var(--adx-border-strong); }
.pezzo .th { position: relative; aspect-ratio: 4 / 5; background: var(--adx-surface-2); overflow: hidden; }
.pezzo .th img, .pezzo .th video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pezzo .th .fmt { position: absolute; left: 6px; top: 6px; background: rgb(17 20 27 / .72); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.pezzo .th.txt { aspect-ratio: auto; padding: 10px 10px 4px; background: none; font-size: 12.5px; line-height: 1.4; color: var(--adx-text-body); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.pezzo .info { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
.pezzo .r1 { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--adx-text); }
.pezzo .r1 .can { display: inline-flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pezzo .pill { height: 21px; font-size: 11.5px; padding: 0 8px; align-self: flex-start; }
.sett-nav { display: flex; align-items: center; gap: 8px; }
.sett-nav .titolo { font-family: var(--font-display); font-weight: 700; color: var(--adx-text); font-size: 16px; min-width: 150px; text-align: center; }
.leg { display: flex; flex-wrap: wrap; gap: 6px; }

/* Finestra dettaglio */
dialog.fin {
  border: 0; padding: 0; border-radius: 18px; background: var(--adx-surface); color: inherit; box-shadow: var(--adx-shadow-overlay);
  width: min(920px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
}
dialog.fin::backdrop { background: var(--adx-scrim); }
dialog.fin .appr { margin: 0; border: 0; border-radius: 0; }
dialog.fin .chiudi { position: absolute; right: 12px; top: 12px; z-index: 2; }

/* ── Distribuzione ── */
.tab { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.tab th { text-align: start; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--adx-text-muted); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--adx-border); white-space: nowrap; }
.tab td { padding: 13px 16px; border-bottom: 1px solid var(--adx-border); vertical-align: top; }
.tab tr:last-child td { border-bottom: 0; }
.tab .nome { font-weight: 700; color: var(--adx-text); }
.tab .url { font-size: 12.5px; color: var(--adx-text-muted); text-decoration: none; }
.tab .url:hover { text-decoration: underline; }
.tab .passo { color: var(--adx-text); }
.tab .nota { font-size: 12.5px; color: var(--adx-text-muted); margin-top: 3px; }
.barra { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; margin: 4px 0 14px; background: var(--adx-surface); }
.barra i { display: block; height: 100%; }
.barra i.ok { background: var(--adx-ok-dot); } .barra i.info { background: var(--adx-info); }
.barra i.warn { background: var(--adx-warn-strong); } .barra i.danger { background: var(--adx-danger); } .barra i.neutro { background: var(--adx-border-strong); }

/* ── Numeri ── */
.grafici { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.grafico { padding: 16px 18px 12px; position: relative; }
.grafico .gtit { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.grafico .gval { font-family: var(--font-display); font-weight: 800; font-size: 26px; color: var(--adx-text); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 4px; }
.grafico .delta { font-size: 13px; font-weight: 700; }
.grafico .delta.su { color: var(--adx-ok); } .grafico .delta.giu { color: var(--adx-danger); }
.grafico svg { display: block; width: 100%; height: 170px; margin-top: 8px; overflow: visible; }
.grafico svg .griglia { stroke: var(--adx-border); stroke-width: 1; }
.grafico svg .asse { fill: var(--adx-text-muted); font-size: 11px; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.grafico svg .linea { fill: none; stroke: var(--adx-chart-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grafico svg .area { fill: var(--adx-brand); opacity: .35; }
:root[data-theme="dark"] .grafico svg .area { opacity: .16; }
.grafico svg .bar { fill: var(--adx-chart-1); }
.grafico svg .bar.ultimo { fill: var(--adx-chart-2); }
.grafico svg .cursore { stroke: var(--adx-border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.grafico svg .punto-h { fill: var(--adx-surface); stroke: var(--adx-chart-1); stroke-width: 2; }
.tip {
  position: absolute; pointer-events: none; background: var(--adx-tooltip-bg); color: var(--adx-tooltip-text);
  font-size: 12.5px; padding: 6px 9px; border-radius: 8px; white-space: nowrap; transform: translate(-50%, -100%); z-index: 3;
  font-variant-numeric: tabular-nums; box-shadow: var(--adx-shadow-overlay);
}
.tip b { font-weight: 700; }
.grafico details { margin-top: 6px; font-size: 13px; }
.grafico details summary { cursor: pointer; color: var(--adx-text-muted); font-weight: 600; }
.grafico details table { width: 100%; margin-top: 6px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.grafico details td { padding: 3px 0; border-bottom: 1px solid var(--adx-border); }
.grafico details td:last-child { text-align: end; }

/* ── Registro ── */
.reg { list-style: none; margin: 0; padding: 0; }
.reg li { display: grid; grid-template-columns: 48px 116px 116px minmax(0, 1fr); gap: 14px; align-items: baseline; padding: 11px 18px; border-top: 1px solid var(--adx-border); font-size: 14px; }
.reg li:first-child { border-top: 0; }
.reg time { font-size: 13px; color: var(--adx-text-muted); font-variant-numeric: tabular-nums; }
.reg .ru { font-weight: 700; color: var(--adx-text); font-size: 13.5px; }
.reg .tx { color: var(--adx-text-body); }
.reg .gg { padding: 14px 18px 8px; font-family: var(--font-display); font-weight: 700; color: var(--adx-text); font-size: 15px; background: var(--adx-surface-2); display: block; border-top: 1px solid var(--adx-border); }
.reg .gg:first-child { border-top: 0; border-radius: 16px 16px 0 0; }
.altro { display: flex; justify-content: center; padding: 16px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--adx-tooltip-bg); color: var(--adx-tooltip-text);
  padding: 11px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--adx-shadow-overlay); z-index: 50;
  animation: entra .25s cubic-bezier(.2, .8, .2, 1);
}
@keyframes entra { from { opacity: 0; transform: translate(-50%, 8px); } }
.carica { color: var(--adx-text-muted); padding: 30px 0; }

/* ── Telefono e tablet ── */
@media (max-width: 1180px) {
  .oggi { grid-template-columns: minmax(0, 1fr); }
  .feed { max-height: none; }
  .sett { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .top {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: color-mix(in srgb, var(--adx-surface) 94%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--adx-border);
  }
  .top .wordmark { font-size: 23px; }
  .top .seg { margin-inline-start: auto; }
  .top .seg button { padding: 5px 10px; min-height: 32px; font-size: 12.5px; }
  .top .tema { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--adx-border); background: var(--adx-surface); display: grid; place-items: center; cursor: pointer; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(6, 1fr);
    background: color-mix(in srgb, var(--adx-surface) 96%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--adx-border);
    padding: 6px 4px max(6px, env(safe-area-inset-bottom));
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 0; text-decoration: none; color: var(--adx-text-muted); font-size: 10.5px; font-weight: 700; position: relative; border-radius: 10px; }
  .tabbar a .ico { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"] { color: var(--adx-text); }
  .tabbar a[aria-current="page"] .ico { background: var(--adx-brand); color: var(--adx-on-brand); border-radius: 8px; padding: 2px; box-sizing: content-box; margin: -2px; }
  .tabbar .badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; background: var(--adx-text); color: var(--adx-surface); }
  .main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  h1 { font-size: 30px; }
  .kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .v { font-size: 28px; }
  .appr, .appr.decisa { grid-template-columns: minmax(0, 1fr); }
  .appr .anteprima { border-inline-end: 0; border-bottom: 1px solid var(--adx-border); padding: 12px; }
  .appr .corpo { padding: 16px; }
  .appr.decisa .anteprima { display: none; }
  .azioni .btn { flex: 1 1 auto; }
  .azioni .spazio { display: none; }
  .sett { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .giorno .lista { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .giorno.vuotoG .lista { display: block; }
  .giorno .gt { top: 59px; }
  .sett-nav .titolo { min-width: 0; flex: 1; font-size: 15px; }
  .tab thead { display: none; }
  .tab, .tab tbody, .tab tr, .tab td { display: block; }
  .tab tr { padding: 14px 16px; border-bottom: 1px solid var(--adx-border); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; }
  .tab tr:last-child { border-bottom: 0; }
  .tab td { padding: 0; border: 0; }
  .tab td.c-nome { grid-column: 1; }
  .tab td.c-stato { grid-column: 2; grid-row: 1; }
  .tab td.c-cat { display: none; }
  .tab td.c-passo, .tab td.c-agg { grid-column: 1 / -1; }
  .tab td.c-agg { font-size: 12px; }
  .grafici { grid-template-columns: minmax(0, 1fr); }
  .reg li { grid-template-columns: 52px minmax(0, 1fr); gap: 4px 10px; padding: 11px 14px; }
  .reg li .ru { grid-column: 2; grid-row: 1; }
  .reg li .tp { display: none; }
  .reg li .tx { grid-column: 2; }
  .toolbar { gap: 10px; }
  .toolbar .field { flex: 1 1 140px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  dialog.fin { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; }
}
@media (min-width: 861px) { .tabbar { display: none; } }

/* ── Login ── */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: min(400px, 100%); padding: 32px 28px 28px; display: flex; flex-direction: column; gap: 18px; }
.login h1 { font-size: 30px; }
.login label { font-size: 13px; font-weight: 700; color: var(--adx-text); }
.login .field { width: 100%; min-height: 46px; font-size: 16px; }
.login .btn { width: 100%; min-height: 46px; }
.login .msg { font-size: 14px; font-weight: 600; padding: 10px 12px; border-radius: 10px; background: var(--adx-danger-bg); color: var(--adx-danger); }
.login .msg:empty { display: none; }
.login .campo { display: flex; flex-direction: column; gap: 8px; }
[hidden] { display: none !important; }
a.chip { text-decoration: none; }
@media (min-width: 861px) {
  .app { background: linear-gradient(to right, var(--adx-surface) calc(var(--side) - 1px), var(--adx-border) calc(var(--side) - 1px), var(--adx-border) var(--side), transparent var(--side)); }
}
.wordmark { display: inline-flex; align-items: baseline; white-space: nowrap; letter-spacing: -0.03em; }

.wordmark.wm-ka { display: none; }
[data-brand="knockads"] .wordmark.wm-adify { display: none; }
[data-brand="knockads"] .wordmark.wm-ka { display: inline-flex; }
.app { overflow-x: clip; }
@media (max-width: 860px) {
  .top { gap: 8px; }
  .top .logo { padding: 0; }
  .top .wordmark.wm-ka { font-size: 19px; }
}
@media (max-width: 860px) {
  .agente { min-height: 0; }
  .toolbar .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; max-width: calc(100% + 32px); }
  .toolbar .chips::-webkit-scrollbar { display: none; }
  .toolbar .leg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; max-width: calc(100% + 32px); }
  .toolbar .lab { width: 100%; margin-bottom: -4px; }
  .demo { font-size: 12.5px; padding: 7px 12px; }
}
@media (max-width: 860px) {
  .appr .anteprima:has(.solo-testo) { display: none; }
}
