/* ============================================
   Weather Service UI Framework
   Mobile-first, professional, production-ready
   ============================================ */

/* ============================================
   CSS VARIABLES — AI.md PART 16
   Dark theme defaults in :root
   Light overrides in html.theme-light
   Palette: ThemePaletteDark / ThemePaletteLight
   ============================================ */

:root {
  /* --- Dark theme colors (default) --- */
  /* Backgrounds */
  --color-bg: #282a36;
  --color-bg-secondary: #21222c;
  --color-bg-card: #2b2d3a;
  --color-bg-hover: #343746;
  --color-bg-active: #44475a;
  --color-bg-code: rgba(255, 255, 255, 0.1);

  /* Text */
  --color-text: #f8f8f2;
  /* 4.57:1 on --color-bg, meets WCAG AA 4.5:1 for normal text (AI.md
     PART 31) - lightened from Dracula's stock #6272a4 comment color
     (3.03:1), which was AA-compliant only for large text/UI elements */
  --color-muted: #8591b8;

  /* Borders */
  --color-border: #44475a;
  --color-border-hover: #6272a4;

  /* Brand */
  --color-primary: #bd93f9;
  --color-primary-bg: rgba(189, 147, 249, 0.15);
  --color-secondary: #50fa7b;
  --color-accent: #ff79c6;

  /* Status */
  --color-success: #50fa7b;
  --color-success-bg: rgba(80, 250, 123, 0.15);
  --color-warning: #ffb86c;
  --color-warning-bg: rgba(255, 184, 108, 0.15);
  --color-error: #ff5555;
  --color-error-bg: rgba(255, 85, 85, 0.15);
  --color-info: #8be9fd;
  --color-info-bg: rgba(139, 233, 253, 0.15);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);

  /* --- Layout (theme-neutral) --- */
  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Border radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;

  /* Z-index layers */
  --z-dropdown: 1000;
  --z-modal: 2000;
  --z-toast: 3000;
  --z-tooltip: 4000;
}

/* ============================================
   LIGHT THEME — AI.md PART 16
   Class: html.theme-light
   Palette: ThemePaletteLight
   All values pass WCAG AA 4.5:1 contrast
   ============================================ */

html.theme-light {
  /* Backgrounds */
  --color-bg: #ffffff;
  --color-bg-secondary: #f6f8fa;
  --color-bg-card: #ffffff;
  --color-bg-hover: #eff2f5;
  --color-bg-active: #e6eaef;
  --color-bg-code: rgba(0, 0, 0, 0.05);

  /* Text */
  --color-text: #1f2328;
  --color-muted: #59636e;

  /* Borders */
  --color-border: #d1d9e0;
  --color-border-hover: #818b98;

  /* Brand */
  --color-primary: #0969da;
  --color-primary-bg: rgba(9, 105, 218, 0.12);
  --color-secondary: #1a7f37;
  --color-accent: #8250df;

  /* Status */
  --color-success: #1a7f37;
  --color-success-bg: rgba(26, 127, 55, 0.12);
  --color-warning: #9a6700;
  --color-warning-bg: rgba(154, 103, 0, 0.12);
  --color-error: #d1242f;
  --color-error-bg: rgba(209, 36, 47, 0.12);
  --color-info: #0969da;
  --color-info-bg: rgba(9, 105, 218, 0.12);

  /* Lighter shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.12);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
}

/* ============================================
   AUTO THEME — AI.md PART 16
   Class: html.theme-auto
   Follows system prefers-color-scheme, pure CSS,
   zero JS - dark values already apply from :root,
   so only the light override needs to be re-applied
   when the system prefers light.
   ============================================ */

@media (prefers-color-scheme: light) {
  html.theme-auto {
    --color-bg: #ffffff;
    --color-bg-secondary: #f6f8fa;
    --color-bg-card: #ffffff;
    --color-bg-hover: #eff2f5;
    --color-bg-active: #e6eaef;
    --color-bg-code: rgba(0, 0, 0, 0.05);

    --color-text: #1f2328;
    --color-muted: #59636e;

    --color-border: #d1d9e0;
    --color-border-hover: #818b98;

    --color-primary: #0969da;
    --color-primary-bg: rgba(9, 105, 218, 0.12);
    --color-secondary: #1a7f37;
    --color-accent: #8250df;

    --color-success: #1a7f37;
    --color-success-bg: rgba(26, 127, 55, 0.12);
    --color-warning: #9a6700;
    --color-warning-bg: rgba(154, 103, 0, 0.12);
    --color-error: #d1242f;
    --color-error-bg: rgba(209, 36, 47, 0.12);
    --color-info: #0969da;
    --color-info-bg: rgba(9, 105, 218, 0.12);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
  }
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

@media (min-width: 768px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 2rem; }
  h3 { font-size: 1.75rem; }
}

p {
  margin-bottom: var(--space-md);
}

a {
  color: var(--color-info);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* ============================================
   LAYOUT UTILITIES
   ============================================ */

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

@media (min-width: 768px) {
  .container {
    padding: 0 var(--space-xl);
  }
}

.grid {
  display: grid;
  gap: var(--space-md);
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-1 {
  flex: 1 1 0%;
}

.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-bg-active);
  border-radius: var(--radius-md);
  color: var(--color-muted);
}

.empty-state__icon {
  font-size: 4rem;
  margin-bottom: var(--space-md);
}

.empty-state__title {
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

.empty-state__message {
  color: var(--color-muted);
  margin-bottom: var(--space-md);
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* ============================================
   NAVIGATION BAR
   ============================================ */

.navbar {
  background: var(--color-bg-secondary);
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}

.navbar-container {
  display: flex;
  /* Zones wrap onto a second row on narrow screens instead of overflowing */
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-md);
  max-width: 1400px;
  margin: 0 auto;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
}

.navbar-menu {
  display: none;
  min-width: 0;
  gap: var(--space-lg);
  align-items: center;
}

@media (min-width: 1100px) {
  .navbar-menu {
    display: flex;
    /* Zone B fills the space between brand and actions so the links
       stay centered while the theme toggle stays pinned far right */
    flex: 1 1 auto;
    justify-content: center;
  }
}

.navbar-link {
  color: var(--color-text);
  font-weight: 500;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.navbar-link:hover {
  background: var(--color-bg);
  color: var(--color-info);
}

.navbar-link.active {
  background: var(--color-primary);
  color: var(--color-bg);
}

.navbar-link:focus-visible {
  outline: 3px solid var(--color-info);
  outline-offset: 2px;
}

.navbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-sm);
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 768px) {
  .navbar-actions {
    gap: var(--space-md);
  }
}

/* Language Selector (PART 31) */
.lang-selector {
  display: flex;
  align-items: center;
}

.lang-select {
  background: var(--color-bg-secondary);
  color: var(--color-text);
  border: 1px solid var(--color-muted);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
  max-width: 120px;
}

.lang-select:focus {
  outline: 2px solid var(--color-info);
  outline-offset: 2px;
}

/* Mobile Menu Toggle */
.navbar-toggle {
  display: block;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-sm);
}

.navbar-toggle:focus-visible {
  outline: 3px solid var(--color-info);
  outline-offset: 2px;
}

@media (min-width: 768px) {
  .navbar-toggle {
    display: none;
  }
}

.navbar-menu-mobile {
  display: none;
  flex-direction: column;
  background: var(--color-bg);
  padding: var(--space-md);
  border-top: 1px solid var(--color-bg-secondary);
}

.navbar-menu-mobile.active {
  display: flex;
}

.navbar-menu-mobile .navbar-link {
  display: block;
  padding: var(--space-md);
}

/* ============================================
   THEME TOGGLE (in profile dropdown per AI.md)
   ============================================ */

.theme-toggle-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  color: var(--color-text);
}

.theme-toggle-row span:first-child {
  margin-right: auto;
}

.theme-btn {
  background: transparent;
  border: 1px solid var(--color-bg-active);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  padding: var(--space-xs) var(--space-sm);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.theme-btn:hover {
  background: var(--color-bg-active);
  border-color: var(--color-primary);
}

.theme-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-bg);
}

.theme-sep {
  color: var(--color-muted);
  font-size: 0.8rem;
}

.theme-toggle-label {
  margin-right: auto;
  font-size: 0.9rem;
}

/* ============================================
   HEADER ZONE D - THEME TOGGLE (AI.md PART 16)
   Works with JavaScript disabled: it is a real POST form whose value
   is the server-computed next mode.
   ============================================ */

.navbar-theme {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex: 0 0 auto;
}

.theme-toggle-form,
.theme-toggle-inline {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin: 0;
}

.theme-button {
  display: flex;
  align-items: center;
  justify-content: center;
  /* WCAG 2.1 AA touch target minimum */
  min-width: 44px;
  min-height: 44px;
  background: transparent;
  border: 1px solid var(--color-bg-active);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.theme-button:hover {
  background: var(--color-bg-active);
  border-color: var(--color-primary);
}

.theme-button:focus-visible {
  outline: 3px solid var(--color-info);
  outline-offset: 2px;
}

/* The active mode is marked by border AND an underline, never by colour
   alone, per the WCAG 2.1 AA rules in AI.md PART 31 */
.theme-button.active {
  border-color: var(--color-primary);
  box-shadow: inset 0 -3px 0 0 var(--color-primary);
}

/* Guest gear link into /server/preferences */
.navbar-icon-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 1.1rem;
}

/* ============================================
   NOTIFICATION BELL (per AI.md lines 21581-21650)
   ============================================ */

.notification-bell {
  position: relative;
}

.bell-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--color-text);
  position: relative;
}

.bell-button:hover {
  background: var(--color-bg-active);
}

.bell-button:focus-visible {
  outline: 2px solid var(--color-info);
  outline-offset: 2px;
}

.bell-icon {
  width: 20px;
  height: 20px;
}

.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--color-error);
  color: white;
  border-radius: var(--radius-full);
  min-width: 16px;
  height: 16px;
  font-size: 0.65rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.badge:not(:empty) {
  display: flex;
}

/* Notification Dropdown */
.notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  max-width: calc(100vw - var(--space-md));
  max-height: 400px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-bg-active);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  overflow: hidden;
}

.notification-dropdown[hidden] {
  display: none;
}

.notification-dropdown .dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-bg-active);
  font-weight: 600;
}

.notification-dropdown .mark-all-read {
  background: transparent;
  border: none;
  color: var(--color-info);
  cursor: pointer;
  font-size: 0.85rem;
}

.notification-dropdown .mark-all-read:hover {
  text-decoration: underline;
}

.notification-list {
  max-height: 300px;
  overflow-y: auto;
}

.notification-empty {
  padding: var(--space-lg);
  text-align: center;
  color: var(--color-muted);
}

.notification-item {
  display: flex;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-bg-active);
  text-decoration: none;
  color: var(--color-text);
  transition: background 0.2s ease;
}

.notification-item:hover {
  background: var(--color-bg-active);
}

.notification-item.unread {
  background: rgba(139, 233, 253, 0.05);
}

.notification-dot {
  width: 8px;
  height: 8px;
  background: var(--color-info);
  border-radius: var(--radius-full);
  flex-shrink: 0;
  margin-top: 6px;
}

.notification-item:not(.unread) .notification-dot {
  visibility: hidden;
}

.notification-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  display: block;
  font-weight: 500;
  margin-bottom: 2px;
}

.notification-message {
  display: block;
  font-size: 0.85rem;
  color: var(--color-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notification-time {
  display: block;
  font-size: 0.75rem;
  color: var(--color-muted);
  margin-top: 4px;
}

.notification-dropdown .dropdown-footer {
  display: block;
  padding: var(--space-sm) var(--space-md);
  text-align: center;
  color: var(--color-info);
  text-decoration: none;
  border-top: 1px solid var(--color-bg-active);
}

.notification-dropdown .dropdown-footer:hover {
  background: var(--color-bg-active);
}

/* ============================================
   PROFILE AVATAR
   ============================================ */

.profile-avatar {
  position: relative;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  text-transform: uppercase;
}

.avatar:hover {
  border-color: var(--color-info);
  transform: scale(1.05);
}

.avatar:focus-visible {
  outline: 3px solid var(--color-info);
  outline-offset: 2px;
}

.avatar img {
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  object-fit: cover;
}

.profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + var(--space-sm));
  right: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-bg-active);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  min-width: 220px;
  max-width: calc(100vw - var(--space-md));
  z-index: var(--z-dropdown);
  overflow: hidden;
}

.profile-dropdown.active {
  display: block;
}

.profile-dropdown-header {
  padding: var(--space-md) var(--space-lg);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-bg-active);
}

.profile-dropdown-header > div:first-child {
  font-weight: 600;
  color: var(--color-text);
  font-size: 0.95rem;
}

.profile-dropdown-email {
  font-size: 0.875rem;
  color: var(--color-muted);
}

.profile-dropdown-role {
  font-size: 0.7rem;
  color: var(--color-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.profile-dropdown-menu {
  list-style: none;
  padding: var(--space-xs) 0;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  color: var(--color-text);
  transition: all 0.15s ease;
  font-size: 0.9rem;
}

.profile-dropdown-item:hover {
  background: var(--color-bg-active);
  color: var(--color-info);
}

.profile-dropdown-item:focus-visible {
  outline: 2px solid var(--color-info);
  outline-offset: -2px;
}

.dropdown-divider {
  height: 1px;
  background: var(--color-bg-active);
  margin: var(--space-xs) 0;
}

/* Sign out link (last item) */
a.profile-dropdown-item[href="/server/auth/logout"] {
  color: var(--color-error);
}

a.profile-dropdown-item[href="/server/auth/logout"]:hover {
  background: var(--color-error);
  color: var(--color-bg);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  max-width: 100%;
  text-align: center;
  overflow-wrap: anywhere;
}

.btn:focus-visible {
  outline: 3px solid var(--color-info);
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-bg);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--color-info);
  color: var(--color-bg);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-success);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--color-success);
  color: var(--color-bg);
}

