/* =========================================================
   AutoNetwork24 FleetOS - Enterprise Demo
   Brand: Deep Emerald + Petrol + Sage (Stitch Institutional Fleet Logic)
   Design System premium per autonoleggio multi-sede
   ========================================================= */

:root {
  /* === Palette Institutional Fleet Logic (Stitch Template) === */
  --primary: #003527;
  --primary-container: #064e3b;
  --on-primary: #ffffff;
  --on-primary-container: #80bea6;
  --inverse-primary: #95d3ba;
  --secondary: #006a61;
  --secondary-container: #86f2e4;
  --on-secondary: #ffffff;
  --on-secondary-container: #006f66;
  --secondary-fixed: #89f5e7;
  --secondary-fixed-dim: #6bd8cb;
  --tertiary: #003623;
  --tertiary-container: #004f34;
  --on-tertiary: #ffffff;
  --on-tertiary-container: #31c98f;
  --tertiary-fixed: #6ffbbe;
  --tertiary-fixed-dim: #4edea3;

  /* Neutrals / Surface */
  --background: #f9f9ff;
  --on-background: #111c2d;
  --surface: #f9f9ff;
  --surface-dim: #cfdaf2;
  --surface-bright: #f9f9ff;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f0f3ff;
  --surface-container: #e7eeff;
  --surface-container-high: #dee8ff;
  --surface-container-highest: #d8e3fb;
  --surface-variant: #d8e3fb;
  --on-surface: #111c2d;
  --on-surface-variant: #404944;
  --inverse-surface: #263143;
  --inverse-on-surface: #ecf1ff;

  /* Outline */
  --outline: #707974;
  --outline-variant: #bfc9c3;

  /* Error */
  --error: #ba1a1a;
  --error-container: #ffdad6;
  --on-error: #ffffff;
  --on-error-container: #93000a;

  /* Primary-fixed aliases */
  --primary-fixed: #b0f0d6;
  --primary-fixed-dim: #95d3ba;
  --on-primary-fixed: #002117;
  --on-primary-fixed-variant: #0b513d;

  /* Semantic aliases for backward compatibility */
  --signal-red: #ba1a1a;
  --electric-cyan: #006a61;
  --emerald-ok: #4edea3;
  --amber-alert: #f59e0b;
  --error-red: #ba1a1a;
  --bg-app: #f9f9ff;
  --card-white: #ffffff;
  --border-soft: #bfc9c3;
  --text-primary: #111c2d;
  --text-secondary: #404944;

  /* Slate scale (mapped to Stitch neutrals) */
  --slate-50: #f0f3ff;
  --slate-100: #e7eeff;
  --slate-200: #d8e3fb;
  --slate-300: #bfc9c3;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-900: #1e293b;

  --sage-50: #f0fdf4;
  --amber: #f59e0b;

  /* Radius (matching Stitch template: softer, institutional) */
  --r-default: 0.125rem;
  --r-lg: 0.25rem;
  --r-xl: 0.5rem;
  --r-2xl: 0.75rem;
  --r-full: 9999px;

  /* Spacing */
  --sp-unit: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-gutter: 16px;
  --sp-section-gap: 32px;
  --sp-container-padding: 24px;

  /* Layout */
  --sidebar-width: 280px;
  --topbar-height: 64px;

  --box-shadow-sm: 0 1px 3px rgba(0,0,0,.05);
  --box-shadow-md: 0 4px 6px -1px rgba(0,0,0,.05);
  --box-shadow-lg: 0 10px 30px rgba(0,0,0,.12);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--background);
  color: var(--on-surface);
  font-size: 14px;
  line-height: 20px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal; font-style: normal;
  font-size: 22px; line-height: 1;
  letter-spacing: normal; text-transform: none;
  display: inline-block; white-space: nowrap;
  word-wrap: normal; direction: ltr;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}
.material-symbols-outlined.fill { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }
.material-symbols-outlined.text-sm { font-size: 18px; }
.icon-xs { font-size: 16px !important; }
.icon-sm { font-size: 20px !important; }
.icon-md { font-size: 22px !important; }
.icon-lg { font-size: 28px !important; }
.icon-xl { font-size: 36px !important; }

