/*!
 * ============================================================================
 * 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 LEM - Main Stylesheet
 * @DESCRIPTION: Core component styles for the ATH LEM 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.11
 * - File Modified | Ary van der Pijl | 2026-08-12 | ATH-LEM-CERB-008 | Added .legal-* rules for the new standalone /cookie-policy, /privacy-policy, /security-policy, /terms pages (layouts/legal.php) |
 * VERSION 1.0.10
 * - File Modified | Ary van der Pijl | 2026-08-12 | ATH-LEM-CERB-008 | Added .site-footer* rules for the new sticky app-shell footer (copyright, dev attribution, legal-modal trigger links) |
 * VERSION 1.0.9
 * - File Modified | Ary van der Pijl | 2026-08-12 | ATH-LEM-CERB-007 | Added .branding-preview/.branding-preview--empty for the Appearance page's logo/favicon upload previews; removed the now-unused .skin-option* rules (Colour Theme card was removed from theme.php) |
 * VERSION 1.0.8
 * - File Modified | Ary van der Pijl | 2026-08-12 | ATH-LEM-CERB-005 | Added .user-avatar img sizing rule - the header topbar avatar is a div with an <img> inserted via JS, and had no rule constraining the inserted image to the 32px circle, so an uploaded photo rendered at its natural full size |
 * VERSION 1.0.7
 * - File Modified | Ary van der Pijl | 2026-08-11 | ATH-LEM-CERB-001 | CERBEATH rebrand: added .sidebar-logo-img/.auth-logo-img (image crest sizing) and .metismenu .has-arrow/.mm-active caret color overrides for the new collapsible accordion nav groups |
 * VERSION 1.0.6
 * - File Modified | Ary van der Pijl | 2026-07-23 | ATH-SKELETON-003 | Added .presence-stack/.presence-avatar/.presence-more (overlapping avatar stack for the "who's online" header widget) |
 * VERSION 1.0.5
 * - File Modified | Ary van der Pijl | 2026-07-23 | ATH-SKELETON-003 | Added object-fit:cover to .user-avatar so an <img> avatar fills the circle without distortion (previously only ever held text initials) |
 * VERSION 1.0.4
 * - File Modified | Ary van der Pijl | 2026-07-22 | ATH-SKELETON-012 | Added sortable-column-header styles (.th-sortable, .th-sort-icon, .th-sort-active) for the DataTable component |
 * VERSION 1.0.3
 * - File Modified | Ary van der Pijl | 2026-07-22 | ATH-SKELETON-011 | Dashtreme look-and-feel: rebuilt shell/sidebar/header onto wrapper/sidebar-wrapper/metismenu/topbar/page-wrapper structure; swapped material-icons-round selectors for Boxicons `i` tags; rounder card/modal/table radii |
 * 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-SKELETON-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;
  width: 575px;
}

/* ─── App Shell ──────────────────────────────────────────────────────────── */

.wrapper {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */

#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;
}

.wrapper.toggled #sidebar {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  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);
  overflow: hidden;
  white-space: nowrap;
  background-color: #000000;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  overflow: hidden;
}

.sidebar-logo-icon {
  font-size: 22px;
  color: var(--color-accent);
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logo-img {
  height: 60px;
  max-width: 100%;
  object-fit: contain;
  flex-shrink: 0;
}

.metismenu .has-arrow:after {
  border-color: var(--sidebar-text);
}

.metismenu .mm-active>.has-arrow:after,
.metismenu .has-arrow[aria-expanded="true"]:after {
  border-color: var(--sidebar-text-hover);
}

.toggle-icon {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  cursor: pointer;
  transition: background var(--transition-base), transform var(--transition-slow);
  flex-shrink: 0;
}

.toggle-icon:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}

.wrapper.toggled .toggle-icon {
  transform: rotate(180deg);
}

.wrapper.toggled .sidebar-header,
.wrapper.toggled .sidebar-logo-text,
.wrapper.toggled .menu-label,
.wrapper.toggled .menu-title {
  opacity: 0;
  pointer-events: none;
}

.metismenu {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  list-style: none;
  margin: 0;
  padding: var(--space-4) 0;
  scrollbar-width: thin;
  scrollbar-color: var(--sidebar-border) transparent;
}

.menu-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;
  transition: opacity var(--transition-fast);
}

.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 i {
  font-size: 20px;
  flex-shrink: 0;
}

.nav-item .parent-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
}

.nav-item .menu-title,
.nav-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition-fast);
}

.nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  font-size: 10px;
  font-weight: var(--fw-semibold);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* ─── Main ───────────────────────────────────────────────────────────────── */

.page-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-slow);
}

.wrapper.toggled .page-wrapper {
  margin-left: var(--sidebar-collapsed);
}

/* ─── Header ─────────────────────────────────────────────────────────────── */

.topbar {
  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 i {
  font-size: 20px;
}

.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: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  flex-shrink: 0;
  object-fit: cover;
  overflow: hidden;
}

