/* Roma RP Ticket — dashboard.
   Sistema: superfici antracite neutre, bordi sottili, rosso Roma riservato alle azioni principali,
   oro per i dettagli (valutazioni, focus). Font Inter incluso nel progetto. */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/static/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/static/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;
  /* Superfici */
  --bg: #0b0b0d;
  --sidebar: #0f0f12;
  --surface: #131316;
  --surface-2: #19191d;
  --surface-3: #202025;
  --input: #0e0e11;
  --hover: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  /* Testo */
  --text: #ececef;
  --text-2: #a8a8b2;
  --text-3: #8b8b95;
  /* Marchio e stati */
  --primary: #b42318;
  --primary-hover: #c9301f;
  --gold: #d4a72c;
  --gold-soft: rgba(212, 167, 44, 0.14);
  --ok: #3fb950;
  --warn: #e3a008;
  --err: #f0574a;
  --info: #5b9cf0;
  --discord: #5865f2;
  --series-1: #e5484d;
  --series-2: #4f8fdc;
  /* Forma e movimento */
  --radius: 12px;
  --radius-sm: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 150ms;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 1px 2px rgba(0, 0, 0, 0.4);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px rgba(212, 167, 44, 0.7);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.55 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
a { color: inherit; text-decoration: none; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 22px; line-height: 1.3; }
h2 { font-size: 15px; }
h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 12px; }
code { font: 12.5px ui-monospace, 'Cascadia Code', Consolas, monospace; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; }
small, .small { font-size: 12.5px; }
.muted { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.icon { width: 16px; height: 16px; flex: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }

.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--surface-3); padding: 8px 14px; border-radius: var(--radius-sm); }
.skip:focus { top: 12px; }

/* --- Struttura -------------------------------------------------------------------------------- */

.app { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100dvh; }
.main { display: flex; flex-direction: column; min-width: 0; }
.page-content { width: 100%; max-width: 1120px; margin: 0 auto; padding: 28px 32px 72px; outline: none; }
.page-content.wide { max-width: 1400px; }

.sidebar {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  background: var(--sidebar); border-right: 1px solid var(--border); padding: 12px;
}
.ws {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px;
  transition: background var(--fast) var(--ease);
}
.ws:hover { background: var(--hover); }
.ws-icon { width: 32px; height: 32px; border-radius: 9px; object-fit: cover; flex: none; }
.ws-mark {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; flex: none;
  font-size: 12px; font-weight: 800; letter-spacing: 0.02em; color: #fff;
  background: linear-gradient(145deg, #8b0000, #c0392b); box-shadow: inset 0 0 0 1px rgba(212, 167, 44, 0.45);
}
.ws-mark.lg { width: 44px; height: 44px; border-radius: 12px; font-size: 15px; }
.ws-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; flex: 1; }
.ws-text b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-text small { color: var(--text-3); font-size: 12px; }
.ws-chev { color: var(--text-3); }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 11.5px; font-weight: 500; color: var(--text-3); padding: 14px 10px 6px; }
.nav-label:first-child { padding-top: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500; transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav-link .icon { color: var(--text-3); transition: color var(--fast) var(--ease); }
.nav-link:hover { background: var(--hover); color: var(--text); }
.nav-link.active { background: var(--surface-3); color: var(--text); }
.nav-link.active .icon { color: var(--gold); }

.sidebar-foot {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px 4px; margin-top: 8px; border-top: 1px solid var(--border);
}
.sidebar-foot form { margin: 0; }
.me { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.me b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: var(--text-3); font-size: 12px; }
.avatar { border-radius: 50%; background: var(--surface-3); object-fit: cover; flex: none; vertical-align: middle; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 32px;
  background: rgba(11, 11, 13, 0.82); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; color: var(--text-3); font-size: 13.5px; }
.crumbs a { white-space: nowrap; transition: color var(--fast) var(--ease); }
.crumbs a:hover { color: var(--text); }
.crumbs [aria-current] { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb-sep { width: 14px; height: 14px; opacity: 0.6; }
.icon-btn.menu-btn { display: none; }
.scrim { display: none; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: transparent; border: 0; color: var(--text-3); cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

/* --- Intestazioni e superfici ----------------------------------------------------------------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.page-title p { color: var(--text-3); margin-top: 4px; }
.meta-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
section.card, .stack > .card { margin-bottom: 16px; }
.card > h2 { margin-bottom: 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-head p { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .table-wrap { margin: 0; }
.card.flush .empty { padding: 48px 20px; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.emoji-name { grid-template-columns: 110px minmax(0, 1fr); }
.split { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.split > .card { margin-bottom: 0; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpis.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi {
  display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-2); font-weight: 500; }
.kpi-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); }
.kpi b { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi small { color: var(--text-3); }

/* Tabelle */
.table-wrap { overflow-x: auto; margin: 0 -20px; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12.5px; font-weight: 500; color: var(--text-3); padding: 10px 12px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-2); }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--fast) var(--ease); }
.table tbody tr:hover { background: var(--hover); }
.row-link { cursor: pointer; }
.t-id { display: flex; flex-direction: column; line-height: 1.35; }
.t-id b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.t-id small { color: var(--text-3); }
.bar-col { width: 16%; min-width: 90px; }
.bar { display: block; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--primary), var(--gold)); }

