/*!
 * ============================================================================
 * Copyright (c) 2025 ATH SOLUTIONS (PTY) LTD. All rights reserved.
 * KwaZulu-Natal, Republic of South Africa.
 * ============================================================================
 *
 * @BEGIN Developer Log Header Block
 * @FILENAME: main.css
 * @TITLE: ATH EDMP - Main Stylesheet
 * @DESCRIPTION: Core component styles for the ATH EDMP application shell. Depends on design-tokens.css being loaded first. All values reference CSS custom properties from design-tokens.css.
 * @AUTHOR: Ary van der Pijl
 * @COMPANY: ATH SOLUTIONS (PTY) LTD
 * @WEBSITE: https://www.ath.solutions/
 * @EMAIL: info@ath.solutions
 * @COPYRIGHT: All Rights Reserved
 * @LICENSE: ATH SOLUTIONS - PROPRIETARY SOFTWARE LICENCE AGREEMENT (https://www.ath.solutions/documents/ath_solutions_software_licence_agreement.pdf)
 *
 * BEGIN CHANGELOG
 * @IMPORTANT NOTICE: Developers working on these files MUST update and maintain the Developers Change Log, failure to do is not an option:
 * !==================================================================================================================================================================
 * VERSION 1.0.17
 * - File Modified | Ary van der Pijl | 2026-09-10 | ATH-EDMP-PWTOGGLE | Added .password-field/.password-toggle (show/hide password button injected by password-toggle.js); reserves right-side padding on .form-control so the overlaid button never covers typed text. |
 * VERSION 1.0.16
 * - File Modified | Ary van der Pijl | 2026-09-03 | GAP V3-2 | Replaced 27 raw hex color values with design-token var() references - CLAUDE.md's zero-hardcoded-hex rule for main.css. Kept the 3 literal black/white/grey values in the @media print block as a deliberate print-safety exception (they must not resolve through theme-switching tokens). |
 * VERSION 1.0.15
 * - File Modified | Ary van der Pijl | 2026-09-03 | GAP V3-2 | Added .edmp-cell (height:16px), .select-auto (width:auto), .thumb-sm (64x48 object-fit:cover) - 17 JS files across public/js/pages and public/js/components emitted raw style="..." attributes in template-literal markup (27 instances), violating CLAUDE.md's explicit zero-inline-styles rule. Reused the existing .icon-xs/.icon-sm/.text-xs utilities for font-size cases; added these 3 new ones for the cases nothing existing covered. |
 * VERSION 1.0.14
 * - File Modified | Ary van der Pijl | 2026-09-03 | GAP V2-1 | .user-avatar and .presence-avatar now clip overflow with an img rule, so the header/hovercard/presence-cluster avatars render real images instead of only text initials. Added .app-footer-credit/.app-footer-credit-icon for the footer's logo mark next to the ATH Solutions credit. Added .module-tile usage support (Site Management/Analytics dashboard tiles). |
 * VERSION 1.0.13
 * - File Modified | Ary van der Pijl | 2026-09-02 | GAP P1-8 | Added .ticket-message / .ticket-message--staff for the support ticket thread views. |
 * VERSION 1.0.12
 * - File Modified | Ary van der Pijl | 2026-09-02 | GAP P1-8 | Added .help-launcher-panel and .help-kb-result for the header help launcher. |
 * VERSION 1.0.11
 * - File Modified | Ary van der Pijl | 2026-09-02 | GAP P2-11 | Added .address-autocomplete-list / .address-autocomplete-item for the address-autocomplete component. |
 * VERSION 1.0.10
 * - File Modified | Ary van der Pijl | 2026-09-02 | GAP P2-6 | Added .user-hovercard and its inner elements; added the global .hidden utility rule (several components toggled this class with no matching CSS). |
 * VERSION 1.0.9
 * - File Modified | Ary van der Pijl | 2026-09-02 | GAP P2-8 | Added .app-footer / .app-footer-links for the app-shell footer partial. |
 * VERSION 1.0.8
 * - File Modified | Ary van der Pijl | 2026-09-02 | GAP P2-7 | Added .auth-crest-img for the auth-layout tenant logo. |
 * VERSION 1.0.7
 * - File Modified | Ary van der Pijl | 2026-09-02 | GAP P2-7 | Added .brand-upload-preview / .brand-upload-placeholder for the logo/favicon uploaders. |
 * VERSION 1.0.6
 * - File Modified | Ary van der Pijl | 2026-09-02 | GAP P2-4/P2-5 | Added .avatar-upload-wrap / .profile-avatar-img and .social-link-row for the profile page. |
 * VERSION 1.0.5
 * - File Modified | Ary van der Pijl | 2026-09-02 | GAP P1-6 | Added .presence-cluster / .presence-avatar for the online-users stacked-avatar cluster. |
 * - File Modified | Ary van der Pijl | 2026-09-02 | GAP P1-1 | Added .header-locale-select for the header language switcher. |
 * VERSION 1.0.4
 * - File Modified | Ary van der Pijl | 2026-07-02 | Added icon-kpi, icon-empty-state, vehicle-list-scroll, filter-select--wide, filter-input--date, heatmap-card-body, heatmap map element, and heatmap legend dot utilities to eliminate inline styles across six view files. |
 * VERSION 1.0.3
 * - File Modified | Ary van der Pijl | 2026-07-01 | Added EDMP domain badge variants (status, phase, severity, priority), timeline component, step-indicator stepper, and page-header-actions utility. |
 * VERSION 1.0.2
 * - File Modified | Ary van der Pijl | 2026-06-16 | ATH-COMPLIANCE-001 | Applied ATH Solutions 2026 standards: added ATH /*! file header per G-17 |
 * VERSION 1.0.1
 * - File Created | Ary van der Pijl | 2026-05-01 | ATH-edmp-001 | Initial file |
 * ==================================================================================================================================================================!
 * END CHANGELOG
 */

