/* ═══════════════════════════════════════════════════════
   TELEMAX — Main Stylesheet (Redesign v2)
   Branding: #0077C8 (blue), #1e2329 (dark), #fff (white)
   Font: Inter (Google Fonts)
   ═══════════════════════════════════════════════════════ */

:root {
  /* Brand */
  --primary: #0077C8;
  --primary-dark: #005fa3;
  --primary-light: #2196f3;
  --primary-surface: rgba(0, 119, 200, 0.07);
  --primary-shadow: rgba(0, 119, 200, 0.28);

  /* Neutrals */
  --dark: #1e2329;
  --dark-2: #2d3748;
  --surface: #ffffff;
  --bg: #f0f4f8;
  --bg-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  /* Text */
  --text: #1e2329;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Semantic */
  --success: #059669;
  --success-bg: #d1fae5;
  --success-border: #6ee7b7;
  --warning: #d97706;
  --warning-bg: #fef3c7;
  --warning-border: #fcd34d;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --danger-border: #fca5a5;
  --info: #0284c7;
  --info-bg: #e0f2fe;
  --info-border: #7dd3fc;

  /* Radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.10), 0 3px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.14), 0 6px 16px rgba(0,0,0,0.08);

  /* Motion */
  --transition: 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Legacy compat */
  --gray-100: #f0f4f8;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #64748b;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); text-decoration: underline; }

/* ── Navbar ─────────────────────────────────────────── */
.navbar {
  background: linear-gradient(135deg, #1e2329 0%, #2d3748 100%);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25), 0 1px 0 rgba(255,255,255,0.04);
}

.navbar-brand a {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.navbar-brand a::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 22px;
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  border-radius: 3px;
  flex-shrink: 0;
}
/* Navbar logo */
.navbar-logo {
  height: 32px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4)) brightness(1.15);
  display: block;
}
.navbar-brand a::before { display: none; }

.navbar-menu { display: flex; gap: 2px; flex: 1; align-items: center; }

.nav-link {
  color: rgba(255,255,255,0.72);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  letter-spacing: 0.1px;
  position: relative;
}
.nav-link:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
  text-decoration: none;
}
.nav-link.active {
  color: #fff;
  background: rgba(0,119,200,0.25);
}

/* Dropdown */
.nav-dropdown { position: relative; align-self: stretch; display: flex; align-items: center; }
.nav-dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  min-width: 200px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  z-index: 200;
  border: 1px solid var(--border);
}
.dropdown-menu a {
  display: block;
  padding: 10px 16px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--transition);
}
.dropdown-menu a:hover {
  background: var(--bg);
  color: var(--primary);
  text-decoration: none;
}

.navbar-user { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.user-name { color: rgba(255,255,255,0.8); font-size: 13px; font-weight: 500; }
.user-profile-link { text-decoration: none; transition: color var(--transition); }
.user-profile-link:hover { color: #fff; text-decoration: none; }

.btn-logout {
  background: none;
  border: 1px solid rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.72);
  padding: 5px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-family: var(--font);
  font-weight: 500;
  transition: all var(--transition);
  letter-spacing: 0.2px;
}
.btn-logout:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: rgba(255,255,255,0.4);
}

/* ── Main Content ──────────────────────────────────── */
.main-content {
  flex: 1;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px;
}
.main-content.no-nav { max-width: 100%; padding: 0; }

