:root {
      /* superfici */
      --bg: #0b1120;
      --surface: #151f33;
      --surface-2: #0f172a;   /* superficie su cui vivono i grafici (palette validata su questa) */
      --border: #26344d;
      --border-soft: rgba(148,163,184,0.14);

      /* inchiostro */
      --text: #eef2f8;
      --text-2: #b6c2d4;
      --muted: #8a99b0;

      /* serie dati (validate su superficie #0f172a, modalità scura) */
      --series-1: #3987e5;
      --series-2: #d95926;
      --series-3: #199e70;

      /* stato (mai da sole: sempre con icona + etichetta) */
      --good: #0ca30c;
      --warning: #fab219;
      --serious: #ec835a;
      --critical: #d03b3b;

      --accent: #3987e5;
      --accent-ink: #0b1120;

      --nav-h: 62px;
      --radius: 16px;
    }
    * { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
    html { -webkit-text-size-adjust: 100%; }
    body {
      font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
      background: var(--bg);
      color: var(--text);
      line-height: 1.45;
      min-height: 100dvh;
      overscroll-behavior-y: none;
    }
    .app { max-width: 520px; margin: 0 auto; min-height: 100dvh; }

    /* ---------- LOGIN ---------- */
    #login-screen {
      display: flex; flex-direction: column; justify-content: center; align-items: center;
      padding: 24px; text-align: center; min-height: 100dvh;
    }
    #login-screen h1 { font-size: 2rem; margin-bottom: 8px; letter-spacing: -0.02em; }
    #login-screen .tagline { color: var(--muted); margin-bottom: 32px; max-width: 300px; }
    .btn-google {
      display: flex; align-items: center; gap: 12px; background: #fff; color: #1f2937;
      border: none; padding: 15px 26px; border-radius: 14px; font-size: 1rem; font-weight: 650;
      cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,0.35); min-height: 52px;
    }
    .btn-google:disabled { opacity: 0.6; }
    .spinner {
      width: 34px; height: 34px; border-radius: 50%;
      border: 3px solid var(--border); border-top-color: var(--accent);
      animation: spin 0.8s linear infinite;
    }
    @keyframes spin { to { transform: rotate(360deg); } }
    .auth-error {
      background: #3a1010; border: 1px solid #7f1d1d; color: #fecaca;
      padding: 12px 14px; border-radius: 12px; font-size: 0.82rem;
      margin-top: 18px; max-width: 340px; text-align: left; word-break: break-word;
    }
    .auth-error code { color: #fca5a5; }
    .auth-error .fix { color: #fde68a; margin-top: 8px; display: block; }
    details.diag { margin-top: 22px; max-width: 340px; width: 100%; }
    details.diag summary { cursor: pointer; font-size: 0.72rem; color: var(--muted); list-style: none; text-align: center; }
    details.diag summary::-webkit-details-marker { display: none; }
    details.diag pre {
      background: #060b16; border: 1px solid var(--border); border-radius: 10px;
      padding: 10px; font-size: 0.68rem; color: var(--text-2); margin-top: 8px;
      white-space: pre-wrap; word-break: break-all;
    }

    /* ---------- CHROME ---------- */
    header.topbar {
      position: sticky; top: 0; z-index: 40;
      background: rgba(11,17,32,0.86);
      backdrop-filter: saturate(180%) blur(14px);
      -webkit-backdrop-filter: saturate(180%) blur(14px);
      border-bottom: 1px solid var(--border-soft);
      padding: 10px 16px;
      padding-top: max(10px, env(safe-area-inset-top));
      display: flex; align-items: center; justify-content: space-between; gap: 12px;
    }
    header.topbar h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
    header.topbar .sub { font-size: 0.72rem; color: var(--muted); font-weight: 500; }
    .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface); flex: 0 0 auto; }

    main { padding: 16px 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
    .page { display: none; }
    .page.active { display: block; animation: fade 0.18s ease-out; }
    @keyframes fade { from { opacity: 0; transform: translateY(4px);} to {opacity:1; transform:none;} }

    nav.bottom {
      position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
      display: grid; grid-template-columns: repeat(5, 1fr);
      background: rgba(11,17,32,0.94);
      backdrop-filter: saturate(180%) blur(14px);
      -webkit-backdrop-filter: saturate(180%) blur(14px);
      border-top: 1px solid var(--border-soft);
      padding-bottom: env(safe-area-inset-bottom);
      max-width: 520px; margin: 0 auto;
    }
    nav.bottom button {
      background: none; border: none; color: var(--muted); cursor: pointer;
      display: flex; flex-direction: column; align-items: center; gap: 3px;
      padding: 9px 2px 8px; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.01em;
      min-height: var(--nav-h);
    }
    nav.bottom button svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
    nav.bottom button.active { color: var(--accent); }

    /* ---------- COMPONENTI ---------- */
    .card {
      background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
      padding: 16px; margin-bottom: 14px;
    }
    .card > h2 {
      font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em;
      color: var(--muted); font-weight: 700; margin-bottom: 12px;
    }
    .section-title { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 14px; }

    .tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
    .tile {
      background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
      padding: 14px;
    }
    .tile .label { font-size: 0.7rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
    .tile .val { font-size: 1.75rem; font-weight: 700; margin-top: 6px; letter-spacing: -0.03em; line-height: 1.1; }
    .tile .val small { font-size: 0.9rem; font-weight: 600; color: var(--text-2); letter-spacing: 0; }
    .tile .foot { font-size: 0.72rem; color: var(--muted); margin-top: 4px; }

    .status-line { display: flex; align-items: center; gap: 7px; font-size: 0.76rem; font-weight: 650; margin-top: 6px; }
    .status-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }

    label { display: block; font-size: 0.75rem; font-weight: 650; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
    input, select, textarea {
      width: 100%; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px;
      background: var(--surface-2); color: var(--text); font-size: 1rem; font-family: inherit;
      -webkit-appearance: none; appearance: none; min-height: 48px;
    }
    input:focus, select, textarea:focus { outline: none; }
    input:focus, textarea:focus, select:focus { border-color: var(--accent); }
    select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
             background-position: calc(100% - 20px) 21px, calc(100% - 14px) 21px; background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; }
    textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
    .field { margin-bottom: 14px; }

    .btn {
      background: var(--accent); color: #fff; border: none; padding: 14px 18px;
      border-radius: 13px; font-weight: 650; font-size: 0.98rem; cursor: pointer;
      width: 100%; min-height: 50px; font-family: inherit;
      display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    }
    .btn:active { transform: scale(0.99); }
    .btn:disabled { opacity: 0.5; }
    .btn-ghost { background: transparent; color: var(--text-2); border: 1px solid var(--border); }
    .btn-danger { background: transparent; color: #fca5a5; border: 1px solid #7f1d1d; }
    .btn-sm { width: auto; padding: 9px 14px; font-size: 0.85rem; min-height: 40px; border-radius: 11px; }
    .btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

    .seg { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
    .seg button {
      flex: 1; background: none; border: none; color: var(--muted); font-weight: 650;
      font-size: 0.83rem; padding: 9px 6px; border-radius: 9px; cursor: pointer; font-family: inherit; min-height: 38px;
    }
    .seg button.active { background: var(--accent); color: #fff; }

    .chips { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
    .chips button {
      padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
      background: transparent; color: var(--muted); font-size: 0.8rem; font-weight: 600;
      cursor: pointer; font-family: inherit; min-height: 36px;
    }
    .chips button.active { background: var(--accent); color: #fff; border-color: var(--accent); }

    .empty { text-align: center; padding: 26px 16px; color: var(--muted); font-size: 0.88rem; }
    .empty strong { display: block; color: var(--text-2); font-size: 0.95rem; margin-bottom: 5px; }

    .hint { font-size: 0.78rem; color: var(--muted); line-height: 1.5; }
    .disclaimer {
      background: rgba(250,178,25,0.09); border: 1px solid rgba(250,178,25,0.32); color: #fcd68a;
      padding: 11px 13px; border-radius: 12px; font-size: 0.78rem; margin-bottom: 14px; line-height: 1.5;
      display: flex; gap: 9px;
    }
    .disclaimer svg { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; stroke: currentColor; fill: none; stroke-width: 2; }

    /* ---------- LOGGER ---------- */
    .log-head {
      position: sticky; top: 0; z-index: 30; margin: -16px -16px 14px;
      padding: 12px 16px; background: rgba(11,17,32,0.94);
      backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
      border-bottom: 1px solid var(--border-soft);
      display: flex; align-items: center; justify-content: space-between; gap: 12px;
    }
    .log-head .meta { font-size: 0.74rem; color: var(--muted); font-weight: 600; }
    .log-head .day { font-size: 1.05rem; font-weight: 700; }

    .ex {
      background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
      padding: 14px; margin-bottom: 12px;
    }
    .ex.done { border-color: rgba(12,163,12,0.45); }
    .ex-top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 3px; }
    .ex-num {
      width: 24px; height: 24px; border-radius: 8px; background: var(--surface-2);
      color: var(--muted); font-size: 0.74rem; font-weight: 700;
      display: flex; align-items: center; justify-content: center; flex: 0 0 auto; margin-top: 1px;
    }
    .ex.done .ex-num { background: var(--good); color: #fff; }
    .ex-name { font-size: 0.98rem; font-weight: 650; line-height: 1.3; }
    .ex-target { font-size: 0.75rem; color: var(--muted); margin: 2px 0 0 34px; }
    .ex-last {
      margin: 9px 0 0 34px; font-size: 0.75rem; color: var(--text-2);
      background: var(--surface-2); border-radius: 9px; padding: 7px 10px;
      display: flex; gap: 7px; align-items: baseline; flex-wrap: wrap;
    }
    .ex-last b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
    .ex-last .when { color: var(--muted); font-size: 0.7rem; }

    .sets { margin-top: 12px; }
    .sets-header {
      display: grid; grid-template-columns: 34px 1fr 16px 1fr 44px; gap: 8px; align-items: center;
      font-size: 0.63rem; font-weight: 750; color: var(--muted);
      text-transform: uppercase; letter-spacing: 0.09em; margin-bottom: 7px; padding: 0 2px;
    }
    .sets-header .c { text-align: center; }
    .set-row {
      display: grid; grid-template-columns: 34px 1fr 16px 1fr 44px; gap: 8px; align-items: center;
      margin-bottom: 8px;
    }
    .set-n {
      font-size: 0.8rem; font-weight: 700; color: var(--muted); text-align: center;
      font-variant-numeric: tabular-nums;
    }
    .set-x { text-align: center; color: var(--muted); font-size: 0.85rem; }
    .set-row input {
      margin: 0; text-align: center; padding: 12px 4px; font-size: 1.05rem; font-weight: 650;
      font-variant-numeric: tabular-nums; min-height: 50px;
    }
    .set-row input::placeholder { color: #5b6b83; font-weight: 500; }
    .set-tick {
      width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border);
      background: var(--surface-2); color: var(--muted); cursor: pointer;
      display: flex; align-items: center; justify-content: center; padding: 0;
    }
    .set-tick svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.32; }
    .set-tick.on { background: var(--good); border-color: var(--good); color: #fff; }
    .set-tick.on svg { opacity: 1; }
    .set-actions { display: flex; gap: 8px; margin-top: 4px; }
    .set-actions button {
      flex: 1; background: var(--surface-2); border: 1px dashed var(--border); color: var(--muted);
      border-radius: 11px; padding: 9px; font-size: 0.8rem; font-weight: 600; cursor: pointer; font-family: inherit; min-height: 40px;
    }

    /* timer recupero */
    .rest {
      position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom));
      max-width: 496px; margin: 0 auto; z-index: 60;
      background: var(--accent); color: #fff; border-radius: 14px; padding: 12px 16px;
      display: none; align-items: center; justify-content: space-between; gap: 12px;
      box-shadow: 0 10px 30px rgba(0,0,0,0.45);
    }
    .rest .t { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
    .rest .lbl { font-size: 0.72rem; opacity: 0.85; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
    .rest button { background: rgba(255,255,255,0.2); border: none; color: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 650; font-size: 0.82rem; cursor: pointer; font-family: inherit; min-height: 38px; }

    /* ---------- LISTE ---------- */
    .row {
      display: flex; align-items: center; justify-content: space-between; gap: 12px;
      padding: 13px 0; border-bottom: 1px solid var(--border-soft);
    }
    .row:last-child { border-bottom: none; }
    .row .k { font-size: 0.88rem; }
    .row .v { font-weight: 650; font-variant-numeric: tabular-nums; }
    details.item {
      background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px;
      padding: 13px; margin-bottom: 9px;
    }
    details.item > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
    details.item > summary::-webkit-details-marker { display: none; }
    details.item .sum-main { font-weight: 650; font-size: 0.92rem; }
    details.item .sum-sub { font-size: 0.74rem; color: var(--muted); margin-top: 2px; }
    details.item .body { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); font-size: 0.85rem; }

    /* altezza esplicita: include la fascia delle etichette dell'asse x,
       così il grafico non genera uno scroll interno nella card */
    .chart-wrap {
      background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px;
      padding: 12px 10px;
    }
    /* altezza definita sul box interno: Chart.js ci dimensiona dentro il canvas,
       comprese le etichette dell'asse x, senza generare scroll nella card */
    .chart-box { position: relative; height: 238px; }
    .chart-box canvas { display: block; }
    .legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 2px 2px; font-size: 0.76rem; color: var(--text-2); }
    .legend span { display: inline-flex; align-items: center; gap: 7px; }
    .legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
    .legend i.dot { width: 9px; height: 9px; border-radius: 50%; }

    pre.prompt {
      background: #060b16; color: var(--text-2); padding: 13px; border-radius: 12px;
      font-size: 0.72rem; overflow-x: auto; white-space: pre-wrap; max-height: 300px;
      border: 1px solid var(--border); margin-top: 12px; line-height: 1.5;
    }

    .toast {
      position: fixed; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); left: 50%;
      transform: translateX(-50%); background: var(--good); color: #fff;
      padding: 13px 22px; border-radius: 999px; font-weight: 650; font-size: 0.88rem;
      z-index: 200; display: none; box-shadow: 0 8px 26px rgba(0,0,0,0.5);
      max-width: 92%; text-align: center;
    }
    .toast.err { background: var(--critical); }
    .toast.info { background: var(--surface); border: 1px solid var(--border); }

    .update-bar {
      position: fixed; left: 0; right: 0; bottom: 0; z-index: 210;
      background: var(--accent); color: #fff; padding: 13px 16px;
      padding-bottom: calc(13px + env(safe-area-inset-bottom));
      display: none; align-items: center; justify-content: space-between; gap: 12px;
      font-size: 0.86rem; font-weight: 650; max-width: 520px; margin: 0 auto;
    }
    .update-bar button { background: #fff; color: var(--accent); border: none; border-radius: 999px; padding: 9px 17px; font-weight: 700; font-size: 0.84rem; min-height: 40px; }

/* ==================== v3: referti, attrezzi, editor scheda ==================== */

.avatar-btn {
  width: 36px; height: 36px; min-width: 36px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  padding: 0; cursor: pointer; overflow: hidden; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; font-family: inherit;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-btn img[hidden] { display: none; }

input.range {
  padding: 0; min-height: auto; background: transparent; border: none;
  -webkit-appearance: auto; appearance: auto; accent-color: var(--accent);
}

.seg-days { flex-wrap: wrap; }

/* --- zona di caricamento file --- */
.file-drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 1.5px dashed var(--border); border-radius: 14px;
  padding: 22px 16px; text-align: center; cursor: pointer;
  background: var(--surface-2); transition: border-color .15s, background .15s;
}
.file-drop:active { border-color: var(--accent); background: rgba(57,135,229,0.07); }
.file-drop svg { width: 26px; height: 26px; stroke: var(--accent); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 4px; }
.file-drop strong { font-size: 0.94rem; font-weight: 650; }
.file-drop span { font-size: 0.78rem; color: var(--muted); }

/* --- barra di avanzamento --- */
.progress { margin-top: 14px; }
.progress .bar { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s ease; }
.progress .msg { font-size: 0.78rem; color: var(--muted); margin-top: 7px; }

/* --- esiti dei valori --- */
.val-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center;
  padding: 11px 0; border-bottom: 1px solid var(--border-soft);
}
.val-row:last-child { border-bottom: none; }
.val-nome { font-size: 0.88rem; }
.val-nome small { display: block; color: var(--muted); font-size: 0.72rem; margin-top: 1px; }
.val-num { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.95rem; text-align: right; }
.val-num small { font-weight: 500; color: var(--muted); font-size: 0.72rem; }
.pill {
  font-size: 0.66rem; font-weight: 750; padding: 4px 9px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.pill.ok    { color: #7ee08a; background: rgba(12,163,12,0.14); }
.pill.alto  { color: #f7c76a; background: rgba(250,178,25,0.14); }
.pill.basso { color: #8fc4f5; background: rgba(57,135,229,0.16); }
.pill.grave { color: #f79a9a; background: rgba(208,59,59,0.16); }
.pill.na    { color: var(--muted); background: rgba(148,163,184,0.12); }

.delta { font-size: 0.72rem; font-weight: 650; }
.delta.su { color: #f7c76a; }
.delta.giu { color: #8fc4f5; }

/* --- riquadri di analisi --- */
.finding {
  border-radius: 13px; padding: 13px 14px; margin-bottom: 10px;
  border: 1px solid var(--border); background: var(--surface-2);
}
.finding .t { font-weight: 700; font-size: 0.9rem; margin-bottom: 5px; display: flex; align-items: center; gap: 8px; }
.finding .t i { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.finding p { font-size: 0.85rem; color: var(--text-2); line-height: 1.55; }
.finding.good     { border-color: rgba(12,163,12,0.42); }
.finding.good .t i     { background: var(--good); }
.finding.info     { border-color: rgba(57,135,229,0.42); }
.finding.info .t i     { background: var(--series-1); }
.finding.warning  { border-color: rgba(250,178,25,0.45); }
.finding.warning .t i  { background: var(--warning); }
.finding.critical { border-color: rgba(208,59,59,0.55); background: rgba(208,59,59,0.07); }
.finding.critical .t i { background: var(--critical); }

.legend i.band { width: 14px; height: 10px; border-radius: 3px; background: rgba(57,135,229,0.16); border: 1px solid rgba(57,135,229,0.35); }

/* --- attrezzi --- */
.equip-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.equip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
}
.equip img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--surface-2); }
.equip .body { padding: 10px 11px 12px; }
.equip .nome { font-size: 0.86rem; font-weight: 650; line-height: 1.25; }
.equip .meta { font-size: 0.7rem; color: var(--muted); margin-top: 3px; }
.equip .acts { display: flex; gap: 6px; margin-top: 9px; }
.equip .acts button {
  flex: 1; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  border-radius: 9px; padding: 7px; font-size: 0.72rem; font-weight: 600; cursor: pointer; font-family: inherit; min-height: 34px;
}

/* --- editor scheda --- */
.ex-edit {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 13px;
  padding: 11px 12px; margin-bottom: 9px;
}
.ex-edit .head { display: flex; align-items: center; gap: 10px; }
.ex-edit .nome { flex: 1; font-size: 0.9rem; font-weight: 650; line-height: 1.3; }
.ex-edit .sub { font-size: 0.73rem; color: var(--muted); margin-top: 2px; }
.icon-btn {
  width: 34px; height: 34px; min-width: 34px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); cursor: pointer; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 0.95rem;
}
.icon-btn:disabled { opacity: 0.3; }

/* --- foglio modale --- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(3,7,18,0.72); z-index: 300;
  display: none; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.sheet-backdrop.on { display: flex; }
.sheet {
  background: var(--bg); border: 1px solid var(--border); border-bottom: none;
  border-radius: 20px 20px 0 0; width: 100%; max-width: 520px;
  max-height: 88dvh; display: flex; flex-direction: column;
  animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--border-soft);
}
.sheet-head strong { font-size: 1.02rem; }
.sheet-head button {
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 0.9rem;
}
.sheet-body { padding: 16px 18px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; -webkit-overflow-scrolling: touch; }

.opt-row {
  display: flex; align-items: center; gap: 11px; padding: 12px 0;
  border-bottom: 1px solid var(--border-soft); cursor: pointer;
}
.opt-row:last-child { border-bottom: none; }
.opt-row .txt { flex: 1; }
.opt-row .txt b { font-size: 0.9rem; font-weight: 650; display: block; }
.opt-row .txt span { font-size: 0.74rem; color: var(--muted); }
.opt-row .chk {
  width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--border);
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: transparent; font-size: 0.75rem;
}
.opt-row.on .chk { background: var(--accent); border-color: var(--accent); color: #fff; }
