/* =========================================================================
   The Deck — parking-operations control console design system
   A dark "concrete-at-night" console with sodium-vapor amber wayfinding and
   garage-entrance status semantics (green vacant / coral occupied / slate maint).
   ========================================================================= */

:root {
  /* Concrete-at-night base */
  --ink:        #0E1726;
  --ink-2:      #0B1320;
  --surface:    #16213A;
  --surface-2:  #1E2C49;
  --surface-3:  #26375A;
  --line:       #2A3A5C;
  --line-soft:  #213152;

  --text:       #E8EDF7;
  --muted:      #8A97B0;
  --faint:      #5C6B89;

  /* Sodium-vapor amber wayfinding accent */
  --amber:      #FFB627;
  --amber-dim:  #C98A12;
  --amber-glow: rgba(255, 182, 39, 0.16);

  /* Garage-entrance status semantics */
  --vacant:     #3FB950;
  --vacant-bg:  rgba(63, 185, 80, 0.14);
  --occupied:   #F2545B;
  --occupied-bg:rgba(242, 84, 91, 0.14);
  --maint:      #8A97B0;
  --maint-bg:   rgba(138, 151, 176, 0.14);

  --radius:     14px;
  --radius-sm:  9px;
  --radius-xs:  6px;
  --shadow:     0 18px 40px -22px rgba(0, 0, 0, 0.7);
  --shadow-sm:  0 8px 20px -14px rgba(0, 0, 0, 0.6);

  --rail-w:     248px;

  --font-display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --font-body:    "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", "SFMono-Regular", "Consolas", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 182, 39, 0.05), transparent 60%),
    var(--ink);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; font-weight: 600; letter-spacing: -0.01em; }

.mono { font-family: var(--font-mono); }

/* ----------------------------------------------------------------- App shell */
.shell { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; }

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  gap: 6px;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 20px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; flex: none;
  background: repeating-linear-gradient(45deg, var(--amber) 0 7px, var(--ink) 7px 14px);
  box-shadow: inset 0 0 0 2px var(--ink), 0 0 0 1px var(--amber-dim);
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: 0.02em; line-height: 1.1; }
.brand-sub { font-family: var(--font-mono); font-size: 10px; color: var(--amber); letter-spacing: 0.22em; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav-eyebrow { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--faint); text-transform: uppercase; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; font-size: 14px;
  border: 1px solid transparent; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--amber-glow); color: var(--text); border-color: rgba(255, 182, 39, 0.4); }
.nav-item.active svg { color: var(--amber); }

.rail-foot { margin-top: auto; }

/* Garage entrance availability board (the signature element) */
.board {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--ink-2);
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: inset 0 0 24px rgba(0,0,0,0.4);
}
.board-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; color: var(--faint); text-transform: uppercase; }
.board-count { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1; }
.board-count.is-open { color: var(--vacant); text-shadow: 0 0 18px rgba(63,185,80,0.45); }
.board-count.is-full { color: var(--occupied); text-shadow: 0 0 18px rgba(242,84,91,0.45); }

/* ----------------------------------------------------------------- Main area */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 32px;
  background: rgba(14, 23, 38, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 22px; }
.topbar .crumb { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; color: var(--amber); text-transform: uppercase; margin-bottom: 3px; }

.pill {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-mono); font-weight: 600; font-size: 13px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--ink-2);
}
.pill .dot { width: 9px; height: 9px; border-radius: 50%; }
.pill.is-open { color: var(--vacant); border-color: rgba(63,185,80,0.4); }
.pill.is-open .dot { background: var(--vacant); box-shadow: 0 0 10px var(--vacant); }
.pill.is-full { color: var(--occupied); border-color: rgba(242,84,91,0.4); }
.pill.is-full .dot { background: var(--occupied); box-shadow: 0 0 10px var(--occupied); }

.view { padding: 28px 32px 56px; max-width: 1320px; }
.view-intro { color: var(--muted); margin: -4px 0 22px; max-width: 70ch; }

