/* ===================================================================
   PezzaliGuard — style.css
   Operational dashboard aesthetic · dark, technical, refined.
   Mobile-first. Bottom-nav layout. Big touch targets.
   =================================================================== */

/* -------------------------------------------------------------------
   1. Tokens
   ------------------------------------------------------------------- */
:root {
  /* Surface */
  --bg:            #0a0e16;
  --bg-2:          #0e1320;
  --surface:       #131a2b;
  --surface-2:     #1a2236;
  --surface-3:     #222c44;
  --border:        #243049;
  --border-soft:   #1a2236;

  /* Text */
  --text:          #e8ecf3;
  --text-2:        #aab3c5;
  --text-3:        #6e788c;
  --text-faint:    #4a5366;

  /* Accents — three actions */
  --block:         #ff4d5e;          /* danger / red    */
  --block-soft:    rgba(255,77,94,.14);
  --block-border:  rgba(255,77,94,.32);

  --identify:      #ffb547;          /* warning / amber */
  --identify-soft: rgba(255,181,71,.14);
  --identify-border: rgba(255,181,71,.32);

  --whitelist:     #2bd486;          /* success / green */
  --whitelist-soft:rgba(43,212,134,.14);
  --whitelist-border:rgba(43,212,134,.34);

  --accent:        #6c8cff;          /* generic accent  */
  --accent-soft:   rgba(108,140,255,.14);

  /* Type */
  --font-sans: 'Sora', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Radii / shadows */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  18px;
  --r-xl:  24px;
  --shadow-sheet: 0 -20px 60px rgba(0,0,0,.55);
  --shadow-fab:  0 12px 28px rgba(255,77,94,.35);

  /* Layout */
  --nav-h: 68px;
  --header-h: 60px;

  /* Safe area (iOS notch / home bar) */
  --sa-top:    env(safe-area-inset-top, 0px);
  --sa-bottom: env(safe-area-inset-bottom, 0px);
}

/* -------------------------------------------------------------------
   2. Reset & base
   ------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(108,140,255,.07), transparent 60%),
    radial-gradient(800px 600px at -10% 110%, rgba(255,77,94,.06), transparent 60%),
    var(--bg);
  padding-bottom: calc(var(--nav-h) + var(--sa-bottom) + 84px);
}

button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

a { color: var(--accent); }

code {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-2);
}

::selection { background: rgba(108,140,255,.35); }

/* Hide native search clear in WebKit (we provide our own) */
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

/* Scrollbar (desktop) */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }


/* -------------------------------------------------------------------
   3. Header
   ------------------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--sa-top) + 12px) 18px 12px;
  background: linear-gradient(180deg, rgba(10,14,22,.92) 0%, rgba(10,14,22,.78) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(160deg, #1d2540, #131a2b);
  border: 1px solid var(--border);
  flex: none;
}
.brand-text { min-width: 0; }
.brand-title {
  font-weight: 700;
  letter-spacing: -.01em;
  font-size: 17px;
}
.brand-sub {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: .08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--text-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn:active { transform: scale(.96); }


/* -------------------------------------------------------------------
   4. Main / views
   ------------------------------------------------------------------- */
.app-main {
  padding: 18px 16px 40px;
  max-width: 720px;
  margin: 0 auto;
}
.view { display: none; animation: fade .26s ease both; }
.view.active { display: block; }

@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

.section-title {
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--text-3);
  font-weight: 600;
  margin: 28px 4px 12px;
}

.section-title:first-of-type { margin-top: 22px; }


/* -------------------------------------------------------------------
   5. Hero card (dashboard)
   ------------------------------------------------------------------- */
