:root {
  --bg: #09090b;
  --panel: #18181b;
  --panel-soft: rgba(24, 24, 27, 0.68);
  --line: #27272a;
  --line-light: #3f3f46;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --muted-dark: #71717a;
  --primary: #13ef93;
  --primary-soft: rgba(19, 239, 147, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 9, 11, 0.92);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand:hover { text-decoration: none; }
.brand-logo { height: 26px; width: auto; object-fit: contain; }
.brand-divider { width: 1px; height: 20px; background: var(--line-light); }
.brand-name { color: var(--text); }

.user-account-menu { position: relative; }

.user-account-menu summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  max-width: min(280px, 55vw);
  padding: 0.3rem 0.55rem 0.3rem 0.3rem;
  border: 1px solid var(--line-light);
  border-radius: 999px;
  background: var(--panel);
  cursor: pointer;
  list-style: none;
}

.user-account-menu summary::-webkit-details-marker { display: none; }
.user-account-menu summary:hover { border-color: var(--muted); }

.user-account-menu summary img,
.user-avatar-fallback {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
}

.user-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #27272a;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
}

.user-summary-name {
  overflow: hidden;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chevron {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.user-account-menu[open] .user-chevron { transform: rotate(180deg); }

.user-account-panel {
  position: absolute;
  right: 0;
  z-index: 20;
  width: 240px;
  margin-top: 0.5rem;
  padding: 0.75rem 0 0.5rem;
  overflow: hidden;
  border: 1px solid var(--line-light);
  border-radius: 0.75rem;
  background: #111113;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.user-account-name,
.user-account-email,
.user-account-role {
  margin: 0;
  padding: 0 0.9rem;
}

.user-account-name {
  overflow: hidden;
  font-size: 0.85rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-account-email {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-account-role {
  margin-top: 0.25rem;
  color: var(--primary);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.user-logout {
  display: block;
  width: calc(100% - 1rem);
  margin: 0.65rem 0.5rem 0.15rem;
  padding: 0.5rem 0.4rem;
  border: none;
  border-radius: 0.45rem;
  background: none;
  color: var(--danger);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}

.user-logout:hover {
  background: var(--danger-soft);
  text-decoration: none;
}

.login-page {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
}

.login-logo {
  height: 64px;
  width: auto;
  margin-bottom: 2rem;
  object-fit: contain;
}

.login-page .banner {
  width: min(360px, 100%);
  text-align: left;
}

.login-title {
  margin: 0 0 1.25rem;
  font-size: 1.15rem;
  font-weight: 600;
}

/* Unite email and password form. */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: min(360px, 100%);
  text-align: left;
}

.login-form label {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-form .btn { margin-top: 1rem; }

.login-help {
  margin: 1rem 0 0;
  font-size: 0.85rem;
}

main {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 0.2rem;
  font-size: 1.65rem;
  line-height: 1.2;
}

.muted { color: var(--muted); }

.heading-docs {
  margin: 0.45rem 0 0;
}

.heading-docs a {
  font-size: 0.88rem;
  font-weight: 600;
}

.demo-notice {
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  border: 2px solid var(--warning);
  border-radius: 0.5rem;
  background: var(--warning-soft);
}

.demo-notice-label {
  margin: 0 0 0.4rem;
  color: var(--warning);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.demo-notice-text {
  margin: 0;
  color: #fde68a;
  font-size: 0.9rem;
  line-height: 1.55;
}

.demo-panel {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--panel-soft);
}

.demo-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* One labelled field (alert type or address) inside a demo panel. */
.demo-field {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.demo-field + .demo-field { margin-top: 1.25rem; }

.demo-field label,
.demo-field-title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Shared look so the alert dropdown, address fields and sign-in fields match. */
.alert-select,
.address-input,
.login-input {
  width: 100%;
  min-height: 40px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--primary);
  border-radius: 0.4rem;
  outline: none;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

/* ---- Alert type dropdown ---- */

.alert-select { cursor: pointer; }

/* Required and still on "Choose your type of Alert": show it like a placeholder. */
.alert-select:invalid { color: var(--muted); }
.alert-select option { color: var(--text); }

.alert-select:focus { border-color: var(--primary); }

/* ---- Address field ---- */

.address-input:focus,
.login-input:focus { border-color: var(--primary); }

.address-input::placeholder { color: var(--muted); }

.location-hint {
  margin: -0.4rem 0 0;
  font-size: 0.85rem;
}

/* Street / City / State / ZIP or Latitude / Longitude, per alert type. */
.location-fields {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.location-subtitle {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.location-subtitle .muted {
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.location-row {
  display: grid;
  gap: 0.75rem;
}

.civic-row { grid-template-columns: 2fr 1fr 1fr; }

.coordinates-row { grid-template-columns: 1fr 1fr; }

.location-input {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.location-input label {
  font-size: 0.7rem;
}

@media (max-width: 520px) {
  .civic-row,
  .coordinates-row { grid-template-columns: 1fr; }
}

/* Keep Chrome's autofill from tinting the address and sign-in fields. */
.address-input:-webkit-autofill,
.address-input:-webkit-autofill:hover,
.address-input:-webkit-autofill:focus,
.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover,
.login-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  caret-color: var(--text);
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 40px;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--primary);
  border-radius: 0.4rem;
  background: var(--primary);
  color: #09090b;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover { background: #6ee7b7; text-decoration: none; }
.btn.secondary {
  border-color: var(--line-light);
  background: transparent;
  color: var(--text);
}
.btn.secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.btn:disabled {
  cursor: wait;
  opacity: 0.5;
}

.btn.heading-action {
  width: auto;
  min-width: 10.5rem;
  flex: 0 0 auto;
  margin-top: 0.35rem;
}

.banner {
  margin-bottom: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: var(--panel);
}

.demo-panel .banner {
  margin-top: 1rem;
  margin-bottom: 0;
}

.banner.warn {
  border-color: rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

.banner.ok {
  border-color: rgba(19, 239, 147, 0.4);
  color: var(--primary);
}

.banner.error {
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}

.banner.info {
  border-color: rgba(19, 239, 147, 0.25);
  color: var(--text);
}

.portal-panel {
  margin-top: 0.25rem;
}

.portal-panel .muted {
  margin: 0 0 0.5rem;
}

.portal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.hidden { display: none !important; }

body.lightbox-open { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(440px, 100%);
  padding: 1.35rem 1.25rem 1.15rem;
  border: 1px solid var(--line-light);
  border-radius: 0.85rem;
  background: #111113;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

.lightbox-panel h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  line-height: 1.3;
}

.lightbox-panel > .muted {
  margin: 0 0 1rem;
  font-size: 0.88rem;
}

.lightbox-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.lightbox-form label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.lightbox-form input {
  width: 100%;
  min-height: 40px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line-light);
  border-radius: 0.4rem;
  outline: none;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  color-scheme: dark;
}

.lightbox-form input:focus { border-color: var(--primary); }

.lightbox-form .banner {
  margin: 0;
}

.lightbox-actions {
  display: flex;
  gap: 0.55rem;
  margin-top: 0.15rem;
}

.lightbox-actions .btn {
  width: auto;
  flex: 1;
}

@media (max-width: 600px) {
  .topbar { padding: 0 1rem; }
  main { padding: 1.5rem 1rem 2rem; }
  .brand-name { font-size: 0.78rem; }
  .page-heading { flex-direction: column; }
  .btn.heading-action { width: 100%; }
}
