/* ============================================================
   EQUILORD DESIGN SYSTEM
   equi × lord — precise tools, delightful experience
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;0,9..144,800;1,9..144,400;1,9..144,700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* ── Design Tokens: Light Mode ────────────────────────────── */
:root {
  /* Brand */
  --equi:          #C44478;   /* warm rose — equity, warmth  (HSL 338° 55% 52%) */
  --equi-light:    #FCE8F3;
  --equi-mid:      #E8A4C4;
  --lord:          #6941C6;   /* grape-violet — ownership, authority  (HSL 264° 50% 51%) */
  --lord-light:    #EDE7F9;
  --lord-mid:      #B49FE0;

  /* Semantic brand gradient */
  --brand-gradient: linear-gradient(135deg, var(--equi) 0%, var(--lord) 100%);
  --brand-gradient-soft: linear-gradient(135deg, #FCE8F3 0%, #EDE7F9 100%);

  /* Backgrounds */
  --bg:            #FDFCFF;   /* warm off-white with lavender breath */
  --bg-2:          #F7F5FF;   /* slightly deeper surface */
  --bg-3:          #F0ECF9;   /* tertiary surface */
  --surface:       #FFFFFF;
  --surface-hover: #FAF8FF;
  --overlay:       rgba(105, 65, 198, 0.06);

  /* Text */
  --text:          #1A1523;   /* near-black with warmth */
  --text-2:        #4B4558;   /* secondary */
  --text-3:        #7B7490;   /* muted/placeholder */
  --text-inv:      #FFFFFF;

  /* Borders */
  --border:        #E5E0F0;
  --border-mid:    #D0C8E4;
  --border-focus:  var(--lord);

  /* Status colors */
  --green:         #059669;
  --green-light:   #ECFDF5;
  --green-mid:     #34D399;
  --red:           #DC2626;
  --red-light:     #FEF2F2;
  --red-mid:       #F87171;
  --yellow:        #D97706;
  --yellow-light:  #FFFBEB;
  --yellow-mid:    #FCD34D;
  --blue:          #2563EB;
  --blue-light:    #EFF6FF;
  --blue-mid:      #60A5FA;

  /* Shadows */
  --shadow-xs:     0 1px 2px rgba(26, 21, 35, 0.05);
  --shadow-sm:     0 1px 3px rgba(26, 21, 35, 0.08), 0 1px 2px rgba(26, 21, 35, 0.04);
  --shadow-md:     0 4px 6px rgba(26, 21, 35, 0.07), 0 2px 4px rgba(26, 21, 35, 0.04);
  --shadow-lg:     0 10px 15px rgba(26, 21, 35, 0.08), 0 4px 6px rgba(26, 21, 35, 0.04);
  --shadow-xl:     0 20px 25px rgba(26, 21, 35, 0.1), 0 8px 10px rgba(26, 21, 35, 0.04);
  --shadow-brand:  0 4px 20px rgba(105, 65, 198, 0.18);

  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-ui:      'Plus Jakarta Sans', system-ui, sans-serif;

  /* Radii */
  --r-xs:   4px;
  --r-sm:   8px;
  --r-md:   12px;
  --r-lg:   16px;
  --r-xl:   24px;
  --r-full: 9999px;

  /* Spacing scale */
  --sp-1:   4px;
  --sp-2:   8px;
  --sp-3:   12px;
  --sp-4:   16px;
  --sp-5:   20px;
  --sp-6:   24px;
  --sp-8:   32px;
  --sp-10:  40px;
  --sp-12:  48px;
  --sp-16:  64px;

  /* Transitions */
  --ease:         cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:      cubic-bezier(0.4, 0, 1, 1);
  --ease-out:     cubic-bezier(0, 0, 0.2, 1);
  --dur-fast:     120ms;
  --dur-mid:      200ms;
  --dur-slow:     350ms;
}

/* ── Design Tokens: Dark Mode ─────────────────────────────── */
[data-theme="dark"] {
  --equi:          #E0729E;   /* lightened rose for dark bg — still warm, less vivid than current */
  --equi-light:    #2D1820;
  --equi-mid:      #CC5588;
  --lord:          #9A78D8;   /* lightened grape-violet for dark bg */
  --lord-light:    #1C1535;
  --lord-mid:      #BBA8E8;

  --brand-gradient: linear-gradient(135deg, #E0729E 0%, #9A78D8 100%);
  --brand-gradient-soft: linear-gradient(135deg, #2D1820 0%, #1C1535 100%);

  --bg:            #100D1A;
  --bg-2:          #161124;
  --bg-3:          #1D1730;
  --surface:       #1A1528;
  --surface-hover: #211C35;
  --overlay:       rgba(154, 120, 216, 0.08);

  --text:          #F0ECFF;
  --text-2:        #B8AFD6;
  --text-3:        #7B6FA8;
  --text-inv:      #100D1A;

  --border:        #2A2240;
  --border-mid:    #382E55;
  --border-focus:  var(--lord);

  --green:         #34D399;
  --green-light:   #0D2B22;
  --green-mid:     #6EE7B7;
  --red:           #F87171;
  --red-light:     #2D1111;
  --red-mid:       #FCA5A5;
  --yellow:        #FCD34D;
  --yellow-light:  #2D2008;
  --yellow-mid:    #FDE68A;
  --blue:          #60A5FA;
  --blue-light:    #0E1F3D;
  --blue-mid:      #93C5FD;

  --shadow-xs:     0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm:     0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md:     0 4px 6px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.2);
  --shadow-lg:     0 10px 15px rgba(0, 0, 0, 0.5), 0 4px 6px rgba(0, 0, 0, 0.3);
  --shadow-xl:     0 20px 25px rgba(0, 0, 0, 0.6), 0 8px 10px rgba(0, 0, 0, 0.3);
  --shadow-brand:  0 4px 20px rgba(154, 120, 216, 0.28);
}

/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--dur-mid) var(--ease), color var(--dur-mid) var(--ease);
}