.hero-card {
  position: relative;
  overflow: hidden;
  padding: 22px 22px 18px;
  border-radius: var(--r-xl);
  background:
    radial-gradient(600px 240px at 100% 0%, rgba(108,140,255,.18), transparent 60%),
    linear-gradient(160deg, #1a2238 0%, #131a2b 100%);
  border: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(transparent 95%, rgba(255,255,255,.03) 100%),
    linear-gradient(90deg, transparent 95%, rgba(255,255,255,.03) 100%);
  background-size: 24px 24px;
  pointer-events: none;
  mask-image: radial-gradient(circle at 100% 0%, black, transparent 70%);
}

.hero-row {
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1;
}
.hero-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--text-3);
  font-weight: 600;
}
.hero-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--whitelist-soft);
  color: var(--whitelist);
  border: 1px solid var(--whitelist-border);
  letter-spacing: .04em;
}
.hero-pill.warn { background: var(--identify-soft); color: var(--identify); border-color: var(--identify-border); }
.hero-pill.bad  { background: var(--block-soft);    color: var(--block);    border-color: var(--block-border); }

.hero-big {
  font-family: var(--font-mono);
  font-size: 56px;
  font-weight: 600;
  line-height: 1;
  margin: 14px 0 4px;
  letter-spacing: -.03em;
  position: relative; z-index: 1;
  color: var(--text);
}
.hero-sublabel {
  color: var(--text-2);
  font-size: 13.5px;
  position: relative; z-index: 1;
}
.hero-meta {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
  position: relative; z-index: 1;
}
.hero-meta strong { color: var(--text-2); font-weight: 500; }
.hero-version {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}


/* -------------------------------------------------------------------
   6. Stat grid (dashboard)
   ------------------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}
.stat-card {
  padding: 14px 12px 12px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  display: flex; flex-direction: column; gap: 6px;
  min-width: 0;
}
.stat-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
}
.stat-num {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin-top: 6px;
}
.stat-label {
  font-size: 11.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-block    .stat-icon { color: var(--block);    background: var(--block-soft); }
.stat-identify .stat-icon { color: var(--identify); background: var(--identify-soft); }
.stat-whitelist .stat-icon{ color: var(--whitelist);background: var(--whitelist-soft); }
.stat-block    .stat-num { color: var(--block); }
.stat-identify .stat-num { color: var(--identify); }
.stat-whitelist .stat-num{ color: var(--whitelist); }


/* -------------------------------------------------------------------
   7. Quick actions
   ------------------------------------------------------------------- */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.qa-btn {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  text-align: left;
  min-height: 66px;
  transition: background .14s, border-color .14s, transform .14s;
}
.qa-btn:hover  { background: var(--surface-2); border-color: var(--border); }
.qa-btn:active { transform: scale(.98); }
.qa-icon {
  flex: none;
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--surface-3);
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 18px;
  color: var(--text);
}
.qa-icon-green  { background: var(--whitelist-soft); color: var(--whitelist); }
.qa-icon-blue   { background: var(--accent-soft);    color: var(--accent); }
.qa-icon-amber  { background: var(--identify-soft);  color: var(--identify); }

