/* COMPARATORE - stile minimale professionale, desktop-first full-width */

:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1a2330;
  --ink-2: #5a6572;
  --line: #dde2e8;
  --accent: #12406e;
  --accent-2: #e8f0f9;
  --danger: #a33;
  --mono: "SF Mono", Consolas, "Cascadia Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* ---------- header ---------- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 18px 24px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.top h1 { margin: 0; font-size: 20px; font-weight: 650; letter-spacing: .2px; }
.top .sub { margin: 4px 0 0; color: var(--ink-2); font-size: 12.5px; }
.main-nav { margin-top: 7px; display: flex; gap: 14px; }
.main-nav a {
  color: var(--accent); text-decoration: none; font-size: 12.5px; font-weight: 600;
  border-bottom: 1px solid transparent;
}
.main-nav a:hover { border-bottom-color: var(--accent); }
.badge-src {
  font-size: 11.5px; color: var(--accent);
  background: var(--accent-2); border: 1px solid #c9dcf0;
  padding: 4px 10px; border-radius: 3px; white-space: nowrap;
}
.topright { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.premium-link {
  font-size: 12.5px; font-weight: 650; text-decoration: none;
  color: #0b3a5e; background: linear-gradient(93deg, #d9f5f0, #dbe9fb);
  border: 1px solid #b5d9d2; padding: 6px 12px; border-radius: 4px;
  transition: transform .15s, box-shadow .15s;
}
.premium-link:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(18, 64, 110, .18); }
.premium-link span {
  font-size: 9.5px; letter-spacing: 1px; background: #12406e; color: #fff;
  padding: 2px 5px; border-radius: 2px; margin-left: 4px; vertical-align: 1px;
}

/* ---------- winners ---------- */
.winners {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  padding: 16px 24px 4px;
}
.win {
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  padding: 12px 16px 14px;
  min-height: 118px;
}
.win h2 {
  margin: 0 0 8px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .8px; color: var(--ink-2);
}
.win .w-none { color: var(--ink-2); font-size: 12.5px; padding-top: 12px; }
.win .w-row {
  display: flex; align-items: baseline; gap: 9px;
  padding: 5px 0; border-bottom: 1px dashed #e8ecf1;
}
.win .w-row:last-child { border-bottom: none; }
.win .w-rank {
  flex: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent-2); color: var(--accent);
  font-size: 11px; font-weight: 700; text-align: center; line-height: 18px;
}
.win .w-row:first-child .w-rank { background: var(--accent); color: #fff; }
.win .w-link {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 550;
}
.win .w-link:hover { color: var(--accent); text-decoration: underline; }
.win .w-met { flex: none; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }

/* ---------- controls ---------- */
.controls { padding: 12px 24px 0; }
.row1 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
#q {
  width: 260px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 3px; background: var(--panel);
  font-size: 13.5px;
}
#q:focus, .dd-search:focus, .rng input:focus { outline: 2px solid #bcd4ec; border-color: var(--accent); }

.dd { position: relative; }
.dd-btn {
  padding: 7px 26px 7px 10px; font-size: 13px;
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%235a6572'/%3E%3C/svg%3E") no-repeat right 9px center;
  border: 1px solid var(--line); border-radius: 3px; cursor: pointer; color: var(--ink);
}
.dd-btn.active { border-color: var(--accent); background-color: var(--accent-2); }
.dd-panel {
  display: none; position: absolute; z-index: 30; top: calc(100% + 4px); left: 0;
  width: 290px; max-height: 380px; overflow: hidden auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 6px 22px rgba(20, 30, 45, .14);
}
.dd.open .dd-panel { display: block; }
.dd-search {
  width: calc(100% - 16px); margin: 8px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 3px; font-size: 13px;
}
.dd-list label {
  display: flex; gap: 8px; align-items: center;
  padding: 4px 12px; font-size: 13px; cursor: pointer;
}
.dd-list label:hover { background: var(--accent-2); }
.dd-list .cnt { margin-left: auto; color: var(--ink-2); font-size: 11.5px; font-family: var(--mono); }

.chipgroup { display: flex; gap: 4px; }
.chip {
  padding: 6px 10px; font-size: 12.5px; border: 1px solid var(--line);
  background: var(--panel); border-radius: 3px; cursor: pointer; color: var(--ink);
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.tgl { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink); cursor: pointer; }

.linkbtn {
  background: none; border: none; color: var(--accent);
  font-size: 13px; cursor: pointer; text-decoration: underline; padding: 4px 2px;
}
.linkbtn.danger { color: var(--danger); }
.count { margin-left: auto; font-size: 13px; color: var(--ink-2); font-family: var(--mono); }

