/*!
 * ============================================================================
 * 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: ZENATH - Main Stylesheet
 * @DESCRIPTION: Core component styles for the ZENATH 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.0.17
 * - File Modified | Ary van der Pijl | 2026-08-05 | ATH-STUDIOS-020 | Added .gallery/.gallery-lightbox (Carousel component - photo galleries for rooms/assets/stock/facilities), .signature-pad (SignaturePad canvas), .table-thumb (list-row hero thumbnails), and .catalog-grid/.catalog-card/.teaser-grid/.public-nav__actions (public catalog page + home page teaser + public nav "Browse Catalog" link) for Module 20.
 * VERSION 1.0.0.16
 * - File Modified | Ary van der Pijl | 2026-08-04 | ATH-STUDIOS-018 | Fixed the header avatar rendering at full/natural size after upload: app.js (header.init()) and profile.js (avatar-upload handler) both insert a bare <img> as a CHILD of #header-user-initials, relying on the parent's .user-avatar class (width/height/object-fit) to constrain it - but those properties don't apply to an unconstrained child, only to .user-avatar itself. users.js/presence.js already avoid this by putting the .user-avatar class directly on the <img>. Added a `.user-avatar img` rule instead of touching both JS call sites separately, so any future img inserted the same way is covered too.
 * VERSION 1.0.0.15
 * - File Modified | Ary van der Pijl | 2026-08-04 | ATH-STUDIOS-017 | Added .public-nav/.public-footer/.hero/.public-section/.feature-grid/.feature-card/.trust-grid/.public-cta for the new public brochure site (public.php layout + home.php page) - the app had no unauthenticated marketing front door before this.
 * VERSION 1.0.0.14
 * - File Modified | Ary van der Pijl | 2026-08-04 | ATH-STUDIOS-014 | Phase 21 (Micro-interactions) - added .btn:active press feedback (no active/pressed state existed at all); a pageFadeIn keyframe on .page-content/.auth-container for the 150ms view-change fade the spec calls for (this is a server-rendered per-route app, not an SPA, so "page transition" means fade-in on load, not a route-change animation); retimed toast slide-in to 300ms/5s auto-dismiss to match spec numbers (was 200ms/4s); added .form-control.is-valid for live password-confirmation match feedback; added a prefers-reduced-motion guard covering all of the above plus the existing toast/skeleton/spin animations.
 * VERSION 1.0.0.13
 * - File Modified | Ary van der Pijl | 2026-08-04 | ATH-STUDIOS-013 | Phase 19 - added .password-strength/.password-strength__bar/__seg/__checks for the new password-policy.js strength meter (register/reset-password/change-password).
 * VERSION 1.0.0.12
 * - File Modified | Ary van der Pijl | 2026-08-04 | ATH-STUDIOS-013 | Phase 19 (Component Library) - added .alert/.alert-success/-warning/-danger/-info overrides, re-skinning Bootstrap's stock alert classes (used as-is by login.php/profile.php/accept-invite.php) with design tokens instead of Bootstrap's default palette - flagged as a gap in the Phase 17 design-system audit (toasts/badges were already tokenised, plain alerts weren't).
 * VERSION 1.0.0.11
 * - File Modified | Ary van der Pijl | 2026-08-04 | ATH-STUDIOS-013 | Phase 18 (Global Layout & Navigation) - added .app-footer/.app-footer__links/.app-footer__link/.app-footer__credit for the new sticky app-shell footer partial (spec Phase 18.3) - the app had no footer at all before this.
 * VERSION 1.0.0.10
 * - File Modified | Ary van der Pijl | 2026-07-28 | ATH-STUDIOS-007 | Added #qr-reader - constrains the html5-qrcode library's injected <video> to the Scan QR modal's width with rounded corners, so the camera preview doesn't overflow the modal-dialog on wide source resolutions.
 * VERSION 1.0.0.9
 * - File Modified | Ary van der Pijl | 2026-07-26 | ATH-STUDIOS-006 | Sidebar accordion: li.sidebar-group > ul now resets browser list defaults and adds a hierarchy indent; .mm-active > .has-arrow gets a hover-tint background so the open section reads distinct from a plain hover without being confused with a leaf .nav-item.active (no left accent border - the header isn't itself a destination). In .wrapper.toggled (icon-rail collapsed mode) all submenus force-display and arrows hide, matching Dashtreme's own collapsed-sidebar behaviour - the accordion's open/closed state only matters at full sidebar width.
 * VERSION 1.0.0.8
 * - File Modified | Ary van der Pijl | 2026-07-26 | ATH-STUDIOS-006 | Glassmorphism pass: body now paints --app-bg-gradient (soft primary/accent blobs) instead of a flat --color-bg so translucent surfaces have something to read against; .card/.stat-card/.table-wrapper/.modal-content/.topbar switched to --glass-bg + backdrop-filter blur(--glass-blur) + --glass-border/--glass-shadow. Brings WEB in line with the glass treatment already shipped on MOBILE (GlassContainer/GlassCard). Sidebar stays solid navy - a translucent nav column tested illegible against 7 skins x light/dark and isn't part of the mobile precedent (bottom nav there, not a persistent side column).
 * VERSION 1.0.0.7
 * - File Modified | Ary van der Pijl | 2026-07-26 | ATH-STUDIOS-006 | Dashtreme page-template adoption: added .invoice-doc (printable letterhead), .contact-card (client grid), .type-tile (document-template folder tiles), .booking-calendar-toggle, .email-split (email-templates inbox layout), and .task-checklist (maintenance to-do board) - all token-driven, see per-page changelogs for the matching Dashtreme source template |
 * VERSION 1.0.0.6
 * - File Modified | Ary van der Pijl | 2026-07-23 | ATH-STOCK-003 | Added .presence-stack/.presence-avatar/.presence-more (overlapping avatar stack for the "who's online" header widget) |
 * VERSION 1.0.0.5
 * - File Modified | Ary van der Pijl | 2026-07-23 | ATH-STOCK-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.0.4
 * - File Modified | Ary van der Pijl | 2026-07-22 | ATH-STOCK-012 | Added sortable-column-header styles (.th-sortable, .th-sort-icon, .th-sort-active) for the DataTable component |
 * VERSION 1.0.0.3
 * - File Modified | Ary van der Pijl | 2026-07-22 | ATH-STOCK-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.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.0.1
 * - File Created | Ary van der Pijl | 2026-05-01 | ATH-STOCK-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(--app-bg-gradient);
  background-attachment: fixed;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

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

img, svg {
  vertical-align: middle;
}

/* ─── App Shell ──────────────────────────────────────────────────────────── */