/* Typography helpers */
.t-display { font-size: clamp(32px, 4vw, 48px); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.t-headline-lg { font-size: 32px; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
.t-headline { font-size: 24px; font-weight: 600; line-height: 1.33; }
.t-headline-sm { font-size: 20px; font-weight: 600; line-height: 1.4; }
.t-title { font-size: 18px; font-weight: 600; line-height: 1.33; }
.t-body { font-size: 14px; font-weight: 400; line-height: 1.43; }
.t-body-lg { font-size: 16px; font-weight: 400; line-height: 1.5; }
.t-label { font-size: 12px; font-weight: 500; letter-spacing: 0.05em; }
.t-label.upper { text-transform: uppercase; }
.t-caption { font-size: 12px; font-weight: 400; line-height: 1.33; }
.muted { color: var(--on-surface-variant); }
.muted-strong { color: var(--text-secondary); }
.text-primary { color: var(--primary); }
.text-cyan { color: var(--secondary); }

/* Layout */
[hidden] { display: none !important; }
.app-shell { display: flex; min-height: 100vh; }

/* Sidebar - Deep Emerald */
.sidebar {
  width: var(--sidebar-width);
  position: fixed; inset: 0 auto 0 0;
  background: var(--primary);
  color: var(--on-primary);
  display: flex; flex-direction: column;
  padding: 24px 0;
  z-index: 50;
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.brand-row { display: flex; align-items: center; gap: 12px; padding: 0 24px 32px; }
.brand-row img.logo-sidebar { max-height: 60px; width: auto; object-fit: contain; }
.brand-row img.logo-compact { max-height: 32px; width: auto; object-fit: contain; }
.brand-mark {
  width: 40px; height: 40px;
  border-radius: var(--r-lg);
  background: var(--primary-container);
  display: grid; place-items: center;
  color: #fff; flex-shrink: 0;
}
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; color: #fff; }
.brand-sub { font-size: 12px; color: var(--primary-fixed-dim); margin-top: 2px; font-weight: 500; }
.badge-demo { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--secondary-fixed-dim); background: rgba(137,245,231,.15); padding: 2px 8px; border-radius: var(--r-full); margin-top: 4px; display: inline-block; }

/* Navigation */
.nav-list { list-style: none; padding: 0 12px; margin: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-divider { padding: 16px 12px 6px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.3); }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  font-size: 14px;
  border-radius: var(--r-lg);
  transition: background .15s, color .15s;
  cursor: pointer;
  position: relative;
  border-left: 4px solid transparent;
  margin-left: -4px;
  padding-left: 12px;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav-link.active {
  color: #fff;
  background: rgba(137,245,231,.1);
  border-left-color: var(--secondary-fixed);
  font-weight: 600;
}
.nav-link.active .material-symbols-outlined { color: var(--secondary-fixed); }
.nav-link .badge {
  margin-left: auto;
  background: var(--error);
  color: #fff;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--r-full);
}
.nav-bottom { padding: 12px 12px 4px; border-top: 1px solid var(--primary-container); }

/* Main content + topbar */
.main-area {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-height: 100vh;
  display: flex; flex-direction: column;
}
.topbar {
  position: sticky; top: 0;
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--outline-variant);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-container-padding);
  z-index: 40;
}
.topbar img.logo-topbar { max-height: 42px; width: auto; object-fit: contain; margin-right: 4px; }
.search-pill { position: relative; max-width: 480px; flex: 1; }
.search-pill .material-symbols-outlined { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--on-surface-variant); font-size: 20px; }
.search-pill input {
  width: 100%; padding: 10px 12px 10px 40px;
  background: var(--surface-container-low);
  border: 1px solid var(--outline-variant);
  border-radius: var(--r-full);
  font-size: 13px; color: var(--on-surface);
  font-family: inherit;
  transition: border .15s, box-shadow .15s;
}
.search-pill input:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(0,106,97,.1); }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: none; background: transparent;
  color: var(--on-surface-variant);
  border-radius: var(--r-full);
  cursor: pointer; position: relative;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-container-low); color: var(--on-surface); }
.icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--error); border: 2px solid var(--surface); }
.divider-v { width: 1px; height: 28px; background: var(--outline-variant); margin: 0 8px; }
.profile-btn { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--outline-variant); border-radius: var(--r-lg); background: transparent; cursor: pointer; text-align: left; }
.profile-btn:hover { background: var(--surface-container-low); }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.avatar-placeholder { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.profile-meta strong { display: block; font-size: 12px; color: var(--on-surface); line-height: 1.1; }
.profile-meta span { display: block; font-size: 11px; color: var(--on-surface-variant); line-height: 1.1; }

/* Scrollable canvas */
.canvas {
  flex: 1; overflow-y: auto;
  padding: var(--sp-container-padding);
  background: var(--background);
  display: flex; flex-direction: column;
  gap: var(--sp-section-gap);
}
.page[hidden] { display: none !important; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-header h2 { margin: 0; color: var(--primary); }
.page-header p { margin: 4px 0 0; }

/* Cards */
.card {
  background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant);
  border-radius: var(--r-xl);
  padding: 20px;
  transition: box-shadow .2s;
}
.card:hover { box-shadow: var(--box-shadow-md); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h3, .card-head .t-title { margin: 0; color: var(--primary); }

/* Grid helpers */
.grid { display: grid; gap: var(--sp-gutter); }
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--sp-gutter); }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }
.span-4 { grid-column: span 4; }
.span-6 { grid-column: span 6; }
.span-8 { grid-column: span 8; }

