/* ============================================================
   A'ILA Design System — Color Tokens
   Brand: Navy + Gold | Status: Semantic | Surfaces: Adaptive
   ============================================================ */

:root {
  /* ---- Brand ---- */
  --aila-navy: #1a3a5c;
  --aila-navy-dark: #0f2640;
  --aila-navy-light: #2a5080;
  --aila-gold: #c9a84c;
  --aila-gold-light: #dfc272;
  --aila-gold-dark: #a88a2e;

  /* ---- Semantic Aliases ---- */
  --color-primary: var(--aila-navy);
  --color-primary-dark: var(--aila-navy-dark);
  --color-primary-light: var(--aila-navy-light);
  --color-accent: var(--aila-gold);
  --color-accent-hover: var(--aila-gold-dark);
  --color-accent-light: var(--aila-gold-light);

  /* ---- Text ---- */
  --color-text: #1a1a2e;
  --color-text-muted: #6b7280;
  --color-text-inverse: #ffffff;

  /* ---- Surfaces ---- */
  --color-bg: #f4f6f9;
  --color-bg-card: #ffffff;
  --color-bg-sidebar: var(--aila-navy);
  --color-bg-header: #ffffff;
  --color-bg-input: #ffffff;

  /* ---- Borders ---- */
  --color-border: #e2e8f0;
  --color-border-focus: var(--aila-navy-light);

  /* ---- Status ---- */
  --color-success: #059669;
  --color-warning: #d97706;
  --color-error: #dc2626;
  --color-info: #2563eb;

  /* ---- Status Backgrounds (Light) ---- */
  --color-success-bg: #dcfce7;
  --color-success-text: #166534;
  --color-warning-bg: #fef3c7;
  --color-warning-text: #92400e;
  --color-error-bg: #fee2e2;
  --color-error-text: #991b1b;
  --color-info-bg: #dbeafe;
  --color-info-text: #1e40af;

  /* ---- Overlays ---- */
  --color-overlay: rgba(0, 0, 0, 0.5);
  --color-hover-light: rgba(26, 58, 92, 0.02);
  --color-hover-subtle: rgba(26, 58, 92, 0.03);
  --color-highlight-bg: rgba(26, 58, 92, 0.06);
  --color-sidebar-hover: rgba(255, 255, 255, 0.05);
  --color-sidebar-active: rgba(255, 255, 255, 0.08);
  --color-sidebar-border: rgba(255, 255, 255, 0.1);
  --color-sidebar-text: rgba(255, 255, 255, 0.7);
  --color-sidebar-muted: rgba(255, 255, 255, 0.35);
  --color-sidebar-btn: rgba(255, 255, 255, 0.08);
  --color-sidebar-btn-hover: rgba(255, 255, 255, 0.15);
}
/* ============================================================
   A'ILA Design System — Typography Tokens
   Font: Inter | Scale: rem-based
   ============================================================ */

:root {
  /* ---- Font Family ---- */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

  /* ---- Font Sizes ---- */
  --text-xs: 0.75rem;    /* 12px */
  --text-sm: 0.875rem;   /* 14px */
  --text-base: 1rem;     /* 16px */
  --text-lg: 1.125rem;   /* 18px */
  --text-xl: 1.25rem;    /* 20px */
  --text-2xl: 1.5rem;    /* 24px */
  --text-3xl: 1.875rem;  /* 30px */

  /* ---- Font Weights ---- */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;

  /* ---- Line Heights ---- */
  --leading-tight: 1.2;
  --leading-snug: 1.3;
  --leading-normal: 1.5;
  --leading-relaxed: 1.6;
  --leading-loose: 1.7;
  --leading-prose: 1.8;

  /* ---- Letter Spacing ---- */
  --tracking-tight: -0.01em;
  --tracking-normal: 0;
  --tracking-wide: 0.05em;
  --tracking-wider: 0.08em;
}
/* ============================================================
   A'ILA Design System — Spacing Tokens
   Scale: 4px base (0.25rem)
   ============================================================ */