/* ─── Base Reset ─────────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--fw-normal);
  line-height: var(--lh-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  color: var(--color-primary-hover);
}

img, svg {
  vertical-align: middle;
}

/* ─── App Shell ──────────────────────────────────────────────────────────── */

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: var(--z-fixed);
  transition: width var(--transition-slow);
  overflow-x: hidden;
}

.app-sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-5);
  height: var(--header-height);
  border-bottom: 1px solid var(--sidebar-border);
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-logo img {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--color-primary-text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-4) 0;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-border) transparent;
}

.sidebar-section-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--sidebar-text);
  padding: var(--space-4) var(--space-5) var(--space-2);
  opacity: .6;
  white-space: nowrap;
  overflow: hidden;
}

.app-sidebar.collapsed .sidebar-section-label {
  opacity: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  margin: 2px var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-hover);
  text-decoration: none;
}

.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  border-left: 3px solid var(--sidebar-active-border);
  padding-left: calc(var(--space-4) - 3px);
}

.nav-item--disabled {
  opacity: var(--module-tile-disabled-opacity);
  cursor: not-allowed;
  pointer-events: none;
}

.nav-item .material-icons-round {
  font-size: 20px;
  flex-shrink: 0;
  width: 20px;
}

.nav-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, .15);
  color: var(--color-primary-text);
  font-size: 10px;
  font-weight: var(--fw-semibold);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-4);
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background var(--transition-base);
  margin-left: auto;
}

.sidebar-toggle:hover {
  background: var(--sidebar-hover-bg);
  color: var(--color-primary-text);
}

/* ─── Main ───────────────────────────────────────────────────────────────── */

.app-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

.app-sidebar.collapsed~.app-main {
  margin-left: var(--sidebar-collapsed);
}

/* ─── Header ─────────────────────────────────────────────────────────────── */

.app-header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  z-index: var(--z-sticky);
  box-shadow: var(--shadow-xs);
}

.header-breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.header-breadcrumb .breadcrumb-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-breadcrumb .breadcrumb-item.active {
  color: var(--color-text);
  font-weight: var(--fw-medium);
}

.header-breadcrumb .separator {
  color: var(--color-text-subtle);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
}

.header-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-color: var(--color-border);
}

.header-btn .material-icons-round {
  font-size: 20px;
}

.presence-cluster {
  display: flex;
  align-items: center;
}

