/* =====================================================================
   MAP GNR8 — Base styles (dark tech)
   ===================================================================== */

:root {
  /* Luna Llena — near-black neutral canvas + gold accent */
  --bg-0: #070708;
  --bg-1: #0c0c0e;
  --bg-2: #151519;
  --bg-3: #20201f;
  --bg-glass: rgba(21, 21, 25, 0.80);

  --border: #26262e;
  --border-strong: #363640;
  --border-soft: rgba(216, 210, 196, 0.12);

  --text: #f0ece2;
  --text-mute: #9a978c;
  --text-dim: #6b685e;

  /* Luna Llena — black & white / platinum-silver accent (monochrome) */
  --primary: #ded8ca;
  --primary-dim: #a8a294;
  --primary-glow: rgba(222, 216, 202, 0.22);

  --accent: #b7b0a2;
  --accent-glow: rgba(183, 176, 162, 0.28);

  --ok: #7bc47f;
  --warn: #d9a441;
  --danger: #d9534f;

  --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-hard: 0 8px 40px rgba(0, 0, 0, 0.6);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ---------- Background grid ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  background-color: var(--bg-0);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(222, 216, 202, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(183, 176, 162, 0.05), transparent),
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: auto, auto, 40px 40px, 40px 40px;
  z-index: -1;
  pointer-events: none;
}

/* ---------- Brand (Luna Llena) ---------- */
.brand-mark {
  font-family: var(--font);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.brand-mark .brand-moon {
  width: 1.35em; height: 1.35em;
  object-fit: contain;
  filter: drop-shadow(0 0 6px var(--primary-glow));
  flex-shrink: 0;
}
.brand-mark .brand-light {
  color: var(--text-mute);
  font-weight: 400;
  margin: 0 4px;
}
.brand-mark .brand-accent {
  color: var(--primary);
  font-weight: 600;
}
.brand-mark.sm { font-size: 15px; }
.brand-mark.xs { font-size: 13px; }
/* Geometric monochrome logo mark (inline SVG, theme-adaptive) */
.brand-mark { letter-spacing: 0.08em; }
.brand-logo { width: 1.7em; height: 1.7em; flex-shrink: 0; color: var(--primary); }
.brand-mark .brand-accent { letter-spacing: 0.08em; }
/* Auth (login) logo */
.auth-logo-mark { width: 68px; height: 68px; color: var(--primary); margin: 0 auto 12px; display: block; }
.auth-wordmark { font-size: 25px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text); text-align: center; }
.auth-wordmark .brand-accent { color: var(--primary); }
/* Subtle attribution legend next to the brand mark */
.brand-credit {
  font-size: 10px;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--text-dim, #7a7a82);
  padding-left: 10px;
  margin-left: 2px;
  border-left: 1px solid var(--border, #2a2a30);
  white-space: nowrap;
  opacity: .85;
}
.brand-credit strong { color: var(--primary); font-weight: 600; }
@media (max-width: 720px) { .brand-credit { display: none; } }
.brand-sub {
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-top: 4px;
}
.auth-logo {
  width: 168px; height: auto;
  object-fit: contain;
  margin: 0 auto 6px;
  display: block;
  filter: drop-shadow(0 0 26px rgba(240, 236, 226, 0.14));
  animation: moonRise 0.8s ease-out;
}
@keyframes moonRise { from { opacity: 0; transform: translateY(8px) scale(0.94); } to { opacity: 1; transform: none; } }

/* ---------- Auth (login / setup) ---------- */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-hard), 0 0 0 1px var(--border-soft) inset;
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  opacity: 0.6;
}
.auth-brand {
  text-align: center;
  margin-bottom: 28px;
}
.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.auth-card label {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 14px;
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}
.auth-card .hint {
  color: var(--text-dim);
  font-weight: normal;
}
.auth-card input[type=text],
.auth-card input[type=password] {
  background: var(--bg-1);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-card input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.auth-card button {
  margin-top: 22px;
}
.auth-foot {
  margin-top: 22px;
  font-size: 12px;
  color: var(--text-mute);
  text-align: center;
  line-height: 1.5;
}

/* ---------- Messages ---------- */
.msg {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid;
}
.msg-error { background: rgba(255, 75, 110, 0.08); border-color: rgba(255, 75, 110, 0.3); color: #ff8aa0; }
.msg-ok    { background: rgba(0, 255, 157, 0.08); border-color: rgba(0, 255, 157, 0.3); color: #6fffc6; }
.msg-info  { background: rgba(222, 216, 202, 0.08); border-color: rgba(222, 216, 202, 0.3); color: #7ee5ff; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn-block { width: 100%; }
.btn-sm    { padding: 7px 12px; font-size: 12px; }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dim));
  color: #14120c;
  box-shadow: 0 4px 14px var(--primary-glow), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
}
.btn-primary:hover {
  box-shadow: 0 6px 22px var(--primary-glow), 0 0 0 1px rgba(222, 216, 202, 0.4) inset;
}

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

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(255, 75, 110, 0.3);
}
.btn-danger:hover {
  background: rgba(255, 75, 110, 0.1);
  border-color: var(--danger);
}