:root {
  /* ---- Spacing Scale ---- */
  --space-0: 0;
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */

  /* ---- Border Radius ---- */
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* ---- Layout Dimensions ---- */
  --sidebar-width: 260px;
  --header-height: 56px;
  --bottom-nav-height: 60px;
  --content-max-width: 1200px;
  --modal-max-width: 480px;
  --toast-max-width: 360px;
}
/* ============================================================
   A'ILA Design System — Elevation Tokens
   Shadows for depth layering
   ============================================================ */

:root {
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1), 0 8px 10px rgba(0, 0, 0, 0.04);

  /* ---- Z-Index Scale ---- */
  --z-base: 0;
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-header: 80;
  --z-overlay: 90;
  --z-sidebar: 100;
  --z-modal: 200;
  --z-toast: 300;
}
/* ============================================================
   A'ILA Design System — Motion Tokens
   Transitions, animations, easing
   ============================================================ */

:root {
  /* ---- Durations ---- */
  --duration-fast: 0.15s;
  --duration: 0.2s;
  --duration-slow: 0.3s;
  --duration-slower: 0.4s;

  /* ---- Easing ---- */
  --ease-default: ease;
  --ease-in: ease-in;
  --ease-out: ease-out;
  --ease-in-out: ease-in-out;

  /* ---- Composite Transitions ---- */
  --transition: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* ---- Keyframes ---- */
@keyframes aila-spin {
  to { transform: rotate(360deg); }
}

@keyframes aila-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes aila-slide-in-right {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
/* ============================================================
   A'ILA Design System — CSS Reset
   Modern reset with sensible defaults
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: var(--leading-relaxed);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, picture, video, canvas, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

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

button {
  cursor: pointer;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

table {
  border-collapse: collapse;
}

/* Remove list styles for nav/menu */
ul[role="list"], ol[role="list"] {
  list-style: none;
}
/* ============================================================
   A'ILA Design System — Base Typography
   Headings, body text, prose formatting
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-semibold);
  line-height: var(--leading-snug);
  color: var(--color-text);
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-base); }

.page-title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-4);
}

/* ---- Prose (Long-form content) ---- */
.prose {
  max-width: 100%;
  line-height: var(--leading-loose);
  overflow-wrap: break-word;
}
.prose p { margin-bottom: var(--space-3); }
.prose h2 {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  margin: var(--space-6) 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}
.prose h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin: var(--space-5) 0 var(--space-2);
}
.prose h4 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  margin: var(--space-4) 0 var(--space-2);
}
.prose h5 {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  margin: var(--space-3) 0 var(--space-1);
}
.prose ul, .prose ol {
  margin: 0 0 var(--space-3);
  padding-left: var(--space-5);
}
.prose li { margin-bottom: var(--space-1); }
.prose blockquote {
  border-left: 3px solid var(--color-accent);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0;
  background: var(--color-highlight-bg);
  border-radius: var(--radius);
  font-style: italic;
}
.prose strong { font-weight: var(--font-semibold); }
.prose a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.prose a:hover { color: var(--color-accent-hover); }

/* ---- Responsive Typography ---- */
@media (min-width: 768px) {
  .page-title {
    font-size: var(--text-2xl);
    margin-bottom: var(--space-6);
  }
  .prose h2 { font-size: var(--text-2xl); margin: var(--space-8) 0 var(--space-4); }
  .prose h3 { font-size: var(--text-xl); margin: var(--space-6) 0 var(--space-3); }
  .prose h4 { font-size: var(--text-lg); }
  .prose p { margin-bottom: var(--space-4); }
  .prose { line-height: var(--leading-prose); }
}

@media (max-width: 767px) {
  .page-title { font-size: var(--text-lg); margin-bottom: var(--space-3); }
  .prose h2 { margin: var(--space-4) 0 var(--space-2); }
  .prose h3 { margin: var(--space-3) 0 var(--space-2); }
  .prose p { margin-bottom: var(--space-2); }
  .prose ul, .prose ol { padding-left: var(--space-4); }
}
/* ============================================================
   A'ILA Design System — Button Component
   Variants: primary, accent, outline, danger
   Sizes: sm, default, lg | Modifier: block
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: none;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  transition: all var(--transition);
  white-space: nowrap;
  line-height: var(--leading-normal);
  cursor: pointer;
  text-decoration: none;
}

/* ---- Variants ---- */
.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  color: var(--color-text-inverse);
}