.qa-text { display: flex; flex-direction: column; min-width: 0; }
.qa-text strong { font-size: 14px; font-weight: 600; line-height: 1.25;
                  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qa-text small  { color: var(--text-3); font-size: 11.5px; margin-top: 2px;
                  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.qa-primary { background: linear-gradient(160deg, #2a1820 0%, #1a1320 100%);
              border-color: var(--block-border); }
.qa-primary .qa-icon { background: var(--block-soft); color: var(--block); }


/* -------------------------------------------------------------------
   8. Recent / list cards
   ------------------------------------------------------------------- */
.recent-list, .entry-list {
  display: flex; flex-direction: column; gap: 8px;
}
.empty-state {
  padding: 32px 18px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px dashed var(--border);
  text-align: center;
  color: var(--text-2);
}
.empty-state p { margin: 0; }
.empty-state .empty-sub { color: var(--text-3); font-size: 13px; margin-top: 6px; }

.entry {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  transition: background .14s, border-color .14s;
}
.entry:hover { background: var(--surface-2); border-color: var(--border); }
.entry:active { transform: scale(.995); }

.entry-badge {
  width: 8px; height: 44px;
  border-radius: 4px;
  background: var(--text-faint);
}
.entry[data-action="block"]      .entry-badge { background: var(--block); }
.entry[data-action="identify"]   .entry-badge { background: var(--identify); }
.entry[data-action="whitelist"]  .entry-badge { background: var(--whitelist); }

.entry-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.entry-num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-meta {
  display: flex; gap: 8px; align-items: center;
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-tag {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 500;
}
.entry[data-action="block"]    .entry-tag { background: var(--block-soft);    color: var(--block); }
.entry[data-action="identify"] .entry-tag { background: var(--identify-soft); color: var(--identify); }
.entry[data-action="whitelist"].entry-tag { background: var(--whitelist-soft);color: var(--whitelist); }

.entry-action {
  background: transparent;
  border: 0;
  color: var(--text-3);
  padding: 8px;
  border-radius: 8px;
}
.entry-action:hover { color: var(--text); background: var(--surface-3); }


/* -------------------------------------------------------------------
   9. Search bar / filter chips / list meta
   ------------------------------------------------------------------- */
.search-bar {
  position: relative;
  margin: 6px 0 14px;
}
.search-bar input {
  width: 100%;
  padding: 12px 38px 12px 40px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color .14s, background .14s;
}
.search-bar input:focus { border-color: var(--accent); background: var(--surface-2); }
.search-bar input::placeholder { color: var(--text-3); }
.search-icon {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none;
}
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 8px;
  background: transparent; border: 0;
  color: var(--text-3); font-size: 22px; line-height: 1;
  display: none;
}
.search-bar.has-value .search-clear { display: grid; place-items: center; }
.search-clear:hover { background: var(--surface-3); color: var(--text); }

.filter-chips {
  display: flex; gap: 8px; margin-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: all .14s;
}
.chip:hover { border-color: var(--border); }
.chip.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  font-weight: 600;
}

.list-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin: 4px 4px 12px;
  font-size: 12px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.link-btn {
  background: transparent; border: 0;
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}
.link-btn:hover { background: var(--accent-soft); }


/* -------------------------------------------------------------------
   10. Tools view
   ------------------------------------------------------------------- */
.tool-group {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 6px;
}
.tool-btn {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  text-align: left;
  transition: background .14s, border-color .14s;
}
.tool-btn:hover { background: var(--surface-2); border-color: var(--border); }
.tool-btn:active { transform: scale(.99); }
.tool-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--surface-3);
  display: grid; place-items: center;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: .04em;
  color: var(--text);
}
.tool-text { display: flex; flex-direction: column; min-width: 0; }
.tool-text strong { font-size: 14.5px; font-weight: 600; }
.tool-text small  { font-size: 12.5px; color: var(--text-3); margin-top: 2px; line-height: 1.4; }
.tool-text small code { font-size: 11.5px; }

.tool-danger { border-color: var(--block-border); background: linear-gradient(160deg, rgba(255,77,94,.06), transparent); }
.tool-danger .tool-icon { background: var(--block-soft); color: var(--block); }
.tool-danger:hover { background: var(--block-soft); }

.info-banner {
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-2);
  margin: 4px 0 14px;
  border: 1px solid var(--border);
}
.info-banner-green {
  background: var(--whitelist-soft);
  border-color: var(--whitelist-border);
  color: #cfeedd;
}

.info-card {
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  font-size: 13.5px;
  color: var(--text-2);
}
.info-card p { margin: 0 0 10px; }
.info-card p:last-child { margin-bottom: 0; }
.dot-list { list-style: none; padding: 0; margin: 6px 0 12px; display: flex; flex-direction: column; gap: 6px; }
.dot-list li { position: relative; padding-left: 18px; }
.dot-list li::before {
  content: ""; position: absolute; left: 4px; top: 9px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.info-warn {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--identify-soft);
  border: 1px solid var(--identify-border);
  color: #ffe1b3;
  font-size: 12.5px;
}
.info-warn strong { color: var(--identify); }