.presence-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: -8px;
  border-radius: 50%;
  border: 2px solid var(--header-bg);
  background: var(--color-primary);
  color: var(--color-primary-text);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold, 600);
  cursor: default;
  overflow: hidden;
}

.presence-avatar:first-child {
  margin-left: 0;
}

.presence-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.header-locale-select {
  height: 36px;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.header-locale-select:hover,
.header-locale-select:focus {
  color: var(--color-text);
  border-color: var(--color-primary);
  outline: none;
}

.badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--color-danger);
  border-radius: 50%;
  border: 2px solid var(--header-bg);
}

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text);
  cursor: pointer;
  transition: all var(--transition-base);
}

.user-menu-btn:hover {
  background: var(--color-surface-2);
  border-color: var(--color-border);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-primary-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.user-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-name {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
}

/* ─── Page Content ───────────────────────────────────────────────────────── */

.app-content {
  flex: 1;
  padding: var(--space-6);
  max-width: 1400px;
  width: 100%;
}

/* ─── App Footer (GAP P2-8) ──────────────────────────────────────────────── */

.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
}

.app-footer-copyright a {
  color: inherit;
  text-decoration: underline;
}

.app-footer-credit {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.app-footer-credit-icon {
  font-size: var(--text-sm);
}

.app-footer-links {
  display: flex;
  gap: var(--space-4);
}

.app-footer-links a {
  color: var(--color-text-subtle);
  text-decoration: none;
}

.app-footer-links a:hover {
  color: var(--color-text);
  text-decoration: underline;
}

/* ─── User Hover Card (GAP P2-6) ──────────────────────────────────────────── */

.user-hovercard {
  position: absolute;
  z-index: var(--z-tooltip);
  width: 240px;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.user-hovercard-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.user-hovercard-header .user-avatar {
  width: 40px;
  height: 40px;
  font-size: var(--text-sm);
}

.user-hovercard-contact {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-hovercard-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--text-xs);
}

/* ─── Address Autocomplete (GAP P2-11) ────────────────────────────────────── */

.address-autocomplete-list {
  position: absolute;
  z-index: var(--z-dropdown);
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 2px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 220px;
  overflow-y: auto;
}

.address-autocomplete-item {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  cursor: pointer;
}

.address-autocomplete-item:hover {
  background: var(--color-surface-2);
}

/* ─── Help Launcher (GAP P1-8) ────────────────────────────────────────────── */

.help-launcher-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-modal, 1050);
  width: 360px;
  max-width: 90vw;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.help-launcher-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.help-launcher-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
}

.help-kb-result {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: pointer;
}

.help-kb-result:hover {
  background: var(--color-surface-2);
}

.ticket-message {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
}

.ticket-message--staff {
  background: var(--color-primary-light);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--color-text);
  margin: 0;
  line-height: var(--lh-tight);
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: var(--space-1) 0 0;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-4);
}

.card-title {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  margin: 0;
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-2);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* ─── Stat Cards ─────────────────────────────────────────────────────────── */

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon .material-icons-round {
  font-size: 24px;
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--fw-bold);
  color: var(--color-text);
  line-height: 1;
  margin: 0 0 var(--space-1);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0;
}

.stat-change {
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  margin-top: var(--space-2);
  display: flex;
  align-items: center;
  gap: 2px;
}

.stat-change.up {
  color: var(--color-success);
}

.stat-change.down {
  color: var(--color-danger);
}

/* ─── Table ──────────────────────────────────────────────────────────────── */

.table-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}

.table-toolbar-left {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.table-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.table {
  margin: 0;
}

.table th {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  white-space: nowrap;
}

.table td {
  font-size: var(--text-sm);
  color: var(--color-text);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover td {
  background: var(--color-surface-2);
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.table-meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  line-height: 1;
  padding: var(--space-2) var(--space-4);
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-primary-text);
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--color-primary-text);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.btn-danger {
  background: var(--color-danger);
  color: var(--color-primary-text);
  border-color: var(--color-danger);
}

.btn-danger:hover {
  background: var(--color-danger-hover);
  border-color: var(--color-danger-hover);
  color: var(--color-primary-text);
}

.btn-sm {
  height: 30px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  height: 44px;
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-md);
}