.btn-success:hover:not(:disabled) {
  background: #3fd968;
}

.btn-danger {
  background: var(--color-error);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #ff3333;
}

.btn-warning {
  background: var(--color-warning);
  color: var(--color-bg);
}

.btn-warning:hover:not(:disabled) {
  background: #ff9944;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--color-primary);
  color: var(--color-bg);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-bg-secondary);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

.btn-icon {
  padding: var(--space-sm);
  border-radius: var(--radius-full);
}

/* ============================================
   FORMS
   ============================================ */

.form-group {
  margin-bottom: var(--space-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 600;
  color: var(--color-text);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem;
  background: var(--color-bg-secondary);
  border: 2px solid var(--color-muted);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(189, 147, 249, 0.2);
}

/* Legacy bare-tag form styling for templates that don't apply .form-label/.form-input */
/* (register, login, setup pages) but still nest plain label/input in .form-group */
.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--color-text);
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  background: var(--color-bg);
  border: 1px solid var(--color-muted);
  border-radius: 4px;
  color: var(--color-text);
  font-size: 1rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.form-group small {
  display: block;
  margin-top: 0.25rem;
  color: var(--color-muted);
  font-size: 0.85rem;
}

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

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

.form-help {
  display: block;
  margin-top: var(--space-sm);
  font-size: 0.875rem;
  color: var(--color-muted);
}

.form-error {
  color: var(--color-error);
  font-size: 0.875rem;
  margin-top: var(--space-sm);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-muted);
  transition: 0.3s;
  border-radius: var(--radius-full);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: var(--radius-full);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--color-success);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(24px);
}

/* Custom Checkbox */
.custom-checkbox {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.custom-checkbox input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkbox-box {
  position: relative;
  height: 20px;
  width: 20px;
  background-color: var(--color-bg-secondary);
  border: 2px solid var(--color-muted);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.custom-checkbox:hover .checkbox-box {
  border-color: var(--color-primary);
}

.custom-checkbox input:checked ~ .checkbox-box {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.checkbox-box:after {
  content: "";
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.custom-checkbox input:checked ~ .checkbox-box:after {
  display: block;
}

.checkbox-label {
  margin-left: var(--space-sm);
  color: var(--color-text);
}

/* Custom Radio Button */
.custom-radio {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  margin-right: var(--space-lg);
}

.custom-radio input[type="radio"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.radio-circle {
  position: relative;
  height: 20px;
  width: 20px;
  background-color: var(--color-bg-secondary);
  border: 2px solid var(--color-muted);
  border-radius: var(--radius-full);
  transition: all 0.2s ease;
}

.custom-radio:hover .radio-circle {
  border-color: var(--color-primary);
}

.custom-radio input:checked ~ .radio-circle {
  background-color: var(--color-primary);
  border-color: var(--color-primary);
}

.radio-circle:after {
  content: "";
  position: absolute;
  display: none;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: white;
}

.custom-radio input:checked ~ .radio-circle:after {
  display: block;
}

.radio-label {
  margin-left: var(--space-sm);
  color: var(--color-text);
}

/* File Input */
.file-input-wrapper {
  position: relative;
  display: inline-block;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.file-input-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  background: var(--color-bg-secondary);
  border: 2px solid var(--color-muted);
  border-radius: var(--radius-md);
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-input-label:hover {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: var(--color-bg);
}

.file-input-icon {
  font-size: 1.25rem;
}

.file-input-text {
  font-weight: 600;
}

/* ============================================
   MODALS
   ============================================ */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: var(--z-modal);
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

.modal-overlay.closing {
  animation: fadeOut 0.2s ease;
}

.modal {
  background: var(--color-bg);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.modal-sm {
  max-width: 400px;
}

.modal-md {
  max-width: 600px;
}

.modal-lg {
  max-width: 800px;
}

.modal-xl {
  max-width: 1200px;
}

/* Modal auto-close indicator */
.modal-auto-close {
  font-size: 0.75rem;
  color: var(--color-muted);
  text-align: center;
  margin-top: var(--space-sm);
  font-style: italic;
}

.modal-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-bg-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.5rem;
  color: var(--color-primary);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--color-bg-secondary);
  color: var(--color-error);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-body-text {
  margin: 0;
  line-height: 1.6;
  color: var(--color-text);
}

.modal-body-text-spacing {
  margin: 0 0 1rem 0;
  line-height: 1.6;
  color: var(--color-text);
}

.modal-body-text-center {
  margin: 0;
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--color-text);
}

.modal-input-full {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 1rem;
}

.modal-input-full:focus {
  outline: none;
  border-color: var(--color-info);
  box-shadow: 0 0 0 3px rgba(139, 233, 253, 0.1);
}

.modal-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--color-bg-secondary);
  display: flex;
  gap: var(--space-md);
  justify-content: flex-end;
}

@media (min-width: 768px) {
  .modal {
    max-width: 600px;
  }
}

/* ============================================
   ALERTS & BANNERS
   ============================================ */

.alert {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  border-left: 4px solid;
  display: flex;
  align-items: start;
  gap: var(--space-md);
}

.alert-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.alert-content {
  flex: 1;
}

.alert-title {
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.alert-message {
  font-size: 0.875rem;
}

.alert-info {
  background: rgba(139, 233, 253, 0.1);
  border-color: var(--color-info);
  color: var(--color-info);
}

.alert-success {
  background: rgba(80, 250, 123, 0.1);
  border-color: var(--color-success);
  color: var(--color-success);
}

.alert-warning {
  background: rgba(255, 184, 108, 0.1);
  border-color: var(--color-warning);
  color: var(--color-warning);
}

.alert-error {
  background: rgba(255, 85, 85, 0.1);
  border-color: var(--color-error);
  color: var(--color-error);
}

.alert-dismissible {
  position: relative;
  padding-right: calc(var(--space-lg) + 2rem);
}

.alert-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: none;
  border: none;
  color: inherit;
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.alert-close:hover {
  opacity: 1;
}

/* Server-rendered one-shot flash, shown after a POST-redirect-GET without JS */
.flash-alert {
  align-items: center;
  justify-content: space-between;
}

.flash-alert-message {
  flex: 1;
  font-size: 0.875rem;
}

.flash-alert-dismiss {
  flex-shrink: 0;
  min-width: 44px;
  min-height: 44px;
  background: none;
  border: none;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.flash-alert-dismiss:hover,
.flash-alert-dismiss:focus-visible {
  opacity: 1;
}

/* Banner (full-width alert) */
.banner {
  padding: var(--space-md);
  text-align: center;
  border-bottom: 2px solid;
}

.banner-info {
  background: var(--color-bg-secondary);
  border-color: var(--color-info);
  color: var(--color-info);
}

.banner-success {
  background: rgba(80, 250, 123, 0.1);
  border-color: var(--color-success);
  color: var(--color-success);
}

.banner-warning {
  background: rgba(255, 184, 108, 0.1);
  border-color: var(--color-warning);
  color: var(--color-warning);
}

.banner-error {
  background: rgba(255, 85, 85, 0.1);
  border-color: var(--color-error);
  color: var(--color-error);
}

/* ============================================
   CARDS
   ============================================ */

.card {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  padding: var(--space-lg);
  border-bottom: 1px solid var(--color-bg);
}

.card-title {
  font-size: 1.25rem;
  color: var(--color-primary);
  margin: 0;
}

.card-body {
  padding: var(--space-lg);
}

.card-footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--color-bg);
  background: var(--color-bg);
}

/* ============================================
   BADGES
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: var(--color-primary);
  color: var(--color-bg);
}

.badge-success {
  background: var(--color-success);
  color: var(--color-bg);
}

.badge-warning {
  background: var(--color-warning);
  color: var(--color-bg);
}

.badge-danger {
  background: var(--color-error);
  color: white;
}

.badge-info {
  background: var(--color-info);
  color: var(--color-bg);
}

/* Setup user flow */
.setup-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.setup-card {
  max-width: 450px;
  width: 100%;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  border: 1px solid var(--color-bg-active);
}

.setup-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.setup-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

.setup-title {
  font-size: 1.75rem;
  color: var(--color-info);
  margin-bottom: var(--space-xs);
}

.setup-subtitle {
  color: var(--color-muted);
  font-size: 0.95rem;
}

.setup-form-group {
  margin-bottom: var(--space-xl);
}

.setup-form-label {
  display: block;
  color: var(--color-text);
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.setup-form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--color-bg);
  border: 1px solid var(--color-bg-active);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.setup-form-input:focus {
  outline: none;
  border-color: var(--color-info);
  box-shadow: 0 0 0 3px rgba(139, 233, 253, 0.15);
}

.setup-submit {
  width: 100%;
  background: var(--color-success);
  color: var(--color-bg);
  border: none;
  padding: 0.875rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.setup-submit:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.setup-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.setup-error {
  background: var(--color-error);
  color: var(--color-bg);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
  display: none;
}

.form-hint {
  display: block;
  margin-top: var(--space-xs);
  color: var(--color-muted);
  font-size: 0.8125rem;
}

/* Inline field errors stay hidden until the browser marks the field invalid
   after the user has interacted with it - no JS needed for the timing. */
.field-error {
  display: none;
  margin-top: var(--space-xs);
  color: var(--color-error);
  font-size: 0.8125rem;
}

input:user-invalid ~ .field-error,
select:user-invalid ~ .field-error,
textarea:user-invalid ~ .field-error {
  display: block;
}

input:user-invalid,
select:user-invalid,
textarea:user-invalid {
  border-color: var(--color-error);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 350px;
}

.toast {
  background: var(--color-bg-secondary);
  border: 1px solid;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-md);
  display: flex;
  align-items: start;
  gap: var(--space-md);
  animation: slideInRight 0.3s ease;
}

.toast-success {
  border-color: var(--color-success);
}

.toast-error {
  border-color: var(--color-error);
}

.toast-warning {
  border-color: var(--color-warning);
}

.toast-info {
  border-color: var(--color-info);
}

.toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.toast-message {
  font-size: 0.875rem;
  color: var(--color-muted);
}

.toast-close {
  background: none;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0;
  opacity: 0.7;
}

.toast-close:hover {
  opacity: 1;
}

/* ============================================
   LOADING STATES
   ============================================ */

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-bg-secondary);
  border-top-color: var(--color-primary);
  border-radius: var(--radius-full);
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner-lg {
  width: 60px;
  height: 60px;
  border-width: 6px;
}

.loading-dots {
  display: inline-flex;
  gap: var(--space-xs);
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
  animation-delay: -0.16s;
}

/* ============================================
   TABLES
   ============================================ */

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table thead {
  background: var(--color-bg);
}

.table th {
  padding: var(--space-md);
  text-align: left;
  font-weight: 700;
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
}

.table td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-bg);
}

.table tbody tr:hover {
  background: var(--color-bg);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideDown {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(20px);
    opacity: 0;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-purple { color: var(--color-primary); }
.text-cyan { color: var(--color-info); }
.text-green { color: var(--color-success); }
.text-red { color: var(--color-error); }
.text-yellow { color: var(--color-warning); }
.text-orange { color: var(--color-warning); }
.text-pink { color: var(--color-accent); }
.text-comment { color: var(--color-muted); }

.bg-bg { background: var(--color-bg); }
.bg-current { background: var(--color-bg-secondary); }

.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }

.pt-lg { padding-top: var(--space-lg); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--space-sm); }
.mt-2 { margin-top: var(--space-md); }
.mt-3 { margin-top: var(--space-lg); }
.mt-4 { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--space-sm); }
.mb-2 { margin-bottom: var(--space-md); }
.mb-3 { margin-bottom: var(--space-lg); }
.mb-4 { margin-bottom: var(--space-xl); }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-sm); }
.p-2 { padding: var(--space-md); }
.p-3 { padding: var(--space-lg); }
.p-4 { padding: var(--space-xl); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* ============================================
   RESPONSIVE UTILITIES
   ============================================ */

/* Mobile menu - hidden by default, shown on mobile when active */
.mobile-menu {
  display: none;
  background: var(--color-bg-secondary);
  padding: 1rem;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-menu.active {
  display: flex;
}

.mobile-menu-item {
  padding: 0.75rem 1rem;
  color: var(--color-text);
  text-decoration: none;
  border-radius: 4px;
  transition: background 0.2s;
}

.mobile-menu-item:hover {
  background: var(--color-bg-active);
}

.mobile-menu-toggle {
  display: block;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

.hide-mobile { display: none !important; }

@media (min-width: 768px) {
  .hide-desktop { display: none !important; }
  .hide-mobile { display: initial !important; }
}

/* Inline links need ~1100px; below that the hamburger drawer carries them */
@media (min-width: 1100px) {
  .mobile-menu-toggle,
  .mobile-menu.active {
    display: none;
  }
}

/* ============================================
   WEATHER PAGE STYLES
   ============================================ */

/* Weather Container */
.weather-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-md);
}

/* Mobile: reduced padding, icon-only brand */
.navbar-brand-text {
  display: none;
}

@media (min-width: 768px) {
  .navbar-brand-text {
    display: inline;
  }

  .weather-container {
    padding: var(--space-lg);
  }
}

/* Search Form */
.search-form {
  margin: var(--space-lg) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.search-row {
  display: flex;
  gap: var(--space-sm);
  align-items: stretch;
}

.search-row-single {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  align-items: stretch;
  width: 100%;
  flex-wrap: wrap;
}

.search-input-wrapper,
.units-select,
.search-button {
  width: 100%;
  flex: none;
}

@media (min-width: 768px) {
  .search-row-single {
    flex-direction: row;
  }

  .search-input-wrapper {
    width: auto;
    flex: 1;
  }

  .units-select {
    width: 4rem;
  }

  .search-button {
    width: auto;
  }
}

.search-input-wrapper {
  position: relative;
  flex: 1;
}

.location-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: #ffffff;
  border: 1px solid var(--color-bg-active);
  border-radius: var(--radius-md);
  color: #282a36;
  font-size: 1rem;
  font-family: var(--font-sans);
  transition: all 0.2s;
}

.location-input:focus {
  outline: none;
  border-color: var(--color-info);
  box-shadow: 0 0 0 3px rgba(139, 233, 253, 0.1);
}

.location-input::placeholder {
  color: var(--color-muted);
}

.units-select {
  flex-shrink: 0;
  width: 4rem;
  padding: 0.75rem 0.5rem;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-bg-active);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.units-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(189, 147, 249, 0.1);
}