@media (max-width: 1200px) {
  .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .grid-12 { grid-template-columns: 1fr; }
  .grid-12 > * { grid-column: span 1 !important; }
}
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .grid-12 { grid-template-columns: 1fr; }
  .grid-12 > * { grid-column: span 1 !important; }
}

/* KPI cards */
.kpi { display: flex; flex-direction: column; justify-content: space-between; min-height: 140px; }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; }
.kpi-label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--on-surface-variant); }
.kpi-icon { width: 40px; height: 40px; border-radius: var(--r-lg); background: var(--surface-container); display: grid; place-items: center; }
.kpi-value { font-size: 32px; font-weight: 700; color: var(--primary); line-height: 1; letter-spacing: -0.01em; margin: 8px 0 4px; }
.kpi-bottom { display: flex; align-items: flex-end; justify-content: space-between; }
.trend { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; }
.trend.up { color: var(--emerald-ok); }
.trend.down { color: var(--error); }
.trend.neutral { color: var(--amber-alert); }

/* Mini KPI */
.mini-kpi { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
.mini-kpi .val { font-size: 20px; font-weight: 700; color: var(--primary); }
.mini-kpi .lbl { font-size: 12px; color: var(--on-surface-variant); }
.mini-kpi .ic { width: 40px; height: 40px; border-radius: var(--r-lg); display: grid; place-items: center; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0; line-height: 1.4;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #ffdad6; color: #93000a; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-cyan    { background: rgba(137,245,231,.15); color: var(--secondary); }
.badge-neutral { background: var(--surface-container); color: var(--on-surface-variant); }
.badge-red     { background: rgba(186,26,26,.1); color: var(--error); }

/* Badge stati specifici FleetOS */
.badge-available  { background: #d1fae5; color: #065f46; }
.badge-rented     { background: rgba(137,245,231,.15); color: var(--secondary); }
.badge-booked     { background: #dbeafe; color: #1e40af; }
.badge-maintenance { background: #fef3c7; color: #92400e; }
.badge-blocked    { background: #ffdad6; color: #93000a; }
.badge-returning  { background: #fce7f3; color: #9d174d; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: inherit; font-size: 13px; font-weight: 600; letter-spacing: .02em;
  padding: 10px 18px;
  border-radius: var(--r-lg);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: inset 0 1px 0 rgba(255,255,255,.1); }
.btn-primary:hover { background: var(--primary-container); box-shadow: var(--box-shadow-md); }
.btn-secondary { background: #fff; color: var(--on-surface); border-color: var(--outline-variant); }
.btn-secondary:hover { background: var(--surface-container-low); border-color: var(--outline); }
.btn-ghost { background: transparent; color: var(--secondary); border: 1px solid transparent; padding: 8px 12px; }
.btn-ghost:hover { background: var(--surface-container-low); color: var(--primary); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--r-lg); }
.btn-cyan { background: var(--secondary); color: var(--on-secondary); }
.btn-cyan:hover { background: var(--secondary-container); color: var(--on-secondary-container); }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: var(--r-lg); }

/* Tables */
.table-wrap { background: var(--surface-container-lowest); border: 1px solid var(--outline-variant); border-radius: var(--r-xl); overflow: hidden; }
.table-x { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--on-surface-variant); background: var(--surface-container-low);
  padding: 12px 16px; border-bottom: 1px solid var(--outline-variant);
}
.table td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; color: var(--on-surface); }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--sage-50); }
.table tbody tr:last-child td { border-bottom: none; }
.cell-id { color: var(--on-surface-variant); font-size: 11px; font-family: 'SF Mono', Consolas, monospace; }
.plate { font-family: 'SF Mono', Consolas, monospace; color: var(--on-surface-variant); font-size: 12px; font-weight: 600; letter-spacing: .05em; background: var(--surface-container); padding: 3px 8px; border-radius: 6px; }
.veh-cell { display: flex; align-items: center; gap: 12px; }
.veh-thumb { width: 42px; height: 42px; border-radius: var(--r-lg); background: var(--surface-container-low); display: grid; place-items: center; color: var(--on-surface-variant); border: 1px solid var(--outline-variant); flex-shrink: 0; }
.veh-name { font-weight: 600; font-size: 14px; color: var(--primary); }

/* Filter bar */
.filterbar {
  background: var(--surface-container-lowest); border: 1px solid var(--outline-variant);
  border-radius: var(--r-xl); padding: 14px 16px;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.input, .select {
  font-family: inherit; font-size: 13px; color: var(--on-surface);
  padding: 9px 12px; background: var(--surface-container-lowest);
  border: 1px solid var(--outline-variant); border-radius: var(--r-lg);
}
.input:focus, .select:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(0,106,97,.1); }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%23404944' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-color: var(--surface-container-lowest); }
.search-box { position: relative; }
.search-box .material-symbols-outlined { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--on-surface-variant); font-size: 18px; pointer-events: none; }
.search-box input { padding-left: 34px; }
.toggle-group { display: inline-flex; background: var(--surface-container); border-radius: var(--r-lg); padding: 3px; gap: 2px; }
.toggle-btn { padding: 7px 14px; font-size: 12px; font-weight: 600; border: none; background: transparent; color: var(--on-surface-variant); border-radius: var(--r-lg); cursor: pointer; transition: all .12s; }
.toggle-btn:hover { color: var(--on-surface); }
.toggle-btn.active { background: var(--surface-container-lowest); color: var(--primary); box-shadow: var(--box-shadow-sm); }

