/* 
 * flatpack.help - Global Theme Stylesheet
 * 
 * Contains shared variables, typography, navigation, layout components, 
 * and utility classes used across all administrative and customer portals.
 */

:root {
  --bg: #f8fafc;
  --bg-hover: #f1f5f9;
  --bg-alt: #f1f5f9;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --surface-subtle: #f8fafc;
  --surface-light: #f1f5f9;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --border-dark: #cbd5e1;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-rgb: 37, 99, 235;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --danger-border: #fee2e2;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --warning-border: #fcd34d;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  color-scheme: light;

  /* Theme-aware timeline backgrounds */
  --timeline-note-bg: #fffbeb;
  --timeline-note-border: #fef08a;
  --timeline-email-bg: #eff6ff;
  --timeline-email-border: #bfdbfe;
  --timeline-system-bg: #f0fdf4;
  --timeline-system-border: #bbf7d0;
  --timeline-inbound-bg: #ecfeff;
  --timeline-inbound-border: #a5f3fc;
  --timeline-fitter-bg: #faf5ff;
  --timeline-fitter-border: #e9d5ff;
}

:root[data-theme='dark'] {
  --bg: #0b0f19;
  --bg-hover: #111726;
  --bg-alt: #111827;
  --surface: #161f30;
  --surface-hover: #1e293f;
  --surface-subtle: #111724;
  --surface-light: #202d44;
  --border: rgba(255, 255, 255, 0.09);
  --border-light: rgba(255, 255, 255, 0.05);
  --border-dark: rgba(255, 255, 255, 0.16);
  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.16);
  --primary-rgb: 59, 130, 246;
  --text: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.12);
  --success-border: rgba(52, 211, 153, 0.28);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.12);
  --danger-border: rgba(248, 113, 113, 0.28);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.12);
  --warning-border: rgba(251, 191, 36, 0.28);
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.35), 0 1px 2px -1px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;

  /* Theme-aware timeline backgrounds in dark mode */
  --timeline-note-bg: rgba(245, 158, 11, 0.12);
  --timeline-note-border: rgba(245, 158, 11, 0.25);
  --timeline-email-bg: rgba(59, 130, 246, 0.12);
  --timeline-email-border: rgba(59, 130, 246, 0.25);
  --timeline-system-bg: rgba(16, 185, 129, 0.12);
  --timeline-system-border: rgba(16, 185, 129, 0.25);
  --timeline-inbound-bg: rgba(6, 182, 212, 0.12);
  --timeline-inbound-border: rgba(6, 182, 212, 0.25);
  --timeline-fitter-bg: rgba(168, 85, 247, 0.12);
  --timeline-fitter-border: rgba(168, 85, 247, 0.25);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0b0f19;
    --bg-hover: #111726;
    --bg-alt: #111827;
    --surface: #161f30;
    --surface-hover: #1e293f;
    --surface-subtle: #111724;
    --surface-light: #202d44;
    --border: rgba(255, 255, 255, 0.09);
    --border-light: rgba(255, 255, 255, 0.05);
    --border-dark: rgba(255, 255, 255, 0.16);
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --primary-light: rgba(59, 130, 246, 0.16);
    --primary-rgb: 59, 130, 246;
    --text: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --success: #34d399;
    --success-bg: rgba(52, 211, 153, 0.12);
    --success-border: rgba(52, 211, 153, 0.28);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.12);
    --danger-border: rgba(248, 113, 113, 0.28);
    --warning: #fbbf24;
    --warning-bg: rgba(251, 191, 36, 0.12);
    --warning-border: rgba(251, 191, 36, 0.28);
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.35), 0 1px 2px -1px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 72px;

    /* Theme-aware timeline backgrounds in dark mode prefers */
    --timeline-note-bg: rgba(245, 158, 11, 0.12);
    --timeline-note-border: rgba(245, 158, 11, 0.25);
    --timeline-email-bg: rgba(59, 130, 246, 0.12);
    --timeline-email-border: rgba(59, 130, 246, 0.25);
    --timeline-system-bg: rgba(16, 185, 129, 0.12);
    --timeline-system-border: rgba(16, 185, 129, 0.3);
    --timeline-inbound-bg: rgba(6, 182, 212, 0.15);
    --timeline-inbound-border: rgba(6, 182, 212, 0.3);
    --timeline-fitter-bg: rgba(168, 85, 247, 0.15);
    --timeline-fitter-border: rgba(168, 85, 247, 0.3);
  }
}

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

