/* =============================================================
   Redstar Logbook — Design System & App CSS
   ============================================================= */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* -------------------------------------------------------------
   1. DESIGN TOKENS
   ------------------------------------------------------------- */
:root {
  /* Colors */
  --bg-base:       #0a0f1e;
  --bg-surface:    #111827;
  --bg-surface-2:  #1a2235;
  --bg-surface-3:  #222d42;
  --bg-hover:      #1e2d47;

  --accent:        #e63946;
  --accent-hover:  #c1121f;
  --accent-muted:  rgba(230, 57, 70, 0.15);

  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;

  --border:        rgba(255,255,255,0.07);
  --border-focus:  rgba(230, 57, 70, 0.5);

  --success:       #22c55e;
  --success-muted: rgba(34, 197, 94, 0.15);
  --warning:       #f59e0b;
  --warning-muted: rgba(245, 158, 11, 0.15);
  --danger:        #ef4444;
  --danger-muted:  rgba(239, 68, 68, 0.15);
  --info:          #3b82f6;
  --info-muted:    rgba(59, 130, 246, 0.15);
  --night:         #6366f1;
  --night-muted:   rgba(99, 102, 241, 0.2);

  /* Sizing */
  --sidebar-w:     220px;
  --header-h:      56px;
  --radius-sm:     4px;
  --radius-md:     8px;
  --radius-lg:     12px;
  --radius-xl:     16px;

  /* Shadows */
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 24px rgba(0,0,0,0.6);

  /* Transitions */
  --transition:    150ms ease;
}

/* -------------------------------------------------------------
   2. RESET & BASE
   ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;
}

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

h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }

/* -------------------------------------------------------------
   3. APP SHELL LAYOUT
   ------------------------------------------------------------- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr;
  min-height: 100vh;
}

/* -------------------------------------------------------------
   4. SIDEBAR
   ------------------------------------------------------------- */
.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand .brand-icon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

.sidebar-brand .brand-name {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}

/* Pilot Info */
.sidebar-pilot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}

.pilot-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-muted);
  border: 1.5px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  text-transform: uppercase;
}

.pilot-info { flex: 1; min-width: 0; }
.pilot-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pilot-code { font-size: 11px; color: var(--text-muted); }

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: 600;
}

.nav-item svg, .nav-item .nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.8;
}

.nav-item.active svg, .nav-item.active .nav-icon { opacity: 1; }

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
}

/* -------------------------------------------------------------
   5. MAIN CONTENT
   ------------------------------------------------------------- */
.main-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Page Header */
.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  gap: 16px;
}

.page-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.page-actions { display: flex; align-items: center; gap: 10px; }

/* Page Body */
.page-body {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
  width: 100%;
}

/* -------------------------------------------------------------
   6. CARDS
   ------------------------------------------------------------- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.card-sm { padding: 14px 16px; }
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 14px; font-weight: 600; }

/* Stat Cards */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}

.stat-card:hover {
  border-color: rgba(230,57,70,0.3);
  transform: translateY(-1px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.6;
}

.stat-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-muted);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 15px;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text-primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* -------------------------------------------------------------
   7. BUTTONS
   ------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 11px 22px; font-size: 14.5px; }
.btn-full { width: 100%; }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); color: #fff; }

.btn-secondary {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-surface-3); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  background: var(--danger-muted);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-icon {
  padding: 7px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border); }
.btn-icon.danger:hover { background: var(--danger-muted); color: var(--danger); }

/* -------------------------------------------------------------
   8. FORMS
   ------------------------------------------------------------- */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 12px;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

.form-input:user-invalid,
.form-select:user-invalid {
  border-color: var(--danger);
}

.form-input.is-invalid,
.form-select.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}

.form-select option { background: var(--bg-surface); }

.form-textarea { resize: vertical; min-height: 80px; }

.form-hint { font-size: 11.5px; color: var(--text-muted); }
.form-error { font-size: 11.5px; color: var(--danger); }

/* Time input fix */
input[type="time"] {
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Inter', monospace;
  font-size: 15px;
  font-weight: 600;
  padding: 9px 12px;
  width: 100%;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input[type="time"]:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}
input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(0.5); cursor: pointer; }

