/* Alessia — design system
   Colori del brand EDA: blu #1F3A8F, teal #2ABFB0, fucsia #D6215E, azzurro #5BC8D8, grigio #B0B0B0.
   Regole: il testo usa solo inchiostri ad alto contrasto; teal e azzurro solo come superfici e indicatori
   (sul bianco non hanno contrasto sufficiente per il testo); il fucsia segnala i lead caldi. */

:root {
  --brand: #1F3A8F;
  --brand-600: #1A3279;
  --brand-700: #152962;
  --brand-50: #EEF2FB;
  --brand-100: #DCE4F7;
  --teal: #2ABFB0;
  --teal-ink: #0B7268;
  --teal-50: #E4F6F4;
  --fuchsia: #D6215E;
  --fuchsia-ink: #B0184C;
  --fuchsia-50: #FCEBF1;
  --sky: #5BC8D8;
  --chart: #3B5CC4;          /* blu del brand schiarito per i grafici (validato) */

  --ink: #101A33;            /* testo principale */
  --ink-2: #47536B;          /* testo secondario */
  --ink-3: #6B7690;          /* testo attenuato (solo dimensioni ≥ 13px) */
  --line: #E3E8F1;
  --line-2: #D3DBE8;
  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --surface-2: #F8FAFD;

  --good-ink: #0B7268;  --good-bg: #E4F6F4;
  --warn-ink: #8A5300;  --warn-bg: #FFF3DB;
  --crit-ink: #B3261E;  --crit-bg: #FDECEA;
  --info-ink: #1F3A8F;  --info-bg: #EEF2FB;
  --hot-ink: #B0184C;   --hot-bg: #FCEBF1;
  --neutral-ink: #47536B; --neutral-bg: #EEF1F6;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 26, 51, .04), 0 1px 3px rgba(16, 26, 51, .04);
  --shadow-lg: 0 12px 32px rgba(16, 26, 51, .10);
  --focus: 0 0 0 3px rgba(42, 191, 176, .45);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.015em; line-height: 1.25; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.small { font-size: 13.5px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

/* ------------------------------------------------------------------ layout */
.app { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--brand); color: #fff; padding: 22px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 0; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; background: #fff; color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 19px; position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--teal); border: 2.5px solid var(--brand);
}
.brand-name { font-weight: 750; font-size: 19px; letter-spacing: -0.02em; line-height: 1.1; }
.brand-sub { font-size: 12.5px; color: rgba(255, 255, 255, .78); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 12px; font-weight: 600; color: rgba(255, 255, 255, .62); padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: rgba(255, 255, 255, .90); font-weight: 520; font-size: 14.5px; position: relative;
}
.nav a:hover { background: rgba(255, 255, 255, .08); text-decoration: none; color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .14); color: #fff; font-weight: 620; }
.nav a.active::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0;
  background: var(--teal);
}
.nav svg { width: 19px; height: 19px; flex: none; opacity: .95; }
.nav .count {
  margin-left: auto; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 11px; display: grid;
  place-items: center; font-size: 12px; font-weight: 700; background: #fff; color: var(--brand);
}
.nav .count.hot { background: var(--fuchsia); color: #fff; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.agent-card {
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); border-radius: 12px;
  padding: 12px 14px; font-size: 13.5px; color: rgba(255, 255, 255, .92);
}
.agent-card strong { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 14px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 0 rgba(42,191,176,.6); animation: pulse 2s infinite; }
.pulse.off { background: #F2B84B; animation: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(42,191,176,.55); } 70% { box-shadow: 0 0 0 8px rgba(42,191,176,0); } 100% { box-shadow: 0 0 0 0 rgba(42,191,176,0); } }
.logout { color: rgba(255, 255, 255, .78); font-size: 13.5px; padding: 4px 12px; display: flex; gap: 8px; align-items: center; }
.logout:hover { color: #fff; }
.logout svg { width: 16px; height: 16px; }

.main { min-width: 0; padding: 30px 40px 60px; max-width: 1440px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head p { color: var(--ink-2); margin-top: 6px; font-size: 15px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 18px; }
.mt-sm { margin-top: 10px; }

/* ------------------------------------------------------------------ superfici */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.card-head .sub { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; }
.card-body { padding: 18px 22px 22px; }
.card-foot { border-top: 1px solid var(--line); padding: 12px 22px; font-size: 14px; }
.card.flat { box-shadow: none; }

/* KPI */
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi-label { color: var(--ink-2); font-size: 13.5px; font-weight: 560; display: flex; align-items: center; gap: 8px; }
.kpi-label svg { width: 16px; height: 16px; color: var(--ink-3); }
.kpi-value { font-size: 32px; font-weight: 720; letter-spacing: -0.025em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 17px; color: var(--ink-3); font-weight: 600; letter-spacing: 0; }
.kpi-note { font-size: 13.5px; color: var(--ink-2); }
.kpi.hot { background: linear-gradient(180deg, var(--fuchsia-50), #fff 70%); border-color: #F5CFDC; }
.meter { height: 8px; border-radius: 4px; background: var(--neutral-bg); overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; border-radius: 4px; background: var(--brand); }
.meter.teal > span { background: var(--teal); }

/* Badge e stati */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 25px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 640; white-space: nowrap; line-height: 1;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.tone-good { color: var(--good-ink); background: var(--good-bg); }
.tone-warning { color: var(--warn-ink); background: var(--warn-bg); }
.tone-critical { color: var(--crit-ink); background: var(--crit-bg); }
.tone-info { color: var(--info-ink); background: var(--info-bg); }
.tone-hot { color: var(--hot-ink); background: var(--hot-bg); }
.tone-neutral { color: var(--neutral-ink); background: var(--neutral-bg); }
.status-line { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.status-line svg { width: 18px; height: 18px; }

.pill-status {
  display: inline-flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--line); font-size: 14px; font-weight: 560; box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ bottoni e form */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 16px;
  border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-size: 14.5px; font-weight: 620;
  cursor: pointer; background: var(--brand); color: #fff; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--brand-600); text-decoration: none; }
.btn svg { width: 17px; height: 17px; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-secondary:hover { background: var(--surface-2); border-color: #BFC9DA; }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-50); }
.btn-danger { background: var(--surface); color: var(--crit-ink); border-color: #F2C9C5; }
.btn-danger:hover { background: var(--crit-bg); }
.btn-sm { height: 34px; padding: 0 12px; font-size: 13.5px; border-radius: 9px; }
.btn-block { width: 100%; }
form.inline { display: inline; }

label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.hint { font-size: 13px; color: var(--ink-2); margin-top: 6px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=search],
select, textarea {
  width: 100%; height: 44px; padding: 0 13px; border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: var(--surface); font: inherit; font-size: 15px; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 120px; padding: 12px 13px; line-height: 1.6; resize: vertical; }
textarea.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 58, 143, .14); }
input::placeholder, textarea::placeholder { color: #8A94AA; }
input[type=file] { font: inherit; font-size: 14px; }
.field { margin-bottom: 16px; }
.fields { display: grid; gap: 14px 16px; }
.fields-2 { grid-template-columns: 1fr 1fr; }
.fields-3 { grid-template-columns: repeat(3, 1fr); }
.checkbox { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; font-size: 14.5px; }
.checkbox input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--brand); }

/* Toolbar filtri */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.toolbar .search svg { position: absolute; left: 13px; top: 13px; width: 18px; height: 18px; color: var(--ink-3); }
.toolbar .search input { padding-left: 40px; }
.toolbar select { width: auto; min-width: 150px; }
.tabs { display: inline-flex; background: var(--neutral-bg); padding: 4px; border-radius: 12px; gap: 2px; }
.tabs a { padding: 7px 14px; border-radius: 9px; color: var(--ink-2); font-weight: 580; font-size: 14px; display: flex; gap: 8px; align-items: center; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.tabs .n { font-size: 12px; color: var(--ink-3); font-weight: 700; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ tabelle */
.table-wrap { overflow-x: auto; position: relative; }
table.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th {
  text-align: left; font-size: 12.5px; font-weight: 650; color: var(--ink-2); padding: 12px 16px;
  border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap;
}
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #FAFBFE; }
.table .right { text-align: right; }
.table .strong { font-weight: 620; }
.cell-main { font-weight: 620; color: var(--ink); }
.cell-sub { font-size: 13.5px; color: var(--ink-2); }
.score { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-weight: 620; }
.score-bar { width: 46px; height: 6px; border-radius: 3px; background: var(--neutral-bg); overflow: hidden; }
.score-bar span { display: block; height: 100%; background: var(--brand); border-radius: 3px; }

/* Liste */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; gap: 14px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; padding-bottom: 0; }
.list-item:first-child { padding-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: var(--brand-50); color: var(--brand); font-weight: 700;
  font-size: 13.5px; display: grid; place-items: center; flex: none; letter-spacing: .02em;
}
.avatar svg { width: 18px; height: 18px; }
.avatar.hot { background: var(--fuchsia-50); color: var(--fuchsia-ink); }
.avatar.lg { width: 52px; height: 52px; font-size: 17px; }

.empty { text-align: center; padding: 34px 20px; color: var(--ink-2); }
.empty svg { width: 34px; height: 34px; color: var(--ink-3); margin-bottom: 10px; }
.empty strong { display: block; color: var(--ink); font-size: 15.5px; margin-bottom: 4px; }

/* ------------------------------------------------------------------ grafico */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: #EDF0F6; stroke-width: 1; }
.chart .axis-text { fill: var(--ink-2); font-size: 12px; font-family: var(--font); }
.chart .bar { fill: var(--chart); transition: opacity .12s; }
.chart .bar.today { fill: var(--brand); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart g.col:hover .bar { opacity: .82; }
.chart .dot { fill: var(--surface); stroke: var(--fuchsia); stroke-width: 2; }
.tooltip {
  position: absolute; pointer-events: none; background: var(--ink); color: #fff; padding: 9px 12px; border-radius: 10px;
  font-size: 13px; line-height: 1.45; box-shadow: var(--shadow-lg); white-space: nowrap; transform: translate(-50%, -100%);
  opacity: 0; transition: opacity .1s; z-index: 5;
}
.tooltip.on { opacity: 1; }
.tooltip b { font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 18px; font-size: 13.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; background: var(--chart); display: inline-block; }
.legend i.dot { border-radius: 50%; background: #fff; border: 2px solid var(--fuchsia); }

/* Funnel */
.funnel { display: flex; flex-direction: column; gap: 12px; }
.funnel-row { display: grid; grid-template-columns: 150px 1fr 64px 78px; gap: 12px; align-items: center; font-size: 14px; }
.funnel-row .track { height: 26px; border-radius: 6px; background: var(--surface-2); position: relative; }
.funnel-row .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: var(--chart); min-width: 3px; }
.funnel-row .v { text-align: right; font-weight: 680; font-variant-numeric: tabular-nums; }
.funnel-row .r { text-align: right; color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ conversazione */
.thread { display: flex; flex-direction: column; gap: 16px; }
.msg { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); max-width: 86%; }
.msg.out { align-self: flex-end; background: var(--surface-2); }
.msg.in { align-self: flex-start; border-color: var(--brand-100); box-shadow: var(--shadow); }
.msg-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.msg-head .who { font-weight: 640; font-size: 14px; }
.msg-head .when { font-size: 13px; color: var(--ink-2); }
.msg-subject { padding: 12px 16px 0; font-weight: 640; font-size: 14.5px; }
.msg-body { padding: 10px 16px 16px; white-space: pre-wrap; font-size: 14.5px; line-height: 1.65; color: var(--ink); overflow-wrap: anywhere; }
.msg-ai { margin: 0 16px 14px; padding: 10px 12px; border-radius: 10px; background: var(--brand-50); font-size: 13.5px; color: var(--brand-700); display: flex; gap: 8px; align-items: flex-start; }
.msg-ai svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

.draft { border: 1.5px solid var(--teal); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.draft-head { background: var(--teal-50); padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.draft-head strong { color: var(--teal-ink); display: flex; align-items: center; gap: 8px; font-size: 14px; }
.draft-head svg { width: 17px; height: 17px; }
.draft-body { padding: 16px 18px 18px; }
.draft-body textarea { min-height: 190px; }
.quote { border-left: 3px solid var(--brand-100); padding: 4px 0 4px 14px; color: var(--ink-2); font-size: 14px; white-space: pre-wrap; margin-bottom: 14px; max-height: 160px; overflow: auto; }

.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 540; overflow-wrap: anywhere; }

/* Sequenza */
.steps { display: flex; flex-direction: column; gap: 0; }
.step { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; position: relative; }
.step + .step { border-top: 1px dashed var(--line-2); }
.step-n { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 14px; }
.step-delay { font-size: 13px; color: var(--ink-2); }

/* Anteprima email */
.preview { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.preview-bar { background: var(--surface-2); padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; display: grid; gap: 4px; }
.preview-bar b { color: var(--ink); font-weight: 620; }
.preview-body { padding: 18px 18px 20px; white-space: pre-wrap; font-size: 14.5px; line-height: 1.65; overflow-wrap: anywhere; }
.preview-sign { color: var(--ink-2); border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: 500 13px/1 ui-monospace, Menlo, monospace; padding: 7px 9px; border-radius: 7px; background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100); cursor: pointer; }
.chip:hover { background: var(--brand-100); }

/* Avvisi */
.flash { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 12px; margin-bottom: 20px; font-weight: 560; font-size: 14.5px; }
.flash svg { width: 18px; height: 18px; flex: none; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; font-size: 14px; line-height: 1.55; }
.callout svg { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.callout strong { display: block; margin-bottom: 2px; }

/* Health */
.health-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.health-row:last-child { border-bottom: none; padding-bottom: 0; }
.health-row .v { font-weight: 650; font-variant-numeric: tabular-nums; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 12px 1fr auto; gap: 12px; padding: 9px 0; font-size: 14px; align-items: baseline; }
.timeline li i { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); display: inline-block; transform: translateY(-1px); }
.timeline li.warning i { background: #E0A100; }
.timeline li.error i { background: var(--crit-ink); }
.timeline .t { color: var(--ink-2); font-size: 13px; white-space: nowrap; }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 500px at 10% -10%, rgba(42,191,176,.16), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, rgba(91,200,216,.16), transparent 60%), var(--brand); }
.auth-card { width: 100%; max-width: 410px; background: #fff; border-radius: 20px; padding: 36px 34px; box-shadow: 0 30px 80px rgba(8, 18, 50, .35); }
.auth-card .brand { color: var(--ink); padding: 0; margin-bottom: 26px; }
.auth-card .brand-mark { background: var(--brand); color: #fff; }
.auth-card .brand-mark::after { border-color: #fff; }
.auth-card .brand-sub { color: var(--ink-2); }

.pagination { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 14px 16px; border-top: 1px solid var(--line); font-size: 14px; }

details.more summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 14px; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; height: auto; flex-direction: row; align-items: center; padding: 10px 14px; gap: 14px; z-index: 20; overflow-x: auto; }
  .brand-sub, .nav-label, .sidebar-foot, .nav a span.label-text { display: none; }
  .nav { flex-direction: row; gap: 4px; }
  .nav a { padding: 9px 11px; }
  .nav a.active::before { display: none; }
  .main { padding: 22px 16px 48px; }
  .grid-3, .grid-2, .fields-2, .fields-3 { grid-template-columns: 1fr; }
  .funnel-row { grid-template-columns: 110px 1fr 52px; }
  .funnel-row .r { display: none; }
  .msg { max-width: 100%; }
  h1 { font-size: 23px; }
}
@media (max-width: 560px) { .grid-4 { grid-template-columns: 1fr 1fr; } .kpi-value { font-size: 27px; } }
details.more summary.btn { color: #fff; font-size: 14.5px; }
details.more summary.btn-secondary { color: var(--ink); }
details.more[open] summary.btn-secondary { background: var(--surface-2); }
[hidden] { display: none !important; }
.msg { width: 86%; }
@media (max-width: 900px) { .msg { width: 100%; } }
.app > *, .grid > * { min-width: 0; }
.draft .badge { white-space: normal; height: auto; min-height: 25px; padding: 5px 10px; line-height: 1.3; }
@media (max-width: 480px) { .grid-4 { grid-template-columns: 1fr; } .page-head .actions { width: 100%; } }
@media (max-width: 900px) {
  .app { overflow-x: clip; }
  .brand > span:last-child { display: none; }
  .nav a { padding: 8px 9px; gap: 6px; }
  .nav .count { min-width: 20px; height: 19px; font-size: 11px; padding: 0 5px; }
}
details.more summary svg { width: 16px; height: 16px; vertical-align: -3px; }
.tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; } .tabs a { white-space: nowrap; }

.place { display:inline-flex; align-items:center; gap:3px; margin-left:6px; padding:1px 8px 1px 6px; border-radius:999px;
  background:var(--teal-50, #e6f7f5); color:var(--teal-ink, #0f6f65); font-size:12.5px; font-weight:600; white-space:nowrap; vertical-align:1px; }
.place svg { width:13px; height:13px; }

/* Report invii */
.report-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; padding: 16px 20px; }
.report-filters .field { margin: 0; min-width: 150px; flex: 1 1 150px; }
.report-filters .btn { height: 44px; }
.chart .bar-sent { fill: #CDD7F2; }
.chart .bar-open { fill: var(--chart); }
.chart .bar-click { fill: var(--fuchsia); }
.chart g.col:hover path { opacity: .85; }
.legend i.sw-sent { background: #CDD7F2; }
.legend i.sw-open { background: var(--chart); }
.legend i.sw-click { background: var(--fuchsia); }
.report-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 22px 14px; }
.report-tabs a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); font-size: 14px; font-weight: 560; }
.report-tabs a:hover { background: var(--brand-50); text-decoration: none; }
.report-tabs a.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.table tfoot td { border-top: 2px solid var(--line-2); background: #F8FAFD; }
@media (max-width: 760px) { .legend { flex-wrap: wrap; gap: 10px; } }
.report-filters input[type=date] { height: 44px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); font: inherit; width: 100%; }