/* =========================================================
   MODERN UI CSS (FULL REPLACEMENT)
   - Drop-in replacement for your previous stylesheet
   - Keeps your existing class names and layout
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Source+Sans+3:wght@400;500;600;700&display=swap');

:root {
  /* Surfaces */
  --bg: #f2f6fb;
  --panel: rgba(255, 255, 255, 0.95);
  --panel-solid: #ffffff;
  --panel-2: rgba(236, 243, 252, 0.85);
  --panel-3: rgba(228, 236, 248, 0.96);
  --glass: rgba(255, 255, 255, 0.72);

  /* Text */
  --text: #0b1220;   /* deep slate */
  --muted: #5b6b80;

  /* Brand */
  --accent: #1254a3;
  --accent-strong: #0d3f7d;
  --accent-2: #0fb0c6;
  --accent-soft: rgba(18, 84, 163, 0.12);
  --accent-glow: rgba(18, 84, 163, 0.28);
  --danger: #ef4444;
  --success: #22c55e;
  --success: #22c55e;

  /* Lines / radii / shadows */
  --border: rgba(148, 163, 184, 0.28);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.12);

  --focus: 0 0 0 4px rgba(31, 75, 153, 0.18);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", "Source Sans 3", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  background:
    radial-gradient(900px 360px at 10% -10%, rgba(18, 84, 163, 0.10), transparent 70%),
    radial-gradient(700px 360px at 90% 0%, rgba(15, 176, 198, 0.12), transparent 70%),
    linear-gradient(180deg, #f8fbff 0%, #eef3fb 100%);
  color: var(--text);
}

img {
  max-width: 100%;
  height: auto;
}

a, button, input, select, textarea {
  transition:
    background-color .18s var(--ease),
    border-color .18s var(--ease),
    box-shadow .18s var(--ease),
    color .18s var(--ease),
    transform .18s var(--ease),
    opacity .18s var(--ease);
}

a {
  color: inherit;
}

summary {
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::marker {
  content: "";
}

.main details > summary {
  list-style: none;
}

.main details > summary::-webkit-details-marker {
  display: none;
}

.main details > summary::marker {
  content: "";
}

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

.main {
  padding: 4px 28px 24px;
  position: relative;
  z-index: 1;
  overflow-x: hidden;
  background:
    radial-gradient(800px 320px at 90% 10%, rgba(15, 176, 198, 0.08), transparent 70%);
}

/* =========================
   Sidebar
   ========================= */
.sidebar {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(245,248,252,0.94) 100%);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sidebar-overlay {
  display: none;
}

.sidebar::after {
  position: absolute;
  top: 20px;
  bottom: 20px;
  right: 0;
  width: 2px;
  background: linear-gradient(180deg, transparent 0%, rgba(31, 75, 153, 0.22) 30%, transparent 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px;
}

.brand-logo {
  padding: 2px 4px;
}

.brand-svg {
  width: 190px;
  height: auto;
  display: block;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;

  background:
    radial-gradient(18px 18px at 30% 30%, rgba(255,255,255,0.42), transparent 60%),
    linear-gradient(135deg, var(--accent) 0%, #12346c 100%);
  color: #ffffff;
  font-weight: 800;
  box-shadow: var(--shadow-sm);
}

.brand-name {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* Nav */
.nav {
  display: grid;
  gap: 6px;
}

.nav-section {
  display: grid;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.nav-section:last-child {
  border-bottom: 0;
}

/* details/summary accordion */
.nav-title {
  padding: 8px 10px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: rgba(100, 116, 139, 0.95);
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 12px;
}

.nav-title:hover {
  background: rgba(31, 75, 153, 0.08);
  color: var(--accent-strong);
}

.nav-section[open] .nav-title {
  background: rgba(31, 75, 153, 0.10);
  color: var(--accent-strong);
}

.nav-title::after {
  font-size: 0.8rem;
  color: rgba(100, 116, 139, 0.95);
}

details.nav-section:not([open]) .nav-title::after {
  content: "^";
}

.nav-section summary::-webkit-details-marker {
  display: none;
}

/* links */
.nav a {
  text-decoration: none;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  position: relative;
}

.nav a.active {
  background: var(--accent-soft);
  border-color: rgba(31, 75, 153, 0.28);
  color: var(--accent-strong);
  font-weight: 700;
}

.nav a.active i {
  color: var(--accent-strong);
}

.nav a.active::before {
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent) 0%, #12346c 100%);
  box-shadow: 0 6px 12px rgba(31, 75, 153, 0.28);
}

.nav a i {
  width: 18px;
  text-align: center;
  color: rgba(100, 116, 139, 0.95);
  opacity: 0.9;
}

.nav a span {
  flex: 1;
}

.nav a:hover {
  background: rgba(31, 75, 153, 0.10);
  border-color: rgba(31, 75, 153, 0.20);
  color: var(--accent-strong);
  transform: translateY(-1px);
}

.nav a:hover i {
  color: var(--accent-strong);
}

.nav a:active {
  transform: translateY(0px);
}

/* Language switch */
.lang-switch {
  margin-top: auto;
  display: flex;
  gap: 12px;
  padding: 10px 6px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
}

.lang-switch a {
  color: rgba(100, 116, 139, 0.95);
  text-decoration: none;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lang-switch a:hover {
  color: var(--accent-strong);
}

.flag {
  width: 16px;
  height: 12px;
  border-radius: 2px;
  display: inline-block;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}

.flag-it {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='12' viewBox='0 0 16 12'><rect width='5.33' height='12' fill='%23008C45'/><rect x='5.33' width='5.34' height='12' fill='%23FFFFFF'/><rect x='10.67' width='5.33' height='12' fill='%23CD212A'/></svg>");
}

.flag-us {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='12' viewBox='0 0 16 12'><rect width='16' height='12' fill='%23B22234'/><rect y='1.5' width='16' height='1.5' fill='%23FFFFFF'/><rect y='3' width='16' height='1.5' fill='%23B22234'/><rect y='4.5' width='16' height='1.5' fill='%23FFFFFF'/><rect y='6' width='16' height='1.5' fill='%23B22234'/><rect y='7.5' width='16' height='1.5' fill='%23FFFFFF'/><rect y='9' width='16' height='1.5' fill='%23B22234'/><rect y='10.5' width='16' height='1.5' fill='%23FFFFFF'/><rect width='7' height='6' fill='%23003D7D'/></svg>");
}

/* =========================
   Panels / Cards
   ========================= */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  overflow: scroll;
  max-width: 100%;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.panel h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-width: 100%;
}

.panel:hover,
.card:hover {
  box-shadow: var(--shadow);
}

.panel::before {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0) 50%);
  opacity: 0.6;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
}

.sip-accounts-grid {
  grid-template-rows: repeat(2, auto);
  grid-auto-flow: column;
  grid-auto-columns: minmax(320px, 1fr);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.card-body {
  display: grid;
  gap: 12px;
}

/* =========================
   Create panel (details)
   ========================= */
.create-panel {
  border: 1px dashed rgba(148, 163, 184, 0.35);
  background: rgba(240, 244, 250, 0.70);
  border-radius: 18px;
  padding: 8px 10px;
}

.create-toggle {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  padding: 4px 6px;
  border-radius: 14px;
}

.create-toggle:hover {
  background: rgba(26, 162, 180, 0.08);
}

.create-toggle::-webkit-details-marker {
  display: none;
}

.create-toggle i {
  color: var(--accent-strong);
}

.create-toggle .chevron {
  margin-left: auto;
  color: rgba(100, 116, 139, 0.95);
  transition: transform 0.2s var(--ease);
}

.create-panel[open] .create-toggle .chevron {
  transform: rotate(180deg);
}

.create-body {
  margin-top: 12px;
}

/* =========================
   Grids
   ========================= */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

/* =========================
   Table
   ========================= */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  border-radius: 14px;
  display: table;
  overflow: visible;
  table-layout: auto;
  max-width: 100%;
}

.table th,
.table td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  padding: 10px 10px;
  text-align: left;
  font-size: 0.9rem;
  white-space: nowrap;
}

.table th {
  color: rgba(100, 116, 139, 0.95);
  font-weight: 700;
  background: linear-gradient(180deg, rgba(236, 243, 252, 0.95) 0%, rgba(228, 236, 248, 0.7) 100%);
  position: sticky;
  top: 0;
  z-index: 2;
}

.table th.sortable {
  cursor: pointer;
}

.table th.sortable .sort-indicator {
  display: inline-block;
  width: 8px;
  height: 12px;
  position: relative;
  margin-left: 6px;
}

.table th.sortable .sort-indicator::before,
.table th.sortable .sort-indicator::after {
  content: "";
  position: absolute;
  left: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.table th.sortable .sort-indicator::before {
  top: -1px;
  border-bottom: 6px solid rgba(100, 116, 139, 0.45);
}

.table th.sortable .sort-indicator::after {
  top: 5px;
  border-top: 6px solid rgba(100, 116, 139, 0.45);
}

.table th.sortable[data-dir="asc"] .sort-indicator::before {
  border-bottom-color: rgba(100, 116, 139, 0.9);
}

.table th.sortable[data-dir="asc"] .sort-indicator::after {
  border-top-color: rgba(100, 116, 139, 0.18);
}

.table th.sortable[data-dir="desc"] .sort-indicator::before {
  border-bottom-color: rgba(100, 116, 139, 0.18);
}

.table th.sortable[data-dir="desc"] .sort-indicator::after {
  border-top-color: rgba(100, 116, 139, 0.9);
}

.table thead tr.filter-row th {
  background: rgba(240, 244, 250, 0.75);
  position: static;
}

.table .filter-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 0.78rem;
}

.table-controls {
  margin-bottom: 10px;
}

.table-filters {
  margin: 10px 0 6px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(240, 244, 250, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.report-table thead th {
  position: sticky;
  padding-right: 26px;
}

.report-table thead th::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 2px solid rgba(100, 116, 139, 0.45);
  border-bottom: 2px solid rgba(100, 116, 139, 0.45);
  transform: translateY(-50%) rotate(45deg);
}

.report-table thead th[data-sort-dir="asc"]::after {
  border-right-color: rgba(100, 116, 139, 0.9);
  border-bottom-color: rgba(100, 116, 139, 0.9);
  transform: translateY(-50%) rotate(-135deg);
}

.report-table thead th[data-sort-dir="desc"]::after {
  border-right-color: rgba(100, 116, 139, 0.9);
  border-bottom-color: rgba(100, 116, 139, 0.9);
  transform: translateY(-50%) rotate(45deg);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table::-webkit-scrollbar {
  height: 10px;
}

.table::-webkit-scrollbar-thumb {
  background: rgba(18, 84, 163, 0.35);
  border-radius: 999px;
}

.table::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.12);
  border-radius: 999px;
}

.table tr:hover td {
  background: rgba(31, 75, 153, 0.06);
}

.table tbody tr:nth-child(odd) td {
  background: rgba(240, 244, 250, 0.35);
}

.table td:last-child,
.table th:last-child {
  text-align: right;
}

.table details > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(240, 244, 250, 0.8);
  font-weight: 700;
  cursor: pointer;
}

