/* ═══════════════════════════════════════════════════════════════
   Drive-A — CSS Design System
   iPad-first dark theme, tap-optimised button sizing
   ═══════════════════════════════════════════════════════════════ */

/* ── Custom Properties ─────────────────────────────────────────── */
:root {
  /* Severity colours */
  --severity-positive:      #22c55e;
  --severity-minor:         #f59e0b;
  --severity-significant:   #f97316;
  --severity-serious:       #ef4444;

  /* UI colours */
  --route-stage-bg:         #1e40af;
  --route-stage-active:     #3b82f6;
  --active-bg:              #0f172a;
  --surface:                #1e293b;
  --surface-raised:         #263349;
  --surface-hover:          #2d3f5a;
  --border:                 #334155;
  --border-subtle:          #1e293b;

  --accent-cyan:            #4cc9f0;
  --accent-cyan-dim:        #0ea5e9;
  --accent-cyan-hover:      #67d8f7;

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

  --danger:                 #ef4444;
  --danger-hover:           #dc2626;
  --success:                #22c55e;
  --warning:                #f59e0b;

  /* Sizing — tap targets per Apple HIG */
  --btn-severity-h:         130px;
  --btn-category-h:         80px;
  --btn-subcategory-h:      60px;
  --btn-route-h:            44px;
  --min-tap:                44px;

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;

  /* Spacing */
  --gap-xs:  4px;
  --gap-sm:  8px;
  --gap-md:  16px;
  --gap-lg:  24px;
  --gap-xl:  32px;

  /* Radius */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;

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

  /* Safe areas (notch/home bar) */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);
}

/* ── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: var(--font);
  background: var(--active-bg);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── App Shell ──────────────────────────────────────────────────── */
#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

#screen-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Every screen fills the container */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.screen-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--gap-md);
}

/* ── Header ─────────────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--gap-sm) var(--gap-md);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  min-height: 56px;
  flex-shrink: 0;
}

.header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.header-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.header-actions {
  display: flex;
  gap: var(--gap-sm);
  align-items: center;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  min-height: var(--min-tap);
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent-cyan);
  color: var(--text-inverse);
}
.btn-primary:hover { background: var(--accent-cyan-hover); }

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

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 10px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--surface-raised); }

.btn-icon {
  min-width: var(--min-tap);
  min-height: var(--min-tap);
  padding: 8px;
  border-radius: var(--radius-md);
}

.btn-full { width: 100%; }

.btn-large {
  min-height: 56px;
  font-size: 18px;
  padding: 14px 24px;
}

/* ── Severity Buttons (Step 1 of 3-tap) ─────────────────────────── */
.severity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-md);
  padding: var(--gap-md);
}

.btn-severity {
  min-height: var(--btn-severity-h);
  border-radius: var(--radius-lg);
  font-size: 20px;
  font-weight: 700;
  border: 3px solid transparent;
  flex-direction: column;
  gap: 8px;
  transition: all var(--transition);
}

.btn-severity .severity-icon { font-size: 32px; }

.btn-severity[data-severity="Positive"] {
  background: color-mix(in srgb, var(--severity-positive) 20%, var(--surface));
  border-color: var(--severity-positive);
  color: var(--severity-positive);
}
.btn-severity[data-severity="Minor issue"] {
  background: color-mix(in srgb, var(--severity-minor) 20%, var(--surface));
  border-color: var(--severity-minor);
  color: var(--severity-minor);
}
.btn-severity[data-severity="Significant issue"] {
  background: color-mix(in srgb, var(--severity-significant) 20%, var(--surface));
  border-color: var(--severity-significant);
  color: var(--severity-significant);
}
.btn-severity[data-severity="Serious concern"] {
  background: color-mix(in srgb, var(--severity-serious) 20%, var(--surface));
  border-color: var(--severity-serious);
  color: var(--severity-serious);
}

.btn-severity.selected,
.btn-severity:active {
  transform: scale(0.97);
  filter: brightness(1.2);
}

/* ── Category Grid (Step 2) ──────────────────────────────────────── */
.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap-sm);
  padding: var(--gap-sm) var(--gap-md);
}

.btn-category {
  min-height: var(--btn-category-h);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text-primary);
  border: 2px solid var(--border);
  flex-direction: column;
  gap: 4px;
  text-align: center;
  padding: 8px;
}

.btn-category .cat-icon { font-size: 20px; }

.btn-category:hover,
.btn-category:active {
  background: var(--surface-hover);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* ── Subcategory List (Step 3) ───────────────────────────────────── */
.subcategory-list {
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
  padding: var(--gap-sm) var(--gap-md);
}

.btn-subcategory {
  min-height: var(--btn-subcategory-h);
  font-size: 16px;
  font-weight: 500;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border);
  justify-content: flex-start;
  padding: 12px 16px;
  text-align: left;
}

.btn-subcategory:hover,
.btn-subcategory:active {
  background: var(--surface-hover);
  border-color: var(--accent-cyan);
}

