/*!
 * ============================================================================
 * 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: waATHon - Main Stylesheet
 * @DESCRIPTION: Core component styles for the waATHon 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.1.2
 * - File Modified | Ary van der Pijl | 2026-11-07 | waATHon-QA-005 | Added .marketing-* styles for the new /welcome public landing page - reuses the
 *   existing glass-surface tokens and .legal-page structural pattern rather than inventing a separate visual language |
 * VERSION 1.1.1
 * - File Modified | Ary van der Pijl | 2026-11-06 | waATHon-QA-002 | .app-footer now position:fixed to the viewport bottom on every layout (was static,
 *   bottom-of-flow only) with glass styling matching .app-header/.card; .app-content/.auth-cover-wrapper/.legal-content reserve bottom padding so
 *   content never sits underneath it, with taller mobile-breakpoint values to match the footer's wrapped height at that width |
 * VERSION 1.1.0
 * - File Modified | Ary van der Pijl | 2026-09-10 | ATH-WA-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.9
 * - File Modified | Ary van der Pijl | 2026-07-30 | ATH-WA-024 | Dashtreme wholesale reskin: added .app-header.is-scrolled (header scroll-shadow, driven by core/app-plugins.js) |
 * VERSION 1.0.8
 * - File Modified | Ary van der Pijl | 2026-07-30 | ATH-WA-024 | Dashtreme wholesale reskin: body/legal-page background now paints the fixed gradient (was background-color, now background shorthand + attachment:fixed); .modal-content/.dropdown-menu made opaque (not glass, matching bootstrap-extended.css); .nav-submenu accordion switched from max-height/aria-expanded to metisMenu's mm-collapse/mm-show/mm-collapsing classes; .btn-primary/.nav-item.active/.conversation-item.active glows repointed from the waATHon teal gradient to flat Bootstrap blue (--color-primary) - the brand gradient/scale stays reserved for the dashboard KPI hero tiles, module tiles, and auth crest; removed the now-dead .skin-option CSS block and the 10 orphaned .material-icons-round selectors |
 * VERSION 1.0.7
 * - File Modified | Ary van der Pijl | 2026-07-29 | waATHon-022 | Dashtreme template migration: sidebar items wrapped in .parent-icon (template
 *   convention), added .nav-group/.has-arrow/.nav-submenu accordion styles for the WhatsApp module group, icon selectors extended to accept
 *   Boxicons (.bx) alongside Material Icons, replaced the centered .auth-page/.auth-container layout with a split-screen .auth-page-cover /
 *   .auth-cover-brand / .auth-cover-panel layout (.auth-card retained, now shadow-less inside the panel) |
 * VERSION 1.0.6
 * - File Modified | Ary van der Pijl | 2026-07-29 | waATHon-020 | Added .presence-dot (+online/offline modifiers) for the Users page presence indicator |
 * VERSION 1.0.5
 * - File Modified | Ary van der Pijl | 2026-07-29 | waATHon-016 | Added .app-footer/.legal-page styles for the new footer partial and public legal pages |
 * VERSION 1.0.4
 * - File Modified | Ary van der Pijl | 2026-07-20 | waATHon-009 | Rebrand reskin: gradient logo/active-nav/buttons, renamed --navy/--gold variant classes to
 *   --teal/--coral, display-font headings, stat-card sparklines, chat bubble + conversation-item styles, fixed stale indigo focus-ring and untokenized
 *   outline buttons |
 * VERSION 1.0.3
 * - File Modified | Ary van der Pijl | 2026-07-13 | waATHon-006 | Renamed .auth-lodge-name/.auth-lodge-sub to .auth-brand-name/.auth-brand-sub (matches
 *   auth.php); removed remaining "lodge" wording from comments |
 * VERSION 1.0.2
 * - File Modified | Ary van der Pijl | 2026-06-16 | waATHon-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 | waATHon-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: var(--color-bg);
  background-attachment: fixed;
  background-size: cover;
  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;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
}

/* ─── 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);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  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-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: #ffffff;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logo-accent {
  color: var(--color-primary);
}

.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);
  box-shadow: 0 6px 16px rgb(13 110 253 / 0.35);
}

.nav-item--disabled {
  opacity: var(--module-tile-disabled-opacity);
  cursor: not-allowed;
  pointer-events: none;
}

.nav-item .parent-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  flex-shrink: 0;
}

.nav-item .parent-icon .bx {
  font-size: 20px;
}

/* Bare icon directly inside a .nav-item with no .parent-icon wrapper
   (e.g. the dashboard's Quick Actions list) - same sizing, no wrapper needed. */