.button-row {
  display: flex;
  gap: var(--space-sm);
}

.search-button {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-sans);
  white-space: nowrap;
  flex-shrink: 0;
}

.search-button.primary {
  background: var(--color-bg-secondary);
  color: var(--color-text);
  border: 1px solid var(--color-bg-active);
}

.search-button.primary:hover {
  background: var(--color-bg-active);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.search-button.secondary {
  background: var(--color-info);
  color: var(--color-bg);
}

.search-button.secondary:hover {
  background: #7cdcf4;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.search-button:active {
  transform: translateY(0);
}

.search-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Location Card */
.location-card {
  margin: var(--space-md) 0;
  padding: var(--space-md);
  background: transparent;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.location-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.location-label {
  color: var(--color-info);
  font-weight: 600;
  flex-shrink: 0;
}

.location-value {
  color: var(--color-text);
}

.location-value.location-name {
  color: var(--color-warning);
  font-weight: 600;
}

.location-value.country {
  color: var(--color-success);
}

.location-value.coords {
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.location-value.population {
  color: var(--color-warning);
}

/* Current Weather Display */
.current-weather {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 0;
  background: transparent;
  border-radius: 0;
  margin: var(--space-lg) 0;
  border: none;
  box-shadow: none;
}

@media (min-width: 768px) {
  .current-weather {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--space-xl);
  }
}

.weather-icon {
  font-size: 5rem;
  line-height: 1;
  margin-bottom: var(--space-md);
}

@media (min-width: 768px) {
  .weather-icon {
    font-size: 6rem;
    margin-bottom: 0;
  }
}

.weather-details {
  text-align: left;
  flex: 1;
}

@media (min-width: 768px) {
  .weather-details {
    text-align: left;
    padding-left: 0;
  }
}

.temperature {
  font-size: 2.5rem;
  font-weight: 400;
  color: var(--color-text);
  line-height: 1.2;
  margin-bottom: var(--space-xs);
}

@media (min-width: 768px) {
  .temperature {
    font-size: 3rem;
  }
}

.description {
  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: var(--space-md);
  font-weight: 400;
}

.weather-stats {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-top: 0;
}

.stat {
  color: var(--color-text);
  font-size: 0.875rem;
}

.stat-value {
  color: var(--color-text);
  font-weight: 400;
  margin-left: 0;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-info);
  border-radius: var(--radius-md);
  margin-top: var(--space-xs);
  max-height: 500px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
  box-shadow: var(--shadow-lg);
  display: none;
}

.autocomplete-dropdown.show {
  display: block;
}

.autocomplete-item {
  padding: var(--space-md);
  cursor: pointer;
  border-bottom: 1px solid var(--color-bg-active);
  transition: background 0.15s;
}

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

.autocomplete-item:hover {
  background: var(--color-bg-active);
}

.autocomplete-item .city-name {
  color: var(--color-info);
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.autocomplete-item .location-details {
  color: var(--color-muted);
  font-size: 0.875rem;
}

/* Forecast Section */
.forecast-section {
  margin: var(--space-xl) 0;
}

.forecast-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.forecast-table thead {
  background: var(--color-bg);
}

.forecast-table th {
  padding: var(--space-md);
  text-align: left;
  color: var(--color-info);
  font-weight: 600;
  border-bottom: 2px solid var(--color-bg-active);
}

.forecast-table td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-bg-active);
  vertical-align: middle;
}

.forecast-table .day-header,
.forecast-table .forecast-temp,
.forecast-table .wind-info,
.forecast-table .precipitation {
  white-space: nowrap;
}

.forecast-table tbody tr:last-child td {
  border-bottom: none;
}

.forecast-table tbody tr:hover {
  background: var(--color-bg-active);
}

/* Console Commands */
.console-commands {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.command-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

@media (min-width: 768px) {
  .command-item {
    flex-direction: row;
    align-items: center;
  }
}

.command-item strong {
  flex-shrink: 0;
  min-width: 120px;
}

.code-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.mobile-code {
  background: var(--color-bg-secondary);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  color: var(--color-warning);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  overflow-x: auto;
  display: block;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

@media (min-width: 768px) {
  .mobile-code {
    display: inline-block;
  }
}

.copy-btn {
  background: var(--color-primary);
  color: var(--color-bg);
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s;
  flex-shrink: 0;
  white-space: nowrap;
}

.copy-btn:hover {
  background: var(--color-accent);
  transform: translateY(-1px);
}

.copy-btn:active {
  transform: translateY(0);
}

.copy-btn.copied {
  background: var(--color-success);
}

/* Mobile Forecast Cards */
.mobile-forecast {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Eight columns need ~1024px; below that each day is a card */
@media (min-width: 1024px) {
  .mobile-forecast {
    display: none;
  }
}

.desktop-table {
  display: none;
}

@media (min-width: 1024px) {
  .desktop-table {
    display: table;
  }
}

.forecast-card {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 2px solid var(--color-info);
  box-shadow: var(--shadow-sm);
}

.forecast-card-header {
  color: var(--color-info);
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: var(--space-md);
}

.forecast-card-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.forecast-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.forecast-icon {
  font-size: 3rem;
}

.forecast-temp {
  font-size: 1.5rem;
  font-weight: 600;
  display: flex;
  gap: var(--space-sm);
}

.forecast-details {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  color: var(--color-text);
}

/* ============================================
   PAGE-SPECIFIC STYLES (Extracted from inline)
   ============================================ */

/* ==================== SEVERE WEATHER PAGE ==================== */

.page-header {
  font-size: 2rem;
  margin-bottom: var(--space-sm);
}

.page-subtitle {
  color: var(--color-muted);
}

.page-container {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
}

.severe-weather-header {
  text-align: center;
  margin-bottom: var(--space-xl);
}

.severe-location-form {
  margin: var(--space-lg) 0;
}

.alert-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

.summary-item {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
  border: 1px solid var(--color-bg-active);
}

.summary-count {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-info);
}

.summary-label {
  color: var(--color-muted);
  margin-top: var(--space-sm);
}

.alert-section {
  margin-top: var(--space-xl);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--color-bg-active);
}

.section-icon {
  font-size: 1.5rem;
}

.section-title {
  flex: 1;
  margin: 0 var(--space-sm);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
}

.section-count {
  color: var(--color-success);
  font-weight: 600;
}

.alerts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.alert-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  min-width: 0;
  background: var(--color-bg);
  border: 1px solid var(--color-bg-active);
  border-left: 4px solid var(--color-info);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  overflow-wrap: anywhere;
}

.alert-card.severity-extreme { border-left-color: var(--color-error); }
.alert-card.severity-severe { border-left-color: var(--color-warning); }
.alert-card.severity-moderate { border-left-color: var(--color-primary); }
.alert-card.severity-minor { border-left-color: var(--color-success); }

.alert-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
}

.alert-type {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-warning);
}

.alert-distance {
  background: var(--color-bg-secondary);
  color: var(--color-info);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.alert-event {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--color-warning);
}

.alert-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  margin: 0;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.alert-area {
  margin: 0;
  color: var(--color-text);
}

.alert-headline {
  margin: 0;
  color: var(--color-info);
  font-weight: 600;
}

.alert-details {
  margin-top: auto;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
}

.alert-expand {
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--color-info);
  font-weight: 600;
}

.alert-expand:focus-visible {
  outline: 3px solid var(--color-info);
  outline-offset: 2px;
}

.alert-description,
.alert-instruction {
  margin-top: var(--space-sm);
  white-space: pre-line;
}

@media (min-width: 768px) {
  .alert-meta {
    flex-direction: row;
    gap: var(--space-md);
  }
}

/* Select elements for forms */
.select-input {
  padding: 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid var(--color-bg-active);
  background: var(--color-bg);
  color: var(--color-text);
}

/* Alert detail sections */
.alert-detail__title {
  font-weight: bold;
  margin-bottom: var(--space-sm);
  color: var(--color-primary);
}

.alert-detail__content {
  line-height: 1.6;
}

.alert-detail__instruction-title {
  font-weight: bold;
  margin-top: var(--space-md);
  margin-bottom: var(--space-sm);
  color: var(--color-warning);
}

.alert-detail__expires {
  margin-top: var(--space-md);
  color: var(--color-muted);
}

/* Storm detail specific */
.storm-detail--full-width {
  grid-column: 1 / -1;
}

/* All Clear message */
.all-clear__title {
  color: var(--color-success);
  font-size: 1.75rem;
  margin-bottom: var(--space-md);
}

.all-clear__message {
  margin-top: var(--space-sm);
  color: var(--color-text);
  font-size: 1.125rem;
}

.all-clear__note {
  margin-top: var(--space-md);
  color: var(--color-muted);
}

.all-clear__location-info {
  margin-top: var(--space-md);
  color: var(--color-info);
  font-size: 0.875rem;
}

/* Data source footer */
.data-source-box {
  text-align: center;
  margin-top: var(--space-2xl);
  padding: var(--space-lg);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
}

.data-source-box__primary {
  color: var(--color-muted);
  margin-bottom: var(--space-sm);
}

.data-source-box__meta {
  color: var(--color-muted);
  font-size: 0.875rem;
}

/* ==================== LOCATION DETAILS (Uniform Across All Pages) ==================== */

.location-details-section {
  margin: 1.5rem 0;
  padding: 1rem;
  background-color: var(--color-bg);
  border-radius: 0.5rem;
  border: 1px solid var(--color-bg-secondary);
}

.location-info {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
  margin: 0;
}

@media (min-width: 768px) {
  .location-info {
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  }
}

.location-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  min-width: 0;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
}

.location-detail__label {
  color: var(--color-info);
  font-size: 0.8125rem;
  font-weight: 600;
}

.location-detail__value {
  margin: 0;
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.location-detail__value--name {
  color: var(--color-warning);
}

.location-detail__value--country {
  color: var(--color-success);
}

.location-detail__value--coords {
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}

.location-detail__value--timezone {
  color: var(--color-warning);
}

.location-detail__value--population {
  color: var(--color-primary);
}

/* ==================== MOON PAGE ==================== */

/* Moon form layout */
.moon-form {
  margin: var(--space-md) 0;
  width: 100%;
}

.moon-form__wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.moon-form__row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

/* Mobile: stack moon form rows vertically, side-by-side from 720px up */
.moon-form__input-wrapper,
.moon-form__units,
.moon-form__button,
.moon-form__button--location {
  width: 100%;
}

.moon-form__input-wrapper {
  position: relative;
  flex: 1;
}

.moon-form__input {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.moon-form__units {
  flex-shrink: 0;
}

.moon-form__button {
  flex: 1;
}

.moon-form__button--location {
  flex: 1;
  background-color: var(--color-info);
}

@media (min-width: 768px) {
  .moon-form__row {
    flex-direction: row;
  }

  .moon-form__units {
    width: 5rem;
  }
}

/* Moon weather display */
.moon-weather-icon {
  font-size: 4rem;
}

.moon-temp-display {
  color: var(--color-primary);
}

/* Console section */
.console-section {
  background-color: var(--color-bg);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-bg-secondary);
  margin-top: var(--space-xl);
}

.console-section__title {
  color: var(--color-primary);
  text-align: center;
  margin-top: 0;
}

.console-section__label {
  color: var(--color-success);
}

/* Moon/Sun info boxes */
.info-box {
  background-color: var(--color-bg);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-bg-secondary);
}

.info-box__title {
  color: var(--color-primary);
  margin-top: 0;
  text-align: center;
}

.info-box__title--lunar {
  color: var(--color-primary);
}

.info-box__title--solar {
  color: var(--color-warning);
}

.info-box__content {
  color: var(--color-text);
}

.info-box__item {
  margin: 0.75rem 0;
}

.info-box__label {
  color: var(--color-info);
}

.info-box__value {
  color: var(--color-text);
}

.info-box__value--primary {
  color: var(--color-warning);
}

.info-box__value--green {
  color: var(--color-success);
}

.info-box__value--pink {
  color: var(--color-accent);
}

.info-box__value--orange {
  color: var(--color-warning);
}

.info-box__value--red {
  color: var(--color-error);
}

.info-box__value--cyan {
  color: var(--color-info);
}

.info-box__value--purple {
  color: var(--color-primary);
}

.info-box__value--yellow {
  color: var(--color-warning);
}

/* Grid layouts */
.grid-auto-fit-300 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

