/* =========================================================================
   CinePost CRM — foglio di stile (tema scuro)
   ========================================================================= */

/* ---------- reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

:root {
  --bg: #0d0f13;
  --panel: #14171d;
  --panel-2: #1a1f28;
  --panel-3: #222836;
  --border: #262c38;
  --border-soft: #1e232d;
  --text: #e7eaf0;
  --muted: #98a2b3;
  --muted-2: #6b7486;
  --accent: #4f8cff;
  --accent-soft: rgba(79,140,255,0.14);
  --ok: #22c55e;
  --ok-soft: rgba(34,197,94,0.14);
  --warn: #f59e0b;
  --warn-soft: rgba(245,158,11,0.14);
  --err: #ef4444;
  --err-soft: rgba(239,68,68,0.14);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 12px 40px rgba(0,0,0,0.4);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
  background: var(--panel-3);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 6px;
}
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
h4 { font-size: 13.5px; font-weight: 650; }
small { font-size: 12px; color: var(--muted); }
::selection { background: var(--accent-soft); }

/* ---------- icone ---------- */
.icon { width: 18px; height: 18px; display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ---------- shell ---------- */
#app { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #12151b 0%, #10131a 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 16px; }
.brand-logo { width: 38px; height: 38px; border-radius: 10px; object-fit: contain; display: block; flex-shrink: 0; }
.brand-logo-default { display: flex; align-items: center; justify-content: center; background: var(--panel-3); font-size: 20px; border: 1px solid var(--border); }
.brand-text { min-width: 0; }
.brand-name { display: block; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-tag { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; padding: 6px 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 13.5px; font-weight: 500;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap; overflow: hidden;
}
.nav-item .icon { opacity: 0.85; }
.nav-item:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: #fff; }
.nav-item.active .icon { color: var(--accent); opacity: 1; }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 8px; display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.user-chip div { min-width: 0; display: flex; flex-direction: column; }
.user-chip strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip span { font-size: 11.5px; color: var(--muted); }

.main { flex: 1; min-width: 0; padding: 26px 30px 60px; }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; flex: 1;
  background: radial-gradient(1200px 600px at 50% -10%, rgba(79,140,255,0.10), transparent 60%), var(--bg);
}
.login-card { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 18px; }
.login-brand { width: 100%; display: flex; justify-content: center; }
.login-brand .brand { width: 100%; padding: 0; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.login-brand .brand-logo { width: 380px; max-width: 100%; height: auto; border-radius: 14px; }
.login-brand .brand-logo-default { width: 96px; height: 96px; font-size: 40px; }
.login-brand .brand-name { font-size: 18px; white-space: normal; }
.login-card .panel { padding: 22px; margin-bottom: 0; }
.login-card h2 { margin-bottom: 14px; text-align: center; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-hints { margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; }
.login-fields { display: flex; flex-direction: column; gap: 12px; }
.login-error { background: var(--err-soft); border: 1px solid rgba(239,68,68,0.4); color: #ffb2b2; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; }
.login-ok { background: var(--ok-soft); border: 1px solid rgba(34,197,94,0.4); color: #86efac; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; }
.login-forgot-row { display: flex; justify-content: center; margin-top: 2px; }
.login-forgot { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 12.5px; text-decoration: underline; padding: 4px; }
.login-forgot:hover { color: #9db8ff; }
.login-forgot-hint { font-size: 13px; color: var(--muted); line-height: 1.5; margin: 0; }
.forgot-step { display: flex; flex-direction: column; gap: 12px; }

/* ---------- license lock ---------- */
.license-lock-body { display: flex; flex-direction: column; gap: 12px; padding: 10px 0; }
.license-lock-title { font-size: 22px; text-align: center; color: var(--err); }
.license-lock-reason { font-size: 14px; color: var(--muted); text-align: center; }
.license-lock-detail { font-size: 13px; color: var(--muted); text-align: center; }
.license-lock .field input { background: var(--panel-3); font-family: monospace; font-size: 12px; }

/* ---------- bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: inherit; font-size: 13.5px; font-weight: 550;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 8px 14px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.12s, border-color 0.12s, transform 0.05s;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #5f97ff; }
.btn-success { background: var(--ok); border-color: var(--ok); color: #06210f; }
.btn-success:hover { background: #34d970; }
.btn-danger { background: transparent; border-color: rgba(239,68,68,0.5); color: #ff8a8a; }
.btn-danger:hover { background: var(--err-soft); border-color: var(--err); color: #ffb2b2; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid transparent; color: var(--muted); cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn.danger:hover { background: var(--err-soft); color: #ff9a9a; }
.icon-btn .icon { width: 16px; height: 16px; }
.row-actions { display: inline-flex; gap: 4px; }/* ---------- layout di pagina ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title p { color: var(--muted); margin-top: 4px; font-size: 13px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.panel h2, .panel h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.panel h2 .icon, .panel h3 .icon { color: var(--accent); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.card .label { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.card .value { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.card .sub { font-size: 12px; color: var(--muted-2); }
.card.warn { border-color: rgba(245,158,11,0.45); background: linear-gradient(180deg, rgba(245,158,11,0.07), transparent 65%), var(--panel); }

.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-bottom: 16px; }
.dash-cols .panel { margin-bottom: 0; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 8px 14px; font-size: 13px; font-weight: 550; color: var(--muted); background: transparent; border: none; border-bottom: 2px solid transparent; cursor: pointer; font-family: inherit; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.list-wrap { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--border-soft); }
.list-row:first-child { border-top: none; }
.grow { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.grow strong { font-size: 13.5px; font-weight: 600; }
.grow span, .list-row > span { font-size: 12.5px; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mono { font-family: "SFMono-Regular", Consolas, Menlo, monospace; font-size: 0.92em; }
.right { text-align: right; }
.count { font-size: 11.5px; color: var(--muted); background: var(--panel-3); border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px; margin-left: 6px; }
.arrow { color: var(--muted-2); margin: 0 6px; }
.clickable { cursor: pointer; }

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 26px 8px; font-size: 13.5px; }

.empty, .empty-state { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 16px; color: var(--muted); text-align: center; font-size: 13.5px; }
.empty-emoji, .empty-icon { font-size: 34px; }

.error-box, .alert.err { background: var(--err-soft); border: 1px solid rgba(239,68,68,0.4); color: #ffb2b2; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; }/* ---------- form ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.field small.hint, .hint { font-size: 11.5px; color: var(--muted-2); }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-end { justify-content: flex-end; }

input, select, textarea {
  font-family: inherit; font-size: 13.5px; color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:disabled, select:disabled, textarea:disabled { opacity: 0.55; cursor: not-allowed; }
select { cursor: pointer; }
textarea { resize: vertical; min-height: 64px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; padding: 0; border-radius: 0; background: transparent; box-shadow: none; }
input[type="range"] { padding: 0; border: none; background: transparent; accent-color: var(--accent); height: 24px; cursor: pointer; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }

.members-block { display: flex; flex-direction: column; gap: 10px; }
.members-block > span { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.members { display: flex; flex-direction: column; gap: 8px; }
.member-row { display: grid; grid-template-columns: 1.2fr 1fr 34px; gap: 8px; align-items: center; }

.settings-logo-row { display: flex; align-items: center; gap: 12px; }
.settings-logo-preview { width: 54px; height: 54px; border-radius: var(--radius-sm); background: var(--panel-3); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.settings-logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.settings-logo-preview .icon { width: 26px; height: 26px; color: var(--muted); }
.settings-dirty { color: var(--warn); font-size: 12.5px; font-weight: 550; }
.word-count { font-size: 11.5px; color: var(--muted-2); margin-left: auto; white-space: nowrap; }/* ---------- tabelle ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.table, .data { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .data th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; padding: 10px 12px; background: var(--panel-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td, .data td { padding: 10px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.table tbody tr:last-child td, .data tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover, .data tbody tr:hover { background: rgba(255,255,255,0.02); }
.table th.num, .table td.num, .data th.right, .data td.right { text-align: right; font-variant-numeric: tabular-nums; }
.cell-strong { display: flex; flex-direction: column; gap: 2px; }

.totals, .totals-box { max-width: 420px; margin-left: auto; display: flex; flex-direction: column; gap: 2px; }
.trow { display: flex; justify-content: space-between; gap: 12px; padding: 6px 2px; font-size: 13.5px; color: var(--muted); }
.trow .val { color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.trow.disc .val { color: var(--warn); }
.trow.total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 10px; font-size: 15px; font-weight: 700; color: var(--text); }
.trow.total .val { font-weight: 700; color: var(--accent); font-size: 16px; }

.quote-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.quote-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.quote-meta strong { color: var(--text); font-weight: 550; }

.decision-note { margin-top: 14px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--err-soft); border: 1px solid rgba(239,68,68,0.35); color: #ffb2b2; font-size: 13px; }
.decision-note.approved { background: var(--ok-soft); border-color: rgba(34,197,94,0.35); color: #86efac; }

.billing-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border-soft); flex-wrap: wrap; }
.billing-row:first-of-type { border-top: none; }
.billing-row strong { display: block; font-size: 13.5px; }
.billing-date { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.history-item { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--border-soft); font-size: 13px; }
.history-item:first-child { border-top: none; }
.h-when { font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.h-what { color: var(--text); }
.h-vals { color: var(--muted); font-size: 12.5px; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.legend-consuntivo { font-size: 12px; color: var(--muted); margin-top: 10px; }
.notes { font-size: 13px; color: var(--muted); white-space: pre-wrap; }

/* ---------- editor voci (preventivi / fatture) ---------- */
.items-editor { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.item-help { display: grid; grid-template-columns: 2fr 1.2fr 70px 90px 110px 80px 34px; gap: 8px; font-size: 11px; color: var(--muted-2); align-items: center; }
.item-head, .item-row { display: grid; grid-template-columns: 2fr 1.2fr 70px 90px 110px 80px 34px; gap: 8px; align-items: center; }
.item-head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.item-row { padding: 4px 0; border-top: 1px solid var(--border-soft); }/* ---------- badge e stati ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; line-height: 1.5; }

.st-personnel { background: var(--accent-soft); color: #9ec3ff; border-color: rgba(79,140,255,0.35); }
.st-room { background: rgba(139,92,246,0.14); color: #c4b0ff; border-color: rgba(139,92,246,0.4); }
.st-freelance { background: rgba(20,184,166,0.14); color: #7fe0d1; border-color: rgba(20,184,166,0.4); }

.st-planning { background: var(--accent-soft); color: #9ec3ff; border-color: rgba(79,140,255,0.35); }
.st-production { background: var(--warn-soft); color: #fbc96b; border-color: rgba(245,158,11,0.4); }
.st-post { background: rgba(139,92,246,0.14); color: #c4b0ff; border-color: rgba(139,92,246,0.4); }
.st-review { background: rgba(236,72,153,0.14); color: #f9a8d4; border-color: rgba(236,72,153,0.4); }
.st-done { background: var(--ok-soft); color: #86efac; border-color: rgba(34,197,94,0.4); }
.st-archived { background: var(--panel-3); color: var(--muted); border-color: var(--border); }

.st-draft { background: var(--panel-3); color: var(--muted); border-color: var(--border); }
.st-submitted { background: var(--warn-soft); color: #fbc96b; border-color: rgba(245,158,11,0.4); }
.st-sentc { background: var(--accent-soft); color: #9ec3ff; border-color: rgba(79,140,255,0.35); }
.st-approved { background: var(--ok-soft); color: #86efac; border-color: rgba(34,197,94,0.4); }
.st-rejected { background: var(--err-soft); color: #ff9a9a; border-color: rgba(239,68,68,0.4); }
.st-billed { background: rgba(6,182,212,0.14); color: #7dd3fc; border-color: rgba(6,182,212,0.4); }
.st-paid { background: var(--ok-soft); color: #86efac; border-color: rgba(34,197,94,0.4); }

.st-notstarted { background: var(--panel-3); color: var(--muted); border-color: var(--border); }
.st-inprogress { background: var(--warn-soft); color: #fbc96b; border-color: rgba(245,158,11,0.4); }
.st-paused { background: rgba(148,163,184,0.14); color: #cbd5e1; border-color: rgba(148,163,184,0.4); }
.st-completed { background: var(--ok-soft); color: #86efac; border-color: rgba(34,197,94,0.4); }
.st-blocked { background: var(--err-soft); color: #ff9a9a; border-color: rgba(239,68,68,0.4); }

.st-new { background: var(--accent-soft); color: #9ec3ff; border-color: rgba(79,140,255,0.35); }
.st-categorized { background: rgba(6,182,212,0.14); color: #7dd3fc; border-color: rgba(6,182,212,0.4); }
.st-doubt { background: var(--warn-soft); color: #fbc96b; border-color: rgba(245,158,11,0.4); }
.st-resolved { background: var(--ok-soft); color: #86efac; border-color: rgba(34,197,94,0.4); }

.pos { color: var(--ok); }
.neg { color: var(--err); }
.danger { color: #ff8a8a; }/* ---------- modali ---------- */
#modal-root { position: fixed; inset: 0; z-index: 100; pointer-events: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4,6,10,0.66); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 18px; overflow-y: auto; pointer-events: auto; }
.modal { width: 100%; max-width: 520px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; margin: auto 0; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { display: flex; align-items: center; gap: 8px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.confirm-msg { font-size: 13.5px; line-height: 1.55; }

/* ---------- toast ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { background: var(--panel-2); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: 11px 15px; font-size: 13px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: opacity 0.22s, transform 0.22s; }
.toast.in { opacity: 1; transform: none; }
.toast.out { opacity: 0; transform: translateY(6px); }
.toast.err { background: var(--err-soft); border-color: rgba(239,68,68,0.45); color: #ffb2b2; }

/* ---------- dettaglio prenotazione ---------- */
.alloc-detail { display: flex; flex-direction: column; gap: 14px; }
.alloc-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.alloc-kv { display: flex; flex-direction: column; gap: 2px; }
.alloc-kv-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-2); font-weight: 600; }
.alloc-kv-value { font-size: 13.5px; }
.booking-members { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.booking-members .list-row { border-top: 1px solid var(--border-soft); }
.booking-members .list-row:first-child { border-top: none; }

.progress-block { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.progress-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.progress-head h4 { display: flex; align-items: center; gap: 8px; }
.pct-val { font-size: 20px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.progress-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.progress-range { display: flex; align-items: center; gap: 10px; }
.prog-meta { font-size: 12px; color: var(--muted-2); }

.notes-title { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.note-list { display: flex; flex-direction: column; }
.note-item { padding: 10px 0; border-top: 1px solid var(--border-soft); }
.note-meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
.note-meta strong { color: var(--text); }
.note-text { font-size: 13px; white-space: pre-wrap; }
.note-empty { color: var(--muted-2); font-size: 13px; padding: 10px 0; }
.note-composer { display: flex; flex-direction: column; gap: 8px; }

/* ---------- documenti in entrata ---------- */
.note-doubt, .note-ok { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 10px 12px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.note-doubt { background: var(--warn-soft); color: #fbc96b; border: 1px solid rgba(245,158,11,0.4); }
.note-ok { background: var(--ok-soft); color: #86efac; border: 1px solid rgba(34,197,94,0.4); }
.note-doubt .icon, .note-ok .icon { width: 16px; height: 16px; flex: none; }
.kv { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 12px; margin-top: 12px; }
.kv-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--border-soft); font-size: 13px; }
.kv-row:first-child { border-top: none; }
.kv-k { color: var(--muted); flex: none; }
.kv-v { color: var(--text); text-align: right; word-break: break-word; }
.ocr-text { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.5; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto; margin-top: 6px; }/* ---------- agenda / schedule ---------- */
.sched-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; max-width: 680px; }
.sched-range { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--panel); }
.seg-btn { border: none; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 600; padding: 7px 16px; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn:hover { color: var(--text); background: var(--panel-3); }
.seg-btn.active { color: #0b0d12; background: var(--accent); }
.sched { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow-x: auto; }
.sched-inner { min-width: 880px; }
.sched-head { display: grid; grid-template-columns: 190px 1fr; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.sched-label { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--border); min-width: 0; }
.sched-label strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-label small { color: var(--muted-2); }
.sched-days { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(44px, 1fr); }
.sched-day { padding: 8px 3px; text-align: center; font-size: 12px; color: var(--muted); border-left: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 1px; }
.sched-day .dow { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted-2); }
.sched-day.weekend { background: rgba(255,255,255,0.02); }
.sched-day.today { color: var(--accent); }
.sched-day.today .dow { color: var(--accent); }

.sched-row { display: grid; grid-template-columns: 190px 1fr; border-bottom: 1px solid var(--border-soft); }
.sched-row:last-child { border-bottom: none; }
.sched-track { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(44px, 1fr); min-height: 46px; }
.sched-cell { border-left: 1px solid var(--border-soft); min-height: 46px; height: 100%; }
.sched-cell.weekend { background: rgba(255,255,255,0.02); }
.sched-cell.today { background: var(--accent-soft); }
.sched-cell.clickable:hover { background: rgba(79,140,255,0.25); }

.sched-bar { position: absolute; top: 50%; transform: translateY(-50%); height: 22px; border-radius: 6px; color: #0b0d12; font-size: 11.5px; font-weight: 650; display: flex; align-items: center; padding: 0 8px; overflow: hidden; white-space: nowrap; z-index: 2; box-shadow: 0 2px 8px rgba(0,0,0,0.35); }
.sched-bar.clickable { cursor: pointer; }
.sched-bar.clickable:hover { filter: brightness(1.1); }
.sched-bar.group { outline: 2px dashed rgba(255,255,255,0.7); outline-offset: -3px; }
.sched-bar-prog { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(255,255,255,0.35); pointer-events: none; }
.sched-bar.ws-completed { opacity: 0.72; }
.sched-bar.ws-paused { opacity: 0.8; }
.sched-bar.ws-blocked { outline: 2px solid var(--err); }
.sched-bar[draggable="true"] { cursor: grab; }
.sched-bar.dragging { opacity: 0.4; }
.sched-cell.drop-target { background: rgba(79,140,255,0.35); box-shadow: inset 0 0 0 2px #4f8cff; }
/* doppio-booking: lista conflitti (409) */
.conflict-box p { margin: 0 0 12px; color: var(--muted); }
.conflict-list { display: flex; flex-direction: column; gap: 8px; }
.conflict-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-3); }
.conflict-item small { margin-left: auto; color: var(--muted); }/* ---------- statistiche ---------- */
.stat-panel { min-height: 120px; }
.stat-rank { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border-soft); }
.stat-rank:first-of-type { border-top: none; }
.stat-rank.no-rev { opacity: 0.65; }
.rank { width: 26px; height: 26px; border-radius: 50%; background: var(--panel-3); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; color: var(--muted); flex-shrink: 0; }
.stat-nums { display: flex; flex-direction: column; gap: 2px; }
.stat-nums > div { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; font-size: 12px; color: var(--muted); }
.stat-nums .num { color: var(--text); }

/* ---------- spese ufficio ---------- */
.exp-cols { grid-template-columns: 1.25fr 1fr; }
.exp-total { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.month-bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 5px; align-items: end; height: 160px; padding-top: 8px; }
.mbar { display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; min-width: 0; }
.mbar-val { font-size: 9.5px; color: var(--muted); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.mbar-track { flex: 1; width: 100%; max-width: 26px; background: var(--panel-3); border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; }
.mbar-fill { width: 100%; background: linear-gradient(180deg, var(--accent), #3567c4); border-radius: 6px 6px 0 0; min-height: 2px; }
.mbar:not(.on) .mbar-fill { display: none; }
.mbar-label { font-size: 10px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.03em; }

.catbars { display: flex; flex-direction: column; gap: 12px; }
.catbar-row { display: flex; flex-direction: column; gap: 5px; }
.catbar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.catbar-head .num { color: var(--muted); font-size: 12px; }
.catbar-track { height: 8px; border-radius: 4px; background: var(--panel-3); overflow: hidden; }
.catbar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #3567c4, var(--accent)); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .dash-cols, .exp-cols { grid-template-columns: 1fr; }
  .dash-cols .panel { margin-bottom: 0; }
}
@media (max-width: 860px) {
  #app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; padding: 12px; }
  .nav { flex-direction: row; overflow-x: auto; flex-wrap: nowrap; }
  .nav-item { white-space: nowrap; }
  .sidebar-foot { flex-direction: row; align-items: center; border-top: none; padding-top: 0; }
  .main { padding: 18px 16px 50px; }
  .form-grid { grid-template-columns: 1fr; }
  .sched-controls { grid-template-columns: 1fr; }
  .alloc-detail-grid { grid-template-columns: 1fr; }
  .member-row { grid-template-columns: 1fr 34px; }
  .item-head { display: none; }
  .item-help { display: none; }
  .item-row { grid-template-columns: 1fr 1fr 34px; grid-auto-rows: auto; }
  .month-bars { grid-template-columns: repeat(6, 1fr); row-gap: 14px; }
}
.note-del { margin-left: auto; }
/* =========================================================================
   Filtro lista Clienti
   ========================================================================= */
.client-filter {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  max-width: 560px;
  margin-bottom: 10px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.client-filter:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.client-filter .icon { color: var(--muted); flex-shrink: 0; }
.client-filter input {
  flex: 1; min-width: 0;
  background: transparent; border: none; outline: none;
  color: var(--text); font-size: 13.5px; font-family: var(--font);
}
.client-filter input::placeholder { color: var(--muted-2); }
.client-count { font-size: 12.5px; color: var(--muted); margin: 0 2px 8px; }
/* =========================================================================
   Ricerca globale (sidebar)
   ========================================================================= */
.sidebar-search { position: relative; padding: 0 8px; margin-bottom: 14px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box .icon { color: var(--muted); flex-shrink: 0; }
.search-box input {
  flex: 1; min-width: 0;
  background: transparent; border: none; outline: none;
  color: var(--text); font-size: 13.5px; font-family: var(--font);
}
.search-box input::placeholder { color: var(--muted-2); }

.search-drop {
  position: absolute; left: 8px; right: 8px; top: calc(100% + 6px);
  z-index: 60;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 380px; overflow-y: auto;
  padding: 6px;
  animation: searchDropIn 0.12s ease;
}
@keyframes searchDropIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.search-empty { padding: 14px 12px; color: var(--muted); font-size: 13px; text-align: center; }
.search-group { margin-bottom: 2px; }
.search-group-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted-2); padding: 8px 10px 4px;
}
.search-item { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.search-item:hover { background: var(--panel-2); }
.si-title { font-size: 13.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.si-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* flash sulla riga trovata dopo la navigazione */
table tbody tr.search-hit { animation: searchHit 2.6s ease; }
@keyframes searchHit {
  0%   { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
  70%  { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
  100% { background: transparent; box-shadow: inset 0 0 0 0 transparent; }
}

@media (max-width: 860px) {
  .search-drop { position: static; margin-top: 6px; box-shadow: none; }
}

/* ---------- notifiche (campanella sidebar) ---------- */
.notif-wrap { margin-bottom: 10px; }
.notif-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}
.notif-btn:hover { background: var(--panel-2); color: var(--text); }
.notif-btn .icon { width: 17px; height: 17px; }
.notif-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--err);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 19px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.notif-panel {
  position: fixed;
  z-index: 90;
  width: 340px;
  max-width: calc(100vw - 16px);
  max-height: min(480px, calc(100vh - 24px));
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: searchDropIn 0.14s ease;
}
.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: var(--panel);
}
.notif-markall {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
}
.notif-markall:hover { background: var(--accent-soft); }
.notif-empty { padding: 18px 12px; color: var(--muted); font-size: 13px; }
.notif-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--panel-2); }
.notif-item.unread { background: var(--accent-soft); }
.notif-item.unread:hover { background: var(--accent-soft); }
.notif-title { font-size: 13px; font-weight: 600; }
.notif-msg { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.notif-time { font-size: 11.5px; color: var(--muted-2); margin-top: 4px; }/* ---------- PWA / mobile (bottom bar, offline, agenda sticky) ----------
.mnav { display: none; }
.mnav-ic { display: inline-flex; }
.offline-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; font-size: 12.5px;
  background: #3a2c10; color: #ffd98a;
  border-bottom: 1px solid #6b5316;
}
.pwa-install-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 80;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  font-size: 13px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--accent);
  box-shadow: 0 4px 20px rgba(79,140,255,0.15);
}
.pwa-install-text { flex: 1; font-weight: 500; }
.pwa-install-close {
  background: none; border: none; color: var(--muted); font-size: 18px;
  cursor: pointer; padding: 4px 8px; line-height: 1;
}
.pwa-install-close:hover { color: var(--text); }
.more-menu { display: flex; flex-direction: column; gap: 4px; }
.more-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border-radius: 8px; color: inherit; text-decoration: none;
}
.more-item:hover { background: var(--panel-3); }

@media (max-width: 860px) {
  .sidebar .nav { display: none; }
  .main { padding-bottom: 84px; }
  .offline-bar { top: 0; }
  .mnav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(13, 15, 19, 0.96);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--border);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .mnav-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    background: none; border: none; color: var(--muted);
    font-size: 10.5px; padding: 6px 2px; border-radius: 8px; cursor: pointer;
    text-decoration: none; font-family: inherit;
  }
  .mnav-item .mnav-ic svg { width: 24px; height: 24px; }
  .mnav-item.active { color: var(--accent); }
  .mnav-item:active { background: var(--panel-3); }

  /* Agenda mobile: colonna risorse fissa (sticky) + scroll orizzontale dei giorni */
  .sched-inner { min-width: 0; }
  .sched-head, .sched-row { grid-template-columns: 118px 1fr; }
  .sched-label { position: sticky; left: 0; z-index: 3; background: var(--panel-2); min-width: 118px; }
  .sched-row .sched-label { background: var(--panel); }
  /* Giorni sempre in riga singola (mai impilati): le colonne sono impostate
     inline da JS (repeat(N, minmax(44px,1fr))); qui serve solo lo scroll orizzontale. */
  .sched-days, .sched-track { min-width: 560px; }
  .sched-bar { height: 26px; font-size: 11px; }
}

/* ---------- scheda 360° cliente ---------- */
.cd-back { margin-bottom: 12px; }
.cd-head { margin-bottom: 14px; }
.cd-head-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.cd-id { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cd-name-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.cd-name-row h1 { margin: 0; font-size: 24px; letter-spacing: -0.01em; }
.cd-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.cd-meta a { color: var(--accent); text-decoration: none; }
.cd-meta a:hover { text-decoration: underline; }
.cd-since { color: var(--muted-2); font-size: 12px; }
.cd-notes { font-size: 13px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 8px; padding: 8px 12px; max-width: 640px; }
.cd-actions { display: flex; gap: 8px; flex-shrink: 0; }
.cd-body { margin-top: 4px; }
.cd-content { min-height: 120px; }
@media (max-width: 640px) {
  .cd-head-top { flex-direction: column; }
  .cd-actions { align-self: stretch; }
  .cd-actions .btn { flex: 1; justify-content: center; }
}

/* ---------- Etichetta QR (Magazzino) ---------- */
.qr-modal-body { display: flex; justify-content: center; }
.qr-label {
  display: inline-block;
  background: #fff; color: #111;
  border: 1px solid #d0d0d0;
  border-radius: 10px;
  padding: 18px 22px;
  max-width: 420px;
  text-align: center;
}
.qr-label-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.qr-label-head strong { font-size: 15px; letter-spacing: -0.01em; }
.qr-label-id { font-size: 12px; color: #666; font-variant-numeric: tabular-nums; }
.qr-svg-wrap { width: 280px; max-width: 100%; margin: 0 auto 12px; }
.qr-svg-wrap svg { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.qr-error { padding: 24px; color: #c0392b; font-size: 14px; background: #fdf0ef; border-radius: 6px; }
.qr-summary { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; text-align: left; }
.qr-summary dt { color: #555; font-size: 12.5px; }
.qr-summary dd { margin: 0; font-size: 13px; font-weight: 600; }
.qr-label-foot { margin-top: 12px; font-size: 11.5px; color: #666; border-top: 1px dashed #ccc; padding-top: 8px; }

/* Stampa: mostra SOLO l'etichetta */
@media print {
  body * { visibility: hidden; }
  .qr-label, .qr-label * { visibility: visible; }
  .qr-label {
    position: absolute; left: 0; top: 0;
    border: none; border-radius: 0; width: 100%;
  }
  .qr-svg-wrap { width: 260px; }
}

/* ---------- Nastri LTO ---------- */
.lto-search-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.lto-results {
  background: #0d0f13; border: 1px solid var(--border-soft); border-radius: 8px;
  padding: 12px 14px; max-height: 60vh; overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.5; color: #d7dae0;
  white-space: pre-wrap; word-break: break-all;
}
.lto-line { padding: 1px 0; }
.lto-date { color: var(--accent); font-variant-numeric: tabular-nums; margin-right: 8px; }
.cell-strong.link { color: var(--accent); cursor: pointer; text-decoration: none; }
.cell-strong.link:hover { text-decoration: underline; }

/* LTO — generatore di manifest da directory */
.lto-manifest-status { font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 6px; white-space: normal; }
.lto-manifest-status.ok { background: var(--ok-soft, #dcfce7); color: #166534; }
.lto-manifest-status.err { background: var(--err-soft, #fee2e2); color: #991b1b; }
.lto-manifest-admin { border-top: 1px solid var(--border-soft); margin-top: 14px; padding-top: 12px; }

/* ---------- Crediti / incassi: badge stato ---------- */
.st-overdue { background: var(--err-soft); color: #ff9a9a; border-color: rgba(239,68,68,0.4); }
.st-partial { background: var(--warn-soft); color: #fbc96b; border-color: rgba(245,158,11,0.4); }
.st-pending { background: var(--panel-3); color: var(--muted); border-color: var(--border); }
.card .value.pos { color: #86efac; }
.card .value.neg { color: #ff9a9a; }

/* ---------- Pipeline deals (kanban) ---------- */
.deals-board { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.deals-col { flex: 1 1 0; min-width: 210px; max-width: 280px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; }
.deals-col.won { border-color: rgba(34,197,94,0.4); }
.deals-col.lost { border-color: rgba(239,68,68,0.35); }
.deals-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; font-size: 12.5px; font-weight: 650; border-bottom: 1px solid var(--border-soft); }
.deals-col.won .deals-col-head { color: #86efac; }
.deals-col.lost .deals-col-head { color: #ff9a9a; }
.deals-col-count { font-size: 11px; color: var(--muted); background: var(--panel-3); border: 1px solid var(--border); border-radius: 10px; padding: 0 7px; line-height: 1.6; }
.deals-col-sub { font-size: 11.5px; color: var(--muted-2); padding: 6px 12px 0; font-variant-numeric: tabular-nums; }
.deals-col-body { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; min-height: 64px; }
.deals-col-empty { font-size: 12px; color: var(--muted-2); text-align: center; padding: 14px 0; }
.deal-card { background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
.deal-title { font-size: 13.5px; font-weight: 650; line-height: 1.35; }
.deal-client { font-size: 12px; color: var(--muted); }
.deal-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.deal-value { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.deal-prob { font-size: 11px; color: var(--muted); background: var(--panel-3); border: 1px solid var(--border); border-radius: 10px; padding: 0 7px; line-height: 1.6; }
.deal-next { font-size: 11.5px; color: var(--muted-2); }
.deal-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; padding-top: 6px; border-top: 1px solid var(--border-soft); }
.deal-linked { font-size: 11.5px; color: #86efac; font-weight: 600; }

/* ---------- Pipeline: view toggle ---------- */
.deals-view-toggle { display: inline-flex; gap: 3px; background: var(--panel-3); border: 1px solid var(--border); border-radius: var(--radius); padding: 3px; margin-bottom: 14px; }
.deals-toggle-btn { border: none; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 6px 16px; border-radius: calc(var(--radius) - 2px); cursor: pointer; transition: all .15s; }
.deals-toggle-btn:hover { color: var(--text); }
.deals-toggle-btn.active { background: var(--accent); color: #fff; }
.deals-content { min-height: 120px; }

/* ---------- Pipeline: stage tips (B) ---------- */
.stage-tips { background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin: 8px 12px; }
.stage-tips-title { font-size: 12px; font-weight: 650; color: var(--accent); margin-bottom: 6px; }
.stage-tips-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.stage-tips-item { font-size: 12px; color: var(--muted); padding-left: 16px; position: relative; line-height: 1.5; }
.stage-tips-item::before { content: '☐'; position: absolute; left: 0; color: var(--muted-2); }

/* ---------- Pipeline: stalled (D) ---------- */
.deal-card.stalled { border-color: rgba(239,68,68,0.35); }
.stalled-badge { font-size: 10.5px; font-weight: 650; color: #ff9a9a; background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25); border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.stalled-alert { background: rgba(239,68,68,0.06); border: 1px solid rgba(239,68,68,0.2); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.stalled-alert-head { font-size: 13.5px; font-weight: 650; color: #ff9a9a; margin-bottom: 10px; }
.stalled-alert-list { display: flex; flex-direction: column; gap: 8px; }
.stalled-alert-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 12.5px; }
.stalled-deal-title { font-weight: 600; }
.stalled-deal-info { color: var(--muted); font-size: 11.5px; }

/* ---------- Pipeline: wizard (A) ---------- */
.wizard-body { padding: 4px 0; }
.wizard-steps { display: flex; align-items: center; gap: 0; margin-bottom: 20px; padding: 0 8px; }
.wizard-dot { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: var(--panel-3); color: var(--muted-2); border: 2px solid var(--border); position: relative; flex-shrink: 0; }
.wizard-dot + .wizard-dot { margin-left: -8px; }
.wizard-dot.active { background: var(--accent); color: #fff; border-color: var(--accent); z-index: 1; }
.wizard-dot.done { background: var(--panel-2); color: var(--accent); border-color: var(--accent); }
.wizard-step-body { display: flex; flex-direction: column; gap: 14px; }
.wizard-q { font-size: 18px; font-weight: 700; margin: 0; }
.wizard-hint { font-size: 13px; color: var(--muted); margin: -8px 0 4px; line-height: 1.5; }
.wizard-stage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.wizard-stage-card { background: var(--panel-2); border: 2px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; transition: all .15s; }
.wizard-stage-card:hover { border-color: var(--accent); }
.wizard-stage-card.selected { border-color: var(--accent); background: rgba(53,103,196,0.08); }
.wizard-stage-label { font-size: 13.5px; font-weight: 650; margin-bottom: 3px; }
.wizard-stage-desc { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.wizard-summary { background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.wizard-summary-row { font-size: 13px; display: flex; gap: 4px; flex-wrap: wrap; }
.wizard-summary-row strong { color: var(--muted); min-width: 110px; font-weight: 600; }
.wizard-footer { display: flex; justify-content: space-between; gap: 8px; }

/* ---------- Pipeline: guided view ---------- */
.guided-stage { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.guided-stage.won { border-color: rgba(34,197,94,0.3); }
.guided-stage.lost { border-color: rgba(239,68,68,0.25); }
.guided-stage-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.guided-stage-label { font-size: 14px; font-weight: 700; }
.guided-stage.won .guided-stage-label { color: #86efac; }
.guided-stage.lost .guided-stage-label { color: #ff9a9a; }
.guided-stage-desc { font-size: 12px; color: var(--muted); flex: 1; }
.guided-stage .stage-tips { margin: 8px 16px; }
.guided-deals { display: flex; flex-direction: column; gap: 8px; padding: 10px 16px 14px; }
.guided-deals .deal-card { margin: 0; }

/* ---------- Pipeline: smart stage change (C) ---------- */
.smart-change { display: flex; flex-direction: column; gap: 12px; }
.smart-change-q { font-size: 14px; font-weight: 600; margin: 0; line-height: 1.5; }

/* ---------- Pipeline: deal title row ---------- */
.deal-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.deal-title-row .deal-title { flex: 1; min-width: 0; }

/* ---------- Pipeline: button variants ---------- */
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { opacity: 0.9; }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

/* ---------- ERP: workflow di produzione (fasi progetto) ---------- */
.panel-sub { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: auto; }
.phase-progress { margin-bottom: 14px; }
.phase-progress span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.phase-progress-bar { height: 8px; border-radius: 4px; background: var(--panel-3); overflow: hidden; }
.phase-progress-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #3567c4, var(--accent)); transition: width .25s ease; }
.phase-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 4px; border-top: 1px solid var(--border-soft); }
.phase-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.phase-label { font-size: 13.5px; }
.phase-actual { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.phase-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mini { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.mini input, .mini select { font-size: 12.5px; padding: 4px 8px; }

/* ---------- ERP: dashboard KPI personalizzabili ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.kpi-card .label { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.kpi-card .value { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.kpi-card .value.pos { color: #86efac; }
.kpi-card .value.neg { color: #ff9a9a; }
.kpi-prefs-panel { margin-bottom: 16px; }
.kpi-prefs { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.kpi-pref { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; user-select: none; }
.kpi-pref input { accent-color: var(--accent); cursor: pointer; }

/* =========================================================================
   Menu raggruppato (grandi aree) + navigazione mobile (top bar + drawer)
   ========================================================================= */

/* Intestazioni dei gruppi nel menu (sidebar desktop e drawer mobile) */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.nav-group-title {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 11px 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted-2);
  cursor: pointer; user-select: none; border-radius: 8px;
}
.nav-group-title:hover { color: var(--text); }
.nav-group-title .icon { width: 14px; height: 14px; opacity: 0.75; }
.nav-group-chev { margin-left: auto; display: inline-flex; transition: transform 0.15s ease; }
.nav-group-chev .icon { width: 13px; height: 13px; opacity: 0.7; }
.nav-group.collapsed .nav-group-chev { transform: rotate(-90deg); }
.nav-group.collapsed > a { display: none; }

/* --- Mobile: top bar + drawer (menu raggruppato off-canvas) --- */
.topbar { display: none; }
.mdrawer { display: none; }
.drawer-backdrop { display: none; }
body.drawer-open { overflow: hidden; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .mnav { display: none !important; }   /* bottom bar iconografica disattivata */
  .main { padding: 14px 14px 24px; }

  .topbar {
    display: flex; align-items: center; gap: 6px;
    position: sticky; top: 0; z-index: 40;
    min-height: 56px; padding: 6px 8px;
    background: rgba(13,15,19,0.96); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
  }
  .topbar-burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; border-radius: 10px;
    background: none; border: none; color: var(--text); cursor: pointer;
  }
  .topbar-burger .icon { width: 24px; height: 24px; }
  .topbar-brand { flex: 1; display: flex; align-items: center; min-width: 0; padding: 0 2px; }
  .topbar-brand .brand { padding: 0; }
  .topbar-brand .brand-logo { width: 30px; height: 30px; }
  .topbar-brand .brand-name { font-size: 14px; }
  .topbar-brand .brand-tag { display: none; }
  .topbar-actions { display: flex; align-items: center; }
  .topbar-actions .notif-wrap { margin: 0; }
  .topbar-actions .notif-btn {
    width: 42px; height: 42px; padding: 0; justify-content: center;
    border: none; background: none;
  }
  .topbar-actions .notif-btn .icon { width: 22px; height: 22px; }

  /* Drawer */
  .mdrawer {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 60;
    width: min(86vw, 330px);
    background: linear-gradient(180deg, #12151b 0%, #10131a 100%);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }
  .mdrawer.open { transform: translateX(0); }
  .mdrawer-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 12px 10px 14px;
  }
  .mdrawer-title { font-size: 15px; font-weight: 700; }
  .mdrawer-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 10px;
    background: none; border: none; color: var(--muted); cursor: pointer;
  }
  .mdrawer-close .icon { width: 22px; height: 22px; }
  .mdrawer .sidebar-search { padding: 0 12px; margin-bottom: 8px; }
  .mdrawer .nav { flex: 1; overflow-y: auto; overflow-x: hidden; flex-direction: column; padding: 4px 12px 14px; }
  .mdrawer-foot { border-top: 1px solid var(--border); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }

  .drawer-backdrop {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(0,0,0,0.5);
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  }
  .drawer-backdrop.show { opacity: 1; pointer-events: auto; }
}

/* ---------- Sandbox badge (sidebar) ---------- */
.sandbox-badge {
  font-size: 0.7rem;
  color: #f0c040;
  background: rgba(240,192,64,0.08);
  border: 1px solid rgba(240,192,64,0.2);
  border-radius: 4px;
  padding: 3px 8px;
  margin: 4px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  cursor: default;
}

/* ---------- Condizioni Generali (Terms of Service) modal ---------- */
.terms-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: auto;
}
.terms-box {
  background: var(--panel, #14171d);
  border: 1px solid var(--border, #262c38);
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.terms-header {
  padding: 20px 28px 12px;
  border-bottom: 1px solid var(--border, #262c38);
}
.terms-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text, #e7eaf0);
}
.terms-header-sub {
  margin-top: 6px;
  font-size: 0.875rem;
  color: var(--muted, #98a2b3);
}
.terms-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 28px;
  min-height: 200px;
  max-height: 55vh;
}
.terms-text {
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 0.85rem;
  line-height: 1.65;
  color: var(--text, #e7eaf0);
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
}
.terms-accept-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted-2, #6b7486);
  padding: 0 28px 8px;
}
.terms-error {
  margin: 0 28px;
  padding: 10px 14px;
  background: rgba(220,60,60,0.12);
  border: 1px solid rgba(220,60,60,0.3);
  border-radius: 6px;
  color: #f08080;
  font-size: 0.85rem;
}
.terms-box .btn {
  margin: 12px 28px 20px;
}
body.terms-locked {
  overflow: hidden;
}
@media (max-width: 600px) {
  .terms-overlay { padding: 12px; }
  .terms-box { max-height: 92vh; border-radius: 8px; }
  .terms-header { padding: 16px 18px 10px; }
  .terms-scroll { padding: 14px 18px; max-height: 50vh; }
  .terms-box .btn { margin: 10px 18px 16px; }
  .terms-error { margin: 0 18px; }
  .terms-accept-hint { padding: 0 18px 6px; }
}

/* =========================================================================
   WIZARD — sistema guidato multi-step
   ========================================================================= */

.wiz-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(6px);
  padding: 20px;
  animation: wizFadeIn 0.25s ease;
  pointer-events: auto;
}
.wiz-overlay.wiz-closing { opacity: 0; transition: opacity 0.25s; }
@keyframes wizFadeIn { from { opacity: 0; } to { opacity: 1; } }

.wiz-shell {
  width: 100%; max-width: 640px; max-height: 90vh;
  background: var(--surface, #161922);
  border: 1px solid var(--border, #2a2e3a);
  border-radius: 16px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
}

/* Header */
.wiz-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px 12px;
  border-bottom: 1px solid var(--border, #2a2e3a);
}
.wiz-title { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 700; }
.wiz-icon { font-size: 1.4rem; }

/* Progress */
.wiz-progress {
  height: 4px; background: var(--border, #2a2e3a); margin: 0 24px; border-radius: 2px; overflow: hidden;
}
.wiz-progress-bar {
  height: 100%; background: var(--accent, #4f8cff); border-radius: 2px;
  transition: width 0.3s ease;
}

/* Dots */
.wiz-dots {
  display: flex; gap: 6px; padding: 12px 24px 0;
}
.wiz-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border, #2a2e3a);
  transition: background 0.2s, transform 0.2s;
}
.wiz-dot.active { background: var(--accent, #4f8cff); transform: scale(1.3); }
.wiz-dot.done { background: #198754; }

/* Body */
.wiz-body {
  flex: 1; overflow-y: auto; padding: 20px 24px;
}
.wiz-step-title { font-size: 1.15rem; margin-bottom: 6px; }
.wiz-step-desc { color: var(--muted, #8b92a5); margin-bottom: 18px; font-size: 0.92rem; }
.wiz-step-box { min-height: 120px; }

/* Form */
.wiz-form { display: flex; flex-direction: column; gap: 14px; }
.wiz-field { display: flex; flex-direction: column; gap: 5px; }
.wiz-field-label { font-size: 0.85rem; font-weight: 600; color: var(--muted, #8b92a5); }
.wiz-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg, #0d0f13); color: var(--text, #e2e5ef);
  border: 1px solid var(--border, #2a2e3a); border-radius: 8px;
  font-size: 0.95rem; transition: border-color 0.2s;
}
.wiz-input:focus { outline: none; border-color: var(--accent, #4f8cff); }
select.wiz-input { appearance: auto; }
textarea.wiz-input { resize: vertical; min-height: 70px; }

/* Items (voci) */
.wiz-items { display: flex; flex-direction: column; gap: 8px; }
.wiz-item-row {
  display: grid; grid-template-columns: 1fr 70px 90px 36px;
  gap: 8px; align-items: center;
}
.wiz-item-row .wiz-input { padding: 8px 10px; font-size: 0.88rem; }

/* Info boxes */
.wiz-info {
  margin-top: 14px; padding: 12px 16px;
  background: rgba(79,140,255,0.08); border: 1px solid rgba(79,140,255,0.2);
  border-radius: 8px; font-size: 0.88rem; line-height: 1.5;
}
.wiz-info-warn {
  background: rgba(255,193,7,0.08); border-color: rgba(255,193,7,0.25);
}
.wiz-info code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-size: 0.82rem; }
.wiz-hint { font-size: 0.82rem; color: var(--muted); margin-top: 8px; }

/* Summary */
.wiz-summary { display: flex; flex-direction: column; gap: 8px; }
.wiz-summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border, #2a2e3a);
}
.wiz-summary-row:last-child { border-bottom: none; }
.wiz-summary-key { color: var(--muted); font-size: 0.9rem; }
.wiz-summary-val { font-weight: 600; font-size: 0.92rem; }
.wiz-summary-total { font-weight: 700; font-size: 1rem; border-top: 2px solid var(--accent, #4f8cff); margin-top: 8px; padding-top: 12px; }

/* Footer */
.wiz-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px; border-top: 1px solid var(--border, #2a2e3a);
}

/* Loading */
.wiz-loading { padding: 24px; text-align: center; color: var(--muted); }

/* QR preview */
.wiz-qr-preview { text-align: center; padding: 16px; }
.wiz-qr-preview code { display: block; margin-top: 8px; background: var(--bg); padding: 10px; border-radius: 6px; word-break: break-all; font-size: 0.82rem; }

/* Color picker */
.wiz-color { width: 36px; height: 36px; border: none; border-radius: 6px; cursor: pointer; background: transparent; }

/* Stage rows */
.wiz-stage-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.wiz-stage-num { width: 24px; height: 24px; border-radius: 50%; background: var(--accent, #4f8cff); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; flex-shrink: 0; }

/* Check rows */
.wiz-check-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; }
.wiz-check-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent, #4f8cff); }

/* Backup result */
.wiz-bk-result { margin-top: 10px; font-weight: 600; }
.wiz-bk-result.ok { color: #198754; }
.wiz-bk-result.err { color: #dc3545; }

/* ---------- Wizard list (pagina Guida) ---------- */
.wizard-quick { margin: 24px 0; }
.wizard-quick h3 { margin-bottom: 12px; }
.wizard-quick-grid { display: flex; flex-wrap: wrap; gap: 10px; }

.wizard-list { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.wizard-card {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px;
  background: var(--surface, #161922); border: 1px solid var(--border, #2a2e3a);
  border-radius: 12px; transition: border-color 0.2s;
}
.wizard-card:hover { border-color: var(--accent, #4f8cff); }
.wizard-card-icon { font-size: 2rem; flex-shrink: 0; }
.wizard-card-body { flex: 1; }
.wizard-card-body h4 { margin-bottom: 4px; }
.wizard-card-body p { color: var(--muted); font-size: 0.88rem; }
.wizard-card-steps { font-size: 0.78rem; color: var(--muted); margin-top: 6px; display: inline-block; }

.wizard-tips { margin-top: 32px; padding: 18px 20px; background: var(--surface); border-radius: 12px; border: 1px solid var(--border); }
.wizard-tips h3 { margin-bottom: 10px; }
.wizard-tips ul { padding-left: 20px; line-height: 2; font-size: 0.9rem; color: var(--muted); }

/* Responsive */
@media (max-width: 600px) {
  .wiz-shell { max-width: 100%; border-radius: 12px; }
  .wiz-item-row { grid-template-columns: 1fr 60px 80px 30px; }
  .wizard-quick-grid { flex-direction: column; }
}

/* ==========================================================================
   CREDENZIALI — Password Vault (tema scuro)
   ========================================================================== */
.cred-search {
  margin-bottom: 16px;
  max-width: 400px;
}

.cred-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cred-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .15s;
}
.cred-card:hover {
  border-color: var(--muted-2);
}

.cred-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}
.cred-card-head h4 {
  color: var(--text);
  font-size: 0.95rem;
  margin: 0;
}

.cred-count {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--panel-3);
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--border);
}

.cred-entries {
  padding: 0;
}

.cred-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.88rem;
  color: var(--text);
}
.cred-row:last-child { border-bottom: none; }
.cred-row:hover {
  background: var(--panel-2);
}

.cred-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cred-login {
  font-weight: 600;
  color: var(--text);
}

.cred-pw {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 2px;
}

.cred-notes {
  font-size: 0.78rem;
  color: var(--muted-2);
  font-style: italic;
}

.cred-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.cred-error {
  padding: 12px 16px;
  color: #ff6b6b;
  font-size: 0.88rem;
}

/* Reveal modal */
.cred-reveal {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0;
}

.cred-reveal-site {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
}

.cred-reveal-pw {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 1.1rem;
  background: var(--panel-2);
  padding: 10px 14px;
  border-radius: 8px;
  letter-spacing: 1px;
  word-break: break-all;
  color: var(--accent);
  border: 1px solid var(--border);
}

/* Responsive credentials */
@media (max-width: 600px) {
  .cred-row { flex-direction: column; align-items: flex-start; }
  .cred-row-actions { width: 100%; justify-content: flex-end; }
}