.nav-item>.bx {
  font-size: 20px;
  flex-shrink: 0;
  width: 20px;
}

.nav-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── Sidebar Accordion Group (Dashtreme has-arrow convention) ──────────── */

.nav-group>.nav-item.has-arrow {
  position: relative;
}

.nav-arrow {
  font-size: 16px;
  margin-left: auto;
  flex-shrink: 0;
  transition: transform var(--transition-base);
}

.nav-group>.nav-item[aria-expanded="true"] .nav-arrow {
  transform: rotate(90deg);
}

.nav-submenu {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* metisMenu drives expand/collapse via these classes + an inline height during
   the transition, rather than the aria-expanded/max-height pair above (which
   metisMenu doesn't set) - pattern matches Dashtreme's own app.css. */
.mm-collapse:not(.mm-show) {
  display: none;
}

.mm-collapsing {
  position: relative;
  height: 0;
  overflow: hidden;
  transition: height var(--transition-slow);
}

.nav-submenu .nav-item {
  padding-left: calc(var(--space-4) + 28px);
  font-size: var(--text-sm);
}

.nav-submenu .bx-radio-circle {
  font-size: 6px;
  margin-right: var(--space-2);
}

.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;
}

.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: #fff;
}

/* ─── 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);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  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);
  transition: box-shadow var(--transition-base), background var(--transition-base);
}

.app-header.is-scrolled {
  background: rgb(0 0 0 / 0.35);
  box-shadow: var(--shadow-md);
}

.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 .bx {
  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;
  overflow: hidden;
}

.presence-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--color-surface);
}

.presence-dot.presence-online {
  background: var(--color-success);
}

.presence-dot.presence-offline {
  background: var(--color-text-muted);
}

.user-name {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
}

/* ─── Page Content ───────────────────────────────────────────────────────── */

.app-content {
  flex: 1;
  padding: var(--space-6);
  padding-bottom: calc(var(--space-6) + 52px);
  max-width: 1400px;
  width: 100%;
}

.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-family: var(--font-display);
  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);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  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-family: var(--font-display);
  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);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  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 .bx {
  font-size: 24px;
}

.stat-value {
  font-family: var(--font-display);
  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);
}

/* ─── Stat Cards: Dashtreme-style gradient hero variant (dashboard only) ─── */

.stat-card--hero {
  border: none;
  color: #ffffff;
}

.stat-card--hero.stat-card--grad-teal {
  background: var(--stat-hero-grad-teal);
}

.stat-card--hero.stat-card--grad-coral {
  background: var(--stat-hero-grad-coral);
}

.stat-card--hero.stat-card--grad-navy {
  background: var(--stat-hero-grad-navy);
}

.stat-card--hero.stat-card--grad-green {
  background: var(--stat-hero-grad-green);
}