.btn .material-icons-round {
  font-size: 16px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
}

.btn-icon.btn-sm {
  width: 30px;
  height: 30px;
}

.btn[disabled], .btn.disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn.loading .btn-text {
  opacity: 0;
}

/* ─── Forms ──────────────────────────────────────────────────────────────── */

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.form-control, .form-select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  height: 38px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  outline: none;
}

.form-control:focus, .form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

.form-control::placeholder {
  color: var(--color-text-subtle);
}

textarea.form-control {
  height: auto;
  min-height: 100px;
  resize: vertical;
  line-height: var(--lh-normal);
}

.form-control.is-invalid, .form-select.is-invalid {
  border-color: var(--color-danger);
}

.invalid-feedback {
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

.form-group {
  margin-bottom: var(--space-5);
}

/* ─── Password reveal toggle (injected by password-toggle.js) ─────────────── */

.password-field {
  position: relative;
  display: block;
}
.password-field .form-control {
  padding-right: calc(var(--space-3) + 28px);
}
.password-field .password-toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: 38px;
  width: calc(var(--space-3) + 28px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 18px;
  cursor: pointer;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.password-field .password-toggle .material-icons-round { font-size: 20px; }
.password-field .password-toggle:hover { color: var(--color-text); }
.password-field .password-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.input-group {
  display: flex;
}

.input-group .form-control {
  flex: 1;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group .btn {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.input-prefix, .input-suffix {
  display: flex;
  align-items: center;
  padding: 0 var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.input-prefix {
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-suffix {
  border-left: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.input-group .form-control:not(:first-child):not(:last-child) {
  border-radius: 0;
}

/* ─── Badges / Status ────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  border-radius: var(--radius-full);
  line-height: 1;
}

.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.badge-info {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.badge-muted {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.badge-primary {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.active {
  background: var(--color-success);
}

.status-dot.pending {
  background: var(--color-warning);
}

.status-dot.suspended {
  background: var(--color-danger);
}

.status-dot.draft {
  background: var(--color-text-subtle);
}

/* ─── Modals ─────────────────────────────────────────────────────────────── */

.modal-content {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  margin: 0;
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
}

/* ─── Toast Notifications ────────────────────────────────────────────────── */

#toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 420px;
  pointer-events: all;
  animation: toastIn .2s ease;
}

.toast-item.hide {
  animation: toastOut .2s ease forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(12px);
  }
}

.toast-icon .material-icons-round {
  font-size: 20px;
}

.toast-success .toast-icon {
  color: var(--color-success);
}

.toast-error .toast-icon {
  color: var(--color-danger);
}

.toast-warning .toast-icon {
  color: var(--color-warning);
}

.toast-info .toast-icon {
  color: var(--color-info);
}

.toast-body {
  flex: 1;
}

.toast-title {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  margin: 0;
}

.toast-message {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 2px 0 0;
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-subtle);
  padding: 2px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
}

.toast-close:hover {
  color: var(--color-text);
  background: var(--color-surface-2);
}

/* ─── Auth Pages ─────────────────────────────────────────────────────────── */

.auth-page {
  min-height: 100vh;
  background: var(--auth-page-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
}

.auth-container {
  width: 100%;
  max-width: 440px;
  padding: var(--space-8) var(--space-4);
}

/* EDMP crest + name lockup above the auth card */
.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  margin-bottom: var(--space-8);
}

.auth-crest {
  width: var(--auth-crest-size);
  height: var(--auth-crest-size);
  background: var(--auth-crest-bg);
  border: 2px solid var(--auth-crest-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
  transition: box-shadow var(--transition-base);
}

.auth-crest:hover {
  box-shadow: var(--shadow-glow-gold);
}

.auth-crest-img {
  width: var(--auth-crest-size);
  height: var(--auth-crest-size);
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: var(--space-3);
}

.auth-crest .material-icons-round {
  font-size: 40px;
  color: var(--color-accent);
}

.auth-edmp-name {
  color: var(--auth-edmp-color);
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  letter-spacing: 0.05em;
  text-align: center;
}

.auth-edmp-sub {
  color: var(--auth-sub-color);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  margin-top: 2px;
}

.auth-card {
  background: var(--auth-card-bg);
  border-radius: var(--auth-card-radius);
  padding: var(--space-8);
  box-shadow: var(--auth-card-shadow);
}

.auth-heading {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--color-primary);
  margin: 0 0 var(--space-2);
}

.auth-subtext {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-6);
}

/* Override Bootstrap btn-primary to use edmp navy in auth context */
.auth-card .btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-primary-text);
}

.auth-card .btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.auth-card .text-primary {
  color: var(--color-accent) !important;
}

.auth-card a.text-primary:hover {
  color: var(--color-accent-hover) !important;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-5) 0;
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
}

