/* Layout: colonna unica stretta — scheda "contatore" per i dati, poi tabelle di confronto in fasce */
:root {
  /* palette «moderna»: fondo chiaro, schede bianche, blu come colore principale (modificabile dalla pagina Amministrazione) */
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #1463ff;
  --accent-soft: #eaf1ff;
  --meter: #ffffff;
  --meter-ink: #0f172a;
  --sky: #eef6ff;
  --sky-ink: #0b3a66;
  --good: #0f9d58;
  --good-soft: #e9f9f0;
  --bar: #e2e8f0;
  --warn: #dc2626;
  --on-accent: #ffffff;
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, sans-serif;
  --font-num: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141d; --surface: #161d29; --ink: #e7edf7; --muted: #94a3b8; --line: #263142;
    --accent: #6ea2ff; --accent-soft: #1b2a47; --meter: #1b2230; --meter-ink: #e7edf7;
    --sky: #16304d; --sky-ink: #dcecff;
    --good: #69d27c; --good-soft: #1e3323; --bar: #4b4129; --warn: #ff6b5e; --on-accent: #0b1220; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141d; --surface: #161d29; --ink: #e7edf7; --muted: #94a3b8; --line: #263142;
  --accent: #6ea2ff; --accent-soft: #1b2a47; --meter: #1b2230; --meter-ink: #e7edf7;
  --sky: #16304d; --sky-ink: #dcecff;
  --good: #69d27c; --good-soft: #1e3323; --bar: #4b4129; --warn: #ff6b5e; --on-accent: #0b1220; color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.5; }
#app {
  max-width: 860px; margin: 0 auto;
  padding-block: 32px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid; gap: 28px;
}
header h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(28px, 6vw, 40px); line-height: 1.05; margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
header p { margin: 8px 0 0; color: var(--muted); }
.eyebrow { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: 6px; }
.stamp { font-family: var(--font-num); font-size: 13px; color: var(--muted); }