.stat-card--hero .stat-icon {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.stat-card--hero .stat-value {
  color: #ffffff;
}

.stat-card--hero .stat-label {
  color: rgba(255, 255, 255, 0.75);
}

.stat-card--hero .stat-change {
  color: rgba(255, 255, 255, 0.85);
}

.stat-card--hero .stat-change.up,
.stat-card--hero .stat-change.down {
  color: #ffffff;
}

.stat-card--hero .text-success {
  color: #ffffff !important;
}

.stat-card--hero .text-warning {
  color: #ffe8b3 !important;
}

.stat-card--hero .text-muted {
  color: rgba(255, 255, 255, 0.75) !important;
}

.stat-card--hero .stat-sparkline polyline {
  stroke: rgba(255, 255, 255, 0.65);
}

/* ─── Table ──────────────────────────────────────────────────────────────── */

.table-wrapper {
  background: var(--color-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  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 {
  /* Flat Bootstrap-blue, not the brand gradient - that stays reserved for the
     dashboard KPI hero tiles and the auth crest as a deliberate accent. */
  background: var(--color-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 18px rgb(13 110 253 / 0.30);
  transition: transform var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgb(13 110 253 / 0.40);
  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-outline-secondary {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.btn-outline-secondary:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-outline-danger {
  background: transparent;
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.btn-outline-danger:hover {
  background: var(--color-danger);
  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 .bx {
  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: var(--shadow-glow-primary);
}

.form-control::placeholder {
  color: var(--color-text-subtle);
}

textarea.form-control {
  height: auto;
  min-height: 100px;
  resize: vertical;
  line-height: var(--lh-normal);
}

/* Template body preview (wa-templates.php) - was hardcoded Bootstrap .bg-light, which
   renders as a stark white box against this app's dark glass theme everywhere else. */
.template-preview-box {
  background: var(--color-surface-2);
  color: var(--color-text);
  min-height: 80px;
}

.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: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 {
  /* Opaque, not glass - a modal sitting over page content needs to fully
     occlude it, unlike .card which floats on the fixed gradient background. */
  background: #171717;
  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);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  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 .bx {
  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 (Dashtreme auth-cover split-screen layout) ─────────────── */

.auth-page-cover {
  min-height: 100vh;
  background: var(--color-surface);
}

.auth-cover-wrapper {
  display: flex;
  min-height: 100vh;
  padding-bottom: 52px;
}

.auth-cover-brand {
  flex: 1 1 55%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--auth-page-bg);
  background-image: var(--color-primary-gradient);
  background-blend-mode: overlay;
  padding: var(--space-8);
}

.auth-cover-panel {
  flex: 1 1 45%;
  max-width: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  background: var(--color-surface);
}

.auth-cover-panel-inner {
  width: 100%;
  max-width: 400px;
}

/* Brand crest + name lockup */
.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  margin-bottom: var(--space-8);
}

.auth-logo-mobile {
  display: none;
}

.auth-crest {
  width: var(--auth-crest-size);
  height: var(--auth-crest-size);
  background: var(--auth-crest-bg);
  border: none;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3);
  transition: box-shadow var(--transition-base);
}

.auth-cover-brand .auth-crest {
  width: calc(var(--auth-crest-size) * 1.4);
  height: calc(var(--auth-crest-size) * 1.4);
  background: rgba(255, 255, 255, 0.12);
}

.auth-crest:hover {
  box-shadow: var(--shadow-glow-primary);
}

.auth-crest .bx {
  font-size: 40px;
  color: #ffffff;
}

.auth-cover-brand .auth-crest .bx {
  font-size: 56px;
}

@media (max-width: 992px) {
  .auth-cover-brand {
    display: none;
  }

  .auth-cover-panel {
    flex: 1 1 100%;
    max-width: none;
  }

  .auth-logo-mobile {
    display: flex;
  }
}

.auth-brand-name {
  font-family: var(--font-display);
  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);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--auth-card-radius);
  padding: var(--space-8);
  box-shadow: var(--auth-card-shadow);
}

/* Inside the cover-panel the card sits directly on the panel's own background,
   so the boxed chrome (which was designed for a card floating over the dark
   auth-page background) is dropped - form controls sit flush on the panel. */
.auth-cover-panel .auth-card {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  padding: 0;
}

.auth-heading {
  font-family: var(--font-display);
  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 the brand gradient in auth context */
.auth-card .btn-primary {
  background: var(--color-primary-gradient);
  border-color: transparent;
  color: #ffffff;
}

.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 .bx {
  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 {
  /* Opaque, not glass - same reasoning as .modal-content. */
  background: #1e1e1e;
  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 .bx {
  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) {
  .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);
    padding-bottom: calc(var(--space-4) + 68px);
  }

  .page-header {
    flex-direction: column;
  }

  /* Links wrap to their own row below the copyright line at this width, so the footer is
     taller than its 52px desktop height - the credit line is dropped rather than letting it
     wrap further still, and the padding-bottom reservations above are bumped to match. */
  .app-footer {
    min-height: 68px;
    justify-content: center;
    text-align: center;
  }

  .app-footer-credit {
    display: none;
  }

  .auth-cover-wrapper {
    padding-bottom: 68px;
  }

  .legal-content {
    padding-bottom: calc(var(--space-8) + 68px);
  }
}

/* ─── 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;
}

/* ─── Sidebar Logo Icon ──────────────────────────────────────────────────── */

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--color-primary-gradient);
  border: none;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo-icon .bx {
  color: #ffffff;
  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;
}

.icon-3xl {
  font-size: 64px;
}

.icon-xl {
  font-size: 72px;
}

/* ─── Stat Card Colour Variants ──────────────────────────────────────────── */

.stat-icon--teal {
  background: var(--stat-teal-bg);
  color: var(--stat-teal-color);
}

.stat-icon--coral {
  background: var(--stat-coral-bg);
  color: var(--stat-coral-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);
}

/* ─── Stat Card Sparkline ────────────────────────────────────────────────── */

.stat-sparkline {
  display: block;
  width: 100%;
  height: 28px;
  margin-top: var(--space-2);
}

.stat-sparkline polyline {
  fill: none;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 220;
  animation: statDrawLine 1.2s ease both;
}

@keyframes statDrawLine {
  from {
    stroke-dashoffset: 220;
  }

  to {
    stroke-dashoffset: 0;
  }
}

/* ─── 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--teal {
  background: var(--module-tile-bg);
}

.module-tile--coral {
  background: var(--module-tile-bg-coral);
}

.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--teal {
  color: var(--color-teal-700);
}

.module-tile__icon--coral {
  color: var(--color-coral-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--teal {
  color: var(--color-teal-700);
}

.module-tile__label--coral {
  color: var(--color-coral-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--teal {
  color: var(--color-teal-700);
}

.quick-action-icon--coral {
  color: var(--color-coral-700);
}

.quick-action-icon--red {
  color: var(--color-danger);
}

/* ─── Dashboard Phase Badge ──────────────────────────────────────────────── */

.badge-teal {
  background: var(--color-primary-gradient);
  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);
}

/* ─── Text Utilities ─────────────────────────────────────────────────────── */

.text-xs {
  font-size: 0.75rem;
}

/* ─── Conversation List (wa-messages) ────────────────────────────────────── */

.conversation-item {
  transition: background var(--transition-base);
}

.conversation-item:hover {
  background: var(--color-surface-2);
}

.conversation-item.active {
  background: rgb(13 110 253 / 0.12);
  border-left: 3px solid var(--color-primary);
  padding-left: calc(var(--space-2) - 3px) !important;
}

/* ─── Chat Bubbles (wa-messages) ─────────────────────────────────────────── */

.msg-row {
  display: flex;
  margin-bottom: var(--space-2);
}

.msg-row--out {
  justify-content: flex-end;
}

.msg-row--in {
  justify-content: flex-start;
}

.msg-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 70%;
}

.msg-row--out .msg-bubble-wrap {
  align-items: flex-end;
}

.msg-row--in .msg-bubble-wrap {
  align-items: flex-start;
}

.msg-bubble {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
}

.msg-bubble--out {
  background: var(--color-primary-gradient);
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
}

.msg-bubble--in {
  background: var(--color-surface-2);
  color: var(--color-text);
  border-radius: 16px 16px 16px 4px;
}

.msg-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: 3px;
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */

/* Fixed to the viewport bottom on every page (app shell, auth, legal) rather than sitting
   in normal flow - stays visible regardless of scroll position or how little content a page
   has. background/backdrop-filter match the other glass surfaces (.app-header, .card) so it
   reads as part of the same system rather than a flat bar; min-height is fixed (not just
   padding) so JS below can size each layout's content area to never sit underneath it. */
.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 52px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-6);
  border-top: 1px solid var(--color-border);
  background: var(--header-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  font-size: 13px;
  color: var(--color-text-muted);
  z-index: var(--z-fixed);
}

.app-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}