.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;
}

.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;
}

.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);
}

/* ─── Sidebar Accordion Groups ───────────────────────────────────────────── */

.sidebar-group>ul {
  list-style: none;
  margin: 0;
  padding: 0 0 0 var(--space-3);
}

.sidebar-group.mm-active>.has-arrow {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-text-hover);
}

.wrapper.toggled .metismenu .has-arrow:after {
  display: none;
}

.wrapper.toggled .metismenu .mm-collapse:not(.mm-show) {
  display: block;
}

.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(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-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;
}

.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%;
  animation: pageFadeIn var(--transition-base);
}

@keyframes pageFadeIn {
  from {
    opacity: 0;
  }
}

/* ─── App Footer ─────────────────────────────────────────────────────────── */

.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.app-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.app-footer__link {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.app-footer__link:hover,
.app-footer__link:focus-visible {
  color: var(--color-primary);
  text-decoration: underline;
}

.app-footer__credit {
  color: var(--color-text-muted);
  text-decoration: none;
}

.app-footer__credit:hover,
.app-footer__credit:focus-visible {
  color: var(--color-primary);
  text-decoration: underline;
}

@media (max-width: 768px) {
  .app-footer {
    flex-direction: column;
    text-align: center;
  }
}

.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(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
  gap: var(--space-4);
}

.card-title {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  margin: 0;
}

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

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ─── Stat Cards ─────────────────────────────────────────────────────────── */

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--glass-shadow);
  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;
}