.user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.presence-stack {
  align-items: center;
  margin-right: var(--space-2, 8px);
}

.presence-avatar,
.presence-more {
  width: 28px;
  height: 28px;
  font-size: 11px;
  margin-left: -8px;
  border: 2px solid var(--color-surface);
}

.presence-stack> :first-child {
  margin-left: 0;
}

.presence-more {
  border-radius: 50%;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-semibold);
}

.user-name {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
}

/* ─── Page Content ───────────────────────────────────────────────────────── */

.page-content {
  flex: 1;
  padding: var(--space-6);
  max-width: 1400px;
  width: 100%;
}

/* ─── Site Footer ────────────────────────────────────────────────────────── */

.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--color-border-light);
  background: var(--color-surface);
  padding: var(--space-4) var(--space-6);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
  max-width: 1400px;
  margin: 0 auto;
}

.site-footer__copy,
.site-footer__dev {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.site-footer__dev-logo {
  height: 18px;
  width: auto;
  object-fit: contain;
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.site-footer__link {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.site-footer__link:hover,
.site-footer__link:focus-visible {
  color: var(--color-primary);
}

@media (max-width: 768px) {
  .site-footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

.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-lg); */
  /* box-shadow: var(--shadow-md); */
}

.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);
  background-color: var(--color-navy-500);
  ;
  /* gap: var(--space-4); */
}

.card-title {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--color-navy-50);
  margin: 0;
}

.card-body {
  /* padding: var(--space-5) 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-lg) var(--radius-lg);
}

/* ─── Stat Cards ─────────────────────────────────────────────────────────── */

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
}

.stat-icon i {
  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-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.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 th.th-sortable {
  cursor: pointer;
  user-select: none;
}

.table th.th-sortable:hover {
  color: var(--color-text);
}

.th-sort-icon {
  font-size: 14px;
  margin-left: var(--space-1);
  vertical-align: middle;
  opacity: .5;
}

.table th.th-sort-active {
  color: var(--color-primary);
}

.table th.th-sort-active .th-sort-icon {
  opacity: 1;
}

.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: #fff;
  border-color: var(--color-primary);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: #fff;
}

.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: #fff;
  border-color: var(--color-danger);
}

.btn-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.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 i {
  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);
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.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);
}

.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-xl);
  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-lg);
  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 i {
  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);
}

/* Brand 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-logo-img {
  max-width: var(--auth-crest-size);
  max-height: var(--auth-crest-size);
  object-fit: contain;
  margin-bottom: var(--space-3);
}

.auth-crest i {
  font-size: 40px;
  color: var(--color-accent);
}

.auth-brand-name {
  color: var(--auth-brand-color);
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  letter-spacing: 0.05em;
  text-align: center;
}

.auth-brand-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);
}

/* ─── Legal Page Layout (Cookie/Privacy/Security Policy, Terms) ─────────────── */

.legal-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--color-bg);
}

.legal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
}

.legal-topbar__brand {
  display: flex;
  align-items: center;
}

.legal-topbar__logo {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.legal-content {
  flex: 1;
  padding: var(--space-8) var(--space-6);
}

.legal-container {
  max-width: 880px;
  margin: 0 auto;
}

/* Override Bootstrap btn-primary to use brand navy in auth context */
.auth-card .btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

.auth-card .btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.auth-card .text-primary {
  color: var(--color-accent-text-on-light) !important;
}

.auth-card a.text-primary:hover {
  color: var(--color-accent) !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 i {
  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 ────────────────────────────────────────────────────────────── */

.skeleton {
  background: linear-gradient(90deg, var(--color-border) 25%, var(--color-surface-2) 50%, var(--color-border) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-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-lg);
  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 i {
  font-size: 16px;
  color: var(--color-text-muted);
}

/* ─── Code Editor ────────────────────────────────────────────────────────── */

.code-editor {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: #0f172a;
  color: #e2e8f0;
  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) {
  #sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
  }

  #sidebar.mobile-open {
    transform: translateX(0);
  }

  .page-wrapper {
    margin-left: 0;
  }

  .page-content {
    padding: var(--space-4);
  }

  .page-header {
    flex-direction: column;
  }
}

/* ─── Utilities ──────────────────────────────────────────────────────────── */

.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;
}

/* ─── 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;
}

.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: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-md);
}

.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: #ffffff;
  font-size: var(--text-xs);
}

/* ─── 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);
}

/* ─── Branding Preview (Appearance page logo/favicon) ───────────────────────── */

.branding-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}

.branding-preview--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--color-text-muted);
}

/* ─── Text Utilities ─────────────────────────────────────────────────────── */

.text-xs {
  font-size: 0.75rem;
}

/* ─── Print Styles ───────────────────────────────────────────────────────── */

@media print {
  #sidebar, .topbar, #toast-container, .no-print {
    display: none !important;
  }

  .page-wrapper {
    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;
  }
}