/* Badge di stato e priorità: colore + testo, mai solo colore */
.badge, .prio { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.badge { padding: 2px 9px 2px 8px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-2); }
.badge i, .prio i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-open { color: #7ee2a0; border-color: rgba(63, 185, 80, 0.35); background: rgba(63, 185, 80, 0.08); }
.b-closed { color: var(--text-3); }
.prio { color: var(--text-2); }
.p-low i { background: var(--text-3); }
.p-normal i { background: var(--info); }
.p-high { color: #f5c26b; }
.p-high i { background: var(--warn); }
.p-urgent { color: #ff9b91; font-weight: 600; }
.p-urgent i { background: var(--err); box-shadow: 0 0 0 3px rgba(240, 87, 74, 0.18); }

/* Pulsanti */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font: inherit; font-weight: 500; white-space: nowrap; cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: rgba(255, 255, 255, 0.18); }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.55; cursor: progress; }
.btn .icon { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: transparent; }
.btn-discord { background: var(--discord); border-color: transparent; color: #fff; }
.btn-discord:hover { background: #4752c4; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); border-color: transparent; color: var(--text); }
.btn-danger { background: transparent; color: #ff8a80; border-color: rgba(240, 87, 74, 0.35); }
.btn-danger:hover { background: rgba(240, 87, 74, 0.1); border-color: rgba(240, 87, 74, 0.55); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-lg .icon { width: 18px; height: 18px; }

/* Moduli */
.stack { display: flex; flex-direction: column; }
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.label { display: block; font-weight: 500; margin-bottom: 7px; color: var(--text); }
.hint { color: var(--text-3); font-size: 12.5px; margin-top: 6px; }
input[type=text], input[type=number], input[type=url], input[type=search], input[type=time], select, textarea {
  width: 100%; min-height: 38px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--input); color: var(--text); font: inherit;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
input::placeholder, textarea::placeholder { color: #6e6e78; }
input:hover, select:hover, textarea:hover { border-color: rgba(255, 255, 255, 0.18); }
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(212, 167, 44, 0.6); box-shadow: 0 0 0 3px rgba(212, 167, 44, 0.15); }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b8b95' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
textarea { resize: vertical; line-height: 1.5; }
input[type=color] { width: 56px; height: 38px; padding: 3px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--input); cursor: pointer; }
.checklist { display: flex; flex-wrap: wrap; gap: 8px; max-height: 248px; overflow-y: auto; padding: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--input); color: var(--text-2); font-size: 13px; cursor: pointer; user-select: none;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.2); }
.chip.static { cursor: default; height: 26px; padding: 0 10px; font-size: 12px; background: var(--surface-2); }
.chip input { accent-color: var(--primary); margin: 0; }
.chip:has(input:checked) { color: var(--text); border-color: rgba(212, 167, 44, 0.55); background: var(--gold-soft); }
.chip:has(input:focus-visible) { box-shadow: var(--focus); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.inline { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer; color: var(--text-2); }
.inline input { accent-color: var(--primary); width: 16px; height: 16px; }
.switch { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { position: relative; flex: none; width: 36px; height: 20px; margin-top: 1px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background var(--fast) var(--ease); }
.switch .track::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #d4d4d8; transition: transform 200ms var(--ease), background var(--fast); }
.switch input:checked + .track { background: var(--primary); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + .track { box-shadow: var(--focus); }
.switch-text { color: var(--text); }
.switch-text small { display: block; color: var(--text-3); margin-top: 2px; }
.time-range { display: flex; align-items: center; gap: 10px; }
.time-range input { max-width: 140px; }
.questions { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.question { display: grid; grid-template-columns: 28px 1.3fr 1fr auto auto; gap: 10px; align-items: center; }
.q-num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-3); color: var(--text-3); font-size: 12px; font-weight: 600; }
.form-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 10px; padding: 14px 0 6px;
  background: linear-gradient(to bottom, transparent, var(--bg) 40%);
}
.inline-form { display: grid; grid-template-columns: 240px minmax(0, 1fr) auto; gap: 10px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.segmented a, .segmented label span {
  display: block; padding: 6px 12px; border-radius: 7px; color: var(--text-3); font-weight: 500; font-size: 13px; cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.segmented a:hover, .segmented label span:hover { color: var(--text); }
.segmented a.active, .segmented input:checked + span { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }
.segmented.radio input { position: absolute; opacity: 0; }
.segmented.radio input:focus-visible + span { box-shadow: var(--focus); }
.danger-zone {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; padding: 18px 20px;
  border: 1px solid rgba(240, 87, 74, 0.25); border-radius: var(--radius); background: rgba(240, 87, 74, 0.04);
}
.danger-zone p { margin-top: 2px; }

/* Barra degli strumenti della lista ticket */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.toolbar select { width: auto; min-width: 150px; }
.toolbar-actions { display: flex; gap: 8px; margin-left: auto; }
.search { position: relative; flex: 1 1 260px; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search input { padding-left: 34px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--border); }

/* Avvisi */
.alert {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; margin-bottom: 20px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2);
}
.alert::before { content: ''; flex: none; width: 16px; height: 16px; margin-top: 2px; background: currentColor;
  -webkit-mask: var(--alert-icon) center / contain no-repeat; mask: var(--alert-icon) center / contain no-repeat; }
.alert-ok { color: #8fe0a9; border-color: rgba(63, 185, 80, 0.3); background: rgba(63, 185, 80, 0.07);
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E"); }
.alert-err { color: #ffa198; border-color: rgba(240, 87, 74, 0.35); background: rgba(240, 87, 74, 0.07);
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4M12 16h.01'/%3E%3C/svg%3E"); }
.alert-warn { color: #f5c26b; border-color: rgba(227, 160, 8, 0.35); background: rgba(227, 160, 8, 0.07);
  --alert-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E"); }

/* Stati vuoti */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 36px 16px; }
.empty-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--surface-3); color: var(--text-3); margin-bottom: 6px; }
.empty-icon .icon { width: 18px; height: 18px; }
.empty-title { color: var(--text); font-weight: 500; }
.empty-text { color: var(--text-3); max-width: 420px; }
.empty .btn { margin-top: 12px; }

/* Elenchi (categorie, pannelli, server) */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-item { display: flex; align-items: center; gap: 16px; margin: 0 !important; transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease); }
.list-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.list-item p { margin: 2px 0 8px; }
.emoji { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--surface-3); font-size: 20px; flex: none; }
.emoji .icon { width: 18px; height: 18px; color: var(--text-2); }
.swatch { width: 6px; align-self: stretch; border-radius: 3px; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Grafico */
.chart { margin: 0; }
.legend { display: flex; gap: 18px; margin-bottom: 14px; color: var(--text-2); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend .s1, .bar.s1 { background: var(--series-1); }
.legend .s2, .bar.s2 { background: var(--series-2); }
.plot { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); height: 240px; padding-bottom: 24px; }
.y-axis { display: flex; flex-direction: column; justify-content: space-between; height: 100%; color: var(--text-3); font-size: 11.5px; font-variant-numeric: tabular-nums; transform: translateY(-7px); }
.grid-lines { position: absolute; left: 28px; right: 0; top: 0; bottom: 24px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.grid-lines i { border-top: 1px solid rgba(255, 255, 255, 0.06); }
.grid-lines i:last-child { border-top-color: rgba(255, 255, 255, 0.14); }
.cols { position: relative; display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); height: 100%; }
.col { position: relative; display: flex; flex-direction: column; align-items: center; height: 100%; outline: none; cursor: default; }
.col .bars { position: relative; z-index: 1; flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 18%; }
.bar.s1, .bar.s2 { display: block; width: 50%; max-width: 10px; border-radius: 4px 4px 0 0; transition: opacity var(--fast) var(--ease); }
.col .x { position: absolute; bottom: -22px; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.cols:hover .col:not(:hover) .bar { opacity: 0.45; }
.col:hover::before, .col:focus-visible::before { content: ''; position: absolute; inset: 0 8%; background: rgba(255, 255, 255, 0.04); border-radius: 6px; }
.col:hover::after, .col:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 3;
  padding: 6px 10px; border-radius: 8px; background: var(--surface-3); border: 1px solid var(--border-strong);
  color: var(--text); font-size: 12px; white-space: nowrap; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.col:first-child:hover::after, .col:first-child:focus-visible::after { left: 0; transform: none; }
.col:last-child:hover::after, .col:last-child:focus-visible::after { left: auto; right: 0; transform: none; }

/* Attività recente */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.feed li:first-child { padding-top: 0; }
.feed li:last-child { border-bottom: 0; padding-bottom: 0; }
.feed p { color: var(--text-2); }
.feed p b { color: var(--text); font-weight: 500; }
.feed a { color: var(--gold); font-weight: 500; }
.feed small { color: var(--text-3); }
.feed-dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.ev-open { background: var(--series-1); }
.ev-close { background: var(--series-2); }
.ev-claim, .ev-assign { background: var(--gold); }
.ev-rating { background: var(--ok); }

/* Pagine senza barra laterale: accesso, scelta del server, messaggi */
.plain-main { min-height: 100dvh; }
.narrow { max-width: 560px; margin: 0 auto; padding: 64px 20px; }
.narrow.centered { min-height: 100dvh; display: grid; align-content: center; }
.plain-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; margin-bottom: 28px; }
.server-list { display: flex; flex-direction: column; gap: 8px; }
.server {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.server:hover { background: var(--surface-2); border-color: var(--border-strong); }
.server b { display: block; font-weight: 600; }
.server small { color: var(--text-3); }

.auth { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: 100dvh; }
.auth-aside { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 36px 48px; border-right: 1px solid var(--border); background: #120a0b; }
.auth-bg { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(40px) saturate(1.1); opacity: 0.55; }
.auth-banner { position: relative; z-index: 1; width: 100%; max-width: 560px; height: auto; margin: auto 0; border-radius: 14px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08); }
.auth-aside::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11, 11, 13, 0.55) 0%, rgba(11, 11, 13, 0.35) 45%, rgba(11, 11, 13, 0.95) 100%); }
.auth-brand, .auth-quote { position: relative; z-index: 1; }
.auth-brand { order: -1; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.auth-quote p { font-size: 22px; line-height: 1.35; font-weight: 500; letter-spacing: -0.01em; max-width: 520px; }
.auth-quote small { display: block; margin-top: 14px; color: rgba(236, 236, 239, 0.7); font-size: 12px; letter-spacing: 0.12em; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; background: radial-gradient(600px 400px at 70% 20%, rgba(180, 35, 24, 0.08), transparent 70%); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 26px; margin-top: 22px; }
.auth-card .lead { color: var(--text-2); margin: 8px 0 26px; font-size: 15px; }
.auth-card .fine { color: var(--text-3); font-size: 12.5px; margin-top: 18px; }

/* Ticket */
.ticket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.ticket-layout > * { min-width: 0; }
.conversation .chat { border: 1px solid var(--border); --chat-bg: var(--surface); background: var(--surface); min-height: 320px; }
.ticket-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 72px; }
.ticket-side .card { margin: 0; padding: 18px; }
.details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 9px 16px; margin: 0; }
.details dt { color: var(--text-3); }
.details dd { margin: 0; color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; }
.details.stacked { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.details.stacked dd { margin-bottom: 12px; color: var(--text-2); }
.details.stacked dd:last-child { margin-bottom: 0; }
.rating { font-size: 20px; color: var(--gold); letter-spacing: 2px; }
.rating span { color: var(--surface-3); }
.rating.small { font-size: 14px; letter-spacing: 1px; }
.quote { border-left: 2px solid var(--border-strong); padding-left: 12px; margin-top: 10px; color: var(--text-2); white-space: pre-wrap; }

/* Recensioni */
.reviews { display: flex; flex-direction: column; gap: 10px; }
.review { padding: 14px 16px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.review-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.review p { margin-top: 6px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Editor del pannello con anteprima in stile Discord */
.panel-editor { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 20px; align-items: start; }
.panel-side { position: sticky; top: 72px; }
.image-choice { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 10px; }
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 90px; gap: 10px; }
.dc-preview { padding: 14px; border: 1px solid var(--border); --chat-bg: #313338; background: #313338; }
.dc-container { background: #2b2d31; border-left: 4px solid #8b0000; border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.dc-media { width: 100%; border-radius: 6px; display: block; }
.dc-sep { border: 0; border-top: 1px solid #3f4147; margin: 2px 0; width: 100%; }
.dc-text { font-size: 14px; line-height: 1.4; }
.dc-text .md-h2 { font-size: 19px; margin-top: 0; }
.dc-select { display: flex; justify-content: space-between; background: #1e1f22; border-radius: 6px; padding: 9px 12px; color: #949ba4; font-size: 14px; }
.dc-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.dc-btn { background: #4e5058; color: #fff; border-radius: 6px; padding: 6px 14px; font-size: 13px; font-weight: 500; }
.dc-danger { background: #da373c; }

/* --- Responsive ------------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .panel-editor { grid-template-columns: minmax(0, 1fr); }
  .panel-side { position: static; }
}
@media (max-width: 1000px) {
  .ticket-layout { grid-template-columns: minmax(0, 1fr); }
  .ticket-side { position: static; order: -1; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 50; width: 280px; transform: translateX(-100%);
    transition: transform 240ms var(--ease); box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  }
  .nav-open .sidebar { transform: none; }
  .nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.55); }
  .icon-btn.menu-btn { display: inline-grid; margin-left: -8px; }
  .topbar { padding: 0 16px; }
  .page-content { padding: 20px 16px 56px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { padding: 24px; gap: 20px; border-right: 0; border-bottom: 1px solid var(--border); }
  .auth-quote p { font-size: 18px; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .kpis, .kpis.three, .kpis.two { grid-template-columns: minmax(0, 1fr); }
  .grid.two, .inline-form, .image-choice, .link-row { grid-template-columns: minmax(0, 1fr); }
  .question { grid-template-columns: 28px minmax(0, 1fr); }
  .question input[type=text], .question .inline { grid-column: 2; }
  .toolbar select { flex: 1 1 140px; min-width: 0; }
  .toolbar-actions { margin-left: 0; width: 100%; }
  .toolbar-actions .btn { flex: 1; }
  .col.odd .x { display: none; }
  .danger-zone { flex-direction: column; align-items: flex-start; }
  .page-head { align-items: flex-start; }
  input[type=text], input[type=number], input[type=url], input[type=search], select, textarea { font-size: 16px; min-height: 44px; }
  .btn { height: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