.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(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--glass-shadow);
}

.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:active {
  transform: translateY(1px) scale(0.98);
}

.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);
}

.form-control.is-valid, .form-select.is-valid {
  border-color: var(--color-success);
}

.invalid-feedback {
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

.valid-feedback {
  font-size: var(--text-xs);
  color: var(--color-success);
  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(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow);
}

.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);
}

/* ─── Password Strength Meter ────────────────────────────────────────────── */

.password-strength {
  margin-top: var(--space-2);
}

.password-strength__bar {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.password-strength__seg {
  flex: 1;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--color-border);
  transition: background var(--transition-fast);
}

.password-strength__seg.is-filled.score-1 {
  background: var(--color-danger);
}

.password-strength__seg.is-filled.score-2 {
  background: var(--color-danger);
}

.password-strength__seg.is-filled.score-3 {
  background: var(--color-warning);
}

.password-strength__seg.is-filled.score-4 {
  background: var(--color-warning);
}

.password-strength__seg.is-filled.score-5 {
  background: var(--color-success);
}

.password-strength__checks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.password-strength__checks li {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.password-strength__checks li.is-met {
  color: var(--color-success);
}

/* ─── Alert Boxes ────────────────────────────────────────────────────────── */
/* Re-skins Bootstrap's stock .alert-* with design tokens instead of Bootstrap's
   default palette - no markup changes needed on the pages already using them
   (login.php, profile.php, accept-invite.php). */

.alert {
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: var(--text-sm);
}

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

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

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

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

/* ─── 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 .3s ease;
}

.toast-item.hide {
  animation: toastOut .3s ease forwards;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(40px, 12px);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translate(40px, 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);
  animation: pageFadeIn var(--transition-base);
}

/* 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-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);
}

/* 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-radius: var(--radius-md);
  text-decoration: none;
  transition: all var(--transition-base);
}

.module-tile:hover {
  text-decoration: none;
  filter: brightness(0.95);
}

.module-tile--navy {
  background: var(--module-tile-bg);
}

.module-tile--gold {
  background: var(--module-tile-bg-gold);
}

.module-tile--green {
  background: var(--module-tile-bg-green);
}

.module-tile--blue {
  background: var(--module-tile-bg-blue);
}

.module-tile--disabled {
  opacity: var(--module-tile-disabled-opacity);
  pointer-events: none;
  cursor: not-allowed;
}

.module-tile__icon {
  font-size: 32px;
}

.module-tile__icon--navy {
  color: var(--color-navy-700);
}

.module-tile__icon--gold {
  color: var(--color-gold-700);
}

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

.module-tile__icon--blue {
  color: var(--color-info);
}

.module-tile__label {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
}

.module-tile__label--navy {
  color: var(--color-navy-700);
}

.module-tile__label--gold {
  color: var(--color-gold-700);
}

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

.module-tile__label--blue {
  color: var(--color-info);
}

/* ─── Quick Action Nav Items ─────────────────────────────────────────────── */

.quick-action-nav {
  color: var(--color-text);
}

.quick-action-icon--navy {
  color: var(--color-navy-700);
}

.quick-action-icon--gold {
  color: var(--color-gold-700);
}

.quick-action-icon--red {
  color: var(--color-danger);
}

/* ─── Dashboard Phase Badge ──────────────────────────────────────────────── */

.badge-navy {
  background: var(--color-navy-700);
  color: #ffffff;
  font-size: var(--text-xs);
}

/* ─── Skin Selector ──────────────────────────────────────────────────────── */

.skin-option {
  cursor: pointer;
  padding: var(--space-3);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  text-align: center;
  transition: border-color var(--transition-fast);
}

.skin-option.selected,
.skin-option--selected {
  border-color: var(--color-primary);
}

.skin-option__swatch {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  margin: 0 auto var(--space-2);
  background: var(--swatch-color, var(--color-primary));
}

.skin-option__label {
  font-size: 0.75rem;
  font-weight: 500;
}

/* ─── Filter Toolbar ─────────────────────────────────────────────────────── */

.filter-toolbar__input {
  max-width: 260px;
}

.filter-toolbar__input--sm {
  max-width: 200px;
}

.filter-toolbar__select {
  max-width: 160px;
}

.filter-toolbar__select--sm {
  max-width: 140px;
}

.filter-toolbar__date {
  max-width: 160px;
}

/* ─── Theme Selector ─────────────────────────────────────────────────────── */

.theme-option {
  cursor: pointer;
  border-radius: var(--radius-md) !important;
}

.theme-option--selected {
  border-color: var(--color-primary) !important;
}

.theme-option__icon--warning {
  color: var(--color-warning);
}

/* ─── Permissions List ───────────────────────────────────────────────────── */

.permissions-list {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-4);
}

