:root {
  --green: #08752a;
  --green-dark: #00561d;
  --green-soft: #e8f4ec;
  --orange: #f39a00;
  --orange-dark: #d98200;
  --bg: #f4f5f1;
  --card: #ffffff;
  --text: #263228;
  --muted: #687468;
  --border: #dbe3db;
  --danger: #b42318;
  --warning: #a15c00;
  --success: #08752a;
  --shadow: 0 16px 40px rgba(8, 117, 42, .10);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(243,154,0,.12), transparent 30rem),
    linear-gradient(180deg, #fbfcfa 0%, var(--bg) 100%);
}
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.auth-body {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
}
.auth-hero {
  position: relative;
  display: flex;
  align-items: center;
  padding: 64px;
  color: white;
  overflow: hidden;
  background:
    linear-gradient(115deg, rgba(0,86,29,.96), rgba(8,117,42,.84)),
    url('/img/icon.svg') center/420px no-repeat;
}
.auth-hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -40px -10%;
  height: 150px;
  background: var(--orange);
  transform: rotate(-3deg);
}
.auth-hero-content { position: relative; max-width: 680px; z-index: 2; }
.auth-hero img {
  width: clamp(190px, 27vw, 300px);
  height: auto;
  display: block;
  object-fit: contain;
  background: transparent;
  border-radius: 22px;
  padding: 0;
  margin-bottom: 30px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, .18);
}
.auth-hero h1 { font-size: clamp(34px, 5vw, 62px); margin: 0 0 18px; line-height: 1.02; }
.auth-hero p { max-width: 620px; font-size: 18px; line-height: 1.45; opacity: .94; }
.auth-panel {
  display: grid;
  place-items: center;
  padding: 28px;
}
.login-card, .card, .metric, .modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.login-card { width: min(100%, 440px); padding: 30px; }
.logo-mini {
  width: 160px;
  height: 160px;
  display: block;
  object-fit: contain;
  border-radius: 18px;
  margin: 0 auto 20px;
}
.field { display: grid; gap: 8px; margin-bottom: 14px; }
.field label { font-weight: 700; font-size: 13px; color: var(--green-dark); }
.field input, .field select {
  border: 1px solid var(--border);
  background: #fbfcfa;
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}
.field input:focus, .field select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(8,117,42,.12);
}
.btn {
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  font-weight: 800;
  transition: .2s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--green); color: white; }