.table details[open] > summary {
  border-color: rgba(31, 75, 153, 0.35);
  color: var(--accent-strong);
}

/* =========================
   Pagination
   ========================= */
.pagination {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 12px;
}

.page-link {
  text-decoration: none;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(240, 244, 250, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.page-link:hover {
  border-color: rgba(31, 75, 153, 0.35);
  color: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
}

.page-link.active {
  background: linear-gradient(135deg, var(--accent) 0%, #12346c 100%);
  color: #ffffff;
  font-weight: 800;
  border-color: transparent;
  box-shadow: 0 14px 30px rgba(26, 162, 180, 0.22);
}

/* =========================
   Links / Text utilities
   ========================= */
.link {
  color: var(--accent-strong);
  text-decoration: none;
  margin-left: 8px;
}

.link:hover {
  text-decoration: underline;
}

.link.danger {
  color: var(--danger);
}

/* URL icon for external links */
a[href^="http://"],
a[href^="https://"] {
  position: relative;
  padding-right: 18px;
}

a[href^="http://"]::after,
a[href^="https://"]::after {
  content: ">";
  display: inline-block;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%) rotate(-45deg);
  font-size: 0.85em;
  color: rgba(100, 116, 139, 0.9);
}

a[href^="http://"]:hover::after,
a[href^="https://"]:hover::after {
  color: var(--accent-strong);
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.92rem;
  word-break: break-word;
}

/* =========================
   Code block
   ========================= */
.code {
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 12px;
  white-space: pre-wrap;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.pill.trace-user {
  background: #eaf2ff;
  color: #1f3b7a;
  border: 1px solid #d6e3ff;
}

.pill.trace-trunk {
  background: #eaf7f0;
  color: #1d5b3a;
  border: 1px solid #d2efdf;
}

.pill.trace-server {
  background: #f6eefb;
  color: #5a2d7a;
  border: 1px solid #e7d6f5;
}

.code.trace-user {
  border-color: #cfe0ff;
  background: #f3f7ff;
}

.code.trace-trunk {
  border-color: #cdebdc;
  background: #f2fbf6;
}

.code.trace-server {
  border-color: #e2d2f3;
  background: #f7f2fb;
}

/* =========================
   Header
   ========================= */
.page-header {
  display: none;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.page-header h1 {
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  margin: 0;
}

/* =========================
   Dashboard hero
   ========================= */
.dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-radius: 24px;
  background:
    radial-gradient(340px 180px at 10% 0%, rgba(26, 162, 180, 0.22), transparent 70%),
    radial-gradient(260px 180px at 95% 10%, rgba(245, 158, 11, 0.14), transparent 65%),
    linear-gradient(135deg, rgba(255,255,255,0.86) 0%, rgba(242, 247, 251, 0.78) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  margin-bottom: 18px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.dashboard-hero h1 {
  margin: 6px 0 4px;
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.kicker {
  text-transform: uppercase;
  font-size: 0.76rem;
  letter-spacing: 0.2em;
  color: rgba(100, 116, 139, 0.95);
}

.hero-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.74);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  color: rgba(100, 116, 139, 0.95);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hero-meta i {
  color: var(--accent-strong);
}

/* =========================
   Stats
   ========================= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
}

.stat-card.accent {
  border-color: rgba(26, 162, 180, 0.22);
  background:
    radial-gradient(360px 200px at 0% 0%, rgba(26, 162, 180, 0.16), transparent 70%),
    rgba(255, 255, 255, 0.78);
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(20px 20px at 30% 30%, rgba(26, 162, 180, 0.18), transparent 60%),
    rgba(240, 244, 250, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: var(--accent-strong);
  font-size: 1.05rem;
}

.stat-label {
  color: rgba(100, 116, 139, 0.95);
  font-size: 0.88rem;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.user-pill {
  background: rgba(255,255,255,0.75);
  padding: 8px 14px;
  border-radius: 999px;
  color: rgba(100, 116, 139, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
}

/* =========================
   Small metric cards (inside card)
   ========================= */
.card-title {
  color: rgba(100, 116, 139, 0.95);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-value {
  font-size: 1.85rem;
  font-weight: 900;
  margin-top: 6px;
  letter-spacing: -0.02em;
}

/* =========================
   Chart bars
   ========================= */
.chart {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 2fr auto;
  gap: 10px;
  align-items: center;
}

.chart-label {
  font-size: 0.92rem;
  color: rgba(100, 116, 139, 0.95);
}

.chart-bar {
  background: rgba(240, 244, 250, 0.75);
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.chart-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #3cc2d0);
  border-radius: 999px;
}

.chart-value {
  font-weight: 700;
  color: var(--text);
}

/* =========================
   Login
   ========================= */
.login-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 70vh;
  padding: 20px;
  border-radius: 26px;
  background:
    radial-gradient(520px 240px at 10% 10%, rgba(31, 75, 153, 0.12), transparent 70%),
    radial-gradient(420px 220px at 90% 10%, rgba(14, 165, 183, 0.14), transparent 70%),
    linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(244, 248, 252, 0.88) 100%);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.login-grid {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(320px, 1fr);
  gap: 22px;
  align-items: stretch;
}

.login-card {
  width: min(440px, 100%);
  height: fit-content;
  margin: 0 auto;
  background: rgba(255,255,255,0.96);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 22px;
  padding: 26px;
  box-shadow:
    0 30px 60px rgba(15, 23, 42, 0.16),
    0 2px 8px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: login-card-in 0.5s var(--ease);
}

.login-hero {
  background: rgba(255,255,255,0.9);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 22px;
  padding: 26px;
  box-shadow:
    0 30px 60px rgba(15, 23, 42, 0.14),
    0 2px 8px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: grid;
  gap: 12px;
}

.login-hero h2 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

.login-hero p {
  margin: 0 0 6px 0;
  color: rgba(100, 116, 139, 0.95);
}

.hero-badge {
  align-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 999px;
  background: rgba(26, 162, 180, 0.12);
  color: #0f3a5a;
}

.contact-thanks {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid rgba(26, 162, 180, 0.25);
  background: rgba(240, 253, 250, 0.8);
  color: #0f3a5a;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

.contact-thanks h4 {
  margin: 0 0 6px 0;
  font-size: 1rem;
}

.contact-thanks p {
  margin: 0;
  color: rgba(15, 58, 90, 0.85);
}

.login-features {
  background: rgba(255,255,255,0.86);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.login-features h3 {
  margin: 0 0 8px 0;
  font-size: 1rem;
}

.login-features ul {
  margin: 0;
  padding-left: 18px;
  color: rgba(71, 85, 105, 0.95);
  display: grid;
  gap: 6px;
}

.feature-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 10px;
}

.feature-card {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255,255,255,0.7);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.feature-card strong {
  display: block;
  font-size: 0.92rem;
  margin-bottom: 2px;
}

.feature-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(26, 162, 180, 0.12);
  color: var(--accent-strong);
  flex: 0 0 34px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.login-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(18px 18px at 30% 30%, rgba(255,255,255,0.35), transparent 60%),
    linear-gradient(135deg, var(--accent) 0%, #12346c 100%);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(26, 162, 180, 0.22);
}

.login-title {
  font-weight: 900;
  letter-spacing: -0.02em;
}

.login-card h1 {
  margin: 0 0 12px 0;
  letter-spacing: -0.02em;
  font-size: 1.35rem;
}

.login-card .form-grid {
  gap: 12px;
}

.login-card .btn.primary {
  width: 100%;
  padding: 11px 16px;
  font-size: 0.95rem;
}

.login-card .link {
  text-align: center;
  margin-top: 2px;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.remember-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  box-shadow: none;
}

.remember-row span {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(100, 116, 139, 0.95);
}

/* Profile summary */
.profile-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.profile-summary-item {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.profile-summary-item span {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(100, 116, 139, 0.9);
  margin-bottom: 4px;
}

.profile-summary-item strong {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  word-break: break-word;
}

@keyframes login-card-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* =========================
   Forms
   ========================= */
.form-grid {
  display: grid;
  gap: 10px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: rgba(100, 116, 139, 0.95);
  font-size: 0.82rem;
  font-weight: 600;
}

label {
  display: grid;
  gap: 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255,255,255,0.92);
  color: var(--text);
  font-size: 0.9rem;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

input:hover,
select:hover,
textarea:hover {
  border-color: rgba(26, 162, 180, 0.35);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(26, 162, 180, 0.85);
  box-shadow: var(--focus), 0 8px 20px rgba(15, 23, 42, 0.08);
  background: rgba(255,255,255,0.95);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(100,116,139,0.95) 50%),
    linear-gradient(135deg, rgba(100,116,139,0.95) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 10px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

.input-wrap {
  position: relative;
}

.input-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(100, 116, 139, 0.95);
  pointer-events: none;
  opacity: 0.9;
}

.input-wrap input {
  padding-left: 36px;
}

.captcha-row .captcha-wrap .input-wrap {
  width: 100%;
}

.form-grid .grid-2,
.form-grid .grid-3 {
  gap: 10px;
}

/* =========================
   Inline edit rows
   ========================= */
.edit-row {
  display: none;
}

.edit-row.is-open {
  display: table-row;
}

.edit-panel {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(240, 244, 250, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.offer-form {
  display: grid;
  gap: 12px;
}

.offer-section {
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(240, 244, 250, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.offer-section-title {
  font-weight: 800;
  font-size: 0.88rem;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  color: rgba(100, 116, 139, 0.95);
}

.offer-form small.muted {
  font-size: 0.78rem;
  line-height: 1.2;
}

.ivr-audio-preview {
  margin-top: 6px;
}

.ivr-audio-preview audio {
  width: 100%;
}

/* Captcha */
.captcha-row .captcha-wrap {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px;
  align-items: center;
}

.captcha-img {
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  width: 150px;
  height: 46px;
  object-fit: cover;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
}

/* =========================
   Buttons
   ========================= */
.btn {
  padding: 8px 12px;
  border: 1px solid rgba(148, 163, 184, 0.30);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  font-size: 0.9rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(236,243,252,0.9) 100%);
  color: var(--text);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.btn:hover {
  border-color: rgba(31, 75, 153, 0.35);
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
}

.btn:active {
  transform: translateY(0px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.05);
}

.btn.primary {
  background:
    radial-gradient(20px 20px at 30% 30%, rgba(255,255,255,0.30), transparent 60%),
    linear-gradient(135deg, var(--accent) 0%, #0c3d7d 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 16px 36px var(--accent-glow);
}

.btn.primary:hover {
  box-shadow: 0 18px 40px rgba(31, 75, 153, 0.35);
}

.btn.secondary {
  background: rgba(255,255,255,0.7);
  border-color: rgba(148, 163, 184, 0.4);
  color: var(--text);
}

.btn.danger {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(239, 68, 68, 0.28);
}

.btn.danger:hover {
  box-shadow: 0 16px 34px rgba(239, 68, 68, 0.35);
}

/* =========================
   Legend / details panels
   ========================= */
.legend-panel {
  margin-top: 18px;
}

.legend summary {
  list-style: none;
  cursor: pointer;
  font-weight: 800;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(240, 244, 250, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.legend summary:hover {
  border-color: rgba(26, 162, 180, 0.35);
  background: rgba(26, 162, 180, 0.08);
}

.legend summary::-webkit-details-marker {
  display: none;
}

.legend-body {
  margin-top: 12px;
}

.legend-section {
  font-weight: 900;
  color: var(--text);
  margin: 12px 0 6px;
  letter-spacing: -0.01em;
}

/* =========================
   Alerts
   ========================= */
.alert {
  padding: 10px 14px;
  border-radius: 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(240, 244, 250, 0.65);
}

.alert.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.30);
  color: #b91c1c;
}

.alert.warn {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.30);
  color: #b45309;
}

/* =========================
   Tabs
   ========================= */
.tabbed {
  display: grid;
  gap: 12px;
}

.tab-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-btn {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(240, 244, 250, 0.75);
  padding: 7px 10px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 900;
  color: rgba(100, 116, 139, 0.95);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.tab-btn:hover {
  border-color: rgba(26, 162, 180, 0.35);
  transform: translateY(-1px);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, #12346c 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 14px 30px rgba(31, 75, 153, 0.22);
}

.tab-panel {
  display: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.tab-panel.active {
  display: block;
}

.tab-panel h3 {
  margin-top: 0;
  letter-spacing: -0.01em;
}

/* =========================
   Code / Pre
   ========================= */
.code-block {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.35;
  overflow-x: auto;
  white-space: pre-wrap;
  border: 1px solid rgba(148, 163, 184, 0.22);
}

/* =========================
   Badges
   ========================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(240, 244, 250, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: rgba(100, 116, 139, 0.95);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-weight: 900;
}

.badge-success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.28);
  color: #15803d;
}

.badge-warn {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.28);
  color: #92400e;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.28);
  color: #b91c1c;
}

/* =========================
   Footer
   ========================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 2px 0 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.topbar-title {
  font-weight: 800;
  letter-spacing: -0.01em;
  font-size: 0.95rem;
  color: var(--text);
  padding-left: 6px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 800;
  font-size: 0.85rem;
  background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(236,243,252,0.9) 100%);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.topbar-btn i {
  color: var(--accent-strong);
}

.topbar-btn:hover {
  color: var(--accent-strong);
  border-color: rgba(18, 84, 163, 0.35);
  transform: translateY(-1px);
}

.topbar-btn.danger {
  color: #ffffff;
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(239, 68, 68, 0.28);
}

.topbar-btn.danger i {
  color: #ffffff;
}

.app-footer {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: var(--shadow-sm);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.footer-item {
  background: rgba(240, 244, 250, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  padding: 10px 12px;
}

.footer-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(100, 116, 139, 0.95);
  font-weight: 800;
}

.footer-value {
  font-weight: 800;
  margin-top: 4px;
}

.footer-copy {
  text-align: center;
  color: rgba(100, 116, 139, 0.9);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* =========================
   IVR options (legacy: layout v1)
   Nota: i nuovi stili sono in fondo al file (sezione IVR refinement v2)
   ========================= */
.ivr-options {
  display: grid;
  gap: 10px;
  margin: 10px 0 18px;
}

.ivr-row {
  display: grid;
  grid-template-columns: 60px repeat(5, minmax(140px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  background: rgba(240, 244, 250, 0.70);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
}

.ivr-digit {
  font-weight: 900;
  font-size: 1.12rem;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.70);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  height: 46px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

/* =========================
   Responsive
   ========================= */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.2s var(--ease);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease);
    z-index: 90;
  }

  body.nav-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  body.nav-open {
    overflow: hidden;
  }

  .brand {
    justify-content: center;
  }

  .nav {
    grid-auto-flow: row;
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 4px;
  }

  .main {
    padding: 18px;
  }

  .panel,
  .card,
  .table {
    max-width: 100%;
  }

  .sip-accounts-grid {
    grid-auto-flow: row;
    grid-template-rows: none;
    grid-auto-columns: auto;
  }

  .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: max-content;
    min-width: 100%;
  }

  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    z-index: 80;
    background: rgba(255,255,255,0.92);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 8px 10px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .topbar {
    justify-content: space-between;
    margin-bottom: 10px;
  }

  .topbar-title {
    font-size: 0.9rem;
  }

  .topbar-btn span {
    display: none;
  }

  .mobile-title {
    font-weight: 900;
    letter-spacing: -0.01em;
  }

  .menu-toggle {
    padding: 8px 12px;
  }

  /* menu-fab removed */

  .dashboard-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .hero-meta {
    width: 100%;
    justify-content: space-between;
  }

  .ivr-row {
    grid-template-columns: 60px 1fr;
    gap: 10px;
  }

  .login-shell {
    padding: 16px;
  }

  .login-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 901px) {
  .mobile-topbar {
    display: none;
  }

  /* menu-fab removed */
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  box-shadow: 0 0 0 2px rgba(11, 18, 32, 0.08);
}

.status-dot.status-up {
  background: #22c55e;
}

.status-dot.status-down {
  background: #ef4444;
}

.status-dot.status-off {
  background: #f59e0b;
}

.status-text {
  font-size: 0.85rem;
  color: #516177;
  vertical-align: middle;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =========================
   Online calls
   ========================= */
.online-calls-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 10px;
  flex-wrap: wrap;
}

.online-calls-summary {
  display: flex;
  gap: 8px;
  align-items: center;
}

.online-uuid-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
}

.online-uuid-toggle .online-uuid-toggle-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.online-uuid-toggle[aria-pressed="true"] {
  background: rgba(31, 75, 153, 0.10);
  border-color: rgba(31, 75, 153, 0.35);
  color: var(--accent);
}

.online-calls-table .col-uuid {
  display: none;
}

.online-calls-table.show-uuid .col-uuid {
  display: table-cell;
}

.uuid-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.uuid-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  background: rgba(240, 244, 250, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: rgba(71, 85, 105, 0.95);
  padding: 2px 6px;
  border-radius: 6px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uuid-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.30);
  background: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
  color: rgba(71, 85, 105, 0.95);
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.uuid-copy:hover {
  border-color: rgba(31, 75, 153, 0.35);
  background: rgba(31, 75, 153, 0.08);
}

.uuid-copy:active {
  transform: scale(0.95);
}

.uuid-copy.copied {
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.40);
  color: #15803d;
}

/* =========================================================
   Online calls — KPI strip, refresh meta, direction, live
   ========================================================= */

/* Header refresh meta */
.online-refresh-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted, #64748b);
  font-variant-numeric: tabular-nums;
}
.online-refresh-meta strong {
  color: var(--text-2, #334155);
  font-weight: 600;
}
.online-refresh-pulse {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55);
  animation: onlinePulse 1.8s ease-out infinite;
}
.online-refresh-sep {
  opacity: 0.5;
}
@keyframes onlinePulse {
  0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* KPI strip — sopra la tabella, riusa stat-card del design system */
.online-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 12px 0 18px;
}
.online-kpi-card .stat-card-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.online-kpi-card .stat-card-label i {
  font-size: 0.75rem;
  opacity: 0.7;
}
.online-kpi-foot {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.online-kpi-foot .pill i {
  font-size: 0.65rem;
  opacity: 0.7;
}
.online-kpi-ringing {
  border-color: rgba(217, 119, 6, 0.25) !important;
}
.online-kpi-ringing::before {
  background: radial-gradient(180px 100px at 100% 0%, rgba(217, 119, 6, 0.10), transparent 70%) !important;
}
.online-kpi-ringing .stat-card-value {
  color: #92400e;
}

/* Direction column */
.online-calls-table .col-direction {
  width: 36px;
  text-align: center;
  padding-left: 4px;
  padding-right: 4px;
}
.dir-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--panel, #fff);
}
.dir-icon.dir-in {
  color: #166534;
  background: rgba(22, 163, 74, 0.10);
  border-color: rgba(22, 163, 74, 0.25);
}
.dir-icon.dir-out {
  color: #1254a3;
  background: rgba(18, 84, 163, 0.10);
  border-color: rgba(18, 84, 163, 0.25);
}

/* Status badge — riusa il dot esistente di .badge::before, lo fa pulsare
   quando la chiamata è "live" (RINGING / ANSWERED). Non aggiunge un secondo
   pallino. */
.status-badge.is-live.badge-success::before {
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5);
  animation: onlinePulse 2.2s ease-out infinite;
}
.status-badge.is-live.badge-warn::before {
  box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.55);
  animation: onlinePulseWarn 1.4s ease-out infinite;
}
@keyframes onlinePulseWarn {
  0%   { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.55); }
  70%  { box-shadow: 0 0 0 6px rgba(217, 119, 6, 0); }
  100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0); }
}

/* Live row gets a subtle left accent */
.online-calls-table tbody tr.is-live {
  position: relative;
}
.online-calls-table tbody tr.is-live > td:first-child::before,
.online-calls-table.show-uuid tbody tr.is-live > td:nth-child(2)::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(to bottom, var(--accent, #1254a3), transparent);
  opacity: 0.45;
}

/* Number cells — monospace, tabular numbers */
.num-cell {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* Codec badge — distinct subtle accent */
.codec-badge {
  background: rgba(8, 145, 178, 0.10);
  color: #0e7490;
  border-color: rgba(8, 145, 178, 0.22);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

/* Duration — tabular, slightly bigger weight */
.duration-cell {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
  background: var(--bg-2, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
  min-width: 64px;
  text-align: center;
}
.online-calls-table .col-duration {
  text-align: right;
  white-space: nowrap;
}

/* Sticky header on long lists */
.online-calls-table thead th {
  position: sticky;
  top: 0;
  background: var(--panel-2, #f1f5f9);
  z-index: 1;
}

/* Empty state */
.online-empty-row td {
  background: transparent !important;
}
.online-empty {
  text-align: center;
  padding: 36px 16px 28px;
  color: var(--muted, #64748b);
}
.online-empty-icon {
  font-size: 1.6rem;
  width: 56px;
  height: 56px;
  margin: 0 auto 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--bg-2, #f1f5f9);
  color: var(--muted-soft, #94a3b8);
  border: 1px solid var(--border, #e2e8f0);
}
.online-empty-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-2, #334155);
  margin-bottom: 4px;
}
.online-empty-hint {
  font-size: 0.82rem;
  color: var(--muted, #64748b);
}

/* Filters: little icon in apply button */
.online-calls-filters .btn.primary i {
  font-size: 0.8rem;
  margin-right: 2px;
}

@media (max-width: 720px) {
  .online-refresh-meta .online-refresh-interval,
  .online-refresh-meta .online-refresh-sep {
    display: none;
  }
  .online-kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =========================================================
   v2 RESTYLING — design pulito, professionale, ispirato a
   dashboard moderne (Linear / Vercel / Stripe).
   Tutto override-only, nessuna classe HTML modificata.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Surfaces — toni slate caldi, niente bianco accecante */
  --bg: #e6ecf3;            /* sfondo app: slate freddo, dà riposo */
  --bg-2: #dde4ed;          /* hover row / blocchi secondari */
  --panel: #f4f7fb;         /* pannelli: off-white tinto, non bianco puro */
  --panel-solid: #f4f7fb;
  --panel-2: #ebf0f7;
  --panel-3: #e3e9f1;
  --glass: #f4f7fb;

  /* Text — gerarchia slate, contrasto pieno per leggibilità */
  --text: #0b1424;
  --text-2: #2c3a52;
  --muted: #5b6a82;
  --muted-soft: #8595ad;

  /* Brand — manteniamo l'identità blu, ma con palette estesa */
  --accent: #1254a3;
  --accent-strong: #0d3f7d;
  --accent-dim: #1e6bc6;
  --accent-2: #0891b2;
  --accent-soft: #eff6ff;
  --accent-tint: #dbeafe;
  --accent-glow: rgba(18, 84, 163, 0.18);

  /* Stati */
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --success: #16a34a;
  --success-soft: #dcfce7;

  /* Linee — più visibili sul nuovo background tinto */
  --border: #c8d2e0;
  --border-strong: #aab8cd;
  --border-soft: #d8dfe9;

  /* Radii — più contenuti, look moderno */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows — sottili, layered */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.04), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.06), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

  --focus: 0 0 0 3px rgba(18, 84, 163, 0.15);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

/* ---- Body / typography ---------------------------------- */

html, body {
  background: var(--bg);
}

body {
  font-family: "Inter", "Manrope", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-feature-settings: "cv11" 1, "ss01" 1, "ss03" 1;
  letter-spacing: -0.005em;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at -10% -20%, rgba(18, 84, 163, 0.06), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(8, 145, 178, 0.06), transparent 60%),
    var(--bg);
}

.main {
  padding: 16px 32px 32px;
  background: transparent;
  /* Critico: senza min-width:0 la grid si auto-espande con contenuti larghi
     (es. tabelle con molte colonne) facendo andare in overflow l'intera pagina. */
  min-width: 0;
  overflow-x: hidden;
}

/* Le tabelle larghe vanno wrappate in .table-wrap per scrollare orizzontalmente
   senza far scappare l'intero pannello dalla pagina. */
.panel > .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.panel > .table-wrap > .table {
  width: max-content;
  min-width: 100%;
}

/* Smooth focus ring globale */
:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius);
}

/* Selezione testo */
::selection {
  background: var(--accent-tint);
  color: var(--accent-strong);
}

/* Scrollbar minimal */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted-soft); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---- App shell / Sidebar ------------------------------- */
/* IMPORTANTE: wrappato in media query desktop per non sovrascrivere
   il layout mobile (grid-template-columns: 1fr a max-width:900px). */
@media (min-width: 901px) {
  .app-shell {
    grid-template-columns: 248px 1fr;
  }

  .sidebar {
    background: var(--panel-2);
    border-right: 1px solid var(--border);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 18px 12px;
    gap: 14px;
  }
}

.sidebar::after { display: none; }

.brand-name {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
  color: var(--text);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 2px 8px rgba(18, 84, 163, 0.20);
}

.nav-section {
  border-bottom: 1px solid var(--border-soft);
  padding: 10px 0;
}

.nav-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 6px 12px;
}

.nav-title:hover {
  background: transparent;
  color: var(--text-2);
}

.nav-section[open] .nav-title {
  background: transparent;
  color: var(--text-2);
}

.nav a {
  padding: 7px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  gap: 10px;
}

.nav a i {
  color: var(--muted);
  font-size: 0.9em;
}

.nav a:hover {
  background: var(--bg-2);
  color: var(--text);
  border-color: transparent;
  transform: none;
}

.nav a:hover i {
  color: var(--text-2);
}

.nav a.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
  font-weight: 600;
}

.nav a.active i {
  color: var(--accent);
}

.nav a.active::before { display: none; }

/* ---- Topbar -------------------------------------------- */

.topbar {
  padding: 8px 14px;
  border-radius: var(--radius-lg);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  margin: 0 0 16px;
}

.topbar-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.topbar-btn {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
  padding: 6px 12px;
}

.topbar-btn:hover {
  background: var(--bg-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.topbar-btn.danger {
  color: var(--danger);
  border-color: var(--danger-soft);
}

.topbar-btn.danger:hover {
  background: var(--danger-soft);
}

/* ---- Page header --------------------------------------- */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 20px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-soft);
}

.page-header h1 {
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  margin: 0;
  background: none;
  -webkit-text-fill-color: initial;
}

/* ---- Panels & cards ------------------------------------ */

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  overflow: visible;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}

.panel::before { display: none; }

.panel:hover,
.card:hover {
  transform: none;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.panel h2,
.card h2 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
  color: var(--text);
}

.panel h3,
.card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0 0 10px;
  color: var(--text-2);
}

.panel.scroll-x,
.panel-scroll {
  overflow-x: auto;
}

.panel > .table-wrap {
  overflow-x: auto;
  margin: 0 -20px -20px;
  padding: 0 20px 20px;
}

/* Animazione fade-in sottilissima */
@keyframes v2-panel-in {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}
.panel,
.card {
  animation: v2-panel-in .2s var(--ease) both;
}
@media (prefers-reduced-motion: reduce) {
  .panel, .card { animation: none; }
}

/* ---- Tables -------------------------------------------- */

.table {
  font-size: 0.875rem;
  font-feature-settings: "tnum" 1, "lnum" 1;
  border-radius: 0;
}

.table thead th {
  background: var(--bg-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-2);
  vertical-align: middle;
}

.table tbody tr:nth-child(odd) td {
  background: transparent;
}

.table tbody tr:hover td {
  background: var(--bg-2);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table code {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  color: var(--text);
  background: var(--bg-2);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.table a.link {
  color: var(--accent);
  font-weight: 500;
}

/* ---- Forms --------------------------------------------- */

label > span:first-child {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

input,
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fbfcfe;
  color: var(--text);
  font-size: 0.875rem;
  font-family: inherit;
  box-shadow: var(--shadow-xs);
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus);
  background: #ffffff;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-soft);
}

select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* ---- Buttons ------------------------------------------- */

.btn {
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fbfcfe;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}

.btn:hover {
  background: #ffffff;
  border-color: var(--border-strong);
  color: var(--text);
  transform: none;
  box-shadow: var(--shadow-sm);
}

.btn:active {
  transform: none;
}

.btn.primary {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(18, 84, 163, 0.20);
}

.btn.primary:hover {
  background: var(--accent-strong);
  filter: none;
  box-shadow: 0 4px 12px rgba(18, 84, 163, 0.28);
}

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

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

.btn.danger {
  background: var(--danger);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(220, 38, 38, 0.20);
}

.btn.danger:hover {
  background: #b91c1c;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.28);
}

.btn[disabled],
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ---- Badges -------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  background: var(--bg-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.badge-success {
  background: var(--success-soft);
  color: #166534;
  border-color: rgba(22, 163, 74, 0.20);
}

.badge-warn {
  background: var(--warning-soft);
  color: #92400e;
  border-color: rgba(217, 119, 6, 0.20);
}

.badge-danger {
  background: var(--danger-soft);
  color: #991b1b;
  border-color: rgba(220, 38, 38, 0.20);
}

/* ---- Dashboard hero ------------------------------------ */

.dashboard-hero {
  background:
    radial-gradient(420px 220px at 8% 0%, rgba(18, 84, 163, 0.10), transparent 65%),
    radial-gradient(360px 220px at 95% 100%, rgba(8, 145, 178, 0.10), transparent 65%),
    var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px 28px;
  box-shadow: var(--shadow-xs);
}

/* ---- Pagination ---------------------------------------- */

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 16px;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: #fbfcfe;
  color: var(--text-2);
  text-decoration: none;
  box-shadow: var(--shadow-xs);
}

.pagination a:hover {
  background: #ffffff;
  border-color: var(--border-strong);
  color: var(--text);
}

.pagination .current,
.pagination span.current {
  background: var(--accent);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(18, 84, 163, 0.20);
}

/* ---- Misc ---------------------------------------------- */

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

a.link {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

a.link:hover {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Pillole trace varie già esistenti — armonizzo */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--bg-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}

/* Filter row delle tabelle */
.table thead tr.filter-row th {
  background: var(--panel);
  border-bottom: 1px solid var(--border-soft);
  padding: 8px 14px;
}

.table .filter-input {
  font-size: 0.825rem;
  padding: 6px 10px;
}

/* Online calls table — tweak per il nuovo look */
.online-calls-table .col-uuid {
  background: transparent !important;
}
.uuid-code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  background: var(--bg-2);
  border-color: var(--border);
  color: var(--text-2);
}
.uuid-copy {
  border-color: var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
}
.uuid-copy:hover {
  background: var(--bg-2);
  border-color: var(--border-strong);
}

/* Form-grid con respiro */
.form-grid {
  gap: 14px;
}
.form-grid .grid-2,
.form-grid .grid-3 {
  gap: 14px;
}

/* Alert */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  font-size: 0.875rem;
  color: var(--text-2);
}

/* Login / card centrali — un piccolo upgrade */
.login-card,
.center-card {
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  background: var(--panel);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* =========================================================
   v3 WOW LAYER
   - Sidebar dark navy (dual-tone come Linear/Vercel/Cal.com)
   - Typography ridefinita: Inter Variable + Plus Jakarta Sans
   - Accent glow su CTA, microinterazioni, bordi a gradiente
   - Sempre molto leggibile (contrasto AAA sul testo body)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

:root {
  /* Tipo: due famiglie complementari */
  --font-sans: "Inter", "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Palette sidebar dark */
  --side-bg: #0b1424;          /* near-black blu */
  --side-bg-2: #111c30;
  --side-text: #d4dbe7;
  --side-text-2: #98a4b8;
  --side-muted: #6b7894;
  --side-border: rgba(255, 255, 255, 0.06);
  --side-active-bg: linear-gradient(135deg, rgba(56, 138, 255, 0.18) 0%, rgba(8, 145, 178, 0.14) 100%);
  --side-active-text: #ffffff;
  --side-glow: 0 0 0 1px rgba(96, 165, 250, 0.30), 0 6px 20px rgba(56, 138, 255, 0.20);

  /* Glow CTA */
  --primary-glow: 0 1px 0 rgba(255,255,255,0.20) inset, 0 6px 16px rgba(18, 84, 163, 0.32), 0 1px 2px rgba(18, 84, 163, 0.30);
  --primary-glow-hover: 0 1px 0 rgba(255,255,255,0.20) inset, 0 8px 22px rgba(18, 84, 163, 0.42), 0 2px 4px rgba(18, 84, 163, 0.30);
}

/* ---- Typography rendering pro -------------------------- */

html {
  font-size: 15px; /* base più generosa per leggibilità */
}

body {
  font-family: var(--font-sans);
  font-feature-settings: "cv02" 1, "cv03" 1, "cv04" 1, "cv11" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
  font-weight: 400;
  letter-spacing: -0.005em;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

code, pre, .uuid-code {
  font-family: var(--font-mono);
  font-feature-settings: "ss02" 1, "ss03" 1;
}

.table {
  font-feature-settings: "tnum" 1, "lnum" 1, "ss01" 1;
}

/* ---- Page header: titolo display con accent ------------ */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 24px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.page-header h1 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin: 0;
  background: none;
  -webkit-text-fill-color: initial;
  position: relative;
  padding-left: 14px;
}

.page-header h1::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 70%;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 0 16px rgba(18, 84, 163, 0.45);
}

/* ---- Sidebar DARK (the wow factor) --------------------- */

.sidebar {
  background:
    radial-gradient(420px 200px at 0% 0%, rgba(56, 138, 255, 0.10), transparent 70%),
    radial-gradient(420px 220px at 100% 100%, rgba(8, 145, 178, 0.08), transparent 70%),
    linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
  border-right: 1px solid var(--side-border);
  padding: 22px 14px;
  color: var(--side-text);
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.03);
}

.sidebar::after { display: none; }

.brand {
  padding: 4px 8px 12px;
  border-bottom: 1px solid var(--side-border);
  margin-bottom: 8px;
}

.brand-name {
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.1rem;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background:
    radial-gradient(20px 20px at 30% 30%, rgba(255,255,255,0.55), transparent 60%),
    linear-gradient(135deg, #2563eb 0%, #1254a3 60%, #0d3f7d 100%);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.10), 0 8px 22px rgba(56, 138, 255, 0.40);
  color: #ffffff;
  font-weight: 800;
}

/* Logo SVG: NON applicare filter globale (annerirebbe l'icona gradient).
   Sovrascriviamo solo i fill delle due text per renderle leggibili sul fondo dark. */
.brand-svg { filter: none; }
.brand-svg text:nth-of-type(1) {
  fill: #ffffff !important;
}
.brand-svg text:nth-of-type(2) {
  fill: rgba(255,255,255,0.62) !important;
}

/* sezioni */
.nav-section {
  border-bottom: 1px solid var(--side-border);
  padding: 8px 0;
}
.nav-section:last-child { border-bottom: 0; }

.nav-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--side-muted);
  padding: 8px 12px;
}