/* ── Typography ───────────────────────────────────────────── */
.font-display { font-family: var(--font-display); }
.font-ui      { font-family: var(--font-ui); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text);
  font-weight: 700;
}

h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
h4 { font-size: 1.125rem; font-family: var(--font-ui); font-weight: 700; letter-spacing: -0.01em; }

p { color: var(--text-2); line-height: 1.7; }

a {
  color: var(--lord);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
}
a:hover { color: var(--equi); }

/* Tabular numbers for financial data */
.tabular, .amount, .stat-value, td.amount, .balance {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-family: var(--font-display);
  font-weight: 600;
}

/* ── Logo ─────────────────────────────────────────────────── */
.logo {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.04em;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  text-decoration: none;
}
.logo-equi { color: var(--equi); }
.logo-lord { color: var(--lord); }

.logo-sm { font-size: 1.125rem; }
.logo-lg { font-size: 2rem; }
.logo-xl { font-size: clamp(2.5rem, 6vw, 4rem); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px var(--sp-5);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--r-full);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--dur-mid) var(--ease);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Primary: brand gradient */
.btn-primary {
  background: var(--brand-gradient);
  color: white;
  border-color: transparent;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover {
  opacity: 0.9;
  box-shadow: 0 6px 24px rgba(105, 65, 198, 0.30);
  transform: translateY(-1px);
  color: white;
}

/* Secondary: ghost with lord border */
.btn-secondary {
  background: transparent;
  color: var(--lord);
  border-color: var(--lord);
}
.btn-secondary:hover {
  background: var(--lord-light);
  color: var(--lord);
}

/* Ghost: subtle */
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--bg-2);
  color: var(--text);
  border-color: var(--border-mid);
}

/* Danger */
.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red);
}
.btn-danger:hover {
  background: var(--red-light);
}

