/* Assoholding — area riservata. Sistema visivo (vedi DESIGN.md). */

:root {
  /* Brand */
  --brand: oklch(0.34 0.068 236);
  --brand-700: oklch(0.28 0.06 236);
  --brand-050: oklch(0.965 0.018 236);
  --gold: oklch(0.72 0.095 84);
  --gold-700: oklch(0.58 0.09 82);
  --gold-050: oklch(0.965 0.03 88);

  /* Surfaces & ink */
  --bg: oklch(0.985 0.003 236);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.974 0.004 236);
  --border: oklch(0.905 0.006 236);
  --border-strong: oklch(0.84 0.01 236);
  --ink: oklch(0.27 0.02 250);
  --ink-soft: oklch(0.37 0.02 250);
  --muted: oklch(0.475 0.02 250);

  /* Sidebar (navy chrome) */
  --side: oklch(0.30 0.062 236);
  --side-2: oklch(0.27 0.058 236);
  --side-ink: oklch(0.965 0.008 236);
  --side-muted: oklch(0.78 0.03 236);
  --side-active: oklch(0.40 0.075 236);
  --side-border: oklch(0.40 0.05 236 / 0.5);

  /* Semantic */
  --st-open: oklch(0.66 0.13 66);
  --st-open-bg: oklch(0.955 0.04 78);
  --st-prog: oklch(0.55 0.11 236);
  --st-prog-bg: oklch(0.95 0.03 236);
  --st-done: oklch(0.55 0.11 155);
  --st-done-bg: oklch(0.95 0.04 158);
  /* risposto: tocca all'associato (helpdesk/avvisi.py) */
  --st-risp: oklch(0.5 0.09 200);
  --st-risp-bg: oklch(0.95 0.03 200);

  --focus: oklch(0.62 0.13 236);

  /* Type */
  --font-sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;

  /* Radii & shadow */
  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow-sm: 0 1px 2px oklch(0.3 0.03 250 / 0.06), 0 1px 3px oklch(0.3 0.03 250 / 0.06);
  --shadow-md: 0 6px 20px -8px oklch(0.3 0.04 250 / 0.18);
  --shadow-lg: 0 24px 48px -24px oklch(0.28 0.05 250 / 0.32);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 200ms;

  /* z-index scale */
  --z-nav: 20;
  --z-sticky: 30;
  --z-drawer: 60;
  --z-backdrop: 55;
  --z-toast: 80;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.011em; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
svg.icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- App shell ---------- */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start; height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--side), var(--side-2));
  color: var(--side-ink);
  border-right: 1px solid var(--side-border);
  z-index: var(--z-nav);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 20px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: var(--surface); color: var(--brand);
  font-family: var(--font-serif); font-weight: 600; font-size: 1.15rem;
  box-shadow: inset 0 0 0 1px oklch(1 0 0 / 0.15);
}
.brand-name { font-weight: 600; font-size: 1.02rem; letter-spacing: -0.01em; line-height: 1.1; }
.brand-sub { font-size: 0.7rem; color: var(--side-muted); letter-spacing: 0.02em; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; overflow-y: auto; flex: 1; }
.nav-label {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--side-muted); padding: 16px 10px 6px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border-radius: var(--r-sm); color: var(--side-muted); font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.nav-item .icon { width: 1.15rem; height: 1.15rem; opacity: 0.9; }
.nav-item:hover { background: oklch(1 0 0 / 0.06); color: var(--side-ink); }
.nav-item.is-active { background: var(--side-active); color: #fff; box-shadow: var(--shadow-sm); }
.nav-item.is-active .icon { color: var(--gold); opacity: 1; }
.nav-item .count {
  margin-left: auto; font-size: 0.72rem; font-weight: 600;
  background: oklch(1 0 0 / 0.1); color: var(--side-ink);
  padding: 1px 8px; border-radius: 999px;
}
.nav-item.is-disabled { opacity: 0.5; cursor: default; }
.nav-item.is-disabled:hover { background: none; color: var(--side-muted); }
.nav-item .soon { margin-left: auto; font-size: 0.62rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--side-muted); }

.side-user { border-top: 1px solid var(--side-border); padding: 12px; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--gold); color: var(--brand-700); font-weight: 700; font-size: 0.82rem;
}
.side-user .who { min-width: 0; line-height: 1.2; }
.side-user .who b { font-weight: 600; font-size: 0.85rem; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who span { font-size: 0.72rem; color: var(--side-muted); }
.side-user .logout { margin-left: auto; color: var(--side-muted); padding: 6px; border-radius: 7px; display: grid; }
.side-user .logout:hover { background: oklch(1 0 0 / 0.08); color: var(--side-ink); }

/* ---------- Main + topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: 16px;
  padding: 13px 28px; background: oklch(0.985 0.003 236 / 0.85);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border);
}
.topbar .crumbs { font-size: 0.82rem; color: var(--muted); display: flex; align-items: center; gap: 7px; min-width: 0; }
.topbar .crumbs a:hover { color: var(--ink); }
.topbar .crumbs .sep { opacity: 0.5; }
.topbar .crumbs .here { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hamburger { display: none; }

.searchbox { position: relative; margin-left: auto; width: min(340px, 40vw); }
.searchbox .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 1.05rem; height: 1.05rem; color: var(--muted); pointer-events: none; }
.searchbox input {
  width: 100%; font: inherit; font-size: 0.86rem; color: var(--ink);
  padding: 9px 12px 9px 34px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); transition: border-color var(--dur), box-shadow var(--dur);
}
.searchbox input::placeholder { color: var(--muted); }
.searchbox input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px oklch(0.62 0.13 236 / 0.15); }

.content { padding: 28px; max-width: 1140px; width: 100%; margin: 0 auto; flex: 1; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 1.6rem; letter-spacing: -0.02em; }
.page-head .lead { color: var(--muted); margin-top: 6px; max-width: 62ch; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-sm); font-weight: 600; font-size: 1rem;
  border: 1px solid transparent; transition: background var(--dur) var(--ease), box-shadow var(--dur), transform var(--dur), border-color var(--dur);
}
.btn .icon { width: 1.05rem; height: 1.05rem; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-700); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-quiet { background: transparent; color: var(--muted); padding: 8px 10px; }
.btn-quiet:hover { color: var(--ink); background: var(--surface-2); }

/* ---------- Pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; letter-spacing: 0.005em; white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-open { color: var(--st-open); background: var(--st-open-bg); }
.pill-prog { color: var(--st-prog); background: var(--st-prog-bg); }
.pill-done { color: var(--st-done); background: var(--st-done-bg); }
.pill-risp { color: var(--st-risp); background: var(--st-risp-bg); }
.badge-esperto {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.72rem; font-weight: 600;
  color: var(--gold-700); background: var(--gold-050); padding: 3px 10px; border-radius: 999px;
}

/* ---------- Panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 1rem; }
.panel-head .more { margin-left: auto; font-size: 0.82rem; color: var(--brand); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.panel-head .more:hover { color: var(--brand-700); }
.panel-head .more .icon { width: 1rem; height: 1rem; transition: transform var(--dur) var(--ease); }
.panel-head .more:hover .icon { transform: translateX(3px); }

.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }

/* ---------- Q&A list ---------- */
.qlist { display: flex; flex-direction: column; }
.qrow { display: block; padding: 16px 20px; border-bottom: 1px solid var(--border); transition: background var(--dur) var(--ease); }
.qrow:last-child { border-bottom: 0; }
.qrow:hover { background: var(--surface-2); }
.qrow .qtitle { font-family: var(--font-serif); font-size: 1.06rem; font-weight: 500; color: var(--ink); letter-spacing: -0.01em; line-height: 1.3; }
.qrow:hover .qtitle { color: var(--brand); }
.qrow .qexcerpt { color: var(--muted); font-size: 0.86rem; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qrow .qmeta { display: flex; align-items: center; gap: 12px; margin-top: 10px; font-size: 0.78rem; color: var(--muted); flex-wrap: wrap; }
.qrow .qmeta .who { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-soft); font-weight: 500; }
.qrow .qmeta .who .icon { width: 0.9rem; height: 0.9rem; color: var(--muted); }

/* Ticket row variant */
.trow { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: center; padding: 15px 20px; border-bottom: 1px solid var(--border); transition: background var(--dur) var(--ease); }
.trow:last-child { border-bottom: 0; }
.trow:hover { background: var(--surface-2); }
.trow .ttitle { font-weight: 600; color: var(--ink); }
.trow:hover .ttitle { color: var(--brand); }
.trow .tmeta { grid-column: 1; font-size: 0.78rem; color: var(--muted); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.trow .tright { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: center; gap: 14px; }
.trow .replies { font-size: 0.78rem; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.search-lg { position: relative; flex: 1; min-width: 240px; }
.search-lg .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-lg input { width: 100%; font: inherit; padding: 11px 14px 11px 40px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.search-lg input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px oklch(0.62 0.13 236 / 0.15); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font-size: 0.8rem; font-weight: 500; color: var(--muted); padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); transition: all var(--dur) var(--ease); white-space: nowrap; }
.chip:hover { border-color: var(--border-strong); color: var(--ink); }
.chip.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.chip .n { opacity: 0.7; margin-left: 4px; }
.result-count { font-size: 0.82rem; color: var(--muted); margin-bottom: 12px; }

/* ---------- Detail / editorial ---------- */
.detail { max-width: 760px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; color: var(--muted); font-weight: 500; margin-bottom: 18px; }
.back-link:hover { color: var(--brand); }
.back-link .icon { width: 1rem; height: 1rem; }
.q-head { margin-bottom: 22px; }
.q-head h1 { font-family: var(--font-serif); font-size: 2rem; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }
.q-head .q-meta { display: flex; align-items: center; gap: 14px; margin-top: 14px; font-size: 0.84rem; color: var(--muted); flex-wrap: wrap; }

.answer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); overflow: hidden; }
.answer-head { display: flex; align-items: center; gap: 12px; padding: 16px 24px; background: var(--gold-050); border-bottom: 1px solid var(--gold-050); }
.answer-head .who { font-weight: 600; color: var(--ink); }
.answer-head .who span { display: block; font-size: 0.76rem; color: var(--gold-700); font-weight: 600; }
.answer-body { padding: 8px 24px 24px; font-family: var(--font-serif); font-size: 1.08rem; line-height: 1.72; color: var(--ink-soft); text-wrap: pretty; }
.answer-body p { margin: 1em 0; }
.answer-body :is(h2, h3) { font-family: var(--font-sans); }