.nav-title:hover {
  background: rgba(255,255,255,0.04);
  color: var(--side-text);
}

.nav-section[open] .nav-title {
  background: transparent;
  color: var(--side-text-2);
}

.nav-title::after {
  color: var(--side-muted);
}

/* link */
.nav a {
  padding: 8px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--side-text-2);
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  position: relative;
  transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}

.nav a i {
  color: var(--side-muted);
  width: 18px;
  text-align: center;
}

.nav a:hover {
  background: rgba(255,255,255,0.05);
  color: #ffffff;
  border-color: transparent;
  transform: none;
}

.nav a:hover i {
  color: #ffffff;
}

.nav a.active {
  background: var(--side-active-bg);
  color: var(--side-active-text);
  border-color: rgba(96, 165, 250, 0.20);
  font-weight: 600;
  box-shadow: var(--side-glow);
}

.nav a.active i {
  color: #93c5fd;
}

.nav a.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #60a5fa 0%, #22d3ee 100%);
  box-shadow: 0 0 14px rgba(96, 165, 250, 0.65);
  display: block;
}

/* lang switch sotto */
.lang-switch {
  border-top: 1px solid var(--side-border);
  padding-top: 12px;
}

.lang-switch a {
  color: var(--side-muted);
}

.lang-switch a:hover {
  color: #ffffff;
}