.btn-accent {
  background: var(--color-accent);
  color: var(--aila-navy-dark);
}
.btn-accent:hover {
  background: var(--color-accent-hover);
  color: var(--aila-navy-dark);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--color-border);
  color: var(--color-text);
}
.btn-outline:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-danger {
  background: var(--color-error);
  color: var(--color-text-inverse);
}
.btn-danger:hover {
  background: #b91c1c;
  color: var(--color-text-inverse);
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
}
.btn-ghost:hover {
  background: var(--color-highlight-bg);
  color: var(--color-text);
}

/* ---- Sizes ---- */
.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-base);
}

/* ---- Modifiers ---- */
.btn-block {
  width: 100%;
  justify-content: center;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
/* ============================================================
   A'ILA Design System — Card Component
   Base card with header, title, body patterns
   ============================================================ */

.card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

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

.card-body {
  /* No specific styles; container only */
}

.card-footer {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .card { padding: var(--space-5); }
  .card-title { font-size: var(--text-lg); }
}

@media (max-width: 767px) {
  .card { padding: var(--space-3); }
}
/* ============================================================
   A'ILA Design System — Badge Component
   Variants: success, warning, error, info, neutral
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: var(--leading-normal);
}

.badge--success {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}
.badge--warning {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}
.badge--error {
  background: var(--color-error-bg);
  color: var(--color-error-text);
}
.badge--info {
  background: var(--color-info-bg);
  color: var(--color-info-text);
}
.badge--neutral {
  background: var(--color-border);
  color: var(--color-text-muted);
}
/* ============================================================
   A'ILA Design System — Form Components
   Input, select, label, error, help text
   ============================================================ */

.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  margin-bottom: var(--space-1);
  color: var(--color-text);
}

.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-family: inherit;
  background: var(--color-bg-input);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(26, 58, 92, 0.12);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-top: var(--space-1);
}

.form-help {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

/* ---- Select ---- */
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ---- Textarea ---- */
textarea.form-input {
  resize: vertical;
  min-height: 100px;
}
/* ============================================================
   A'ILA Design System — Data Table Component
   Scrollable wrapper with fade hint
   ============================================================ */

.data-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  max-width: 100%;
  position: relative;
}

.data-table-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(to right, transparent, var(--color-bg-card));
  pointer-events: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
}

.data-table th {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  font-weight: var(--font-semibold);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  word-break: break-word;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: var(--color-hover-light);
}

.data-table-empty {
  text-align: center;
  padding: var(--space-8) !important;
  color: var(--color-text-muted);
}

/* ---- Responsive ---- */
@media (max-width: 767px) {
  .data-table-wrapper::after { opacity: 1; }
  .data-table { font-size: var(--text-xs); }
  .data-table th,
  .data-table td { padding: var(--space-1) var(--space-2); }
}

@media (min-width: 768px) {
  .data-table { font-size: var(--text-sm); }
  .data-table th,
  .data-table td { padding: var(--space-3) var(--space-4); }
}
/* ============================================================
   A'ILA Design System — Modal Component
   Overlay + centered modal with header/body/footer
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-4);
  opacity: 0;
  transition: opacity var(--transition-slow);
  pointer-events: none;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: var(--modal-max-width);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition-slow);
}
.modal-overlay.open .modal {
  transform: translateY(0);
}

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

.modal-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  font-size: 1.5rem;
  color: var(--color-text-muted);
  border-radius: var(--radius);
  cursor: pointer;
}
.modal-close:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.modal-body {
  padding: var(--space-5);
}

.modal-footer {
  display: flex;
  gap: var(--space-3);
  justify-content: flex-end;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-border);
}
/* ============================================================
   A'ILA Design System — Toast / Notification Component
   Variants: success, error, warning, info
   ============================================================ */

.toast-container {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: var(--toast-max-width);
}

.toast {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  box-shadow: var(--shadow-md);
  transform: translateX(100%);
  opacity: 0;
  transition: all var(--transition-slow);
}