/* ── Cards ─────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow); }

.form-section { padding: 28px; }

.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
  margin-bottom: 22px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--primary);
  border-radius: 2px;
}

.section-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

.empty-state {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
}
.empty-state::before {
  content: '📭';
  display: block;
  font-size: 32px;
  margin-bottom: 10px;
}

/* ── Page Header ────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}
.page-header h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 3px;
  color: var(--text);
  letter-spacing: -0.3px;
}
.page-header .text-muted { font-size: 13px; }

/* ── Forms ──────────────────────────────────────────── */
.form-row { display: flex; gap: 16px; flex-wrap: wrap; }
.form-group { margin-bottom: 18px; flex: 1; min-width: 200px; }
.form-group.col-3 { flex: 0 0 calc(25% - 12px); }
.form-group.col-4 { flex: 0 0 calc(33% - 11px); }
.form-group.col-6 { flex: 0 0 calc(50% - 8px); }
.form-group.col-8 { flex: 0 0 calc(67% - 6px); }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 7px;
  color: var(--text);
  letter-spacing: 0.1px;
}
.form-label.required::after { content: ' *'; color: var(--primary); }

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--surface);
  outline: none;
}
.form-control::placeholder { color: var(--text-light); }
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-surface);
}
.form-control[readonly], .form-control:disabled {
  background: var(--bg);
  color: var(--text-muted);
  cursor: not-allowed;
  border-color: var(--border);
}
.form-control.mt-2 { margin-top: 8px; }
.form-control-sm { padding: 6px 10px; font-size: 13px; }

textarea.form-control { resize: vertical; min-height: 84px; line-height: 1.5; }

.form-control-static {
  padding: 9px 13px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  min-height: 40px;
  color: var(--text);
}

.input-row { display: flex; gap: 8px; }

/* ── Zone Selector ──────────────────────────────────── */
.zone-selector { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.zone-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  transition: all var(--transition);
  user-select: none;
  background: var(--surface);
  color: var(--text);
  letter-spacing: 0.1px;
}
.zone-btn input[type="radio"] { display: none; }
.zone-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-surface); }
.zone-btn.selected { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 2px 8px var(--primary-shadow); }
.zone-addresses { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.zone-address { font-size: 12px; color: var(--primary); font-weight: 500; }
.zone-selector.readonly .zone-btn { cursor: default; }

/* ── Carkit Selector ────────────────────────────────── */
.carkit-selector { display: flex; gap: 12px; flex-wrap: wrap; }
.carkit-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 116px;
  padding: 18px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  background: var(--surface);
}
.carkit-btn input[type="radio"] { display: none; }
.carkit-btn:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.carkit-btn.selected { border-color: var(--primary); background: var(--primary-surface); box-shadow: 0 2px 8px var(--primary-shadow); }
.carkit-icon { font-size: 36px; line-height: 1; }
.carkit-btn span { font-size: 12.5px; font-weight: 600; color: var(--text); }

/* ── Radio Group ────────────────────────────────────── */
.radio-group { display: flex; gap: 20px; align-items: center; padding-top: 6px; }
.radio-group label { display: flex; align-items: center; gap: 7px; font-size: 14px; cursor: pointer; font-weight: 400; }
.radio-group input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }

/* ── Checkbox ───────────────────────────────────────── */
.checkbox-label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 14px; }
.checkbox-label input[type="checkbox"] { margin-top: 2px; accent-color: var(--primary); width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }

/* ── Technician checklist ───────────────────────────────*/
.technician-checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--bg-2); }
.technician-check { padding: 9px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1.5px solid var(--border); transition: border-color var(--transition), background var(--transition); flex-direction: column; gap: 2px; }
.technician-check:hover { border-color: var(--primary); background: var(--primary-surface); }
.technician-check input:checked ~ span { font-weight: 600; color: var(--primary); }
.technician-check:has(input:checked) { border-color: var(--primary); background: var(--primary-surface); }
.technician-check small { margin-left: 26px; color: var(--text-muted); }
.field-error { color: var(--danger); font-size: 12.5px; margin-top: 5px; font-weight: 500; }