/* Progress bars */
.progress { height: 8px; background: var(--surface-container-highest); border-radius: var(--r-full); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: var(--r-full); background: var(--primary); transition: width .4s; }
.progress.red > span { background: var(--error); }
.progress.green > span { background: var(--emerald-ok); }
.progress.amber > span { background: var(--amber-alert); }
.bar-row-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; color: var(--on-surface-variant); }

/* Alert list */
.alert-item { display: flex; gap: 12px; padding: 16px; border-bottom: 1px solid var(--surface-container); align-items: flex-start; }
.alert-item:last-child { border-bottom: none; }
.alert-item:hover { background: var(--surface-container-low); }
.alert-ic { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; margin-top: 2px; }
.alert-ic.critical { background: var(--error-container); color: var(--error); }
.alert-ic.high { background: var(--error-container); color: var(--error); }
.alert-ic.med  { background: #fef3c7; color: #92400e; }
.alert-ic.low  { background: var(--surface-container); color: var(--on-surface-variant); }
.alert-ic.info { background: #dbeafe; color: #1e40af; }
.alert-title { font-weight: 600; line-height: 1.2; font-size: 14px; color: var(--primary); }
.alert-desc { font-size: 12px; color: var(--on-surface-variant); margin-top: 3px; }
.alert-meta { font-size: 11px; color: var(--on-surface-variant); margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }

/* Drawer / Modal */
.drawer { position: fixed; inset: 0; z-index: 60; display: none; }
.drawer.open { display: block; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(17,28,45,.5); backdrop-filter: blur(4px); animation: fade .2s; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(500px, 92vw);
  background: var(--surface-container-lowest); box-shadow: -10px 0 40px rgba(0,0,0,.2);
  transform: translateX(0); display: flex; flex-direction: column; animation: slideIn .25s ease;
  border-radius: 16px 0 0 16px;
}
.drawer-head { padding: 18px 20px; border-bottom: 1px solid var(--outline-variant); display: flex; align-items: center; justify-content: space-between; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { padding: 16px 20px; border-top: 1px solid var(--outline-variant); display: flex; gap: 10px; }

/* Modal center */
.modal-overlay { position: fixed; inset: 0; z-index: 70; background: rgba(17,28,45,.5); backdrop-filter: blur(4px); display: grid; place-items: center; animation: fade .2s; }
.modal-box { background: var(--surface-container-lowest); border-radius: var(--r-2xl); padding: 24px; width: min(640px, 94vw); max-height: 85vh; overflow-y: auto; box-shadow: var(--box-shadow-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-head h3 { margin: 0; font-size: 20px; font-weight: 700; color: var(--primary); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

/* Login */
.login-wrap { display: flex; min-height: 100vh; }
.login-left {
  display: none; position: relative; width: 50%;
  background: var(--primary-container); color: #fff; padding: 48px;
  flex-direction: column; justify-content: space-between; overflow: hidden;
}
.login-left::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(137,245,231,.15), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0,106,97,.12), transparent 55%),
    linear-gradient(135deg, var(--primary), var(--primary-container));
}
.login-left-content { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: space-between; height: 100%; }
.login-left img { max-height: 72px; width: auto; object-fit: contain; margin-bottom: 32px; }
.login-right { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--background); }
.login-form { width: 100%; max-width: 420px; }
.login-form img { max-height: 60px; width: auto; object-fit: contain; margin-bottom: 8px; }
.login-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.login-badge { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: var(--r-full); background: rgba(255,255,255,.1); color: rgba(255,255,255,.8); border: 1px solid rgba(255,255,255,.15); }
.login-claim { font-size: 14px; color: var(--secondary); font-weight: 500; margin-bottom: 24px; }

@media (min-width: 900px) { .login-left { display: flex; } }

/* Charts pure CSS */
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 200px; padding-bottom: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 48px; border-radius: 6px 6px 0 0; background: var(--secondary); min-height: 4px; transition: background .2s, height .4s; }
.bar.red { background: var(--error); }
.bar.muted { background: var(--slate-300); }
.bar-col:hover .bar { opacity: .8; }
.bar-label { font-size: 11px; color: var(--on-surface-variant); font-weight: 500; }
.donut {
  width: 160px; height: 160px; border-radius: 50%; position: relative; margin: 0 auto;
}
.donut-hole { position: absolute; inset: 24px; border-radius: 50%; background: var(--surface-container-lowest); display: grid; place-items: center; text-align: center; font-weight: 700; font-size: 20px; color: var(--primary); }
.donut-hole span { font-size: 11px; font-weight: 400; color: var(--on-surface-variant); }
.donut-legend { list-style: none; padding: 0; margin: 0; }
.donut-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.donut-legend .swatch { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }

/* Wizard */
.wizard { display: flex; align-items: center; justify-content: center; gap: 0; max-width: 800px; margin: 0 auto 32px; }
.wizard-step { display: flex; align-items: center; gap: 10px; color: var(--slate-300); font-size: 13px; }
.wizard-step.active { color: var(--secondary); }
.wizard-step.done { color: var(--emerald-ok); }
.wizard-circle { width: 36px; height: 36px; border-radius: 50%; border: 2px solid currentColor; background: var(--surface-container-lowest); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex-shrink: 0; }
.wizard-step.active .wizard-circle { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.wizard-step.done .wizard-circle { background: var(--emerald-ok); color: #fff; border-color: var(--emerald-ok); }
.wizard-connector { width: 40px; height: 2px; background: var(--slate-200); margin: 0 4px; }
.wizard-connector.done { background: var(--emerald-ok); }

/* Form field */
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--primary); }
.form-field .req { color: var(--error); }
.form-field .help { font-size: 11px; color: var(--on-surface-variant); }

/* Section card */
.section-card { background: var(--surface-container-lowest); border: 1px solid var(--outline-variant); border-radius: var(--r-xl); padding: 24px; }
.section-card h3 { margin: 0 0 4px; font-size: 18px; font-weight: 700; color: var(--primary); }
.section-card .section-sub { font-size: 13px; color: var(--on-surface-variant); margin-bottom: 16px; }

/* Summary sidebar */
.summary-card { position: sticky; top: 80px; }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--r-full); font-size: 12px; font-weight: 600; background: var(--surface-container); color: var(--on-surface-variant); }
.chip-label { color: var(--on-surface-variant); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

/* Stat bento */
.stat-bento { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-bento .item { background: var(--surface-container-low); border-radius: var(--r-lg); padding: 14px; }
.stat-bento .num { font-size: 18px; font-weight: 700; color: var(--primary); }
.stat-bento .lbl { font-size: 11px; color: var(--on-surface-variant); text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }

/* Helpers */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.muted-bg { background: var(--surface-container-low); }
.list-unstyled { list-style: none; padding: 0; margin: 0; }
.w-full { width: 100%; }
.font-mono { font-family: 'SF Mono', Consolas, monospace; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }

/* Admin menu */
.menu { position: absolute; top: 100%; right: 0; margin-top: 6px; background: var(--surface-container-lowest); border: 1px solid var(--outline-variant); border-radius: var(--r-lg); box-shadow: var(--box-shadow-md); min-width: 200px; padding: 6px; z-index: 80; display: none; }
.menu.open { display: block; }
.menu a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; text-decoration: none; color: var(--on-surface); border-radius: var(--r-lg); font-size: 13px; }
.menu a:hover { background: var(--surface-container-low); }
.profile-wrap { position: relative; }

/* Toast */
.toast-container { position: fixed; top: 80px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--inverse-surface); color: var(--inverse-on-surface); padding: 14px 20px;
  border-radius: var(--r-lg); font-size: 13px; font-weight: 500;
  box-shadow: var(--box-shadow-lg); animation: toastIn .3s ease;
  display: flex; align-items: center; gap: 10px;
  max-width: 380px;
  border-left: 4px solid var(--secondary);
}
.toast.success { border-left-color: var(--emerald-ok); }
.toast.error { border-left-color: var(--error); }
.toast.warning { border-left-color: var(--amber-alert); }
@keyframes toastIn { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--outline-variant); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 20px; font-size: 13px; font-weight: 600;
  border: none; background: transparent; color: var(--on-surface-variant);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--on-surface); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Timeline */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 4px; bottom: 4px; width: 2px; background: var(--outline-variant); }