/* Moon-specific */
.moon-temp-display {
  color: var(--color-primary);
}

/* Welcome/intro sections */
.welcome-section {
  text-align: center;
  color: var(--color-muted);
  margin: 40px 0;
}

.welcome-section__title {
  color: var(--color-primary);
}

.city-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(120px, 100%), 1fr));
  gap: 10px;
  margin: 20px 0;
}

.city-link {
  color: var(--color-accent);
  text-decoration: none;
  padding: 8px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  display: block;
}

/* ==================== EARTHQUAKE PAGE ==================== */

/* Statistics boxes */
.stat-box {
  background: var(--color-bg);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-bg-secondary);
  text-align: center;
}

.stat-box__value {
  font-size: 2rem;
  font-weight: bold;
}

.stat-box__value--cyan {
  color: var(--color-info);
}

.stat-box__value--orange {
  color: var(--color-warning);
}

.stat-box__value--purple {
  color: var(--color-primary);
}

.stat-box__label {
  color: var(--color-muted);
  margin-top: var(--space-sm);
}

.grid-auto-fit-200 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: var(--space-md);
  margin: var(--space-lg) 0;
}

/* Map */
.map-container {
  height: 600px;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-bg-secondary);
  margin: var(--space-lg) 0;
}

/* Earthquake items */
.earthquake-item {
  background: var(--color-bg);
  padding: var(--space-md);
  margin: var(--space-sm) 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}

.earthquake-item--minor {
  border-left: 4px solid var(--color-success);
}

.earthquake-item--light {
  border-left: 4px solid var(--color-warning);
}

.earthquake-item--moderate {
  border-left: 4px solid var(--color-warning);
}

.earthquake-item--strong {
  border-left: 4px solid var(--color-error);
}

.earthquake-item--tsunami {
  border-left: 4px solid var(--color-info);
}

.magnitude-badge {
  display: inline-block;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  text-align: center;
  line-height: 3rem;
  font-weight: bold;
}

.magnitude-badge--minor {
  background-color: var(--color-success);
}

.magnitude-badge--light {
  background-color: var(--color-warning);
}

.magnitude-badge--moderate {
  background-color: var(--color-warning);
}

.magnitude-badge--strong {
  background-color: var(--color-error);
}

.magnitude-badge--major {
  background-color: var(--color-primary);
}

.eq-info {
  color: var(--color-muted);
  margin-top: 0.25rem;
  font-size: 0.875rem;
}

.eq-details {
  display: none;
  margin-top: var(--space-sm);
  padding: var(--space-sm);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

/* ==================== LOCATION MANAGEMENT ==================== */

.location-manager {
  max-width: 900px;
  margin: 0 auto;
}

.location-manager__header {
  margin-bottom: var(--space-xl);
}

.back-link {
  color: var(--color-info);
  text-decoration: none;
  font-weight: 600;
}

.back-link:hover {
  color: var(--color-primary);
}

.location-tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  border-bottom: 2px solid var(--color-bg-secondary);
  flex-wrap: wrap;
}

.location-tab {
  padding: var(--space-md) var(--space-lg);
  background: transparent;
  border: none;
  color: var(--color-muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  border-bottom: 3px solid transparent;
  transition: all 0.2s ease;
}

.location-tab:hover {
  color: var(--color-text);
}

.location-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.location-tab-content {
  display: none;
}

.location-tab-content.active {
  display: block;
}

.search-results {
  position: relative;
  margin-top: var(--space-sm);
}

.results-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  max-height: 300px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
  box-shadow: var(--shadow-lg);
}

.results-dropdown.active {
  display: block;
}

.result-item {
  padding: var(--space-md);
  cursor: pointer;
  border-bottom: 1px solid var(--color-bg);
  transition: all 0.2s ease;
}

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

.result-item:hover {
  background: var(--color-primary);
  color: var(--color-bg);
}

.result-item:hover .result-details {
  color: var(--color-bg);
  opacity: 0.8;
}

.result-city {
  font-weight: 700;
  color: var(--color-info);
}

.result-item:hover .result-city {
  color: var(--color-bg);
}

.result-details {
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-top: var(--space-xs);
}

.gps-button {
  width: 100%;
  margin-bottom: var(--space-lg);
}

.location-confirm-form {
  margin-top: var(--space-2xl);
  padding-top: var(--space-2xl);
  border-top: 2px solid var(--color-bg-secondary);
}

.result-coords {
  opacity: 0.6;
}

.no-alerts {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-bg-active);
  margin-top: var(--space-2xl);
}

.no-alerts-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
}

/* Earthquake detail view */
.eq-detail-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-lg);
  margin: var(--space-md) 0 var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-bg-secondary);
  border-radius: var(--radius-md);
  flex-wrap: wrap;
}

.eq-detail-nav__link {
  font-weight: 600;
  text-decoration: none;
  color: var(--color-info);
  transition: color 0.2s ease;
}

.eq-detail-nav__link--moon {
  color: var(--color-primary);
}

.eq-detail-nav__link--earthquake {
  color: var(--color-warning);
}

.eq-detail-nav__link:hover {
  color: var(--color-primary);
}

.eq-detail-back-link {
  display: inline-block;
  margin-bottom: var(--space-md);
  color: var(--color-info);
  text-decoration: none;
  font-weight: 600;
}

.eq-detail-back-link:hover {
  color: var(--color-primary);
}

.eq-detail-card {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  border: 1px solid var(--color-bg-active);
}

.eq-detail-title {
  margin: 0;
  padding-left: var(--space-md);
  border-left: 4px solid transparent;
}

.eq-detail-title--cyan { border-left-color: var(--color-info); }
.eq-detail-title--green { border-left-color: var(--color-success); }
.eq-detail-title--yellow { border-left-color: var(--color-warning); }
.eq-detail-title--orange { border-left-color: var(--color-warning); }
.eq-detail-title--red { border-left-color: var(--color-error); }

.eq-detail-summary {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  flex-wrap: wrap;
  margin: var(--space-lg) 0;
}

.eq-magnitude {
  text-align: center;
}

.eq-magnitude__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-bg);
}

.eq-magnitude__badge--minor { background: var(--color-success); }
.eq-magnitude__badge--light { background: var(--color-warning); color: var(--color-bg); }
.eq-magnitude__badge--moderate { background: var(--color-warning); }
.eq-magnitude__badge--strong { background: var(--color-error); }
.eq-magnitude__badge--major { background: var(--color-primary); }

.eq-magnitude__label {
  display: block;
  margin-top: var(--space-sm);
  color: var(--color-muted);
  font-size: 0.875rem;
}

.eq-tsunami-alert {
  background: var(--color-info);
  color: var(--color-bg);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-weight: 700;
}

.eq-detail-grid {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
}

.eq-detail-attribute {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  border: 1px solid var(--color-bg-secondary);
}

.eq-detail-attribute__label {
  color: var(--color-warning);
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.eq-detail-attribute__value {
  color: var(--color-text);
  font-size: 1.1rem;
  font-weight: 600;
}

.eq-detail-attribute__meta {
  margin-top: var(--space-xs);
  color: var(--color-muted);
  font-size: 0.875rem;
}

.eq-detail-map {
  height: 400px;
  margin-top: var(--space-xl);
}

.map-popup {
  color: #1e212a;
  font-family: var(--font-sans);
  line-height: 1.4;
}

.map-popup__title {
  font-size: 1.1rem;
  font-weight: 700;
  display: block;
  margin-bottom: 0.25rem;
}

.map-popup__place {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.map-popup__time {
  font-size: 0.85rem;
  color: #555b6e;
  margin-bottom: 0.25rem;
}

.map-popup__meta {
  font-size: 0.85rem;
  color: #2d3142;
}

.map-popup__warning {
  margin-top: 0.5rem;
  color: #0077b6;
  font-weight: 700;
}

.map-popup__link {
  display: inline-block;
  margin-top: 0.5rem;
  color: #0077b6;
  text-decoration: none;
  font-weight: 600;
}

.map-popup__link:hover {
  color: #023e8a;
}

/* Footer section */
.page-footer {
  text-align: center;
  margin-top: var(--space-2xl);
  padding: var(--space-xl) var(--space-md);
  border-top: 1px solid var(--color-bg-secondary);
  color: var(--color-muted);
}

.page-footer__text {
  margin: var(--space-sm) 0;
  font-size: 0.875rem;
}

.page-footer__links {
  margin: 0;
  font-size: 0.875rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-sm) var(--space-lg);
}

.page-footer__divider {
  color: var(--color-accent);
}

/* ==================== HURRICANE PAGE ==================== */

/* ==================== WEATHER PAGE ==================== */

/* ==================== NOTIFICATIONS PAGE ==================== */

.notifications-container {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-xl);
}

.top-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.filter-tabs {
  display: flex;
  gap: var(--space-sm);
}

