:root {
  --primary: #0F766E;
  --primary-dark: #0B5C56;
  --primary-light: #CCFBF1;
  --bg: #F7F8FA;
  --card: #FFFFFF;
  --text: #1F2937;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --ok: #16A34A;
  --warning: #D97706;
  --urgent: #EA580C;
  --expired: #DC2626;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 84px;
  position: relative;
}

a { color: var(--primary); text-decoration: none; }

h1, h2, h3 { margin: 0 0 4px 0; }
p { margin: 0 0 8px 0; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar .brand { font-weight: 700; color: var(--primary-dark); font-size: 18px; display: flex; align-items: center; gap: 8px; }
.topbar .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.topbar .actions { display: flex; gap: 10px; align-items: center; }
.icon-btn { background: none; border: none; font-size: 20px; cursor: pointer; position: relative; color: var(--text); }
.badge-dot { position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--expired); }

.page { padding: 16px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.card h3 { font-size: 15px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }

.stat-row { display: flex; gap: 12px; }
.stat { flex: 1; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; text-align: center; }
.stat .value { font-size: 22px; font-weight: 700; color: var(--primary-dark); }
.stat .label { font-size: 12px; color: var(--text-muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--primary); color: white; border: none; border-radius: 10px;
  padding: 12px 18px; font-size: 15px; font-weight: 600; cursor: pointer;
  width: 100%;
}
.btn:active { background: var(--primary-dark); }
.btn.secondary { background: var(--card); color: var(--primary-dark); border: 1px solid var(--border); }
.btn.danger { background: var(--expired); }
.btn.small { width: auto; padding: 8px 14px; font-size: 13px; }
.btn:disabled { opacity: .5; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; font-weight: 600; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border);
  font-size: 15px; background: white; color: var(--text);
}
.field textarea { resize: vertical; min-height: 70px; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.status-ok { background: #DCFCE7; color: var(--ok); }
.status-warning { background: #FEF3C7; color: var(--warning); }
.status-urgent { background: #FFEDD5; color: var(--urgent); }
.status-expired { background: #FEE2E2; color: var(--expired); }
.status-inconnu { background: #F3F4F6; color: var(--text-muted); }

.vehicle-card { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.vehicle-avatar {
  width: 52px; height: 52px; border-radius: 12px; background: var(--primary-light);
  display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0;
}
.vehicle-info { flex: 1; min-width: 0; }
.vehicle-info .title { font-weight: 700; font-size: 15px; }
.vehicle-info .sub { font-size: 13px; color: var(--text-muted); }
.chevron { color: var(--text-muted); }

.alert-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.alert-row:last-child { border-bottom: none; }
.alert-row .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.dot-ok { background: var(--ok); } .dot-warning { background: var(--warning); }
.dot-urgent { background: var(--urgent); } .dot-expired { background: var(--expired); }
.alert-row .content { flex: 1; }
.alert-row .title { font-weight: 600; font-size: 14px; }
.alert-row .sub { font-size: 13px; color: var(--text-muted); }

.tabs { display: flex; overflow-x: auto; gap: 6px; margin-bottom: 14px; padding-bottom: 4px; }
.tab {
  flex-shrink: 0; padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--card); border: 1px solid var(--border); color: var(--text-muted); cursor: pointer;
}
.tab.active { background: var(--primary); color: white; border-color: var(--primary); }

.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px; background: var(--card); border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--text-muted); font-size: 11px; background: none; border: none; cursor: pointer; padding: 4px 10px; }
.nav-item.active { color: var(--primary); }
.nav-item .nav-icon { font-size: 20px; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty-state .emoji { font-size: 40px; margin-bottom: 8px; }

.list-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item .main { font-weight: 600; font-size: 14px; }
.list-item .sub { font-size: 12px; color: var(--text-muted); }
.list-item .right { text-align: right; font-size: 13px; }

.fab {
  position: fixed; bottom: 90px; left: 50%; transform: translateX(calc(-50% + 220px));
  width: 52px; height: 52px; border-radius: 50%; background: var(--primary); color: white;
  border: none; font-size: 26px; box-shadow: 0 4px 12px rgba(0,0,0,.2); cursor: pointer; z-index: 15;
}

.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-logo { text-align: center; margin-bottom: 24px; }
.auth-logo .title { font-size: 24px; font-weight: 800; color: var(--primary-dark); }
.auth-logo .subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.toast {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 100;
  background: var(--text); color: white; padding: 10px 18px; border-radius: 10px; font-size: 14px;
  max-width: 90%; text-align: center; box-shadow: var(--shadow);
}
.toast.error { background: var(--expired); }
.toast.success { background: var(--ok); }

.link-btn { background: none; border: none; color: var(--primary); font-size: 14px; cursor: pointer; padding: 0; font-weight: 600; }
.muted { color: var(--text-muted); font-size: 13px; }
.center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.row-between { display: flex; justify-content: space-between; align-items: center; }
.chip { display: inline-block; background: var(--primary-light); color: var(--primary-dark); font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }

.plan-banner { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.plan-banner .title { font-weight: 700; font-size: 15px; }
.plan-banner .sub { font-size: 13px; opacity: .9; margin-top: 2px; }

.spinner { border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; width: 28px; height: 28px; animation: spin 0.7s linear infinite; margin: 30px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal-sheet { background: var(--card); width: 100%; max-width: 560px; border-radius: 18px 18px 0 0; padding: 20px; max-height: 88vh; overflow-y: auto; }
.modal-sheet .modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-sheet .close-btn { background: none; border: none; font-size: 22px; color: var(--text-muted); cursor: pointer; }