:root {
  --font-family: 'Figtree', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html {
  overflow-x: hidden;
  scrollbar-gutter: stable;
  max-width: 100%;
}

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  overflow-x: hidden;
  max-width: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  button, input, select, textarea, .btn, a.btn {
    touch-action: manipulation;
  }
}

/* ── Pure HTML Logo Styles ── */
.logo-html {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.logo-emoji {
  display: inline-block;
  transform-origin: bottom center;
  font-size: 1.8rem;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
  transition: all 0.2s ease;
  user-select: none;
}

.logo-emoji svg {
  display: block;
  width: 26px;
  height: 26px;
}

.logo-text-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
}

.logo-title {
  font-family: var(--font-family);
  font-size: 1.35rem;
  font-weight: 850;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}

.logo-tm {
  font-weight: 300 !important;
  font-size: 0.55em;
  vertical-align: super;
  margin-left: 1px;
}

.logo-tagline {
  font-family: var(--font-family);
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-align: left;
}

.logo-admin-badge,
.logo-portal-badge {
  font-size: 0.65em;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 6px;
  letter-spacing: normal;
}

.logo-html:hover .logo-emoji:not(.logo-loading) {
  animation: logo-hover-wiggle 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

.logo-emoji.logo-loading {
  animation: logo-loading-wiggle 1.2s ease-in-out infinite;
}

@keyframes logo-loading-wiggle {
  0% {
    transform: rotate(0deg) translateY(0);
  }
  25% {
    transform: rotate(-8deg) translateY(-2px) scale(1.04);
  }
  50% {
    transform: rotate(0deg) translateY(0);
  }
  75% {
    transform: rotate(8deg) translateY(-2px) scale(1.04);
  }
  100% {
    transform: rotate(0deg) translateY(0);
  }
}

@keyframes logo-hover-wiggle {
  0% {
    transform: rotate(0deg) scale(1);
  }
  30% {
    transform: rotate(-15deg) scale(1.1);
  }
  60% {
    transform: rotate(10deg) scale(1.1);
  }
  100% {
    transform: rotate(0deg) scale(1);
  }
}

/* ── Sidebar Navigation ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  height: 100vh;
  position: sticky;
  top: 0;
  display: none; /* Controlled by JS or active state */
  flex-direction: column;
  flex-shrink: 0;
  z-index: 100;
  transition:
    transform 0.3s ease,
    width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-close {
  display: none;
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
}

.sidebar-header {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.sidebar.collapsed .sidebar-header {
  padding: 0;
  justify-content: center;
}

.sidebar-desktop-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.sidebar-desktop-toggle:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.sidebar-desktop-toggle .icon-expand {
  display: none !important;
}
.sidebar-desktop-toggle .icon-collapse {
  display: block !important;
}
.sidebar.collapsed .sidebar-desktop-toggle .icon-expand {
  display: block !important;
}
.sidebar.collapsed .sidebar-desktop-toggle .icon-collapse {
  display: none !important;
}

.sidebar.collapsed .logo-text-group,
.sidebar.collapsed .nav-link-text,
.sidebar.collapsed .user-info {
  display: none;
}

.sidebar.collapsed .nav-link {
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0 auto;
  justify-content: center;
}

.sidebar.collapsed .sidebar-desktop-toggle {
  width: 44px;
  height: 44px;
  padding: 0;
  margin: 0 auto;
  justify-content: center;
  border-radius: var(--radius);
}

.sidebar.collapsed .logo-html {
  display: none;
}

.sidebar.collapsed .sidebar-header {
  border-bottom: 1px solid var(--border);
}

.sidebar.collapsed .sidebar-footer {
  padding: 16px 0;
  display: flex;
  justify-content: center;
}

.sidebar.collapsed .user-profile {
  justify-content: center;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  background: none !important;
  border: none !important;
  width: 100%;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  outline: none !important;
  text-align: left;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

button.nav-link {
  background: transparent !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.nav-link:focus {
  outline: none;
}

.nav-link svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.metric-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  max-width: 28px;
  max-height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
}

.metric-icon svg {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  display: block;
}

.nav-link:hover {
  background: var(--surface-hover) !important;
  color: var(--text);
}

.nav-link:hover svg {
  color: var(--text-secondary);
}

.nav-link.active {
  background: var(--primary-light) !important;
  color: var(--primary);
}

.nav-link.active svg {
  color: var(--primary);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: transparent;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  overflow: hidden;
}

.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* ── Topbar Navigation ── */
.topbar {
  height: 64px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: none;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-mobile-title {
  display: none;
}

.btn-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 8px;
  margin-right: 8px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 95;
}

@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    z-index: 1000;
  }
  .sidebar.active {
    transform: translateX(0);
  }
  .sidebar-close {
    display: block;
  }
  .sidebar-desktop-toggle {
    display: none !important;
  }
  .btn-hamburger {
    display: block;
  }
  .sidebar.active + .sidebar-overlay {
    display: block;
  }
  .topbar {
    display: flex;
  }
  .topbar .logo-html {
    display: none;
  }
}

/* ── Main Layout Containers ── */
.page-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page-wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg {
  color: var(--primary);
}

/* ── Typography & Forms ── */
label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}