.icon-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover:not(:disabled) {
  background: var(--bg-3);
  border-color: var(--border-strong);
  color: var(--primary);
}
.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  color: var(--text-dim);
}
.icon-btn-toggle.active {
  background: rgba(222, 216, 202, 0.12);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 10px rgba(222, 216, 202, 0.25);
}

/* Language switcher (EN/ES) */
.lang-switch {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active {
  background: var(--primary);
  color: #001218;
}
.auth-lang {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.auth-lang .lang-btn {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 12px;
}

/* ---------- Topbar nav ---------- */
.topbar-nav {
  display: flex;
  gap: 4px;
  margin-left: 12px;
  flex: 1;
}
.topbar-nav a {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-mute);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.topbar-nav a:hover { color: var(--text); background: var(--bg-2); }
.topbar-nav a.active {
  color: var(--primary);
  background: rgba(222, 216, 202, 0.08);
}

/* ---------- Admin table (users, audit) ---------- */
.users-table-wrap {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table thead th {
  background: var(--bg-2);
  color: var(--text-mute);
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 700;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.admin-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table .loading, .admin-table .empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-mute);
  font-size: 13px;
}
.admin-table .actions {
  white-space: nowrap;
  text-align: right;
}
.admin-table .actions .btn { padding: 5px 8px; }
.admin-table .actions .btn.danger:hover { color: var(--danger); border-color: var(--danger); }

.user-cell strong { color: var(--text); display: block; }
.user-cell small {
  display: block;
  color: var(--text-mute);
  font-size: 11px;
  margin-top: 2px;
}
.user-email { font-family: var(--font-mono); }

.role-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.role-owner { background: rgba(255,181,71,0.12); color: var(--warn); border: 1px solid rgba(255,181,71,0.3); }
.role-editor { background: rgba(222, 216, 202,0.1); color: var(--primary); border: 1px solid rgba(222, 216, 202,0.3); }
.role-viewer { background: rgba(122,138,163,0.12); color: var(--text-mute); border: 1px solid var(--border-strong); }

.status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.status-active { background: rgba(0,255,157,0.1); color: var(--ok); border: 1px solid rgba(0,255,157,0.3); }
.status-inactive { background: rgba(255,75,110,0.1); color: var(--danger); border: 1px solid rgba(255,75,110,0.3); }

/* ---------- Audit filters + pagination ---------- */
.audit-filters {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.audit-filters input,
.audit-filters select {
  background: var(--bg-1);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
}
.audit-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  color: var(--text-mute);
  font-size: 12px;
  flex-wrap: wrap;
  gap: 10px;
}
.pag-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pag-page {
  font-family: var(--font-mono);
  color: var(--text);
  padding: 0 8px;
}

.action-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-mute);
}
.action-chip.act-ok { color: var(--ok); border-color: rgba(0,255,157,0.3); }
.action-chip.act-info { color: var(--primary); border-color: rgba(222, 216, 202,0.3); }
.action-chip.act-warn { color: var(--warn); border-color: rgba(255,181,71,0.3); }
.action-chip.act-danger { color: var(--danger); border-color: rgba(255,75,110,0.3); }
.action-chip.act-mute { color: var(--text-dim); }