.adv {
  margin-top: 10px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 4px; padding: 14px 16px;
}
.adv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px 22px;
}
.rng { font-size: 12px; color: var(--ink-2); }
.rng .rng-lbl { display: block; margin-bottom: 4px; font-weight: 600; color: var(--ink); }
.rng .rng-io { display: flex; align-items: center; gap: 6px; }
.rng input {
  width: 90px; padding: 5px 7px; border: 1px solid var(--line);
  border-radius: 3px; font-size: 12.5px; font-family: var(--mono);
}
.rng .hint { font-family: var(--mono); font-size: 11px; }

/* ---------- table ---------- */
.tablewrap { padding: 12px 24px 0; overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); font-size: 12.8px;
}
thead th {
  position: sticky; z-index: 10;
  background: #eef1f5; border-bottom: 1px solid var(--line);
  padding: 6px 9px; text-align: left; font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .4px; color: var(--ink-2);
  white-space: nowrap; cursor: pointer; user-select: none;
}
thead tr.h-groups th { top: 0; height: 26px; }
thead tr.h-cols th { top: 26px; border-bottom: 2px solid var(--line); }
thead tr.h-groups th[rowspan] { height: auto; border-bottom: 2px solid var(--line); vertical-align: bottom; padding-bottom: 8px; }
thead th.group {
  text-align: center; font-weight: 700; font-size: 10.5px;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}