/* ── Route Stage Strip ───────────────────────────────────────────── */
.route-strip {
  display: flex;
  gap: var(--gap-sm);
  padding: var(--gap-sm) var(--gap-md);
  overflow-x: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.route-strip::-webkit-scrollbar { display: none; }

.btn-route {
  height: var(--btn-route-h);
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  background: var(--route-stage-bg);
  color: #fff;
  border: none;
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0.7;
}

.btn-route.active {
  background: var(--route-stage-active);
  opacity: 1;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--route-stage-active);
}

/* ── Active Screen Top Bar ───────────────────────────────────────── */
.active-topbar {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: var(--gap-sm) var(--gap-md);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.timer {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-cyan);
  letter-spacing: 1px;
}

.stage-pill {
  background: var(--route-stage-active);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.saved-banner {
  font-size: 13px;
  color: var(--success);
  margin-left: auto;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: opacity 300ms, max-width 300ms;
  white-space: nowrap;
}
.saved-banner.visible {
  opacity: 1;
  max-width: 80px;
}

/* ── Step Indicator ──────────────────────────────────────────────── */
.step-indicator {
  display: flex;
  align-items: center;
  gap: var(--gap-sm);
  padding: var(--gap-sm) var(--gap-md);
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-raised);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition);
}

.step-dot.active {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  color: var(--text-inverse);
}