/* ─── Avatar Placeholder ─────────────────────────────────────────────────── */

.avatar-placeholder {
  width: 80px;
  height: 80px;
  font-size: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  color: var(--color-text-muted);
}

/* ─── Text Utilities ─────────────────────────────────────────────────────── */

.text-xs {
  font-size: 0.75rem;
}

/* ─── Invoice Document (printable letterhead - Dashtreme app-invoice.html) ── */

.invoice-doc {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-8);
}

.invoice-doc__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  padding-bottom: var(--space-6);
  margin-bottom: var(--space-6);
  border-bottom: 2px solid var(--color-border);
}

.invoice-doc__brand-name {
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--color-primary);
}

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

.invoice-doc__number {
  font-size: var(--text-xl);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--space-2);
  color: var(--color-text);
}

.invoice-doc__label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-subtle);
  margin-bottom: var(--space-1);
}

.invoice-doc__value {
  color: var(--color-text);
}

.invoice-doc__meta {
  margin-bottom: var(--space-6);
}

.invoice-doc__table thead th {
  background: var(--color-surface-2);
  font-size: var(--text-xs);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.invoice-doc__totals {
  max-width: 320px;
  margin-left: auto;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.invoice-doc__grand-total {
  font-size: var(--text-lg);
  font-weight: var(--fw-bold);
  color: var(--color-primary);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-2);
}

.invoice-doc__notes {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border-light);
}

/* ─── Client Contact Cards (grid view - Dashtreme app-contact-list.html) ──── */

.contact-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
}

.contact-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

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

.contact-card__avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.contact-card__name {
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  margin: 0;
}

.contact-card__subtext {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: var(--space-1) 0 var(--space-3);
}

.contact-card__links {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.contact-card__links a {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
}

.contact-card__links a:hover {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.contact-card__actions {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
}

/* ─── Document Template Type Tiles (folder tiles - Dashtreme app-file-manager.html) */

.type-tile-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.type-tile {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  cursor: pointer;
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.type-tile:hover {
  box-shadow: var(--shadow-sm);
}

.type-tile--active {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
}

.type-tile__icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  flex-shrink: 0;
}

.type-tile__label {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text);
}

.type-tile__count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ─── Bookings Calendar (Dashtreme app-fullcalender.html) ───────────────── */

.booking-calendar-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}

#bookings-calendar .fc-event {
  cursor: pointer;
  border: none;
}

#bookings-calendar .fc-toolbar-title {
  font-size: var(--text-lg);
  color: var(--color-text);
}

#bookings-calendar .fc-button-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

#bookings-calendar .fc-button-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

#bookings-calendar .fc-button-primary:not(:disabled).fc-button-active {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

#bookings-calendar .fc-daygrid-day.fc-day-today {
  background: var(--color-primary-light);
}

#bookings-calendar {
  color: var(--color-text);
}

#bookings-calendar .fc-col-header-cell, #bookings-calendar td, #bookings-calendar th {
  border-color: var(--color-border);
}

/* ─── Email Templates Split View (Dashtreme app-emailbox.html / app-emailread.html) */