.filter-tab {
  padding: 0.5rem 1rem;
  background: var(--color-bg-secondary);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-tab.active {
  background: var(--color-accent);
  color: var(--color-bg);
}

.notification-item {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin: var(--space-md) 0;
  border-left: 4px solid var(--color-info);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.notification-item.unread {
  border-left-color: var(--color-success);
  background: rgba(80, 250, 123, 0.1);
}

.notification-item:hover {
  transform: translateX(5px);
  box-shadow: var(--shadow-md);
}

.notification-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
  gap: var(--space-sm);
}

.notification-title {
  color: var(--color-info);
  font-weight: 600;
  font-size: 1.1rem;
}

.notification-time {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.notification-message {
  color: var(--color-text);
  line-height: 1.6;
}

.notification-actions {
  margin-top: var(--space-sm);
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.notification-type {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.notification-type.alert {
  background: rgba(255, 85, 85, 0.2);
  color: var(--color-error);
}

.notification-type.info {
  background: rgba(139, 233, 253, 0.2);
  color: var(--color-info);
}

.notification-type.success {
  background: rgba(80, 250, 123, 0.2);
  color: var(--color-success);
}

.notification-type.warning {
  background: rgba(241, 250, 140, 0.2);
  color: var(--color-warning);
}

/* Error messages */
.error-box {
  background-color: var(--color-error);
  color: var(--color-bg);
  padding: 10px;
  border-radius: 6px;
  margin: 20px 0;
}

/* Forecast table elements */
.day-header {
  /* Additional styles if needed */
}

.forecast-condition {
  /* Additional styles if needed */
}

.forecast-temp {
  /* Additional styles if needed */
}

.wind-info {
  /* Additional styles if needed */
}

.precipitation {
  /* Additional styles if needed */
}

/* Wind direction */
.wind-direction {
  font-size: 0.75rem;
  color: var(--color-muted);
}

/* Precipitation details */
.precip-prob {
  font-size: 0.75rem;
  color: var(--color-muted);
}

/* ==================== SHARED UTILITY CLASSES ==================== */

/* Color utilities (foreground text) */
.color-primary {
  color: var(--color-primary);
}

.color-cyan {
  color: var(--color-info);
}

.color-yellow {
  color: var(--color-warning);
}

.color-green {
  color: var(--color-success);
}

.color-orange {
  color: var(--color-warning);
}

.color-red {
  color: var(--color-error);
}

.color-pink {
  color: var(--color-accent);
}

.color-comment {
  color: var(--color-muted);
}

.color-foreground {
  color: var(--color-text);
}

/* Display utilities */
.flex-align-center {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.flex-column-gap {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.flex-row-gap {
  display: flex;
  gap: var(--space-sm);
  width: 100%;
}

/* Responsive flex to column */
.flex-column-mobile {
  flex-direction: column;
}

@media (min-width: 768px) {
  .flex-column-mobile {
    flex-direction: revert;
  }
}

/* Margin utilities - refined */
.margin-y-md {
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
}

.margin-y-lg {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-lg);
}

/* Scroll container */
.scroll-container {
  max-height: 600px;
  overflow-y: auto;
}

/* Full-width grid spans */
.grid-span-full {
  grid-column: 1 / -1;
}

/* ==================== HURRICANE PAGE ==================== */

.hurricane-header {
  text-align: center;
  margin: 2rem 0;
}

.storm-count {
  color: var(--color-warning);
  font-size: 1.2rem;
  margin: 1rem 0;
}

.storms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}

.storm-card {
  background: var(--color-bg-secondary);
  border-radius: 0.5rem;
  padding: 1.5rem;
  border-left: 4px solid var(--color-error);
  transition: transform 0.2s;
}

.storm-card:hover {
  transform: translateY(-5px);
}

.storm-card.category-5 {
  border-left-color: var(--color-error);
}

.storm-card.category-4 {
  border-left-color: var(--color-warning);
}

.storm-card.category-3 {
  border-left-color: var(--color-warning);
}

.storm-card.category-2 {
  border-left-color: var(--color-success);
}

.storm-card.category-1 {
  border-left-color: var(--color-info);
}

.storm-card.tropical-storm {
  border-left-color: var(--color-primary);
}

.storm-name {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--color-info);
  margin-bottom: 0.5rem;
}

.storm-classification {
  color: var(--color-warning);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.storm-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1rem 0;
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-label {
  color: var(--color-muted);
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.detail-value {
  color: var(--color-text);
  font-size: 1.1rem;
  font-weight: bold;
}

.storm-location {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--color-bg);
  border-radius: 0.375rem;
}

.storm-update {
  color: var(--color-muted);
  font-size: 0.875rem;
  margin-top: 1rem;
}

.advisory-links {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.advisory-link {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: var(--color-bg);
  text-decoration: none;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  transition: background 0.2s;
}

.advisory-link:hover {
  background: var(--color-accent);
}

.no-storms {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-muted);
}

.no-storms-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.storms-grid,
.storm-details {
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .storms-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
  }

  .storm-details {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==================== DATA SOURCE FOOTER ==================== */

.data-footer {
  text-align: center;
  margin-top: 3rem;
  padding: 2rem 1rem;
  border-top: 1px solid var(--color-bg-secondary);
  color: var(--color-muted);
}

.data-footer__text {
  margin: 0;
  font-size: 0.875rem;
}

.data-footer__link {
  color: var(--color-info);
  text-decoration: none;
}

.data-footer__link:hover {
  color: var(--color-primary);
}

/* ==================== PROFILE PAGE ==================== */

.tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--color-bg);
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.tab {
  padding: 1rem 1.5rem;
  background: var(--color-bg-secondary);
  color: var(--color-text);
  border: none;
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.tab:hover {
  background: var(--color-muted);
}

.tab.active {
  background: var(--color-primary);
  color: white;
}

.tab:focus-visible {
  outline: 3px solid var(--color-info);
  outline-offset: 2px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin-bottom: 2rem;
  padding: 2rem;
  background: var(--color-bg-secondary);
  border-radius: 12px;
}

.profile-avatar-large {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: white;
  font-weight: bold;
}

.profile-info h1 {
  margin: 0 0 0.5rem 0;
  color: var(--color-info);
}

.profile-info p {
  margin: 0.25rem 0;
  color: var(--color-muted);
}

.token-display {
  font-family: 'Courier New', monospace;
  background: var(--color-bg-secondary);
  padding: 1rem;
  border-radius: 8px;
  word-break: break-all;
  font-size: 0.9rem;
}

.activity-item {
  padding: 1rem;
  border-left: 3px solid var(--color-primary);
  background: var(--color-bg-secondary);
  margin-bottom: 1rem;
  border-radius: 4px;
}

.activity-time {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.stat-card {
  background: var(--color-bg-secondary);
  padding: 1.5rem;
  border-radius: 0.5rem;
  border: 1px solid var(--color-primary);
  text-align: center;
  transition: all 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--color-info);
  margin: 0.5rem 0;
}

.stat-label {
  color: var(--color-muted);
  font-size: 0.875rem;
}

/* ============================================
   UTILITY CLASSES (NO INLINE STYLES)
   ============================================ */

/* Text utilities */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.text-comment {
  color: var(--color-muted);
}

.text-error {
  color: var(--color-error);
}

.text-success {
  color: var(--color-success);
}

.text-sm {
  font-size: 0.9rem;
}

/* Display utilities */
.display-none {
  display: none;
}

.overflow-auto {
  overflow-x: auto;
}

/* Spacing utilities */
.padding-2 {
  padding: 2rem;
}

.padding-top-sm {
  padding-top: 0.5rem;
}

.margin-top-sm {
  margin-top: 0.5rem;
}

/* Badge styles */
.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge-admin {
  background: var(--color-error);
  color: white;
}

.badge-user {
  background: var(--color-primary);
  color: white;
}

/* Table utility styles */
.table-full {
  width: 100%;
  border-collapse: collapse;
}

.table-border-bottom {
  border-bottom: 2px solid var(--color-muted);
}

.table-border-row {
  border-bottom: 1px solid var(--color-muted);
}

.table-cell {
  padding: 1rem;
}

.table-cell-right {
  padding: 1rem;
  text-align: right;
}

/* Button utilities */
.btn-delete {
  background: var(--color-error);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.btn-delete:hover {
  opacity: 0.8;
}

/* Loading state utilities */
.loading-text {
  text-align: center;
  color: var(--color-muted);
  padding: 2rem;
}

/* Notification badge */
.notification-badge {
  background: var(--color-error);
  color: white;
  border-radius: 50%;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: bold;
  margin-left: 0.5rem;
}

/* Stat value variations */
.stat-value-success {
  font-size: 1.5rem;
  color: var(--color-success);
}

/* Table cell variations */
.table-cell-mono {
  padding: 1rem;
  font-family: var(--font-mono);
  color: var(--color-info);
}

.table-cell-mono-plain {
  padding: 1rem;
  font-family: var(--font-mono);
}

.table-cell-comment {
  padding: 1rem;
  color: var(--color-muted);
  font-size: 0.9rem;
}

/* Button variations */
.btn-edit {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.btn-edit:hover {
  opacity: 0.8;
}

.btn-revoke {
  background: var(--color-warning);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.btn-revoke:hover {
  opacity: 0.8;
}

/* Table size variations */
.table-small {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

/* Table cell size variations */
.table-cell-sm {
  padding: 0.75rem;
}

.table-cell-sm-mono {
  padding: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.table-cell-sm-cyan {
  padding: 0.75rem;
  color: var(--color-info);
}

.table-cell-sm-comment {
  padding: 0.75rem;
  color: var(--color-muted);
}

/* ============================================
   ADMIN SETTINGS - MOBILE FIRST
   ============================================ */

.settings-category {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.settings-category-title {
  margin: 0 0 var(--space-md) 0;
  color: var(--color-primary);
  font-size: 1.1rem;
}

.settings-grid {
  display: grid;
  gap: var(--space-md);
}

.setting-item {
  background: var(--color-bg);
  border: 1px solid var(--color-muted);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  display: grid;
  gap: var(--space-sm);
}

.setting-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.setting-name {
  font-weight: 600;
  color: var(--color-text);
}

.setting-key {
  font-size: 0.85rem;
  color: var(--color-info);
  font-family: var(--font-mono);
}

.setting-description {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 0.25rem;
}

.setting-value {
  margin-top: var(--space-sm);
}

/* Desktop: side-by-side layout */
@media (min-width: 768px) {
  .setting-item {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .setting-value {
    margin-top: 0;
    min-width: 200px;
  }
}

/* Admin tables - mobile responsive */
.admin-table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Mobile: compact tables, full-size from 720px up */
.table-small {
  font-size: 0.85rem;
}

.table-cell,
.table-cell-sm {
  padding: 0.5rem;
}

.table-cell-mono,
.table-cell-mono-plain {
  font-size: 0.75rem;
}

@media (min-width: 768px) {
  .table-small {
    font-size: 0.9rem;
  }

  .table-cell {
    padding: 1rem;
  }

  .table-cell-sm {
    padding: 0.75rem;
  }

  .table-cell-mono,
  .table-cell-mono-plain {
    font-size: inherit;
  }
}

/* ============================================
   ADMIN HEADER & NAVIGATION (from partials)
   ============================================ */

.admin-header {
    background: var(--color-bg);
    padding: 1.5rem 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--color-bg-secondary);
}

@media (min-width: 768px) {
    .admin-header {
        padding: 2rem;
    }
}

.admin-header-content {
    max-width: 1400px;
    margin: 0 auto;
}

.admin-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.breadcrumb-link {
    color: var(--color-info);
    text-decoration: none;
}

.breadcrumb-link:hover {
    text-decoration: underline;
}

.breadcrumb-separator {
    color: var(--color-muted);
}

.breadcrumb-current {
    color: var(--color-text);
}

.admin-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary);
    margin: 0;
}

@media (min-width: 768px) {
    .admin-page-title {
        font-size: 2rem;
    }
}

.admin-page-description {
    color: var(--color-muted);
    margin: 0.5rem 0 0 0;
    font-size: 1rem;
}

.admin-header-actions {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
}

.admin-nav {
    background: var(--color-bg-secondary);
    border-bottom: 2px solid var(--color-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.admin-nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .admin-nav-container {
        flex-direction: row;
        padding: 0 2rem;
        gap: 2rem;
    }
}

.admin-nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
}

.admin-icon {
    font-size: 1.5rem;
}

.admin-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-primary);
}

.admin-nav-menu {
    display: flex;
    gap: 0.25rem;
    flex: 1;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
}

@media (min-width: 768px) {
    .admin-nav-menu {
        gap: 0.5rem;
        width: auto;
    }
}

@media (min-width: 1200px) {
    .admin-nav-menu {
        gap: 0.5rem;
    }
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    font-size: 0.9rem;
    color: var(--color-text);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
}

@media (min-width: 768px) {
    .admin-nav-link {
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }
}

.admin-nav-link:hover {
    background: rgba(189, 147, 249, 0.1);
    color: var(--color-primary);
}

.admin-nav-link.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    background: rgba(189, 147, 249, 0.05);
}

.nav-icon {
    font-size: 1.1rem;
}

.admin-nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    justify-content: space-between;
    border-top: 1px solid var(--color-muted);
    padding: 1rem 0 0.5rem;
}

@media (min-width: 768px) {
    .admin-nav-user {
        width: auto;
        justify-content: flex-start;
        border-top: none;
        padding: 0.5rem 0;
    }
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.user-name {
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.9rem;
}

.admin-nav-link.logout {
    color: var(--color-error);
    padding: 0.75rem 1rem;
    border-radius: 6px;
}

.admin-nav-link.logout:hover {
    background: rgba(255, 85, 85, 0.1);
}

/* ============================================
   JAVASCRIPT ERROR DISPLAYS (NON-INLINE)
   ============================================ */

.js-error-display-orange {
  background: var(--color-warning);
  color: var(--color-bg);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  margin: 0.5rem 0;
  text-align: center;
  font-size: 0.875rem;
}

/* ============================================
   VISIBILITY UTILITIES
   ============================================ */

.location-form-visible {
  display: block !important;
}

.earthquake-card-hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(139, 233, 253, 0.3);
}

/* ============================================
   SCREEN READER ONLY
   ============================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================
   AUTOCOMPLETE & FORM UTILITIES
   ============================================ */

/* Autocomplete Dropdown Visibility */
.autocomplete-dropdown-visible {
  display: block !important;
}

/* Setup Error Display */
.setup-error-visible {
  display: block !important;
}

/* ============================================
   UTILITY CLASSES
   Per AI.md PART 16: NO inline CSS - use classes
   ============================================ */

/* Display Utilities */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

/* Flex Utilities */
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.align-center { align-items: center !important; }
.align-stretch { align-items: stretch !important; }
.gap-1 { gap: var(--space-sm) !important; }
.gap-2 { gap: var(--space-md) !important; }
.gap-3 { gap: var(--space-lg) !important; }

/* Text Alignment */
.text-left { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* Margin Utilities */
.m-0 { margin: 0 !important; }
.m-1 { margin: var(--space-sm) !important; }
.m-2 { margin: var(--space-md) !important; }
.m-3 { margin: var(--space-lg) !important; }
.m-4 { margin: var(--space-xl) !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--space-sm) !important; }
.mt-2 { margin-top: var(--space-md) !important; }
.mt-3 { margin-top: var(--space-lg) !important; }
.mt-4 { margin-top: var(--space-xl) !important; }
.mt-5 { margin-top: var(--space-2xl) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--space-sm) !important; }
.mb-2 { margin-bottom: var(--space-md) !important; }
.mb-3 { margin-bottom: var(--space-lg) !important; }
.mb-4 { margin-bottom: var(--space-xl) !important; }
.mb-5 { margin-bottom: var(--space-2xl) !important; }

.my-2 { margin-top: var(--space-md) !important; margin-bottom: var(--space-md) !important; }
.my-3 { margin-top: var(--space-lg) !important; margin-bottom: var(--space-lg) !important; }
.my-4 { margin-top: var(--space-xl) !important; margin-bottom: var(--space-xl) !important; }

.mx-auto { margin-left: auto !important; margin-right: auto !important; }

/* Padding Utilities */
.p-0 { padding: 0 !important; }
.p-1 { padding: var(--space-sm) !important; }
.p-2 { padding: var(--space-md) !important; }
.p-3 { padding: var(--space-lg) !important; }
.p-4 { padding: var(--space-xl) !important; }
.p-5 { padding: var(--space-2xl) !important; }

.pt-0 { padding-top: 0 !important; }
.pt-2 { padding-top: var(--space-md) !important; }
.pt-3 { padding-top: var(--space-lg) !important; }

.pb-0 { padding-bottom: 0 !important; }
.pb-2 { padding-bottom: var(--space-md) !important; }
.pb-3 { padding-bottom: var(--space-lg) !important; }

.py-2 { padding-top: var(--space-md) !important; padding-bottom: var(--space-md) !important; }
.py-3 { padding-top: var(--space-lg) !important; padding-bottom: var(--space-lg) !important; }

.px-2 { padding-left: var(--space-md) !important; padding-right: var(--space-md) !important; }
.px-3 { padding-left: var(--space-lg) !important; padding-right: var(--space-lg) !important; }

/* Width Utilities */
.w-full { width: 100% !important; }
.w-auto { width: auto !important; }
.w-50 { width: 50% !important; }
.max-w-sm { max-width: 24rem !important; }
.max-w-md { max-width: 32rem !important; }
.max-w-lg { max-width: 48rem !important; }
.flex-1 { flex: 1 !important; }
.min-w-60 { min-width: 60px !important; }

/* Heading/Section Title Styles */
.section-title {
  color: var(--color-info);
  margin-bottom: var(--space-md);
  font-size: 1.1rem;
}

/* Duration Label Styles */
.duration-label-success { color: var(--color-success); font-weight: bold; min-width: 60px; }
.duration-label-info { color: var(--color-info); font-weight: bold; min-width: 60px; }
.duration-label-warning { color: var(--color-warning); font-weight: bold; min-width: 60px; }

/* Info Box Style */
.info-box-styled {
  background: var(--color-bg-secondary);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-top: var(--space-md);
  border-left: 4px solid var(--color-primary);
}

.info-box-styled p {
  margin: 0;
  color: var(--color-text);
  font-size: 0.9rem;
}

/* Font Size Utilities */
.fs-xs { font-size: 0.75rem !important; }
.fs-sm { font-size: 0.875rem !important; }
.fs-base { font-size: 1rem !important; }
.fs-lg { font-size: 1.125rem !important; }
.fs-xl { font-size: 1.25rem !important; }
.fs-2xl { font-size: 1.5rem !important; }
.fs-3xl { font-size: 2rem !important; }
.fs-4xl { font-size: 3rem !important; }

/* Font Weight Utilities */
.fw-normal { font-weight: 400 !important; }
.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-bold { font-weight: 700 !important; }

/* Text Color Utilities */
.text-muted { color: var(--color-muted) !important; }
.text-primary { color: var(--color-primary) !important; }
.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-danger { color: var(--color-error) !important; }
.text-info { color: var(--color-info) !important; }

/* Background Color Utilities */
.bg-current-line { background-color: var(--color-bg-secondary) !important; }
.bg-selection { background-color: var(--color-bg-active) !important; }

/* Border Utilities */
.border-0 { border: none !important; }
.rounded { border-radius: var(--radius-md) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-full { border-radius: var(--radius-full) !important; }

/* Empty State Styling */
.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--color-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

.empty-state-text {
  margin-top: var(--space-md);
  font-size: 0.875rem;
}

/* Modal Hidden State */
.modal-hidden {
  display: none;
}

/* Back Link Styling */
.back-link {
  text-align: center;
  margin-top: 2.5rem;
  color: var(--color-muted);
}

.back-link a {
  color: var(--color-info);
  text-decoration: none;
}

.back-link a:hover {
  text-decoration: underline;
}

/* ============================================
   ADMIN NOTIFICATION/SETTINGS UTILITIES
   AI.md PART 16: External stylesheets only
   ============================================ */

/* Section styling for admin pages */
.section-title {
  color: var(--color-primary);
  margin-top: 0;
}

.subsection-title {
  color: var(--color-info);
  margin-bottom: var(--space-md);
  font-size: 1.1rem;
}

/* Checkbox/toggle row layout */
.checkbox-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

.checkbox-hint {
  display: block;
  margin-left: var(--space-lg);
}

/* Settings grid for responsive forms */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: var(--space-lg);
}

/* Range slider row */
.slider-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.slider-label {
  min-width: 60px;
  font-weight: bold;
}

.slider-label-success { color: var(--color-success); }
.slider-label-info { color: var(--color-info); }
.slider-label-warning { color: var(--color-warning); }

/* Info/note box */
.note-box {
  background: var(--color-bg-secondary);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  margin-top: var(--space-md);
  border-left: 4px solid var(--color-primary);
}

.note-box p {
  margin: 0;
  color: var(--color-text);
  font-size: 0.9rem;
}

/* Settings form label */
.settings-label {
  display: block;
  margin-bottom: var(--space-sm);
  font-weight: 600;
}

/* Additional display utilities */
.d-block { display: block !important; }
.d-inline-block { display: inline-block !important; }
.d-grid { display: grid !important; }

/* Cursor utilities */
.cursor-pointer { cursor: pointer !important; }

/* Additional margin utilities */
.ml-md { margin-left: var(--space-md) !important; }
.ml-lg { margin-left: var(--space-lg) !important; }
.mr-md { margin-right: var(--space-md) !important; }
.mr-lg { margin-right: var(--space-lg) !important; }

/* Width utilities */
.min-w-60 { min-width: 60px; }
.w-full { width: 100% !important; }

/* Flex utilities for slider/input */
.flex-grow { flex: 1 !important; }

/* Font utilities */
.font-semibold { font-weight: 600 !important; }
.font-bold { font-weight: 700 !important; }
.text-sm { font-size: 0.875rem !important; }
.text-xs { font-size: 0.75rem !important; }

/* Additional padding utilities */
.pt-md { padding-top: var(--space-md) !important; }
.pb-md { padding-bottom: var(--space-md) !important; }
.pl-md { padding-left: var(--space-md) !important; }
.pr-md { padding-right: var(--space-md) !important; }

/* ============================================
   TOR HIDDEN SERVICE STYLES
   AI.md PART 16: External stylesheets only
   ============================================ */

/* Status indicator dot */
.status-indicator {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: var(--space-sm);
}

.status-connected { background: var(--color-success); }
.status-disconnected { background: var(--color-muted); }
.status-error { background: var(--color-error); }

/* Onion address display box */
.onion-address-box {
  background: var(--color-bg);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  margin: var(--space-md) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Vanity generation progress */
.vanity-progress {
  background: var(--color-bg);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  margin-top: var(--space-md);
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.stat-item {
  text-align: center;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--color-primary);
}

.stat-label {
  font-size: 0.875rem;
  color: var(--color-muted);
}

/* Help/info section with cyan border */
.help-section {
  background: var(--color-bg);
  padding: var(--space-lg);
  border-radius: var(--radius-sm);
  margin-top: var(--space-md);
  border-left: 4px solid var(--color-info);
}

/* Status row layout */
.status-row {
  display: flex;
  align-items: center;
  margin: var(--space-md) 0;
}

/* Action buttons row */
.action-row {
  margin-top: var(--space-lg);
}

/* Success message box */
.success-box {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--color-success);
  color: var(--color-bg);
  border-radius: var(--radius-sm);
}

/* Warning text */
.warning-text {
  margin-top: var(--space-md);
  color: var(--color-error);
}

/* Code/pre block styling */
/* Table styling */
.data-table {
  width: 100%;
  margin-top: var(--space-sm);
}

.data-table th,
.data-table td {
  text-align: left;
  padding: var(--space-sm);
}

/* Modal button row */
.modal-actions {
  margin-top: var(--space-lg);
}

/* ============================================
   SSL/TLS CERTIFICATE MANAGEMENT STYLES
   AI.md PART 16: External stylesheets only
   ============================================ */

/* Info grid for certificate details */
.info-grid {
  display: grid;
  gap: 0.75rem;
  margin: var(--space-md) 0;
}

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

@media (min-width: 768px) {
  .info-row {
    grid-template-columns: 140px 1fr;
  }
}

.info-label {
  font-weight: 500;
  color: var(--color-muted);
}

.info-value {
  color: var(--color-text);
  word-break: break-all;
}

/* Status badges for SSL */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 500;
}

.status-active {
  background: rgba(80, 250, 123, 0.2);
  color: var(--color-success);
}

.status-expiring {
  background: rgba(255, 184, 108, 0.2);
  color: var(--color-warning);
}

.status-expired {
  background: rgba(255, 85, 85, 0.2);
  color: var(--color-error);
}

.status-none {
  background: var(--color-bg-active);
  color: var(--color-muted);
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-bg-active);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: var(--space-md) 0;
}

.progress-fill {
  height: 100%;
  background: var(--color-info);
  transition: width 0.3s ease;
}

.progress-fill.success { background: var(--color-success); }
.progress-fill.warning { background: var(--color-warning); }
.progress-fill.danger { background: var(--color-error); }

/* Setup wizard step widths - replaces inline style="width: N%" per the no-inline-styles rule */
.progress-fill--step-1 { width: 16.67%; }
.progress-fill--step-2 { width: 33.33%; }
.progress-fill--step-3 { width: 50%; }
.progress-fill--step-4 { width: 66.67%; }
.progress-fill--step-5 { width: 83.33%; }
.progress-fill--step-6 { width: 100%; }

/* Setup wizard progress */
.setup-progress {
  margin: var(--space-lg) 0;
}

.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-sm);
  font-size: 0.75rem;
}