.toast--visible {
  transform: translateX(0);
  opacity: 1;
}

.toast--success { background: var(--color-success); color: white; }
.toast--error   { background: var(--color-error);   color: white; }
.toast--warning { background: var(--color-warning); color: white; }
.toast--info    { background: var(--color-info);    color: white; }
/* ============================================================
   A'ILA Design System — Tabs Component
   Horizontal scrolling tab bar with underline active state
   ============================================================ */

.tab-bar {
  display: flex;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: var(--space-4);
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.tab-bar::-webkit-scrollbar { height: 3px; }
.tab-bar::-webkit-scrollbar-track { background: transparent; }
.tab-bar::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }

.tab-btn {
  padding: var(--space-2) var(--space-3);
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  cursor: pointer;
}

.tab-btn:hover {
  color: var(--color-text);
}

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-accent);
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .tab-bar { gap: var(--space-1); margin-bottom: var(--space-5); }
  .tab-btn { padding: var(--space-2) var(--space-4); font-size: var(--text-sm); }
}

@media (max-width: 767px) {
  .tab-btn {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    min-height: 36px;
  }
}

@media (max-width: 359px) {
  .tab-btn { padding: var(--space-1) var(--space-2); font-size: 0.65rem; }
}
/* ============================================================
   A'ILA Design System — Accordion Component
   Collapsible sections with +/- indicator
   ============================================================ */

.accordion-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-2);
  overflow: hidden;
}

.accordion-header {
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-weight: var(--font-semibold);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-bg-card);
  transition: background var(--transition);
}

.accordion-header:hover {
  background: var(--color-hover-subtle);
}

.accordion-header::after {
  content: '+';
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  transition: transform var(--transition);
  flex-shrink: 0;
  margin-left: var(--space-2);
}

.accordion-item.open .accordion-header::after {
  content: '\2212'; /* minus sign */
}

.accordion-body {
  padding: 0 var(--space-4) var(--space-4);
  display: none;
}

.accordion-item.open .accordion-body {
  display: block;
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .accordion-header { padding: var(--space-4) var(--space-5); }
  .accordion-body { padding: 0 var(--space-5) var(--space-5); }
}

@media (max-width: 767px) {
  .accordion-header { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
  .accordion-body { padding: 0 var(--space-3) var(--space-3); }
}
/* ============================================================
   A'ILA Design System — Callout & Highlight Components
   Callout variants + highlight box + confidential banner
   ============================================================ */

/* ---- Callout ---- */
.callout {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  margin: var(--space-3) 0;
  border-left: 4px solid;
  overflow-wrap: break-word;
  word-break: break-word;
}

.callout--info    { border-color: var(--color-primary); background: var(--color-highlight-bg); }
.callout--warning { border-color: #e67e22; background: rgba(230, 126, 34, 0.06); }
.callout--critical { border-color: var(--color-error); background: rgba(220, 53, 69, 0.06); }
.callout--success { border-color: var(--color-success); background: rgba(16, 185, 129, 0.06); }

.callout-title {
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-1);
}

/* ---- Highlight Box ---- */
.highlight-box {
  padding: var(--space-3);
  background: var(--color-highlight-bg);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  overflow-wrap: break-word;
  word-break: break-word;
}

/* ---- Confidential Banner ---- */
.confidential-banner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.2);
  border-radius: var(--radius);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--color-error);
  margin-bottom: var(--space-3);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .callout { padding: var(--space-4) var(--space-5); }
  .highlight-box { padding: var(--space-4); }
  .confidential-banner { padding: var(--space-2) var(--space-4); margin-bottom: var(--space-6); }
}

@media (max-width: 767px) {
  .callout { padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
  .highlight-box { font-size: var(--text-xs); padding: var(--space-2) var(--space-3); }
  .confidential-banner { font-size: 0.65rem; padding: var(--space-1) var(--space-2); margin-bottom: var(--space-2); }
}
/* ============================================================
   A'ILA Design System — Stat Card Component
   Stat grids (2-col mobile, 4-col desktop) + individual stat cards
   ============================================================ */

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.stat-grid--3 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.stat-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-shadow: var(--shadow-sm);
}