/* ---------- Thread (ticket) ---------- */
.thread { display: flex; flex-direction: column; gap: 16px; margin: 8px 0 24px; }
.msg { display: grid; grid-template-columns: auto 1fr; gap: 12px; }
.msg .avatar { width: 38px; height: 38px; }
.msg .bubble { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; box-shadow: var(--shadow-sm); min-width: 0; }
.msg .bubble .bhead { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 0.82rem; }
.msg .bubble .bhead b { font-weight: 600; }
.msg .bubble .bhead time { color: var(--muted); }
.msg .bubble .btext { color: var(--ink-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.staff .avatar { background: var(--brand); color: #fff; }
.msg.staff .bubble { background: var(--brand-050); border-color: oklch(0.88 0.03 236); }
.msg.first .bubble { background: var(--surface-2); }

.composer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 14px; }
.composer textarea { width: 100%; font: inherit; font-size: 0.92rem; border: 0; resize: vertical; min-height: 76px; color: var(--ink); background: transparent; }
.composer textarea:focus { outline: none; }
.composer .crow { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.composer .crow .hint { font-size: 0.78rem; color: var(--muted); }
.composer .crow .btn { margin-left: auto; }

/* ---------- Dashboard ---------- */
.hello { font-family: var(--font-serif); font-size: 1.9rem; font-weight: 500; letter-spacing: -0.02em; }
.hello .accent { color: var(--brand); }
.hero-hd {
  background: linear-gradient(135deg, var(--brand), var(--brand-700));
  color: #fff; border-radius: var(--r-xl); padding: 28px 30px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-md);
}
.hero-hd::after { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 100% at 100% 0%, oklch(0.72 0.095 84 / 0.22), transparent 55%); pointer-events: none; }
.hero-hd h2 { font-family: var(--font-serif); font-size: 1.55rem; font-weight: 500; max-width: 20ch; position: relative; }
.hero-hd p { color: oklch(0.9 0.02 236); margin-top: 8px; max-width: 42ch; position: relative; }
.hero-search { position: relative; margin-top: 20px; max-width: 460px; }
.hero-search .icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--brand); }
.hero-search input { width: 100%; font: inherit; padding: 13px 16px 13px 44px; border-radius: 999px; border: 0; color: var(--ink); box-shadow: var(--shadow-md); }
.hero-search input:focus { outline: none; box-shadow: var(--shadow-md), 0 0 0 3px oklch(0.72 0.095 84 / 0.5); }

.statstrip { display: flex; gap: 26px; flex-wrap: wrap; margin: 22px 2px 0; }
.stat .n { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .l { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.stat + .stat { padding-left: 26px; border-left: 1px solid var(--border); }

/* ---------- Help desk home hero cards ---------- */
.hd-paths { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 26px; }
.hd-card { display: flex; flex-direction: column; gap: 10px; padding: 22px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur); }
.hd-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.hd-card .ic { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; }
.hd-card .ic .icon { width: 1.4rem; height: 1.4rem; }
.hd-card.esperto .ic { background: var(--gold-050); color: var(--gold-700); }
.hd-card.assist .ic { background: var(--brand-050); color: var(--brand); }
.hd-card h3 { font-size: 1.12rem; }
.hd-card p { color: var(--muted); font-size: 0.88rem; }
.hd-card .go { margin-top: auto; color: var(--brand); font-weight: 600; font-size: 0.86rem; display: inline-flex; align-items: center; gap: 6px; }
.hd-card .go .icon { width: 1rem; height: 1rem; transition: transform var(--dur) var(--ease); }
.hd-card:hover .go .icon { transform: translateX(3px); }

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 22px; }
.pager a, .pager span { padding: 7px 12px; border-radius: var(--r-sm); font-size: 0.84rem; font-weight: 500; border: 1px solid var(--border); background: var(--surface); color: var(--ink); }
.pager a:hover { border-color: var(--border-strong); background: var(--surface-2); }
.pager .disabled { color: var(--muted); opacity: 0.5; }
.pager .info { border: 0; background: none; color: var(--muted); }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .icon { width: 2.2rem; height: 2.2rem; color: var(--border-strong); margin-bottom: 12px; }
.empty h3 { color: var(--ink); font-size: 1.05rem; margin-bottom: 6px; }

/* ---------- Messages ---------- */
.flash { padding: 11px 16px; border-radius: var(--r-sm); font-size: 0.86rem; margin-bottom: 16px; border: 1px solid var(--st-done); color: var(--st-done); background: var(--st-done-bg); }

/* ---------- Login ---------- */
.login-wrap { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.login-brand { background: linear-gradient(155deg, var(--side), var(--side-2)); color: #fff; padding: 56px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.login-brand::after { content: ""; position: absolute; inset: 0; background: radial-gradient(90% 70% at 90% 10%, oklch(0.72 0.095 84 / 0.2), transparent 50%); }
.login-brand .lb-top { display: flex; align-items: center; gap: 12px; position: relative; }
.login-brand .lb-mid { margin-top: auto; position: relative; }
.login-brand .lb-mid h2 { font-family: var(--font-serif); font-size: 2.1rem; font-weight: 500; line-height: 1.2; max-width: 16ch; }
.login-brand .lb-mid p { color: var(--side-muted); margin-top: 14px; max-width: 40ch; }
.login-brand .lb-quote { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--side-border); font-family: var(--font-serif); font-style: italic; font-size: 1.05rem; color: oklch(0.9 0.02 236); position: relative; }
.login-form-side { display: grid; place-items: center; padding: 40px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 1.5rem; letter-spacing: -0.02em; }
.login-card .sub { color: var(--muted); margin-top: 6px; margin-bottom: 26px; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 6px; color: var(--ink-soft); }
.field input { width: 100%; font: inherit; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); transition: border-color var(--dur), box-shadow var(--dur); }
.field input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px oklch(0.62 0.13 236 / 0.15); }
.login-card .btn { width: 100%; padding: 12px; margin-top: 6px; }
.login-card .err { background: oklch(0.96 0.04 25); color: oklch(0.5 0.16 25); border: 1px solid oklch(0.85 0.08 25); padding: 10px 13px; border-radius: var(--r-sm); font-size: 0.84rem; margin-bottom: 18px; }
.login-card .foot { margin-top: 18px; font-size: 0.82rem; color: var(--muted); text-align: center; }