.progress-steps .step {
  color: var(--color-muted);
  text-align: center;
  flex: 1;
}

.progress-steps .step.active {
  color: var(--color-info);
  font-weight: 600;
}

.progress-steps .step.completed {
  color: var(--color-success);
}

/* Password fields toggle */
.password-fields {
  transition: opacity 0.2s ease;
}

.password-fields.hidden {
  display: none;
}

/* Checkbox label styling */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  padding: var(--space-sm) 0;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-info);
}

/* Setup wizard card */
.setup-card {
  max-width: 500px;
}

/* Token display box */
.token-display {
  margin: var(--space-lg) 0;
}

.token-box {
  display: flex;
  gap: var(--space-sm);
  align-items: stretch;
  margin-top: var(--space-sm);
}

.token-value {
  flex: 1;
  padding: var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-bg-active);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  overflow-x: auto;
}

/* Long values with no adjacent copy button wrap in place instead of overflowing */
.long-string,
.ip-address,
.api-token,
.hash,
.uuid,
.monospace-data {
  word-break: break-all;
  overflow-wrap: break-word;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

/* Onion, I2P, and copy-button values stay on one line and scroll horizontally */
.onion-address,
.i2p-address,
.copy-value {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.btn-copy {
  padding: var(--space-sm) var(--space-md);
  background: var(--color-bg-active);
  color: var(--color-text);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
}

.btn-copy:hover {
  background: var(--color-muted);
}

/* Service options */
.service-option {
  padding: var(--space-md);
  background: var(--color-bg);
  border: 1px solid var(--color-bg-active);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
}

.service-option .checkbox-label.disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.service-status {
  float: right;
}

.sub-options {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-bg-active);
}

.sub-options.hidden {
  display: none;
}

/* Setup skip link */
.setup-skip {
  text-align: center;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-bg-active);
}

.setup-skip a {
  font-size: 0.875rem;
}

/* Checkbox confirm */
.checkbox-confirm {
  margin: var(--space-lg) 0;
  padding: var(--space-md);
  background: var(--color-bg);
  border-radius: var(--radius-sm);
}

/* QR code styling */
.totp-qr {
  text-align: center;
  padding: var(--space-md);
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  margin: var(--space-md) 0;
}

.qr-code {
  max-width: 200px;
  margin: var(--space-md) auto;
  display: block;
}

/* Onion preview */
.onion-preview {
  margin-top: var(--space-sm);
}

/* Renewal schedule */
.renewal-schedule {
  background: var(--color-bg);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  margin: var(--space-md) 0;
}

.schedule-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-bg-active);
}

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

/* Timeline for history */
.timeline {
  position: relative;
  padding-left: 2rem;
  margin: var(--space-lg) 0;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-bg-active);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-lg);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 0.25rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-bg-secondary);
  border: 2px solid var(--color-info);
}

.timeline-item.completed::before {
  background: var(--color-success);
  border-color: var(--color-success);
}

.timeline-item.failed::before {
  background: var(--color-error);
  border-color: var(--color-error);
}

.timeline-title {
  font-weight: 500;
  color: var(--color-text);
}

.timeline-time {
  font-size: 0.85rem;
  color: var(--color-muted);
}

/* Loading spinner */
.loading {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--color-bg-active);
  border-radius: 50%;
  border-top-color: var(--color-primary);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Button group vertical layout */
.btn-group-vertical {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-sm);
}

/* Text utilities for alignment */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }

/* Display none utility */
.d-none { display: none !important; }

/* Button group for inline buttons */
.button-group {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* Toggle switch styles */
.toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
  font-weight: 600;
}

.toggle-input {
  width: 50px;
  height: 26px;
}

/* Action card for database/cache operations */
.action-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  border: 1px solid var(--color-bg-secondary);
  border-radius: var(--border-radius);
  background: var(--color-bg-secondary);
}

.action-info h3 {
  margin: 0 0 var(--space-sm) 0;
  font-size: 1.125rem;
}

.action-info p {
  margin: 0 0 var(--space-sm) 0;
  color: var(--color-muted);
}

.action-info ul {
  margin: 0;
  padding-left: var(--space-md);
  color: var(--color-muted);
  font-size: 0.875rem;
}

.optimization-actions {
  display: grid;
  gap: var(--space-md);
  margin-top: var(--space-sm);
}

/* Position utilities */
.position-relative { position: relative; }
.position-absolute { position: absolute; }

/* Password toggle button */
.btn-toggle-password {
  position: absolute;
  right: var(--space-sm);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.125rem;
  padding: 0;
}

.input-with-toggle {
  padding-right: 2.5rem;
}

/* Alert result for JS feedback */
.alert-result {
  margin-top: var(--space-md);
}

/* Margin Y utilities */
.my-0 { margin-top: 0 !important; margin-bottom: 0 !important; }
.my-1 { margin-top: var(--space-sm) !important; margin-bottom: var(--space-sm) !important; }
.my-2 { margin-top: var(--space-md) !important; margin-bottom: var(--space-md) !important; }
.my-3 { margin-top: var(--space-lg) !important; margin-bottom: var(--space-lg) !important; }
.my-4 { margin-top: var(--space-xl) !important; margin-bottom: var(--space-xl) !important; }

/* Cache status grid */
.cache-status {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

/* Toast notification for JS-created alerts */
.toast-notification {
  position: fixed;
  top: var(--space-md);
  right: var(--space-md);
  z-index: 9999;
  min-width: 300px;
}

/* ============================================
   ADMIN TEMPLATE STYLES
   Extracted from inline style blocks per PART 16
   ============================================ */

/* Code editor textarea */
.code-editor {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background-color: var(--color-bg-secondary);
  border: 1px solid var(--color-bg-active);
  color: var(--color-text);
}

/* Required field indicator */
.required {
  color: var(--color-error);
}

/* Card description subtitle */
.card-description {
  color: var(--color-muted);
  margin-top: var(--space-xs);
  font-size: 0.875rem;
}

/* Margin top utilities */
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--space-sm) !important; }
.mt-2 { margin-top: var(--space-md) !important; }
.mt-3 { margin-top: var(--space-lg) !important; }
.mt-4 { margin-top: var(--space-xl) !important; }