/* Danger filled */
.btn-danger-filled {
  background: var(--red);
  color: white;
  border-color: var(--red);
}
.btn-danger-filled:hover {
  background: #B91C1C;
  border-color: #B91C1C;
  color: white;
}

/* Icon button */
.btn-icon {
  padding: var(--sp-2);
  border-radius: var(--r-sm);
  width: 36px;
  height: 36px;
}

/* Sizes */
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-lg svg { width: 18px; height: 18px; }

/* Loading state */
.btn.loading { pointer-events: none; }
.btn.loading::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── Form Elements ────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.01em;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px var(--sp-4);
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  outline: none;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), background var(--dur-mid) var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-3); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--lord);
  box-shadow: 0 0 0 3px rgba(105, 65, 198, 0.12);
}

.form-input.error { border-color: var(--red); }
.form-input.error:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12); }

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

.form-textarea { resize: vertical; min-height: 80px; }

.form-hint {
  font-size: 12px;
  color: var(--text-3);
}

.form-error {
  font-size: 12px;
  color: var(--red);
  font-weight: 500;
}

/* ── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--dur-mid) var(--ease), border-color var(--dur-mid) var(--ease), background var(--dur-mid) var(--ease);
}

.card-hover:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-mid);
}

.card-interactive {
  cursor: pointer;
}
.card-interactive:hover {
  box-shadow: var(--shadow-brand);
  border-color: var(--lord-mid);
  transform: translateY(-2px);
}

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

.card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ── Property Cards ───────────────────────────────────────── */
.property-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  cursor: pointer;
  transition: all var(--dur-slow) var(--ease);
  position: relative;
  overflow: hidden;
}

.property-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity var(--dur-mid) var(--ease);
}

.property-card:hover {
  box-shadow: var(--shadow-brand);
  border-color: var(--lord-mid);
  transform: translateY(-3px);
}

.property-card:hover::before { opacity: 1; }

.property-card-name {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-1);
}

.property-card-address {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: var(--sp-5);
}

.property-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

.stat-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-value.equi { color: var(--equi); }
.stat-value.lord { color: var(--lord); }
.stat-value.green { color: var(--green); }
.stat-value.red   { color: var(--red); }

/* ── Badges / Pills ───────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--r-full);
  white-space: nowrap;
}

.badge-actual   { background: var(--green-light);  color: var(--green); }
.badge-assumed  { background: var(--yellow-light); color: var(--yellow); }
.badge-projected { background: var(--blue-light);  color: var(--blue); }
.badge-missed   { background: var(--red-light);    color: var(--red); }
.badge-current  { background: var(--lord-light);   color: var(--lord); }
.badge-brand    { background: var(--brand-gradient-soft); color: var(--lord); }

/* ── Chip filters ─────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--r-full);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
  -webkit-user-select: none;
  user-select: none;
}
.chip:hover { border-color: var(--lord-mid); color: var(--lord); background: var(--lord-light); }
.chip.active { background: var(--lord); border-color: var(--lord); color: white; }
.chip.active:hover { background: var(--lord); opacity: 0.9; color: white; }

/* ── Table ────────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table thead th:first-child { border-radius: var(--r-lg) 0 0 0; }
.data-table thead th:last-child  { border-radius: 0 var(--r-lg) 0 0; }

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast) var(--ease);
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-hover); }
.data-table tbody tr.current-month { background: var(--overlay); }

.data-table td {
  padding: var(--sp-3) var(--sp-4);
  color: var(--text-2);
  vertical-align: middle;
}

.data-table td.amount,
.data-table th.amount { text-align: right; }

.data-table td strong { color: var(--text); font-weight: 600; }

/* ── Tabs ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: var(--sp-6);
}

.tab {
  padding: var(--sp-3) var(--sp-5);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-ui);
}
.tab:hover { color: var(--text-2); }
.tab.active { color: var(--lord); border-bottom-color: var(--lord); }

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 13, 26, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  z-index: 100;
  animation: fadeIn var(--dur-fast) var(--ease);
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-8);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-xl);
  animation: modalIn var(--dur-slow) var(--ease);
}

.modal-lg { max-width: 640px; }
.modal-sm { max-width: 380px; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.modal-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--dur-fast) var(--ease);
}
.modal-close:hover { background: var(--bg-2); color: var(--text); }

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
}

/* ── Toast notifications ──────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  z-index: 200;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  min-width: 240px;
  max-width: 360px;
  animation: toastIn var(--dur-slow) var(--ease);
}

.toast-icon { flex-shrink: 0; width: 18px; height: 18px; }
.toast-success .toast-icon { color: var(--green); }
.toast-error   .toast-icon { color: var(--red); }
.toast-info    .toast-icon { color: var(--lord); }

.toast.out { animation: toastOut var(--dur-mid) var(--ease) forwards; }

/* ── Progress bar ─────────────────────────────────────────── */
.progress-track {
  height: 8px;
  background: var(--bg-3);
  border-radius: var(--r-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--brand-gradient);
  border-radius: var(--r-full);
  transition: width 0.8s var(--ease);
}