.footer-credit {
  margin-top: 30px;
  padding: 18px 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.footer-credit .footer-line { margin-bottom: 8px; }
.footer-credit .footer-author {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.55;
}
.footer-credit .footer-author a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.footer-credit .footer-author a:hover { text-decoration: underline; }
.footer-credit .footer-heart {
  display: inline-block;
  animation: heartbeat 1.6s ease-in-out infinite;
  text-transform: none;
  letter-spacing: 0;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  20%      { transform: scale(1.18); }
  40%      { transform: scale(1); }
  60%      { transform: scale(1.12); }
  80%      { transform: scale(1); }
}


/* -------------------------------------------------------------------
   11. FAB
   ------------------------------------------------------------------- */
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(var(--nav-h) + var(--sa-bottom) + 14px);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(160deg, #ff5b6b, #c92e3f);
  color: white;
  border: 0;
  display: grid; place-items: center;
  box-shadow: var(--shadow-fab);
  z-index: 25;
  transition: transform .15s;
}
.fab:hover  { transform: translateY(-2px); }
.fab:active { transform: scale(.94); }


/* -------------------------------------------------------------------
   12. Bottom nav
   ------------------------------------------------------------------- */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + var(--sa-bottom));
  padding-bottom: var(--sa-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(10,14,22,.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border-soft);
  z-index: 20;
}
.nav-btn {
  background: transparent; border: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  color: var(--text-3);
  font-size: 10.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 500;
  padding: 6px;
  transition: color .14s;
}
.nav-btn svg { transition: transform .15s; }
.nav-btn.active { color: var(--text); }
.nav-btn.active svg { transform: scale(1.06); }
.nav-btn.active::after {
  content: "";
  position: absolute;
  top: 6px;
  width: 28px; height: 3px;
  border-radius: 2px;
  background: var(--block);
  transform: translateX(0);
}
.nav-btn { position: relative; }


/* -------------------------------------------------------------------
   13. Modal / sheet
   ------------------------------------------------------------------- */
.modal {
  position: fixed; inset: 0;
  z-index: 100;
  display: grid;
  align-items: end;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fade .2s ease both;
}
.modal-sheet {
  position: relative;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 24px 24px 0 0;
  padding: 8px 18px calc(20px + var(--sa-bottom));
  box-shadow: var(--shadow-sheet);
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .28s cubic-bezier(.2,.8,.2,1) both;
  width: 100%;
}
.modal-sheet-sm { max-height: none; padding-bottom: calc(24px + var(--sa-bottom)); }
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: none; }
}
.modal-grip {
  width: 40px; height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  margin: 6px auto 14px;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 4px;
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.modal-body { padding: 0 4px; }


/* -------------------------------------------------------------------
   14. Form
   ------------------------------------------------------------------- */
.field { display: block; margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-3);
  font-weight: 600;
  margin-bottom: 6px;
}
.field-label small { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-faint); }
.field-hint { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 6px; }
.field-meta { font-size: 11.5px; color: var(--text-faint); margin: -4px 4px 14px; font-family: var(--font-mono); }

.field input,
.field select,
.field textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 15.5px;
  outline: none;
  transition: border-color .14s, background .14s;
  font-family: var(--font-sans);
}
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--accent); background: var(--surface-2); }
.field textarea { resize: vertical; min-height: 56px; }
.field input[type="tel"] { font-family: var(--font-mono); letter-spacing: .02em; }
.field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(-45deg, transparent 50%, var(--text-3) 50%);
  background-size: 6px 6px, 6px 6px;
  background-position: calc(100% - 16px) center, calc(100% - 10px) center;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.action-toggle {
  border: 0;
  margin: 4px 0 14px;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.action-toggle legend {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-3);
  font-weight: 600;
  margin-bottom: 8px;
  padding: 0;
}
.toggle-opt {
  position: relative;
  display: block;
  cursor: pointer;
}
.toggle-opt input { position: absolute; opacity: 0; }
.toggle-opt span {
  display: flex; flex-direction: column; gap: 2px;
  padding: 12px 10px;
  border-radius: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  text-align: center;
  transition: all .14s;
}
.toggle-opt strong { font-size: 13px; font-weight: 600; }
.toggle-opt small  { font-size: 10.5px; color: var(--text-3); line-height: 1.3; }

.toggle-opt input:checked + span { transform: translateY(-1px); }
.toggle-identify  input:checked + span { background: var(--identify-soft);  border-color: var(--identify);  color: var(--identify); }
.toggle-identify  input:checked + span small { color: var(--identify); opacity: .85; }
.toggle-block     input:checked + span { background: var(--block-soft);     border-color: var(--block);     color: var(--block); }
.toggle-block     input:checked + span small { color: var(--block); opacity: .85; }
.toggle-whitelist input:checked + span { background: var(--whitelist-soft); border-color: var(--whitelist); color: var(--whitelist); }
.toggle-whitelist input:checked + span small { color: var(--whitelist); opacity: .85; }