.step-dot.complete {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.step-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
.step-label.active { color: var(--text-primary); }

.step-divider {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.severity-badge-selected {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  margin-left: auto;
}

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: var(--gap-md);
  margin-bottom: var(--gap-md);
}

.assessment-card {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: var(--gap-md);
  margin-bottom: var(--gap-sm);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  min-height: var(--min-tap);
}

.assessment-card:hover {
  background: var(--surface-hover);
  border-color: var(--accent-cyan-dim);
}

.assessment-card-body { flex: 1; min-width: 0; }

.assessment-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.assessment-card-meta {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.assessment-card-chevron {
  color: var(--text-muted);
  font-size: 20px;
}

/* ── Event Items ─────────────────────────────────────────────────── */
.event-item {
  display: flex;
  gap: var(--gap-md);
  padding: var(--gap-sm) var(--gap-md);
  border-bottom: 1px solid var(--border-subtle);
  align-items: flex-start;
}

.event-item:last-child { border-bottom: none; }

.event-severity-bar {
  width: 4px;
  border-radius: 2px;
  flex-shrink: 0;
  align-self: stretch;
  min-height: 40px;
}

.event-body { flex: 1; min-width: 0; }

.event-meta {
  display: flex;
  gap: var(--gap-sm);
  align-items: center;
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.event-time {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.event-category {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.event-subcategory {
  font-size: 13px;
  color: var(--text-secondary);
}

.event-note {
  font-size: 13px;
  color: var(--accent-cyan);
  margin-top: 2px;
  font-style: italic;
}

.event-location {
  font-size: 12px;
  color: var(--accent-cyan);
  margin-top: 2px;
  opacity: 0.85;
}

.event-actions {
  display: flex;
  gap: var(--gap-xs);
}

/* ── Severity Colours Applied ────────────────────────────────────── */
[data-severity="Positive"]          { --sev-color: var(--severity-positive); }
[data-severity="Minor issue"]       { --sev-color: var(--severity-minor); }
[data-severity="Significant issue"] { --sev-color: var(--severity-significant); }
[data-severity="Serious concern"]   { --sev-color: var(--severity-serious); }

.event-severity-bar        { background: var(--sev-color, var(--border)); }
.severity-badge {
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  background: color-mix(in srgb, var(--sev-color, var(--border)) 20%, transparent);
  color: var(--sev-color, var(--text-muted));
  border: 1px solid var(--sev-color, var(--border));
}

/* ── Status Badges ───────────────────────────────────────────────── */
.status-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.in-progress {
  background: color-mix(in srgb, var(--accent-cyan) 15%, transparent);
  color: var(--accent-cyan);
  border: 1px solid var(--accent-cyan-dim);
}

.status-badge.complete {
  background: color-mix(in srgb, var(--success) 15%, transparent);
  color: var(--success);
  border: 1px solid var(--success);
}

/* ── Forms ───────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--gap-md);
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  min-height: var(--min-tap);
  padding: 10px 14px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-cyan) 20%, transparent);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap-md);
}

.form-section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: var(--gap-lg) 0 var(--gap-sm);
  padding-bottom: var(--gap-sm);
  border-bottom: 1px solid var(--border);
}

/* ── Toast ───────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-raised);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 200ms, transform 200ms;
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
  border: 1px solid var(--border);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Modal / Overlay ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 500;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: var(--gap-lg);
  padding-bottom: calc(var(--gap-lg) + var(--safe-bottom));
  width: 100%;
  max-width: 640px;
  border: 1px solid var(--border);
  border-bottom: none;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: var(--gap-md);
  color: var(--text-primary);
}

/* ── Empty State ─────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--gap-xl);
  color: var(--text-muted);
  text-align: center;
  gap: var(--gap-md);
}

.empty-state-icon { font-size: 48px; }
.empty-state-title { font-size: 18px; font-weight: 600; color: var(--text-secondary); }
.empty-state-text { font-size: 14px; }

/* ── Misc Utilities ──────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: var(--gap-md) 0;
}

.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 13px; }
.text-center  { text-align: center; }
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.gap-sm       { gap: var(--gap-sm); }
.gap-md       { gap: var(--gap-md); }
.ml-auto      { margin-left: auto; }
.mt-md        { margin-top: var(--gap-md); }
.mb-md        { margin-bottom: var(--gap-md); }

/* Code / JSON preview */
.code-preview {
  background: #000;
  color: #a8ff78;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: var(--gap-md);
  border-radius: var(--radius-md);
  overflow: auto;
  max-height: 50vh;
  white-space: pre;
  border: 1px solid var(--border);
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: var(--gap-sm);
  padding: var(--gap-sm) var(--gap-md);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}

.filter-bar select {
  flex: 1;
  min-width: 120px;
}

/* Outcome selector */
.outcome-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--gap-sm);
}

.btn-outcome {
  min-height: 52px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text-secondary);
  border: 2px solid var(--border);
  transition: all var(--transition);
}

.btn-outcome.selected[data-outcome="Satisfactory"]      { background: color-mix(in srgb, var(--success) 20%, transparent); color: var(--success); border-color: var(--success); }
.btn-outcome.selected[data-outcome="Development needed"] { background: color-mix(in srgb, var(--warning) 20%, transparent); color: var(--warning); border-color: var(--warning); }
.btn-outcome.selected[data-outcome="Unsatisfactory"]    { background: color-mix(in srgb, var(--danger) 20%, transparent); color: var(--danger); border-color: var(--danger); }

/* Post status */
.post-status {
  padding: var(--gap-sm) var(--gap-md);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  margin-top: var(--gap-sm);
}
.post-status.success { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.post-status.error   { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.post-status.pending { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }

/* Settings rows */
.setting-row {
  display: flex;
  align-items: center;
  gap: var(--gap-md);
  padding: var(--gap-md) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { flex: 1; }
.setting-label strong { display: block; font-size: 15px; color: var(--text-primary); }
.setting-label span   { font-size: 13px; color: var(--text-secondary); }

/* ── Phone Responsive (≤ 480px) ─────────────────────────────────── */
@media (max-width: 480px) {
  :root {
    --btn-severity-h:    105px;
    --btn-category-h:    68px;
    --btn-subcategory-h: 52px;
  }

  /* Category: 2 columns on phones */
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Category button text: tighter */
  .btn-category { font-size: 13px; }
  .btn-category .cat-icon { font-size: 18px; }

  /* Severity grid: tighter padding */
  .severity-grid { gap: var(--gap-sm); padding: var(--gap-sm); }
  .btn-severity  { font-size: 17px; }
  .btn-severity .severity-icon { font-size: 26px; }

  /* Active topbar: let name shrink and truncate */
  .active-topbar {
    gap: 6px;
    padding: 6px 10px;
  }
  .active-topbar .header-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
  }

  /* Timer: compact */
  .timer { font-size: 18px; letter-spacing: 0; }

  /* Stage pill: hidden on very small phones — shown in route strip */
  .stage-pill { display: none; }

  /* Subcategory list */
  .subcategory-list { gap: 6px; padding: 6px var(--gap-sm); }
  .btn-subcategory  { font-size: 14px; padding: 10px 12px; }

  /* Step indicator */
  .step-indicator { padding: 6px 10px; }
  .step-label     { font-size: 12px; }

  /* Forms: single column */
  .form-row { grid-template-columns: 1fr; }

  /* Card/content padding */
  .card           { padding: var(--gap-sm); }
  .screen-content { padding: var(--gap-sm); }

  /* Modal: full width on phones */
  .modal { padding: var(--gap-md); padding-bottom: calc(var(--gap-md) + var(--safe-bottom)); }

  /* Outcome grid: tighter */
  .outcome-grid { grid-template-columns: 1fr; }
  .btn-outcome  { min-height: 48px; }

  /* Route strip: grid on phones instead of horizontal scroll */
  .route-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    overflow-x: visible;
    gap: 6px;
    padding: 6px 10px;
  }

  .btn-route {
    height: auto;
    min-height: 44px;
    white-space: normal;
    text-align: center;
    padding: 6px 6px;
    font-size: 12px;
  }
}

/* ── Small phone landscape (≤ 667px height) ──────────────────────── */
@media (max-height: 667px) and (orientation: landscape) {
  :root {
    --btn-severity-h:    80px;
    --btn-category-h:    56px;
    --btn-subcategory-h: 44px;
  }

  .severity-grid { padding: 6px var(--gap-sm); gap: 6px; }
  .category-grid { padding: 4px var(--gap-sm); gap: 6px; }
}

/* ── iPad Media Queries ──────────────────────────────────────────── */
@media (min-width: 768px) {
  :root {
    --btn-severity-h: 160px;
  }

  .category-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .screen-content {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
  }

  .form-row-3 {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  :root {
    --btn-severity-h: 180px;
  }

  .severity-grid {
    max-width: 700px;
    margin: 0 auto;
  }
}

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