.form-group {
  margin-bottom: 16px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: all 0.15s ease;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input[readonly] {
  background: var(--bg);
  cursor: default;
}

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

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  text-decoration: none;
}

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

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

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

.btn-primary:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: var(--surface-hover);
  color: var(--text);
}

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

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

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

.btn-warning:hover {
  background: var(--warning);
  border-color: var(--warning);
  color: #ffffff;
}

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

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

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 0.675rem;
}

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

.btn-success:hover {
  background: #059669;
  color: #ffffff;
}

/* ── Data Tables ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table th {
  background: var(--bg);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}

.data-table tr:hover {
  background: var(--surface-hover);
}

.data-table th.sortable {
  cursor: pointer;
  position: relative;
  padding-right: 24px;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}

.data-table th.sortable:hover {
  background: var(--surface-hover);
  color: var(--primary);
}

.data-table th.sortable::after {
  content: '↕';
  position: absolute;
  right: 10px;
  opacity: 0.3;
  font-size: 0.8rem;
}

/* ── Status Pills & Badges ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
}

.pill-success {
  background: var(--success-bg);
  color: var(--success);
}
.pill-danger {
  background: var(--danger-bg);
  color: var(--danger);
}
.pill-warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.pill-primary {
  background: var(--primary-light);
  color: var(--primary);
}

/* ── Alert Banners ── */
.alert-banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  display: none;
  align-items: center;
  gap: 10px;
  border: 1px solid;
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  animation: alertSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.alert-banner.success {
  background: var(--success-bg);
  border-color: var(--success-border);
  color: var(--success);
}