/* ---- Topbar -------------------------------------------- */

.topbar {
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  margin-bottom: 18px;
}

.topbar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.015em;
  color: var(--text);
}

/* ---- Panels: bordo a gradiente sottile (wow) ----------- */

.panel,
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  box-shadow: var(--shadow-xs);
  transition: border-color .2s var(--ease), box-shadow .25s var(--ease), transform .2s var(--ease);
}

.panel:hover,
.card:hover {
  border-color: var(--border-strong);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 8px 24px rgba(15, 23, 42, 0.06),
    0 0 0 1px rgba(18, 84, 163, 0.08);
  transform: translateY(-1px);
}

/* Heading dei pannelli con peso display e size più ariosa */
.panel h2,
.card h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0 0 14px;
}

/* ---- Dashboard hero — animated gradient halo ---------- */

.dashboard-hero {
  position: relative;
  padding: 28px 32px;
  border-radius: 18px;
  background:
    radial-gradient(520px 260px at 0% 0%, rgba(56, 138, 255, 0.18), transparent 65%),
    radial-gradient(420px 240px at 100% 100%, rgba(34, 211, 238, 0.16), transparent 65%),
    linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.dashboard-hero::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.40), transparent 40%, rgba(34, 211, 238, 0.30) 100%);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0.55;
}

