/* ============================================================================
   PROMPTICA · DEMO KIT — neon-dark app UI design system
   Pavimento di qualità condiviso per le demo automazioni. Brand: navy + due neon
   (cyan #38e8ff, violet #a06bff). Zero dipendenze runtime. Linka con:
     <link rel="stylesheet" href="../_kit/kit.css">
   Per cambiare accento di una demo: <body class="app" style="--accent:#7af0ff">
   ============================================================================ */

:root {
  /* ---- canvas / superfici (navy layered) ---- */
  --bg: #05060f;
  --surface: #0b0e1e;
  --surface-2: #10142a;
  --surface-3: #161b38;
  --raise: #1a224033;

  /* ---- testo ---- */
  --text: #eaf2ff;
  --text-dim: #b4c2e0;
  --text-faint: #6b7aa3;

  /* ---- linee ---- */
  --line: rgba(234, 242, 255, 0.08);
  --line-strong: rgba(234, 242, 255, 0.15);

  /* ---- accento (cyan neon — sovrascrivibile per demo) ---- */
  --accent: #38e8ff;
  --accent-2: #7af0ff;
  --accent-soft: #38e8ff1f;
  --accent-ink: #03141a;
  --accent-glow: 0 0 0 1px #38e8ff55, 0 10px 34px -12px #38e8ff7a;

  /* ---- secondo neon (violet) + extra ---- */
  --violet: #a06bff;
  --violet-soft: #a06bff1f;
  --mint: #7af0ff;

  /* ---- semantici ---- */
  --urgent: #ff5c7a;   --urgent-bg: #ff5c7a1c;
  --ok: #39d98a;       --ok-bg: #39d98a1a;
  --warn: #ffcf6b;     --warn-bg: #ffcf6b18;
  --info: #38e8ff;     --info-bg: #38e8ff16;
  --idle: #8b96bf;

  /* ---- tipografia fluida ---- */
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", var(--font);
  --fs-2xs: clamp(.62rem, .61rem + .08vw, .66rem);
  --fs-xs: clamp(.68rem, .67rem + .1vw, .72rem);
  --fs-sm: clamp(.78rem, .76rem + .12vw, .82rem);
  --fs-md: clamp(.86rem, .83rem + .15vw, .9rem);
  --fs-lg: clamp(1rem, .95rem + .3vw, 1.12rem);
  --fs-xl: clamp(1.25rem, 1.1rem + .6vw, 1.5rem);
  --fs-num: clamp(1.5rem, 1.2rem + 1.3vw, 2.15rem);

  /* ---- spazi / raggi ---- */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --r-sm: 8px; --r-md: 12px; --r-lg: 18px; --r-pill: 999px;

  /* ---- motion ---- */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --d-fast: 150ms; --d-med: 280ms; --d-slow: 520ms;

  /* ---- layout ---- */
  --topbar-h: 56px; --statusbar-h: 34px;
  --sidebar-w: 240px; --list-w: 380px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; max-width: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden; /* la shell non scrolla la pagina */
}
::selection { background: var(--accent-soft); color: var(--text); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
svg { display: block; }

/* glow ambientale in alto (due neon) */
body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 380px; pointer-events: none; z-index: 0;
  background:
    radial-gradient(820px 280px at 16% -130px, #38e8ff14, transparent 70%),
    radial-gradient(680px 240px at 88% -150px, #a06bff12, transparent 72%);
}

/* ---- scrollbar ---- */
.scroll { scrollbar-width: thin; scrollbar-color: #243056 transparent; }
.scroll::-webkit-scrollbar { width: 9px; height: 9px; }
.scroll::-webkit-scrollbar-thumb { background: #223; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
.scroll::-webkit-scrollbar-thumb:hover { background: #2c3a5a; }

/* ============================== APP SHELL ============================== */
.app {
  position: relative; z-index: 1;
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr var(--statusbar-h);
}
.app.no-status { grid-template-rows: var(--topbar-h) 1fr; }

/* layout principale: scegli una variante mettendola sull'elemento .main */
.main { display: grid; min-height: 0; overflow: hidden; }
.main.l-three { grid-template-columns: var(--sidebar-w) var(--list-w) minmax(0, 1fr); }
.main.l-two   { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.main.l-one   { grid-template-columns: minmax(0, 1fr); }
.main.l-board { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

/* ---------- TOPBAR ---------- */
.topbar {
  display: flex; align-items: center; gap: var(--s4);
  padding: 0 var(--s4); border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #0a0d1c, #070912);
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; user-select: none; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  background: radial-gradient(circle at 30% 30%, var(--accent), var(--violet));
  box-shadow: 0 4px 16px -4px var(--accent), inset 0 1px 0 #ffffff35;
}
.brand .mark svg { width: 15px; height: 15px; }
.brand .name { font-family: var(--font-display); font-weight: 700; letter-spacing: .14em; font-size: .8rem; }
.brand .name b { color: var(--accent); }

.search {
  flex: 1; max-width: 520px; margin: 0 auto; position: relative;
  display: flex; align-items: center; gap: 10px;
  height: 36px; padding: 0 12px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-faint);
  transition: border-color var(--d-fast), box-shadow var(--d-fast);
}
.search:hover { border-color: var(--line-strong); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search svg { width: 15px; height: 15px; opacity: .7; flex-shrink: 0; }
.search input { flex: 1; background: none; border: 0; color: var(--text); font-size: var(--fs-sm); outline: none; }
.search input::placeholder { color: var(--text-faint); }
.kbd {
  font-family: var(--font-display); font-weight: 600; font-size: .66rem; color: var(--text-dim);
  padding: 3px 6px; border-radius: 5px; background: #070a16; border: 1px solid var(--line-strong);
  line-height: 1; white-space: nowrap;
}
.top-right { display: flex; align-items: center; gap: var(--s3); flex-shrink: 0; }
.ai-pill {
  display: flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: var(--r-pill);
  background: var(--accent-soft); border: 1px solid #38e8ff40; color: var(--accent);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}
.ai-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 2.4s var(--ease) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #38e8ff70; } 70% { box-shadow: 0 0 0 7px #38e8ff00; } 100% { box-shadow: 0 0 0 0 #38e8ff00; } }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--text-dim); transition: background var(--d-fast), color var(--d-fast); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 17px; height: 17px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(140deg, #2a3358, #1a2240); border: 1px solid var(--line-strong);
  font-weight: 700; font-size: .74rem; color: #dfe6ff; flex-shrink: 0;
}

/* ---------- SIDEBAR ---------- */
.sidebar { border-right: 1px solid var(--line); background: #080a16; display: flex; flex-direction: column; min-height: 0; }
.cta {
  margin: var(--s4); height: 40px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: linear-gradient(145deg, var(--accent), var(--violet)); color: var(--accent-ink);
  font-weight: 700; font-size: var(--fs-sm);
  box-shadow: 0 6px 20px -8px var(--accent), inset 0 1px 0 #ffffff45;
  transition: transform var(--d-fast) var(--ease), box-shadow var(--d-fast);
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -8px var(--accent), inset 0 1px 0 #ffffff55; }
.cta:active { transform: translateY(0); }
.cta svg { width: 15px; height: 15px; }
.side-scroll { flex: 1; overflow-y: auto; min-height: 0; padding: 0 var(--s3) var(--s4); }
.side-group { margin-top: var(--s4); }
.side-label { font-size: .62rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--text-faint); padding: 0 10px; margin: 0 0 var(--s2); }
.nav {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text-dim); font-size: var(--fs-sm); font-weight: 500; text-align: left;
  transition: background var(--d-fast), color var(--d-fast); position: relative;
}
.nav:hover { background: var(--surface-2); color: var(--text); }
.nav.on { background: var(--accent-soft); color: var(--accent); }
.nav.on::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--accent); }
.nav .ico { width: 17px; height: 17px; flex-shrink: 0; opacity: .9; }
.nav .ico svg { width: 17px; height: 17px; }
.nav .cnt { margin-left: auto; font-size: var(--fs-xs); color: var(--text-faint); }

/* ---------- PANE / SECTIONS ---------- */
.pane { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.pane:last-child { border-right: 0; }
.pane-head { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s4); height: 52px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.pane-head h2 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.pane-head .sub { font-size: var(--fs-xs); color: var(--text-faint); }
.pane-body { flex: 1; overflow-y: auto; min-height: 0; }

/* ---------- LIST ROWS ---------- */
.row { display: flex; gap: var(--s3); padding: 12px var(--s4); border-bottom: 1px solid var(--line); cursor: pointer; transition: background var(--d-fast); }
.row:hover { background: var(--surface); }
.row.on { background: var(--accent-soft); }
.row .body { min-width: 0; flex: 1; }
.row .top { display: flex; align-items: center; gap: 8px; }
.row .who { font-weight: 600; font-size: var(--fs-sm); }
.row .time { margin-left: auto; font-size: var(--fs-2xs); color: var(--text-faint); }
.row .sub { font-size: var(--fs-sm); color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- KPI / STAT CARD ---------- */
.stat-grid { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s4); background: var(--surface); position: relative; overflow: hidden; }
.stat .label { font-size: var(--fs-xs); color: var(--text-faint); text-transform: uppercase; letter-spacing: .08em; }
.stat .num { font-family: var(--font-display); font-size: var(--fs-num); font-weight: 700; line-height: 1.1; margin-top: 4px; }
.stat .delta { font-size: var(--fs-xs); font-weight: 600; }
.stat .delta.up { color: var(--ok); } .stat .delta.down { color: var(--urgent); }

/* ---------- BADGE / PILL ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-pill); font-size: var(--fs-2xs); font-weight: 600; line-height: 1.3; }
.badge.urgent { background: var(--urgent-bg); color: var(--urgent); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.idle { background: #8b96bf18; color: var(--idle); }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---------- CHIP ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 500; background: var(--surface-2); border: 1px solid var(--line); color: var(--text-dim); transition: border-color var(--d-fast), color var(--d-fast); }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip.accent { background: var(--accent-soft); border-color: #38e8ff40; color: var(--accent); }

/* ---------- GLASS / GRADIENT BORDER ---------- */
.glass { background: color-mix(in oklab, var(--surface) 78%, transparent); backdrop-filter: blur(12px); border: 1px solid var(--line); }
.gborder { position: relative; border-radius: var(--r-lg); }
.gborder::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(135deg, var(--accent), var(--violet)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; opacity: .6; }

/* ---------- AI-SPARK CARD ---------- */
.ai-card { border: 1px solid #38e8ff33; background: linear-gradient(180deg, var(--accent-soft), transparent); border-radius: var(--r-md); padding: var(--s4); }
.ai-card .ai-head { display: flex; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }
.ai-card .ai-head svg { width: 14px; height: 14px; }
.ai-card ul { margin: 10px 0 0; padding-left: 0; list-style: none; display: grid; gap: 7px; }
.ai-card li { display: flex; gap: 8px; font-size: var(--fs-sm); color: var(--text-dim); }
.ai-card li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex-shrink: 0; }

/* ---------- CONFIDENCE BARS ---------- */
.conf { display: inline-flex; align-items: flex-end; gap: 2px; height: 13px; }
.conf i { width: 3px; border-radius: 2px; background: var(--accent); opacity: .35; }
.conf i.on { opacity: 1; }
.conf i:nth-child(1) { height: 5px; } .conf i:nth-child(2) { height: 9px; } .conf i:nth-child(3) { height: 13px; }

/* ---------- BUTTONS ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 16px; border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: 600; transition: transform var(--d-fast), background var(--d-fast); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 20px -10px var(--accent); }
.btn.primary:hover { transform: translateY(-1px); }
.btn.ghost { border: 1px solid var(--line-strong); color: var(--text); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 15px; height: 15px; }

/* ---------- TABLE ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tbl th { text-align: left; font-weight: 600; font-size: var(--fs-2xs); text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); padding: 10px var(--s4); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); }
.tbl td { padding: 12px var(--s4); border-bottom: 1px solid var(--line); color: var(--text-dim); }
.tbl tr:hover td { background: var(--surface); }
.tbl .num { font-family: var(--font-display); color: var(--text); text-align: right; }

/* ---------- PROGRESS ---------- */
.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--violet)); }

/* ---------- KANBAN ---------- */
.board { display: grid; gap: var(--s3); grid-auto-flow: column; grid-auto-columns: minmax(248px, 1fr); padding: var(--s4); overflow-x: auto; height: 100%; }
.col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); display: flex; flex-direction: column; min-height: 0; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px var(--s3); border-bottom: 1px solid var(--line); font-size: var(--fs-sm); font-weight: 600; }
.col-head .cnt { margin-left: auto; font-size: var(--fs-2xs); color: var(--text-faint); }
.col-body { flex: 1; overflow-y: auto; min-height: 0; padding: var(--s2); display: grid; gap: var(--s2); align-content: start; }
.kard { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--s3); transition: transform var(--d-fast), border-color var(--d-fast); cursor: grab; }
.kard:hover { transform: translateY(-2px); border-color: var(--line-strong); }

