* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  color: #1a1a1a;
  background: #fafafa;
}

/* ===== LOGIN ===== */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
  padding: 1rem;
}
#login-screen { width: 100%; display: flex; justify-content: center; }
.login-card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 14px;
  padding: 2rem 2rem 1.75rem;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.04);
}
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 1.75rem; }
.login-logo-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: #e6f1fb; display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.login-logo-text { font-size: 16px; font-weight: 600; line-height: 1.2; }
.login-logo-sub { font-size: 12px; color: #888; }
.login-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: #888; margin-bottom: 1.5rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 12px; color: #666; margin-bottom: 5px; }
.field input {
  width: 100%; height: 38px; padding: 0 12px;
  font-size: 14px; border-radius: 8px;
  border: 1px solid #ddd; background: #fff; color: #1a1a1a;
}
.field input:focus { outline: none; border-color: #3b82f6; }
.field-pass { position: relative; }
.field-pass input { padding-right: 40px; }
.toggle-pass {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px;
}
.error-msg {
  font-size: 12px; color: #991b1b; background: #fef2f2;
  border-radius: 8px; padding: 8px 12px; margin-bottom: 1rem;
  align-items: center; gap: 6px;
}
.btn-login {
  width: 100%; height: 40px; border-radius: 8px;
  border: none; background: #3b82f6; color: #fff;
  font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 4px;
}
.btn-login:hover { background: #2563eb; }

/* ===== APP LAYOUT ===== */
.app { max-width: 1200px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0 14px; border-bottom: 1px solid #e5e5e5; margin-bottom: 1.25rem;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-icon {
  width: 32px; height: 32px; border-radius: 8px; background: #e6f1fb;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.topbar-title { font-size: 14px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #666; }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: #e1f5ee;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #085041;
}
.logout-btn {
  background: none; border: 1px solid #ddd; border-radius: 8px;
  padding: 5px 10px; font-size: 12px; cursor: pointer; color: #666;
  text-decoration: none;
}
.logout-btn:hover { background: #fef2f2; color: #991b1b; border-color: transparent; }

.nav { display: flex; gap: 8px; margin-bottom: 1.5rem; border-bottom: 1px solid #e5e5e5; padding-bottom: 1rem; flex-wrap: wrap; }
.nav-btn {
  background: transparent; border: 1px solid #ddd; border-radius: 8px;
  padding: 8px 16px; font-size: 14px; cursor: pointer; color: #666;
}
.nav-btn.active { background: #f0f0f0; color: #1a1a1a; border-color: #bbb; font-weight: 600; }
.nav-btn:hover:not(.active) { background: #f5f5f5; }

.section { display: none; }
.section.active { display: block; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 1.5rem; }
.card { background: #f5f5f5; border-radius: 10px; padding: 1rem; text-align: center; }
.card-label { font-size: 12px; color: #888; margin-bottom: 4px; }
.card-value { font-size: 22px; font-weight: 600; }
.card-value.green { color: #1d9e75; }
.card-value.amber { color: #ba7517; }
.card-value.blue { color: #185fa5; }
.card-value.red { color: #a32d2d; }

.actions-row { display: flex; gap: 8px; margin-bottom: 1rem; flex-wrap: wrap; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1rem; align-items: center; }
.filters select, .filters input {
  height: 34px; font-size: 13px; padding: 0 10px; border-radius: 8px;
  border: 1px solid #ddd; background: #fff; color: #1a1a1a;
}

.btn {
  height: 34px; padding: 0 14px; border-radius: 8px;
  border: 1px solid #ddd; background: transparent; color: #1a1a1a;
  font-size: 13px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: #f5f5f5; }
.btn.primary { background: #e6f1fb; color: #185fa5; border-color: transparent; font-weight: 600; }
.btn.primary:hover { opacity: .88; }
.btn.success { background: #e1f5ee; color: #085041; border-color: transparent; font-weight: 600; }

.add-form {
  background: #fff; border: 1px solid #e5e5e5; border-radius: 12px;
  padding: 1rem 1.25rem; margin-bottom: 1.25rem;
}
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.form-group label { font-size: 12px; color: #888; display: block; margin-bottom: 4px; }
.form-group input, .form-group select {
  width: 100%; height: 34px; padding: 0 10px; font-size: 13px;
  border-radius: 8px; border: 1px solid #ddd; background: #fff; color: #1a1a1a;
}
.form-group input:read-only { background: #f5f5f5; color: #888; }
.form-actions { display: flex; gap: 8px; }

.table-wrap { border: 1px solid #e5e5e5; border-radius: 12px; overflow: hidden; margin-bottom: 1rem; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 700px; }
th {
  background: #f5f5f5; padding: 8px 12px; text-align: left; font-weight: 600;
  font-size: 12px; color: #888; border-bottom: 1px solid #e5e5e5; white-space: nowrap;
}
td {
  padding: 9px 12px; border-bottom: 1px solid #f0f0f0; color: #1a1a1a;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.badge.gasolina { background: #e6f1fb; color: #0c447c; }
.badge.etanol { background: #eaf3de; color: #27500a; }
.badge.diesel { background: #faeeda; color: #633806; }
.badge.gnv { background: #fbeaf0; color: #72243e; }
.badge.flex { background: #eeedfe; color: #3c3489; }
.badge.manutencao { background: #faeeda; color: #633806; }
.badge.pneu { background: #e1f5ee; color: #085041; }
.badge.bateria { background: #fcebeb; color: #791f1f; }
.badge.freio { background: #eeedfe; color: #3c3489; }
.badge.outro { background: #f1efe8; color: #444441; }

.empty { text-align: center; padding: 2.5rem; color: #888; font-size: 14px; }
.del-btn {
  background: none; border: none; cursor: pointer; color: #888;
  font-size: 15px; padding: 2px 6px; border-radius: 4px;
}
.del-btn:hover { color: #991b1b; background: #fef2f2; }

.veiculo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 1.5rem; }
.veiculo-card { background: #fff; border: 1px solid #e5e5e5; border-radius: 12px; padding: 1rem; }
.veiculo-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.veiculo-icon {
  width: 36px; height: 36px; border-radius: 8px; background: #e6f1fb;
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.veiculo-name { font-size: 14px; font-weight: 600; line-height: 1.2; }
.veiculo-plate { font-size: 12px; color: #888; }
.dash-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dash-title { font-size: 14px; font-weight: 600; }
.cat-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; border-bottom: 1px solid #f0f0f0;
}

.toast {
  position: fixed; bottom: 20px; right: 20px; background: #1a1a1a; color: #fff;
  padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 999;
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.error-toast { background: #991b1b; }

@media (max-width: 640px) {
  .filters { flex-direction: column; align-items: stretch; }
  .filters select, .filters input, .btn { width: 100%; }
  .actions-row { flex-direction: column; }
  .actions-row .btn { width: 100%; justify-content: center; }
}