/* ---- Tables: header sticky con backdrop blur ----------- */

.table {
  font-size: 0.88rem;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

.table thead th {
  background: rgba(232, 237, 244, 0.80);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.71rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-2);
}

.table tbody tr {
  transition: background .12s var(--ease);
}

.table tbody tr:hover td {
  background: rgba(96, 165, 250, 0.06);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

/* numeric columns visual hint: peso medio */
.table td:has(code) {
  font-family: var(--font-mono);
}

.table code {
  font-size: 0.78rem;
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--text);
}

/* ---- Buttons: primary con glow vero ------------------- */

.btn {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: -0.005em;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fbfcfe;
  color: var(--text);
  box-shadow: var(--shadow-xs);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .25s var(--ease), transform .12s var(--ease);
}

.btn:hover {
  background: #ffffff;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255,255,255,0.20), transparent 70%),
    linear-gradient(180deg, #1e6bc6 0%, var(--accent) 50%, var(--accent-strong) 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: var(--primary-glow);
  font-weight: 600;
}

.btn.primary:hover {
  filter: none;
  box-shadow: var(--primary-glow-hover);
  transform: translateY(-1px);
}

.btn.primary:active {
  transform: translateY(0);
}

.btn.danger {
  background: linear-gradient(180deg, #ef4444 0%, var(--danger) 60%, #b91c1c 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 1px 0 rgba(255,255,255,0.20) inset, 0 6px 16px rgba(220, 38, 38, 0.32);
}

.btn.danger:hover {
  box-shadow: 0 1px 0 rgba(255,255,255,0.20) inset, 0 8px 22px rgba(220, 38, 38, 0.42);
  transform: translateY(-1px);
}

/* ---- Badges con micro-bordo -------------------------- */

.badge {
  font-family: var(--font-sans);
  font-size: 0.71rem;
  font-weight: 600;
  letter-spacing: 0;
  padding: 4px 9px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-2);
  text-transform: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.55;
}

.badge.badge-success::before { background: #16a34a; opacity: 1; }
.badge.badge-warn::before    { background: #d97706; opacity: 1; }
.badge.badge-danger::before  { background: #dc2626; opacity: 1; }

/* ---- Inputs: focus ring più ricco --------------------- */

input, select, textarea {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  padding: 9px 12px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(18, 84, 163, 0.14);
}

label > span:first-child {
  font-family: var(--font-sans);
  color: var(--text-2);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

/* ---- Sidebar collapse handle (se esiste) -------------- */
.sidebar .lang-switch a {
  font-size: 0.85rem;
}

/* ---- Topbar buttons: pulizia totale ------------------- */
.topbar-btn {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.85rem;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #fbfcfe;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
}

.topbar-btn:hover {
  background: #ffffff;
  border-color: var(--border-strong);
  color: var(--text);
  transform: none;
}

.topbar-btn i {
  color: inherit;
}

.topbar-btn.danger {
  color: var(--danger);
  background: #fff5f5;
  border-color: #fecaca;
  box-shadow: none;
}

.topbar-btn.danger i {
  color: var(--danger);
}

.topbar-btn.danger:hover {
  background: var(--danger);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.30);
}

/* =========================================================
   Pagina USERS — riorganizzazione visiva
   ========================================================= */

/* Stat cards in alto */
.users-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(180px 100px at 100% 0%, rgba(18, 84, 163, 0.06), transparent 70%);
}

.stat-card-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.stat-card-value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  font-feature-settings: "tnum" 1, "lnum" 1;
}

.stat-card.stat-success {
  border-color: rgba(22, 163, 74, 0.25);
}
.stat-card.stat-success::before {
  background: radial-gradient(180px 100px at 100% 0%, rgba(22, 163, 74, 0.10), transparent 70%);
}
.stat-card.stat-success .stat-card-value { color: #166534; }

.stat-card.stat-danger {
  border-color: rgba(220, 38, 38, 0.22);
}
.stat-card.stat-danger::before {
  background: radial-gradient(180px 100px at 100% 0%, rgba(220, 38, 38, 0.08), transparent 70%);
}
.stat-card.stat-danger .stat-card-value { color: #991b1b; }

/* Toolbar di filtraggio sopra la tabella */
.users-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.users-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

.users-search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 280px;
}
.users-search i {
  position: absolute;
  left: 12px;
  color: var(--muted-soft);
  pointer-events: none;
  font-size: 0.85rem;
}
.users-search input {
  padding-left: 34px;
}

.users-per {
  display: flex;
  align-items: center;
  gap: 8px;
}
.users-per span {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  margin: 0;
  white-space: nowrap;
}
.users-per input {
  width: 80px;
}

/* Tabella users */
.users-table .actions-cell {
  white-space: nowrap;
  display: flex;
  gap: 6px;
}

.users-table .actions-cell .btn {
  padding: 6px 10px;
  font-size: 0.8rem;
}
.users-table .actions-cell .btn .edit-label {
  display: inline;
}
.users-table .actions-cell .btn.danger-link {
  color: var(--danger);
  background: #fff5f5;
  border-color: #fecaca;
}
.users-table .actions-cell .btn.danger-link:hover {
  background: var(--danger);
  color: #ffffff;
  border-color: transparent;
}

/* Cella username con avatar */
.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #1254a3 0%, #0891b2 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(18, 84, 163, 0.20);
}
.user-cell-info {
  min-width: 0;
}
.user-cell-name {
  font-weight: 600;
  color: var(--text);
}
.user-cell-sub {
  font-size: 0.72rem;
  margin-top: 2px;
}

/* Form users con sotto-sezioni */
.users-form .form-section {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px 16px 6px;
  margin-bottom: 14px;
  background: var(--panel-2);
}

.users-form .form-section:last-of-type {
  margin-bottom: 18px;
}

.users-form .form-section h3 {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.users-form .grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.users-form .span-2 {
  grid-column: span 2;
}

@media (max-width: 720px) {
  .users-form .span-2 {
    grid-column: auto;
  }
}

.users-form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 1px solid var(--border-soft);
  margin-top: 4px;
}

/* Tab buttons con icona */
.tab-bar .tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tab-bar .tab-btn i {
  font-size: 0.85rem;
  opacity: 0.85;
}
.tab-bar .tab-btn.active i {
  opacity: 1;
  color: var(--accent);
}

/* edit-row presentation: stesso bg del panel-2 */
.users-table .edit-row .edit-panel {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}

/* =========================================================
   SIP ACCOUNTS — secret field con bottoni inline
   ========================================================= */
.secret-field {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcfe;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.secret-field input {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  box-shadow: none;
  padding: 8px 12px;
}

.secret-field input:focus {
  outline: none;
  box-shadow: none;
}

.secret-field:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus);
  background: #ffffff;
}

.secret-field .secret-btn {
  flex: 0 0 auto;
  width: 36px;
  border: 0;
  border-left: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: background .15s var(--ease), color .15s var(--ease);
}

.secret-field .secret-btn:hover {
  background: var(--bg-2);
  color: var(--accent);
}

.secret-field .secret-btn.ok {
  color: #16a34a;
  background: rgba(34, 197, 94, 0.10);
}

/* Tabella admin: secret oscurato con toggle */
.secret-display {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.secret-display .secret-mask {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--bg-2);
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  letter-spacing: 0.06em;
}

/* Form section helper riutilizzato dal partial */
.sip-account-form .form-section {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 14px 16px 6px;
  margin-bottom: 14px;
  background: var(--panel-2);
}

.sip-account-form .form-section h3 {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.sip-account-form .grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.sip-account-form .span-2 {
  grid-column: span 2;
}

.sip-account-form .span-full,
.users-form .span-full {
  grid-column: 1 / -1;
}

/* Section header con icon + label affiancata e divider */
.sip-account-form .form-section h3,
.users-form .form-section h3 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sip-account-form .form-section h3 i,
.users-form .form-section h3 i {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  flex: 0 0 auto;
}

.sip-account-form .form-section h3 > span,
.users-form .form-section h3 > span {
  flex: 0 0 auto;
}

/* Hint sotto i campi: piccolo testo informativo */
.sip-account-form .form-hint,
.users-form .form-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0 2px;
  padding: 8px 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(18, 84, 163, 0.18);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.4;
}

.sip-account-form .form-hint i,
.users-form .form-hint i {
  color: var(--accent);
  margin-top: 2px;
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .sip-account-form .span-2,
  .sip-account-form .span-full,
  .users-form .span-2,
  .users-form .span-full {
    grid-column: auto;
  }
}

/* =========================================================
   RATE FORM — preset increment + disclosure inline
   ========================================================= */

.rate-form .form-section {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px 12px;
  margin: 0 0 14px;
}

.rate-form .form-section::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  opacity: 0.6;
}