/* ---------- Topbar right group + demo switch ---------- */
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.top-right .searchbox { margin-left: 0; }
.demo-switch { display: inline-flex; align-items: center; gap: 3px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; }
.demo-switch .demo-lbl { font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); font-weight: 700; padding: 0 5px 0 8px; }
.demo-switch .seg { font-size: 0.8rem; font-weight: 600; color: var(--muted); padding: 5px 13px; border-radius: 999px; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.demo-switch .seg:hover { color: var(--ink); }
.demo-switch .seg.on { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }

/* ---------- Help Desk tabs ---------- */
.hd-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; }
.hd-tab { display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px; font-weight: 600; font-size: 0.92rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.hd-tab .icon { width: 1.1rem; height: 1.1rem; }
.hd-tab:hover { color: var(--ink); }
.hd-tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.hd-tab .c { font-size: 0.72rem; font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 1px 8px; border-radius: 999px; }
.hd-tab.is-active .c { color: var(--brand); background: var(--brand-050); }
/* La barra del tool Public Affairs: sta su OGNI pagina del modulo (da
   qualunque vista si torna indietro), quindi ha l'aria di una console:
   superficie contenuta, voce attiva piena. Scoped a .mo-nav — le
   .hd-tabs del resto del portale restano a sottolineatura. */
.mo-nav { gap: 3px; padding: 5px; background: var(--surface-2); border: 1px solid var(--border); border-bottom: 1px solid var(--border); border-radius: 11px; margin-bottom: 18px; scrollbar-width: thin; }
.mo-nav .hd-tab { gap: 5px; padding: 7px 11px; font-size: 0.84rem; white-space: nowrap; flex-shrink: 0; border-bottom: 0; margin-bottom: 0; border-radius: 8px; }
.mo-nav .hd-tab:hover { background: oklch(0.34 0.068 236 / 0.07); color: var(--brand); }
.mo-nav .hd-tab.is-active { background: var(--brand); color: #fff; box-shadow: 0 6px 14px -9px oklch(0.34 0.068 236 / 0.8); }
.mo-nav .hd-tab .c { padding-inline: 5px; }
.mo-nav .hd-tab.is-active .c { background: oklch(1 0 0 / 0.18); color: #fff; }

/* Selettore a segmenti (es. il tono in Cabina): tre stati sulla stessa
   riga, lo stato corrente pieno. I bottoni POSTano subito via form=. */
.seg { display: inline-flex; align-items: center; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; }
.seg button { border: 0; background: none; cursor: pointer; font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--muted); padding: 4px 12px; border-radius: 999px; transition: color var(--dur, .15s) var(--ease, ease), background var(--dur, .15s) var(--ease, ease); }
.seg button:hover { color: var(--ink); }
.seg button.is-on { background: #fff; color: var(--brand); box-shadow: var(--shadow-sm); }

/* ---------- Console operatore (admin) ---------- */
.console-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cstat { padding: 18px 20px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.cstat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.cstat .n { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.cstat .l { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.cstat.is-open .n { color: var(--st-open); }
.cstat.is-prog .n { color: var(--st-prog); }

/* ---------- Nuovo quesito (details dropdown) ---------- */
.newq { position: relative; }
.newq > summary { list-style: none; cursor: pointer; }
.newq > summary::-webkit-details-marker { display: none; }
.newq-form { position: absolute; right: 0; margin-top: 10px; width: min(430px, 88vw); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 18px; z-index: var(--z-sticky); }
.newq-form label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--ink-soft); margin: 10px 0 5px; }
.newq-form label:first-child { margin-top: 0; }
.newq-form input, .newq-form textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.newq-form textarea { min-height: 96px; resize: vertical; }
.newq-form input:focus, .newq-form textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px oklch(0.62 0.13 236 / 0.15); }
.newq-actions { margin-top: 14px; display: flex; justify-content: flex-end; }

/* ---------- Controllo stato (admin) ---------- */
.status-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; padding: 11px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.status-ctl .scl { font-size: 0.8rem; font-weight: 600; color: var(--muted); margin-right: 2px; }
.sbtn { font-size: 0.82rem; font-weight: 600; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.sbtn:hover { border-color: var(--border-strong); color: var(--ink); }
.sbtn.on.open { background: var(--st-open-bg); color: var(--st-open); border-color: transparent; }
.sbtn.on.prog { background: var(--st-prog-bg); color: var(--st-prog); border-color: transparent; }
.sbtn.on.done { background: var(--st-done-bg); color: var(--st-done); border-color: transparent; }
.sbtn.on.risp { background: var(--st-risp-bg); color: var(--st-risp); border-color: transparent; }

/* Il riquadro «Nuovo quesito» dello staff (portale/base.html) e il pannello
   degli avvisi dei quesiti (quesiti_impostazioni.html). */
.qalert { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; padding: 14px 18px;
  border: 1px solid oklch(0.85 0.07 70); border-radius: var(--r-sm); background: var(--st-open-bg);
  color: oklch(0.38 0.08 60); }
.qalert > .icon { flex: none; width: 1.25rem; height: 1.25rem; margin-top: 1px; color: var(--st-open); }
.qalert-testo { flex: 1; min-width: 0; }
.qalert h2 { margin: 0 0 4px; font-family: var(--font-sans); font-size: 0.95rem; font-weight: 600; line-height: 1.35; color: oklch(0.34 0.08 60); }
.qalert ul { margin: 0; padding: 0; list-style: none; font-size: 0.86rem; line-height: 1.5; }
.qalert li + li { margin-top: 2px; }
.qalert a { color: inherit; font-weight: 600; text-underline-offset: 0.18em; }
.qalert li span { color: oklch(0.45 0.07 60); }
.qalert-tutti { display: inline-block; margin-top: 6px; font-size: 0.84rem; }
.qalert form { flex: none; margin: 0; }
@media (max-width: 640px) {
  .qalert { flex-wrap: wrap; }
  .qalert-testo { flex-basis: calc(100% - 40px); }
  .qalert form { margin-left: 34px; }
}

.qdest { margin: 0 0 14px; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.qdest li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.qdest li span { overflow-wrap: anywhere; }
.qdest form { margin: 0; flex: none; }
.qdest-vuoto { color: oklch(0.48 0.1 66); }
.qdest-aggiungi { display: flex; gap: 8px; flex-wrap: wrap; }
.qdest-aggiungi input { flex: 1; min-width: 220px; font: inherit; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink); }
.qdest-aggiungi input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px oklch(0.62 0.13 236 / 0.15); }
.qregole { margin: 0; padding-left: 1.1rem; font-size: 0.9rem; line-height: 1.55; color: var(--ink-soft, var(--ink)); }
.qregole li + li { margin-top: 6px; }

/* ---------- Welcome (dashboard utente) ---------- */
.welcome .welcome-date { font-size: 0.82rem; color: var(--muted); margin-bottom: 6px; }
.hello-sub { color: var(--muted); margin-top: 8px; max-width: 62ch; }
.hello-sub b { color: var(--ink-soft); font-weight: 600; }

/* ---------- Forms (impostazioni / anagrafica) ---------- */
.settings { display: flex; flex-direction: column; gap: 20px; max-width: 640px; }
.pform { padding: 16px 20px 20px; }
.frow { margin-bottom: 14px; }
.frowgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.frow label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.frow input, .frow select { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); }
.frow input:focus, .frow select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px oklch(0.62 0.13 236 / 0.15); }
.ro-val { padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--muted); }
.ferr { color: oklch(0.5 0.16 25); font-size: 0.8rem; margin-top: 5px; }
.fhint { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }
.fhint ul { margin: 6px 0 0; padding-left: 18px; }
/* Contatore di caratteri del pannello SEO (redazione/_seo.html + sito/static/sito/seo.js) */
.seo-conta { float: right; }
.seo-conta-oltre { color: oklch(0.5 0.16 25); font-weight: 700; }
.finfo.err { background: oklch(0.96 0.04 25); color: oklch(0.5 0.16 25); border: 1px solid oklch(0.85 0.08 25); padding: 10px 12px; border-radius: var(--r-sm); font-size: 0.84rem; margin-bottom: 14px; }
.pform-actions { margin-top: 18px; display: flex; justify-content: flex-end; }
.sec-h { font-size: 1rem; margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-weight: 500; cursor: pointer; }
.check span { color: var(--ink-soft); }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.check.dis { opacity: 0.55; cursor: not-allowed; }
.toggle-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 18px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); font-size: 0.9rem; color: var(--ink-soft); }

