/* ============================================================
   Corpo Pompieri Bellinzona - Main Stylesheet
   Theme: Red (#CC0000) + Dark (#1a1a2e / #222)
   ============================================================ */

:root {
  --primary:        #CC0000;
  --primary-dark:   #990000;
  --primary-light:  #ff4444;
  --dark:           #0f1623;
  --dark-2:         #16213e;
  --sidebar-bg:     #0d1117;
  --sidebar-width:  260px;
  --card-bg:        #1a2332;
  --card-border:    #243044;
  --text:           #e2e8f0;
  --text-muted:     #7a8fa6;
  --input-bg:       #1e2d42;
  --input-border:   #2d4060;
  --success:        #22c55e;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;
  --radius:         8px;
  --radius-lg:      12px;
  --shadow:         0 2px 12px rgba(0,0,0,0.35);
  --shadow-lg:      0 8px 40px rgba(0,0,0,0.5);
  --transition:     all 0.2s ease;
  --font:           'Segoe UI', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--dark); color: var(--text); line-height: 1.6; min-height: 100vh; }
a { color: var(--primary-light); text-decoration: none; }
a:hover { color: #fff; }
img { max-width: 100%; height: auto; }

/* Layout */
.app-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width); background: var(--sidebar-bg);
  border-right: 1px solid #1a2540; display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 1000;
  transition: transform 0.3s ease; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: #2d4060 transparent;
}
.sidebar-header {
  padding: 18px 16px; border-bottom: 1px solid #1a2540;
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #1a0000, #0d1117); flex-shrink: 0;
}
.sidebar-logo { width: 44px; height: 44px; object-fit: contain; flex-shrink: 0; }
.sidebar-title { font-size: 0.82rem; font-weight: 800; color: #fff; line-height: 1.2; letter-spacing: 0.03em; }
.sidebar-title span { display: block; font-size: 0.68rem; color: #888; font-weight: 400; }
.sidebar-nav { padding: 10px 0; flex: 1; }
.nav-section { padding: 8px 18px 4px; font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.12em; color: #4a6080; font-weight: 700; margin-top: 8px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 18px;
  color: #8a9fb8; font-size: 0.875rem; font-weight: 500; transition: var(--transition); position: relative;
}
.nav-link:hover { background: rgba(204,0,0,0.08); color: #fff; }
.nav-link.active { background: rgba(204,0,0,0.15); color: #fff; }
.nav-link.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); border-radius: 0 2px 2px 0; }
.nav-icon { width: 19px; height: 19px; flex-shrink: 0; opacity: 0.75; }
.nav-link:hover .nav-icon, .nav-link.active .nav-icon { opacity: 1; }
.sidebar-user { padding: 14px 16px; border-top: 1px solid #1a2540; display: flex; align-items: center; gap: 10px; background: #080d14; }
.sidebar-user-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 0.8rem; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 0.68rem; color: var(--text-muted); }

/* Main Content */
.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { background: var(--dark-2); border-bottom: 1px solid #1a2540; padding: 0 24px; height: 58px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100; }
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title { font-size: 1.05rem; font-weight: 700; color: #fff; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.menu-toggle { display: none; background: none; border: none; color: var(--text); cursor: pointer; padding: 8px; border-radius: var(--radius); transition: var(--transition); }
.menu-toggle:hover { background: rgba(255,255,255,0.08); }
.menu-toggle svg { width: 24px; height: 24px; }
.page-content { padding: 24px; flex: 1; }

/* Page Header */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 1.4rem; font-weight: 800; color: #fff; display: flex; align-items: center; gap: 10px; }
.page-title svg { width: 26px; height: 26px; color: var(--primary); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Cards */
.card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--card-border); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: rgba(255,255,255,0.015); }
.card-title { font-size: 0.9rem; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 17px; height: 17px; color: var(--primary); }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--card-border); background: rgba(255,255,255,0.015); }

/* Dashboard Grid */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-bottom: 20px; }
.dashboard-grid-wide { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-lg); padding: 18px; display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow); transition: var(--transition); }
.stat-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.stat-icon { width: 50px; height: 50px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 24px; height: 24px; }
.stat-icon.red    { background: rgba(204,0,0,0.12);    color: #ff6666; }
.stat-icon.green  { background: rgba(34,197,94,0.12);  color: var(--success); }
.stat-icon.yellow { background: rgba(245,158,11,0.12); color: var(--warning); }
.stat-icon.blue   { background: rgba(59,130,246,0.12); color: var(--info); }
.stat-icon.orange { background: rgba(249,115,22,0.12); color: #f97316; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: #fff; line-height: 1; }
.stat-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 3px; font-weight: 500; }

/* Tables */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead th { background: rgba(255,255,255,0.03); padding: 11px 14px; text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 700; white-space: nowrap; border-bottom: 1px solid var(--card-border); }
tbody tr { border-bottom: 1px solid rgba(255,255,255,0.035); transition: background 0.15s; }
tbody tr:hover { background: rgba(255,255,255,0.025); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 11px 14px; color: var(--text); vertical-align: middle; }
.table-actions { display: flex; gap: 5px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); border: none; cursor: pointer; font-size: 0.875rem; font-weight: 600; font-family: var(--font); text-decoration: none; transition: var(--transition); white-space: nowrap; line-height: 1; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-sm { padding: 5px 11px; font-size: 0.78rem; }
.btn-lg { padding: 11px 22px; font-size: 0.95rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: rgba(255,255,255,0.07); color: var(--text); border: 1px solid var(--card-border); }
.btn-secondary:hover { background: rgba(255,255,255,0.12); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; color: #fff; }
.btn-warning { background: var(--warning); color: #000; }
.btn-warning:hover { background: #d97706; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #2563eb; color: #fff; }
.btn-outline-primary { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-muted); border: none; }
.btn-ghost:hover { color: #fff; background: rgba(255,255,255,0.07); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 20px; font-size: 0.7rem; font-weight: 700; white-space: nowrap; letter-spacing: 0.03em; }
.badge-success   { background: rgba(34,197,94,0.12);   color: #4ade80; }
.badge-danger    { background: rgba(239,68,68,0.12);   color: #f87171; }
.badge-warning   { background: rgba(245,158,11,0.12);  color: #fbbf24; }
.badge-info      { background: rgba(59,130,246,0.12);  color: #60a5fa; }
.badge-secondary { background: rgba(148,163,184,0.1);  color: #94a3b8; }
.badge-primary   { background: rgba(204,0,0,0.12);     color: #ff8888; }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 0.8rem; font-weight: 600; color: #8fa3b8; letter-spacing: 0.02em; }
.required::after { content: ' *'; color: var(--primary); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="datetime-local"], input[type="tel"], input[type="url"],
select, textarea {
  background: var(--input-bg); border: 1px solid var(--input-border); border-radius: var(--radius);
  color: var(--text); padding: 9px 13px; font-size: 0.875rem; font-family: var(--font);
  transition: var(--transition); width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(204,0,0,0.12); }
input::placeholder, textarea::placeholder { color: #445; }
select option { background: var(--input-bg); }
textarea { resize: vertical; min-height: 100px; }
.form-hint { font-size: 0.73rem; color: var(--text-muted); margin-top: 2px; }
.form-check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.form-check input[type="checkbox"], .form-check input[type="radio"] { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.form-section { border-top: 1px solid var(--card-border); padding-top: 20px; margin-top: 20px; }
.form-section-title { font-size: 0.8rem; font-weight: 800; color: var(--primary-light); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 14px; }

/* Alerts */
.alert { display: flex; align-items: flex-start; gap: 11px; padding: 13px 16px; border-radius: var(--radius); margin-bottom: 14px; font-size: 0.875rem; }
.alert svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: rgba(34,197,94,0.1);  color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.alert-error   { background: rgba(239,68,68,0.1);  color: #f87171; border: 1px solid rgba(239,68,68,0.25); }
.alert-warning { background: rgba(245,158,11,0.1); color: #fbbf24; border: 1px solid rgba(245,158,11,0.25); }
.alert-info    { background: rgba(59,130,246,0.1); color: #60a5fa; border: 1px solid rgba(59,130,246,0.25); }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; visibility: hidden; transition: all 0.25s; backdrop-filter: blur(4px); }
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-lg); max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); transform: scale(0.92); transition: transform 0.25s; }
.modal-overlay.open .modal { transform: scale(1); }
.modal-lg { max-width: 780px; }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--card-border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 1rem; font-weight: 700; color: #fff; }
.modal-close { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; transition: var(--transition); }
.modal-close:hover { color: #fff; background: rgba(255,255,255,0.08); }
.modal-close svg { width: 20px; height: 20px; }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--card-border); display: flex; justify-content: flex-end; gap: 8px; }

/* Filter Bar */
.filter-bar { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-lg); padding: 14px 18px; margin-bottom: 18px; display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filter-bar .form-group { margin: 0; flex: 1; min-width: 150px; }

/* Pagination */
.pagination { display: flex; gap: 4px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.page-link { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: var(--radius); font-size: 0.83rem; font-weight: 600; color: var(--text-muted); background: var(--card-bg); border: 1px solid var(--card-border); transition: var(--transition); }
.page-link:hover { color: #fff; border-color: var(--primary); }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Avatar */
.avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid var(--card-border); flex-shrink: 0; }
.avatar-sm { width: 30px; height: 30px; }
.avatar-lg { width: 80px; height: 80px; }

/* Status dot */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.green  { background: var(--success); box-shadow: 0 0 5px var(--success); }
.status-dot.red    { background: var(--danger);  box-shadow: 0 0 5px var(--danger); }
.status-dot.yellow { background: var(--warning); box-shadow: 0 0 5px var(--warning); }
.status-dot.blue   { background: var(--info);    box-shadow: 0 0 5px var(--info); }

/* Map embed */
.map-embed { width: 100%; height: 300px; border-radius: var(--radius); border: 1px solid var(--card-border); background: #0a0f1a; }

/* Login Page */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #060c18 0%, #0f1a30 50%, #1a0505 100%);
  position: relative; overflow: hidden;
}
.login-page::before {
  content: ''; position: absolute; width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(204,0,0,0.07), transparent 70%);
  top: 50%; left: 50%; transform: translate(-50%, -50%); pointer-events: none;
}
.login-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 16px; padding: 44px 38px; width: 100%; max-width: 400px; box-shadow: var(--shadow-lg); position: relative; z-index: 1; }
.login-header { text-align: center; margin-bottom: 32px; }
.login-logo { width: 76px; height: 76px; margin: 0 auto 14px; display: block; }
.login-title { font-size: 1.4rem; font-weight: 800; color: #fff; margin-bottom: 4px; }
.login-subtitle { font-size: 0.82rem; color: var(--text-muted); }
.login-form .form-group { margin-bottom: 14px; }
.login-btn { width: 100%; padding: 12px; font-size: 0.95rem; margin-top: 6px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border: none; border-radius: var(--radius); cursor: pointer; font-weight: 700; font-family: var(--font); transition: var(--transition); }
.login-btn:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 20px rgba(204,0,0,0.35); }
.login-footer { text-align: center; margin-top: 20px; font-size: 0.75rem; color: var(--text-muted); }

/* TV Dashboard */
.tv-page { background: #000; color: #fff; min-height: 100vh; font-family: var(--font); overflow: hidden; }
.tv-header { background: linear-gradient(90deg, #2a0000, #0a0f1a); padding: 10px 28px; display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid var(--primary); }
.tv-header-logo { display: flex; align-items: center; gap: 14px; }
.tv-header-logo img { width: 56px; height: 56px; }
.tv-org-name { font-size: 1.6rem; font-weight: 800; color: #fff; line-height: 1.1; }
.tv-org-name span { display: block; font-size: 0.85rem; font-weight: 400; color: #aaa; }
.tv-time { font-size: 2.8rem; font-weight: 900; color: #fff; font-variant-numeric: tabular-nums; line-height: 1; text-align: right; }
.tv-date { font-size: 0.9rem; color: #aaa; text-align: right; }
.tv-body { display: grid; grid-template-columns: 1fr 1fr; height: calc(100vh - 80px - 52px); }
.tv-section { padding: 18px 24px; border-right: 1px solid #222; overflow: hidden; }
.tv-section:last-child { border-right: none; }
.tv-section-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--primary); font-weight: 800; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid #333; display: flex; align-items: center; gap: 8px; }
.tv-section-title svg { width: 16px; height: 16px; }
.tv-ticker { background: #0a0a0a; padding: 0 28px; height: 52px; display: flex; align-items: center; overflow: hidden; border-top: 1px solid #333; }
.tv-ticker-inner { white-space: nowrap; animation: ticker 40s linear infinite; font-size: 0.95rem; color: #fbbf24; }
@keyframes ticker { from { transform: translateX(100vw); } to { transform: translateX(-100%); } }
.tv-picchetto-item { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid #1a1a1a; font-size: 1rem; }
.tv-alarm-type { font-size: 1.3rem; font-weight: 800; color: #f87171; }
.tv-alarm-addr { font-size: 0.9rem; color: #aaa; margin-top: 2px; }

/* Info list */
.info-list { display: flex; flex-direction: column; gap: 8px; }
.info-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.04); font-size: 0.875rem; }
.info-item:last-child { border-bottom: none; }
.info-label { color: var(--text-muted); font-weight: 600; flex-shrink: 0; }
.info-value { color: #fff; text-align: right; word-break: break-word; }

/* Map placeholder */
.map-placeholder { background: #0a0f1a; border: 1px solid var(--card-border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; color: var(--text-muted); height: 240px; }
.map-placeholder svg { width: 48px; height: 48px; opacity: 0.25; }

/* Empty state */
.empty-state { text-align: center; padding: 44px 24px; color: var(--text-muted); }
.empty-state svg { width: 60px; height: 60px; margin-bottom: 14px; opacity: 0.25; }
.empty-state h3 { font-size: 1rem; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.empty-state p { font-size: 0.83rem; }

/* Turni */
.turno-group { border: 1px solid var(--card-border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.turno-group-header { background: rgba(204,0,0,0.07); padding: 10px 16px; font-weight: 700; color: var(--primary-light); display: flex; align-items: center; justify-content: space-between; font-size: 0.875rem; }
.turno-milite-row { display: flex; align-items: center; gap: 12px; padding: 9px 16px; border-bottom: 1px solid rgba(255,255,255,0.035); font-size: 0.875rem; }
.turno-milite-row:last-child { border-bottom: none; }

/* Vehicle cards */
.veicoli-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.veicolo-card { background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius-lg); overflow: hidden; transition: var(--transition); }
.veicolo-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.veicolo-img { width: 100%; height: 160px; object-fit: cover; background: #0a0f1a; display: flex; align-items: center; justify-content: center; }
.veicolo-img svg { width: 60px; height: 60px; opacity: 0.2; }
.veicolo-body { padding: 14px 16px; }
.veicolo-targa { font-size: 0.72rem; font-weight: 800; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }
.veicolo-model { font-size: 1rem; font-weight: 700; color: #fff; margin: 3px 0; }
.veicolo-tipo { font-size: 0.8rem; color: var(--text-muted); }
.veicolo-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--card-border); }

/* Stock low */
.stock-low { color: var(--danger) !important; font-weight: 700; }

/* Milite header */
.milite-header { display: flex; align-items: center; gap: 22px; margin-bottom: 22px; }
.milite-avatar { width: 90px; height: 90px; border-radius: 50%; object-fit: cover; border: 3px solid var(--primary); flex-shrink: 0; }
.milite-info h2 { font-size: 1.5rem; font-weight: 800; color: #fff; }
.milite-info p { color: var(--text-muted); font-size: 0.875rem; }

/* Dropdown */
.dropdown { position: relative; display: inline-flex; }
.dropdown-menu { position: absolute; top: calc(100% + 4px); right: 0; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: var(--radius); min-width: 170px; box-shadow: var(--shadow-lg); z-index: 500; display: none; overflow: hidden; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 9px 14px; color: var(--text); font-size: 0.875rem; transition: background 0.15s; cursor: pointer; border: none; background: none; width: 100%; text-align: left; font-family: var(--font); text-decoration: none; }
.dropdown-item:hover { background: rgba(255,255,255,0.06); color: #fff; }
.dropdown-item svg { width: 15px; height: 15px; }
.dropdown-divider { height: 1px; background: var(--card-border); margin: 4px 0; }

/* Tabs */
.tabs { display: flex; border-bottom: 1px solid var(--card-border); margin-bottom: 18px; overflow-x: auto; }
.tab-link { padding: 9px 18px; font-size: 0.875rem; font-weight: 600; color: var(--text-muted); border: none; background: none; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: var(--transition); font-family: var(--font); }
.tab-link:hover { color: #fff; }
.tab-link.active { color: var(--primary-light); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Spinner */
.spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.2); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Progress */
.progress { height: 6px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 4px; transition: width 0.5s; }

/* Footer */
.app-footer { padding: 14px 24px; text-align: center; font-size: 0.73rem; color: var(--text-muted); border-top: 1px solid var(--card-border); }

/* Overlay */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 999; }

/* PWA install */
#pwa-install-banner { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--card-bg); border: 1px solid var(--primary); border-radius: var(--radius-lg); padding: 14px 18px; align-items: center; gap: 14px; box-shadow: var(--shadow-lg); z-index: 1500; max-width: 90vw; display: none; }
#pwa-install-banner.visible { display: flex; }

/* Print */
@media print {
  .sidebar, .topbar, .page-actions, .btn, .filter-bar { display: none !important; }
  .main-content { margin-left: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .card { border: 1px solid #ccc !important; background: #fff !important; box-shadow: none !important; }
  td, th { color: #000 !important; border-color: #ccc !important; }
  .badge { border: 1px solid #ccc; }
}

/* Responsive */
@media (max-width: 1024px) { .dashboard-grid-wide { grid-template-columns: 1fr; } }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .page-content { padding: 14px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .filter-bar { flex-direction: column; }
  .filter-bar .form-group { min-width: 100%; }
  .tv-body { grid-template-columns: 1fr; }
  .tv-section { border-right: none; border-bottom: 1px solid #222; }
  .veicoli-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.6rem; }
  .table-wrapper { font-size: 0.8rem; }
  thead th, tbody td { padding: 8px 10px; }
}

/* Utilities */
.text-muted   { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-primary { color: var(--primary-light) !important; }
.fw-bold   { font-weight: 700 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }
.mt-3 { margin-top: 24px !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }
.d-flex { display: flex; }
.d-none { display: none !important; }
.align-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.w-100 { width: 100%; }