.btn-primary:hover { background: var(--green-dark); }
.btn-secondary { background: var(--green-soft); color: var(--green-dark); }
.btn-orange { background: var(--orange); color: white; }
.btn-danger { background: #fee4e2; color: var(--danger); }
.w-full { width: 100%; }

.app-shell { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, var(--green-dark), var(--green));
  color: white;
  padding: 24px 18px;
  overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px 22px;
  border-bottom: 1px solid rgba(255,255,255,.18);
  margin-bottom: 18px;
}
.sidebar .brand img { width: 116px; background: white; padding: 5px 10px; border-radius: 12px; }
.menu { display: grid; gap: 7px; }
.menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: 14px;
  color: rgba(255,255,255,.88);
  font-weight: 700;
}
.menu a:hover, .menu a.active { background: rgba(255,255,255,.16); color: white; }
.menu .admin-only.hidden { display: none; }
.sidebar-footer {
  margin-top: 22px; padding: 16px 10px 0;
  border-top: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.82);
  font-size: 13px;
}
.content { padding: 26px; min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  margin-bottom: 22px;
}
.page-title h1 { margin: 0; font-size: 28px; color: var(--green-dark); }
.page-title p { margin: 5px 0 0; color: var(--muted); }
.user-pill {
  display: flex; align-items: center; gap: 10px;
  background: white; border: 1px solid var(--border); border-radius: 999px;
  padding: 9px 12px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--orange); color: white; font-weight: 900;
}
.grid { display: grid; gap: 16px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric { padding: 18px; }
.metric span { color: var(--muted); font-size: 13px; font-weight: 700; }
.metric strong { display: block; color: var(--green-dark); font-size: 28px; margin-top: 8px; }
.card { padding: 18px; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 14px; }
.card-header h2 { margin: 0; color: var(--green-dark); font-size: 18px; }
.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  align-items: end;
}
.filters .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; min-width: 900px; background: white; }
th, td { padding: 12px 13px; border-bottom: 1px solid #edf1ed; text-align: left; font-size: 13px; white-space: nowrap; }
th { color: var(--green-dark); background: #f7fbf8; position: sticky; top: 0; z-index: 1; }
tr:hover td { background: #fbfdfb; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 64px; padding: 5px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 800;
}
.badge.ok, .badge.bom { background: #dcfae6; color: #067647; }
.badge.alerta, .badge.regular { background: #fef0c7; color: #93370d; }
.badge.inconsistente, .badge.ruim { background: #fee4e2; color: #b42318; }
.badge.pendente { background: #eef4ff; color: #3538cd; }
.badge.vistoria { background: #f3e8ff; color: #6b21a8; }
.badge.sem-km, .badge.sem-meta { background: #fff1d6; color: #9a4d00; }
.badge.horimetro { background:#e8f1ff; color:#175cd3; }
.badge.sem-metodo { background:#f2f4f7; color:#475467; }
.notice { padding: 12px 14px; border-radius: 14px; margin: 12px 0; display: none; }
.notice.show { display: block; }
.notice.error { background: #fee4e2; color: #b42318; }
.notice.success { background: #dcfae6; color: #067647; }
.notice.info { background: #eff8ff; color: #175cd3; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 170px 1fr 90px; gap: 10px; align-items: center; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-weight: 700; }
.bar-track { height: 14px; border-radius: 999px; background: #e8eee9; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--green), var(--orange)); min-width: 2px; }
.empty { padding: 20px; color: var(--muted); text-align: center; }

@media (max-width: 1100px) {
  .auth-body { grid-template-columns: 1fr; }
  .auth-hero { min-height: 360px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .content { padding: 16px; }
  .metrics { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .auth-hero {
  padding: 32px 24px;
}

.auth-hero img {
  width: 180px;
  margin-bottom: 22px;
}

.logo-mini {
  width: 132px;
  height: 132px;
}
}

/* =========================
   DASHBOARD INTERATIVO
========================= */
.dashboard-filter-card {
  margin-bottom: 16px;
  background:
    linear-gradient(135deg, rgba(8,117,42,.045), rgba(243,154,0,.045)),
    var(--card);
}
.dashboard-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 14px;
}
.dashboard-filter-header h2 {
  margin: 0;
  color: var(--green-dark);
  font-size: 18px;
}
.dashboard-filter-header p,
.dashboard-chart-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.dashboard-filters {
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
}
.dashboard-filter-actions {
  align-self: end;
  padding-bottom: 14px;
}
.filter-summary {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}
.filter-chip {
  border: 1px solid rgba(8,117,42,.2);
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green-dark);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}
.filter-chip:hover {
  border-color: var(--green);
  transform: translateY(-1px);
}
.filter-chip span {
  margin-left: 4px;
  font-size: 15px;
}
.dashboard-metrics {
  margin-bottom: 16px;
}
.dashboard-metric {
  position: relative;
  overflow: hidden;
  min-height: 138px;
}
.dashboard-metric::after {
  content: "";
  position: absolute;
  width: 76px;
  height: 76px;
  right: -24px;
  bottom: -30px;
  border-radius: 50%;
  background: rgba(8,117,42,.07);
}
.dashboard-metric-featured {
  background:
    linear-gradient(145deg, rgba(8,117,42,.09), rgba(243,154,0,.10)),
    var(--card);
  border-color: rgba(8,117,42,.25);
}
.metric-top {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.metric-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green-dark);
}
.dashboard-metric strong {
  font-size: clamp(22px, 2vw, 29px);
}
.dashboard-metric small {
  color: var(--muted);
}
.metric-statuses {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 5px;
}
.mini-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 10px;
  font-weight: 800;
}
.mini-status.ruim { background: #fee4e2; color: #b42318; }
.mini-status.regular { background: #fef0c7; color: #93370d; }
.mini-status.bom { background: #dcfae6; color: #067647; }
.mini-status.vistoria { background: #f3e8ff; color: #6b21a8; }
.mini-status.sem-dados { background:#fff1d6; color:#9a4d00; }
.badge.sem-dados { background:#fff1d6; color:#9a4d00; }
.metric-statuses button.mini-status { border:0; cursor:pointer; transition:.15s ease; }
.metric-statuses button.mini-status:hover, .metric-statuses button.mini-status:focus-visible { transform:translateY(-1px); box-shadow:0 0 0 2px rgba(8,117,42,.18); outline:none; }

.km-chart { display: grid; gap: 7px; min-height: 160px; }
.km-chart-row { display: grid; grid-template-columns: minmax(180px,1fr) minmax(220px,2fr) 100px 90px; align-items:center; gap:12px; width:100%; padding:9px; border:1px solid transparent; border-radius:12px; background:transparent; text-align:left; }
.km-chart-row:hover { border-color:var(--border); background:#f8fbf8; }
.km-chart-row > span:first-child { display:grid; min-width:0; }
.km-chart-row small { color:var(--muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.km-chart-row em { font-style:normal; font-weight:800; text-align:right; }
.km-track { position:relative; height:13px; border-radius:999px; background:#e8eee9; }
.km-track i { display:block; height:100%; border-radius:inherit; background:var(--green); }
.km-track i.ruim { background:#d92d20; }.km-track i.regular { background:#f79009; }.km-track i.vistoria { background:#7f56d9; }
.km-track b { position:absolute; top:-4px; width:3px; height:21px; background:var(--orange-dark); border-radius:3px; }
.km-pendente, .km-row-pendente { background:#fff8eb; box-shadow:inset 4px 0 0 #f79009; }
.pagination-controls { display:flex; align-items:center; justify-content:flex-end; gap:8px; flex-wrap:wrap; }
.pagination-controls span { display:grid; min-width:76px; text-align:center; color:var(--green-dark); font-weight:800; font-size:12px; }
.pagination-controls small { color:var(--muted); font-weight:600; }
.pagination-controls .btn-page { padding:6px 10px; border-radius:9px; font-size:18px; line-height:1; }
.km-summary-chart { min-height:240px; display:flex; align-items:center; justify-content:center; gap:24px; }
.km-donut { width:150px; height:150px; flex:0 0 150px; border-radius:50%; display:grid; place-items:center; position:relative; }
.km-donut::after { content:""; position:absolute; inset:28px; background:var(--card); border-radius:50%; }
.km-donut span { position:relative; z-index:1; display:grid; text-align:center; }
.km-donut strong { font-size:26px; color:var(--green-dark); }.km-donut small { color:var(--muted); }
.km-chart-legend { display:grid; gap:7px; min-width:170px; }.km-chart-legend span { display:grid; grid-template-columns:10px 1fr auto; align-items:center; gap:8px; font-size:12px; }.km-chart-legend i { width:10px; height:10px; border-radius:50%; }
.km-deviation-list { display:grid; gap:7px; width:100%; }.km-deviation-row { display:grid; grid-template-columns:minmax(110px,1fr) minmax(120px,2fr) 65px; gap:9px; align-items:center; font-size:11px; }.km-deviation-row>span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:700; }.km-deviation-row>div { height:10px; background:#edf1ed; border-radius:999px; overflow:hidden; }.km-deviation-row i { display:block; height:100%; border-radius:inherit; }.km-deviation-row i.negative { background:#d92d20; }.km-deviation-row i.positive { background:#079455; }.km-deviation-row strong { text-align:right; }
.classification-dialog { width:min(1180px,calc(100% - 28px)); max-width:none; padding:0; border:0; border-radius:18px; background:transparent; }
.classification-dialog::backdrop { background:rgba(20,31,23,.62); backdrop-filter:blur(2px); }
.classification-modal-card { max-height:85vh; overflow:auto; padding:20px; }
.classification-modal-card>p { margin-top:-5px; }
.classification-modal-card small { color:var(--muted); }
.column-filter-row th { padding:6px; background:#f8faf8; }
.column-filter-row input, .column-filter-row select { width:100%; min-width:82px; padding:7px 8px; border:1px solid var(--border); border-radius:8px; background:#fff; color:var(--text); font:inherit; font-size:11px; }
.column-filter-row input:focus, .column-filter-row select:focus { outline:2px solid rgba(8,117,42,.18); border-color:var(--green); }
.km-metric-button { width:100%; border:1px solid var(--border); color:inherit; text-align:left; cursor:pointer; font:inherit; }
.km-metric-button:hover, .km-metric-button:focus-visible { border-color:var(--orange); box-shadow:0 0 0 3px rgba(243,154,0,.13); outline:none; }
.km-method-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:12px; }
.km-method-card { display:grid; gap:6px; padding:16px; border:1px solid var(--border); border-radius:14px; background:#f8fbf8; }
.km-method-card span { color:var(--green-dark); font-size:12px; font-weight:900; letter-spacing:.05em; }
.km-method-card strong { font-size:24px; }.km-method-card small { color:var(--muted); }
.km-maintenance-chart { display:grid; gap:12px; }
.km-maintenance-row { display:grid; gap:8px; padding:13px; border:1px solid var(--border); border-radius:14px; background:#fffdfa; }
.km-maintenance-row header { display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; }.km-maintenance-row header span { color:var(--muted); font-size:12px; }
.km-maintenance-series { display:grid; grid-template-columns:48px minmax(140px,1fr) 120px; gap:10px; align-items:center; font-size:12px; }
.km-maintenance-series>div { height:12px; border-radius:999px; overflow:hidden; background:#edf1ed; }.km-maintenance-series i { display:block; height:100%; border-radius:inherit; }.km-maintenance-series i.liters { background:var(--green); }.km-maintenance-series i.cost { background:var(--orange); }.km-maintenance-series strong { text-align:right; }
.km-simple-dialog { width:min(680px,calc(100% - 28px)); }.km-missing-list { display:grid; gap:8px; }.km-missing-list>div { display:grid; grid-template-columns:110px 1fr auto; gap:12px; align-items:center; padding:11px; border:1px solid var(--border); border-radius:11px; }.km-missing-list span { color:var(--muted); }.km-missing-list em { font-style:normal; color:#b54708; font-weight:800; }
.km-config-dialog { width:min(900px,calc(100% - 28px)); }.km-config-form { margin:16px 0; }.km-config-list { display:grid; gap:8px; }.km-config-row { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:11px; border:1px solid var(--border); border-radius:11px; }.km-config-row>div:first-child { display:grid; }.km-config-row span { color:var(--muted); font-size:12px; }.km-config-row>div:last-child { display:flex; gap:6px; }
@media(max-width:760px){.km-chart-row{grid-template-columns:1fr auto}.km-track{grid-column:1/-1;grid-row:2}.km-chart-row .badge{display:none}.km-summary-chart{align-items:stretch;flex-direction:column}.km-donut{margin:auto}.pagination-controls{justify-content:flex-start}.dashboard-chart-header{flex-direction:column}.km-deviation-row{grid-template-columns:minmax(90px,1fr) minmax(90px,1.3fr) 58px}}
@media(max-width:760px){.km-maintenance-series{grid-template-columns:42px 1fr}.km-maintenance-series strong{grid-column:2;text-align:left}.km-missing-list>div{grid-template-columns:1fr}.km-config-row{align-items:flex-start;flex-direction:column}}
.dashboard-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}
.dashboard-grid-primary {
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .55fr);
}
.dashboard-grid-secondary {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.dashboard-grid-full {
  grid-template-columns: minmax(0, 1fr);
}
.dashboard-chart-card {
  min-width: 0;
}
.dashboard-chart-featured {
  background:
    radial-gradient(circle at top right, rgba(243,154,0,.10), transparent 18rem),
    var(--card);
}
.dashboard-chart-header {
  align-items: flex-start;
}
.dashboard-chart-header h2 {
  margin-top: 3px;
}
.chart-kicker {
  color: var(--orange-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.chart-unit {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #f7faf7;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 800;
}
.dashboard-chart {
  min-height: 160px;
}
.chart-bar-list {
  display: grid;
  gap: 8px;
}
.chart-bar-row {
  appearance: none;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(130px, 1.05fr) minmax(130px, 1.4fr) minmax(90px, auto);
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  padding: 8px;
  text-align: left;
  transition: .18s ease;
}
.chart-bar-row:hover,
.chart-bar-row:focus-visible {
  background: #f8fbf8;
  border-color: var(--border);
  outline: none;
  transform: translateY(-1px);
}
.chart-bar-row.selected {
  background: var(--green-soft);
  border-color: rgba(8,117,42,.35);
  box-shadow: inset 4px 0 0 var(--green);
}
.chart-bar-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.chart-bar-copy strong,
.chart-bar-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-bar-copy strong {
  color: var(--text);
  font-size: 12px;
}
.chart-bar-copy small {
  color: var(--muted);
  font-size: 10px;
}
.chart-bar-track {
  position: relative;
  display: block;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eee9;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.04);
}
.chart-bar-fill {
  display: block;
  min-width: 3px;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--orange));
  transition: width .35s ease;
}
.chart-bar-row.selected .chart-bar-fill {
  background: linear-gradient(90deg, var(--green-dark), var(--green));
}
.chart-bar-value {
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}
.dashboard-empty {
  min-height: 150px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: #fbfcfa;
}
.dashboard-loading .dashboard-chart,
.dashboard-loading .dashboard-metric {
  opacity: .58;
}
.dashboard-loading .dashboard-chart {
  pointer-events: none;
}

@media (max-width: 1280px) {
  .dashboard-filters {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
  .dashboard-filter-actions {
    padding-bottom: 14px;
  }
  .dashboard-grid-primary {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .dashboard-grid-secondary {
    grid-template-columns: minmax(0, 1fr);
  }
  .dashboard-filter-header {
    flex-direction: column;
  }
  .filter-summary {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .dashboard-filters {
    grid-template-columns: minmax(0, 1fr);
  }
  .dashboard-filter-actions {
    padding-bottom: 0;
  }
  .dashboard-filter-actions .btn {
    flex: 1;
  }
  .chart-unit {
    display: none;
  }
  .chart-bar-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 10px;
    padding: 9px 7px;
  }
  .chart-bar-track {
    grid-column: 1 / -1;
    grid-row: 2;
    height: 10px;
  }
  .chart-bar-value {
    grid-column: 2;
    grid-row: 1;
  }
  .dashboard-metric {
    min-height: 118px;
  }
}

/* =========================
   SINCRONIZAÇÃO AUTOMÁTICA
========================= */
.sync-auto-card {
  margin-bottom: 16px;
  background:
    linear-gradient(135deg, rgba(8,117,42,.055), rgba(243,154,0,.05)),
    var(--card);
}
.sync-auto-header,
.sync-title-line,
.sync-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.sync-auto-header { align-items: flex-start; margin-bottom: 18px; }
.sync-title-line { justify-content: flex-start; }
.sync-title-line h2 { margin: 0; color: var(--green-dark); }
.sync-auto-header p { margin: 6px 0 0; }
.sync-progress-header { margin-bottom: 8px; font-size: 13px; color: var(--muted); font-weight: 700; }
.sync-progress-header strong { color: var(--green-dark); font-size: 18px; }
.sync-progress-track {
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #e7ede8;
}
.sync-progress-fill {
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green-dark), var(--green), var(--orange));
  transition: width .45s ease;
}
.sync-progress-track.is-running .sync-progress-fill {
  background-size: 200% 100%;
  animation: syncFlow 1.8s linear infinite;
}
@keyframes syncFlow { to { background-position: -200% 0; } }
.sync-progress-note { margin: 8px 0 16px; color: var(--muted); font-size: 12px; }
.sync-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.sync-metric {
  padding: 13px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.78);
}
.sync-metric span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.sync-metric strong { display: block; margin-top: 6px; color: var(--green-dark); font-size: 22px; }
.sync-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.sync-details > div {
  padding: 12px 13px;
  border-radius: 14px;
  background: #fbfcfa;
  border: 1px solid var(--border);
  min-width: 0;
}
.sync-details span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.sync-details strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.sync-manual-grid { grid-template-columns: 1fr 1fr; }
.sync-manual-panel { min-width: 0; }
.sync-manual-panel + .sync-manual-panel { border-left: 1px solid var(--border); padding-left: 18px; }
.sync-manual-panel h3 { margin: 0 0 12px; color: var(--green-dark); font-size: 16px; }
.sync-two-columns { grid-template-columns: 1fr 1fr; }
.sync-message-cell { max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
button:disabled { opacity: .58; cursor: not-allowed; transform: none !important; }

@media (max-width: 1200px) {
  .sync-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sync-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .sync-auto-header { flex-direction: column; }
  .sync-metrics,
  .sync-details,
  .sync-manual-grid,
  .sync-two-columns { grid-template-columns: 1fr; }
  .sync-manual-panel + .sync-manual-panel { border-left: 0; border-top: 1px solid var(--border); padding-left: 0; padding-top: 18px; }
}

/* =========================
   DASHBOARD DE GASTOS
========================= */
.gastos-filters {
  grid-template-columns: repeat(4, minmax(155px, 1fr));
}

.line-chart-host {
  min-height: 420px;
}

.line-chart-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0 8px;
  scrollbar-width: thin;
}

.line-chart-svg {
  display: block;
  min-width: 100%;
  font-family: inherit;
}

.line-chart-grid {
  stroke: #e4e9e4;
  stroke-width: 1;
}

.line-chart-y-label,
.line-chart-x-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.line-chart-series {
  fill: none;
  stroke: var(--green);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(8,117,42,.14));
}

.line-chart-average {
  stroke: var(--orange);
  stroke-width: 2.5;
  stroke-dasharray: 9 7;
}

.line-chart-point {
  fill: var(--card);
  stroke: var(--green-dark);
  stroke-width: 3;
  cursor: pointer;
  transition: .16s ease;
}

.line-chart-point-group:hover .line-chart-point,
.line-chart-point-group:focus .line-chart-point {
  r: 7;
  fill: var(--green-soft);
  outline: none;
}

.line-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.line-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-line {
  display: inline-block;
  width: 28px;
  height: 0;
  border-top: 3px solid var(--green);
  border-radius: 999px;
}

.legend-average {
  border-top-color: var(--orange);
  border-top-style: dashed;
}

.gastos-table th,
.gastos-table td {
  white-space: nowrap;
}

.gastos-table td:first-child,
.gastos-table td:nth-child(2) {
  white-space: normal;
  min-width: 170px;
}

.gastos-table small {
  color: var(--muted);
}

.gasto-diferenca {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 900;
}

.gasto-acima {
  background: #fee4e2;
  color: #b42318;
}

.gasto-abaixo {
  background: #dcfae6;
  color: #067647;
}

.gasto-media {
  background: #f2f4f7;
  color: #475467;
}

@media (max-width: 1280px) {
  .gastos-filters {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

@media (max-width: 760px) {
  .gastos-filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .line-chart-host {
    min-height: 360px;
  }

  .line-chart-legend {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* =========================
   RESPONSIVIDADE GLOBAL E CONSULTAS
========================= */
.view-hidden { display: none !important; }
.chart-header-tools { display:flex; align-items:center; justify-content:flex-end; gap:12px; flex-wrap:wrap; }
.btn-chart-export { min-height:34px; padding:7px 11px; font-size:12px; }
.pagination-size { display:inline-flex; align-items:center; gap:7px; color:var(--muted); font-size:12px; font-weight:700; white-space:nowrap; }
.pagination-size select { min-height:34px; width:auto; padding:5px 28px 5px 9px; }
.table-result-counter { margin-left:auto; font-size:12px; font-weight:700; white-space:nowrap; }
.field-search-wide { grid-column:span 2; }
.table-wrap { max-width:100%; -webkit-overflow-scrolling:touch; scrollbar-gutter:stable; }
.column-filter-row th { top:41px; z-index:3; }

@media (max-width: 1100px) {
  .app-shell { display:block; }
  .sidebar {
    position:sticky;
    top:0;
    z-index:50;
    height:auto;
    display:grid;
    grid-template-columns:auto minmax(0,1fr);
    align-items:center;
    gap:12px;
    padding:10px 14px;
    overflow:visible;
    box-shadow:0 8px 24px rgba(0,86,29,.18);
  }
  .sidebar .brand { padding:0 12px 0 0; margin:0; border:0; border-right:1px solid rgba(255,255,255,.18); }
  .sidebar .brand img { width:86px; }
  .menu { display:flex; gap:6px; overflow-x:auto; overscroll-behavior-inline:contain; scrollbar-width:thin; padding-bottom:2px; }
  .menu a { flex:0 0 auto; padding:10px 12px; white-space:nowrap; }
  .sidebar-footer { display:none; }
  .content { padding:20px; }
  .topbar { align-items:flex-start; }
}

@media (max-width: 760px) {
  body { background:var(--bg); }
  .sidebar { display:block; padding:8px 10px; }
  .sidebar .brand { display:none; }
  .menu a { min-height:42px; padding:10px 12px; border-radius:11px; }
  .content { padding:12px; }
  .topbar { gap:12px; margin-bottom:14px; }
  .page-title h1 { font-size:22px; }
  .page-title p { font-size:13px; }
  .user-pill { width:100%; border-radius:14px; padding:8px 10px; }
  .user-pill>div { min-width:0; flex:1; overflow:hidden; }
  .user-pill strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .avatar { flex:0 0 34px; }
  .card, .metric, .modal-card { border-radius:14px; box-shadow:0 8px 24px rgba(8,117,42,.08); }
  .card, .metric { padding:14px; }
  .card-header { align-items:flex-start; flex-direction:column; margin-bottom:12px; }
  .card-header>div { width:100%; }
  .metrics, .dashboard-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .dashboard-metric { min-height:112px; }
  .dashboard-metric strong { font-size:21px; overflow-wrap:anywhere; }
  .metric-top { align-items:flex-start; }
  .filters, .gastos-filters, .dashboard-filters { grid-template-columns:minmax(0,1fr); gap:8px; }
  .field-search-wide { grid-column:auto; }
  .field { margin-bottom:8px; gap:6px; }
  .field input, .field select { min-height:44px; padding:10px 12px; border-radius:11px; font-size:16px; }
  .actions, .dashboard-filter-actions { width:100%; padding-bottom:0; }
  .actions .btn, .dashboard-filter-actions .btn { flex:1 1 140px; min-height:43px; }
  .filter-summary { width:100%; justify-content:flex-start; flex-wrap:nowrap; overflow-x:auto; padding-bottom:4px; }
  .filter-chip { flex:0 0 auto; white-space:nowrap; }
  .dashboard-grid, .dashboard-grid-primary, .dashboard-grid-secondary, .dashboard-grid-full { grid-template-columns:minmax(0,1fr); gap:10px; margin-bottom:10px; }
  .dashboard-chart-header { width:100%; }
  .chart-header-tools { width:100%; justify-content:flex-start; }
  .btn-chart-export { flex:1 1 90px; }
  .pagination-size { flex:1 1 auto; }
  .pagination-controls { width:100%; justify-content:space-between; }
  .table-result-counter { margin-left:0; }
  .table-wrap { margin:0 -2px; border-radius:12px; }
  table { min-width:820px; }
  th, td { padding:10px; font-size:12px; }
  .table-wrap th:first-child, .table-wrap td:first-child { position:sticky; left:0; z-index:2; background:#fff; box-shadow:5px 0 8px rgba(38,50,40,.06); }
  .table-wrap thead th:first-child { z-index:5; background:#f7fbf8; }
  .table-wrap .column-filter-row th:first-child { z-index:6; background:#f8faf8; }
  .column-filter-row th { top:37px; }
  .column-filter-row input, .column-filter-row select { min-height:36px; font-size:12px; }
  .classification-dialog, .km-simple-dialog, .km-config-dialog { width:calc(100% - 12px); max-height:calc(100dvh - 12px); margin:auto; }
  .classification-modal-card { max-height:calc(100dvh - 12px); padding:14px; }
  .line-chart-host { min-height:330px; }
  .line-chart-scroll { margin:0 -8px; padding-left:8px; }
  .line-chart-legend { font-size:11px; }
  .km-chart-row { grid-template-columns:minmax(0,1fr) auto; padding:10px 7px; }
  .km-chart-row em { font-size:12px; }
  .km-method-grid { grid-template-columns:minmax(0,1fr); }
  .km-summary-chart { min-height:unset; padding:8px 0; }
  .km-config-form { grid-template-columns:minmax(0,1fr); }
  .sync-auto-card { overflow:hidden; }
  .sync-progress-header { align-items:flex-start; }
  .sync-metric strong { font-size:19px; }
  .auth-body { display:block; }
  .auth-hero { min-height:auto; padding:28px 20px 52px; }
  .auth-hero h1 { font-size:32px; }
  .auth-hero p { font-size:15px; }
  .auth-panel { padding:16px; }
  .login-card { padding:22px 18px; }
}

@media (max-width: 420px) {
  .metrics, .dashboard-metrics { grid-template-columns:minmax(0,1fr); }
  .dashboard-metric { min-height:100px; }
  .actions .btn, .dashboard-filter-actions .btn { flex-basis:100%; }
  .user-pill .btn { padding:9px 11px; }
  .km-maintenance-series { grid-template-columns:38px minmax(0,1fr); }
}