/* Stats grid for admin panels */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.stat-item {
  background: var(--color-bg-secondary);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-xs);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-info);
}

/* Settings form styles */
.settings-form .form-group {
  margin-bottom: var(--space-md);
}

/* Admin card sections */
.admin-card {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
  overflow: hidden;
}

.admin-card .card-header {
  padding: var(--space-md);
  border-bottom: 1px solid var(--color-bg-active);
}

.admin-card .card-body {
  padding: var(--space-md);
}

.admin-card .card-footer {
  padding: var(--space-md);
  border-top: 1px solid var(--color-bg-active);
  background: rgba(0, 0, 0, 0.1);
  font-size: 0.875rem;
}

.admin-card .card-footer p {
  margin: 0 0 var(--space-sm) 0;
}

.admin-card .card-footer p:last-child {
  margin-bottom: 0;
}

/* Admin content area */
.admin-content {
  padding: var(--space-lg);
}

.content-header {
  margin-bottom: var(--space-lg);
}

.content-header h1 {
  margin-bottom: var(--space-xs);
}

.content-header .subtitle {
  color: var(--color-muted);
  margin: 0;
}

/* Admin container layout */
.admin-container {
  display: flex;
  min-height: 100vh;
}

/* Form text help */
.form-text {
  display: block;
  margin-top: var(--space-xs);
  font-size: 0.8125rem;
  color: var(--color-muted);
}

/* Footer link styles */
.footer-link {
  color: var(--color-info);
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
}

/* Nav link styles */
.nav-link {
  color: var(--color-info);
  text-decoration: none;
}

.nav-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Help Page Styles (moved from help.tmpl per AI.md PART 16)
   ========================================================================== */

.help-section {
  border-bottom: 1px solid var(--color-muted);
  padding: 1rem 0;
}

.help-summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-info);
  padding: 0.5rem;
  user-select: none;
}

.help-summary:hover {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
}

.help-content {
  padding: 1rem 1.5rem;
  color: var(--color-text);
}

.help-content ul {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.help-content li {
  margin: 0.5rem 0;
}

/* ==========================================================================
   Health Page Styles (moved from healthz.tmpl per AI.md PART 16)
   ========================================================================== */

.health-container {
  max-width: 1200px;
  margin: 40px auto;
  padding: 20px;
}

.health-header {
  text-align: center;
  margin-bottom: 40px;
}

.health-status {
  font-size: 48px;
  margin: 20px 0;
}

.status-healthy { color: var(--color-success); }
.status-degraded { color: var(--color-warning); }
.status-unhealthy { color: var(--color-error); }

.health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.health-card {
  background: var(--color-bg);
  border: 1px solid var(--color-bg-active);
  border-radius: 8px;
  padding: 20px;
}

.health-card h3 {
  margin: 0 0 15px 0;
  color: var(--color-primary);
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

.check-ok { background: var(--color-success); color: var(--color-bg); }
.check-warning { background: var(--color-warning); color: var(--color-bg); }
.check-error { background: var(--color-error); color: var(--color-text); }
.check-inactive { background: var(--color-muted); color: var(--color-text); }

.metric {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-bg-active);
}

.metric:last-child {
  border-bottom: none;
}

.metric-label {
  color: var(--color-info);
}

.metric-value {
  color: var(--color-text);
  font-weight: bold;
}

.progress-bar {
  width: 100%;
  height: 20px;
  background: var(--color-bg-active);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 5px;
}

.progress-ok { background: var(--color-success); }
.progress-warning { background: var(--color-warning); }
.progress-critical { background: var(--color-error); }

/* ==========================================================================
   History Page Styles (moved from history.tmpl per AI.md PART 16)
   ========================================================================== */

.history-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
}

@media (min-width: 768px) {
  .history-container {
    padding: 2rem;
  }
}

.history-form {
  background: var(--color-bg-secondary);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.stats-summary {
  background: var(--color-bg-secondary);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--color-bg);
  padding: 1.5rem;
  border-radius: 4px;
  border-left: 4px solid var(--color-primary);
}

.stat-card h3 {
  margin: 0 0 0.5rem 0;
  color: var(--color-primary);
  font-size: 0.875rem;
  text-transform: uppercase;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--color-text);
}

.stat-card .label {
  color: var(--color-muted);
  font-size: 0.875rem;
}

.year-data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 2rem;
  background: var(--color-bg-secondary);
  border-radius: 8px;
  overflow: hidden;
}

.year-data-table thead {
  background: var(--color-bg);
}

.year-data-table th {
  padding: 1rem;
  text-align: left;
  color: var(--color-primary);
  font-weight: 600;
}

.year-data-table td {
  padding: 1rem;
  border-top: 1px solid var(--color-muted);
}

.year-data-table tbody tr:hover {
  background: var(--color-bg);
}

.warmest-year {
  background: var(--color-error) !important;
  color: white !important;
}

.coldest-year {
  background: var(--color-info) !important;
  color: var(--color-bg) !important;
}

.wettest-year {
  background: var(--color-muted) !important;
  color: white !important;
}

.year-data-table {
  font-size: 0.875rem;
}

.year-data-table th,
.year-data-table td {
  padding: 0.5rem;
}

@media (min-width: 768px) {
  .year-data-table {
    font-size: 1rem;
  }

  .year-data-table th,
  .year-data-table td {
    padding: 1rem;
  }
}

/* ==========================================================================
   Setup Complete Page Styles (moved from server_setup_complete.tmpl per AI.md PART 16)
   ========================================================================== */

.admin-link {
  display: inline-block;
  margin: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--color-primary);
  color: var(--color-bg);
  text-decoration: none;
  border-radius: 4px;
  font-weight: 500;
  transition: background 0.2s;
}

.admin-link:hover {
  background: #9580ff;
}

.admin-link-secondary {
  background: var(--color-bg-active);
  color: var(--color-text);
}

.admin-link-secondary:hover {
  background: var(--color-muted);
}

.isolation-note {
  margin-top: 2rem;
  padding: 1rem;
  background: rgba(139, 233, 253, 0.1);
  border: 1px solid var(--color-info);
  border-radius: 4px;
  font-size: 0.875rem;
  color: var(--color-info);
}

/* ==========================================================================
   Admin Login Page Styles (moved from login.tmpl per AI.md PART 16)
   ========================================================================== */

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  margin: 0 auto;
}

.login-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-muted);
  border-radius: 8px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-muted);
}

.login-title {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text);
}

.login-subtitle {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-muted);
}

/* ==========================================================================
   Admin Dashboard Styles (moved from dashboard.tmpl per AI.md PART 16)
   ========================================================================== */

.dashboard-header {
  margin-bottom: 2rem;
}

.dashboard-header h1 {
  margin: 0 0 0.5rem 0;
  font-size: 2rem;
  color: var(--color-text);
}

.stat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-icon {
  color: var(--color-primary);
}

.stat-header h3 {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.stat-value.status-ok {
  color: var(--color-success);
}

.stat-value.status-warning {
  color: var(--color-warning);
}

.stat-value.status-error {
  color: var(--color-error);
}

.stat-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.dashboard-section {
  background: var(--color-bg);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--color-muted);
  margin-bottom: 1.5rem;
}

.dashboard-section h2 {
  margin: 0 0 1.5rem 0;
  font-size: 1.25rem;
  color: var(--color-text);
}

/* Additional Login Page Styles */
.form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.form-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.form-checkbox label {
  font-size: 0.875rem;
  color: var(--color-text);
  cursor: pointer;
}

.btn-login {
  width: 100%;
  padding: 0.75rem;
  background: var(--color-primary);
  color: var(--color-bg);
  border: none;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-login:hover {
  background: #9580ff;
}

.btn-login:active {
  background: #7b68ee;
}

.login-footer {
  text-align: center;
  margin-top: 2rem;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.login-info {
  text-align: center;
  margin-bottom: 1.5rem;
  color: var(--color-muted);
  line-height: 1.5;
}

.login-info p {
  margin: 0.5rem 0;
}

.login-help {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-muted);
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-muted);
}

.login-help p {
  margin: 0.25rem 0;
}

.success-box {
  border: 1px solid var(--color-success);
  background: rgba(80, 250, 123, 0.1);
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1.5rem;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.btn-secondary {
  display: block;
  text-align: center;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: var(--color-primary);
  border: 2px solid var(--color-primary);
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: var(--color-primary);
  color: var(--color-bg);
}

/* ==========================================================================
   Additional Dashboard Styles (moved from dashboard.tmpl per AI.md PART 16)
   ========================================================================== */

.resource-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.resource-card {
  background: var(--color-bg-secondary);
  padding: 1rem;
  border-radius: 4px;
}

.resource-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.resource-name {
  color: var(--color-text);
}

.resource-value {
  color: var(--color-primary);
  font-weight: 600;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.activity-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: var(--color-bg-secondary);
  border-radius: 4px;
}

.activity-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.activity-content {
  flex: 1;
}

.activity-message {
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 1rem;
}

/* ==========================================================================
   Admin Web Settings Styles (moved from admin_web.tmpl per AI.md PART 16)
   ========================================================================== */

.web-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.web-section {
  background: var(--color-bg-secondary);
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
}

.web-section h2 {
  margin-top: 0;
  color: var(--color-primary);
}

.btn-view {
  background: var(--color-info);
  color: var(--color-bg);
}

.preview-link {
  margin-top: 0.5rem;
}

.preview-link a {
  color: var(--color-info);
  text-decoration: none;
}

.preview-link a:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Admin Standalone Page Styles (moved from admin templates per AI.md PART 16)
   Templates: admin-scheduler.tmpl, admin-metrics.tmpl, admin-system.tmpl
   ========================================================================== */

/* Admin Page Layout */
.admin-page-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.admin-page-container.wide {
  max-width: 1400px;
}

/* Navigation Links */
.admin-nav-link {
  padding: 0.5rem 1rem;
  background: var(--color-bg-secondary);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--color-text);
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.admin-nav-link:hover {
  background: var(--color-primary);
  color: var(--color-bg);
}

/* Admin Cards */
.admin-page-card {
  background: var(--color-bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.admin-page-card h2 {
  font-size: 1.3rem;
  margin-bottom: 1.5rem;
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
  padding-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Scheduler Task Sections */
.task-section {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-left: 4px solid var(--color-info);
}

.task-section.critical {
  border-left-color: var(--color-error);
  background: rgba(255, 85, 85, 0.1);
}

.task-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.task-category {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 2rem 0 1rem 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-bg-active);
}

/* Warning Badge */
.warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-warning);
  color: var(--color-bg);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-muted);
  transition: 0.4s;
  border-radius: 28px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: var(--color-text);
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--color-success);
}

input:checked + .toggle-slider:before {
  transform: translateX(32px);
}

input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Form Row Grid */
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* Help Text & Icon */
.help-text {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 0.25rem;
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: var(--color-info);
  color: var(--color-bg);
  border-radius: 50%;
  font-size: 0.75rem;
  margin-left: 0.5rem;
  cursor: help;
}

/* Cron Preview */
.cron-preview {
  background: var(--color-bg-active);
  border-left: 3px solid var(--color-info);
  padding: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
}

.cron-preview-title {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.cron-preview-times {
  font-family: var(--font-mono);
  color: var(--color-info);
}

/* Button Group */
.btn-group {
  display: flex;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
}

.btn-group.vertical {
  flex-direction: column;
}

.btn-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Admin Page Alerts */
.admin-alert {
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  display: none;
}

.admin-alert.show {
  display: block;
}

.admin-alert-success {
  background: rgba(80, 250, 123, 0.2);
  color: var(--color-success);
  border: 1px solid var(--color-success);
}

.admin-alert-error {
  background: rgba(255, 85, 85, 0.2);
  color: var(--color-error);
  border: 1px solid var(--color-error);
}

.admin-alert-warning {
  background: rgba(255, 184, 108, 0.2);
  color: var(--color-warning);
  border: 1px solid var(--color-warning);
}

.admin-alert-info {
  background: rgba(139, 233, 253, 0.2);
  color: var(--color-info);
  border: 1px solid var(--color-info);
}

/* Metrics Page Specific Styles */
.metrics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(400px, 100%), 1fr));
  }
}

.metric-preview {
  background: var(--color-bg);
  border: 1px solid var(--color-bg-active);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  max-height: 300px;
  overflow-y: auto;
}

.metric-line {
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--color-bg-active);
}

.metric-line:last-child {
  border-bottom: none;
}

.metric-item {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
}

.metric-info h3 {
  font-size: 1rem;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.metric-info p {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 0;
}

/* Code Block */
.code-block {
  background: var(--color-bg);
  color: var(--color-text);
  padding: 1rem;
  border-radius: var(--radius-md);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: pre;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  margin: 1rem 0;
  border: 1px solid var(--color-bg-active);
}

/* Tabs */
.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--color-bg-active);
  flex-wrap: wrap;
}

.admin-tab {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--color-muted);
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  margin-bottom: -2px;
}

.admin-tab:hover {
  color: var(--color-text);
}

.admin-tab.active {
  color: var(--color-info);
  border-bottom-color: var(--color-info);
}

.admin-tab-content {
  display: none;
}

.admin-tab-content.active {
  display: block;
}

/* Stats Box for Metrics */
.stats-box {
  background: var(--color-bg);
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
}

.stats-box .stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-info);
}

.stats-box .stat-label {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-top: 0.25rem;
}

/* System Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 15px;
}

.info-item {
  padding: 12px;
  border-bottom: 1px solid var(--color-bg-active);
}

.info-label {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
}

.info-value {
  font-size: 0.95rem;
  color: var(--color-text);
  font-weight: 500;
  word-break: break-all;
}

/* Domains Page Specific Styles */
.domains-container {
  max-width: 1200px;
  margin: 20px auto;
  padding: 20px;
}

