:root {
  --ink: #142b2b;
  --ink-soft: #4b6261;
  --forest: #153d3b;
  --forest-2: #245b55;
  --mint: #d9eee7;
  --lime: #d9f26b;
  --sand: #f2efe6;
  --paper: #fbfaf6;
  --white: #fff;
  --line: #dde5e1;
  --danger: #c04d3a;
  --warning: #d79927;
  --success: #287a62;
  --blue: #3c6e91;
  --shadow: 0 20px 55px rgba(26, 57, 54, .13);
  --radius: 16px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); }
body { font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.eyebrow { color: #6a817e; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.muted { color: #70817f; }
.mobile-only { display: none; }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; }
.login-brand {
  position: relative; overflow: hidden; color: white; background:
    radial-gradient(circle at 75% 18%, rgba(217,242,107,.24), transparent 26%),
    linear-gradient(145deg, #0e2e2e, #20524d);
  padding: 70px clamp(42px, 7vw, 110px); display: flex; flex-direction: column; justify-content: center;
}
.login-brand::after {
  content: ""; position: absolute; width: 520px; height: 520px; border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%; right: -230px; bottom: -280px; box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 140px rgba(255,255,255,.018);
}
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center;
  background: var(--lime); color: var(--forest); font-weight: 900; letter-spacing: -.06em;
}
.brand-mark.large { width: 58px; height: 58px; font-size: 18px; margin-bottom: 35px; }
.login-brand .eyebrow { color: var(--lime); }
.login-brand h1 { font-size: clamp(48px, 6vw, 78px); line-height: .95; margin: 12px 0 18px; letter-spacing: -.055em; }
.login-brand > div > p { font-size: 20px; color: #c8d7d3; max-width: 530px; line-height: 1.5; }
.login-highlights { display: grid; gap: 18px; margin-top: 70px; max-width: 610px; }
.login-highlights div { display: flex; gap: 18px; border-top: 1px solid rgba(255,255,255,.14); padding-top: 15px; }
.login-highlights span { color: var(--lime); font-weight: 800; }
.login-highlights p { margin: 0; color: #c8d7d3; }
.login-panel { display: grid; place-items: center; padding: 35px; background: #f5f3ec; }
.login-card { width: min(410px, 100%); background: white; padding: 40px; border-radius: 22px; box-shadow: var(--shadow); }
.login-card h2 { margin: 10px 0 4px; font-size: 32px; letter-spacing: -.04em; }
.login-card label, .form-grid label { display: grid; gap: 8px; font-weight: 700; color: #405553; }
.login-card label { margin-top: 20px; }
input, select, textarea {
  min-width: 0; width: 100%; border: 1px solid #d5dfdc; background: #fff; border-radius: 10px;
  padding: 11px 12px; color: var(--ink); outline: none; transition: .18s;
}
input:focus, select:focus, textarea:focus { border-color: var(--forest-2); box-shadow: 0 0 0 3px rgba(36,91,85,.1); }
textarea { min-height: 100px; resize: vertical; }
.login-note { text-align: center; color: #8b9997; font-size: 12px; margin: 18px 0 0; }
.form-error { padding: 10px 12px; margin-top: 15px; border-radius: 9px; color: #9c3327; background: #fde7e2; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar {
  width: 250px; height: 100vh; position: fixed; z-index: 30; inset: 0 auto 0 0;
  color: white; background: var(--forest); display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-head { height: 76px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-head strong { display: block; font-size: 18px; letter-spacing: -.03em; }
.sidebar-head span { color: #9db7b2; font-size: 10px; text-transform: uppercase; letter-spacing: .09em; }
.main-nav { padding: 17px 12px; flex: 1; }
.nav-group { color: #739590; font-size: 10px; font-weight: 800; letter-spacing: .14em; padding: 18px 12px 8px; }
.nav-item {
  width: 100%; border: 0; background: transparent; color: #bcd0cc; text-align: left; border-radius: 10px;
  padding: 10px 12px; display: flex; align-items: center; gap: 11px; margin: 2px 0; font-weight: 600;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: white; }
.nav-item.active { background: var(--lime); color: var(--forest); }
.nav-icon { width: 20px; text-align: center; font-size: 17px; }
.sidebar-foot { margin: 12px; padding: 13px; border-radius: 11px; background: rgba(0,0,0,.13); display: flex; align-items: center; gap: 10px; }
.sidebar-foot strong, .sidebar-foot span { display: block; font-size: 11px; }
.sidebar-foot span { color: #8facA7; margin-top: 2px; }
.system-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(217,242,107,.13); }

.main { grid-column: 2; min-width: 0; }
.topbar {
  height: 76px; position: sticky; z-index: 20; top: 0; background: rgba(251,250,246,.94); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 15px; padding: 0 clamp(18px, 3vw, 38px);
}
.global-search { width: min(540px, 56vw); position: relative; }
.global-search input { background: #eeeee7; border-color: transparent; padding-left: 40px; padding-right: 58px; }
.search-icon { position: absolute; left: 14px; top: 9px; z-index: 1; font-size: 21px; }
kbd { position: absolute; right: 10px; top: 8px; padding: 4px 7px; border: 1px solid #d5d8d2; border-radius: 6px; color: #7e8987; background: #fafaf7; font-size: 10px; }
.search-results {
  position: absolute; top: 46px; left: 0; width: 100%; max-height: 420px; overflow: auto;
  border: 1px solid var(--line); border-radius: 13px; background: white; box-shadow: var(--shadow); padding: 8px;
}
.search-group-title { padding: 9px 10px 5px; color: #84918f; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.search-result { width: 100%; border: 0; background: transparent; padding: 10px; text-align: left; border-radius: 8px; }
.search-result:hover { background: #f2f5f2; }
.search-result strong, .search-result span { display: block; }
.search-result span { color: #73827f; font-size: 12px; margin-top: 2px; }
.top-action { margin-left: auto; width: 38px; height: 38px; border: 1px solid var(--line); background: white; border-radius: 50%; position: relative; color: var(--forest); font-weight: 900; }
.top-action b { position: absolute; top: -4px; right: -5px; min-width: 17px; height: 17px; padding: 2px; border-radius: 9px; background: var(--danger); color: white; font-size: 10px; }
.user-menu { position: relative; }
.user-button { display: flex; align-items: center; gap: 9px; border: 0; background: transparent; color: var(--ink); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--mint); color: var(--forest); display: grid; place-items: center; font-weight: 900; }
.user-copy { text-align: left; }
.user-copy strong, .user-copy small { display: block; }
.user-copy small { color: #748482; margin-top: 2px; }
.dropdown { position: absolute; right: 0; top: 48px; width: 190px; padding: 7px; background: white; border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); }
.dropdown button { width: 100%; border: 0; background: transparent; text-align: left; padding: 10px; border-radius: 7px; }
.dropdown button:hover { background: #f0f3ef; }

.content { padding: 30px clamp(18px, 3vw, 38px) 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 25px; }
.page-head h1 { margin: 5px 0 0; font-size: clamp(28px, 3vw, 40px); letter-spacing: -.045em; }
.page-head p { color: #6b7f7c; margin: 8px 0 0; max-width: 680px; }
.head-actions, .toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.toolbar { margin-bottom: 15px; justify-content: space-between; }
.toolbar .filters { display: flex; gap: 8px; flex: 1; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; min-width: 175px; background: white; }
.btn {
  border: 1px solid #cfdad6; background: white; color: var(--ink); padding: 10px 14px; border-radius: 9px;
  font-weight: 750; display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 12px rgba(20,43,43,.08); }
.btn.primary { background: var(--forest); border-color: var(--forest); color: white; }
.btn.accent { background: var(--lime); border-color: var(--lime); color: var(--forest); }
.btn.danger { color: #9f382c; border-color: #efc5bf; background: #fff5f3; }
.btn.small { padding: 7px 10px; font-size: 12px; }
.btn.full { width: 100%; margin-top: 24px; padding: 13px; }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: inherit; font-size: 22px; }
.icon-btn:hover { background: rgba(20,43,43,.07); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.kpi {
  background: white; border: 1px solid var(--line); border-radius: 14px; padding: 18px; min-height: 130px;
  display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
}
.kpi::after { content: ""; position: absolute; right: -20px; bottom: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--kpi-tint, #eef5f1); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; color: #71827f; font-weight: 700; }
.kpi-icon { width: 30px; height: 30px; border-radius: 9px; background: var(--kpi-tint, #eef5f1); display: grid; place-items: center; color: var(--forest); }
.kpi strong { font-size: 31px; letter-spacing: -.04em; position: relative; z-index: 1; }
.kpi small { color: #80908e; position: relative; z-index: 1; }
.kpi.warning { --kpi-tint: #fff0ce; }
.kpi.danger { --kpi-tint: #f9ddd7; }
.kpi.good { --kpi-tint: #dff2e9; }
.dashboard-grid { display: grid; grid-template-columns: 1.45fr .75fr; gap: 16px; margin-top: 16px; }
.panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #edf0ec; }
.panel-head h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.panel-body { padding: 20px; }
.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.quick-action { border: 1px solid var(--line); background: #fbfcfa; border-radius: 11px; padding: 14px; text-align: left; font-weight: 750; color: var(--ink); }
.quick-action span { display: block; color: var(--forest-2); font-size: 20px; margin-bottom: 7px; }
.quick-action:hover { border-color: var(--forest-2); background: var(--mint); }
.operation-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.operation-card {
  position: relative; min-height: 230px; padding: 24px; border: 1px solid var(--line); border-radius: 18px;
  background: white; color: var(--ink); text-align: left; display: flex; flex-direction: column; align-items: flex-start;
  transition: transform .18s, box-shadow .18s, border-color .18s; overflow: hidden;
}
.operation-card:hover { transform: translateY(-3px); border-color: #9bb7b1; box-shadow: var(--shadow); }
.operation-card.maintenance-action { background: var(--forest); color: white; border-color: var(--forest); }
.operation-card::after { content: ""; position: absolute; width: 150px; height: 150px; border-radius: 50%; background: rgba(21,61,59,.045); right: -65px; bottom: -70px; }
.operation-card.maintenance-action::after { background: rgba(217,242,107,.11); }
.operation-number { color: #81918e; font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.maintenance-action .operation-number { color: #9cb8b2; }
.operation-icon { width: 44px; height: 44px; display: grid; place-items: center; margin: 28px 0 18px; border-radius: 13px; background: var(--mint); color: var(--forest); font-size: 22px; }
.maintenance-action .operation-icon { background: var(--lime); }
.operation-card strong { font-size: 21px; letter-spacing: -.03em; }
.operation-card small { max-width: 270px; min-height: 40px; margin-top: 8px; color: #70817f; line-height: 1.5; }
.maintenance-action small { color: #b8cdc8; }
.operation-card b { margin-top: auto; color: var(--forest-2); }
.maintenance-action b { color: var(--lime); }
.status-line { display: flex; gap: 7px; flex-wrap: wrap; margin: 18px 0; }
.status-line span { padding: 8px 11px; border-radius: 20px; background: #ecefeB; color: #657572; font-size: 12px; }
.status-line span.attention { background: #fff0ce; color: #956006; }
.status-line b { color: var(--ink); }
.light-dashboard { grid-template-columns: 1.4fr .8fr; }
.full-row { grid-column: 1 / -1; }
.simple-alert-list { display: grid; gap: 13px; }
.simple-alert-list > div { display: flex; gap: 10px; align-items: flex-start; }
.simple-alert-list p, .simple-alert-list strong, .simple-alert-list small { display: block; margin: 0; }
.simple-alert-list small { color: #748480; margin-top: 3px; }
.alert-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--warning); flex: 0 0 auto; }
.alert-dot.critica { background: var(--danger); }
.calm-message { margin: 0; padding: 25px 5px; color: var(--success); text-align: center; }
.alert-vehicle-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 11px; }
.alert-vehicle-card { min-width: 0; padding: 15px; border: 1px solid #eadab5; border-radius: 13px; background: #fffbf1; color: var(--ink); text-align: left; transition: .18s; }
.alert-vehicle-card:hover { transform: translateY(-2px); border-color: var(--warning); box-shadow: 0 10px 22px rgba(94,72,25,.09); }
.alert-vehicle-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.alert-vehicle-head .plate { font-size: 17px; font-weight: 900; }
.alert-vehicle-card > small { display: block; min-height: 26px; margin-top: 3px; color: #7a827d; }
.alert-vehicle-card > strong { display: block; margin-top: 15px; font-size: 14px; }
.alert-vehicle-card > p { min-height: 34px; margin: 4px 0 13px; color: #6f7772; font-size: 12px; line-height: 1.4; }
.alert-vehicle-card > b { color: #8a620b; font-size: 11px; }
.alert-page-grid { margin-bottom: 16px; }
.plans-panel { margin-top: 16px; }
.chart { height: 220px; display: flex; align-items: flex-end; gap: 10px; padding: 25px 0 0; }
.chart-col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; min-width: 22px; }
.chart-bar { width: min(34px, 70%); min-height: 3px; border-radius: 7px 7px 2px 2px; background: linear-gradient(var(--forest-2), var(--forest)); position: relative; }
.chart-bar:hover::after { content: attr(data-value); position: absolute; top: -29px; left: 50%; transform: translateX(-50%); background: var(--ink); color: white; border-radius: 6px; padding: 4px 6px; font-size: 10px; white-space: nowrap; }
.chart-col small { color: #80908e; font-size: 9px; transform: rotate(-35deg); height: 20px; }

.table-wrap { background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.vehicle-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 13px; }
.vehicle-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: white; color: var(--ink); text-align: left; transition: .18s; }
.vehicle-card:hover { border-color: #95afa9; transform: translateY(-2px); box-shadow: 0 12px 28px rgba(20,43,43,.09); }
.vehicle-card-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.vehicle-card-top .plate { display: block; font-size: 19px; font-weight: 900; letter-spacing: .015em; }
.vehicle-card-top small { display: block; color: #6e7f7c; margin-top: 4px; line-height: 1.35; min-height: 35px; }
.vehicle-card-meta { display: flex; justify-content: space-between; gap: 10px; padding: 13px 0; margin: 13px 0; border-top: 1px solid #edf0ed; border-bottom: 1px solid #edf0ed; color: #5f716e; font-size: 12px; }
.last-maintenance > span { display: block; color: #8a9795; font-size: 9px; font-weight: 900; letter-spacing: .11em; }
.last-maintenance strong { display: block; margin-top: 7px; font-size: 13px; }
.last-maintenance p { height: 34px; margin: 4px 0 15px; overflow: hidden; color: #73827f; font-size: 12px; line-height: 1.4; }
.card-link { color: var(--forest-2); font-size: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { padding: 12px 15px; background: #f5f6f2; color: #71817f; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; text-align: left; white-space: nowrap; }
td { padding: 13px 15px; border-top: 1px solid #edf0ed; vertical-align: middle; }
tbody tr { transition: .15s; }
tbody tr.clickable:hover { background: #f6faf7; cursor: pointer; }
.cell-title { font-weight: 800; }
.cell-sub { display: block; color: #758481; font-size: 12px; margin-top: 3px; }
.location-code { display: inline-flex; padding: 4px 7px; border-radius: 6px; background: #e1f1eb; color: var(--forest); font-size: 12px; font-weight: 900; letter-spacing: .045em; white-space: nowrap; }
.warehouse-shelves, .all-parts-section { margin-bottom: 28px; }
.warehouse-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 13px; }
.warehouse-section-head h2 { margin: 4px 0 3px; font-size: 23px; letter-spacing: -.025em; }
.warehouse-section-head p { margin: 0; color: #758481; font-size: 13px; }
.section-count { min-width: 38px; height: 30px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 16px; background: #e8eeea; color: var(--forest); font-size: 12px; font-weight: 900; }
.shelf-strip { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 11px; }
.shelf-card { min-height: 172px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--ink); text-align: left; transition: .18s; }
.shelf-card:hover, .shelf-card.active { border-color: #78a299; transform: translateY(-2px); box-shadow: 0 10px 24px rgba(20,43,43,.09); }
.shelf-card.active { background: #f2f9f5; box-shadow: inset 0 0 0 1px var(--forest-2); }
.shelf-visual { width: 42px; height: 42px; padding: 7px 6px; display: grid; gap: 4px; margin-bottom: 15px; border-radius: 10px; background: var(--mint); }
.shelf-visual i { display: block; border: 2px solid var(--forest); border-top: 0; }
.shelf-card-code { display: block; color: #748480; font-size: 9px; font-weight: 900; letter-spacing: .11em; }
.shelf-card strong, .shelf-card small, .shelf-card b { display: block; }
.shelf-card strong { margin-top: 4px; font-size: 16px; }
.shelf-card small { min-height: 30px; margin-top: 5px; color: #748480; line-height: 1.35; }
.shelf-card b { margin-top: 11px; color: var(--forest-2); font-size: 11px; }
.shelf-card.unassigned .shelf-visual { background: #f2eee2; }
.shelf-card.unassigned .shelf-visual i { border-color: #8b7548; }
.add-shelf-card { display: grid; align-content: center; justify-items: center; border-style: dashed; color: var(--forest-2); text-align: center; }
.add-shelf-card > span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--mint); font-size: 22px; }
.add-shelf-card strong { margin-top: 10px; }
.shelf-empty { padding: 25px; border: 1px dashed var(--line); border-radius: 13px; color: #748480; text-align: center; }
.shelf-detail { margin-top: 13px; padding: 18px; border: 1px solid #9eb7b1; border-radius: 14px; background: #f4f9f6; }
.shelf-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 14px; border-bottom: 1px solid #d9e5e0; }
.shelf-detail-head h3 { margin: 7px 0 3px; font-size: 21px; }
.shelf-detail-head p { margin: 0; color: #71817f; font-size: 12px; }
.shelf-content-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(190px,1fr)); gap: 9px; margin-top: 14px; }
.shelf-part-card { min-height: 126px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--ink); text-align: left; }
.shelf-part-card:hover { border-color: var(--forest-2); }
.shelf-part-card span, .shelf-part-card strong, .shelf-part-card b, .shelf-part-card small { display: block; }
.shelf-part-card span { color: #778683; font-size: 10px; font-weight: 900; letter-spacing: .06em; }
.shelf-part-card strong { min-height: 34px; margin: 5px 0 9px; }
.shelf-part-card b { color: var(--forest); font-size: 15px; }
.shelf-part-card small { margin-top: 7px; color: var(--forest-2); }
.danger-outline { color: var(--danger); border-color: #e5b8b1; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 20px; background: #edf1ee; color: #50635f; font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.operativo, .badge.chiusa, .badge.ricevuto, .badge.risolto { color: #21725a; background: #e0f2e9; }
.badge.in-manutenzione, .badge.in-lavorazione, .badge.parzialmente-ricevuto, .badge.alta { color: #a36b05; background: #fff0ce; }
.badge.fermo, .badge.critica, .badge.urgente, .badge.scaduta { color: #ad3e31; background: #fbe2dd; }
.badge.programmata, .badge.approvato { color: #356785; background: #e3eef5; }
.empty-state { text-align: center; padding: 65px 20px; color: #748481; }
.empty-icon { width: 62px; height: 62px; margin: 0 auto 15px; display: grid; place-items: center; border-radius: 18px; background: var(--mint); color: var(--forest); font-size: 28px; }
.empty-state h3 { color: var(--ink); margin: 0 0 7px; }
.empty-state p { margin: 0 auto 18px; max-width: 440px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; padding: 24px; background: rgba(12,35,34,.63); display: grid; place-items: center; backdrop-filter: blur(3px); }
.modal-card { width: min(850px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--paper); border-radius: 19px; box-shadow: 0 30px 90px rgba(0,0,0,.3); }
.modal-card > header { padding: 21px 24px; display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 1px solid var(--line); }
.modal-card h2 { margin: 5px 0 0; font-size: 25px; letter-spacing: -.035em; }
.modal-body { padding: 24px; overflow-y: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.field-help { display: block; margin-top: 5px; color: #758481; font-size: 11px; font-weight: 500; }
.inline-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.location-guide { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; padding: 13px 15px; border-radius: 11px; background: var(--mint); }
.location-guide strong { color: var(--forest); white-space: nowrap; }
.location-guide span { color: #61746f; font-size: 12px; }
.compact-form { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.locations-table { max-height: 330px; }
.locations-table table { min-width: 700px; }
.large-textarea { min-height: 180px; font-size: 15px; line-height: 1.55; }
.optional-fields { border: 1px solid var(--line); border-radius: 11px; background: #f7f8f4; }
.optional-fields summary { padding: 13px 15px; cursor: pointer; font-weight: 800; }
.optional-fields summary span { color: #85918f; font-size: 11px; font-weight: 500; margin-left: 5px; }
.optional-fields > .form-grid { padding: 3px 15px 15px; }
.rule-block { padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #f7f8f4; }
.rule-block > .form-grid { margin-top: 10px; grid-template-columns: repeat(3,minmax(0,1fr)); }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.choice-card { min-height: 190px; padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--ink); text-align: left; }
.choice-card:hover { border-color: var(--forest-2); background: #f5faf7; }
.choice-card span, .choice-card strong, .choice-card small { display: block; }
.choice-card span { width: 40px; height: 40px; display: grid; place-items: center; margin-bottom: 25px; border-radius: 11px; background: var(--mint); font-size: 20px; }
.choice-card strong { font-size: 17px; }
.choice-card small { color: #73827f; margin-top: 7px; line-height: 1.45; }
.upload-zone { padding: 28px; border: 1px dashed #9fb4af; border-radius: 14px; background: #f5faf7; text-align: center; }
.upload-zone span, .upload-zone strong { display: block; }
.upload-zone span { color: var(--forest-2); font-size: 30px; }
.upload-zone strong { margin: 8px 0 4px; font-size: 17px; }
.upload-zone p { color: #748480; margin: 0 0 16px; }
.document-found { display: flex; align-items: center; gap: 12px; padding: 13px; border-radius: 11px; background: var(--mint); }
.document-found > span { font-size: 24px; }
.document-found p, .document-found strong, .document-found small { display: block; margin: 0; }
.document-found small { color: #61746f; margin-top: 3px; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 9px; padding-top: 10px; border-top: 1px solid var(--line); }
.detail-hero { padding: 22px; border-radius: 14px; background: var(--forest); color: white; display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.detail-hero h3 { margin: 5px 0; font-size: 27px; letter-spacing: -.04em; }
.detail-hero p { margin: 0; color: #b9cfca; }
.detail-hero .badge { background: rgba(255,255,255,.12); color: var(--lime); }
.detail-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin: 14px 0; }
.mini-stat { padding: 13px; background: white; border: 1px solid var(--line); border-radius: 11px; }
.mini-stat span, .mini-stat strong { display: block; }
.mini-stat span { color: #7c8b89; font-size: 11px; }
.mini-stat strong { font-size: 18px; margin-top: 4px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 22px 0 15px; overflow-x: auto; }
.tab { border: 0; background: transparent; color: #6c7e7b; padding: 10px 12px; font-weight: 750; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--forest); border-bottom-color: var(--forest); }
.timeline { position: relative; padding-left: 23px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 5px; bottom: 5px; width: 1px; background: #ccd8d4; }
.timeline-item { position: relative; padding: 0 0 18px; }
.timeline-item::before { content: ""; position: absolute; left: -21px; top: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--forest-2); border: 3px solid white; box-shadow: 0 0 0 1px var(--forest-2); }
.timeline-item strong, .timeline-item span { display: block; }
.timeline-item span { color: #71827f; margin-top: 3px; font-size: 12px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 10px; }
.section-title h3 { margin: 0; }
.info-list { display: grid; gap: 1px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.info-row { display: flex; justify-content: space-between; gap: 20px; padding: 11px 13px; background: white; }
.info-row span { color: #71817f; }
.info-row strong { text-align: right; }
.api-endpoint { display: grid; grid-template-columns: 70px 1fr; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding: 12px 0; }
.api-method { padding: 6px; border-radius: 6px; text-align: center; font-size: 11px; font-weight: 900; background: #dff0e8; color: #256b55; }
.api-method.post { background: #e5eef5; color: #326582; }
.mileage-api-card, .api-keys-panel { margin-bottom: 16px; }
.mileage-api-card pre { overflow: auto; margin: 15px 0 0; padding: 16px; border-radius: 11px; background: #102a2b; color: #d7eee7; line-height: 1.55; }
.api-key-reveal { text-align: center; }
.api-key-reveal code { display: block; overflow-wrap: anywhere; margin: 18px 0; padding: 16px; border-radius: 10px; background: #102a2b; color: var(--lime); font-size: 15px; }
.vehicle-settings-panel { margin-bottom: 16px; }
.vehicle-settings-panel .panel-head { align-items: center; }
.vehicle-settings-panel .panel-head p { margin: 6px 0 0; }
.vehicle-setting-count { min-width: 110px; padding: 12px 16px; border-radius: 12px; background: var(--mint); text-align: center; }
.vehicle-setting-count strong, .vehicle-setting-count span { display: block; }
.vehicle-setting-count strong { color: var(--forest); font-size: 27px; line-height: 1; }
.vehicle-setting-count span { color: #58716d; font-size: 11px; margin-top: 5px; }
.settings-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.settings-toolbar input { max-width: 390px; }
.settings-table { border: 0; border-radius: 0; max-height: 590px; }
.settings-table thead { position: sticky; top: 0; z-index: 2; }
.settings-secondary { margin-top: 16px; }
.toggle-switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.toggle-switch input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-slider { width: 46px; height: 25px; border-radius: 20px; background: #c9d2cf; position: relative; transition: .2s; box-shadow: inset 0 0 0 1px rgba(20,43,43,.08); }
.toggle-slider::after { content: ""; position: absolute; width: 19px; height: 19px; top: 3px; left: 3px; border-radius: 50%; background: white; box-shadow: 0 2px 5px rgba(0,0,0,.22); transition: .2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--forest-2); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(21px); }
.toggle-switch input:focus-visible + .toggle-slider { outline: 3px solid rgba(36,91,85,.2); outline-offset: 2px; }
.toggle-switch input:disabled + .toggle-slider { opacity: .5; cursor: not-allowed; }
.toggle-switch b { width: 26px; color: #6c7d7a; font-size: 11px; }
.toggle-switch:has(input:checked) b { color: var(--success); }
.delete-row { width: 31px; height: 31px; border: 0; border-radius: 8px; background: transparent; color: #9baaa7; font-size: 22px; line-height: 1; }
.delete-row:hover { background: #fde7e2; color: var(--danger); }
.admin-links { display: grid; gap: 3px; }
.admin-links button { width: 100%; display: flex; justify-content: space-between; border: 0; border-radius: 8px; background: transparent; padding: 11px; color: var(--ink); text-align: left; font-weight: 700; }
.admin-links button:hover { background: #eef3ef; }
.alert-help { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; padding: 14px 17px; border-radius: 13px; background: var(--mint); }
.alert-help b { font-size: 24px; }
.alert-help span { font-weight: 800; }
.alert-help p { margin: 0 0 0 auto; color: #5e716d; }
.operation-grid.compact { grid-template-columns: 1.15fr 1fr; }
.dashboard-briefing { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; margin: 0 0 16px; }
.dashboard-briefing > article { padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.dashboard-briefing header { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 11px; }
.dashboard-briefing h2 { margin: 3px 0 0; font-size: 17px; }
.fleet-health-strip > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.health-vehicle-row { min-width: 0; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 9px; padding: 10px; border: 1px solid #e3e9e5; border-radius: 9px; background: #fafbf8; color: var(--ink); text-align: left; }
.health-vehicle-row:hover { border-color: #87a9a0; background: #f2f8f4; }
.health-vehicle-row b { color: #6c7d79; font-size: 10px; }
.briefing-notes > div { display: grid; gap: 7px; }
.briefing-note { min-width: 0; display: flex; align-items: flex-start; gap: 9px; padding: 8px; border: 0; border-radius: 9px; background: #f7f8f5; color: var(--ink); text-align: left; }
.briefing-note > span:last-child { min-width: 0; }
.briefing-note strong, .briefing-note small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.briefing-note small { margin-top: 3px; color: #71817e; }
.vehicle-health-line { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 9px; margin-top: 14px; padding: 9px 10px; border-radius: 9px; background: #f5f7f4; }
.vehicle-health-line > span:first-child { color: #80908c; font-size: 9px; font-weight: 900; letter-spacing: .08em; }
.vehicle-health-line > b { color: #657773; font-size: 10px; }
.health-dots { display: inline-flex; gap: 5px; }
.health-dots i, .health-indicators i { display: block; width: 10px; height: 10px; border-radius: 50%; background: #c9d1cf; box-shadow: inset 0 0 0 1px rgba(20,43,43,.08); }
.health-dots.compact i { width: 9px; height: 9px; }
.health-dots i.verde, .health-indicators i.verde { background: #32a778; }
.health-dots i.giallo, .health-indicators i.giallo { background: #e4ad37; }
.health-dots i.rosso, .health-indicators i.rosso { background: #d75848; }
.vehicle-health-panel { display: grid; grid-template-columns: 170px 1fr; gap: 18px; padding: 18px; border: 1px solid #c9ddd5; border-radius: 14px; background: #f3faf6; }
.vehicle-health-panel.giallo { border-color: #e8d09b; background: #fffaf0; }
.vehicle-health-panel.rosso { border-color: #e8bbb3; background: #fff5f3; }
.health-score { padding-right: 18px; border-right: 1px solid rgba(25,63,57,.12); }
.health-score span, .health-score b { display: block; }
.health-score span { color: #72817f; font-size: 9px; font-weight: 900; letter-spacing: .1em; }
.health-score strong { display: block; margin: 7px 0 3px; color: var(--forest); font-size: 42px; line-height: 1; letter-spacing: -.06em; }
.health-score strong small { color: #71817e; font-size: 13px; letter-spacing: 0; }
.health-score b { color: #3f635b; font-size: 11px; }
.health-indicators { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 7px; }
.health-indicators article { min-width: 0; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.72); }
.health-indicators i { width: 13px; height: 13px; margin-bottom: 9px; }
.health-indicators strong, .health-indicators small { display: block; }
.health-indicators strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; }
.health-indicators small { margin-top: 3px; color: #71817e; font-size: 10px; }
.health-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.health-detail-grid > article { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.health-detail-grid header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.health-detail-grid h3 { margin: 0; font-size: 14px; }
.health-detail-grid header > span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; background: #edf1ee; font-size: 10px; font-weight: 900; }
.health-detail-grid > article > p { margin: 17px 0; color: #71817e; text-align: center; font-size: 12px; }
.health-detail-row { display: flex; align-items: flex-start; gap: 8px; padding: 9px 0; border-top: 1px solid #edf0ed; }
.health-detail-row > span:last-child { min-width: 0; }
.health-detail-row strong, .health-detail-row small { display: block; }
.health-detail-row strong { font-size: 12px; }
.health-detail-row small { margin-top: 2px; color: #71817e; font-size: 10px; }
.planning-week { display: grid; grid-template-columns: repeat(7,minmax(120px,1fr)); gap: 8px; margin-bottom: 16px; overflow-x: auto; padding-bottom: 3px; }
.planning-day { min-height: 210px; border: 1px solid var(--line); border-radius: 12px; background: white; overflow: hidden; }
.planning-day.today { border-color: var(--forest-2); box-shadow: inset 0 3px 0 var(--lime); }
.planning-day > header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: #f4f6f2; }
.planning-day > header span { color: #71817e; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.planning-day > header strong { font-size: 17px; }
.planning-day > div { display: grid; gap: 6px; padding: 8px; }
.planning-day > div > p { margin: 45px 0; color: #98a39f; text-align: center; font-size: 11px; }
.planning-event { min-width: 0; display: block; width: 100%; padding: 8px; border: 0; border-left: 3px solid var(--forest-2); border-radius: 7px; background: #eef6f2; color: var(--ink); text-align: left; }
.planning-event span, .planning-event strong, .planning-event small { display: block; }
.planning-event span { color: #5f7771; font-size: 8px; font-weight: 900; letter-spacing: .08em; }
.planning-event strong { margin-top: 3px; font-size: 11px; line-height: 1.3; }
.planning-event small { margin-top: 3px; color: #71817e; font-size: 9px; }
.planning-event.critical { border-color: #cb4f42; background: #fdecea; }
.planning-event.deadline { border-color: #d29c29; background: #fff5dc; }
.planning-event.tire { border-color: #497d9d; background: #edf5f9; }
.planning-overdue { margin-bottom: 16px; }
.planning-list { display: grid; gap: 8px; }
.planning-row { display: grid; grid-template-columns: 105px 1fr; align-items: center; gap: 10px; }
.planning-row time { color: #71817e; font-size: 11px; font-weight: 800; }
.communication-summary { display: grid; grid-template-columns: auto auto 1fr; align-items: baseline; gap: 9px; margin-bottom: 16px; padding: 14px 17px; border-radius: 12px; background: var(--forest); color: white; }
.communication-summary strong { color: var(--lime); font-size: 28px; }
.communication-summary span { font-weight: 800; }
.communication-summary p { margin: 0 0 0 auto; color: #b8ceca; font-size: 12px; }
.communication-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(310px,1fr)); gap: 11px; }
.communication-card { padding: 16px; border: 1px solid var(--line); border-top: 4px solid #7da297; border-radius: 12px; background: white; }
.communication-card.alta { border-top-color: #d5a02d; }
.communication-card.urgente { border-top-color: #cf5144; }
.communication-card.risolta { opacity: .65; }
.communication-card header, .communication-card footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.communication-card header > div { display: flex; gap: 6px; }
.communication-card time { color: #7a8986; font-size: 10px; }
.communication-card h3 { margin: 15px 0 6px; font-size: 17px; }
.communication-card p { min-height: 42px; margin: 0 0 16px; color: #5f716d; line-height: 1.45; }
.communication-card footer { padding-top: 11px; border-top: 1px solid #edf0ed; color: #71817e; font-size: 10px; }
.tire-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 16px; }
.tire-summary > div { padding: 15px; border-radius: 12px; background: var(--forest); color: white; }
.tire-summary span, .tire-summary strong { display: block; }
.tire-summary span { color: #b9ceca; font-size: 10px; }
.tire-summary strong { margin-top: 5px; color: var(--lime); font-size: 25px; }
.tire-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(260px,1fr)); gap: 11px; }
.tire-card { padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.tire-card header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.tire-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #172f30; color: white; font-size: 21px; }
.tire-card h3 { margin: 5px 0; font-size: 20px; }
.tire-card > p { min-height: 19px; margin: 0; color: #71817e; }
.tire-facts { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; margin: 14px 0; }
.tire-facts span { padding: 8px 5px; border-radius: 7px; background: #f4f6f3; color: #71817e; font-size: 9px; text-align: center; }
.tire-facts b { display: block; color: var(--ink); font-size: 12px; }
.tire-destination { padding: 10px; border-left: 3px solid var(--forest-2); background: #f3f8f5; }
.tire-destination strong, .tire-destination small { display: block; }
.tire-destination small { margin-top: 3px; color: #71817e; }
.tire-due { margin-top: 10px; padding: 8px; border-radius: 7px; background: #fff3d7; color: #8e6615; font-size: 10px; font-weight: 800; }
.quick-parts-block { padding: 14px; border: 1px solid #bdd8ce; border-radius: 11px; background: #f0f8f4; }
.quick-parts-block > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.quick-parts-block strong, .quick-parts-block small { display: block; }
.quick-parts-block small { margin-top: 3px; color: #657873; }
.maintenance-parts-inline { display: grid; grid-template-columns: minmax(220px,1fr) 120px 34px; align-items: center; gap: 8px; margin-top: 7px; }
.time-entry-list { display: grid; gap: 8px; }
.time-entry-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: white; }
.time-entry-row strong, .time-entry-row span { display: block; }
.time-entry-row span { margin-top: 3px; color: #71817e; font-size: 11px; }
.time-entry-row b { color: var(--forest-2); font-size: 11px; }
.time-entry-row.running { border-color: #9fc7ba; background: #eff9f4; }
.time-entry-row.running b { color: #21815f; }
.timer-start { color: #17684f; border-color: #9ccbbb; }
.timer-stop { color: #a64035; border-color: #e2afa7; }
.toast-region { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: grid; gap: 9px; }
.toast { min-width: 270px; max-width: 380px; padding: 13px 15px; border-radius: 11px; background: var(--ink); color: white; box-shadow: var(--shadow); animation: toast-in .25s ease-out; }
.toast.error { background: #9e3c31; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }
.page-loader { min-height: 45vh; display: grid; place-items: center; align-content: center; color: #71817f; }
.page-loader span { width: 32px; height: 32px; border: 3px solid #d6dfdc; border-top-color: var(--forest); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1120px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .vehicle-card-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .alert-vehicle-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-briefing { grid-template-columns: 1fr; }
  .health-indicators { grid-template-columns: repeat(3,minmax(0,1fr)); }
}

@media (max-width: 820px) {
  .mobile-only { display: inline-grid; place-items: center; }
  .login-screen { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .login-panel { min-height: 100vh; }
  .app-shell { display: block; }
  .sidebar { transform: translateX(-102%); transition: .22s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-head .mobile-only { margin-left: auto; color: white; }
  .main { width: 100%; }
  .topbar { height: 66px; padding: 0 13px; }
  .global-search { width: auto; flex: 1; }
  kbd, .user-copy { display: none; }
  .content { padding: 22px 14px 45px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi { min-height: 112px; padding: 14px; }
  .kpi strong { font-size: 25px; }
  .form-grid, .split { grid-template-columns: 1fr; }
  .operation-grid { grid-template-columns: 1fr; }
  .operation-grid.compact { grid-template-columns: 1fr; }
  .operation-card { min-height: 190px; }
  .operation-icon { margin: 18px 0 12px; }
  .vehicle-card-grid { grid-template-columns: 1fr; }
  .choice-grid { grid-template-columns: 1fr; }
  .alert-vehicle-grid { grid-template-columns: 1fr; }
  .rule-block > .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .form-actions { grid-column: auto; }
  .detail-stats { grid-template-columns: repeat(2, 1fr); }
  .settings-toolbar { align-items: stretch; flex-direction: column; }
  .settings-toolbar input { max-width: none; }
  .alert-help { align-items: flex-start; flex-wrap: wrap; }
  .alert-help p { width: 100%; margin: 0; }
  .fleet-health-strip > div, .health-detail-grid { grid-template-columns: 1fr; }
  .vehicle-health-panel { grid-template-columns: 1fr; }
  .health-score { padding: 0 0 13px; border-right: 0; border-bottom: 1px solid rgba(25,63,57,.12); }
  .health-indicators { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .communication-summary { grid-template-columns: auto 1fr; }
  .communication-summary p { grid-column: 1/-1; margin: 0; }
  .quick-parts-block > header { align-items: flex-start; flex-direction: column; }
  .maintenance-parts-inline { grid-template-columns: 1fr 90px 34px; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal-card { max-height: 94vh; border-radius: 19px 19px 0 0; }
}

@media (max-width: 470px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: 1fr; }
  .top-action { display: none; }
  .login-card { padding: 28px 22px; }
}