/* ---------- Utenti (lista + dettaglio) ---------- */
.udetail-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.udetail-head .udh-info { min-width: 0; }
.udetail-head h1 { font-size: 1.5rem; }
.udetail-head .udh-state { margin-left: auto; }
.uavatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--brand-050); color: var(--brand); font-weight: 700; font-size: 0.85rem; }
.uavatar.lg { width: 56px; height: 56px; font-size: 1.3rem; }
.tablewrap { overflow-x: auto; }
.utable { min-width: 660px; }
.utable-head, .urow { display: grid; grid-template-columns: 2.6fr 1.1fr 1fr 1fr auto; gap: 14px; align-items: center; padding: 13px 20px; }
.utable-head { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--border); }
.urow { border-bottom: 1px solid var(--border); transition: background var(--dur) var(--ease); }
.urow:last-child { border-bottom: 0; }
.urow:hover { background: var(--surface-2); }
.ucell-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.uinfo { min-width: 0; }
.uname { font-weight: 600; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uname:hover { color: var(--brand); }
.umail { font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.ucell { font-size: 0.86rem; color: var(--ink-soft); }
.ualign-end { display: flex; justify-content: flex-end; }
.tagr { font-size: 0.74rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.tagr.staff { background: var(--brand-050); color: var(--brand); border-color: transparent; }
.tagr.assoc { background: var(--gold-050); color: var(--gold-700); border-color: transparent; }
.pill-off { color: var(--muted); background: var(--surface-2); }
.pill-warn { color: #92722B; background: #FBF3E4; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ---------- Visibilità: badge e scelte ---------- */
.vbadge { display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.vbadge .icon { width: 0.85rem; height: 0.85rem; }
.vbadge.priv { color: var(--muted); background: var(--surface-2); }
.vbadge.pub { color: var(--st-done); background: var(--st-done-bg); }

.vis-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vis-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); cursor: pointer; transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.vis-card:hover { border-color: var(--border-strong); }
.vis-card input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
.vis-card:has(input:checked) { border-color: var(--brand); background: var(--brand-050); box-shadow: inset 0 0 0 1px var(--brand); }
.vis-ic { color: var(--brand); }
.vis-ic .icon { width: 1.2rem; height: 1.2rem; }
.vis-txt { display: flex; flex-direction: column; gap: 2px; }
.vis-txt b { font-weight: 600; }
.vis-txt span { font-size: 0.8rem; color: var(--muted); }

/* ---------- Barra di gestione (thread) ---------- */
.manage-bar { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; margin-bottom: 22px; padding: 12px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.mb-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mb-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; }
.seg-form { display: inline-flex; gap: 6px; }
.closed-note { display: flex; align-items: center; gap: 10px; padding: 14px 18px; color: var(--muted); font-size: 0.9rem; }
.closed-note .icon { width: 1.2rem; height: 1.2rem; color: var(--st-done); flex: none; }

/* ---------- Utenze multiple ---------- */
.ubanner { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: var(--r-md); margin-bottom: 20px; font-size: 0.92rem; border: 1px solid; }
.ubanner .icon { flex: none; width: 1.25rem; height: 1.25rem; }
.ubanner .btn { margin-left: auto; flex: none; }
.ubanner.promo { background: var(--brand-050); border-color: oklch(0.88 0.03 236); color: var(--brand); }
.ubanner.warn { background: var(--st-open-bg); border-color: oklch(0.88 0.06 78); color: oklch(0.48 0.1 66); }

.seatbar { display: flex; align-items: center; gap: 20px; padding: 18px 22px; flex-wrap: wrap; }
.seat-count .n { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.seat-count .n .of { font-size: 1rem; font-weight: 500; color: var(--muted); }
.seat-count .l { font-size: 0.82rem; color: var(--muted); }
.seat-dots { display: flex; gap: 7px; margin-left: auto; flex-wrap: wrap; }
.seat-dots .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border-strong); }
.seat-dots .dot.on { background: var(--brand); border-color: var(--brand); }

.invite-row { display: flex; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.invite-row input[type="email"] { flex: 1; font: inherit; padding: 10px 13px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.invite-row input[type="email"]:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px oklch(0.62 0.13 236 / 0.15); }
.invite-row input:disabled, .invite-row .btn:disabled { opacity: 0.55; cursor: not-allowed; }

.tagr.collab { background: var(--st-prog-bg); color: var(--st-prog); border-color: transparent; }
.tagr.madre { background: var(--brand-050); color: var(--brand); border-color: transparent; }

.sig-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.sig { font-size: 0.78rem; font-weight: 600; color: oklch(0.48 0.1 66); background: var(--st-open-bg); padding: 4px 11px; border-radius: 999px; }
.acc-list { display: flex; flex-direction: column; }
.acc-row { display: grid; grid-template-columns: 130px 130px 1fr; gap: 10px; padding: 7px 0; font-size: 0.82rem; border-bottom: 1px solid var(--border); }
.acc-row:last-child { border-bottom: 0; }
.acc-when { color: var(--ink-soft); font-weight: 500; }
.acc-ip { color: var(--brand); font-variant-numeric: tabular-nums; }
.acc-ua { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

[data-copy].copied { color: var(--st-done); }

/* ---------- Stakeholder Relations ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.kpi .n { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.sel { font: inherit; font-size: 0.88rem; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); }
.sel:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px oklch(0.62 0.13 236 / 0.15); }

.funnel { display: flex; flex-direction: column; gap: 6px; }
.frow-f { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.frow-f:last-child { border-bottom: 0; }
.frow-f b { font-variant-numeric: tabular-nums; }

.consensi-mini { display: flex; gap: 5px; align-items: center; }
.cbit { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 0.68rem; font-weight: 700; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.cbit.on { background: var(--st-done-bg); color: var(--st-done); border-color: transparent; }

.consenso-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.consenso-row:last-of-type { border-bottom: 0; }

.importbox { padding: 0; }
.importbox > summary { list-style: none; cursor: pointer; padding: 13px 20px; font-size: 0.88rem; font-weight: 600; color: var(--brand); }
.importbox > summary::-webkit-details-marker { display: none; }
.import-form { display: flex; gap: 10px; padding: 0 20px 16px; flex-wrap: wrap; align-items: center; }

.regola-row { display: grid; grid-template-columns: 1.4fr 0.7fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.regola-row .sel { width: 100%; }

/* ---------- Marketing & Performance ---------- */
.dlt { font-size: 0.7rem; font-weight: 700; margin-left: 6px; padding: 1px 7px; border-radius: 999px; }
.dlt.good { color: var(--st-done); background: var(--st-done-bg); }
.dlt.bad { color: oklch(0.5 0.16 25); background: oklch(0.96 0.04 25); }
.dlt.up { color: var(--st-open); background: var(--st-open-bg); }
.dlt.down { color: var(--st-done); background: var(--st-done-bg); }

.funnel-viz { display: flex; flex-direction: column; gap: 10px; }
.fstep { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: center; font-size: 0.85rem; }
.fstep .flabel { color: var(--muted); }
.fstep .fbar { height: 16px; border-radius: 999px; background: linear-gradient(90deg, var(--brand), oklch(0.45 0.08 236)); min-width: 24px; }
.fstep .fbar.gold { background: linear-gradient(90deg, var(--gold), var(--gold-700)); }
.fstep b { font-variant-numeric: tabular-nums; }

.spark { display: flex; align-items: flex-end; gap: 2px; height: 72px; }
.spark .sbar { flex: 1; min-height: 2px; background: var(--brand); opacity: 0.85; border-radius: 3px 3px 0 0; transition: opacity var(--dur); }
.spark .sbar:hover { opacity: 1; }
.spark.lead { height: 48px; }
.spark.lead .sbar { background: var(--gold); }
.legend { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.legend.brand { background: var(--brand); }
.legend.gold { background: var(--gold); }

.banner-demo { padding: 11px 16px; border-radius: var(--r-sm); background: var(--gold-050); color: var(--gold-700); font-size: 0.86rem; }
.banner-demo a { color: var(--gold-700); text-decoration: underline; }

/* Funnel conversioni (dettagliato) */
.conv-funnel { display: flex; flex-direction: column; gap: 12px; }
.cf-row { display: grid; grid-template-columns: 1fr 190px; gap: 14px; align-items: center; }
.cf-track { background: var(--surface-2); border-radius: 8px; height: 38px; overflow: hidden; }
.cf-fill { height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--brand), oklch(0.5 0.1 236)); display: flex; align-items: center; padding: 0 12px; min-width: 44px; transition: width var(--dur) var(--ease); }
.cf-fill.gold { background: linear-gradient(90deg, var(--gold), var(--gold-700)); }
.cf-inbar { color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.cf-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cf-label { font-size: 0.9rem; color: var(--ink); font-weight: 500; }
.cf-badge { font-size: 0.74rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.cf-badge.good { color: var(--st-done); background: var(--st-done-bg); }
.cf-badge.mid { color: var(--st-open); background: var(--st-open-bg); }
.cf-badge.low { color: oklch(0.5 0.16 25); background: oklch(0.96 0.04 25); }
.cf-badge.base { color: var(--muted); background: var(--surface-2); }
.cf-drop { font-size: 0.74rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* SEO — distribuzione, movimenti, rank */
.dist { display: flex; height: 26px; border-radius: 8px; overflow: hidden; gap: 2px; }
.dist-seg { min-width: 0; transition: flex var(--dur) var(--ease); }
.dist-seg.top3, .sw.top3 { background: var(--st-done); }
.dist-seg.top10, .sw.top10 { background: var(--brand); }
.dist-seg.top20, .sw.top20 { background: oklch(0.6 0.1 236); }
.dist-seg.top50, .sw.top50 { background: var(--gold-700); }
.dist-seg.top100, .sw.top100 { background: oklch(0.68 0.14 60); }
.dist-seg.oltre, .sw.oltre { background: var(--border-strong); }
.dist-leg { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 14px; font-size: 0.8rem; color: var(--muted); }
.dist-leg i.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.dist-leg b { color: var(--ink); font-variant-numeric: tabular-nums; }

.mv-h { font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; }
.mv-h.up { color: var(--st-done); }
.mv-h.down { color: oklch(0.55 0.18 25); }
.mv-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 0.86rem; }
.mv-row:last-child { border-bottom: 0; }
.mv-kw { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv-delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.mv-delta.up { color: var(--st-done); }
.mv-delta.down { color: oklch(0.55 0.18 25); }
.mv-pos { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.mv-empty { color: var(--muted); font-size: 0.84rem; padding: 4px 0; }

.rank-pill { display: inline-grid; place-items: center; min-width: 30px; height: 24px; padding: 0 8px; border-radius: 7px; font-weight: 700; font-size: 0.82rem; font-variant-numeric: tabular-nums; color: #fff; }
.rank-pill.p3 { background: var(--st-done); }
.rank-pill.p10 { background: var(--brand); }
.rank-pill.p20 { background: oklch(0.6 0.1 236); }
.rank-pill.p50 { background: var(--gold-700); }
.rank-pill.p100 { background: oklch(0.68 0.14 60); }
.rank-pill.off { background: var(--muted); }
.var { font-size: 0.82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.var.up { color: var(--st-done); }
.var.down { color: oklch(0.55 0.18 25); }
.var.flat { color: var(--muted); }
.kd { display: inline-grid; place-items: center; min-width: 26px; height: 22px; border-radius: 6px; font-size: 0.76rem; font-weight: 700; color: #fff; background: oklch(0.66 0.15 calc(140 - var(--kd) * 1.15)); }
.rank-spark { width: 120px; height: 34px; display: block; }

/* ---------- Posta (client email) ---------- */
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.inline-f { display: inline; }
.chk { font-size: 0.85rem; color: var(--ink-soft); display: inline-flex; gap: 6px; align-items: center; }

.mail { display: grid; grid-template-columns: 236px 1fr; gap: 18px; align-items: start; }

.mail-rail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: 12px; position: sticky; top: 16px; }
.mail-compose { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; padding: 11px; border-radius: var(--r-sm); background: var(--brand); color: #fff; font-weight: 600; font-size: 0.9rem; box-shadow: var(--shadow-sm); }
.mail-compose:hover { background: oklch(0.34 0.06 236); }
.mail-compose .icon { width: 18px; height: 18px; }
.mail-search { display: flex; align-items: center; gap: 7px; margin: 12px 2px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.mail-search .icon { width: 15px; height: 15px; color: var(--muted); flex: none; }
.mail-search input { border: 0; background: none; font: inherit; font-size: 0.84rem; width: 100%; color: var(--ink); }
.mail-search input:focus { outline: none; }

.rail-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--ink-soft); font-size: 0.86rem; font-weight: 500; }
.rail-item .icon { width: 17px; height: 17px; flex: none; color: var(--muted); }
.rail-item:hover { background: var(--surface-2); color: var(--ink); }
.rail-item.on { background: var(--brand-050); color: var(--brand); }
.rail-item.on .icon { color: var(--brand); }
.rail-item.foot { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 14px; border-radius: 0 0 8px 8px; }
.rail-badge { margin-left: auto; font-size: 0.72rem; font-weight: 700; color: var(--brand); background: var(--brand-050); padding: 1px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.rail-cas { margin-top: 12px; }
.rail-cas-h { display: flex; align-items: center; gap: 7px; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding: 4px 10px; }
.dot { width: 9px; height: 9px; border-radius: 999px; flex: none; }

.mail-main { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-sm); overflow: hidden; min-height: 60vh; }
.mtoolbar { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.mcheck-all { display: flex; align-items: center; }
.mtitle { display: flex; flex-direction: column; }
.mtitle b { font-size: 0.92rem; }
.mtitle span { font-size: 0.74rem; color: var(--muted); }
.mtools { display: flex; gap: 2px; margin-left: 6px; }
.mtool { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); background: none; border: 0; cursor: pointer; }
.mtool .icon { width: 18px; height: 18px; }
.mtool:hover { background: var(--surface-2); color: var(--ink); }
.mkbd { margin-left: auto; color: var(--muted); font-size: 1rem; cursor: default; }

.mrows { display: flex; flex-direction: column; }
.mrow { display: grid; grid-template-columns: 26px 26px 1fr; align-items: center; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--border); border-left: 3px solid transparent; transition: background var(--dur); }
.mrow:hover { background: var(--surface-2); }
.mrow.nuovo { border-left-color: var(--brand); }
.mrow.cursore { background: var(--brand-050); box-shadow: inset 0 0 0 1px var(--brand-100, var(--border-strong)); }
.mstar { background: none; border: 0; cursor: pointer; display: grid; place-items: center; padding: 4px; }
.mstar .icon { width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 1.6; }
.mstar:hover .icon { stroke: var(--gold-700); }
.mstar.on .icon { fill: var(--gold); stroke: var(--gold-700); }
.mrow-link { display: grid; grid-template-columns: 30px 160px 1fr auto; align-items: center; gap: 10px; padding: 10px 4px; min-width: 0; }
.mavatar { width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; flex: none; }
.mfrom { font-size: 0.86rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrow.nuovo .mfrom { font-weight: 700; }
.mcount { font-size: 0.7rem; color: var(--muted); background: var(--surface-2); padding: 0 6px; border-radius: 999px; }
.mbody { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.86rem; }
.msubj { color: var(--ink); font-weight: 500; }
.mrow.nuovo .msubj { font-weight: 700; }
.msnip { color: var(--muted); }
.mmeta { display: flex; align-items: center; gap: 6px; }
.mclip { width: 14px; height: 14px; color: var(--muted); }
.mdate { font-size: 0.76rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mempty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 60px 20px; color: var(--muted); }
.mempty .icon { width: 34px; height: 34px; opacity: 0.5; }

/* Lettura conversazione */
.mread-top { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.mback { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: var(--muted); border: 1px solid var(--border); flex: none; }
.mback:hover { background: var(--surface-2); color: var(--ink); }
.mback .icon { width: 18px; height: 18px; }
.mread-subj { font-size: 1.1rem; margin: 0; flex: 1 1 220px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mread-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1 1 100%; }
@media (min-width: 1100px) { .mread-actions { flex: 0 0 auto; } }
.ctx-card { display: flex; align-items: center; gap: 12px; margin: 16px 18px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.ctx-avatar { width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center; font-weight: 700; flex: none; }
.ctx-body { flex: 1; min-width: 0; }
.ctx-name { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ctx-meta { font-size: 0.8rem; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; }
.ctx-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.thread { display: flex; flex-direction: column; gap: 14px; padding: 4px 18px 18px; }
.tmsg { border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); }
.tmsg.mine { background: var(--brand-050); border-color: transparent; }
.tmsg-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px 0; }
.tmsg-who { flex: 1; min-width: 0; }
.tmsg-who b { font-size: 0.9rem; }
.tmsg-to { display: block; font-size: 0.76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tmsg-date { font-size: 0.76rem; color: var(--muted); white-space: nowrap; }
.tmsg-body { padding: 10px 14px 14px; font-size: 0.9rem; line-height: 1.55; color: var(--ink-soft); white-space: pre-wrap; word-wrap: break-word; }
.tmsg-att { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 14px; }
.att-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 0.78rem; color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; }
.att-chip .icon { width: 13px; height: 13px; color: var(--muted); }

.quickreply { border-top: 1px solid var(--border); padding: 14px 18px 18px; }
.quickreply textarea { width: 100%; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 11px 13px; font: inherit; font-size: 0.9rem; resize: vertical; background: var(--surface); }
.quickreply textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px oklch(0.62 0.13 236 / 0.15); }
.quickreply-bar { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }

/* Composizione */
.compose { display: flex; flex-direction: column; }
.cfield { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--border); position: relative; }
.cfield[hidden] { display: none; }
.cfield label { font-size: 0.82rem; color: var(--muted); }
.cfield input, .cfield .sel { border: 0; background: none; font: inherit; font-size: 0.9rem; color: var(--ink); width: 100%; }
.cfield input:focus, .cfield .sel:focus { outline: none; }
.cfield-links { position: absolute; right: 18px; font-size: 0.78rem; color: var(--muted); }
.cfield-links a { color: var(--muted); }
.cbody { border: 0; padding: 16px 18px; font: inherit; font-size: 0.94rem; line-height: 1.6; min-height: 300px; resize: vertical; color: var(--ink); }
.cbody:focus { outline: none; }
.compose-bar { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.btn-file { position: relative; cursor: pointer; }
.canned { margin-left: auto; max-width: 200px; }

/* Impostazioni posta */
.cas-panel { margin-bottom: 12px; padding: 0; }
.cas-panel > summary { list-style: none; cursor: pointer; padding: 14px 18px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.cas-panel > summary::-webkit-details-marker { display: none; }
.cas-form { padding: 4px 18px 18px; }
.saved-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.saved-add { display: grid; gap: 8px; margin-top: 14px; }
.saved-add input, .saved-add textarea { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 9px 12px; font: inherit; font-size: 0.88rem; }

/* Aiuto scorciatoie */
.kbd-help { position: fixed; inset: 0; display: none; place-items: center; background: oklch(0.2 0.03 250 / 0.5); z-index: var(--z-drawer); }
.kbd-help.on { display: grid; }
.kbd-help .card { background: var(--surface); border-radius: var(--r-md); padding: 22px 26px; box-shadow: var(--shadow-lg); max-width: 420px; }
.kbd-help h3 { margin: 0 0 14px; }
.kbd-help dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-size: 0.88rem; }
.kbd-help kbd { font-family: inherit; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 8px; font-weight: 600; font-size: 0.82rem; }

/* ---------- Monitoraggio: coda di triage (Task 3) ---------- */
/* Elenco denso ("come una casella di posta", non card): righe strette,
   in griglia, per far stare più segnalazioni possibile a schermo — è la
   metrica che conta per questa vista (spec §7). I filtri e le due barre
   di azione restano compatti apposta: ogni riga di "cromo" sopra
   l'elenco è una riga di segnalazioni in meno a schermo. */
.mo-filters { margin-bottom: 8px; row-gap: 8px; }
.mo-filters .sel { max-width: 148px; }
.mtoolbar.mo-tight { padding: 6px 14px; flex-wrap: wrap; row-gap: 6px; }
.mo-scroll { overflow-x: auto; }
.mo-head, .mo-row {
  display: grid;
  grid-template-columns: 22px 40px 1fr 150px 96px 116px;
  gap: 10px;
  align-items: center;
  padding: 3px 14px;
  min-width: 760px;
}
.mo-head {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--border);
  padding-top: 7px; padding-bottom: 7px;
}
.mo-row { border-bottom: 1px solid var(--border); font-size: 0.82rem; transition: background var(--dur) var(--ease); }
.mo-row:last-child { border-bottom: 0; }
.mo-row:hover { background: var(--surface-2); }
.mo-row.cursore { background: var(--brand-050); box-shadow: inset 0 0 0 1px var(--border-strong); }
.mo-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--brand); }
.mo-score { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand); text-align: center; }
.mo-main { min-width: 0; line-height: 1.2; }
.mo-title { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.mo-title:hover { color: var(--brand); }
.mo-meta { font-size: 0.7rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mo-tags { display: flex; gap: 3px; flex-wrap: wrap; overflow: hidden; max-height: 1.5em; }
.mo-tags .chip { padding: 0 7px; font-size: 0.66rem; line-height: 1.4; }
.mo-actions { display: flex; gap: 3px; align-items: center; justify-content: flex-end; }
.mo-actions form { display: inline-flex; }
.mo-ic { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 0.78rem; line-height: 1; }
.mo-ic:hover { background: var(--surface-2); color: var(--ink); }
.mo-ok:hover { color: var(--st-done); border-color: var(--st-done); }
.mo-no:hover { color: oklch(0.55 0.16 25); border-color: oklch(0.55 0.16 25); }
.mo-nota summary { list-style: none; cursor: pointer; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); color: var(--muted); font-size: 0.74rem; }
.mo-nota summary::-webkit-details-marker { display: none; }
.mo-nota[open] summary { color: var(--ink); background: var(--surface-2); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; transform: translateX(-100%);
    transition: transform var(--dur) var(--ease); z-index: var(--z-drawer);
  }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .backdrop { position: fixed; inset: 0; background: oklch(0.2 0.03 250 / 0.4); opacity: 0; visibility: hidden; transition: opacity var(--dur); z-index: var(--z-backdrop); }
  body.nav-open .backdrop { opacity: 1; visibility: visible; }
  .hamburger { display: inline-grid; place-items: center; padding: 7px; margin: -4px 0; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); }
  .grid-2 { grid-template-columns: 1fr; }
  .cf-row { grid-template-columns: 1fr 128px; }
  .mail { grid-template-columns: 1fr; }
  .mail-rail { position: static; }
  .mrow-link { grid-template-columns: 30px 1fr auto; }
  .mrow-link .mfrom { display: none; }
  .content { padding: 20px 16px; }
  .top-right { gap: 8px; }
  .top-right .searchbox { display: none; }
  .demo-switch .demo-lbl { display: none; }
  .console-stats { grid-template-columns: 1fr; }
  .frowgrid { grid-template-columns: 1fr; }
  .ubanner { flex-wrap: wrap; }
  .ubanner .btn { margin-left: 0; }
  .regola-row { grid-template-columns: 1fr; }
  .acc-row { grid-template-columns: 110px 1fr; }
  .acc-ua { grid-column: 1 / -1; }
  .newq-form { position: fixed; left: 16px; right: 16px; width: auto; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .assoc-areas,
  .assoc-layout,
  .assoc-filters,
  .monitor-preview-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* Entrance (progressive; content is visible by default) */
@media (prefers-reduced-motion: no-preference) {
  .stagger > * { animation: rise var(--dur) var(--ease) both; }
  .stagger > *:nth-child(2) { animation-delay: 40ms; }
  .stagger > *:nth-child(3) { animation-delay: 80ms; }
  .stagger > *:nth-child(4) { animation-delay: 120ms; }
  .stagger > *:nth-child(5) { animation-delay: 160ms; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* La posta resta a due colonne appena c'è spazio (anche con la shell mobile) */
@media (min-width: 640px) {
  .mail { grid-template-columns: 232px 1fr; }
  .mail-rail { position: sticky; }
  .mrow-link { grid-template-columns: 30px 150px 1fr auto; }
  .mrow-link .mfrom { display: block; }
}

/* Textarea del backend: espanse e che crescono col contenuto — mai
   finestrini mezzi chiusi. :where() tiene la specificità a zero, così
   i componenti con misure proprie (composer, chat) restano padroni. */
.content :where(textarea) {
  width: 100%;
  box-sizing: border-box;
  min-height: 110px;
  max-height: 480px;
  resize: vertical;
  field-sizing: content;
}

/* ── Posta: lettura dei messaggi (14/09/2026) ─────────────────────────── */
.mail-refresh { margin: 8px 0 0; }
.mail-refresh .rail-item { width: 100%; border: 0; background: none; font: inherit; cursor: pointer; text-align: left; }
.rail-time { margin-left: auto; font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
details.tmsg > summary { list-style: none; cursor: pointer; padding: 12px 14px; }
details.tmsg > summary::-webkit-details-marker { display: none; }
details.tmsg[open] > summary { padding-bottom: 0; cursor: default; }
details.tmsg:not([open]) > summary:hover { background: var(--surface-2); border-radius: var(--r-sm); }
.tmsg-addr { font-weight: 400; font-size: 0.8rem; color: var(--muted); }
.tmsg-snip { display: block; font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.tmsg[open] .tmsg-snip { display: none; }
.tmsg-side { display: flex; align-items: center; gap: 8px; flex: none; }
.tmsg-side .mclip { width: 14px; height: 14px; color: var(--muted); }
.tmsg-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 14px 0; padding: 8px 12px; font-size: 0.8rem; color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.tmsg-frame { display: block; width: 100%; min-height: 80px; border: 0; margin: 8px 0 6px; background: #fff; }
.tmsg-body { padding: 10px 14px 14px; font-size: 0.92rem; line-height: 1.6; color: var(--ink); white-space: pre-wrap; word-wrap: break-word; max-width: 78ch; }
.tmsg-body a { color: var(--brand); text-decoration: underline; }
.tmsg-quote { margin: 0 14px 14px; }
.tmsg-quote > summary { cursor: pointer; font-size: 0.8rem; color: var(--brand); list-style: none; }
.tmsg-quote > summary::-webkit-details-marker { display: none; }
.tmsg-quote > summary::before { content: "···  "; letter-spacing: 0.1em; }
.tmsg-quote pre { margin: 8px 0 0; padding: 10px 12px; border-left: 3px solid var(--border); color: var(--muted); font: inherit; font-size: 0.85rem; white-space: pre-wrap; word-wrap: break-word; }
.att-ext { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; color: #92722b; background: rgba(190, 154, 78, 0.16); padding: 2px 6px; border-radius: 5px; }
.att-size { color: var(--muted); font-size: 0.72rem; }
.att-chip:hover { border-color: var(--brand); color: var(--brand); }

.mpages { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px; border-top: 1px solid var(--border); }

.firma-anteprima { margin: 10px 0 0; border: 1px dashed var(--border); border-radius: var(--r-sm); padding: 8px 12px; background: var(--surface-2); }
.firma-anteprima > summary { cursor: pointer; font-size: 0.8rem; color: var(--muted); list-style: none; }
.firma-anteprima > summary::-webkit-details-marker { display: none; }
.firma-corpo { margin-top: 8px; padding: 12px; background: #fff; border-radius: 6px; overflow-x: auto; }
.firma-corpo img { max-width: 100%; height: auto !important; }
.firma-corpo table { max-width: 100% !important; }
.firma-anteprima-testo { margin: 8px 0 0; }

/* ── Posta: menu laterale a pannelli (14/09/2026) ─────────────────────── */
.mail-rail { max-height: calc(100vh - 32px); overflow-y: auto; scrollbar-width: thin; }
details.rail-cas { margin-top: 10px; }
details.rail-cas > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 8px; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
details.rail-cas > summary::-webkit-details-marker { display: none; }
details.rail-cas > summary:hover { background: var(--surface-2); color: var(--ink); }
details.rail-cas[data-corrente] > summary { color: var(--brand); }
.rail-cas-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: 0; font-size: 0.84rem; }
.rail-caret { width: 14px; height: 14px; flex: none; transition: transform .15s ease-out; }
details.rail-cas[open] > .rail-cas-h .rail-caret { transform: rotate(180deg); }
details.rail-altre > summary { list-style: none; cursor: pointer; color: var(--muted); }
details.rail-altre > summary::-webkit-details-marker { display: none; }
.rail-conta { margin-left: auto; font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.rail-sotto { padding-left: 22px; font-weight: 400; font-size: 0.82rem; }
.rail-nome { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.firma-testo { font: inherit; white-space: pre-wrap; margin: 0; color: var(--ink-soft); }
@media (prefers-reduced-motion: reduce) { .rail-caret { transition: none; } }

/* ── Posta: preferenze dell'operatore ────────────────────────────────── */
.pref-panel { margin-bottom: 20px; }
.pref-nota { margin: 0 0 10px; }
.pref-radio { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.pref-radio input { margin-top: 3px; flex: none; }
.pref-radio .muted { color: var(--muted); }

/* ── Posta: etichette, viste, ordine ─────────────────────────────────── */
.rail-etichette { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--border); }
.rail-etichette > summary .icon:first-child { width: 14px; height: 14px; flex: none; }
.rail-badge.avv, .count.avv { background: var(--gold, #b08d3c); color: #fff; }
.etq { display: inline-flex; align-items: center; gap: 5px; margin-right: 6px; padding: 1px 8px 1px 6px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; color: var(--ink); background: color-mix(in oklab, var(--c) 16%, transparent); border: 1px solid color-mix(in oklab, var(--c) 45%, transparent); white-space: nowrap; vertical-align: middle; }
.etq::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.etq-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
.etq-x { border: 0; background: none; color: var(--muted); font-size: 0.9rem; line-height: 1; padding: 0 0 0 4px; cursor: pointer; }
.etq-x:hover { color: var(--danger, #a63d3d); }
.mtool-menu { position: relative; }
.mtool-menu > summary { list-style: none; cursor: pointer; }
.mtool-menu > summary::-webkit-details-marker { display: none; }
.mtool-pop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 220px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); display: grid; gap: 2px; }
.mtool-opt { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 6px; font: inherit; font-size: 0.86rem; color: var(--ink); cursor: pointer; }
.mtool-opt:hover { background: var(--surface-2); }
.mtool-opt small { color: var(--muted); }
.mord { margin-left: auto; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 0.76rem; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; }
.mord.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.mord:hover { color: var(--ink); }
.mord.on:hover { color: #fff; }
.etq-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--border); }
.etq-form input[type="color"] { width: 34px; height: 30px; padding: 2px; border: 1px solid var(--border); border-radius: 6px; background: none; }
.etq-form input[name="nome"] { flex: 1 1 180px; }
.etq-form select { flex: 0 1 220px; }
.etq-check { display: inline-flex; align-items: center; gap: 6px; font-size: 0.86rem; color: var(--ink-soft); }
.etq-nuova { border-top: 1px dashed var(--border); margin-top: 4px; }

/* ── Posta: destinatari a più righe nel compositore ──────────────────── */
.cdest { width: 100%; min-height: 34px; resize: none; overflow: hidden; line-height: 1.45; font: inherit; padding: 6px 0; border: 0; background: transparent; color: var(--ink); field-sizing: content; }
.cdest:focus { outline: none; }

.cas-esito { display: block; margin-top: 4px; font-size: 0.78rem; font-weight: 400; color: var(--muted); }

/* ── Posta: la parte citata nel compositore, sotto la firma ──────────── */
.citato-box { margin-top: 10px; border: 1px dashed var(--border); border-radius: var(--r-sm); padding: 8px 12px; background: var(--surface-2); }
.citato-box > summary { cursor: pointer; font-size: 0.8rem; color: var(--muted); list-style: none; }
.citato-box > summary::-webkit-details-marker { display: none; }
.citato-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.citato-punti { padding: 0 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--ink-soft); line-height: 1.4; }
.citato-nome { font-weight: 600; color: var(--ink-soft); }
.citato-azione { margin-left: auto; font-weight: 600; color: var(--brand); }
.citato-azione::after { content: "Mostra"; }
.citato-box[open] .citato-azione::after { content: "Nascondi"; }
.citato-testo { margin-top: 8px; background: var(--surface); color: var(--ink-soft); font-size: 0.92rem; }

.citato-testo { max-height: 380px; overflow: auto; }

/* la riga che spiega la casella scelta sta sotto la tendina, non nella colonna dell'etichetta */
.cfield [data-motivo] { grid-column: 2; margin: 2px 0 0; font-size: 0.78rem; }

/* ── Menu laterale stretto: solo icone, per lavorare più larghi ───────── */
.side-top { display: flex; align-items: center; }
.side-top .brand { flex: 1; min-width: 0; }
.side-stringi {
  flex: none; margin-right: 12px; padding: 6px; border-radius: 8px; border: 0;
  background: none; color: var(--side-muted); display: grid; place-items: center; cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.side-stringi:hover { background: oklch(1 0 0 / 0.08); color: var(--side-ink); }
.side-stringi .icon { width: 1.1rem; height: 1.1rem; transition: transform var(--dur) var(--ease); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.menu-stretto .shell { grid-template-columns: 74px 1fr; }
.menu-stretto .brand { padding: 18px 0 16px; justify-content: center; }
.menu-stretto .brand-testo { display: none; }
.menu-stretto .side-top { flex-direction: column; gap: 2px; }
.menu-stretto .side-stringi { margin: 0 0 10px; }
.menu-stretto .side-stringi .icon { transform: rotate(180deg); }
.menu-stretto .nav { padding: 8px 10px; }
/* il testo delle voci resta nel DOM (lettori di schermo) ma non occupa spazio */
.menu-stretto .nav-item { font-size: 0; justify-content: center; gap: 0; padding: 10px 0; position: relative; }
.menu-stretto .nav-item .icon { width: 1.25rem; height: 1.25rem; }
/* col menu stretto il numero non ci sta sull'icona: resta un pallino che dice «c'è qualcosa» */
.menu-stretto .nav-item .count { position: absolute; top: 6px; right: 14px; margin: 0; width: 8px; height: 8px; padding: 0; font-size: 0; border-radius: 50%; background: var(--gold); }
.menu-stretto .nav-item .count.avv { right: 24px; }
.menu-stretto .nav-item .soon { display: none; }
.menu-stretto .nav-label { font-size: 0; padding: 0; height: 0; margin: 10px 8px; border-top: 1px solid var(--side-border); }
.menu-stretto .side-user { flex-direction: column; gap: 6px; padding: 10px 6px; }
.menu-stretto .side-user .who { display: none; }
.menu-stretto .side-user .logout { margin: 0; }
@media (max-width: 900px) {
  /* sul telefono la barra è un cassetto: resta larga e col testo */
  .side-stringi { display: none; }
  .menu-stretto .shell { grid-template-columns: 1fr; }
  .menu-stretto .nav-item { font-size: inherit; justify-content: flex-start; gap: 11px; padding: 9px 11px; }
  .menu-stretto .nav-item .count { position: static; margin-left: auto; width: auto; height: auto; font-size: 0.72rem; padding: 1px 8px; border-radius: 999px; background: oklch(1 0 0 / 0.1); }
  .menu-stretto .nav-item .count.avv { right: auto; background: var(--gold); }
  .menu-stretto .nav-label { font-size: 0.68rem; height: auto; padding: 16px 10px 6px; margin: 0; border-top: 0; }
  .menu-stretto .brand { padding: 20px 20px 18px; justify-content: flex-start; }
  .menu-stretto .brand-testo { display: block; }
  .menu-stretto .side-user { flex-direction: row; padding: 12px; }
  .menu-stretto .side-user .who { display: block; }
}

.ia-lavori { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.88rem; }
.ia-lavori th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; padding-bottom: 4px; }
.ia-lavori td { padding: 5px 0; border-top: 1px solid var(--border); color: var(--ink-soft); }
.ia-lavori td code { font-size: 0.82rem; color: var(--ink); }

/* ── WhatsApp dentro la posta: fili a sinistra, conversazione a destra ───── */
.wa { display: grid; grid-template-columns: 290px 1fr; min-height: 62vh; }
.wa-fili { border-right: 1px solid var(--border); overflow-y: auto; max-height: 76vh; }
.wa-cerca { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.wa-cerca input { width: 100%; border: 1px solid var(--border); background: var(--surface-2); border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 0.84rem; color: var(--ink); }
.wa-cerca input:focus { outline: none; border-color: var(--brand); }
.wa-filo { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--ink); }
.wa-filo:hover { background: var(--surface-2); }
.wa-filo.on { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--brand); }
.wa-filo.nuovo .wa-chi { font-weight: 700; }
.wa-chi { display: flex; align-items: center; gap: 7px; font-size: 0.88rem; }
.wa-quando { color: var(--muted); font-size: 0.74rem; white-space: nowrap; }
.wa-anteprima { grid-column: 1 / -1; color: var(--muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wa-filo-aperto { display: flex; flex-direction: column; max-height: 76vh; }
.wa-testa { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.wa-testa .fhint { display: block; }
.wa-finestra { font-size: 0.76rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.wa-finestra.on { color: #3e7a5f; border-color: #3e7a5f; }
.wa-bolle { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 9px; background: var(--surface-2); }
.wa-bolla { max-width: 72%; align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 12px 12px 12px 3px; padding: 8px 12px; box-shadow: var(--shadow-sm); }
.wa-bolla.mia { align-self: flex-end; border-radius: 12px 12px 3px 12px; background: oklch(0.95 0.03 155); }
.wa-testo { font-size: 0.88rem; line-height: 1.45; overflow-wrap: anywhere; }
.wa-meta { margin-top: 3px; color: var(--muted); font-size: 0.71rem; }
.wa-errore { color: #a8443d; }
.wa-scrivi { display: flex; gap: 10px; align-items: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); }
.wa-scrivi textarea { flex: 1; resize: vertical; min-height: 40px; }
.wa-chiusa, .wa-vuoto { color: var(--muted); font-size: 0.85rem; padding: 16px 18px; margin: 0; }
.wa-diagnosi { color: #b45309; border-top: 1px solid var(--border); }
.wa-scegli { display: flex; align-items: center; justify-content: center; height: 100%; }
@media (max-width: 860px) {
  .wa { grid-template-columns: 1fr; }
  .wa-fili { border-right: 0; border-bottom: 1px solid var(--border); max-height: 42vh; }
}