.alert-banner.error {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

/* ── Skeleton Loaders ── */
.skeleton-box {
  background: linear-gradient(90deg, var(--surface-hover) 25%, var(--border-light) 50%, var(--surface-hover) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s infinite;
  border-radius: 4px;
}

.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: 8px;
}

@keyframes skeleton-pulse {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ── Loading Screens ── */
.gate-screen {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.gate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.gate-icon.loading {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  background: var(--primary-light);
  border: 3px solid transparent;
  border-top-color: var(--primary);
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

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

/* ── Auto-save Toasts ── */
.auto-save-status {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 9999px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  z-index: 9999;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.auto-save-status.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.auto-save-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ── Scrollbars ── */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Mobile Typography Optimization (Smaller text, headings, and toasts on mobile viewports) */
@media (max-width: 768px) {
  html {
    font-size: 15px !important;
  }

  /* Pin header logo and footer text sizes to keep them unchanged */
  .logo-title {
    font-size: 22.4px !important;
  }
  .logo-tagline {
    font-size: 8.8px !important;
  }
  .main-header .logo-subtext {
    font-size: 8.8px !important;
  }

  /* Explicit overrides for toasts/alerts */
  #portfolio-toast,
  .auto-save-status,
  .toast,
  .alert-toast,
  .portfolio-modal-toast {
    font-size: 0.8rem !important;
    padding: 8px 16px !important;
  }
}

@media (max-width: 576px) {
  html {
    font-size: 14px !important;
  }

  /* Headings size optimization */
  h1 {
    font-size: 1.6rem !important;
  }
  h2 {
    font-size: 1.3rem !important;
  }
  h3 {
    font-size: 1.1rem !important;
  }
  h4 {
    font-size: 0.95rem !important;
  }

  /* Keep logo title / slogan text readable and original size */
  .logo-title {
    font-size: 22.4px !important;
  }
  .logo-tagline {
    font-size: 8.8px !important;
  }
  .main-header .logo-subtext {
    font-size: 8.8px !important;
  }

  /* Toast messages even slightly smaller on small viewports */
  #portfolio-toast,
  .auto-save-status,
  .toast,
  .alert-toast,
  .portfolio-modal-toast {
    font-size: 0.78rem !important;
    padding: 6px 12px !important;
    bottom: 16px !important;
  }
}

/* Premium Image load fallback and shimmer-pulse animations */
.image-error-fallback {
  object-fit: contain !important;
  background: rgba(148, 163, 184, 0.05) !important;
  border: 1px dashed rgba(148, 163, 184, 0.2) !important;
  animation: pulseBroken 2.5s infinite ease-in-out;
  padding: 12% !important;
  box-sizing: border-box !important;
}

/* Wall guide subtle link and mobile tooltip icon styling */
.wall-guide-btn {
  all: unset;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer;
  color: var(--text-muted, #94a3b8) !important;
  font-size: 0.75rem !important;
  font-weight: 400 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  text-decoration: none !important;
  line-height: 1.3 !important;
  white-space: nowrap !important;
}
.wall-guide-desktop-text {
  font-size: 0.75rem !important;
  font-weight: 400 !important;
  color: var(--text-muted, #94a3b8) !important;
}
.wall-guide-btn:hover {
  color: var(--text-secondary, #64748b) !important;
}

@media (max-width: 640px) {
  .wall-guide-btn {
    font-size: 0.725rem !important;
  }
  .wall-guide-desktop-text {
    font-size: 0.725rem !important;
  }
  .dropzone-text-label {
    display: none !important;
  }
  .space-photo-desc {
    display: none !important;
  }
}

/* Specific scaling override for small fitter job photo thumbnails in table view */
.fitter-job-photo-thumb.image-error-fallback {
  padding: 4px !important;
}

/* Scaling override for attachment thumbnails in details modal and galleries */
.attachment-thumb img.image-error-fallback {
  padding: 12px !important;
}

/* Toned down attachments thumbnails when inactive/not hovered */
.attachment-thumb {
  position: relative;
  transition:
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.2s ease,
    box-shadow 0.2s ease !important;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.attachment-thumb img {
  opacity: 0.65;
  filter: grayscale(15%) contrast(95%) brightness(90%);
  transition:
    opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    filter 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.attachment-thumb[style*='background-image'] {
  background-blend-mode: multiply;
  background-color: rgba(15, 23, 42, 0.35); /* Toned down overlay */
  transition:
    background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.2s ease,
    box-shadow 0.2s ease !important;
}

/* Hover and active states */
.attachment-thumb:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12) !important;
}

.attachment-thumb:hover img,
.attachment-thumb.active img {
  opacity: 1 !important;
  filter: grayscale(0%) contrast(100%) brightness(100%) !important;
}

.attachment-thumb:hover[style*='background-image'],
.attachment-thumb.active[style*='background-image'] {
  background-color: transparent !important;
}

@keyframes pulseBroken {
  0% {
    opacity: 0.75;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.75;
  }
}

/* ── Postcode Autocomplete & Validation ── */
.zip-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 0;
}

.zip-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 150;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 4px;
  padding: 4px 0;
}

.zip-suggestions.hidden,
.zip-suggestions:empty {
  display: none !important;
}

.zip-suggestion-item {
  padding: 8px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.zip-suggestion-item:hover {
  background-color: var(--surface-hover);
  color: var(--primary);
}

.zip-validation-msg {
  font-size: 0.78rem;
  font-weight: 700;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 18px;
}

.form-input.cust-postcode-error {
  border-color: var(--danger) !important;
  background-color: var(--danger-bg) !important;
}

.form-input.cust-postcode-error:focus {
  box-shadow: 0 0 0 3px var(--danger-border) !important;
}

/* Hide validation message when suggestions are active */
.form-group:has(.zip-suggestions:not(.hidden)) .zip-validation-msg {
  display: none !important;
}

/* ── Hierarchical Settings Sidebar Navigation ── */
.settings-layout {
  display: flex;
  gap: 24px;
  width: 100%;
  align-items: flex-start;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.settings-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  position: sticky;
  top: 80px;
}

.settings-sidebar.collapsed {
  width: 72px;
}

.settings-sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 57px;
}

.settings-sidebar.collapsed .settings-sidebar-header {
  padding: 18px 10px;
  justify-content: center;
}

.settings-sidebar-title {
  font-size: 0.95rem;
  font-weight: 750;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.settings-sidebar.collapsed .settings-sidebar-title {
  display: none;
}

.settings-sidebar-nav {
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-grow: 1;
}

.settings-nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.settings-group-header {
  width: 100%;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.2s ease;
  outline: none;
  text-align: left;
}

.settings-group-header:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.settings-sidebar.collapsed .settings-group-header {
  padding: 12px;
  justify-content: center;
}

.settings-group-title-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-group-header .settings-icon {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.settings-group-header:hover .settings-icon,
.settings-nav-group.expanded .settings-group-header .settings-icon {
  color: var(--primary);
}

.settings-group-title {
  white-space: nowrap;
  transition: opacity 0.2s ease;
}

.settings-sidebar.collapsed .settings-group-title {
  display: none;
}

.settings-group-header .settings-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.settings-nav-group.expanded .settings-group-header .settings-chevron {
  transform: rotate(90deg);
}

.settings-sidebar.collapsed .settings-group-header .settings-chevron {
  display: none;
}

/* Bracket styling for nested items */
.settings-subpages {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: 20px;
  padding-left: 12px;
  border-left: 1.5px solid var(--border);
  position: relative;
  transition: all 0.2s ease;
}

.settings-nav-group:not(.expanded) .settings-subpages {
  display: none;
}

.settings-sidebar.collapsed .settings-subpages {
  display: none !important;
}

.settings-subpage-btn {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius);
  transition: all 0.2s ease;
  position: relative;
  outline: none;
  white-space: nowrap;
}

.settings-subpage-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.settings-subpage-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 650;
}

/* Accent dot positioned precisely on the left bracket track border */
.settings-subpage-btn.active::before {
  content: '';
  position: absolute;
  left: -12.75px;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  z-index: 2;
  animation: settings-dot-scale 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes settings-dot-scale {
  from {
    transform: translate(-50%, -50%) scale(0);
  }
  to {
    transform: translate(-50%, -50%) scale(1);
  }
}

.settings-sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.settings-sidebar.collapsed .settings-sidebar-footer {
  justify-content: center;
  padding: 12px 10px;
}

.settings-sidebar-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.settings-sidebar-toggle-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--text-muted);
}

.settings-sidebar-toggle-btn svg {
  transition: transform 0.3s ease;
}

.settings-sidebar.collapsed .settings-sidebar-toggle-btn svg {
  transform: rotate(180deg);
}

.settings-content {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Responsive Overrides */
@media (max-width: 900px) {
  .settings-layout {
    flex-direction: column;
    gap: 16px;
  }

  .settings-sidebar {
    width: 100% !important;
    position: static;
  }

  .settings-sidebar.collapsed {
    width: 100% !important;
  }

  .settings-sidebar-header {
    cursor: pointer;
  }

  .settings-sidebar-header::after {
    content: '▼';
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
  }

  .settings-sidebar-header.mobile-expanded::after {
    transform: rotate(180deg);
  }

  .settings-sidebar-nav {
    display: none;
    border-top: 1px solid var(--border);
  }

  .settings-sidebar-header.mobile-expanded + .settings-sidebar-nav {
    display: flex;
  }

  .settings-sidebar-footer {
    display: none !important;
  }

  .settings-sidebar.collapsed .settings-sidebar-title {
    display: block !important;
  }

  .settings-sidebar.collapsed .settings-group-title {
    display: block !important;
  }

  .settings-sidebar.collapsed .settings-group-header .settings-chevron {
    display: block !important;
  }

  .settings-sidebar.collapsed .settings-subpages {
    display: flex !important;
  }
}

/* ── Click to Reveal Masked Details ── */
.revealable {
  cursor: pointer;
  border-bottom: 1px dashed var(--text-muted);
  transition: all 0.2s ease;
  user-select: none;
  -webkit-user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.revealable:hover {
  color: var(--primary) !important;
  border-bottom-color: var(--primary);
}

.revealable .masked-val {
  display: inline;
}

.revealable .full-val {
  display: none;
}

.revealable.revealed .masked-val {
  display: none;
}

.revealable.revealed .full-val {
  display: inline;
}

/* ── Mobile Form/Tab/Card Spacing Tightening Optimization ── */
@media (max-width: 768px) {
  /* Tighten form groups globally */
  .form-group {
    margin-bottom: 8px !important;
    gap: 2px !important;
  }

  label {
    margin-bottom: 3px !important;
    font-size: 0.775rem !important;
  }

  .form-input {
    padding: 8px 12px !important;
    height: 38px !important;
    font-size: 0.85rem !important;
  }

  textarea.form-input {
    height: auto !important;
    min-height: 80px !important;
  }

  .form-grid-2,
  .form-column-layout,
  .portal-grid {
    gap: 10px !important;
  }

  /* Tighten settings tabs and navigation buttons on mobile */
  .settings-tabs-container {
    margin-bottom: 12px !important;
    padding-bottom: 0 !important;
    gap: 4px !important;
  }

  .settings-tab-btn,
  .main-tab-btn {
    padding: 8px 12px !important;
    font-size: 0.8rem !important;
    height: 34px !important;
  }

  .main-tab-btn .tab-text,
  .settings-tab-btn span {
    font-size: 0.8rem !important;
  }

  /* Tighten cards globally on mobile */
  .card {
    padding: 16px !important;
    margin-bottom: 12px !important;
  }
  .card-header {
    margin-bottom: 12px !important;
    padding-bottom: 8px !important;
  }
}

/* ── View Transitions API Customizations ── */
@keyframes fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slide-up {
  from {
    transform: translateY(12px);
  }
  to {
    transform: translateY(0);
  }
}

::view-transition-old(root) {
  animation: 90ms cubic-bezier(0.4, 0, 1, 1) both fade-out;
}
::view-transition-new(root) {
  animation:
    210ms cubic-bezier(0, 0, 0.2, 1) both fade-in,
    210ms cubic-bezier(0, 0, 0.2, 1) both slide-up;
}

/* ── Skeleton Loaders ── */
@keyframes loading-shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.skeleton-card {
  width: 100%;
  border-radius: var(--radius, 8px);
  background: linear-gradient(
    90deg,
    var(--border, #e2e8f0) 25%,
    var(--bg-hover, #f1f5f9) 50%,
    var(--border, #e2e8f0) 75%
  );
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite linear;
}

.skeleton-text {
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--border, #e2e8f0) 25%,
    var(--bg-hover, #f1f5f9) 50%,
    var(--border, #e2e8f0) 75%
  );
  background-size: 200% 100%;
  animation: loading-shimmer 1.5s infinite linear;
}

/* ── Pulsing Active Status Indicator ── */
@keyframes status-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.pulsing-dot {
  width: 8px;
  height: 8px;
  background-color: #10b981; /* green */
  border-radius: 50%;
  display: inline-block;
  animation: status-pulse 2s infinite;
}

/* ── Theme Switcher Micro-Interactions ── */
:root {
  --display-sun: none;
  --display-moon: block;
}

[data-theme='dark'] {
  --display-sun: block;
  --display-moon: none;
}

.theme-toggle-btn {
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.theme-toggle-btn:hover {
  transform: scale(1.15);
}
.theme-toggle-btn.toggled {
  animation: rotate-toggle 0.4s ease-out;
}

@keyframes rotate-toggle {
  0% {
    transform: rotate(0) scale(1);
  }
  50% {
    transform: rotate(180deg) scale(1.2);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

/* ── Auto-save Status Badge ── */
.save-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 12px;
  transition: all 0.3s ease;
  opacity: 0;
  transform: translateY(-5px);
}
.save-badge.visible {
  opacity: 1;
  transform: translateY(0);
}
.save-badge.saving {
  background-color: rgba(245, 158, 11, 0.15);
  color: #d97706; /* Amber */
}
.save-badge.saved {
  background-color: rgba(16, 185, 129, 0.15);
  color: #059669; /* Green */
}
.save-badge.error {
  background-color: rgba(239, 68, 68, 0.15);
  color: #dc2626; /* Red */
}

.auto-save-status.saving {
  border-color: #f59e0b !important;
  box-shadow:
    0 4px 20px -2px rgba(245, 158, 11, 0.15),
    var(--shadow-lg) !important;
}
.auto-save-status.saved {
  border-color: #10b981 !important;
  box-shadow:
    0 4px 20px -2px rgba(16, 185, 129, 0.15),
    var(--shadow-lg) !important;
}
.auto-save-status.error {
  border-color: #ef4444 !important;
  box-shadow:
    0 4px 20px -2px rgba(239, 68, 68, 0.15),
    var(--shadow-lg) !important;
}

/* ── Details Chevron Toggle Rotation ── */
details summary::-webkit-details-marker {
  display: none;
}
details summary {
  list-style: none;
}
details summary .chevron-icon {
  display: inline-flex;
  align-items: center;
  transition: transform 0.2s ease;
}
details[open] summary .chevron-icon,
details[open] .chevron-icon {
  transform: rotate(180deg);
}

/* ══════════════════════════════════════════════════════════════════════════════
   MODAL & DIALOG DISTINCT ELEVATION & DARK THEME STYLING
   ══════════════════════════════════════════════════════════════════════════════ */
dialog::backdrop,
.modal-overlay,
.quote-confirm-overlay,
.confirm-overlay,
.modal-backdrop {
  background: rgba(3, 7, 18, 0.75) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

/* Base Dialog and Modal Cards */
dialog,
.modal-card,
.modal-content,
.quote-confirm-card {
  background: var(--surface, #ffffff);
  color: var(--text, #0f172a);
  border: 1px solid var(--border, #cbd5e1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* Dark theme distinct elevated modal surface */
:root[data-theme='dark'] dialog,
:root[data-theme='dark'] #nav-chooser-dialog,
:root[data-theme='dark'] #flatpack-travel-edit-dialog,
:root[data-theme='dark'] .modal-card,
:root[data-theme='dark'] .modal-content,
:root[data-theme='dark'] .quote-confirm-card,
:root[data-theme='dark'] .custom-dialog {
  background: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #384960 !important;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.14), 0 0 32px rgba(59, 130, 246, 0.15) !important;
}

/* Modal Headers */
:root[data-theme='dark'] dialog > div:first-child,
:root[data-theme='dark'] .modal-header,
:root[data-theme='dark'] #nav-chooser-dialog > div:first-child,
:root[data-theme='dark'] #flatpack-travel-edit-dialog > div:first-child {
  background: #253349 !important;
  border-bottom: 1px solid #384960 !important;
}

:root[data-theme='dark'] dialog > div:first-child span,
:root[data-theme='dark'] .modal-header .modal-title,
:root[data-theme='dark'] #nav-chooser-dialog span {
  color: #ffffff !important;
}

/* Subtitles & Route in Navigation Dialog */
:root[data-theme='dark'] #nav-dialog-route-subtitle,
:root[data-theme='dark'] .modal-subtitle {
  color: #94a3b8 !important;
}

/* "From" / Start Location section */
:root[data-theme='dark'] #nav-chooser-dialog > div:nth-child(2),
:root[data-theme='dark'] #nav-chooser-dialog div[style*="background: var(--surface"] {
  background: #182333 !important;
  border-bottom: 1px solid #384960 !important;
}

:root[data-theme='dark'] #nav-dialog-origin-input {
  background: #0f172a !important;
  border: 1px solid #384960 !important;
  color: #ffffff !important;
}

:root[data-theme='dark'] #nav-dialog-origin-input:focus {
  border-color: var(--primary, #3b82f6) !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25) !important;
}

/* Origin Chips in Navigation Modal */
:root[data-theme='dark'] #nav-dialog-quick-origins .nav-quick-chip,
:root[data-theme='dark'] #nav-dialog-quick-origins button,
:root[data-theme='dark'] .nav-quick-chip {
  background: #223147 !important;
  border: 1px solid #3b4f6b !important;
  color: #93c5fd !important;
}

:root[data-theme='dark'] #nav-dialog-quick-origins .nav-quick-chip:hover,
:root[data-theme='dark'] #nav-dialog-quick-origins button:hover,
:root[data-theme='dark'] .nav-quick-chip:hover {
  background: #2c4161 !important;
  border-color: #60a5fa !important;
  color: #ffffff !important;
}

/* Suggestions Dropdown in Modal */
:root[data-theme='dark'] #nav-dialog-origin-suggestions {
  background: #1e293b !important;
  border: 1px solid #384960 !important;
  box-shadow: 0 12px 24px -4px rgba(0, 0, 0, 0.7) !important;
}

:root[data-theme='dark'] #nav-dialog-origin-suggestions .origin-suggestion-item {
  color: #f8fafc !important;
  border-bottom: 1px solid #28374d !important;
}

:root[data-theme='dark'] #nav-dialog-origin-suggestions .origin-suggestion-item:hover,
:root[data-theme='dark'] #nav-dialog-origin-suggestions .origin-suggestion-item.is-selected {
  background: #27374e !important;
  color: #ffffff !important;
}

/* Map Action Items (Google Maps, Apple Maps, Waze, OSM) */
:root[data-theme='dark'] .nav-app-item {
  color: #f8fafc !important;
}

:root[data-theme='dark'] .nav-app-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

:root[data-theme='dark'] .nav-app-item span[style*="Directions"],
:root[data-theme='dark'] .nav-app-item span[style*="Location"],
:root[data-theme='dark'] .nav-app-item span[style*="background: var(--bg-hover"] {
  background: #253349 !important;
  border: 1px solid #3b4f6b !important;
  color: #94a3b8 !important;
}

/* Custom URL Input & Action Buttons inside modal */
:root[data-theme='dark'] #nav-custom-url-input {
  background: #0f172a !important;
  border: 1px solid #384960 !important;
  color: #f8fafc !important;
}

:root[data-theme='dark'] #btn-save-nav-custom-url,
:root[data-theme='dark'] #btn-toggle-osm-preview {
  background: #253349 !important;
  border: 1px solid #3b4f6b !important;
  color: #cbd5e1 !important;
}

:root[data-theme='dark'] #btn-save-nav-custom-url:hover,
:root[data-theme='dark'] #btn-toggle-osm-preview:hover {
  background: #2f4363 !important;
  border-color: var(--primary, #3b82f6) !important;
  color: #ffffff !important;
}

:root[data-theme='dark'] a[id="nav-link-copy-address"],
:root[data-theme='dark'] button[id="btn-nav-copy-address"],
:root[data-theme='dark'] .nav-copy-btn {
  background: rgba(59, 130, 246, 0.15) !important;
  border: 1px solid rgba(59, 130, 246, 0.3) !important;
  color: #93c5fd !important;
}

:root[data-theme='dark'] a[id="nav-link-copy-address"]:hover,
:root[data-theme='dark'] button[id="btn-nav-copy-address"]:hover,
:root[data-theme='dark'] .nav-copy-btn:hover {
  background: rgba(59, 130, 246, 0.28) !important;
  border-color: var(--primary, #3b82f6) !important;
  color: #ffffff !important;
}



/* ── Foldable Card / Enquiry Card Styling ── */
#card-enquiry.is-folded > .card-body {
  display: none !important;
}
#card-enquiry.is-folded > .card-header {
  border-bottom: none;
}
#card-enquiry .enquiry-card-chevron svg {
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
#card-enquiry.is-folded .enquiry-card-chevron svg {
  transform: rotate(0deg) !important;
}
#card-enquiry:not(.is-folded) .enquiry-card-chevron svg {
  transform: rotate(180deg) !important;
}

/* Hidden file inputs: hide browser default file chooser button while keeping native input accessible for triggers */
.file-input-hidden {
  display: none !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