/* Counter Input */
.counter-group {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.counter-btn {
  width: 32px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface-3);
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  font-family: inherit;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.counter-btn:hover { background: var(--accent-muted); color: var(--accent); }

.counter-value {
  flex: 1;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
  width: 40px;
  padding: 0;
}

/* Calculated display */
.calc-display {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  padding: 4px 0;
}

/* Form grid helpers */
.form-row { display: grid; gap: 14px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }

/* Airport search wrapper */
.airport-field { position: relative; }
.airport-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 3px 12px 0;
  height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.airport-sub.found { color: var(--success); }

/* Autocomplete dropdown */
.autocomplete-list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 220px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: var(--shadow-md);
  display: none;
}
.autocomplete-list.open { display: block; }
.autocomplete-item {
  padding: 9px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.selected { background: var(--bg-hover); }
.autocomplete-item > div {
  min-width: 0;
  flex: 1;
}
.autocomplete-icao {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  font-family: monospace;
  min-width: 42px;
  flex: 0 0 42px;
}
.autocomplete-name,
.autocomplete-city {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.autocomplete-name { font-size: 12.5px; color: var(--text-primary); }
.autocomplete-city { font-size: 11.5px; color: var(--text-muted); }

/* -------------------------------------------------------------
   9. TABLE
   ------------------------------------------------------------- */
.table-wrapper {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead tr {
  background: var(--bg-surface-2);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  text-align: left;
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-hover); }

.data-table td {
  padding: 11px 14px;
  font-size: 13.5px;
  color: var(--text-primary);
  vertical-align: middle;
}

.td-mono { font-family: 'Inter', monospace; font-weight: 600; font-size: 13px; }
.td-muted { color: var(--text-muted); font-size: 12.5px; }
.td-actions { white-space: nowrap; }

/* Route cell */
.route-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13.5px;
}
.route-arrow { color: var(--text-muted); font-size: 11px; }

/* Night time highlight */
.night-cell { color: var(--night); font-weight: 700; }
.night-cell.zero { color: var(--text-muted); font-weight: 400; }

/* -------------------------------------------------------------
   10. BADGES & PILLS
   ------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-success  { background: var(--success-muted); color: var(--success); }
.badge-danger   { background: var(--danger-muted);  color: var(--danger); }
.badge-warning  { background: var(--warning-muted); color: var(--warning); }
.badge-info     { background: var(--info-muted);    color: var(--info); }
.badge-accent   { background: var(--accent-muted);  color: var(--accent); }
.badge-muted    { background: var(--bg-surface-3);  color: var(--text-muted); }
.badge-night    { background: var(--night-muted);   color: var(--night); }

/* Role badges */
.role-pf    { background: var(--success-muted); color: var(--success); }
.role-pnf   { background: var(--info-muted);    color: var(--info); }
.role-pic   { background: var(--success-muted); color: var(--success); }
.role-sic   { background: var(--info-muted);    color: var(--info); }
.role-dual  { background: var(--warning-muted); color: var(--warning); }
.role-instructor { background: rgba(139,92,246,0.15); color: #a78bfa; }
.role-observer   { background: var(--bg-surface-3); color: var(--text-muted); }

/* License type badges */
.lic-cpl   { background: rgba(59,130,246,0.15);  color: #60a5fa; }
.lic-atpl  { background: rgba(230,57,70,0.15);   color: #f87171; }
.lic-ir    { background: rgba(139,92,246,0.15);  color: #a78bfa; }
.lic-mep   { background: rgba(20,184,166,0.15);  color: #2dd4bf; }
.lic-sep   { background: rgba(245,158,11,0.15);  color: #fbbf24; }
.lic-other { background: var(--bg-surface-3);    color: var(--text-muted); }

/* Check type badges */
.check-lpc  { background: rgba(230,57,70,0.15);  color: #f87171; }
.check-opc  { background: rgba(245,158,11,0.15); color: #fbbf24; }
.check-loft { background: rgba(59,130,246,0.15); color: #60a5fa; }
.check-tr   { background: rgba(139,92,246,0.15); color: #a78bfa; }

/* -------------------------------------------------------------
   11. TABS
   ------------------------------------------------------------- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
  margin-bottom: -1px;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* -------------------------------------------------------------
   12. MODALS / DIALOGS
   ------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  transform: translateY(12px);
  transition: transform 200ms ease;
}

.modal-backdrop.open .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--border);
}

/* -------------------------------------------------------------
   13. ALERTS & TOAST
   ------------------------------------------------------------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-error   { background: var(--danger-muted);  color: var(--danger);  border: 1px solid rgba(239,68,68,0.2); }
.alert-success { background: var(--success-muted); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.alert-warning { background: var(--warning-muted); color: var(--warning); border: 1px solid rgba(245,158,11,0.2); }
.alert-info    { background: var(--info-muted);    color: var(--info);    border: 1px solid rgba(59,130,246,0.2); }

/* Toast */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: all;
  max-width: 340px;
  animation: toastIn 250ms ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--info); }

/* -------------------------------------------------------------
   14. AUTH PAGES
   ------------------------------------------------------------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(230,57,70,0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(59,130,246,0.05) 0%, transparent 50%);
  padding: 16px;
}

.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.auth-logo .brand-name { font-size: 1.3rem; font-weight: 800; letter-spacing: 0.08em; }

.auth-title {
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 28px;
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-footer { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text-muted); }
.auth-footer a { color: var(--accent); font-weight: 600; }

/* -------------------------------------------------------------
   15. PROFILE LAYOUT
   ------------------------------------------------------------- */
.profile-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}

.profile-card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 0 4px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-muted);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
}

.profile-name { font-size: 16px; font-weight: 700; margin-top: 4px; }
.profile-code-pill {
  background: var(--accent-muted);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 3px 10px;
  border-radius: 99px;
}

.profile-details {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.profile-detail-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.profile-detail-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.profile-detail-value { font-size: 13.5px; font-weight: 500; }

/* License/Check Cards */
.license-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition);
}
.license-card:hover { border-color: rgba(255,255,255,0.12); }

.license-badge-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.license-info { flex: 1; min-width: 0; }
.license-number { font-size: 14px; font-weight: 700; }
.license-dates {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.license-actions { display: flex; gap: 4px; flex-shrink: 0; }

.add-card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  background: none;
  width: 100%;
  font-family: inherit;
  transition: all var(--transition);
}
.add-card-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-muted); }

/* -------------------------------------------------------------
   16. DASHBOARD GRID
   ------------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.period-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  overflow-x: auto;
  scrollbar-width: none;
}
.period-tabs::-webkit-scrollbar { display: none; }
.period-tab {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  padding: 5px 9px;
  border-radius: calc(var(--radius-md) - 2px);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.period-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.period-tab.active {
  color: var(--text-primary);
  background: var(--accent-muted);
}

/* -------------------------------------------------------------
   17. UTILITY CLASSES
   ------------------------------------------------------------- */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }

.w-full { width: 100%; }
.text-sm   { font-size: 12.5px; }
.text-xs   { font-size: 11.5px; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'Inter', monospace; }

.hidden { display: none !important; }

/* Divider */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  gap: 12px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state .empty-icon { font-size: 32px; opacity: 0.5; }
.empty-state .empty-title { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.empty-state .empty-text  { font-size: 13px; max-width: 300px; }

/* Spinner */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Loading overlay */
.loading-overlay {
  position: absolute; inset: 0;
  background: rgba(10,15,30,0.6);
  display: flex; align-items: center; justify-content: center;
  border-radius: inherit;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--bg-hover); }

@supports (scrollbar-color: auto) {
  * { scrollbar-color: var(--bg-surface-3) transparent; scrollbar-width: thin; }
}

/* -------------------------------------------------------------
   18. RESPONSIVE
   ------------------------------------------------------------- */
@media (max-width: 900px) {
  :root { --sidebar-w: 60px; }

  .sidebar-brand .brand-name,
  .sidebar-pilot .pilot-info,
  .nav-item span,
  .nav-label { display: none; }

  .nav-item { justify-content: center; padding: 10px; }
  .sidebar-pilot { justify-content: center; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .profile-layout { grid-template-columns: 1fr; }
  .form-row-4 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .page-body { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .auth-card { padding: 24px 20px; }
}