.rate-form .form-section h3 {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.rate-form .form-section h3 i {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  flex: 0 0 auto;
}

.rate-form .grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.rate-form .span-2 {
  grid-column: span 2;
}

@media (max-width: 720px) {
  .rate-form .span-2 {
    grid-column: auto;
  }
}

/* Hint box */
.rate-form .form-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 12px 0 0;
  padding: 8px 12px;
  background: var(--accent-soft);
  border: 1px solid rgba(18, 84, 163, 0.18);
  border-radius: 8px;
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.4;
}

.rate-form .form-hint i {
  color: var(--accent);
  margin-top: 2px;
  font-size: 0.85rem;
}

/* Preset buttons row */
.rate-form .rate-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}

.rate-form .rate-presets-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 6px;
}

.rate-form .rate-preset-btn {
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fbfcfe;
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s var(--ease), border-color .12s var(--ease), color .12s var(--ease);
}

.rate-form .rate-preset-btn code {
  font-family: var(--font-mono);
  background: transparent;
  border: 0;
  padding: 0;
  font-size: 0.85em;
  color: inherit;
}

.rate-form .rate-preset-btn:hover {
  background: var(--accent-soft);
  border-color: rgba(18, 84, 163, 0.30);
  color: var(--accent);
  transform: none;
  box-shadow: none;
}

.rate-form .rate-preset-btn.active {
  background: var(--accent);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(18, 84, 163, 0.20);
}

.rate-form .rate-preset-btn.active code {
  color: #ffffff;
}

.rate-form .users-form-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  padding: 14px 16px;
  margin: 8px -4px -4px;
  background: linear-gradient(180deg, transparent 0%, var(--panel-2) 30%);
  border-top: 1px solid var(--border-soft);
  border-radius: 0 0 12px 12px;
}

/* Edit-row della tabella rates: stesso pattern di users/sip_accounts */
.table tbody tr.edit-row.is-open td {
  padding: 0;
}

.table tbody tr.edit-row .edit-panel {
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin: 8px 4px 16px;
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.04);
  position: relative;
}

.table tbody tr.edit-row .edit-panel::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 24px;
  width: 16px;
  height: 16px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-right: 0;
  border-bottom: 0;
  transform: rotate(45deg);
}

.topbar-btn.danger:hover i {
  color: #ffffff;
}

/* ---- Pagination wow ----------------------------------- */
.pagination .current,
.pagination span.current {
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255,255,255,0.25), transparent 70%),
    linear-gradient(180deg, #1e6bc6 0%, var(--accent) 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.20) inset, 0 4px 12px rgba(18, 84, 163, 0.30);
}

/* ---- Selezione testo brand ---------------------------- */
::selection {
  background: rgba(56, 138, 255, 0.22);
  color: var(--text);
}

/* ---- Login card: hero centrale ------------------------ */
.login-card,
.center-card {
  position: relative;
  border-radius: 22px;
  padding: 32px;
  background:
    radial-gradient(420px 220px at 0% 0%, rgba(56, 138, 255, 0.10), transparent 65%),
    radial-gradient(360px 200px at 100% 100%, rgba(34, 211, 238, 0.08), transparent 65%),
    linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
}

.login-card::before,
.center-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(96, 165, 250, 0.50), transparent 40%, rgba(34, 211, 238, 0.40) 100%);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0.45;
}

/* ---- Honor reduced motion ----------------------------- */
@media (prefers-reduced-motion: reduce) {
  .btn:hover, .btn.primary:hover,
  .panel:hover, .card:hover {
    transform: none;
  }
}

/* =========================================================
   USER FORM — refinement della scheda create/edit
   Tab bar moderna, form section con accent, action bar sticky.
   Si applica anche al sip_account_form (stessa struttura).
   ========================================================= */

/* Container form: padding extra nelle edit-row inline e nel create-body */
.users-form,
.sip-account-form {
  position: relative;
  padding-bottom: 4px;
}

/* ---- Tab bar nuova ---------------------------------- */
.users-form .tabbed,
.sip-account-form .tabbed {
  display: grid;
  gap: 18px;
}

.users-form .tab-bar,
.sip-account-form .tab-bar {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--panel-2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px 12px 0 0;
  margin: -2px -4px 0;
  padding: 4px 4px 0;
}

.users-form .tab-bar .tab-btn,
.sip-account-form .tab-bar .tab-btn {
  position: relative;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 12px 18px;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.875rem;
  letter-spacing: -0.005em;
  color: var(--muted);
  box-shadow: none;
  cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease), background .15s var(--ease);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.users-form .tab-bar .tab-btn:hover,
.sip-account-form .tab-bar .tab-btn:hover {
  color: var(--text);
  background: rgba(18, 84, 163, 0.04);
  border-bottom-color: var(--border-strong);
  transform: none;
}

.users-form .tab-bar .tab-btn.active,
.sip-account-form .tab-bar .tab-btn.active {
  color: var(--accent);
  background: transparent;
  border-bottom-color: var(--accent);
  box-shadow: none;
  font-weight: 600;
}

.users-form .tab-bar .tab-btn.active i,
.sip-account-form .tab-bar .tab-btn.active i {
  color: var(--accent);
  opacity: 1;
}