/* -------------------------------------------------------------------
   15. Buttons
   ------------------------------------------------------------------- */
.modal-actions {
  display: flex; gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.btn {
  flex: 1;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: all .14s;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn:active { transform: scale(.97); }

.btn-primary {
  background: linear-gradient(160deg, #ff5b6b, #c92e3f);
  color: white;
  box-shadow: 0 6px 18px rgba(255,77,94,.28);
}
.btn-primary:hover { filter: brightness(1.05); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-3); }

.btn-ghost {
  background: transparent;
  color: var(--block);
  border-color: var(--block-border);
  flex: 0 1 auto;
}
.btn-ghost:hover { background: var(--block-soft); }

.btn-danger {
  background: linear-gradient(160deg, #ff5b6b, #c92e3f);
  color: white;
}


/* -------------------------------------------------------------------
   16. Toasts
   ------------------------------------------------------------------- */
.toast-stack {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--nav-h) + var(--sa-bottom) + 84px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  max-width: 88%;
  padding: 11px 16px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px;
  box-shadow: 0 12px 28px rgba(0,0,0,.4);
  animation: toastIn .2s ease both, toastOut .25s ease 2.4s both;
}
.toast.success { background: var(--whitelist-soft); border-color: var(--whitelist-border); color: #b6f0d2; }
.toast.error   { background: var(--block-soft);    border-color: var(--block-border);    color: #ffc6cd; }
.toast.warn    { background: var(--identify-soft); border-color: var(--identify-border); color: #ffe2b3; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px); }
}

.confirm-msg { font-size: 14.5px; color: var(--text-2); margin: 4px 4px 0; line-height: 1.55; }


/* -------------------------------------------------------------------
   17. Larger screens
   ------------------------------------------------------------------- */
@media (min-width: 720px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .hero-big { font-size: 64px; }
  .modal-sheet {
    max-width: 520px;
    margin: 0 auto;
    border-radius: 20px;
    margin-bottom: 24px;
  }
  .modal { align-items: center; }
}

@media (min-width: 980px) {
  .quick-actions { grid-template-columns: repeat(4, 1fr); }
}

/* -------------------------------------------------------------------
   18. Community lists (Strumenti view)
   ------------------------------------------------------------------- */
.community-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px 12px;
  align-items: start;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-md);
  transition: background .14s, border-color .14s;
}
.community-card:hover { background: var(--surface-2); border-color: var(--border); }
.community-card.is-loading { border-color: var(--accent); }
.community-card.is-success { border-color: var(--whitelist-border); background: linear-gradient(160deg, rgba(43,212,134,.06), transparent); }
.community-card.is-error   { border-color: var(--block-border);   background: linear-gradient(160deg, rgba(255,77,94,.06), transparent); }

.community-card-main { min-width: 0; grid-column: 1 / -1; }
.community-card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: 4px;
}
.community-card-badge {
  flex: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
}
.community-card-badge.local { background: var(--whitelist-soft); color: var(--whitelist); }
.community-card-badge.cdn   { background: var(--accent-soft);    color: var(--accent); }

.community-card-desc {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.5;
  margin-bottom: 8px;
}
.community-card-meta {
  display: flex; flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 11px;
  color: var(--text-faint);
  font-family: var(--font-mono);
}
.community-card-meta strong { color: var(--text-3); font-weight: 500; }

.community-card-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--border-soft);
}
.community-import-btn {
  flex: 1;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .14s, border-color .14s, transform .14s;
}
.community-import-btn:hover  { background: var(--surface-3); border-color: var(--accent); }
.community-import-btn:active { transform: scale(.98); }
.community-import-btn[disabled] { opacity: .55; cursor: progress; }
.community-import-btn.primary {
  background: linear-gradient(160deg, var(--accent), #4763d8);
  border-color: var(--accent);
  color: white;
}
.community-spinner {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.community-warn {
  font-size: 11.5px;
  color: var(--identify);
  background: var(--identify-soft);
  border: 1px solid var(--identify-border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 8px;
  line-height: 1.45;
}

/* -------------------------------------------------------------------
   19. Prefix warnings (form banner + info section in Strumenti)
   ------------------------------------------------------------------- */

/* Banner sotto il campo numero in add/edit modal */
.prefix-warning {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 12.5px;
  line-height: 1.45;
  animation: fade .2s ease both;
}
.prefix-warning[hidden] { display: none; }

.prefix-warning-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.prefix-warning-head strong { font-size: 13px; font-weight: 600; }
.prefix-warning-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--text-3);
  white-space: nowrap;
}
.prefix-warning-desc { color: var(--text-2); }

/* Severity variants — shared across form banner and info cards */
.sev-danger {
  background: var(--block-soft);
  border-color: var(--block-border);
  color: #ffd0d6;
}
.sev-danger .prefix-warning-head strong,
.sev-danger .prefix-cat-head strong { color: var(--block); }

.sev-warning {
  background: var(--identify-soft);
  border-color: var(--identify-border);
  color: #ffe2b3;
}
.sev-warning .prefix-warning-head strong,
.sev-warning .prefix-cat-head strong { color: var(--identify); }

.sev-info {
  background: var(--accent-soft);
  border-color: rgba(108,140,255,.34);
  color: #c8d3ff;
}
.sev-info .prefix-warning-head strong,
.sev-info .prefix-cat-head strong { color: var(--accent); }

/* Info section in Strumenti */
.prefix-cat-list {
  display: flex; flex-direction: column; gap: 10px;
}
.prefix-cat {
  padding: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
}
.prefix-cat.sev-danger  { background: linear-gradient(160deg, rgba(255,77,94,.06),  transparent); border-color: var(--block-border); }
.prefix-cat.sev-warning { background: linear-gradient(160deg, rgba(255,181,71,.06), transparent); border-color: var(--identify-border); }
.prefix-cat.sev-info    { background: linear-gradient(160deg, rgba(108,140,255,.06), transparent); border-color: rgba(108,140,255,.34); }

.prefix-cat-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.prefix-cat-head strong { font-size: 14px; font-weight: 600; }
.prefix-pending-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
}
.prefix-cat-desc {
  font-size: 12.5px;
  color: var(--text-2);
  margin: 0 0 10px;
  line-height: 1.5;
}
.prefix-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.prefix-list li {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  padding: 4px 9px;
  border-radius: 8px;
  color: var(--text);
}
.prefix-list .muted { color: var(--text-3); font-size: 10.5px; }
.prefix-pending {
  font-size: 12px;
  color: var(--text-3);
  margin: 8px 0 0;
}