.domain-card {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-bg-active);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}

.domain-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.domain-name {
  font-size: 1.3em;
  font-weight: bold;
  color: var(--color-text);
}

.domain-status {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.status-badge {
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85em;
  font-weight: 600;
}

.status-verified {
  background: rgba(80, 250, 123, 0.2);
  color: var(--color-success);
}

.status-unverified {
  background: rgba(255, 184, 108, 0.2);
  color: var(--color-warning);
}

.status-active {
  background: rgba(139, 233, 253, 0.2);
  color: var(--color-info);
}

.status-inactive {
  background: rgba(255, 85, 85, 0.2);
  color: var(--color-error);
}

.domain-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 15px;
  margin-bottom: 15px;
  padding: 15px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
}

.detail-item {
  display: flex;
  flex-direction: column;
}

.detail-label {
  font-size: 0.85em;
  color: var(--color-muted);
  margin-bottom: 4px;
}

.detail-value {
  font-weight: 500;
  color: var(--color-text);
}

.domain-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.add-domain-form {
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-bg-active);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 30px;
}

.verification-info {
  background: rgba(139, 233, 253, 0.1);
  border: 1px solid var(--color-info);
  border-radius: var(--radius-md);
  padding: 15px;
  margin-top: 15px;
}

.verification-info h4 {
  margin-top: 0;
  color: var(--color-info);
}

.verification-code {
  background: var(--color-bg);
  border: 1px solid var(--color-info);
  border-radius: var(--radius-md);
  padding: 10px;
  font-family: var(--font-mono);
  margin: 10px 0;
  word-break: break-all;
  color: var(--color-text);
}

.ssl-info {
  background: var(--color-bg);
  padding: 10px;
  border-radius: var(--radius-md);
  font-size: 0.9em;
  margin-top: 10px;
  color: var(--color-muted);
}

/* Loading state */
.loading {
  font-size: 0.9rem;
  color: var(--color-muted);
}

/* Action buttons row */
.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 15px;
}

/* ============================================
   ACCESSIBILITY (WCAG 2.1 AA, from accessibility.css)
   ============================================ */

/* Skip to Main Content Link (Keyboard Navigation) */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #bd93f9;
  color: #282a36;
  padding: 8px 16px;
  text-decoration: none;
  font-weight: bold;
  z-index: 10000;
  border-radius: 0 0 4px 0;
  transition: top 0.3s;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #50fa7b;
  outline-offset: 2px;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Enhanced focus styles for all interactive elements (WCAG 2.4.7 Focus Visible) */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus,
[role="button"]:focus,
[role="menuitem"]:focus {
  outline: 3px solid #50fa7b;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(80, 250, 123, 0.3);
  transition: outline 0.2s, box-shadow 0.2s;
}

/* Remove outline on mouse click (keep for keyboard) */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

/* Enhanced focus-visible for modern browsers */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #50fa7b;
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(80, 250, 123, 0.3);
}

/* Ensure sufficient contrast for text on backgrounds (WCAG AA 4.5:1) */
.text-low-contrast {
  color: #f8f8f2;
  background-color: #282a36;
}

/* Reduced Motion (WCAG 2.3.3 - Animation from Interactions) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  * {
    border-color: currentColor;
  }

  a {
    text-decoration: underline;
    font-weight: bold;
  }

  button {
    border: 2px solid currentColor;
  }
}

/* Form Accessibility */
label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

/* Required field indicator */
[required] + label::after,
label[for] [required]::after {
  content: " *";
  color: #ff5555;
  font-weight: bold;
}

/* Error state */
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: #ff5555;
  border-width: 2px;
}

input[aria-invalid="true"]:focus,
select[aria-invalid="true"]:focus,
textarea[aria-invalid="true"]:focus {
  outline-color: #ff5555;
  box-shadow: 0 0 0 3px rgba(255, 85, 85, 0.3);
}

/* Success state */
input[aria-invalid="false"],
select[aria-invalid="false"],
textarea[aria-invalid="false"] {
  border-color: #50fa7b;
}

/* Loading States (ARIA live regions) */
[aria-busy="true"] {
  cursor: wait;
  opacity: 0.7;
  pointer-events: none;
}

[aria-live="polite"],
[aria-live="assertive"] {
  position: relative;
}

/* Table Accessibility */
th {
  font-weight: bold;
  text-align: left;
  background-color: #44475a;
  color: #f8f8f2;
}

tr:nth-child(even) {
  background-color: rgba(68, 71, 90, 0.3);
}

/*
 * NOTE: accessibility.css previously also had a Dark Mode High Contrast
 * block keyed on [data-theme="dark"] with its own --text-primary/--bg-primary/
 * etc custom properties. A repo-wide search found no template or script that
 * ever sets data-theme="dark" (this project's theme attribute is the
 * html.theme-dark/theme-light/theme-auto class, not a data-theme attribute),
 * so that block was dead code and has been dropped rather than migrated here.
 */

/* Print Styles (Accessibility for printed documents) */
@media print {
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
  }

  nav,
  .skip-link,
  [aria-hidden="true"] {
    display: none;
  }
}

/* Touch Target Size (WCAG 2.1 AAA 2.5.5 - Target Size) */
button,
a,
input[type="checkbox"],
input[type="radio"],
select,
[role="button"],
[role="link"] {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
}

/* Exception for inline text links */
p a,
li a,
span a {
  min-height: auto;
  min-width: auto;
  display: inline;
  padding: 0;
}

/* Keyboard Navigation Indicators */
[role="menu"] [role="menuitem"]:focus,
[role="listbox"] [role="option"]:focus {
  background-color: #bd93f9;
  color: #282a36;
  outline: 2px solid #50fa7b;
}

[tabindex="0"]:focus {
  position: relative;
}

[tabindex="0"]:focus::after {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border: 2px dashed #50fa7b;
  pointer-events: none;
}

/* ============================================
   ADDITIONAL UTILITY CLASSES (from template-overrides.css)
   ============================================ */

.inline-flex {
  display: inline-flex;
}

.flex-shrink-0 {
  flex-shrink: 0;
}

.min-width-0 {
  min-width: 0;
}

.width-full {
  width: 100%;
}

.width-5rem {
  width: 5rem;
}

.margin-y-05 {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.margin-y-1 {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.margin-y-15 {
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.margin-y-2 {
  margin-top: 2rem;
  margin-bottom: 2rem;
}

.margin-y-3 {
  margin-top: 3rem;
  margin-bottom: 3rem;
}

.margin-top-05 {
  margin-top: 0.5rem;
}

.margin-top-1 {
  margin-top: 1rem;
}

.margin-top-15 {
  margin-top: 1.5rem;
}

.margin-top-2 {
  margin-top: 2rem;
}

.margin-top-3 {
  margin-top: 3rem;
}

.margin-bottom-05 {
  margin-bottom: 0.5rem;
}

.margin-bottom-1 {
  margin-bottom: 1rem;
}

.margin-bottom-15 {
  margin-bottom: 1.5rem;
}

.margin-bottom-2 {
  margin-bottom: 2rem;
}

.margin-0 {
  margin: 0;
}

.padding-1 {
  padding: 1rem;
}

.padding-15 {
  padding: 1.5rem;
}

.padding-3 {
  padding: 3rem;
}

.gap-025 {
  gap: 0.25rem;
}

.gap-05 {
  gap: 0.5rem;
}

.gap-075 {
  gap: 0.75rem;
}

.gap-15 {
  gap: 1.5rem;
}

.bg-color-bg {
  background-color: var(--color-bg);
}

.bg-color-bg-secondary {
  background-color: var(--color-bg-secondary);
}

.border-color-bg-secondary {
  border-color: var(--color-bg-secondary);
}

.border-1 {
  border-width: 1px;
  border-style: solid;
}

.border-radius-05 {
  border-radius: 0.5rem;
}

.border-radius-0375 {
  border-radius: 0.375rem;
}

.border-radius-06 {
  border-radius: 6px;
}

.border-radius-08 {
  border-radius: 8px;
}

.border-top-1 {
  border-top: 1px solid;
}

.border-bottom-1 {
  border-bottom: 1px solid;
}

.border-bottom-2 {
  border-bottom: 2px solid;
}

.overflow-x-auto {
  overflow-x: auto;
}

.font-size-0875 {
  font-size: 0.875rem;
}

.font-size-09 {
  font-size: 0.9rem;
}

.font-size-08125 {
  font-size: 0.8125rem;
}

.line-height-16 {
  line-height: 1.6;
}

.whitespace-nowrap {
  white-space: nowrap;
}

.opacity-06 {
  opacity: 0.6;
}

.font-monospace {
  font-family: monospace;
}

.word-break-all {
  word-break: break-all;
}

/* ==========================================================================
   USER SETTINGS PAGES
   ========================================================================== */

.settings-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.settings-nav-item {
  padding: var(--space-sm) var(--space-md);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
  transition: all 0.2s ease;
}

.settings-nav-item:hover {
  background: var(--color-bg-hover);
  border-color: var(--color-border-hover);
}

.settings-nav-item.active {
  background: var(--color-primary-bg);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-lg) 0;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.radio-label input[type="radio"],
.toggle-item input[type="checkbox"],
.visibility-option input[type="radio"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* Toggle lists (notifications, privacy) */

.toggle-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.toggle-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-card);
}

.toggle-item.disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.toggle-content {
  flex: 1;
}

.toggle-content strong {
  display: inline-block;
  color: var(--color-text);
}

.toggle-content p {
  margin: var(--space-xs) 0 0;
  color: var(--color-muted);
  font-size: 0.875rem;
}

.badge-locked {
  display: inline-block;
  margin-inline-start: var(--space-sm);
  padding: 0.125rem var(--space-sm);
  border-radius: var(--radius-full);
  background: var(--color-warning-bg);
  color: var(--color-warning);
  font-size: 0.75rem;
}

/* Profile visibility options */

.visibility-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.visibility-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  min-height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-card);
  cursor: pointer;
  transition: all 0.2s ease;
}

.visibility-option:hover {
  border-color: var(--color-border-hover);
  background: var(--color-bg-hover);
}

.visibility-option.selected,
.visibility-option:has(input[type="radio"]:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-bg);
}

.visibility-content p {
  margin: var(--space-xs) 0 0;
  color: var(--color-muted);
  font-size: 0.875rem;
}

/* Theme picker */

.theme-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  cursor: pointer;
}

.theme-option input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.theme-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100px;
  height: 100px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  transition: all 0.2s ease;
}

.theme-preview:hover,
.theme-option.selected .theme-preview,
.theme-option:has(input[type="radio"]:checked) .theme-preview,
.theme-option input[type="radio"]:focus-visible + .theme-preview {
  border-color: var(--color-primary);
  transform: scale(1.05);
}

.theme-preview--dark {
  background: #282a36;
  color: #f8f8f2;
}

.theme-preview--light {
  background: #f8f8f2;
  color: #282a36;
}

.theme-preview--auto {
  background: linear-gradient(135deg, #282a36 50%, #f8f8f2 50%);
  color: #50fa7b;
}

.theme-icon {
  font-size: 2rem;
}

/* API tokens */

.token-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-card);
  margin-bottom: var(--space-sm);
}

.token-info {
  flex: 1;
  min-width: 0;
}

.token-name {
  font-weight: 600;
  color: var(--color-text);
  overflow-wrap: break-word;
}

.token-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
  font-size: 0.875rem;
  color: var(--color-muted);
}

.token-prefix {
  font-family: var(--font-mono);
  color: var(--color-primary);
  word-break: break-all;
}

.token-scopes {
  color: var(--color-info);
}

.token-dates {
  margin-top: var(--space-xs);
  font-size: 0.8125rem;
  color: var(--color-muted);
}

.token-dates span {
  margin-inline-end: var(--space-md);
}

.token-display {
  display: flex;
  gap: var(--space-sm);
  margin: var(--space-md) 0;
}

.token-display input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  word-break: break-all;
}

.info-content ul {
  margin: var(--space-sm) 0 0;
  padding-inline-start: var(--space-lg);
}

.info-content li {
  margin-bottom: var(--space-xs);
  color: var(--color-muted);
}

/* Two-factor authentication */

#qrCodeContainer img {
  max-width: 200px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
}

#recoveryKeysContainer {
  padding: var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-secondary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.recovery-key {
  padding: var(--space-sm);
  margin: 0.25rem 0;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  word-break: break-all;
}

.margin-y-sm {
  margin-top: var(--space-sm);
  margin-bottom: var(--space-sm);
}

/* ==========================================================================
   AUTH PAGES (login, register, passkey, setup)
   ========================================================================== */

.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-md);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: var(--space-2xl);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg-card);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-card h1 {
  margin: 0 0 var(--space-sm);
  font-size: 1.5rem;
  color: var(--color-text);
}

.auth-subtitle,
.auth-message {
  margin-bottom: var(--space-lg);
  color: var(--color-muted);
  font-size: 0.95rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  text-align: start;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-lg);
  font-size: 0.9rem;
}

.auth-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--color-primary);
}

.auth-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
}

/* Selectable and wrapping text helpers (AI.md PART 16 "Long Strings") */
.select-all {
  user-select: all;
}

.break-all {
  overflow-wrap: anywhere;
  word-break: break-all;
}

.pre-wrap {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

pre.select-all {
  overflow-x: auto;
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.table-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

/* Long inline code (identifiers, URLs) wraps instead of widening the page */
code {
  overflow-wrap: anywhere;
}
