/* Admin Analytics BILANORA – si appoggia alle variabili di tester-admin.css */

.an-main { padding-top: 38px; }
.an-dashboard { display: grid; gap: 18px; }
.an-head { margin-bottom: 4px; }

.an-gate { display: grid; place-items: center; min-height: calc(100vh - 260px); }
.an-gate-card { width: min(460px, 100%); text-align: left; }
.an-gate-card .admin-button { margin-top: 10px; }

/* ---------- Toolbar ---------- */
.an-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 18px;
  padding: 16px 18px;
  border: 1px solid var(--admin-line);
  border-radius: 22px;
  background: rgba(255,253,249,.96);
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 40px rgba(46,46,46,.06);
}
/* Sulle schermate larghe la toolbar resta visibile durante lo scroll. */
@media (min-width: 1200px) {
  .an-toolbar { position: sticky; top: 74px; z-index: 20; }
}
.an-page-picker,
.an-filter-group,
.an-inline-select { display: grid; gap: 6px; }
.an-page-picker > span,
.an-filter-group > span,
.an-inline-select > span {
  color: var(--admin-gold-deep);
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.an-page-picker { flex: 1 1 280px; min-width: 0; }
.an-page-picker select,
.an-inline-select select,
.an-custom-range input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(46,46,46,.14);
  border-radius: 12px;
  background: #fff;
  color: var(--admin-ink);
  font: inherit;
  font-weight: 800;
}
.an-page-picker select { font-size: 15px; }
.an-segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(46,46,46,.10);
  border-radius: 13px;
  background: #f3ede3;
}
.an-segmented button {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--admin-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.an-segmented button.is-active { background: var(--admin-ink); color: #fff; }
.an-segmented button:focus-visible,
.an-refresh:focus-visible { outline: 3px solid rgba(217,154,26,.45); outline-offset: 1px; }
.an-segmented-small button { min-height: 32px; font-size: 12px; }
.an-custom-range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; flex-basis: 100%; }
.an-custom-range label { display: grid; gap: 5px; font-size: 12px; font-weight: 800; color: var(--admin-soft); }
.an-custom-range input { width: auto; min-height: 42px; }
.an-refresh {
  width: 44px;
  height: 44px;
  margin-left: auto;
  border: 1px solid rgba(46,46,46,.12);
  border-radius: 12px;
  background: #fff;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
}
.an-is-loading .an-refresh { animation: an-spin 1s linear infinite; }
@keyframes an-spin { to { transform: rotate(360deg); } }

.an-range-caption { margin: -4px 4px 0; color: var(--admin-soft); font-size: 13px; }

.an-loading-bar { height: 3px; overflow: hidden; border-radius: 3px; background: rgba(217,154,26,.14); }
.an-loading-bar span { display: block; width: 30%; height: 100%; background: var(--admin-gold); animation: an-load 1.1s ease-in-out infinite; }
@keyframes an-load { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.an-is-loading .an-card,
.an-is-loading .an-kpis { opacity: .55; transition: opacity .2s ease; }

/* ---------- Avvisi ---------- */
.an-alert {
  display: grid;
  gap: 4px;
  padding: 14px 18px;
  border: 1px solid rgba(217,154,26,.40);
  border-left: 5px solid var(--admin-gold);
  border-radius: 16px;
  background: #fff8ea;
  color: var(--admin-ink);
  font-size: 14px;
  line-height: 1.5;
}
.an-alert span { color: var(--admin-soft); }
.an-alert-soft { border-color: rgba(46,46,46,.12); border-left-color: #9a9086; background: #faf7f1; }
.an-alert-error { border-color: rgba(183,77,58,.3); border-left-color: var(--admin-red); background: #fff0ed; color: #9c3b2c; font-weight: 800; }

/* ---------- Card ---------- */
.an-card {
  padding: 26px;
  border: 1px solid var(--admin-line);
  border-radius: 26px;
  background: var(--admin-card);
  box-shadow: 0 20px 60px rgba(46,46,46,.05);
}
.an-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.an-card-head h2 { margin: 6px 0 4px; font-size: 26px; letter-spacing: -.035em; }
.an-card-head p { margin: 4px 0 0; max-width: 680px; color: var(--admin-soft); font-size: 14px; line-height: 1.5; }
.an-note { font-size: 13px !important; font-style: italic; }
.an-subtitle { margin: 0 0 14px; color: var(--admin-ink); font-size: 14px; font-weight: 900; }
.an-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.an-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.an-mini-note { margin: 12px 0 0; color: #948a7f; font-size: 12px; line-height: 1.45; }

/* ---------- Lettura rapida ---------- */
.an-insights { background: linear-gradient(150deg, #171717 0%, #231c12 100%); border-color: #171717; color: #fff; }
.an-insights .admin-card-kicker { color: #efc35a; }
.an-insights h2 { color: #fff; }
.an-insight-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 22px; margin: 0; padding: 0; list-style: none; }
.an-insight { display: flex; gap: 10px; align-items: baseline; color: rgba(255,255,255,.86); font-size: 15px; line-height: 1.5; }
.an-insight i { flex: 0 0 auto; width: 18px; font-style: normal; font-size: 12px; text-align: center; }
.an-insight-up i { color: #7fd1a8; }
.an-insight-down i { color: #ff9f8c; }
.an-insight-flat i { color: #efc35a; }

/* ---------- KPI ---------- */
.an-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.an-kpi {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 140px;
  padding: 18px 18px 12px;
  border: 1px solid var(--admin-line);
  border-radius: 20px;
  background: #fffdf9;
}
.an-kpi.is-unavailable { background: #faf7f1; }
.an-kpi-label { color: var(--admin-soft); font-size: 12px; font-weight: 800; }
.an-kpi-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.an-kpi-value strong { font-size: 30px; line-height: 1; letter-spacing: -.04em; }
.an-kpi-sub { color: #958b80; font-size: 12px; }
.an-spark { width: 100%; height: 34px; margin-top: auto; }

.an-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.an-delta i { font-style: normal; font-size: 9px; }
.an-delta-up { background: #e6f4ec; color: #1d6f4d; }
.an-delta-down { background: #fdebe7; color: #a23f2d; }
.an-delta-flat { background: #f1ece4; color: #6f675f; }

/* ---------- Grafico andamento ---------- */
.an-chart { width: 100%; min-height: 220px; }
.an-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.an-grid-line { stroke: rgba(46,46,46,.08); stroke-width: 1; }
.an-axis-label { fill: #948a7f; font-size: 11px; font-weight: 600; }
.an-line-current { fill: none; stroke: #d99a1a; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.an-line-previous { fill: none; stroke: #9a9086; stroke-width: 2; stroke-dasharray: 5 5; stroke-linejoin: round; }
.an-point { fill: #fff; stroke: #d99a1a; stroke-width: 2; }
.an-point-active { fill: #d99a1a; stroke: #fff; stroke-width: 2; }
.an-crosshair { stroke: rgba(23,23,23,.35); stroke-width: 1; stroke-dasharray: 3 3; }

.an-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: -4px 0 12px; color: var(--admin-soft); font-size: 13px; font-weight: 700; }
.an-legend-item { display: inline-flex; align-items: center; gap: 7px; }
.an-legend-swatch { display: inline-block; width: 16px; height: 10px; border-radius: 3px; }
.an-legend-swatch.is-current { background: #d99a1a; }
.an-legend-swatch.is-previous { height: 0; border-top: 2px dashed #9a9086; border-radius: 0; }

/* ---------- Donut ---------- */
.an-donut { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.an-donut svg { flex: 0 0 auto; width: 168px; height: 168px; }
.an-donut-segment { cursor: pointer; transition: opacity .15s ease; }
.an-donut svg:hover .an-donut-segment { opacity: .55; }
.an-donut svg .an-donut-segment:hover { opacity: 1; }
.an-donut-total { fill: var(--admin-ink); font-size: 24px; font-weight: 900; letter-spacing: -.03em; }
.an-donut-caption { fill: #948a7f; font-size: 11px; font-weight: 700; }
.an-donut-legend { flex: 1 1 160px; display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.an-donut-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; align-items: center; gap: 9px; font-size: 13.5px; }
.an-donut-legend i { width: 12px; height: 12px; border-radius: 4px; }
.an-donut-legend .an-legend-label { overflow: hidden; color: var(--admin-ink); font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.an-donut-legend strong { font-size: 14px; }
.an-donut-legend small { min-width: 36px; color: #948a7f; text-align: right; }

/* ---------- Barre orizzontali ---------- */
.an-bars { display: grid; gap: 9px; }
.an-bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 38%) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 2px 4px;
  border-radius: 8px;
}
.an-bar-row:hover { background: #faf5ec; }
.an-bar-row.is-muted .an-bar-label { color: #948a7f; }
.an-bar-label { overflow: hidden; color: var(--admin-ink); font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.an-bar-track { position: relative; height: 14px; overflow: hidden; border-radius: 4px; background: #f1ebe2; }
.an-bar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.an-bar-value { display: inline-flex; align-items: baseline; gap: 6px; min-width: 66px; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.an-bar-value strong { font-size: 13.5px; }
.an-bar-value small { color: #948a7f; font-size: 12px; }

.an-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.an-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 9px; border: 1px solid var(--admin-line); border-radius: 999px; background: #fff; font-size: 12px; font-weight: 700; }
.an-chip > i { width: 8px; height: 8px; border-radius: 2px; }

.an-details { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--admin-line); }
.an-details summary { cursor: pointer; color: var(--admin-gold-deep); font-size: 13px; font-weight: 900; }
.an-details[open] summary { margin-bottom: 14px; }

/* ---------- Stati vuoti ---------- */
.an-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 96px;
  padding: 18px;
  border: 1px dashed rgba(46,46,46,.16);
  border-radius: 16px;
  background: #faf7f1;
  color: var(--admin-soft);
  font-size: 13.5px;
  font-weight: 800;
}
.an-empty-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #efe8dd; color: var(--admin-gold-deep); }
.an-empty-ga4 { border-color: rgba(217,154,26,.45); background: #fff8ea; }

/* ---------- Funnel ---------- */
.an-funnel-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.an-funnel-stage {
  position: relative;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 210px;
  align-items: center;
  gap: 14px;
  padding: 8px 10px;
  border-radius: 12px;
}
.an-funnel-stage:hover { background: #faf5ec; }
.an-funnel-stage.is-drop { background: #fdf1ee; box-shadow: inset 3px 0 0 #b74d3a; }
.an-funnel-stage.is-survey-drop { background: #fff6e6; box-shadow: inset 3px 0 0 #b97c0a; }
.an-funnel-stage.is-survey-drop .an-funnel-drop { color: #8a5a06; }
.an-funnel-label { font-size: 13.5px; font-weight: 800; }
.an-funnel-track { display: flex; justify-content: center; height: 26px; border-radius: 6px; background: #f4eee5; }
.an-funnel-bar { display: block; height: 100%; border-radius: 6px; transition: width .6s cubic-bezier(.2,.8,.2,1); }
.an-funnel-value { display: grid; gap: 2px; text-align: right; }
.an-funnel-value strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.an-funnel-value small { color: #948a7f; font-size: 11.5px; }
.an-funnel-drop { grid-column: 2 / 4; color: #9c3b2c; font-size: 12px; font-weight: 900; }

.an-funnel-branches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.an-branch { padding: 18px; border-radius: 18px; border: 1px solid var(--admin-line); }
.an-branch-yes { background: linear-gradient(160deg, #171717, #221c13); color: #fff; border-color: #171717; }
.an-branch-no { background: #faf7f1; }
.an-branch-kicker { font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.an-branch-yes .an-branch-kicker { color: #efc35a; }
.an-branch-no .an-branch-kicker { color: var(--admin-soft); }
.an-branch-steps { display: grid; gap: 10px; margin-top: 12px; }
.an-branch-step { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 12px; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.06); }
.an-branch-no .an-branch-step { background: #fff; border: 1px solid var(--admin-line); }
.an-branch-step span { font-size: 13.5px; font-weight: 800; }
.an-branch-step strong { font-size: 24px; letter-spacing: -.03em; }
.an-branch-step small { grid-column: 1 / -1; font-size: 12px; opacity: .7; }

/* ---------- Funnel per sorgente ---------- */
.an-group-bars { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.an-group { display: grid; gap: 7px; padding: 14px; border: 1px solid var(--admin-line); border-radius: 16px; background: #fff; }
.an-group-title { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.an-group-title i { width: 10px; height: 10px; border-radius: 3px; }
.an-group-title strong { font-size: 14px; }
.an-group-title small { margin-left: auto; color: #948a7f; font-size: 11.5px; font-weight: 800; }
.an-group-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 44px; align-items: center; gap: 8px; }
.an-group-label { color: var(--admin-soft); font-size: 12px; font-weight: 700; }
.an-group-value { font-size: 13px; font-weight: 900; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Tooltip ---------- */
.an-tooltip {
  position: fixed;
  z-index: 100;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #171717;
  color: #fff;
  box-shadow: 0 12px 32px rgba(0,0,0,.2);
  font-size: 12.5px;
  line-height: 1.45;
  pointer-events: none;
}
.an-tooltip[hidden] { display: none; }
.an-tooltip-title { margin-bottom: 4px; color: #efc35a; font-weight: 900; }
.an-tooltip-row { display: flex; align-items: center; gap: 7px; }
.an-tooltip-row i { width: 9px; height: 9px; border-radius: 2px; }

.an-footnote { margin: 4px 4px 0; color: #948a7f; font-size: 12.5px; line-height: 1.55; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .an-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-funnel-stage { grid-template-columns: 150px minmax(0, 1fr) 170px; }
}

@media (max-width: 760px) {
  .an-main { padding-top: 24px; }
  .an-toolbar { padding: 14px; }
  .an-refresh { margin-left: 0; }
  .an-grid-2,
  .an-grid-3,
  .an-insight-list,
  .an-funnel-branches { grid-template-columns: 1fr; }
  .an-card { padding: 20px 16px; border-radius: 22px; }
  .an-card-head h2 { font-size: 22px; }
  .an-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-kpi { min-height: 120px; padding: 14px 14px 10px; }
  .an-kpi-value strong { font-size: 24px; }
  .an-funnel-stage { grid-template-columns: 1fr auto; gap: 6px 10px; }
  .an-funnel-track { grid-column: 1 / -1; grid-row: 2; }
  .an-funnel-drop { grid-column: 1 / -1; }
  .an-bar-row { grid-template-columns: minmax(80px, 34%) minmax(0, 1fr) auto; }
  .an-donut { justify-content: center; }
  .admin-dashboard-head.an-head { flex-direction: column; align-items: flex-start; }
}

/* Statistiche essenziali first-party */
.an-site-stats .an-kpis { margin-bottom: 22px; }
.an-site-grid { margin-top: 4px; }
.an-site-subtitle { margin-top: 22px; }

/* =====================================================================
   DASHBOARD PRINCIPALE SEMPLIFICATA (dati BILANORA)
   ===================================================================== */
.analytics-page { --an-sage: #4d6a57; --an-gold: #c78c2b; --an-card: #fffdf8; --an-line: rgba(120, 100, 70, .14); }

.an-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.an-controls .an-segmented { background: #efe8dc; }
.an-period button { min-height: 40px; padding: 0 14px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.an-period button.is-active { background: var(--an-sage); color: #fff; }
.an-period .an-period-custom { text-transform: none; letter-spacing: 0; opacity: .8; }

.an-market {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--an-line);
  border-radius: 14px;
  background: #fff;
}
.an-market button {
  min-height: 40px;
  min-width: 96px;
  padding: 0 18px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--admin-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
.an-market button.is-active { background: #171717; color: #fff; }
.an-controls .an-refresh { margin-left: auto; }

.an-block { display: grid; gap: 14px; }
.an-block.an-card { padding: 24px; border-radius: 20px; background: var(--an-card); border-color: var(--an-line); box-shadow: 0 10px 30px rgba(60, 45, 20, .05); }
.an-block-head h2 { margin: 0; font-size: 13px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: var(--admin-ink); }
.an-block-head p { margin: 4px 0 0; color: var(--admin-soft); font-size: 14px; }

/* 1. Com'è andata */
.an-main-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.an-main-kpi {
  display: grid;
  gap: 6px;
  padding: 20px 20px 18px;
  border: 1px solid var(--an-line);
  border-radius: 20px;
  background: var(--an-card);
  box-shadow: 0 10px 30px rgba(60, 45, 20, .05);
}
.an-main-kpi-label { color: var(--admin-soft); font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.an-main-kpi-value { font-size: clamp(34px, 4vw, 46px); line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.an-main-kpi-note { color: #8f857a; font-size: 13px; }
.an-main-kpi:last-child .an-main-kpi-value { color: var(--an-sage); }

/* 2. Quanto restano */
.an-time { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(0, 2.2fr); gap: 14px; align-items: stretch; }
.an-time-avg { display: grid; align-content: center; gap: 6px; padding: 18px; border-radius: 18px; background: #f3ede3; }
.an-time-avg span { color: var(--admin-soft); font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.an-time-avg strong { font-size: 38px; line-height: 1; letter-spacing: -.03em; color: var(--an-sage); }
.an-time-buckets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.an-time-bucket { display: grid; gap: 4px; align-content: center; padding: 14px 12px; border: 1px solid var(--an-line); border-radius: 16px; background: #fff; text-align: center; }
.an-time-bucket strong { font-size: 24px; letter-spacing: -.02em; }
.an-time-bucket span { color: var(--admin-soft); font-size: 12px; font-weight: 700; }

/* 3. Fino a dove arrivano */
.an-path { display: grid; gap: 4px; }
.an-path-row { display: grid; gap: 6px; padding: 6px 0; }
.an-path-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.an-path-head span { font-weight: 800; }
.an-path-head strong { font-variant-numeric: tabular-nums; }
.an-path-track { height: 14px; border-radius: 999px; background: #f1ebe2; overflow: hidden; }
.an-path-bar { display: block; height: 100%; border-radius: 999px; background: var(--an-gold); transition: width .5s ease; }
.an-path-row.is-final .an-path-bar { background: var(--an-sage); }
.an-path-row.is-final .an-path-head span { color: var(--an-sage); }
.an-path-loss { padding-left: 4px; color: #a1704a; font-size: 12px; font-weight: 700; }

/* 4 + 5 affiancati */
.an-main-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; }

.an-hours-chart { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; align-items: end; height: 170px; }
.an-hours-col { display: grid; grid-template-rows: 1fr auto; height: 100%; align-items: end; gap: 6px; cursor: default; }
.an-hours-bar { display: block; width: 100%; border-radius: 5px 5px 2px 2px; background: var(--an-gold); align-self: end; }
.an-hours-col:hover .an-hours-bar { background: var(--an-sage); }
.an-hours-label { min-height: 14px; color: #8f857a; font-size: 10px; font-weight: 700; text-align: center; }
.an-hours-peak { margin: 4px 0 0; color: var(--admin-ink); font-size: 14px; font-weight: 800; }

.an-sources { display: grid; gap: 14px; }
.an-source-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) 48px; align-items: center; gap: 10px; }
.an-source-label { font-size: 14px; font-weight: 800; }
.an-source-track { height: 14px; border-radius: 999px; background: #f1ebe2; overflow: hidden; }
.an-source-bar { display: block; height: 100%; border-radius: 999px; }
.an-source-pct { font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }

/* Lettura rapida */
.an-quick {
  padding: 24px 26px;
  border-radius: 20px;
  background: linear-gradient(150deg, #1c1a17, #24201a);
  color: #fff;
}
.an-quick-kicker { color: #e3b866; font-size: 11px; font-weight: 900; letter-spacing: .16em; }
.an-quick-lead { margin: 10px 0 12px; font-size: 18px; font-weight: 800; line-height: 1.45; }
.an-quick ul { display: grid; gap: 8px; margin: 0; padding: 0 0 0 18px; color: rgba(255,255,255,.85); font-size: 15px; line-height: 1.5; }

/* Dati avanzati */
.an-advanced { border: 1px solid var(--an-line); border-radius: 20px; background: var(--an-card); }
.an-advanced > summary { display: grid; gap: 2px; padding: 18px 22px; cursor: pointer; list-style: none; }
.an-advanced > summary::-webkit-details-marker { display: none; }
.an-advanced > summary::after { content: "＋"; position: absolute; right: 22px; margin-top: -2px; color: var(--admin-soft); font-weight: 900; }
.an-advanced { position: relative; }
.an-advanced[open] > summary::after { content: "－"; }
.an-advanced-title { font-size: 13px; font-weight: 900; letter-spacing: .14em; text-transform: uppercase; }
.an-advanced-sub { color: var(--admin-soft); font-size: 13px; }
.an-advanced-body { display: grid; gap: 18px; padding: 0 18px 22px; }
.an-advanced-note { margin: 0; padding: 12px 14px; border-radius: 14px; background: #f3ede3; color: var(--admin-soft); font-size: 13px; line-height: 1.5; }
.an-advanced .an-toolbar { position: static; }

@media (max-width: 1000px) {
  .an-main-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .an-main-grid { grid-template-columns: minmax(0, 1fr); }
  .an-time { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 600px) {
  .an-controls { gap: 10px; }
  .an-period { width: 100%; }
  .an-period button { flex: 1 1 auto; padding: 0 8px; font-size: 12px; }
  .an-market { width: 100%; }
  .an-market button { flex: 1 1 50%; }
  .an-main-kpi { padding: 16px 14px; }
  .an-time-buckets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .an-hours-chart { height: 140px; gap: 2px; }
  .an-hours-label { font-size: 9px; }
  .an-block.an-card { padding: 18px 16px; }
  .an-quick { padding: 20px 18px; }
  .an-quick-lead { font-size: 16px; }
}

/* Reset statistiche per mercato */
.an-maintenance {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border: 1px dashed rgba(183, 77, 58, .30);
  border-radius: 18px;
  background: transparent;
}
.an-maintenance > div { display: grid; gap: 3px; max-width: 640px; }
.an-maintenance strong { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.an-maintenance span { color: var(--admin-soft); font-size: 13px; line-height: 1.45; }

.an-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(23, 23, 23, .45);
}
.an-modal-backdrop.hidden { display: none; }
.an-modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 26px 26px 22px;
  border-radius: 20px;
  background: #fffdf8;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
}
.an-modal h2 { margin: 6px 0 8px; font-size: 24px; letter-spacing: -.02em; }
.an-modal p { margin: 0 0 12px; color: var(--admin-soft); line-height: 1.55; }
.an-modal-list { display: grid; gap: 6px; margin: 0 0 16px; padding-left: 18px; color: var(--admin-ink); font-size: 14px; line-height: 1.5; }
.an-modal-confirm { display: grid; gap: 8px; font-size: 14px; font-weight: 700; }
.an-modal-confirm input {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(46,46,46,.18);
  border-radius: 12px;
  font: inherit;
  font-weight: 800;
  letter-spacing: .04em;
}
.an-modal-confirm input:focus { outline: 0; border-color: #b74d3a; box-shadow: 0 0 0 3px rgba(183, 77, 58, .12); }
.an-modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.an-button-danger { background: #b74d3a; color: #fff; }
.an-button-danger:disabled { background: #d9cfc4; color: #fff; cursor: not-allowed; }

@media (max-width: 600px) {
  .an-maintenance .admin-button { width: 100%; }
  .an-modal-actions .admin-button { flex: 1 1 100%; }
}