.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

.auth-footer {
  text-align: center;
  margin-top: var(--space-5);
  font-size: var(--text-sm);
  color: var(--auth-footer-color);
}

.auth-footer a {
  color: var(--auth-footer-link);
  text-decoration: none;
  font-weight: var(--fw-semibold);
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* ─── Empty State ────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: var(--space-16) var(--space-8);
  color: var(--color-text-muted);
}

.empty-state .material-icons-round {
  font-size: 48px;
  color: var(--color-text-subtle);
  margin-bottom: var(--space-4);
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  margin: 0 0 var(--space-2);
}

.empty-state-text {
  font-size: var(--text-sm);
  margin: 0 0 var(--space-6);
}

/* ─── Loading ────────────────────────────────────────────────────────────── */

.edmp {
  background: linear-gradient(90deg, var(--color-border) 25%, var(--color-surface-2) 50%, var(--color-border) 75%);
  background-size: 200% 100%;
  animation: edmp-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.edmp-cell {
  height: 16px;
}

@keyframes edmp-shimmer {
  to {
    background-position: -200% 0;
  }
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Dropdown ───────────────────────────────────────────────────────────── */

.dropdown-menu {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  min-width: 180px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--transition-base);
  text-decoration: none;
  border: none;
  background: none;
  width: 100%;
}

.dropdown-item:hover {
  background: var(--color-surface-2);
  text-decoration: none;
  color: var(--color-text);
}

.dropdown-item.danger {
  color: var(--color-danger);
}

.dropdown-item.danger:hover {
  background: var(--color-danger-bg);
}

.dropdown-divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-2) 0;
}

.dropdown-item .material-icons-round {
  font-size: 16px;
  color: var(--color-text-muted);
}

/* ─── Code Editor ────────────────────────────────────────────────────────── */

.code-editor {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--color-neutral-900);
  color: var(--color-neutral-200);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  padding: var(--space-4);
  resize: vertical;
  min-height: 200px;
}

/* ─── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
  }

  .app-sidebar.mobile-open {
    transform: translateX(0);
  }

  .app-main {
    margin-left: 0;
  }

  .app-content {
    padding: var(--space-4);
  }

  .page-header {
    flex-direction: column;
  }
}

/* ─── Utilities ──────────────────────────────────────────────────────────── */

/* Several components toggle a bare "hidden" class (classList.toggle("hidden", …))
 * rather than the boolean HTML attribute - without this rule that class name has
 * no effect. GAP P2-6 surfaced this while adding the hover card. */
.hidden {
  display: none !important;
}

.text-muted {
  color: var(--color-text-muted) !important;
}

.text-subtle {
  color: var(--color-text-subtle) !important;
}

.text-primary {
  color: var(--color-primary) !important;
}

.text-success {
  color: var(--color-success) !important;
}

.text-danger {
  color: var(--color-danger) !important;
}

.text-warning {
  color: var(--color-warning) !important;
}

.fw-medium {
  font-weight: var(--fw-medium);
}

.fw-semibold {
  font-weight: var(--fw-semibold);
}

.fw-bold {
  font-weight: var(--fw-bold);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-5) 0;
}

.overlay-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: calc(var(--z-modal) - 1);
}

.overlay-backdrop.hidden {
  display: none;
}