.stat-card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: rgba(26, 58, 92, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  flex-shrink: 0;
}
.stat-card-icon svg {
  width: 16px;
  height: 16px;
}

.stat-card-value {
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  word-break: break-word;
}

.stat-card-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-bottom: var(--space-6); }
  .stat-grid--3 { grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin-bottom: var(--space-6); }
  .stat-card { padding: var(--space-4); gap: var(--space-3); }
  .stat-card-icon { width: 40px; height: 40px; }
  .stat-card-icon svg { width: 20px; height: 20px; }
  .stat-card-value { font-size: var(--text-xl); }
}

@media (max-width: 767px) {
  .stat-card { padding: var(--space-2); gap: var(--space-1); }
  .stat-card-icon { width: 28px; height: 28px; }
  .stat-card-icon svg { width: 14px; height: 14px; }
  .stat-card-value { font-size: var(--text-xs); }
  .stat-card-label { font-size: 0.65rem; }
}

@media (max-width: 359px) {
  .stat-grid { grid-template-columns: 1fr; }
}
/* ============================================================
   A'ILA Design System — Key-Value List Component
   Vertical on mobile, horizontal on tablet+
   ============================================================ */

.kv-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.kv-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.kv-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.kv-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.kv-value {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  word-break: break-word;
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .kv-item {
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-4);
  }
  .kv-label { font-size: var(--text-sm); }
  .kv-value { text-align: right; }
}
/* ============================================================
   A'ILA Design System — Loading Spinner Component
   ============================================================ */

.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: aila-spin 0.7s linear infinite;
}

.spinner--sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

.spinner--lg {
  width: 48px;
  height: 48px;
  border-width: 4px;
}
/* ============================================================
   A'ILA Design System — Property Card Component
   Image card with metadata, price, status badge
   Also: image gallery, key facts grid
   ============================================================ */

.property-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.property-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  text-decoration: none;
  color: inherit;
  display: block;
}
.property-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  color: inherit;
}

.property-card-img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.property-card-body {
  padding: var(--space-4);
  overflow: hidden;
}

.property-card-title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-1);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.property-card-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.property-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.property-card-price {
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  color: var(--aila-gold-dark);
  margin-bottom: var(--space-2);
}

.property-card-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
}
.property-card-status--active      { background: var(--color-success-bg); color: var(--color-success-text); }
.property-card-status--upcoming    { background: var(--color-info-bg);    color: var(--color-info-text); }
.property-card-status--construction { background: var(--color-warning-bg); color: var(--color-warning-text); }

/* ---- Image Gallery ---- */
.image-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  margin: var(--space-4) 0;
}
.image-gallery img {
  width: 100%;
  border-radius: var(--radius);
  aspect-ratio: 16 / 10;
  object-fit: cover;
  cursor: pointer;
  transition: opacity var(--transition);
}
.image-gallery img:hover { opacity: 0.9; }

/* ---- Key Facts ---- */
.key-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin: var(--space-4) 0;
}
.key-fact { display: flex; flex-direction: column; gap: 2px; }
.key-fact-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}
.key-fact-value {
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  word-break: break-word;
}

/* ---- Back Link ---- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  text-decoration: none;
}
.back-link:hover { color: var(--color-accent); }

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .property-grid { grid-template-columns: repeat(2, 1fr); }
  .image-gallery { grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
  .key-facts { grid-template-columns: repeat(4, 1fr); padding: var(--space-5); }
}

@media (max-width: 767px) {
  .property-card-img { aspect-ratio: 16 / 9; }
  .image-gallery { grid-template-columns: 1fr 1fr; gap: var(--space-2); }
  .key-facts { grid-template-columns: 1fr 1fr; gap: var(--space-2); padding: var(--space-3); }
}

@media (max-width: 359px) {
  .key-facts { grid-template-columns: 1fr; }
}
/* ============================================================
   A'ILA Design System — Sidebar Navigation Component
   Off-canvas on mobile, fixed on desktop
   ============================================================ */