thead th.g-cool  { background: #e8f1f9; color: #1c5a8a; }
thead th.g-heat  { background: #fbeee7; color: #a04a1d; }
thead th.g-noise { background: #f0edf8; color: #5b4a91; }
thead th.g-scen  { background: #e9f5ee; color: #1e6b41; }
thead th.g-sim   { background: #fdf5e0; color: #8a6a12; }
thead tr.h-cols th.g-cool  { background: #f0f6fb; }
thead tr.h-cols th.g-heat  { background: #fcf4ef; }
thead tr.h-cols th.g-noise { background: #f5f3fa; }
thead tr.h-cols th.g-scen  { background: #f0f8f3; }
thead tr.h-cols th.g-sim   { background: #fdf8ea; }
thead th:hover { color: var(--accent); }
thead th.sorted { color: var(--accent); }
thead th .arr { font-size: 10px; }
thead th.num, td.num { text-align: right; }
tbody td {
  padding: 6px 9px; border-bottom: 1px solid #edf0f3; white-space: nowrap;
}
td.num { font-family: var(--mono); font-size: 12.3px; }
tbody tr:nth-child(even) { background: #fafbfc; }
tbody tr:hover { background: #f0f5fb; cursor: pointer; }

.score {
  display: inline-block; min-width: 34px; text-align: center;
  font-family: var(--mono); font-size: 11.5px; font-weight: 700;
  color: #fff; padding: 2px 6px; border-radius: 10px;
}
td.c-model { max-width: 300px; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
td.muted, span.muted { color: #9aa4ae; }

.klass {
  display: inline-block; min-width: 42px; text-align: center;
  font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 2px; color: #fff;
}
.k-app3 { background: #00845c; }      /* A+++ */
.k-app2 { background: #3fa33a; }      /* A++  */
.k-app1 { background: #8fb928; }      /* A+   */
.k-a    { background: #d8c500; color: #333; }
.k-b    { background: #e8a800; }
.k-c    { background: #e07818; }
.k-d    { background: #d43b2a; }
.k-low  { background: #9aa4ae; }

.tag {
  font-size: 10.5px; padding: 2px 6px; border-radius: 2px;
  background: #eef1f5; color: var(--ink-2); border: 1px solid var(--line);
}
.tag.multi { background: #f2ecfa; color: #5b3d8f; border-color: #ddd0ee; }
.tag.out { background: #faf0ef; color: #a33; border-color: #eedad7; }

a.eprel-link { color: var(--accent); font-size: 12px; }

.vdot { color: #2c8a43; font-weight: 700; font-size: 11px; }

.warn-units {
  color: #a05a00; background: #fdf3e3; border: 1px solid #f0ddb8;
  font-size: 10.5px; padding: 1px 5px; border-radius: 2px; margin-left: 6px; white-space: nowrap;
}

/* ---------- simulatore localita' ---------- */
.price-in {
  width: 64px; padding: 4px 6px; border: 1px solid var(--line);
  border-radius: 3px; font-size: 12.5px; font-family: var(--mono);
}
.sim .sim-row {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 22px;
  padding: 4px 0;
}
.sim-fld {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-2);
}
.sim-fld select, .sim-fld input[type="search"] {
  min-width: 190px; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 3px; font-size: 13px; background: var(--panel); color: var(--ink);
}
.sim-fld input[type="search"] { min-width: 120px; margin-bottom: 4px; }
.sim-group { display: flex; flex-direction: column; gap: 4px; }
.sim-lbl { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-2); }
.sim-climate { font-family: var(--mono); font-size: 12px; color: var(--accent); align-self: center; }
.sim-status { font-size: 12.5px; color: var(--ink-2); align-self: center; }
.btn {
  padding: 8px 16px; background: var(--accent); color: #fff; border: none;
  border-radius: 3px; font-size: 13px; cursor: pointer;
}
.btn:hover { background: #0d3357; }
.btn:disabled { opacity: .45; cursor: default; }

.empty { padding: 40px; text-align: center; color: var(--ink-2); background: var(--panel); border: 1px solid var(--line); border-top: none; }

/* ---------- pager ---------- */
.pager {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 24px 4px; font-size: 13px;
}
.pager button, .pager select {
  padding: 6px 12px; border: 1px solid var(--line); background: var(--panel);
  border-radius: 3px; cursor: pointer; font-size: 12.5px; color: var(--ink);
}
.pager button:disabled { opacity: .4; cursor: default; }
#pageinfo { font-family: var(--mono); color: var(--ink-2); }

/* ---------- footer note ---------- */
.notes {
  margin: 26px 24px 30px; padding: 16px 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  color: var(--ink-2); font-size: 12.5px; max-width: 1100px;
}
.notes h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink); }
.notes ul { margin: 0; padding-left: 18px; }
.notes li { margin-bottom: 5px; }

/* ---------- dialog dettaglio ---------- */
dialog#detail {
  width: min(860px, 92vw); border: 1px solid var(--line); border-radius: 6px;
  padding: 0; box-shadow: 0 12px 48px rgba(15, 25, 40, .25);
}
dialog#detail::backdrop { background: rgba(15, 25, 40, .35); }
.d-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: #f4f6f9;
}
.d-head h2 { margin: 0; font-size: 16px; }
#d-close { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--ink-2); }
#d-body { padding: 16px 20px 20px; }
.d-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 24px; }
.d-item { padding: 6px 0; border-bottom: 1px dashed #e6e9ee; font-size: 13px; }
.d-item .lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-2); }
.d-item .val { font-family: var(--mono); font-size: 13px; }
.d-actions { margin-top: 14px; display: flex; gap: 12px; }
.d-actions a {
  color: var(--accent); font-size: 13px; text-decoration: none;
  border: 1px solid var(--accent); padding: 6px 12px; border-radius: 3px;
}
.d-actions a:hover { background: var(--accent-2); }

.loading { opacity: .45; pointer-events: none; }

/* ---------- barra confronto manuale (max 5 modelli) ---------- */
td.c-cmp, thead th.c-cmp { width: 26px; text-align: center; }
td.c-cmp input { cursor: pointer; accent-color: var(--accent); }
.cmp-tray {
  position: sticky; bottom: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 24px; padding: 10px 16px;
  background: #0f2c4d; color: #fff; border-radius: 6px 6px 0 0;
  box-shadow: 0 -6px 24px rgba(15, 44, 77, .25);
}
.cmp-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cmp-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 240px;
  background: rgba(255, 255, 255, .12); border-radius: 3px; padding: 4px 8px; font-size: 12px;
}
.cmp-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-chip button {
  background: none; border: none; color: #ffb4b4; font-size: 14px; cursor: pointer; padding: 0;
}
.cmp-add { position: relative; }
.cmp-add input {
  width: 240px; padding: 6px 10px; border: 1px solid rgba(255, 255, 255, .25);
  border-radius: 3px; background: rgba(255, 255, 255, .08); color: #fff; font-size: 12.5px;
}
.cmp-add input::placeholder { color: #b9c6d4; }
.cmp-suggest {
  position: absolute; bottom: calc(100% + 6px); left: 0; width: 340px; max-height: 260px;
  overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 -6px 24px rgba(20, 30, 45, .2);
}
.cmp-sug-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  border-bottom: 1px solid #edf0f3; padding: 8px 12px; font-size: 12.5px; color: var(--ink); cursor: pointer;
}
.cmp-sug-item:hover { background: var(--accent-2); }
.cmp-hint { font-size: 11.5px; color: #b9c6d4; }
.cmp-go {
  margin-left: auto; background: #fff; color: #0f2c4d; font-weight: 700; font-size: 13px;
  padding: 8px 18px; border-radius: 4px; text-decoration: none;
}
.cmp-go.off { opacity: .45; cursor: default; }
.cmp-clear { background: none; border: none; color: #b9c6d4; font-size: 18px; cursor: pointer; }

/* ---------- hub esplorazione (home = accentratore di tutte le sezioni) ---------- */
.home-hub {
  margin: 0 24px 34px; padding: 20px 22px 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
}
.home-hub h2 { margin: 0 0 14px; font-size: 15px; letter-spacing: .3px; }
.hub-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 30px;
}
.hub-grid h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.hub-grid h3 a { color: var(--ink); text-decoration: none; }
.hub-grid h3 a:hover { color: var(--accent); }
.hub-grid a { display: block; color: var(--accent); text-decoration: none; font-size: 12.8px; padding: 2.5px 0; }
.hub-grid a:hover { text-decoration: underline; }
.hub-grid .hub-more { font-weight: 700; margin-top: 4px; }