/* ─── Sidebar Logo Icon ──────────────────────────────────────────────────── */

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--color-navy-700);
  border: 1.5px solid var(--color-accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon .material-icons-round {
  color: var(--color-accent);
  font-size: 18px;
}

/* ─── Header Utility Classes ─────────────────────────────────────────────── */

.icon-xs {
  font-size: 14px;
}

.icon-sm {
  font-size: 16px;
}

.icon-md {
  font-size: 20px;
}

.icon-lg {
  font-size: 32px;
}

.icon-2xl {
  font-size: 48px;
}

/* ─── GAP V3-2: JS-emitted markup utility classes (zero-inline-styles) ────── */

.select-auto {
  width: auto;
}

.thumb-sm {
  max-width: 64px;
  max-height: 48px;
  object-fit: cover;
}

.icon-3xl {
  font-size: 64px;
}

.icon-xl {
  font-size: 72px;
}

/* ─── Stat Card Colour Variants ──────────────────────────────────────────── */

.stat-icon--navy {
  background: var(--stat-navy-bg);
  color: var(--stat-navy-color);
}

.stat-icon--gold {
  background: var(--stat-gold-bg);
  color: var(--stat-gold-color);
}

.stat-icon--red {
  background: var(--stat-red-bg);
  color: var(--stat-red-color);
}

.stat-icon--green {
  background: var(--stat-green-bg);
  color: var(--stat-green-color);
}

.stat-icon--blue {
  background: var(--stat-blue-bg);
  color: var(--stat-blue-color);
}

.stat-icon--amber {
  background: var(--stat-amber-bg);
  color: var(--stat-amber-color);
}

/* ─── Module Shortcut Tiles ──────────────────────────────────────────────── */

.module-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all var(--transition-base);
}

.module-tile:hover {
  text-decoration: none;
  filter: brightness(0.95);
}

.module-tile--navy {
  background: var(--module-tile-bg);
}

.module-tile--gold {
  background: var(--module-tile-bg-gold);
}

.module-tile--green {
  background: var(--module-tile-bg-green);
}

.module-tile--blue {
  background: var(--module-tile-bg-blue);
}

.module-tile--disabled {
  opacity: var(--module-tile-disabled-opacity);
  pointer-events: none;
  cursor: not-allowed;
}

.module-tile__icon {
  font-size: 32px;
}

.module-tile__icon--navy {
  color: var(--color-navy-700);
}

.module-tile__icon--gold {
  color: var(--color-gold-700);
}

.module-tile__icon--green {
  color: var(--color-success);
}

.module-tile__icon--blue {
  color: var(--color-info);
}

.module-tile__label {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
}

.module-tile__label--navy {
  color: var(--color-navy-700);
}

.module-tile__label--gold {
  color: var(--color-gold-700);
}

.module-tile__label--green {
  color: var(--color-success);
}

.module-tile__label--blue {
  color: var(--color-info);
}

/* ─── Quick Action Nav Items ─────────────────────────────────────────────── */

.quick-action-nav {
  color: var(--color-text);
}

.quick-action-icon--navy {
  color: var(--color-navy-700);
}

.quick-action-icon--gold {
  color: var(--color-gold-700);
}

.quick-action-icon--red {
  color: var(--color-danger);
}

/* ─── Dashboard Phase Badge ──────────────────────────────────────────────── */

.badge-navy {
  background: var(--color-navy-700);
  color: var(--color-primary-text);
  font-size: var(--text-xs);
}

/* ─── Skin Selector ──────────────────────────────────────────────────────── */

.skin-option {
  cursor: pointer;
  padding: var(--space-3);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  text-align: center;
  transition: border-color var(--transition-fast);
}

.skin-option.selected,
.skin-option--selected {
  border-color: var(--color-primary);
}

.skin-option__swatch {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  margin: 0 auto var(--space-2);
  background: var(--swatch-color, var(--color-primary));
}

.skin-option__label {
  font-size: 0.75rem;
  font-weight: 500;
}

/* ─── Filter Toolbar ─────────────────────────────────────────────────────── */

.filter-toolbar__input {
  max-width: 260px;
}

.filter-toolbar__input--sm {
  max-width: 200px;
}

.filter-toolbar__select {
  max-width: 160px;
}

.filter-toolbar__select--sm {
  max-width: 140px;
}

.filter-toolbar__date {
  max-width: 160px;
}

/* ─── Theme Selector ─────────────────────────────────────────────────────── */