/* ---- Overlay ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: var(--z-overlay);
  opacity: 0;
  transition: opacity var(--transition-slow);
}
.sidebar-overlay.open {
  display: block;
  opacity: 1;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-bg-sidebar);
  color: var(--color-text-inverse);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--transition-slow);
  overflow-y: auto;
}
.sidebar.open {
  transform: translateX(0);
}

/* ---- Brand ---- */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5);
  border-bottom: 1px solid var(--color-sidebar-border);
}
.sidebar-brand img { width: 36px; height: 36px; }
.sidebar-brand-text {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--color-accent);
  letter-spacing: 0.5px;
}

/* ---- Nav ---- */
.sidebar-nav {
  flex: 1;
  padding: var(--space-3) 0;
}

.nav-section-title {
  padding: var(--space-3) var(--space-5) var(--space-1);
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--color-sidebar-muted);
  margin-top: var(--space-2);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  color: var(--color-sidebar-text);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: all var(--transition);
  border-left: 3px solid transparent;
  text-decoration: none;
}
.nav-link:hover {
  color: #ffffff;
  background: var(--color-sidebar-hover);
}
.nav-link.active {
  color: var(--color-accent);
  background: var(--color-sidebar-active);
  border-left-color: var(--color-accent);
}

.nav-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.nav-label { white-space: nowrap; }

/* ---- Footer ---- */
.sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--color-sidebar-border);
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: var(--aila-navy-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  flex-shrink: 0;
}

.user-meta { overflow: hidden; }
.user-name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.5);
  text-transform: capitalize;
}

.sidebar-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.sidebar-action-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--color-sidebar-btn);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-sidebar-text);
  font-size: var(--text-xs);
  transition: all var(--transition);
  cursor: pointer;
}
.sidebar-action-btn:hover {
  background: var(--color-sidebar-btn-hover);
  color: #ffffff;
}

/* ---- Desktop: sidebar always visible ---- */
@media (min-width: 1024px) {
  .sidebar { transform: translateX(0); position: fixed; }
  .sidebar-overlay { display: none !important; }
}
/* ============================================================
   A'ILA Design System — Miscellaneous Components
   Status dots, severity bars, TOC, report sections, figures
   ============================================================ */

/* ---- Status Dots ---- */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
}
.status-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot--zero::before    { background: var(--color-error); }
.status-dot--partial::before { background: var(--color-warning); }
.status-dot--active::before  { background: var(--color-success); }

/* ---- Severity Bars ---- */
.severity-bar {
  height: 8px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  min-width: 80px;
}
.severity-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--duration-slower) ease;
}
.severity-bar-fill--critical { background: var(--color-error);   width: 100%; }
.severity-bar-fill--high     { background: var(--color-warning); width: 75%; }
.severity-bar-fill--moderate { background: var(--color-info);    width: 50%; }
.severity-bar-fill--low      { background: var(--color-success); width: 25%; }

/* ---- Table of Contents ---- */
.toc {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
}
.toc-title {
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-2);
  font-size: var(--text-base);
}
.toc a {
  color: var(--color-text-muted);
  text-decoration: none;
  display: block;
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
}
.toc a:hover { color: var(--color-accent); }
.toc ol { padding-left: var(--space-5); margin: 0; }
.toc li { margin-bottom: var(--space-1); }

/* ---- Report Sections ---- */
.report-section { margin-bottom: var(--space-4); }
.report-section-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

/* ---- Report Figures ---- */
.report-figure { margin: var(--space-4) 0; text-align: center; }
.report-figure img { max-width: 100%; border-radius: var(--radius-lg); }
.report-figure figcaption {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--space-2);
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .report-section { margin-bottom: var(--space-6); }
  .toc { padding: var(--space-5); }
}

@media (max-width: 767px) {
  .toc { padding: var(--space-3); }
  .toc ol { padding-left: var(--space-4); }
  .toc a { font-size: var(--text-xs); }
  .report-figure { margin: var(--space-3) 0; }
}
/* ============================================================
   A'ILA Design System — App Shell Layout
   Sidebar + header + main content + bottom nav
   ============================================================ */

.app-layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- Mobile Header ---- */
.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--space-4);
  background: var(--color-bg-header);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}

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

.hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--color-text);
  border-radius: var(--radius);
}
.hamburger:hover { background: var(--color-border); }

.header-brand {
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  color: var(--color-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: var(--font-bold);
}

/* ---- Bottom Nav (Mobile) ---- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-height);
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: var(--color-bg-card);
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: var(--z-header);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-1) var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  transition: color var(--transition);
  text-decoration: none;
}
.bottom-nav-item.active,
.bottom-nav-item:hover {
  color: var(--color-accent);
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  min-width: 0;
  padding: var(--space-3);
  padding-bottom: calc(var(--bottom-nav-height) + var(--space-4) + env(safe-area-inset-bottom, 0));
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .main-content {
    padding: var(--space-4);
    padding-bottom: calc(var(--bottom-nav-height) + var(--space-4) + env(safe-area-inset-bottom, 0));
  }
}

@media (min-width: 1024px) {
  .sidebar { transform: translateX(0); position: fixed; }
  .sidebar-overlay { display: none !important; }
  .mobile-header { display: none; }
  .bottom-nav { display: none; }
  .hamburger { display: none; }

  .main-content {
    margin-left: var(--sidebar-width);
    padding: var(--space-8);
    padding-bottom: var(--space-8);
    width: calc(100% - var(--sidebar-width));
  }
}

@media (min-width: 1440px) {
  .main-content {
    padding-left: var(--space-12);
    padding-right: var(--space-12);
  }
}

@media (max-width: 767px) {
  .main-content {
    padding: var(--space-2);
    padding-bottom: calc(var(--bottom-nav-height) + var(--space-3) + env(safe-area-inset-bottom, 0));
  }
}
/* ============================================================
   A'ILA Design System — Login Page Layout
   Centered card layout for authentication
   ============================================================ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--space-4);
  background: var(--color-bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-md);
}

.login-logo {
  text-align: center;
  margin-bottom: var(--space-6);
}

.login-logo img {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-3);
}

.login-logo h1 {
  font-size: var(--text-xl);
  color: var(--color-primary);
}

.login-logo p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--space-1);
}

.login-error {
  background: var(--color-error-bg);
  color: var(--color-error-text);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
  display: none;
}
.login-error.visible { display: block; }

/* ---- Responsive ---- */
@media (min-width: 1024px) {
  .login-card { padding: var(--space-10); }
}
/* ============================================================
   A'ILA Design System — Grid Layouts
   Profile grid, admin toolbar, generic grids
   ============================================================ */

.profile-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  flex-shrink: 0;
}

.profile-info h2 {
  font-size: var(--text-xl);
  margin-bottom: 2px;
}