.progress-lg .progress-track { height: 12px; }

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--sp-5) 0;
}

/* ── Navigation ───────────────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background var(--dur-mid) var(--ease);
}

.nav-left  { display: flex; align-items: center; gap: var(--sp-6); }
.nav-right { display: flex; align-items: center; gap: var(--sp-3); }

/* Breadcrumb trail */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13px;
  color: var(--text-3);
}
.breadcrumb-sep { color: var(--border-mid); }
.breadcrumb-item { color: var(--text-3); transition: color var(--dur-fast) var(--ease); }
.breadcrumb-item:hover { color: var(--lord); }
.breadcrumb-item.active { color: var(--text); font-weight: 600; }

/* ── Page layout ──────────────────────────────────────────── */
.page { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; padding: var(--sp-8) var(--sp-6); max-width: 1200px; margin: 0 auto; width: 100%; }
.main-wide { max-width: 1400px; }
.main-narrow { max-width: 760px; }

/* ── Section headers ──────────────────────────────────────── */
.section-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
}

.section-subtitle {
  font-size: 15px;
  color: var(--text-3);
  margin-top: var(--sp-1);
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-16) var(--sp-8);
  gap: var(--sp-4);
}

.empty-state-icon {
  width: 64px; height: 64px;
  background: var(--brand-gradient-soft);
  border-radius: var(--r-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.empty-state-body {
  font-size: 14px;
  color: var(--text-3);
  max-width: 320px;
  line-height: 1.6;
}

/* ── Alerts / Banners ─────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  font-size: 14px;
  line-height: 1.5;
}
.alert-info    { background: var(--blue-light);   color: var(--blue);   border: 1px solid var(--blue-mid); }
.alert-success { background: var(--green-light);  color: var(--green);  border: 1px solid var(--green-mid); }
.alert-warning { background: var(--yellow-light); color: var(--yellow); border: 1px solid var(--yellow-mid); }
.alert-error   { background: var(--red-light);    color: var(--red);    border: 1px solid var(--red-mid); }
.alert-brand   { background: var(--brand-gradient-soft); color: var(--lord); border: 1px solid var(--lord-mid); }

/* ── Upload drop zone ─────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-8);
  text-align: center;
  cursor: pointer;
  transition: all var(--dur-mid) var(--ease);
  background: var(--bg);
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--lord);
  background: var(--lord-light);
}

/* ── Theme toggle ─────────────────────────────────────────── */
.theme-toggle {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  font-size: 16px;
}
.theme-toggle:hover { border-color: var(--lord); color: var(--lord); background: var(--lord-light); }

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--lord);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner-sm { width: 14px; height: 14px; }
.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

/* ── Skeleton loading ─────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}

/* ── Utility classes ──────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2  { gap: var(--sp-2); }
.gap-3  { gap: var(--sp-3); }
.gap-4  { gap: var(--sp-4); }
.gap-6  { gap: var(--sp-6); }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.text-sm   { font-size: 13px; }
.text-xs   { font-size: 11px; }
.text-muted { color: var(--text-3); }
.text-2    { color: var(--text-2); }
.text-equi { color: var(--equi); }
.text-lord { color: var(--lord); }
.text-green { color: var(--green); }
.text-red   { color: var(--red); }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.hidden { display: none !important; }
.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;
}

/* ── Animations ───────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); max-height: 80px; }
  to   { opacity: 0; transform: translateX(100%); max-height: 0; }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(105, 65, 198, 0.4); }
  50%       { box-shadow: 0 0 0 8px rgba(124, 58, 237, 0); }
}

/* ── Scrollbar styling ────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--lord-mid); }

/* ── Focus visible ────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--lord);
  outline-offset: 2px;
}

/* ── Responsive grid helpers ──────────────────────────────── */
.grid-properties {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--sp-5);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}