.email-split {
  display: flex;
  gap: var(--space-4);
  align-items: stretch;
  min-height: 560px;
}

.email-split__list {
  width: 340px;
  flex-shrink: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow-y: auto;
  max-height: 720px;
}

.email-split__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border: none;
  border-bottom: 1px solid var(--color-border-light);
  background: transparent;
  cursor: pointer;
}

.email-split__item:hover {
  background: var(--color-surface-2);
}

.email-split__item--active {
  background: var(--color-primary-light);
  border-left: 3px solid var(--color-primary);
}

.email-split__item-name {
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  font-size: var(--text-sm);
}

.email-split__item-subject {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-split__item-meta {
  color: var(--color-text-subtle);
  font-size: var(--text-xs);
  margin-top: var(--space-1);
}

.email-split__reader {
  flex: 1;
  min-width: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  overflow-y: auto;
  max-height: 720px;
}

.email-split__reader-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.email-split__empty {
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-16) var(--space-4);
}

/* ─── Maintenance Task Checklist (Dashtreme app-to-do.html) ─────────────── */

.task-checklist-group+.task-checklist-group {
  margin-top: var(--space-6);
}

.task-checklist-group__title {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.task-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  margin-bottom: var(--space-2);
}

.task-item--scheduled {
  border-left-color: var(--color-info);
}

.task-item--in_progress {
  border-left-color: var(--color-warning);
}

.task-item--completed {
  border-left-color: var(--color-success);
}

.task-item--cancelled {
  border-left-color: var(--color-text-subtle);
  opacity: .65;
}

.task-item__check {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}

.task-item__body {
  flex: 1;
  min-width: 0;
}

.task-item__title {
  font-weight: var(--fw-medium);
  color: var(--color-text);
}

.task-item__title--done {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

.task-item__meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-top: var(--space-1);
}

.task-item__actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

.task-checklist-empty {
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-8) var(--space-4);
}

/* ─── QR Scanner ─────────────────────────────────────────────────────────── */

#qr-reader {
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
}

#qr-reader video {
  width: 100% !important;
  border-radius: var(--radius-md);
}

/* ─── 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;
  }

  /* Invoice letterhead modal: print only the document, full-page, no modal chrome. */
  body:has(#invoice-view-modal.show) * {
    visibility: hidden;
  }

  body:has(#invoice-view-modal.show) #invoice-doc,
  body:has(#invoice-view-modal.show) #invoice-doc * {
    visibility: visible;
  }

  body:has(#invoice-view-modal.show) #invoice-doc {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
  }
}

.logo-image {
  width: 450px;
}

.auth_width {
  width: 100%;
}

.auth-heading {
  text-justify: auto;
  align-items: center;
}

/* ─── Public Brochure Site ───────────────────────────────────────────────── */

.public-page {
  background: var(--color-bg);
  color: var(--color-text);
}

.public-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-8);
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
}

.public-nav__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-text);
}

.public-nav__logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.public-nav__wordmark {
  font-size: var(--text-xl);
  font-weight: var(--fw-medium);
  letter-spacing: 0.02em;
}

.public-nav__wordmark strong {
  color: var(--color-accent);
  font-weight: var(--fw-bold);
}

.hero {
  padding: var(--space-16) var(--space-8);
  text-align: center;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, color-mix(in srgb, var(--color-accent) 18%, transparent), transparent),
    var(--color-bg);
  animation: pageFadeIn var(--transition-base);
}

.hero__inner {
  max-width: 720px;
  margin: 0 auto;
}

.hero__eyebrow {
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--space-3);
}

.hero__title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--space-4);
}

.hero__subtitle {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-8);
}

.hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.public-section {
  padding: var(--space-16) var(--space-8);
}

.public-section--alt {
  background: var(--glass-bg);
}

.public-section__inner {
  max-width: 1080px;
  margin: 0 auto;
  text-align: center;
}

.public-section__title {
  font-size: var(--text-3xl);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--space-2);
}

.public-section__subtitle {
  color: var(--color-text-muted);
  margin: 0 0 var(--space-10);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-6);
  text-align: left;
}

