/* Carby – Ricerca grafica · stile comune (mobile first) */
:root {
  --bg: #F5F3EF; --surface: #FFFFFF; --surface-2: #EEEAE3; --ink: #15171C; --ink-2: #5E6470; --ink-3: #8A909B;
  --line: #E4DFD6; --accent: #F2542D; --accent-press: #D9431F; --accent-soft: #FDE6DF; --on-accent: #FFFFFF;
  --ok: #12A150; --ok-soft: #DDF3E6; --warn: #C98300; --warn-soft: #FBEFD5; --bad: #D93A2B; --bad-soft: #FBE1DE;
  --shadow: 0 1px 2px rgba(21,23,28,.06), 0 8px 24px rgba(21,23,28,.08);
  --shadow-lg: 0 12px 40px rgba(21,23,28,.18);
  --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D0F12; --surface: #171A1F; --surface-2: #20242B; --ink: #F2F3F5; --ink-2: #A2A8B3; --ink-3: #737A86;
    --line: #2A2F37; --accent: #FF6A43; --accent-press: #FF835F; --accent-soft: #3A1E16; --on-accent: #FFFFFF;
    --ok: #34C77B; --ok-soft: #12301F; --warn: #F0B23A; --warn-soft: #33270E; --bad: #FF6B5E; --bad-soft: #3A1714;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.45 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
       min-height: 100dvh; overscroll-behavior-y: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* barra superiore */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
          padding: calc(10px + var(--safe-t)) 16px 10px; background: color-mix(in srgb, var(--bg) 85%, transparent);
          backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.01em; font-size: 17px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand small { display: block; font-size: 12px; font-weight: 500; color: var(--ink-3); letter-spacing: 0; margin-top: -2px; }
.topbar .spacer { flex: 1; }
.iconbtn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--surface); box-shadow: var(--shadow);
           display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.iconbtn:active { transform: scale(.94); }
.iconbtn svg { width: 20px; height: 20px; }

/* pulsanti */
.btn { appearance: none; border: 0; border-radius: var(--r-md); min-height: 56px; padding: 0 20px; width: 100%;
       display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 650; font-size: 17px;
       cursor: pointer; transition: transform .12s ease, background-color .15s ease, opacity .15s; user-select: none; }
.btn:active { transform: scale(.98); }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-primary:active { background: var(--accent-press); }
.btn-secondary { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--ink-2); min-height: 48px; }
.btn-ok { background: var(--ok); color: #fff; box-shadow: 0 6px 18px color-mix(in srgb, var(--ok) 35%, transparent); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-sm { min-height: 40px; font-size: 15px; border-radius: 12px; padding: 0 14px; width: auto; }

/* superfici */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; padding: 4px 10px; border-radius: 99px; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.alta { background: var(--ok-soft); color: var(--ok); }
.pill.media { background: var(--warn-soft); color: var(--warn); }
.pill.bassa { background: var(--bad-soft); color: var(--bad); }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0;
         background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 15px;
         box-shadow: var(--shadow-lg); z-index: 100; transition: all .25s cubic-bezier(.2,.8,.2,1); pointer-events: none;
         max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* pannello dal basso */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 60; }
.scrim.show { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; background: var(--surface); border-radius: 26px 26px 0 0;
         padding: 10px 20px calc(20px + var(--safe-b)); transform: translateY(105%); transition: transform .32s cubic-bezier(.2,.8,.2,1);
         max-width: 640px; margin: 0 auto; box-shadow: var(--shadow-lg); max-height: 92dvh; overflow: auto; }
.sheet.show { transform: translateY(0); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.02em; }
.sheet p { margin: 0 0 16px; color: var(--ink-2); }

.field { width: 100%; font: inherit; font-size: 17px; padding: 15px 16px; border-radius: 14px; border: 1.5px solid var(--line);
         background: var(--bg); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
label.lbl { display: block; font-size: 14px; font-weight: 650; color: var(--ink-2); margin: 0 0 8px 2px; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