/* ----------------------------------------------------------------- Cards */
.card {
  background: linear-gradient(180deg, var(--surface), var(--ink-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 20px 22px; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 22px; border-bottom: 1px solid var(--line-soft);
}
.card-head h3 { font-size: 16px; }
.card-head .sub { font-family: var(--font-mono); font-size: 11px; color: var(--faint); letter-spacing: 0.1em; }

.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* KPI stat cards */
.kpi { position: relative; overflow: hidden; padding: 20px; }
.kpi::after { content: ""; position: absolute; inset: 0 0 auto auto; width: 70px; height: 70px;
  background: radial-gradient(circle at top right, var(--amber-glow), transparent 70%); }
.kpi-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.kpi-value { font-family: var(--font-display); font-weight: 700; font-size: 38px; line-height: 1.05; margin-top: 8px; letter-spacing: -0.02em; }
.kpi-foot { font-size: 12px; color: var(--faint); margin-top: 6px; }
.kpi.accent .kpi-value { color: var(--amber); }
.kpi.good .kpi-value { color: var(--vacant); }
.kpi.warn .kpi-value { color: var(--occupied); }

/* ----------------------------------------------------------------- Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; border: 1px solid transparent;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--available, .badge--active { color: var(--vacant); background: var(--vacant-bg); border-color: rgba(63,185,80,0.3); }
.badge--occupied { color: var(--occupied); background: var(--occupied-bg); border-color: rgba(242,84,91,0.3); }
.badge--maintenance { color: var(--maint); background: var(--maint-bg); border-color: rgba(138,151,176,0.3); }
.badge--completed { color: var(--muted); background: var(--surface-2); border-color: var(--line); }

/* ----------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 600; font-size: 14px;
  padding: 10px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  cursor: pointer; transition: transform .08s, background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--amber); border-color: var(--amber); color: #1A1203; }
.btn-primary:hover { background: #FFC34F; }
.btn-danger { background: transparent; border-color: rgba(242,84,91,0.5); color: var(--occupied); }
.btn-danger:hover { background: var(--occupied-bg); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: var(--radius-xs); }
.btn-block { width: 100%; }

/* ----------------------------------------------------------------- Forms */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.input, .select {
  width: 100%; font-family: var(--font-body); font-size: 15px;
  padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--ink-2); border: 1px solid var(--line); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input.mono { font-family: var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; }
.input:focus, .select:focus { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-glow); }
.input::placeholder { color: var(--faint); }
.select { 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='%238A97B0' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 36px; }
.field-error { color: var(--occupied); font-size: 12.5px; min-height: 1px; }
.hint { color: var(--faint); font-size: 12.5px; }

/* ----------------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-family: var(--font-mono); font-size: 10.5px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
  padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:hover { background: rgba(255,255,255,0.018); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { font-family: var(--font-mono); }

/* ----------------------------------------------------------------- Parking-bay grid (signature) */
.zone { margin-bottom: 24px; }
.zone-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; }
.zone-head h3 { font-size: 17px; }
.zone-head .meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.bays { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
.bay {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--ink-2);
  padding: 11px; display: flex; flex-direction: column; justify-content: space-between;
  cursor: pointer; transition: transform .1s, border-color .15s, box-shadow .15s;
  /* painted bay lines */
  background-image: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 40%);
}
.bay::before { content: ""; position: absolute; left: 11px; right: 11px; bottom: 9px; height: 2px; border-radius: 2px; background: var(--line); }
.bay:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.bay-code { font-family: var(--font-mono); font-weight: 600; font-size: 15px; letter-spacing: 0.06em; }
.bay-type { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.bay-status { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.bay--available { border-color: rgba(63,185,80,0.45); }
.bay--available .bay-status { color: var(--vacant); }
.bay--available::before { background: var(--vacant); box-shadow: 0 0 10px rgba(63,185,80,0.5); }
.bay--occupied { border-color: rgba(242,84,91,0.4); background-color: rgba(242,84,91,0.06); }
.bay--occupied .bay-status { color: var(--occupied); }
.bay--occupied::before { background: var(--occupied); }
.bay--maintenance { border-style: dashed; }
.bay--maintenance .bay-status { color: var(--maint); }
.bay--maintenance::before { background: var(--maint); }

.legend { display: flex; gap: 18px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ----------------------------------------------------------------- Charts (inline SVG/bars) */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; height: 100%; justify-content: flex-end; }
.bar { width: 100%; max-width: 46px; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--amber), var(--amber-dim)); min-height: 3px; transition: height .4s ease; }
.bar-label { font-family: var(--font-mono); font-size: 10px; color: var(--faint); white-space: nowrap; }
.bar-val { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.meter { height: 9px; border-radius: 999px; background: var(--ink-2); overflow: hidden; border: 1px solid var(--line); }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, var(--amber-dim), var(--amber)); }

/* ----------------------------------------------------------------- States */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .glyph { font-size: 34px; opacity: .5; margin-bottom: 10px; }
.empty h4 { font-size: 16px; color: var(--text); margin-bottom: 6px; }

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 30px; font-family: var(--font-mono); font-size: 13px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--amber); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { background: linear-gradient(90deg, var(--surface), var(--surface-2), var(--surface)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ----------------------------------------------------------------- Receipt / confirmation */
.receipt { border: 1px dashed var(--line); border-radius: var(--radius); background: var(--ink-2); padding: 22px; max-width: 380px; }
.receipt h3 { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--amber); margin-bottom: 16px; }
.receipt-row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dotted var(--line); font-size: 14px; }
.receipt-row .k { color: var(--muted); }
.receipt-row .v { font-family: var(--font-mono); }
.receipt-total { display: flex; justify-content: space-between; margin-top: 14px; padding-top: 12px; }
.receipt-total .amt { font-family: var(--font-display); font-weight: 700; font-size: 30px; color: var(--vacant); }

/* ----------------------------------------------------------------- Toasts */
#toasts { position: fixed; bottom: 24px; right: 24px; z-index: 90; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.toast {
  display: flex; align-items: flex-start; gap: 11px;
  background: var(--surface-2); border: 1px solid var(--line); border-left-width: 3px;
  border-radius: var(--radius-sm); padding: 13px 15px; box-shadow: var(--shadow);
  animation: toast-in .25s ease;
}
.toast--ok { border-left-color: var(--vacant); }
.toast--err { border-left-color: var(--occupied); }
.toast--info { border-left-color: var(--amber); }
.toast-title { font-weight: 600; font-size: 14px; }
.toast-msg { font-size: 13px; color: var(--muted); margin-top: 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } }

/* ----------------------------------------------------------------- Utilities */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.amber { color: var(--amber); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.gap-sm { gap: 10px; }
.divider { height: 1px; background: var(--line-soft); margin: 18px 0; }
.tag { font-family: var(--font-mono); font-size: 11px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; }

/* ----------------------------------------------------------------- Responsive */
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .rail {
    position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center;
    --rail-w: 100%; padding: 12px 16px; gap: 6px;
  }
  .brand { padding: 0 12px 0 4px; }
  .nav { flex-direction: row; flex-wrap: wrap; margin-top: 0; }
  .nav-eyebrow, .rail-foot { display: none; }
  .nav-item { padding: 8px 11px; }
  .nav-item span { display: none; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .view, .topbar { padding-left: 18px; padding-right: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 4px; }