.users-form .tab-bar .tab-btn i,
.sip-account-form .tab-bar .tab-btn i {
  font-size: 0.85rem;
  opacity: 0.7;
}

/* ---- Tab panel ridisegnato ------------------------- */
.users-form .tab-panel,
.sip-account-form .tab-panel {
  display: none;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 4px 2px;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.users-form .tab-panel.active,
.sip-account-form .tab-panel.active {
  display: block;
  animation: tab-fade-in .25s var(--ease);
}

@keyframes tab-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .users-form .tab-panel.active,
  .sip-account-form .tab-panel.active { animation: none; }
}

/* ---- Form section con accent laterale -------------- */
.users-form .form-section,
.sip-account-form .form-section {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px 12px;
  margin: 0 0 14px;
  transition: border-color .15s var(--ease);
}

.users-form .form-section::before,
.sip-account-form .form-section::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  opacity: 0.6;
}

.users-form .form-section:hover,
.sip-account-form .form-section:hover {
  border-color: var(--border-strong);
}

.users-form .form-section h3,
.sip-account-form .form-section h3 {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.users-form .form-section h3::after,
.sip-account-form .form-section h3::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border) 0%, transparent 100%);
  margin-left: 10px;
  min-width: 30px;
}

/* ---- Label / input refinement nel form ------------- */
.users-form label,
.sip-account-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.users-form label > span:first-child,
.sip-account-form label > span:first-child {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.3;
}

.users-form input:not([type="hidden"]),
.users-form select,
.users-form textarea,
.sip-account-form input:not([type="hidden"]),
.sip-account-form select,
.sip-account-form textarea {
  height: 38px;
  padding: 8px 12px;
}

/* Required indicator (CSS-only) */
.users-form input[required] + span,
.users-form input[required]:placeholder-shown {
  /* nessun extra: tenuto sobrio */
}

.users-form label:has(input[required]) > span:first-child::after,
.users-form label:has(select[required]) > span:first-child::after,
.sip-account-form label:has(input[required]) > span:first-child::after,
.sip-account-form label:has(select[required]) > span:first-child::after {
  content: "*";
  margin-left: 4px;
  color: var(--danger);
  font-weight: 700;
}

/* ---- Bottom actions bar sticky --------------------- */
.users-form .users-form-actions,
.sip-account-form .users-form-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 16px;
  margin: 8px -4px -4px;
  background: linear-gradient(180deg, transparent 0%, var(--panel-2) 30%);
  border-top: 1px solid var(--border-soft);
  border-radius: 0 0 12px 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.users-form .users-form-actions .btn.primary,
.sip-account-form .users-form-actions .btn.primary {
  padding: 10px 20px;
  font-size: 0.9rem;
  min-width: 140px;
  justify-content: center;
}

/* ---- Edit-row container constrain ----------------- */
.users-table .edit-row td,
.data-table .edit-row td {
  padding: 0;
}

.users-table .edit-row .edit-panel,
.data-table .edit-row .edit-panel {
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin: 8px 4px 16px;
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.04);
  position: relative;
}

.users-table .edit-row .edit-panel::before,
.data-table .edit-row .edit-panel::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 24px;
  width: 16px;
  height: 16px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-right: 0;
  border-bottom: 0;
  transform: rotate(45deg);
}

/* Create panel body un po' più ariosa */
.create-panel .create-body {
  padding-top: 12px;
}

/* ---- Mobile: tab bar scrollabile -------------------- */
@media (max-width: 720px) {
  .users-form .tab-bar,
  .sip-account-form .tab-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .users-form .tab-bar::-webkit-scrollbar,
  .sip-account-form .tab-bar::-webkit-scrollbar {
    display: none;
  }
  .users-form .tab-bar .tab-btn,
  .sip-account-form .tab-bar .tab-btn {
    white-space: nowrap;
    flex: 0 0 auto;
  }
  .users-form .form-section,
  .sip-account-form .form-section {
    padding: 16px 14px 10px;
  }
  .users-form .users-form-actions,
  .sip-account-form .users-form-actions {
    padding: 12px;
  }
}

/* =========================================================
   IVR FORM v2 — refinement
   Layout flex: cifra-pillola circolare + select tipo + 1 solo
   campo valore visibile (gli altri sono display:none via JS).
   ========================================================= */

.ivr-form .ivr-options {
  display: grid;
  gap: 10px;
  margin: 14px 0 4px;
}

.ivr-form .ivr-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  box-shadow: var(--shadow-xs);
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease);
}

.ivr-form .ivr-row:hover {
  border-color: var(--border-strong);
}

.ivr-form .ivr-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 84, 163, 0.10);
}

.ivr-form .ivr-digit {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  border: 0;
  box-shadow: 0 2px 6px rgba(18, 84, 163, 0.25);
  margin-bottom: 4px;
}

.ivr-form .ivr-row > label {
  display: grid;
  gap: 6px;
  margin: 0;
}

.ivr-form .ivr-row > .ivr-opt-type-wrap {
  flex: 0 0 200px;
}

.ivr-form .ivr-row > .ivr-opt-value {
  flex: 1 1 240px;
  min-width: 200px;
}

.ivr-form .ivr-row > label > span {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* Audio cards */
.ivr-form .ivr-audio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.ivr-form .ivr-audio-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--panel-2);
  display: grid;
  gap: 10px;
}

.ivr-form .ivr-audio-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ivr-form .ivr-audio-title i {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
}

.ivr-form .ivr-audio-current {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
}

.ivr-form .ivr-audio-current code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  background: transparent;
  padding: 0;
  border: 0;
  word-break: break-all;
}

.ivr-form .ivr-audio-current audio {
  width: 100%;
  height: 32px;
}

.ivr-form .ivr-audio-empty {
  padding: 12px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  font-size: 0.82rem;
}

.ivr-form .ivr-audio-upload {
  display: grid;
  gap: 6px;
}

.ivr-form .ivr-audio-upload span {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* =========================================================
   Dashboard — abbellimento grafico (CSS-only, nessun cambio
   logico, riusa le classi già presenti nella view)
   ========================================================= */

/* Hero — più respiro, decorazione angolare, layout tipografico */
.dashboard-hero {
  padding: 22px 28px;
  align-items: stretch;
  gap: 18px;
  position: relative;
}
.dashboard-hero h1 {
  font-family: var(--font-display, "Inter", system-ui);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent-strong) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 4px 0 6px;
}
.dashboard-hero .kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
}
.dashboard-hero .kicker::before {
  content: "";
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2, #0891b2));
}
.dashboard-hero .muted {
  font-size: 0.85rem;
  color: var(--muted);
}
.dashboard-hero .muted::before {
  content: "\f007";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  margin-right: 6px;
  font-size: 0.7rem;
  color: var(--muted-soft);
}
.hero-meta {
  align-self: center;
  font-weight: 600;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.hero-meta i {
  background: linear-gradient(135deg, var(--accent), var(--accent-2, #0891b2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Stat cards — più aria, hover dinamico, icona con gradient,
   accento colorato sulla card "online_calls" (.accent) */
.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  position: relative;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  transition: transform .18s var(--ease, ease), box-shadow .18s var(--ease, ease), border-color .18s var(--ease, ease);
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(220px 120px at 100% 0%, rgba(18, 84, 163, 0.05), transparent 70%);
}
.stat-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--border-strong);
}
.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(18, 84, 163, 0.10) 0%, rgba(8, 145, 178, 0.08) 100%);
  border: 1px solid rgba(18, 84, 163, 0.18);
  color: var(--accent);
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}
.stat-card .stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
}
.stat-card .stat-value {
  font-family: var(--font-display, "Inter", system-ui);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}
.stat-card.accent {
  border-color: rgba(8, 145, 178, 0.30);
  background:
    radial-gradient(280px 140px at 0% 0%, rgba(8, 145, 178, 0.12), transparent 70%),
    var(--panel);
}
.stat-card.accent .stat-icon {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.18), rgba(34, 211, 238, 0.10));
  border-color: rgba(8, 145, 178, 0.30);
  color: #0e7490;
}
.stat-card.accent .stat-value { color: #0e7490; }

/* Panel — h2 con barra accent verticale */
.panel > h2 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 2px 0 12px;
  position: relative;
  padding-left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel > h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--accent-2, #0891b2));
}

/* Chart bars — più alti, gradient liquido, value pillola */
.chart {
  gap: 12px;
}
.chart-row {
  grid-template-columns: minmax(110px, 1.3fr) 2.4fr auto;
  gap: 14px;
}
.chart-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-bar {
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  height: 14px;
  border-radius: 999px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
  position: relative;
  overflow: hidden;
}
.chart-bar span {
  background:
    linear-gradient(90deg, var(--accent) 0%, var(--accent-2, #0891b2) 100%);
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.30),
    0 0 12px rgba(18, 84, 163, 0.20);
  position: relative;
  transition: width .6s var(--ease, cubic-bezier(.16,1,.3,1));
}
.chart-bar span::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.30) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: chartShimmer 3s ease-in-out infinite;
  opacity: 0.7;
}
@keyframes chartShimmer {
  0%   { background-position: -100% 0; }
  100% { background-position: 200% 0; }
}
.chart-value {
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg-2);
  border: 1px solid var(--border-soft);
  padding: 3px 10px;
  border-radius: 999px;
  min-width: 44px;
  text-align: center;
}

/* Health check — status badges con icona inline */
.panel .table tbody td .badge {
  font-size: 0.72rem;
  padding: 4px 10px;
  text-transform: lowercase;
}
.panel .table tbody td .badge.badge-success::before {
  background: #16a34a;
  width: 7px; height: 7px;
}
.panel .table tbody td .badge.badge-danger::before {
  background: #dc2626;
  width: 7px; height: 7px;
}

/* Storage / Redis — bar variants by class will come from view if needed,
   ma intanto migliora il default e il muted footer */
.panel > .muted {
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--muted);
}
.panel > .muted + .muted {
  margin-top: 4px;
}

/* Tools panels (DNS/traceroute/SIP) — form un filo più compatto */
.panel form.form-grid + ul {
  margin-top: 12px;
  padding-left: 18px;
  font-size: 0.85rem;
  color: var(--text-2);
}
.panel form.form-grid + ul li {
  padding: 3px 0;
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
}
.panel pre.code-block {
  margin-top: 12px;
  font-size: 0.78rem;
  line-height: 1.5;
  background: #0b1424;
  color: #d1d9e6;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.85);
  max-height: 320px;
  overflow: auto;
  font-family: var(--font-mono, "JetBrains Mono", ui-monospace, monospace);
}