.theme-option {
  cursor: pointer;
  border-radius: var(--radius-md) !important;
}

.theme-option--selected {
  border-color: var(--color-primary) !important;
}

.theme-option__icon--warning {
  color: var(--color-warning);
}

/* ─── Permissions List ───────────────────────────────────────────────────── */

.permissions-list {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
}

/* ─── Avatar Placeholder ─────────────────────────────────────────────────── */

.avatar-placeholder {
  width: 80px;
  height: 80px;
  font-size: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  color: var(--color-text-muted);
}

.avatar-upload-wrap {
  position: relative;
  width: 80px;
  height: 80px;
}

.profile-avatar-img {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.social-link-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.social-link-row select {
  flex: 0 0 110px;
}

.brand-upload-preview,
.brand-upload-placeholder {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-md);
  margin: 0 auto;
}

.brand-upload-preview {
  object-fit: contain;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
}

.brand-upload-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-2);
  border: 1px dashed var(--color-border);
  color: var(--color-text-subtle);
}

.brand-upload-preview--sm,
.brand-upload-placeholder--sm {
  width: 48px;
  height: 48px;
}

/* ─── Text Utilities ─────────────────────────────────────────────────────── */

.text-xs {
  font-size: 0.75rem;
}

/* ─── EDMP: Status Badges ────────────────────────────────────────────────── */
/* Disaster status */
.badge-status-active {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-status-contained {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.badge-status-resolved {
  background: var(--color-success-bg);
  color: var(--color-success);
}

/* Job status */
.badge-status-open {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-status-quoted {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.badge-status-assigned {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.badge-status-in_progress {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.badge-status-completed {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-status-approved {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-status-disputed {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

/* Contractor status */
.badge-status-pending {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-status-verified {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-status-suspended {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.badge-status-rejected {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

/* Shared closed/inactive */
.badge-status-closed {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.badge-status-inactive {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

/* ─── EDMP: Phase Badges ──────────────────────────────────────────────────── */
.badge-phase-prevention {
  background: var(--color-phase-blue-bg);
  color: var(--color-phase-blue);
}

.badge-phase-preparedness {
  background: var(--color-phase-yellow-bg);
  color: var(--color-phase-yellow);
}

.badge-phase-response {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.badge-phase-recovery {
  background: var(--color-phase-orange-bg);
  color: var(--color-phase-orange);
}

.badge-phase-reconstruction {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.badge-phase-monitoring {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.badge-phase-closed {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

/* ─── EDMP: Severity Badges ──────────────────────────────────────────────── */
.badge-severity-1 {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.badge-severity-2 {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.badge-severity-3 {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-severity-4 {
  background: var(--color-phase-orange-bg);
  color: var(--color-phase-orange);
}

.badge-severity-5 {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

/* ─── EDMP: Priority Badges ──────────────────────────────────────────────── */
.badge-priority-low {
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.badge-priority-normal {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.badge-priority-high {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-priority-urgent {
  background: var(--color-phase-orange-bg);
  color: var(--color-phase-orange);
}

.badge-priority-emergency {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  font-weight: var(--fw-bold);
}

/* ─── EDMP: Page Header Actions ──────────────────────────────────────────── */
.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ─── EDMP: Timeline Component ───────────────────────────────────────────── */
.timeline-list {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}

.timeline-list::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  display: flex;
  gap: var(--space-4);
  padding: 0 0 var(--space-5) 0;
  position: relative;
}

.timeline-item::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 2px solid var(--color-surface);
  box-shadow: 0 0 0 2px var(--color-primary);
  flex-shrink: 0;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-time {
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
  white-space: nowrap;
  min-width: 80px;
  padding-top: 2px;
}

.timeline-body {
  flex: 1;
  min-width: 0;
}

.timeline-event {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text);
  margin: 0 0 var(--space-1);
}

.timeline-note {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
  line-height: var(--lh-normal);
}

/* ─── EDMP: Step Indicator (Registration Stepper) ────────────────────────── */
.step-indicator {
  display: flex;
  align-items: flex-start;
  gap: 0;
  margin-bottom: var(--space-8);
  overflow-x: auto;
}

.step-indicator__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 80px;
  position: relative;
}

.step-indicator__num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 2px solid var(--color-border);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  transition: all var(--transition-base);
  z-index: 1;
}

.step-indicator__step--active .step-indicator__num {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-primary-text);
}

.step-indicator__step--done .step-indicator__num {
  background: var(--color-success);
  border-color: var(--color-success);
  color: var(--color-primary-text);
}

.step-indicator__label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
  margin-top: var(--space-2);
  font-weight: var(--fw-medium);
}

.step-indicator__step--active .step-indicator__label {
  color: var(--color-primary);
  font-weight: var(--fw-semibold);
}

.step-indicator__step--done .step-indicator__label {
  color: var(--color-success);
}

.step-indicator__connector {
  flex: 1;
  height: 2px;
  background: var(--color-border);
  margin-top: 17px;
  transition: background var(--transition-base);
}

.step-indicator__connector--done {
  background: var(--color-success);
}

/* ─── EDMP: Detail Info Grid ─────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.info-item__label {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-subtle);
  margin: 0 0 var(--space-1);
}

.info-item__value {
  font-size: var(--text-sm);
  color: var(--color-text);
  margin: 0;
  word-break: break-word;
}

/* ─── EDMP: Escrow Panel ─────────────────────────────────────────────────── */
.escrow-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.escrow-item {
  padding: var(--space-4);
  background: var(--color-surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-light);
}

.escrow-item__label {
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 0 0 var(--space-1);
}

.escrow-item__value {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--color-text);
  margin: 0;
}

/* ─── EDMP: Severity Bar ─────────────────────────────────────────────────── */
.severity-bar {
  display: flex;
  gap: 3px;
}

.severity-bar__segment {
  height: 6px;
  flex: 1;
  border-radius: 2px;
  background: var(--color-border);
}

.severity-bar[data-level="1"] .severity-bar__segment:nth-child(-n+1) {
  background: var(--color-text-subtle);
}

.severity-bar[data-level="2"] .severity-bar__segment:nth-child(-n+2) {
  background: var(--color-info);
}

.severity-bar[data-level="3"] .severity-bar__segment:nth-child(-n+3) {
  background: var(--color-warning);
}

.severity-bar[data-level="4"] .severity-bar__segment:nth-child(-n+4) {
  background: var(--color-phase-orange-solid);
}

.severity-bar[data-level="5"] .severity-bar__segment:nth-child(-n+5) {
  background: var(--color-danger);
}

/* ─── Print Styles ───────────────────────────────────────────────────────── */

@media print {
  .app-sidebar, .app-header, #toast-container, .no-print {
    display: none !important;
  }

  .app-main {
    margin-left: 0 !important;
  }

  body {
    font-size: 11pt;
    color: #000;
    background: #fff;
  }

  .card {
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }

  a[href]::after {
    content: " ("attr(href) ")";
  }

  h1, h2, h3 {
    page-break-after: avoid;
  }
}

/* ─── Page Component Utilities ───────────────────────────────────────────── */

/* KPI dashboard - large icon size */
.icon-kpi { font-size: 2rem; }

/* Empty-state centred icon */
.icon-empty-state { font-size: 3rem; color: var(--color-text-subtle); }

/* Scrollable vehicle / asset list panels */
.vehicle-list-scroll { max-height: 600px; overflow-y: auto; }

/* Filter controls width constraints for page-actions context */
.filter-select--wide { width: 220px; }
.filter-input--date  { width: 150px; }

/* Heatmap card body - canvas positioned relative to this container */
.heatmap-card-body { position: relative; }

/* Heatmap map elements */
#heatmap-container { width: 100%; height: 600px; border-radius: var(--radius-md); }
#heatmap-canvas    { width: 100%; height: 100%; }

/* Heatmap density legend dots */
.heatmap-legend-dot           { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; }
.heatmap-legend-dot--low      { background: rgba(0, 100, 255, 0.4); }
.heatmap-legend-dot--moderate { background: rgba(0, 255, 0, 0.5); }
.heatmap-legend-dot--high     { background: rgba(255, 165, 0, 0.6); }
.heatmap-legend-dot--critical { background: rgba(255, 0, 0, 0.7); }