.feature-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--glass-shadow);
}

.feature-card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--color-accent) 16%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
}

.feature-card__icon i {
  font-size: 22px;
  color: var(--color-accent);
}

.feature-card__title {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--space-2);
}

.feature-card__desc {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin: 0;
}

.public-portal-callout {
  max-width: 640px;
}

.trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-6);
  text-align: center;
}

.trust-item i {
  font-size: 32px;
  color: var(--color-accent);
  margin-bottom: var(--space-3);
}

.trust-item h3 {
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--space-2);
}

.trust-item p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin: 0;
}

.public-cta {
  padding: var(--space-16) var(--space-8);
  text-align: center;
  background: var(--color-primary);
  color: #ffffff;
}

.public-cta h2 {
  font-size: var(--text-3xl);
  font-weight: var(--fw-bold);
  margin: 0 0 var(--space-6);
}

.public-footer {
  border-top: 1px solid var(--glass-border);
  padding: var(--space-8);
}

.public-footer__inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.public-footer__brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.public-footer__logo {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.public-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.public-footer__link {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  text-decoration: underline;
  cursor: pointer;
}

.public-footer__link:hover {
  color: var(--color-accent);
}

.public-footer__credit {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  text-decoration: none;
}

.public-footer__credit:hover {
  color: var(--color-accent);
}

/* ─── Photo Gallery / Carousel (rooms, assets, stock, facilities, catalog) ── */

.table-thumb {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.gallery__empty {
  padding: var(--space-4) 0;
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: var(--space-3);
}

.gallery__thumb-wrap {
  position: relative;
}

.gallery__thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--color-surface-2);
  cursor: pointer;
  position: relative;
}

.gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery__hero-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-accent);
  color: #ffffff;
  font-size: 12px;
  box-shadow: var(--shadow-sm);
}

.gallery__thumb-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
}

.gallery__thumb-action {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.65);
  color: #ffffff;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.gallery__thumb-action:hover {
  background: rgba(15, 23, 42, 0.85);
}

.gallery__thumb-action--danger:hover {
  background: var(--color-danger);
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  padding: var(--space-8);
}

.gallery-lightbox--open {
  display: flex;
}

.gallery-lightbox__img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
}

.gallery-lightbox__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.gallery-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
}

.gallery-lightbox__nav--prev {
  left: var(--space-4);
}

.gallery-lightbox__nav--next {
  right: var(--space-4);
}

/* ─── Signature Pad (rental damage-report e-signature) ───────────────────── */

.signature-pad {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 200px;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  touch-action: none;
  cursor: crosshair;
}

/* ─── Public Catalog (card grid + home page teaser) ───────────────────────── */

.public-nav__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

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

.catalog-section__inner .public-section__title,
.catalog-section__inner .public-section__subtitle {
  text-align: center;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-2);
}

.catalog-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  overflow: hidden;
}

.catalog-card__gallery {
  padding: var(--space-3);
}

.catalog-card__gallery .gallery__grid {
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
}

.catalog-card__body {
  padding: 0 var(--space-5) var(--space-5);
}

.catalog-card__title {
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  margin: 0 0 var(--space-2);
}

.catalog-card__desc {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  margin: 0 0 var(--space-3);
}

.catalog-card__meta {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.catalog-card__meta-item {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.catalog-card__price {
  font-weight: var(--fw-semibold);
  color: var(--color-accent);
}

.teaser-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.teaser-card {
  position: relative;
  display: block;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  text-decoration: none;
  box-shadow: var(--glass-shadow);
}

.teaser-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.teaser-card__label {
  position: absolute;
  inset: auto 0 0 0;
  padding: var(--space-3);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
  color: #ffffff;
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
}

/* ─── Reduced Motion ─────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {

  .page-content, .auth-container, .toast-item, .toast-item.hide,
  .skeleton, .spinner-border, .spinner-sm, .hero {
    animation: none !important;
  }

  .btn:active {
    transform: none;
  }
}