.mono { font-family: var(--font-mono); }
.text-mute { color: var(--text-mute); }
.text-dim { color: var(--text-dim); }

/* ---------- Confirm dialog ---------- */
.confirm-root {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.confirm-root.hidden { display: none; }
.confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 15, 0.78);
  backdrop-filter: blur(8px);
}
.confirm-box {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  width: 92%;
  max-width: 460px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  overflow: hidden;
  animation: confirmIn 0.16s ease-out;
}
@keyframes confirmIn {
  from { transform: scale(0.96) translateY(4px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.confirm-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 20px 20px 8px;
}
.confirm-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,75,110,0.12);
  color: var(--danger);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.confirm-titles { flex: 1; min-width: 0; }
.confirm-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}
.confirm-subtitle {
  font-size: 12px;
  color: var(--text-mute);
}
.confirm-close {
  background: transparent;
  border: none;
  color: var(--text-mute);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.confirm-close:hover { color: var(--text); background: var(--bg-2); }
.confirm-body {
  padding: 0 20px 14px 74px;
  color: var(--text-mute);
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
}
.confirm-typebox {
  padding: 0 20px 4px 74px;
}
.confirm-hint {
  display: block;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 5px;
  letter-spacing: 0.03em;
}
.confirm-input {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
}
.confirm-input:focus {
  outline: none;
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(255,75,110,0.2);
}
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 20px;
  border-top: 1px solid var(--border);
  margin-top: 14px;
}
.confirm-ok:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.icon-btn-mini {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-mute);
  width: 24px; height: 24px;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn-mini:hover { color: var(--primary); border-color: var(--primary); }

/* ---------- Topbar ---------- */
.topbar {
  height: 56px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-left, .topbar-right, .topbar-center {
  display: flex;
  align-items: center;
  gap: 10px;
}
.topbar-center { flex: 1; justify-content: center; }
.user-pill {
  font-size: 12px;
  color: var(--text-mute);
  padding: 5px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* ---------- Dashboard ---------- */
.dash-body { min-height: 100vh; }
.dash-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 32px;
  gap: 20px;
}
.dash-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}
.dash-header h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}
.muted { color: var(--text-mute); font-size: 13px; margin: 4px 0 0; }

.venue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.venue-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  position: relative;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
  overflow: hidden;
}
.venue-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(222, 216, 202, 0.06), transparent 40%);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.venue-card:hover {
  border-color: rgba(222, 216, 202, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(222, 216, 202, 0.15);
}
.venue-card:hover::before { opacity: 1; }
.venue-card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 8px;
  gap: 8px;
}
.venue-card-name {
  font-size: 16px; font-weight: 600; color: var(--text); margin: 0;
}
.venue-card-addr {
  font-size: 12px; color: var(--text-mute); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.venue-card-desc {
  font-size: 12px; color: var(--text-dim); margin: 10px 0 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 32px;
}
.venue-card-foot {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  font-size: 11px;
  color: var(--text-mute);
}
.venue-card-foot .chip {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--primary);
  font-family: var(--font-mono);
  font-weight: 600;
}
.venue-card-actions {
  display: flex; gap: 4px;
  opacity: 0; transition: opacity 0.15s;
}
.venue-card:hover .venue-card-actions { opacity: 1; }
.venue-card-actions button {
  background: transparent;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
}
.venue-card-actions button:hover { color: var(--text); background: var(--bg-3); }
.venue-card-actions button.danger:hover { color: var(--danger); background: rgba(255, 75, 110, 0.1); }

.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-mute);
  font-size: 13px;
}
.empty-venues {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-mute);
  font-size: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(6, 8, 15, 0.7);
  backdrop-filter: blur(6px);
  z-index: 100;
}
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  width: 90%;
  max-width: 440px;
  z-index: 101;
  box-shadow: var(--shadow-hard);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal form { padding: 20px; }