.app-footer-links a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.app-footer-links a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.app-footer-credit {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.app-footer-logo {
  height: 20px;
  width: auto;
}

/* ─── Legal Pages ────────────────────────────────────────────────────────── */

.legal-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--color-bg);
}

.legal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.legal-content {
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
  padding-bottom: calc(var(--space-8) + 52px);
  line-height: 1.7;
}

.legal-content h1 {
  font-family: var(--font-display);
  margin-bottom: var(--space-2);
}

.legal-content .legal-updated {
  color: var(--color-text-muted);
  font-size: 13px;
  margin-bottom: var(--space-6);
}

.legal-content h2 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  font-size: 20px;
}

.legal-content p, .legal-content li {
  color: var(--color-text-muted);
}

.legal-content .legal-todo {
  background: var(--color-warning-bg);
  border-left: 3px solid var(--color-warning);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-4) 0;
  font-size: 13px;
}

/* ─── Marketing Page (/welcome) ──────────────────────────────────────────── */

.marketing-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--color-bg);
}

.marketing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.marketing-header-cta {
  flex-shrink: 0;
}

.marketing-content {
  flex: 1;
  padding-bottom: calc(var(--space-8) + 52px);
}

.marketing-hero {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-6);
  text-align: center;
}

.marketing-hero-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.15;
  margin-bottom: var(--space-4);
}