@media (max-width: 640px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .main { padding: var(--sp-5) var(--sp-4); }
  .modal { padding: var(--sp-5); border-radius: var(--r-lg); }
  .tabs { overflow-x: auto; }
  #toast-container { left: var(--sp-4); right: var(--sp-4); }
  .toast { min-width: 0; max-width: 100%; }
}

@media (max-width: 480px) {
  .nav { padding: var(--sp-3) var(--sp-4); }
  .property-card-stats { grid-template-columns: 1fr 1fr; }
}

/* ── Micro-interactions & Polish ──────────────────────────── */

/* Badge as clickable button */
.badge-btn {
  all: unset;
  cursor: pointer;
  display: inline-block;
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.badge-btn:hover { transform: scale(1.06); opacity: 0.9; }
.badge-btn:active { transform: scale(0.95); }

/* Staggered card entrance */
.property-card {
  animation: fadeUp var(--dur-mid) var(--ease) both;
  animation-delay: var(--card-delay, 0ms);
}
@media (prefers-reduced-motion: reduce) {
  .property-card { animation: none; }
}

/* Skeleton property card (loading state) */
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--sp-6);
  min-height: 160px;
  overflow: hidden;
}
.skeleton-line {
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--bg-2) 25%, var(--border) 50%, var(--bg-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.skeleton-line-title { height: 20px; width: 65%; margin-bottom: var(--sp-3); }
.skeleton-line-sub   { height: 13px; width: 45%; margin-bottom: var(--sp-6); }
.skeleton-line-stat  { height: 28px; flex: 1; border-radius: var(--r-sm); }
.skeleton-stats      { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); margin-top: auto; }

/* View fade transitions */
.view-enter {
  animation: fadeUp 0.22s var(--ease) both;
}

/* Progress bar animated fill */
.progress-fill {
  transition: width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Current month row pulse */
.data-table tbody tr.current-month td:first-child {
  position: relative;
}
.data-table tbody tr.current-month td:first-child::before {
  content: '';
  position: absolute;
  left: 0; top: 25%; bottom: 25%;
  width: 3px;
  background: var(--brand-gradient);
  border-radius: var(--r-full);
}

/* Form input shimmer on focus */
.form-input:focus {
  animation: none;
}

/* Btn-tbl danger state */
.btn-tbl.danger:hover { border-color: var(--red); color: var(--red); background: var(--red-light); }

/* Smooth table row delete flash */
@keyframes rowDelete {
  from { opacity: 1; background: var(--red-light); }
  to   { opacity: 0; transform: translateX(8px); }
}
.row-deleting {
  animation: rowDelete 0.3s var(--ease) forwards;
  pointer-events: none;
}

/* Number count-up shimmer on stat cards */
.stat-card .s-value {
  transition: color var(--dur-mid) var(--ease);
}

/* Tab panel entrance */
.tab-panel.active {
  animation: fadeUp 0.18s var(--ease) both;
}
@media (prefers-reduced-motion: reduce) {
  .tab-panel.active, .view-enter { animation: none; }
}
