*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:    #2563eb;
  --blue-d:  #1d4ed8;
  --green:   #16a34a;
  --red:     #dc2626;
  --orange:  #f59e0b;
  --gray:    #6b7280;
  --gray-l:  #f3f4f6;
  --gray-b:  #e5e7eb;
  --radius:  8px;
  --shadow:  0 1px 3px rgba(0,0,0,.1);
}

body { font-family: system-ui, -apple-system, sans-serif; background: #f8fafc;
       color: #1f2937; line-height: 1.5; }

/* NAV */
nav { background: var(--blue); color: white; padding: 0 24px;
      display: flex; align-items: center; gap: 24px; height: 52px; }
nav a { color: rgba(255,255,255,.85); text-decoration: none; font-size: .9rem; }
nav a:hover, nav a.active { color: white; }
nav .brand { font-weight: 700; font-size: 1rem; color: white; margin-right: auto; }
nav .badge-admin { background: rgba(255,255,255,.2); padding: 2px 8px;
                   border-radius: 12px; font-size: .75rem; }

/* CONTAINER */
.container { max-width: 860px; margin: 0 auto; padding: 32px 16px; }

/* CARDS */
.card { background: white; border-radius: var(--radius); box-shadow: var(--shadow);
        border: 1px solid var(--gray-b); padding: 24px; margin-bottom: 16px; }
.card-header { display: flex; align-items: center; justify-content: space-between;
               margin-bottom: 16px; }
.card-title { font-size: 1.1rem; font-weight: 600; }

/* VEHICLE LIST */
.vehicle-grid { display: grid; gap: 12px; }
.vehicle-item { background: white; border: 1px solid var(--gray-b);
                border-radius: var(--radius); padding: 16px 20px;
                display: flex; align-items: center; gap: 16px;
                text-decoration: none; color: inherit; transition: border-color .15s; }
.vehicle-item:hover { border-color: var(--blue); }
.vehicle-plate { font-family: monospace; font-size: 1.1rem; font-weight: 700;
                 background: #fef3c7; padding: 4px 10px; border-radius: 4px;
                 border: 1px solid #fbbf24; }
.vehicle-meta { flex: 1; }
.vehicle-label { font-weight: 500; }
.vehicle-sub { font-size: .8rem; color: var(--gray); }
.vehicle-cards-count { font-size: .8rem; color: var(--gray); }

/* CARDS LIST */
.cards-list { display: grid; gap: 8px; }
.card-item { background: var(--gray-l); border-radius: var(--radius);
             padding: 12px 16px; display: flex; align-items: center; gap: 12px; }
.card-item .badge { padding: 2px 8px; border-radius: 12px; font-size: .75rem;
                    font-weight: 600; white-space: nowrap; }
.badge-regional { background: #dbeafe; color: #1e40af; }
.badge-communal { background: #dcfce7; color: #166534; }
.badge-expired   { background: #fee2e2; color: var(--red); }
.badge-expiring  { background: #fef3c7; color: #92400e; }
.card-info { flex: 1; }
.card-zone { font-weight: 500; }
.card-expiry { font-size: .8rem; color: var(--gray); }
.card-expiry.warn { color: var(--orange); font-weight: 500; }
.card-expiry.danger { color: var(--red); font-weight: 600; }

/* FORMS */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: .85rem; font-weight: 500;
        color: #374151; margin-bottom: 4px; }
input, select { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-b);
                border-radius: 6px; font-size: .9rem; background: white; }
input:focus, select:focus { outline: none; border-color: var(--blue);
                             box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: .78rem; color: var(--gray); margin-top: 3px; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
       border-radius: 6px; font-size: .88rem; font-weight: 500; cursor: pointer;
       border: none; text-decoration: none; transition: opacity .15s; }
.btn:hover { opacity: .88; }
.btn-primary { background: var(--blue); color: white; }
.btn-danger  { background: var(--red);  color: white; }
.btn-ghost   { background: transparent; color: var(--gray); border: 1px solid var(--gray-b); }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-full { width: 100%; justify-content: center; }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 16px; font-size: .9rem; }
.alert-info  { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }
.alert-warn  { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* ADMIN TABLE */
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; padding: 8px 12px; background: var(--gray-l);
     border-bottom: 1px solid var(--gray-b); font-weight: 600; color: #374151; }
td { padding: 8px 12px; border-bottom: 1px solid var(--gray-b); }
tr:last-child td { border-bottom: none; }

/* LOGIN */
.login-wrap { min-height: 100vh; display: flex; align-items: center;
              justify-content: center; background: #f1f5f9; }
.login-box { background: white; padding: 40px; border-radius: var(--radius);
             box-shadow: 0 4px 24px rgba(0,0,0,.08); width: 100%; max-width: 380px; }
.login-logo { font-size: 2rem; text-align: center; margin-bottom: 8px; }
.login-title { text-align: center; font-size: 1.2rem; font-weight: 700;
               margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--gray); font-size: .85rem;
             margin-bottom: 28px; }

/* LINKED USERS */
.users-list { display: flex; flex-wrap: wrap; gap: 8px; }
.user-chip { background: #eff6ff; color: #1e40af; padding: 4px 10px;
             border-radius: 12px; font-size: .8rem; }

/* TOLERANCE SLIDER */
.tolerance-row { display: flex; align-items: center; gap: 12px; }
.tolerance-row input[type=range] { flex: 1; }
.tolerance-val { font-weight: 600; min-width: 48px; }

/* SECTION TITLE */
.section-title { font-size: .75rem; font-weight: 700; text-transform: uppercase;
                 letter-spacing: .05em; color: var(--gray); margin-bottom: 12px; }

/* STATUS DOT */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%;
       margin-right: 6px; }
.dot-green { background: var(--green); }
.dot-red   { background: var(--red); }
.dot-gray  { background: var(--gray); }

/* RESPONSIVE */
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .container { padding: 16px; }
  nav { padding: 0 16px; }
}