.modal label {
  display: block;
  font-size: 12px;
  color: var(--text-mute);
  margin: 12px 0 6px;
  letter-spacing: 0.03em;
}
.modal label:first-child { margin-top: 0; }
.modal .req { color: var(--danger); }
.modal input[type=text],
.modal input[type=number],
.modal textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}
.modal input:focus, .modal textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.modal-actions {
  display: flex; gap: 10px; justify-content: space-between;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.modal-actions .btn:first-child { margin-right: auto; }

/* ---------- Wizard ---------- */
.modal-wizard { max-width: 520px; }
.modal-wizard .modal-head {
  align-items: center;
}
.wizard-steps {
  display: flex; align-items: center; gap: 8px;
  margin-left: auto;
  margin-right: 12px;
}
.ws-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  color: var(--text-mute);
  font-size: 11px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  transition: all 0.2s;
}
.ws-dot.active {
  background: var(--primary);
  color: #001218;
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}
.ws-line {
  width: 28px; height: 1px;
  background: var(--border-strong);
}
.wizard-pane {
  display: none;
  padding: 22px;
}
.wizard-pane.active { display: block; }
.wizard-intro {
  font-size: 13px;
  color: var(--text-mute);
  margin: 0 0 18px;
  line-height: 1.5;
}
.wizard-pane label {
  display: block;
  font-size: 12px;
  color: var(--text-mute);
  margin: 12px 0 6px;
  letter-spacing: 0.03em;
}
.wizard-pane label:first-of-type { margin-top: 0; }
.wizard-pane input[type=text],
.wizard-pane input[type=number],
.wizard-pane textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}
.wizard-pane input:focus, .wizard-pane textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.wizard-pane .row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}
.wizard-pane .row-2 > div { display: flex; flex-direction: column; }
.wizard-pane .req { color: var(--danger); }

.tpl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 8px;
}
.tpl-grid.tpl-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}
.tpl-grid.tpl-grid-3 .tpl-card { padding: 10px; }
.tpl-grid.tpl-grid-3 .tpl-icon svg { width: 60px; height: 36px; }
.tpl-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.tpl-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-3);
}
.tpl-card.selected {
  border-color: var(--primary);
  background: rgba(222, 216, 202, 0.06);
  box-shadow: 0 0 0 1px var(--primary) inset, 0 0 18px var(--primary-glow);
}
.tpl-icon {
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 10px;
}
.tpl-icon svg { width: 80px; height: 50px; }
.tpl-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}
.tpl-desc {
  font-size: 11px;
  color: var(--text-mute);
  line-height: 1.4;
}

/* ---------- Export chooser cards ---------- */
.export-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 4px;
}
.export-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.export-card:hover {
  border-color: var(--border-strong);
  background: var(--bg-3);
}
.export-card.selected {
  border-color: var(--primary);
  background: rgba(222, 216, 202, 0.06);
  box-shadow: 0 0 0 1px var(--primary) inset, 0 0 18px var(--primary-glow);
}
.export-ic {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-1);
  border: 1px solid var(--border);
  color: var(--primary);
}
.export-card[data-export="firedept"] .export-ic { color: #ff5a4d; }
.export-card.selected .export-ic { border-color: var(--primary); }
.export-ic svg { width: 22px; height: 22px; }
.export-body { flex: 1 1 auto; min-width: 0; }
.export-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}
.export-desc {
  font-size: 11px;
  color: var(--text-mute);
  line-height: 1.45;
}

.hidden { display: none !important; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow-hard);
  z-index: 9500; /* above report overlay (2000) and context menu (9000) */
  animation: toastIn 0.2s ease-out;
}
.toast.ok { border-color: var(--ok); color: var(--ok); }
.toast.err { border-color: var(--danger); color: var(--danger); }
@keyframes toastIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- Fire Dept permit form ---------- */
.fp-note {
  font-size: 12px; color: var(--text-mute);
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 14px;
}
.fp-section {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--primary); font-weight: 700; margin: 16px 0 8px;
}
.fp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fp-f { display: flex; flex-direction: column; gap: 4px; }
.fp-f span { font-size: 11px; color: var(--text-mute); letter-spacing: 0.02em; }
.fp-f input {
  background: var(--bg-1); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 10px; font-family: inherit; font-size: 13px; width: 100%;
}
.fp-f input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
.fp-checks { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.fp-chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.fp-chk input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
@media (max-width: 560px) { .fp-grid { grid-template-columns: 1fr; } }