/* -------------------------------------------------------------------
   20. Onboarding banner (first-visit welcome)
   ------------------------------------------------------------------- */
.onboarding-banner {
  background: linear-gradient(160deg, var(--accent-soft), transparent);
  border: 1px solid rgba(108,140,255,.4);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 16px;
  animation: fade .25s ease both;
}
.onboarding-banner[hidden] { display: none; }

.onboarding-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.onboarding-title {
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
  font-size: 15px;
}
.onboarding-title strong { font-weight: 600; }
.onboarding-icon {
  display: inline-flex;
  width: 24px; height: 24px;
  align-items: center; justify-content: center;
  color: var(--accent);
}
.onboarding-close {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--text-3);
  font-size: 22px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.onboarding-close:hover { background: var(--surface-3); color: var(--text); }

.onboarding-intro {
  font-size: 13px;
  color: var(--text-2);
  margin: 0 0 12px;
  line-height: 1.5;
}

.onboarding-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.onboarding-steps li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
}
.onboarding-step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex: none;
}
.onboarding-step-text { min-width: 0; }
.onboarding-step-text strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
}
.onboarding-step-text small {
  display: block;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.4;
  margin-top: 2px;
}
.onboarding-step-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  flex: none;
  transition: background .14s, color .14s;
}
.onboarding-step-btn:hover { background: var(--accent); color: white; }

.onboarding-dismiss {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 10px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  transition: background .14s, color .14s;
}
.onboarding-dismiss:hover { background: var(--surface-3); color: var(--text); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