/* ---------- STATUSBAR ---------- */
.statusbar { display: flex; align-items: center; gap: var(--s4); padding: 0 var(--s4); border-top: 1px solid var(--line); background: #070912; font-size: var(--fs-2xs); color: var(--text-faint); }
.statusbar .sp { margin-left: auto; }

/* ---------- COMMAND PALETTE ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; display: none; background: #03060fcc; backdrop-filter: blur(4px); }
.scrim.open { display: grid; place-items: start center; padding-top: 12vh; }
.palette { width: min(560px, 92vw); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: 0 30px 80px -20px #000, var(--accent-glow); overflow: hidden; }
.palette input { width: 100%; height: 50px; padding: 0 var(--s4); background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text); font-size: var(--fs-lg); outline: none; }
.pal-list { max-height: 340px; overflow-y: auto; padding: var(--s2); }
.pal-item { display: flex; align-items: center; gap: 11px; padding: 10px var(--s3); border-radius: var(--r-sm); color: var(--text-dim); font-size: var(--fs-sm); cursor: pointer; }
.pal-item.on, .pal-item:hover { background: var(--accent-soft); color: var(--accent); }

/* ---------- UTILITIES ---------- */
.pad { padding: var(--s5); }
.scroll-y { overflow-y: auto; min-height: 0; }
.muted { color: var(--text-faint); }
.dim { color: var(--text-dim); }
.mono { font-family: var(--font-display); }
.row-gap { display: flex; gap: var(--s3); align-items: center; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.wrap { display: flex; flex-wrap: wrap; gap: var(--s2); }
.reveal { opacity: 0; transform: translateY(8px); animation: reveal var(--d-slow) var(--ease) forwards; }
@keyframes reveal { to { opacity: 1; transform: none; } }

/* ---------- MOBILE ---------- */
@media (max-width: 880px) {
  :root { --sidebar-w: 0px; --list-w: 0px; }
  .main.l-three, .main.l-two, .main.l-board { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .pane { border-right: 0; }
  .search { display: none; }
  .board { grid-auto-columns: 80vw; }
}

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