/* Mobile */
@media (max-width: 720px) {
  .dashboard-hero {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 18px;
    gap: 12px;
  }
  .hero-meta {
    align-self: flex-start;
  }
  .stat-card .stat-value { font-size: 1.4rem; }
  .chart-row {
    grid-template-columns: 1fr 2fr auto;
    gap: 10px;
  }
}

@media (max-width: 720px) {
  .ivr-form .ivr-row > .ivr-opt-type-wrap,
  .ivr-form .ivr-row > .ivr-opt-value {
    flex: 1 1 100%;
  }
}


/* =========================================================
   Filter operator group: select operatore + input affiancati
   come unico controllo (per filtri "contiene/inizia con/uguale")
   ========================================================= */
.filter-op-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfcfe;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: border-color .12s var(--ease), box-shadow .12s var(--ease);
}

.filter-op-group:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus);
  background: #ffffff;
}

.filter-op-group .filter-op-select {
  flex: 0 0 auto;
  width: auto;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg-2);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0 26px 0 10px;
  color: var(--text-2);
  box-shadow: none;
  height: auto;
  /* freccia compatta */
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}

.filter-op-group .filter-op-select:focus {
  outline: none;
  box-shadow: none;
  background-color: var(--accent-soft);
  color: var(--accent);
}

.filter-op-group input {
  flex: 1;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 8px 12px;
  min-width: 0;
}

.filter-op-group input:focus {
  outline: none;
  box-shadow: none;
}

/* =========================================================
   FIX UNIVERSALE OVERFLOW TABELLE LARGHE
   - Approccio CSS con :has() per i browser moderni
   - Approccio JS auto-wrap (in app.js) come fallback / per i casi edge
   ========================================================= */

/* Browser moderni: il pannello che contiene una tabella diretta scrolla */
.panel:has(> table.table) {
  overflow-x: auto;
}

/* Wrapper esplicito (preferito): scroll solo della zona tabella */
.panel > .table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  /* margin negativo per arrivare a filo del pannello */
  margin: 0 -22px;
  padding: 0 22px;
}
.panel > .table-wrap > .table {
  width: max-content;
  min-width: 100%;
  margin-bottom: 0;
}

/* Mobile: il wrap sostituisce il display:block sulla table */
@media (max-width: 900px) {
  .panel > .table-wrap {
    margin: 0 -14px;
    padding: 0 14px;
  }
}

/* =========================================================
   FIX RESPONSIVE: ripristina la sidebar fissa-slide su mobile
   I blocchi v3 (sidebar dark, app-shell) avevano dichiarazioni
   non in media query che rompevano il layout mobile.
   ========================================================= */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr !important;
  }

  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.2s var(--ease);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
    /* Tieni il look dark anche su mobile per coerenza */
    padding: 20px 14px;
  }

  .sidebar.open,
  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.50);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s var(--ease);
    z-index: 90;
  }

  body.nav-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  body.nav-open {
    overflow: hidden;
  }

  .main {
    padding: 14px;
    /* Critico: senza questo il contenuto può sforare la viewport */
    min-width: 0;
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Toolbar interne dei filtri vanno a colonna su mobile */
  .users-filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .users-filter-row > * {
    width: 100%;
  }

  /* Stat cards a 2 colonne max su mobile */
  .users-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Bottoni nel page-header fluttuanti */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  /* Riduci padding del pannello su mobile per dare respiro */
  .panel,
  .card {
    padding: 14px;
  }

  /* Le tabelle wrappate scrollano con margini ridotti */
  .panel > .table-wrap {
    margin: 0 -14px;
    padding: 0 14px;
  }
}

/* Schermi piccolissimi (< 480px): card stat a 1 colonna */
@media (max-width: 480px) {
  .users-stats {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   SIP HOST INPUT GROUP — dropdown Dynamic / Static IP
   con campo IP che appare condizionalmente
   ========================================================= */
.host-input-group {
  display: grid;
  gap: 6px;
}
.host-input-group .host-mode-select {
  width: 100%;
}
.host-input-group .host-ip-input {
  width: 100%;
  font-family: var(--font-mono, monospace);
  letter-spacing: 0.02em;
}
.host-input-group .host-ip-input:invalid:not(:placeholder-shown) {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
}

/* =========================================================
   Palette harmony — ritocchi mirati per legare la sidebar
   scura con il resto del layout chiaro. NON tocca la sidebar.
   Solo: body background, topbar, focus ring, pulsanti
   secondary mancante, bordo input coerente.
   ========================================================= */

/* Body: undertone leggermente più freddo, lega meglio al
   blu profondo della sidebar (var(--side-bg) = #0b1424) */
body {
  background:
    radial-gradient(900px 380px at 12% -8%, rgba(18, 84, 163, 0.05), transparent 70%),
    radial-gradient(700px 360px at 92% 0%, rgba(8, 145, 178, 0.05), transparent 70%),
    linear-gradient(180deg, #f5f8fc 0%, #e8eef6 100%);
}

/* Topbar: leggera tinta slate (no più bianco puro, fa parte
   dello stesso sistema cromatico della sidebar dark) */
.topbar {
  background:
    linear-gradient(180deg, #ffffff 0%, #f5f8fc 100%);
  border: 1px solid var(--border, #c8d2e0);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* Topbar buttons — palette uniforme con i .btn principali */
.topbar-btn {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.7);
  color: var(--text-2, #2c3a52);
  font-weight: 500;
}
.topbar-btn:hover {
  background: #ffffff;
  border-color: var(--border-strong, #aab8cd);
  color: var(--text);
}
.topbar-btn.danger {
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.20);
  background: rgba(220, 38, 38, 0.02);
}
.topbar-btn.danger:hover {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.35);
  color: #991b1b;
}

/* Bottone .secondary — mancava nel layer v3, lo aggiungo
   coerente con .btn base */
.btn.secondary {
  background: #ffffff;
  border-color: var(--border, #c8d2e0);
  color: var(--text-2, #2c3a52);
  font-weight: 600;
}
.btn.secondary:hover {
  background: #f5f8fc;
  border-color: var(--border-strong, #aab8cd);
  color: var(--text);
}
.btn.secondary:active {
  background: #ebf0f7;
}

/* Focus ring: tutti gli elementi interattivi usano la stessa
   tinta accent del design system */
.btn:focus-visible,
.topbar-btn:focus-visible,
.pagination a:focus-visible,
.uuid-copy:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(18, 84, 163, 0.22);
}
.btn.danger:focus-visible {
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.20),
    0 0 0 3px rgba(220, 38, 38, 0.25);
}

/* Input border coerente — un solo grigio standard ovunque */
input, select, textarea {
  border-color: var(--border, #c8d2e0);
}
input:hover, select:hover, textarea:hover {
  border-color: var(--border-strong, #aab8cd);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent, #1254a3);
  box-shadow: 0 0 0 3px rgba(18, 84, 163, 0.14);
}

/* Link: stessa accent della primary button, hover con border
   underline per coerenza con resto del sistema */
a.link, .link {
  color: var(--accent, #1254a3);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
a.link:hover, .link:hover {
  color: var(--accent-strong, #0d3f7d);
  border-bottom-color: currentColor;
}

/* Selection: tinta accent armonica */
::selection {
  background: rgba(18, 84, 163, 0.18);
  color: var(--accent-strong, #0d3f7d);
}

/* Mobile topbar: stessa palette */
.mobile-topbar {
  background:
    linear-gradient(180deg, #ffffff 0%, #f5f8fc 100%);
}

/* =========================================================
   Dashboard hero — logo SVG futuristico + decorazione rete
   ========================================================= */

.dashboard-hero {
  position: relative;
  overflow: hidden;
}

.dashboard-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dashboard-logo-wrap {
  display: block;
  margin: 4px 0 6px;
  max-width: 460px;
}

.dashboard-logo {
  width: 100%;
  height: auto;
  max-height: 80px;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(18, 84, 163, 0.12));
}

.dashboard-user-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted, #5b6a82);
}
.dashboard-user-line i {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(18, 84, 163, 0.10), rgba(8, 145, 178, 0.10));
  color: var(--accent, #1254a3);
  font-size: 0.7rem;
  border: 1px solid rgba(18, 84, 163, 0.18);
}
.dashboard-user-role {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-strong, #0d3f7d);
  background: rgba(18, 84, 163, 0.08);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(18, 84, 163, 0.18);
}

.dashboard-hero-deco {
  position: absolute;
  top: -10px;
  right: -20px;
  width: 320px;
  height: 240px;
  pointer-events: none;
  opacity: 0.85;
  z-index: 1;
}

@media (max-width: 900px) {
  .dashboard-hero-deco {
    opacity: 0.45;
    width: 220px;
    height: 180px;
    right: -40px;
  }
}
@media (max-width: 600px) {
  .dashboard-hero-deco {
    display: none;
  }
  .dashboard-logo {
    max-height: 64px;
  }
}

/* =========================================================
   Dashboard — sezione Redis sotto Storage
   ========================================================= */
.dashboard-redis-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px dashed var(--border, #c8d2e0);
}
.dashboard-redis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.dashboard-redis-header h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-left: 0 !important;
}
.dashboard-redis-header h2::before {
  display: none !important;
}
.dashboard-redis-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.redis-metric {
  background: var(--panel-2, #ebf0f7);
  border: 1px solid var(--border-soft, #d8dfe9);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color .15s var(--ease, ease), background .15s var(--ease, ease);
}
.redis-metric:hover {
  border-color: var(--border-strong, #aab8cd);
  background: #ffffff;
}
.redis-metric-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #5b6a82);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.redis-metric-label i {
  color: var(--accent, #1254a3);
  opacity: 0.75;
  font-size: 0.7rem;
}
.redis-metric-value {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text, #0b1424);
  letter-spacing: -0.01em;
}

/* =========================================================
   Sidebar brand — adatta il nuovo logo al container ristretto
   della sidebar dark. ViewBox 420×80, larghezza piena.
   ========================================================= */
.sidebar .brand {
  padding: 4px 4px 12px;
}
.sidebar .brand-logo {
  width: 100%;
  display: block;
  padding: 0;
}
.sidebar .brand-svg {
  width: 100%;
  height: auto;
  max-width: 100%;
  display: block;
  filter: drop-shadow(0 4px 14px rgba(8, 145, 178, 0.18));
}