.timeline-item { position: relative; margin-bottom: 18px; }
.timeline-item::before { content: ''; position: absolute; left: -22px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--secondary); border: 2px solid var(--surface-container-lowest); box-shadow: 0 0 0 2px var(--secondary); }
.timeline-item.warning::before { background: var(--amber-alert); box-shadow: 0 0 0 2px var(--amber-alert); }
.timeline-item.danger::before { background: var(--error); box-shadow: 0 0 0 2px var(--error); }
.timeline-time { font-size: 11px; font-weight: 700; color: var(--secondary); margin-bottom: 2px; }
.timeline-text { font-size: 13px; color: var(--on-surface); line-height: 1.4; }

/* Hero */
.hero-card {
  background: linear-gradient(135deg, var(--primary), var(--primary-container));
  color: #fff;
  border-radius: var(--r-2xl);
  padding: 32px;
  position: relative; overflow: hidden;
}
.hero-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 70% 30%, rgba(137,245,231,.12), transparent 60%);
}
.hero-card h1 { margin: 0 0 8px; font-size: 32px; font-weight: 700; position: relative; z-index: 1; }
.hero-card p { margin: 0 0 16px; opacity: .85; font-size: 15px; position: relative; z-index: 1; }
.hero-badges { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-badge { font-size: 11px; font-weight: 600; padding: 5px 14px; border-radius: var(--r-full); border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: rgba(255,255,255,.9); }

/* Planning grid */
.planning-grid { overflow-x: auto; }
.planning-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 900px; }
.planning-table th, .planning-table td { padding: 10px 12px; border: 1px solid var(--outline-variant); text-align: center; }
.planning-table th { background: var(--surface-container-low); font-weight: 600; color: var(--on-surface-variant); font-size: 11px; white-space: nowrap; }
.planning-table .vh-col { text-align: left; min-width: 200px; }
.planning-table td .plan-badge { display: block; padding: 6px 4px; border-radius: 6px; font-weight: 600; font-size: 11px; }
.plan-available { background: #d1fae5; color: #065f46; }
.plan-booked { background: #dbeafe; color: #1e40af; }
.plan-rented { background: rgba(137,245,231,.15); color: var(--secondary); }
.plan-maintenance { background: #fef3c7; color: #92400e; }
.plan-return { background: #fce7f3; color: #9d174d; }
.plan-blocked { background: #ffdad6; color: #93000a; }

/* Chat AI */
.chat-box { background: var(--surface-container-low); border-radius: var(--r-xl); padding: 20px; max-height: 500px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { display: flex; gap: 10px; max-width: 85%; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.assistant { align-self: flex-start; }
.chat-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--secondary); color: #fff; display: grid; place-items: center; font-size: 16px; font-weight: 700; flex-shrink: 0; }
.chat-msg.user .chat-avatar { background: var(--primary); }
.chat-bubble { padding: 12px 16px; border-radius: 16px; font-size: 13px; line-height: 1.5; }
.chat-msg.assistant .chat-bubble { background: var(--surface-container-lowest); border: 1px solid var(--outline-variant); color: var(--on-surface); border-bottom-left-radius: 4px; }
.chat-msg.user .chat-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }

/* Quick prompts */
.quick-prompts { display: flex; flex-wrap: wrap; gap: 8px; }
.quick-prompt {
  padding: 8px 14px; background: var(--surface-container-lowest); border: 1px solid var(--outline-variant);
  border-radius: var(--r-full); font-size: 12px; font-weight: 500;
  color: var(--on-surface); cursor: pointer; transition: all .15s;
}
.quick-prompt:hover { border-color: var(--secondary); color: var(--secondary); box-shadow: 0 0 0 3px rgba(0,106,97,.08); }

/* Stepper migration */
.stepper { display: flex; gap: 0; flex-wrap: wrap; justify-content: center; margin-bottom: 24px; }
.stepper-item { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--slate-300); padding: 8px 0; }
.stepper-item .step-num { width: 28px; height: 28px; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.stepper-item.done { color: var(--emerald-ok); }
.stepper-item.done .step-num { background: var(--emerald-ok); color: #fff; border-color: var(--emerald-ok); }
.stepper-item.active { color: var(--secondary); }
.stepper-item.active .step-num { background: var(--secondary); color: #fff; border-color: var(--secondary); }
.stepper-arrow { color: var(--slate-300); margin: 0 8px; font-size: 16px; }

/* Pressure cards */
.pressure-card { border-left: 4px solid var(--emerald-ok); padding: 16px; background: var(--surface-container-lowest); border-radius: 0 var(--r-lg) var(--r-lg) 0; border: 1px solid var(--outline-variant); border-left-width: 4px; margin-bottom: 12px; }
.pressure-card.warning { border-left-color: var(--amber-alert); }
.pressure-card.danger { border-left-color: var(--error); }
.pressure-card .sede-name { font-weight: 700; font-size: 15px; color: var(--primary); }
.pressure-card .sede-stats { display: flex; gap: 16px; margin-top: 6px; font-size: 12px; color: var(--on-surface-variant); }

/* Scheda 360 panel */
.scheda-360-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scheda-360-grid .item-full { grid-column: span 2; }

/* Sidebar backdrop (mobile overlay) */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 28, 45, 0.5);
  backdrop-filter: blur(4px);
  z-index: 45;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}
.sidebar-backdrop.show {
  opacity: 1;
  visibility: visible;
}

/* Menu toggle button - visible only on mobile/tablet */
.menu-toggle {
  display: none;
}

/* Responsive sidebar */
@media (max-width: 1024px) {
  .sidebar { width: 72px; padding: 16px 0; }
  .sidebar .brand-name, .sidebar .brand-sub, .sidebar .badge-demo,
  .sidebar .nav-link span:nth-child(2), .sidebar .nav-divider,
  .sidebar .nav-link .badge { display: none; }
  .sidebar .nav-link { justify-content: center; padding: 12px; border-left: none; margin-left: 0; }
  .sidebar .brand-row { justify-content: center; padding: 0 8px 16px; }
  .main-area { margin-left: 72px; width: calc(100% - 72px); }
}
@media (max-width: 768px) {
  /* Show menu toggle button */
  .menu-toggle {
    display: grid;
  }
  
  /* Sidebar hidden by default on mobile, shown when .open */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 50;
    padding: 24px 0;
    flex-direction: column;
    overflow-y: auto;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  
  /* Restore sidebar elements when open on mobile */
  .sidebar.open .brand-name,
  .sidebar.open .brand-sub,
  .sidebar.open .badge-demo,
  .sidebar.open .nav-link span:nth-child(2),
  .sidebar.open .nav-divider,
  .sidebar.open .nav-link .badge { display: initial; }
  .sidebar.open .nav-link { justify-content: flex-start; padding: 12px; border-left: 4px solid transparent; margin-left: -4px; }
  .sidebar.open .brand-row { justify-content: flex-start; padding: 0 24px 32px; }
  .sidebar.open .nav-bottom { display: block; }
  
  .sidebar .nav-list { flex-direction: column; flex-wrap: nowrap; gap: 2px; }
  .sidebar .nav-link { padding: 12px; font-size: 14px; border-radius: var(--r-lg); border-left: 4px solid transparent; margin-left: -4px; }
  .sidebar .brand-row { padding: 0 24px 32px; }
  .sidebar .nav-divider { display: block; padding: 16px 12px 6px; }
  .sidebar .nav-bottom { display: block; padding: 12px 12px 4px; border-top: 1px solid var(--primary-container); }
  
  .main-area { margin-left: 0; width: 100%; }
  .topbar { flex-wrap: wrap; height: auto; padding: 12px; gap: 10px; }
}

/* Utility */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.legend-list { display: flex; flex-wrap: wrap; gap: 12px; }
.legend-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--on-surface-variant); }
.legend-pill .sw { width: 12px; height: 12px; border-radius: 3px; }

/* Stat cards grid for Revenue */
.stat-card { background: var(--surface-container-lowest); border: 1px solid var(--outline-variant); border-radius: var(--r-xl); padding: 14px 16px; display: flex; align-items: center; gap: 14px; }
.stat-card .stat-icon { width: 44px; height: 44px; border-radius: var(--r-lg); display: grid; place-items: center; font-size: 20px; flex-shrink: 0; }
.stat-card .stat-info .stat-val { font-size: 22px; font-weight: 700; line-height: 1; color: var(--primary); }
.stat-card .stat-info .stat-lbl { font-size: 12px; color: var(--on-surface-variant); margin-top: 4px; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; color: var(--on-surface-variant); }
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; opacity: .4; }
.empty-state h3 { font-size: 18px; color: var(--primary); margin: 0 0 8px; }
.empty-state p { font-size: 14px; max-width: 400px; margin: 0 auto; }

/* AI recommended actions */
.ai-box { background: linear-gradient(135deg, rgba(0,106,97,.04), rgba(137,245,231,.06)); border: 1px solid rgba(0,106,97,.15); border-radius: var(--r-xl); padding: 20px; }
.ai-box .ai-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ai-box .ai-header .ai-icon { width: 36px; height: 36px; border-radius: var(--r-lg); background: var(--secondary); color: #fff; display: grid; place-items: center; }
.ai-box .ai-header strong { font-size: 16px; color: var(--primary); }
.ai-list { list-style: none; padding: 0; margin: 0; }
.ai-list li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--surface-container); font-size: 13px; }
.ai-list li:last-child { border-bottom: none; }
.ai-list li .ai-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--secondary); margin-top: 5px; flex-shrink: 0; }