/* Scheda dati */
.meter { background: var(--meter); color: var(--meter-ink); border-radius: 14px; padding: 20px; display: grid; gap: 14px; }
.meter h2 { font-family: var(--font-display); font-size: 18px; margin: 0; font-weight: 600; color: var(--meter-ink); text-align: center; text-transform: uppercase; letter-spacing: 0.1em; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.8; }
.inbox { display: flex; align-items: baseline; gap: 8px; border: 1px solid color-mix(in srgb, var(--meter-ink) 35%, transparent); border-radius: 8px; padding: 8px 12px; background: color-mix(in srgb, var(--meter-ink) 6%, transparent); }
.inbox:focus-within { border-color: var(--meter-ink); }
.inbox input, .inbox select { flex: 1 1 0; width: 100%; min-width: 0; background: transparent; border: 0; color: var(--meter-ink); font-family: var(--font-num); font-size: 24px; outline: none; padding: 0; }
.inbox select option { color: #1d2320; background: #fff; }
.inbox .unit { font-family: var(--font-num); font-size: 14px; opacity: 0.75; }
.field.err .inbox { border-color: var(--accent); }
.hint { font-size: 13px; opacity: 0.75; margin: 0; }

/* Risultati */
#results { display: grid; gap: 16px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.tabs button.tab { flex: 1 1 0; background: transparent; border: 0; color: var(--muted); font-family: var(--font-display); font-size: 17px; font-weight: 600; padding: 10px 12px; border-radius: 9px; }
.tabs button.tab:hover { color: var(--ink); }
.tabs button.tab[aria-selected="true"] { background: var(--meter); color: var(--meter-ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.block { display: grid; gap: 10px; }
.block h2 { font-family: var(--font-display); font-size: 22px; margin: 0; font-weight: 600; text-wrap: balance; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.num, td.num { text-align: right; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr.sep td { padding: 0; height: 10px; background: var(--bg); }
td.gest { font-weight: 600; font-size: 13px; letter-spacing: 0.02em; white-space: nowrap; }
td.off { color: var(--ink); min-width: 160px; }
td.num { font-family: var(--font-num); font-size: 14px; white-space: nowrap; }
.delta { display: block; font-size: 12px; color: var(--muted); }
.barcell { position: relative; }
.bar { height: 4px; border-radius: 2px; background: var(--bar); margin-top: 6px; }
.bar i { display: block; height: 100%; border-radius: 2px; background: var(--muted); }
tr.best td { background: var(--good-soft); }
tr.best .bar i { background: var(--good); }
.gm { display: none; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); }
.pill { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; padding: 1px 8px; border-radius: 999px; background: var(--good); color: var(--surface); margin-left: 6px; vertical-align: 1px; }

td.btncell, th.btncell { width: 40px; padding-right: 0; }
button.more { width: 26px; height: 26px; padding: 0; border-radius: 50%; background: transparent; color: var(--accent); font-family: var(--font-num); font-size: 16px; line-height: 1; display: inline-grid; place-items: center; }
button.more[aria-expanded="true"] { background: var(--accent); color: var(--surface); }
tr.detail td { background: var(--bg); padding: 12px 14px 14px; }
dl.det { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 18px; margin: 0; }
dl.det div { min-width: 0; }
dl.det div.wide { grid-column: 1 / -1; }
dl.det dt { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
dl.det dd a { color: var(--accent); }
dl.det dd { margin: 2px 0 0; font-family: var(--font-num); font-size: 13px; overflow-wrap: anywhere; }
tr.own td { background: var(--accent-soft); }
tr.own td.gest, tr.own td.off { font-style: normal; color: var(--ink); }
.ownin { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; }
.ownf { display: grid; gap: 2px; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.ownf input { width: 9.5em; max-width: 100%; font-family: var(--font-num); font-size: 15px; padding: 5px 8px; border: 2px solid var(--accent); border-radius: 6px; background: #fff8c9; color: #1d2320; }
.ownsub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
tr.owndetail td { background: var(--accent-soft); border-top: 1px dashed var(--accent); }
.owngrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.owncard { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.owncard.top { border-color: var(--good); }
.ownhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ownname { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; }
.ownval { font-family: var(--font-num); font-size: 14px; text-align: right; }
.owncard .ownin { margin-top: 6px; }
.owncard .ownf input { width: 100%; }
.owncard .ownf { flex: 1 1 90px; min-width: 0; }
.ownact { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px; }
.hint2 { font-size: 12px; color: var(--muted); }
.ownin .ownbtn { align-self: end; padding: 6px 14px; }
.ownf.err input { border-style: dashed; background: var(--surface); color: var(--ink); }
details.notes { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
details.notes summary { cursor: pointer; font-weight: 600; }
details.notes p { white-space: pre-line; color: var(--muted); max-width: 70ch; }

/* Pannello aggiornamento (solo chi può modificare) */
.admin { border: 1px dashed var(--accent); border-radius: 12px; padding: 16px; display: grid; gap: 10px; background: var(--accent-soft); }
.admin h2 { font-family: var(--font-display); font-size: 17px; margin: 0; }
.admin p { margin: 0; font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
button, .filebtn { font: inherit; font-weight: 600; border-radius: 8px; padding: 8px 14px; border: 1px solid var(--accent); background: var(--accent); color: var(--surface); cursor: pointer; }
button.ghost, .filebtn { background: transparent; color: var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }
button:focus-visible, .filebtn:focus-within, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.filebtn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.msg { font-size: 14px; }
.msg.bad { color: var(--accent); font-weight: 600; }
.loading { color: var(--muted); font-style: italic; }
footer { font-size: 13px; color: var(--muted); }
@media (max-width: 520px) {
  td, th { padding: 9px 10px; }
  td.btncell, th.btncell { width: 34px; padding-right: 0; }
  dl.det { grid-template-columns: 1fr 1fr; }
  th.gest, td.gest { display: none; }
  .gm { display: block; }
  td.off { min-width: 0; }
  .bar { display: none; }
}

/* Scelta luce / gas */
.topbar { display: flex; justify-content: flex-end; margin-bottom: -12px; }
.switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.switch a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 6px 16px; border-radius: 999px; }
.switch a:hover { color: var(--ink); }
.switch a.on { background: var(--meter); color: var(--meter-ink); }
.switch a:focus-visible, a.choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.landhead { padding-top: 4vh; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
a.choice { display: grid; gap: 6px; text-decoration: none; color: var(--meter-ink); background: var(--meter); border-radius: 16px; padding: 24px; min-height: 200px; align-content: start; border: 2px solid transparent; transition: transform .15s ease, border-color .15s ease; }
a.choice:hover { border-color: var(--accent); transform: translateY(-2px); }
.cicon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--meter-ink) 12%, transparent); margin-bottom: 8px; }
.cname { font-family: var(--font-display); font-size: 34px; font-weight: 700; line-height: 1; }
.cdesc { font-size: 14px; opacity: 0.85; }
a.choice .stamp { color: var(--meter-ink); opacity: 0.7; }
.cgo { margin-top: auto; padding-top: 14px; font-weight: 600; font-size: 15px; }
.fnote { font-size: 12px; opacity: 0.7; }
@media (prefers-reduced-motion: reduce) { a.choice { transition: none; } a.choice:hover { transform: none; } }

/* Consumi per fascia (luce) */
.fascebox { display: grid; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid color-mix(in srgb, var(--meter-ink) 20%, transparent); }
.fascehint { margin: 0; font-size: 13px; opacity: 0.85; }
.fields.fasce { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field.f0 .inbox { border-color: var(--meter-ink); background: color-mix(in srgb, var(--meter-ink) 12%, transparent); }
.inbox input::placeholder { color: var(--meter-ink); opacity: 0.35; }
@media (max-width: 640px) { .fields.fasce { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .fields.fasce .f0 { grid-column: 1 / -1; } .fields.fasce .field:not(.f0) .unit { display: none; } .fields.fasce .field:not(.f0) input { font-size: 20px; } .fields.fasce .field:not(.f0) .inbox { padding: 8px 10px; } }

/* Validità in evidenza nei dettagli */
dl.det div.valid { grid-column: 1 / -1; justify-self: start; background: var(--meter); color: var(--meter-ink); border-radius: 8px; padding: 8px 14px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
dl.det div.valid dt { color: var(--meter-ink); opacity: 0.8; font-size: 11px; }
dl.det div.valid dd { margin: 0; font-size: 17px; font-weight: 500; }
dl.det div.valid .vnote { margin-left: 10px; font-family: var(--font-body); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: var(--surface); }
dl.det div.valid.expired dd { text-decoration: line-through; text-decoration-thickness: 1px; }

.bandstate { margin: 0; font-size: 12.5px; padding: 6px 10px; border-radius: 6px; background: color-mix(in srgb, var(--meter-ink) 12%, transparent); }

/* Tipologia delle offerte indicizzate */
.tipo { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 1px 8px; border-radius: 4px; margin-left: 8px; vertical-align: 1px; white-space: nowrap; border: 1px solid transparent; }
.tipo-mono { color: var(--muted); border-color: var(--line); }
.tipo-bio { background: var(--meter); color: var(--meter-ink); }
.tipo-trio { background: var(--accent); color: var(--surface); }
.tipo.est { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px currentColor; }
.tipo-bio.est { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--meter); }
.tipo-trio.est { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--accent); }
dl.det div.tipodet dd { font-weight: 700; font-family: var(--font-body); }
@media (max-width: 520px) { td.off .tipo { margin-left: 0; margin-top: 4px; display: table; } td.off .pill + .tipo { margin-top: 4px; } }

/* Colonna scadenza */
td.warncell, th.warncell { width: 30px; padding-left: 12px; padding-right: 0; text-align: center; }
.warn { display: inline-block; color: var(--warn); font-weight: 800; font-size: 18px; line-height: 1.1; cursor: help; font-family: var(--font-display); }

/* Riquadro della più conveniente */
.bestcard { background: var(--good-soft); border: 2px solid var(--good); border-radius: 14px; padding: 16px 18px; display: grid; gap: 8px; }
.besthead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; }
.besthead > div:first-child { min-width: 0; }
.bestcard .eyebrow { color: var(--good); margin-bottom: 2px; }
a.bestname { display: block; font-family: var(--font-display); font-size: 22px; font-weight: 700; line-height: 1.15; color: var(--ink); text-decoration: none; }
a.bestname:hover { text-decoration: underline; }
.bestgest { display: block; font-family: var(--font-body); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); }
.bestchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bestchips .tipo { margin-left: 0; }
.bkind { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.bkind.var { background: var(--meter); color: var(--meter-ink); }
.bkind.fix { background: var(--good); color: var(--surface); }
.bestval { text-align: right; display: grid; }
.bestval span { font-family: var(--font-num); font-size: 26px; font-weight: 500; color: var(--good); line-height: 1.1; }
.bestval small { font-size: 12px; color: var(--muted); }
.bestalt { margin: 0; font-size: 14px; }
.bestalt a { color: var(--accent); }
.bestnote { margin: 0; font-size: 12px; color: var(--muted); }
@media (max-width: 520px) { .bestval { text-align: left; } a.bestname { font-size: 19px; } td.warncell, th.warncell { width: 22px; padding-left: 8px; } }

/* Durata del prezzo bloccato nei dettagli delle offerte fisse */
dl.det div.lock { grid-column: 1 / -1; justify-self: start; background: var(--good-soft); border: 1px solid var(--good); border-radius: 8px; padding: 8px 14px; }
dl.det div.lock dt { color: var(--good); }
dl.det div.lock dd { font-family: var(--font-body); font-size: 15px; font-weight: 600; color: var(--ink); }

/* nasconde davvero gli elementi con attributo hidden (anche fuori da Claude) */
[hidden] { display: none !important; }

/* Validità e durata del prezzo affiancate, stessa altezza */
dl.det div.pair { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; }
dl.det div.pair > div { grid-column: auto; justify-self: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0; min-height: 44px; }
dl.det div.pair > div.lock dd { margin: 0; }

/* Colonne con la stessa larghezza in tutte le tabelle (luce e gas) */
table.offers { table-layout: fixed; }
table.offers col.c-btn { width: 40px; }
table.offers col.c-warn { width: 30px; }
table.offers col.c-gest { width: 24%; }
table.offers col.c-num { width: 150px; }
table.offers td.gest { white-space: normal; overflow-wrap: anywhere; }
table.offers td.off { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 520px) {
  table.offers { table-layout: auto; }
  table.offers col.c-gest, table.offers col.c-num { width: auto; }
  table.offers col.c-btn { width: 34px; }
  table.offers col.c-warn { width: 22px; }
}

/* Scelta iniziale: luce gialla come il sole, gas azzurro come il cielo */
a.choice-gas { background: var(--sky); color: var(--sky-ink); }
a.choice-gas .stamp { color: var(--sky-ink); }
a.choice-gas .cicon { background: color-mix(in srgb, var(--sky-ink) 12%, transparent); }
a.choice { box-shadow: 0 4px 14px color-mix(in srgb, var(--ink) 8%, transparent); border: 1px solid var(--line); }
.tabs button.tab[aria-selected="true"] { box-shadow: inset 0 -3px 0 var(--accent); }

/* ===== Stile «schede» ispirato al confronto conti ===== */
header h1 { font-weight: 800; letter-spacing: -0.03em; }
header h1 .hl { color: var(--accent); }
.meter { background: var(--meter); border: 1px solid var(--line); box-shadow: 0 6px 24px color-mix(in srgb, var(--ink) 7%, transparent); }
.meter h2 { letter-spacing: 0.06em; }
.inbox { background: color-mix(in srgb, var(--bg) 70%, var(--meter)); border-color: var(--line); }
.inbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.f0 .inbox { border-color: var(--accent); background: var(--accent-soft); }
/* schede Indicizzate / Fisso come pulsanti a pillola */
.tabs { background: transparent; border: 0; padding: 0; gap: 10px; flex-wrap: wrap; }
.tabs button.tab { flex: 0 0 auto; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 9px 18px; font-family: var(--font-body); font-size: 15px; box-shadow: none; }
.tabs button.tab-idx { border-color: color-mix(in srgb, #7c3aed 35%, var(--line)); color: #6d28d9; background: color-mix(in srgb, #7c3aed 6%, var(--surface)); }
.tabs button.tab-fix { border-color: color-mix(in srgb, #0f9d58 35%, var(--line)); color: #0b7a44; background: color-mix(in srgb, #0f9d58 6%, var(--surface)); }
.tabs button.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent); }
.switch a.on { background: var(--accent); color: var(--on-accent); }
/* griglia delle offerte */
.ogroups { display: grid; gap: 18px; }
.ogroup-title { font-family: var(--font-display); font-size: 18px; margin: 8px 0 0; }
.ocards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.ocard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 12px; align-content: start; box-shadow: 0 4px 18px color-mix(in srgb, var(--ink) 6%, transparent); min-width: 0; }
.ocard.best { border: 2px solid var(--good); }
.ocard.own { border: 2px dashed color-mix(in srgb, var(--accent) 55%, var(--line)); background: color-mix(in srgb, var(--accent) 3%, var(--surface)); }
.ocard.wide { grid-column: 1 / -1; }
.ohead { display: flex; gap: 12px; align-items: center; min-width: 0; }
.ologo { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 15px; letter-spacing: 0.02em; border: 1px solid color-mix(in srgb, currentColor 15%, transparent); }
.otitle { min-width: 0; display: grid; }
.otitle h3 { margin: 0; font-family: var(--font-display); font-size: 17px; line-height: 1.2; overflow-wrap: anywhere; }
.ogest { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: 0.02em; }
.obadges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.obadges:empty { display: none; }
.chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.chip-best { background: var(--accent-soft); color: var(--accent); }
.chip-own { background: var(--accent); color: var(--on-accent); }
.chip-soon { background: #fff4cc; color: #8a5a00; }
.chip-expired { background: #fde2e2; color: #b42318; }
.chip-lock { background: var(--good-soft); color: var(--good); }
.obadges .tipo { margin-left: 0; border-radius: 999px; padding: 3px 10px; font-size: 11px; }
.tipo-mono { color: var(--muted); border-color: var(--line); background: var(--surface); }
.tipo-bio { background: #ede9fe; color: #5b21b6; }
.tipo-trio { background: #ffedd5; color: #9a3412; }
.otiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ocard.own .otiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.otile { border-radius: 12px; padding: 10px; display: grid; gap: 2px; align-content: start; background: color-mix(in srgb, var(--bg) 80%, var(--surface)); min-width: 0; }
.otile.good { background: var(--good-soft); }
.otile.diff { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.otl { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.otv { font-family: var(--font-display); font-weight: 800; font-size: 20px; line-height: 1.15; overflow-wrap: anywhere; }
.otile.good .otv { color: var(--good); }
.otile.diff .otv { color: var(--accent); font-size: 17px; }
.otile.price { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.otile.price .otv { font-size: 16px; }
.ots { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.oactions { display: grid; gap: 8px; }
a.octa { display: block; text-align: center; background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 700; padding: 11px 14px; border-radius: 12px; }
a.octa:hover { filter: brightness(1.06); }
button.omore { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; font-weight: 700; width: 100%; }
button.omore::after { content: " →"; }
button.omore[aria-expanded="true"]::after { content: " ↑"; }
.odetail { border-top: 1px dashed var(--line); padding-top: 12px; }
.ocard .ownin { margin-top: 0; }
.bestcard { background: var(--surface); box-shadow: 0 4px 18px color-mix(in srgb, var(--ink) 6%, transparent); }
@media (max-width: 520px) {
  .ocards { grid-template-columns: 1fr; }
}
.ocards { align-items: start; }
dl.det div.valid { background: var(--accent-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); }
dl.det div.valid dt { color: var(--accent); opacity: 1; }
dl.det div.valid dd { color: var(--ink); }
.ocard .ownf input { background: var(--surface); color: var(--ink); border-color: var(--accent); }
a.choice-luce { background: color-mix(in srgb, #f59f00 9%, var(--surface)); }
a.choice-luce .cicon { background: color-mix(in srgb, #f59f00 22%, transparent); color: #b45309; }
a.choice:hover { border-color: var(--accent); }
/* offerte su un'unica colonna */
.ocards { grid-template-columns: 1fr; }
.otiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.otile.price { grid-column: auto; display: grid; }
.ocard.own .otiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.oactions { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
@media (max-width: 520px) {
  .otiles { grid-template-columns: 1fr 1fr; }
  .otile.price { grid-column: 1 / -1; }
}

/* durata del prezzo subito sotto la più conveniente, prima della migliore dell'altro tipo */
.bestcard .bestnote { font-size: 13px; color: var(--ink); font-weight: 600; }

/* Consumi mese per mese (luce) */
.mesibox { display: grid; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid color-mix(in srgb, var(--meter-ink) 20%, transparent); }
.mesitog { justify-self: start; display: inline-flex; align-items: center; gap: 10px; background: transparent; color: var(--meter-ink); border: 0; padding: 4px 0; font: inherit; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; cursor: pointer; }
.mesitog .mplus { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--meter-ink) 45%, transparent); font-size: 18px; line-height: 1; font-weight: 400; }
.mesitog:hover .mplus, .mesitog:focus-visible .mplus { background: color-mix(in srgb, var(--meter-ink) 12%, transparent); }
.mesibody { display: grid; gap: 10px; padding: 14px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 7%, color-mix(in srgb, var(--meter-ink) 4%, var(--meter))); }
.mesibody .mese + .mese { padding-top: 12px; border-top: 1px solid color-mix(in srgb, var(--meter-ink) 12%, transparent); }
.mesibody[hidden] { display: none; }
.mesilist { display: grid; gap: 14px; }
.mese { display: grid; gap: 6px; }
.mese .mn { margin: 0; font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--meter-ink); }
.mesistate { margin: 0; font-size: 12.5px; opacity: 0.9; }
.mesistate:empty { display: none; }
.mesiact { display: flex; justify-content: flex-end; }
.field.locked .inbox { border-style: dashed; }
.field.locked input { cursor: default; }

.owncheck { display: flex; align-items: center; gap: 8px; flex-basis: 100%; font-size: 13px; color: var(--ink); cursor: pointer; }
.owncheck input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