.marketing-hero-subtitle {
  color: var(--color-text-muted);
  font-size: var(--text-xl);
  line-height: 1.6;
  max-width: 640px;
  margin: 0 auto var(--space-6);
}

.marketing-hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
}

.marketing-section {
  padding: var(--space-8) var(--space-6);
}

.marketing-section--alt {
  background: var(--color-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.marketing-section--cta {
  text-align: center;
}

.marketing-section-title {
  font-family: var(--font-display);
  max-width: 1040px;
  margin: 0 auto var(--space-5);
  text-align: center;
  font-size: clamp(22px, 3.5vw, 32px);
}

.marketing-section > p, .marketing-section .marketing-list {
  max-width: 740px;
  margin: 0 auto var(--space-3);
  color: var(--color-text-muted);
  line-height: 1.7;
}

.marketing-list li {
  margin-bottom: var(--space-2);
}

.marketing-benefit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
  max-width: 1200px;
  margin: 0 auto;
}

.marketing-benefit-card {
  background: var(--color-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
}

.marketing-benefit-icon {
  font-size: 28px;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}

.marketing-benefit-card h3 {
  font-size: 17px;
  margin-bottom: var(--space-2);
}

.marketing-benefit-card p {
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}

.marketing-diff-list {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.marketing-diff-item p {
  margin: 0;
  color: var(--color-text-muted);
  line-height: 1.7;
}

.marketing-diff-item strong {
  color: var(--color-text);
}

.marketing-pricing-note {
  font-size: 13px;
  color: var(--color-text-subtle);
  margin-top: var(--space-4);
}

@media (max-width: 768px) {
  .marketing-content {
    padding-bottom: calc(var(--space-6) + 68px);
  }

  .marketing-section {
    padding: var(--space-6) var(--space-4);
  }
}

/* ─── 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;
  }
}