/* ── Availability warning ───────────────────────────── */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); font-size: 13.5px; line-height: 1.5; border-left: 4px solid transparent; }
.alert-warning { background: var(--warning-bg); border-color: var(--warning); color: #7a4500; }

/* ── Signature ──────────────────────────────────────── */
.signature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.signature-box { display: flex; flex-direction: column; gap: 8px; }
.signature-canvas-wrapper { position: relative; }
.signature-canvas {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  display: block;
  width: 100%;
  height: 150px;
  touch-action: none;
  cursor: crosshair;
}
.signature-controls { position: absolute; top: 6px; right: 6px; }
.signature-modes { display: flex; gap: 6px; }
.sig-mode {
  font-size: 12px;
  padding: 3px 11px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: #fff;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font);
  transition: all var(--transition);
  font-weight: 500;
}
.sig-mode.active { border-color: var(--primary); color: var(--primary); background: var(--primary-surface); }

/* ── File Upload ────────────────────────────────────── */
.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  transition: all var(--transition);
  background: var(--bg-2);
  cursor: pointer;
}
.file-upload-area:hover { border-color: var(--primary); background: var(--primary-surface); }
.file-upload-area.drag-over { border-color: var(--primary); background: var(--primary-surface); }
.file-input { display: none; }
.ficheiros-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.ficheiro-preview-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.ficheiro-item { display: flex; align-items: center; gap: 10px; padding: 9px 13px; background: var(--bg); border-radius: var(--radius-sm); font-size: 13px; border: 1px solid var(--border); flex-wrap: wrap; }
.ficheiro-thumb { width: 80px; height: 80px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); cursor: pointer; }
.ficheiro-video { width: 100%; max-width: 320px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.ficheiro-name { flex: 1; font-size: .82rem; color: var(--text-muted); word-break: break-all; }
.ficheiro-download { color: var(--primary); text-decoration: none; }
.ficheiro-download:hover { text-decoration: underline; }

/* ── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  letter-spacing: 0.1px;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-shadow);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: var(--primary-dark);
  box-shadow: 0 4px 14px var(--primary-shadow);
}

.btn-secondary { background: var(--dark); color: #fff; border-color: var(--dark); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--dark-2); border-color: var(--dark-2); }

.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-outline:hover { border-color: var(--text); background: var(--bg); }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.btn-sm { padding: 5px 14px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; }

/* ── Badges ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: var(--font);
}
.badge-lg { font-size: 12.5px; padding: 5px 14px; }
.badge-admin { background: #2c3e50; color: #fff; }
.badge-administrativo { background: #6d28d9; color: #fff; }
.badge-tecnico { background: #0f766e; color: #fff; }
.badge-pendente    { background: #d97706; color: #fff; }
.badge-agendado    { background: #7c3aed; color: #fff; }
.badge-em_progresso{ background: #0284c7; color: #fff; }
.badge-adiado      { background: #6b7280; color: #fff; }
.badge-concluido   { background: #059669; color: #fff; }
.badge-cancelado   { background: #dc2626; color: #fff; }
.badge-admin       { background: #1e293b; color: #fff; }
.badge-administrativo { background: #0284c7; color: #fff; }
.badge-tecnico     { background: #059669; color: #fff; }
.badge-cliente     { background: #7c3aed; color: #fff; }
.badge-rascunho { background: #64748b; color: #fff; }
.badge-submetido { background: #059669; color: #fff; }
.badge-success { background: #059669; color: #fff; }
.badge-danger { background: var(--danger); color: #fff; }
.badge-audit-view { background: #e2e8f0; color: #475569; }
.badge-audit-create { background: #059669; color: #fff; }
.badge-audit-update { background: #0284c7; color: #fff; }
.badge-audit-delete { background: var(--danger); color: #fff; }
.badge-audit-export { background: #6d28d9; color: #fff; }
.badge-audit-anonymize { background: #9f1239; color: #fff; }
.badge-audit-login { background: #0f766e; color: #fff; }
.badge-audit-logout { background: #64748b; color: #fff; }

/* ── Alerts ─────────────────────────────────────────── */
.alert {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  font-size: 13.5px;
  border-left: 4px solid transparent;
}
.alert-success { background: var(--success-bg); color: #065f46; border-color: var(--success); }
.alert-error { background: var(--danger-bg); color: #991b1b; border-color: var(--danger); }
.alert-info { background: var(--info-bg); color: #075985; border-color: var(--info); }
.alert-warning { background: var(--warning-bg); color: #92400e; border-color: var(--warning); }
.alert-close { background: none; border: none; font-size: 18px; cursor: pointer; opacity: 0.5; line-height: 1; padding: 0 0 0 12px; flex-shrink: 0; }
.alert-close:hover { opacity: 1; }

/* ── Stats Grid ─────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--border);
}
.stat-pendente::before    { background: linear-gradient(90deg, #f59e0b, #d97706); }
.stat-agendado::before    { background: linear-gradient(90deg, #a78bfa, #7c3aed); }
.stat-progresso::before   { background: linear-gradient(90deg, #38bdf8, #0284c7); }
.stat-adiado::before      { background: linear-gradient(90deg, #9ca3af, #6b7280); }
.stat-concluido::before   { background: linear-gradient(90deg, #34d399, #059669); }
.stat-cancelado::before   { background: linear-gradient(90deg, #f87171, #dc2626); }
.stat-value { font-size: 34px; font-weight: 700; color: var(--text); letter-spacing: -1px; line-height: 1; }
.stat-label { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Filter Bar ─────────────────────────────────────── */
.filter-bar { padding: 14px 20px; }
.filter-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-form .form-control { width: auto; flex: 1; min-width: 130px; max-width: 210px; }

/* ── Mobile card list (dashboard) ───────────────────── */
.pedido-list-mobile { display: none; flex-direction: column; gap: 10px; }
.pedido-card-mobile {
  display: block; background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 14px 16px;
  text-decoration: none; color: var(--text);
  box-shadow: var(--shadow-sm); transition: box-shadow var(--transition);
}
.pedido-card-mobile:hover { box-shadow: var(--shadow-md); text-decoration: none; color: var(--text); }
.pedido-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pedido-card-num { font-weight: 700; font-size: 15px; color: var(--text); }
.pedido-card-info { display: flex; flex-direction: column; gap: 5px; }
.pedido-card-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.pedido-card-row > span:first-child { color: var(--text-muted); font-size: 12px; min-width: 90px; }

/* ── Tables ─────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  background: var(--bg-2);
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1.5px solid var(--border);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.table-sm th, .table-sm td { padding: 8px 12px; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--bg-2); }
.table tbody tr:last-child td { border-bottom: none; }
.row-inactive { opacity: 0.45; }

/* ── Detail List ────────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.detail-list { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; font-size: 14px; }
.detail-list dt { color: var(--text-muted); font-weight: 600; font-size: 12.5px; }
.detail-list dd { color: var(--text); }

/* ── Auth Page ──────────────────────────────────────── */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  justify-content: center;
  background: var(--bg);
}

/* Split layout */
.auth-split {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.auth-branding {
  flex: 1;
  background: linear-gradient(145deg, #0d1b2a 0%, #0e2744 40%, #0a3d6b 70%, var(--primary-dark) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  position: relative;
  overflow: hidden;
  min-width: 0;
}
.auth-branding::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.auth-branding-content { position: relative; z-index: 1; text-align: center; color: #fff; }
.auth-branding h1 { font-size: 42px; font-weight: 800; letter-spacing: 3px; color: #fff; margin-bottom: 12px; }
.auth-branding h1 span { color: var(--primary-light); }
.auth-branding p { color: rgba(255,255,255,0.6); font-size: 15px; font-weight: 400; max-width: 280px; line-height: 1.6; }
.auth-branding-tagline { margin-top: 48px; display: flex; flex-direction: column; gap: 14px; }
.auth-branding-feature { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,0.7); font-size: 14px; }
.auth-branding-feature span { font-size: 20px; }
.auth-logo-card {
  background: transparent;
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 28px;
}
.auth-logo-card img { height: 60px; display: block; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5)) brightness(1.1); }

.auth-form-panel {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
  background: var(--surface);
  box-shadow: -8px 0 32px rgba(0,0,0,0.08);
}
.auth-form-panel h2 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.auth-form-panel .auth-subtitle { font-size: 13.5px; color: var(--text-muted); margin-bottom: 28px; }
.auth-form-panel .form { width: 100%; }

/* Legacy fallback card (used in login.html if no split) */
.auth-card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; overflow: hidden; }
.auth-logo { background: linear-gradient(135deg, #1e2329 0%, var(--primary-dark) 100%); padding: 36px; text-align: center; }
.auth-logo h1 { color: #fff; font-size: 26px; letter-spacing: 3px; font-weight: 800; }
.auth-logo p { color: rgba(255,255,255,0.55); font-size: 12.5px; margin-top: 5px; font-weight: 400; }
.auth-card .form { padding: 32px; }
.auth-footer { padding: 0 32px 24px; text-align: center; font-size: 12px; color: var(--text-light); }
.auth-footer a { color: var(--text-muted); }
.auth-footer a:hover { color: var(--primary); }

/* ── Privacy Page ───────────────────────────────────── */
.privacy-page { padding: 32px; }
.privacy-page h3 { margin: 24px 0 10px; color: var(--text); font-size: 16px; font-weight: 600; }
.privacy-page p, .privacy-page li { font-size: 14px; line-height: 1.75; color: #44556a; }
.privacy-page ul { padding-left: 20px; margin: 8px 0; }

/* ── RGPD Section ───────────────────────────────────── */
.rgpd-section { border-left: 4px solid var(--primary); }
.danger-zone { border-left: 4px solid var(--danger); background: #fff8f8; }

/* ── Form Actions ───────────────────────────────────── */
.form-actions { display: flex; gap: 12px; justify-content: flex-end; padding: 20px 0 8px; }

/* ── Modal ──────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.45); backdrop-filter: blur(2px); }
.modal-content {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  padding: 32px;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.modal-content h3 { margin-bottom: 10px; font-size: 18px; font-weight: 700; }

/* ── Footer ─────────────────────────────────────────── */
.footer {
  background: var(--dark);
  color: rgba(255,255,255,0.45);
  padding: 16px 28px;
  font-size: 12px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; max-width: 1120px; margin: 0 auto; }
.footer-link { color: rgba(255,255,255,0.45); transition: color var(--transition); }
.footer-link:hover { color: rgba(255,255,255,0.8); text-decoration: none; }

/* ── Utilities ──────────────────────────────────────── */
.text-muted { color: var(--text-muted); font-size: 13px; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }

/* ── Address Autocomplete ───────────────────────────── */
.address-suggestions {
  position: fixed;
  background: var(--surface);
  border: 1.5px solid var(--primary);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  list-style: none;
  margin: 0; padding: 0;
  z-index: 9999;
  box-shadow: var(--shadow-md);
  max-height: 320px;
  overflow-y: auto;
  display: none;
}
.address-suggestions li {
  padding: 9px 13px;
  font-size: 13.5px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background var(--transition);
}
.address-suggestions li:last-child { border-bottom: none; }
.address-suggestions li:hover, .address-suggestions li.active { background: var(--primary-surface); color: var(--primary); }
.nowrap { white-space: nowrap; }

/* ── Hamburger (hidden on desktop) ──────────────────── */
.navbar-hamburger {
  display: none;
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

/* ── Calendar / Feriados ────────────────────────────── */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day { min-height: 68px; padding: 6px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); font-size: 12px; transition: background var(--transition); }
.cal-day:hover { background: var(--bg-2); }
.cal-day.today { border-color: var(--primary); background: var(--primary-surface); }
.cal-day.other-month { opacity: 0.35; }
.cal-day-num { font-weight: 600; margin-bottom: 4px; font-size: 13px; }
.cal-event { background: var(--primary); color: #fff; border-radius: 3px; padding: 1px 5px; margin-top: 2px; font-size: 11px; line-height: 1.5; }
.cal-event.feriado { background: linear-gradient(90deg, #6d28d9, #7c3aed); }
.cal-event.indisp { background: linear-gradient(90deg, #d97706, #f59e0b); color: #fff; }
.cal-header { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 8px; }
.cal-header span { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 6px 0; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 900px) {
  .auth-split {
    flex-direction: column;
    align-items: stretch;
    background: linear-gradient(145deg, #0d1b2a 0%, #0e2744 40%, #0a3d6b 70%, var(--primary-dark) 100%);
    padding: 0;
  }
  .auth-branding {
    flex: 0 0 auto;
    padding: 36px 24px 28px;
    align-items: center;
  }
  .auth-branding h1 { font-size: 30px; }
  .auth-branding-tagline { margin-top: 24px; gap: 10px; }
  .auth-branding-feature { font-size: 13px; }
  .auth-logo-card { margin-bottom: 16px; }
  .auth-form-panel {
    flex: 0 0 auto;
    width: calc(100% - 32px);
    max-width: 420px;
    margin: 0 16px 32px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    padding: 36px 28px;
  }
}

@media (max-width: 768px) {
  /* Navbar — single row, overlay menu */
  .navbar { position: relative; flex-wrap: nowrap; height: 56px; padding: 0 14px; gap: 8px; }
  .navbar-brand { padding: 0; flex: 1; }
  .navbar-hamburger { display: flex; align-items: center; justify-content: center; order: 2; }
  .navbar-user { order: 3; margin-left: 0; gap: 6px; }
  .navbar-user .user-name { display: none; }

  /* Overlay panel drops below navbar */
  .navbar-menu {
    display: none;
    position: absolute; top: 56px; left: 0; right: 0; z-index: 200;
    flex-direction: column; gap: 0;
    background: linear-gradient(135deg, #1e2329 0%, #2d3748 100%);
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 6px 0;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  }
  .navbar-menu.open { display: flex; }
  .nav-link { padding: 12px 16px; border-radius: 0; }
  .nav-link:hover { background: rgba(255,255,255,0.07); }

  /* Admin dropdown inside panel — reset to block flow */
  .nav-dropdown { display: block; align-self: auto; position: static; }
  .nav-dropdown > .nav-link { display: block; width: 100%; height: auto; box-sizing: border-box; }
  .nav-dropdown:hover .dropdown-menu { display: none; }
  .nav-dropdown.open .dropdown-menu { display: block; }
  .nav-dropdown .dropdown-menu {
    position: static; box-shadow: none; background: rgba(255,255,255,0.06);
    border-radius: 0; min-width: 100%; border: none; z-index: auto;
  }
  .nav-dropdown .dropdown-menu a { display: block; color: rgba(255,255,255,0.7); padding: 10px 24px; font-size: 13.5px; }
  .nav-dropdown .dropdown-menu a:hover { background: rgba(255,255,255,0.08); color: #fff; }

  /* Layout */
  .main-content { padding: 18px 14px; }
  .page-header { flex-direction: column; gap: 12px; }
  .page-header .btn { width: 100%; justify-content: center; }

  /* Stats */
  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* Forms */
  .form-row { flex-direction: column; gap: 0; }
  .form-group.col-3, .form-group.col-4, .form-group.col-6, .form-group.col-8 { flex: 1 1 100%; min-width: 0; }
  .input-row { flex-direction: column; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; justify-content: center; }

  /* Grids */
  .detail-grid { grid-template-columns: 1fr; }
  .signature-grid { grid-template-columns: 1fr; }
  .detail-list { grid-template-columns: 110px 1fr; }
  .section-header-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .checkbox-grid { grid-template-columns: 1fr; }

  /* Filter bar — 2-column grid */
  .filter-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filter-form .form-control { min-width: 0; width: 100%; }
  .filter-form .btn { align-self: stretch; }

  /* Tables — swap to card list on mobile */
  .desktop-table-view { display: none; }
  .pedido-list-mobile { display: flex; }

  /* Cards */
  .form-section { padding: 18px; }

  /* Footer */
  .footer-inner { flex-direction: column; gap: 6px; text-align: center; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .zone-selector { flex-direction: column; }
  .zone-btn { width: 100%; justify-content: center; }
  .carkit-selector { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; justify-content: stretch; }
  .carkit-btn { width: auto; }
  .stat-value { font-size: 28px; }
  .btn { padding: 9px 16px; font-size: 13px; }
  .auth-form-panel { padding: 32px 24px; }
}