/* Integration cards */
.integration-card { border: 1px solid var(--outline-variant); border-radius: var(--r-xl); padding: 16px; display: flex; align-items: center; gap: 14px; transition: box-shadow .15s; background: var(--surface-container-lowest); }
.integration-card:hover { box-shadow: var(--box-shadow-sm); }
.integration-card .int-icon { width: 44px; height: 44px; border-radius: var(--r-lg); display: grid; place-items: center; font-size: 22px; flex-shrink: 0; }
.integration-card .int-name { font-weight: 600; font-size: 14px; color: var(--primary); }
.integration-card .int-status { font-size: 11px; color: var(--on-surface-variant); margin-top: 2px; }

/* Document status rows */
.doc-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border: 1px solid var(--outline-variant); border-radius: var(--r-lg); margin-bottom: 8px; }
.doc-row .doc-name { font-weight: 500; font-size: 13px; }

/* Quick stat pills */
.stat-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.stat-pill { background: var(--surface-container-lowest); border: 1px solid var(--outline-variant); border-radius: var(--r-lg); padding: 14px 18px; text-align: center; min-width: 100px; }
.stat-pill .pill-val { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-pill .pill-lbl { font-size: 11px; color: var(--on-surface-variant); margin-top: 4px; }

/* Schedule 360 photo placeholder */
.photo-placeholder { width: 100%; aspect-ratio: 16/10; background: var(--surface-container); border-radius: var(--r-lg); display: grid; place-items: center; color: var(--slate-400); border: 2px dashed var(--outline-variant); }

/* Signature area */
.signature-area { border: 2px dashed var(--outline-variant); border-radius: var(--r-lg); height: 120px; display: grid; place-items: center; color: var(--on-surface-variant); background: var(--surface-container-low); }

/* Pricing suggestions */
.pricing-tip { background: var(--surface-container-lowest); border: 1px solid var(--outline-variant); border-left: 4px solid var(--secondary); border-radius: 0 var(--r-lg) var(--r-lg) 0; padding: 14px 16px; margin-bottom: 10px; }
.pricing-tip .tip-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--primary); }
.pricing-tip .tip-desc { font-size: 12px; color: var(--on-surface-variant); }

/* Footer */
.app-footer {
  background: var(--surface);
  border-top: 1px solid var(--outline-variant);
  padding: 16px var(--sp-container-padding);
  margin-top: auto;
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1400px;
  margin: 0 auto;
}
.footer-brand {
  font-size: 12px;
  font-weight: 600;
  color: var(--on-surface-variant);
  white-space: nowrap;
}
.footer-meta {
  font-size: 11px;
  color: var(--on-surface-variant);
  text-align: right;
}
.footer-meta a {
  color: var(--secondary);
  text-decoration: none;
}
.footer-meta a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
  .footer-meta {
    text-align: center;
  }
}