.profile-info p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.profile-grid {
  display: grid;
  gap: var(--space-4);
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.admin-search {
  max-width: 280px;
}

/* ---- Responsive ---- */
@media (min-width: 768px) {
  .profile-grid { grid-template-columns: 1fr 1fr; }
}
/* ============================================================
   A'ILA Design System — Utility Classes
   Minimal set of commonly-used helpers
   ============================================================ */

/* ---- Text ---- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--color-text-muted); }
.text-xs     { font-size: var(--text-xs); }
.text-sm     { font-size: var(--text-sm); }
.text-lg     { font-size: var(--text-lg); }
.font-bold   { font-weight: var(--font-bold); }

/* ---- Spacing ---- */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-3  { padding: var(--space-3); }
.p-4  { padding: var(--space-4); }

/* ---- Flexbox ---- */
.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.flex-wrap { flex-wrap: wrap; }

/* ---- Display ---- */
.hidden    { display: none !important; }
.block     { display: block; }
.inline    { display: inline; }

/* ---- Width ---- */
.w-full { width: 100%; }

/* ---- Overflow ---- */
.overflow-hidden { overflow: hidden; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Visually hidden (accessible) ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
/* ============================================================
   A'ILA Design System — Dark Theme
   Apply via: body.dark or @media (prefers-color-scheme: dark)
   ============================================================ */

body.dark {
  /* ---- Surfaces ---- */
  --color-text: #e2e8f0;
  --color-text-muted: #94a3b8;
  --color-bg: #0f172a;
  --color-bg-card: #1e293b;
  --color-bg-header: #1e293b;
  --color-bg-sidebar: #0c1929;
  --color-bg-input: #1e293b;

  /* ---- Borders ---- */
  --color-border: #334155;
  --color-border-focus: var(--aila-gold);

  /* ---- Shadows ---- */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.3);

  /* ---- Status Backgrounds (Dark) ---- */
  --color-success-bg: rgba(5, 150, 105, 0.2);
  --color-success-text: #6ee7b7;
  --color-warning-bg: rgba(217, 119, 6, 0.2);
  --color-warning-text: #fcd34d;
  --color-error-bg: rgba(220, 38, 38, 0.2);
  --color-error-text: #fca5a5;
  --color-info-bg: rgba(37, 99, 235, 0.2);
  --color-info-text: #93c5fd;

  /* ---- Overlays ---- */
  --color-hover-light: rgba(255, 255, 255, 0.02);
  --color-hover-subtle: rgba(255, 255, 255, 0.03);
  --color-highlight-bg: rgba(201, 168, 76, 0.08);
}

/* ---- Dark-specific component overrides ---- */
body.dark .header-brand {
  color: var(--aila-gold);
}

body.dark .header-avatar {
  background: var(--aila-gold);
  color: var(--aila-navy-dark);
}

body.dark .login-logo h1 {
  color: var(--aila-gold);
}

body.dark .tab-btn.active {
  color: var(--aila-gold);
}

body.dark .stat-card-icon {
  background: rgba(201, 168, 76, 0.15);
  color: var(--aila-gold);
}

body.dark .spinner {
  border-top-color: var(--aila-gold);
}

body.dark .form-input:focus {
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.2);
}

body.dark .property-card-price {
  color: var(--aila-gold-light);
}

body.dark .confidential-banner {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.3);
  color: #fca5a5;
}

body.dark .callout--info    { background: rgba(26, 58, 92, 0.15); }
body.dark .callout--warning { background: rgba(230, 126, 34, 0.12); }
body.dark .callout--critical { background: rgba(220, 53, 69, 0.12); }
body.dark .callout--success { background: rgba(16, 185, 129, 0.12); }

body.dark .prose blockquote {
  background: rgba(201, 168, 76, 0.06);
}

body.dark .badge--neutral {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-muted);
}

/* ============================================================
   Portal-Specific Overrides
   Styles needed by the portal but not part of the design system
   ============================================================ */

/* Backward-compatible variable aliases (old portal names → new design system names) */
:root {
  --navy: var(--aila-navy);
  --navy-dark: var(--aila-navy-dark);
  --navy-light: var(--aila-navy-light);
  --gold: var(--aila-gold);
  --gold-light: var(--aila-gold-light);
  --gold-dark: var(--aila-gold-dark);
  --primary: var(--color-primary);
  --primary-dark: var(--color-primary-dark);
  --accent: var(--color-accent);
  --accent-hover: var(--color-accent-hover);
  --text: var(--color-text);
  --text-muted: var(--color-text-muted);
  --text-inverse: var(--color-text-inverse);
  --bg: var(--color-bg);
  --bg-card: var(--color-bg-card);
  --bg-sidebar: var(--color-bg-sidebar);
  --bg-header: var(--color-bg-header);
  --bg-input: var(--color-bg-input);
  --border: var(--color-border);
  --border-focus: var(--color-border-focus);
  --success: var(--color-success);
  --warning: var(--color-warning);
  --error: var(--color-error);
  --info: var(--color-info);
}

/* Page-load fade-in (portal uses body.loaded pattern) */
body {
  opacity: 0;
  transition: opacity 0.2s ease;
}
body.loaded {
  opacity: 1;
}

/* Tool card icon header (replaces image in property-card for tools) */
.tool-card-icon {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 58, 92, 0.06);
  border-radius: var(--radius) var(--radius) 0 0;
}
.tool-card-icon svg {
  width: 48px;
  height: 48px;
  color: var(--aila-navy);
}
body.dark .tool-card-icon {
  background: rgba(201, 168, 76, 0.08);
}
body.dark .tool-card-icon svg {
  color: var(--aila-gold);
}
