:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --ink: #1a1a1a;
  --muted: #5c6570;
  --line: #e6e4de;
  --paper: #f7f6f3;
  --card: #ffffff;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --control-h: 40px;
  --radius: 10px;
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Source Sans 3', -apple-system, sans-serif;
  color: var(--ink); background: var(--paper);
  line-height: 1.5; font-size: 16px;
}
nav {
  border-bottom: 1px solid #e5e5e0; padding: 18px 24px;
  display: flex; justify-content: space-between; align-items: center;
  background: #fff; position: sticky; top: 0; z-index: 50;
}
.nav-brand { font-family: 'Source Sans 3', -apple-system, sans-serif; font-weight: 700; font-size: 20px; color: #2563eb; text-decoration: none; letter-spacing: -0.02em; }
.nav-right { font-size: 14px; color: #64748b; display: flex; align-items: center; gap: 12px; }
.nav-right a { color: #2563eb; cursor: pointer; text-decoration: none; }
.portal-nav-links { display: flex; align-items: center; gap: 24px; font-size: 15px; font-weight: 500; }
.portal-nav-links > a { font-family: 'Source Sans 3', -apple-system, sans-serif; color: #555; text-decoration: none; }
.portal-nav-links > a:hover { color: #2563eb; }
@media (max-width: 768px) {
  nav { flex-wrap: wrap; padding: 14px 18px; gap: 10px; }
  .portal-nav-links { width: 100%; flex-wrap: wrap; gap: 14px 18px; font-size: 14px; }
}

.container { max-width: 800px; margin: 0 auto; padding: var(--space-6) var(--space-5) var(--space-7); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: var(--space-5); margin-bottom: var(--space-5);
}
.auth-card { max-width: 440px; margin-left: auto; margin-right: auto; }
.section-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: #94a3b8; margin: var(--space-4) 0 var(--space-2);
}
.section-note {
  font-size: 14px; line-height: 1.45; color: var(--muted);
  margin: 0 0 var(--space-3);
}

h1 {
  font-family: 'Lora', serif; font-size: 28px; font-weight: 700;
  margin-bottom: 8px; letter-spacing: -0.02em;
}
h2 {
  font-family: 'Lora', serif; font-size: 22px; font-weight: 700;
  margin-bottom: 8px; letter-spacing: -0.01em;
}
h3 { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.subtitle { font-size: 17px; color: #555; margin-bottom: 28px; line-height: 1.6; }

.section { margin-bottom: 36px; }
.hidden { display: none; }

/* Credit balance */
.credit-bar {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border: 1px solid #e5e5e0; border-radius: 12px;
  padding: 16px 20px; margin-bottom: 24px;
}
.credit-count { font-size: 15px; font-weight: 600; color: #1a1a1a; }
.credit-count span { font-size: 24px; color: #2563eb; margin-right: 6px; }
.credit-zero { color: #92400e; }
.credit-zero span { color: #92400e; }

/* Auth form */
label {
  display: block; font-weight: 600; font-size: 14px;
  color: #475569; margin-bottom: 6px; margin-top: 16px;
}
input[type="email"], input[type="password"], input[type="text"], input[type="date"], select {
  width: 100%; border: 1px solid #d9d6cf; border-radius: var(--radius);
  min-height: var(--control-h); padding: 8px 12px; font-size: 16px; font-family: inherit;
  color: var(--ink); background: #fff;
}
input:focus, select:focus { outline: 2px solid #bfdbfe; border-color: var(--blue); }

/* Buttons. One height everywhere. A block button fills its card, not the page. */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--control-h); padding: 0 16px; font-size: 15px; font-weight: 600;
  border: none; border-radius: var(--radius); cursor: pointer;
  transition: background 0.2s, border-color 0.2s; text-align: center;
  text-decoration: none; gap: 8px; line-height: 1.2;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #93c5fd; cursor: not-allowed; }
.btn-block { display: flex; width: 100%; max-width: 440px; }
.btn-secondary {
  background: transparent; color: #2563eb; border: 1.5px solid #2563eb;
}
.btn-secondary:hover { background: #eff6ff; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 8px; }
.btn-ghost {
  background: transparent; color: #64748b; font-size: 14px;
  padding: 8px; border: none;
}
.btn-ghost:hover { color: #1a1a1a; }

/* Properties table */
.properties-table { width: 100%; border-collapse: collapse; }
.properties-table th {
  text-align: left; font-size: 12px; font-weight: 600;
  color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 8px 12px; border-bottom: 1px solid #e5e5e0;
}
.properties-table td {
  padding: 14px 12px; border-bottom: 1px solid #f1f5f9;
  font-size: 14px; vertical-align: middle;
}
.properties-table tr:hover { background: #f8fafc; }
.property-address { font-weight: 600; color: #1e293b; font-size: 15px; }
.property-tenant { color: #64748b; }

/* Status pills */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.rescind-btn { font-size: 12px; color: #dc2626; background: none; border: 1px solid #fecaca; border-radius: 6px; padding: 3px 10px; cursor: pointer; margin-left: 8px; font-family: inherit; vertical-align: middle; }
.rescind-btn:hover { background: #fef2f2; }
.status-invited { background: #fef3c7; color: #92400e; }
.status-ready { background: #dbeafe; color: #1e40af; }
.status-ack { background: #dcfce7; color: #166534; }
.status-none { background: #f1f5f9; color: #475569; }

/* Move-outs list (task 4, commit A) */
.moveout-list { display: flex; flex-direction: column; gap: 10px; }
.moveout-card {
  background: #fff; border: 1.5px solid #e2e8f0; border-radius: 12px;
  padding: 16px 20px; display: flex; justify-content: space-between;
  align-items: center; gap: 12px 16px; flex-wrap: wrap;
}
.moveout-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 320px; }
.moveout-address { font-weight: 600; font-size: 16px; color: #1e293b; }
.moveout-meta { font-size: 13px; color: #64748b; }
.moveout-note { font-size: 13px; color: #64748b; max-width: 240px; }

/* Pricing tiers */
.tiers { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.tier {
  border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 16px;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; transition: border-color 0.2s, background 0.2s;
  width: 100%; background: #fff; font: inherit; color: inherit; text-align: left;
}
.tier:hover { border-color: #2563eb; background: #f8faff; }
.tier.selected { border-color: #2563eb; background: #eff6ff; }
.tier-info h3 { font-size: 16px; font-weight: 600; margin-bottom: 2px; }
.tier-info p { font-size: 13px; color: #64748b; }
.tier-price { text-align: right; }
.tier-price .amount { font-size: 18px; font-weight: 700; color: #1a1a1a; }
.tier-price .per-report { font-size: 12px; color: #64748b; }
.tier-price .savings { font-size: 11px; color: #16a34a; font-weight: 600; }
.tier-price .was { font-size: 12px; color: #94a3b8; text-decoration: line-through; }

/* Modal overlay */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal {
  background: #fff; border-radius: 16px; padding: 32px;
  width: 90%; max-width: 480px; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal h2 { margin-bottom: 4px; }
.invite-path-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  color: #64748b;
  transition: border-color 0.15s, background 0.15s;
}
.invite-path-btn strong {
  font-size: 14px;
  color: #1e293b;
  display: block;
}
.invite-path-btn.active {
  border-color: #2563eb;
  background: #eff6ff;
}
.invite-path-btn:hover {
  border-color: #93c5fd;
}
.invite-path-btn span:first-child {
  font-size: 20px;
}
.modal-close {
  float: right; background: none; border: none; font-size: 22px;
  cursor: pointer; color: #94a3b8; padding: 0; line-height: 1;
}
.modal-close:hover { color: #1a1a1a; }

/* Empty state */
.empty-state {
  text-align: center; padding: 48px 24px;
  background: #fff; border: 1.5px dashed #e2e8f0; border-radius: 16px;
}
.empty-state p { color: #64748b; margin-bottom: 20px; font-size: 15px; }

/* Success / error */
.success {
  background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 12px;
  padding: 16px 20px; color: #15803d; font-weight: 600; font-size: 14px;
}
.error-msg {
  background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px;
  padding: 14px 18px; color: #dc2626; font-size: 14px; margin-top: 12px;
}

.auth-toggle {
  text-align: center; margin-top: 16px; font-size: 14px; color: #64748b;
}
.auth-toggle a { color: #2563eb; cursor: pointer; text-decoration: none; }
.note { font-size: 13px; color: #94a3b8; margin-top: 10px; text-align: center; }
.divider { border-top: 1px solid #e5e5e0; margin: 28px 0; }

/* How it works steps */
.steps { display: flex; flex-direction: column; gap: 16px; margin: 20px 0 28px; }
.step {
  display: flex; gap: 14px; align-items: flex-start;
}
.step-num {
  flex-shrink: 0; width: 28px; height: 28px;
  background: #2563eb; color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.step-text { font-size: 15px; color: #374151; padding-top: 3px; }
.step-text strong { color: #1e293b; }

/* Dashboard header */
.dash-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}

/* Promo section */
.promo-inline {
  display: flex; gap: 8px; align-items: center; margin-top: 10px;
}
.promo-inline input { flex: 1; margin-top: 0; }
.promo-inline button { white-space: nowrap; margin-top: 0; }

/* Responsive */
.package-list { display: flex; flex-direction: column; gap: var(--space-4); }
.package-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: var(--space-4); }
.package-card h3 { font-family: 'Lora', serif; font-size: 18px; margin-bottom: var(--space-2); }
.check-row { display: flex; justify-content: space-between; gap: var(--space-3); padding: 8px 0; border-top: 1px solid #f1efe9; font-size: 14px; }
.check-row:first-of-type { border-top: none; }
.check-locked, .check-not_built { color: #94a3b8; }
.check-done { color: #166534; }
.check-pending { color: #1e293b; }
.badge-best { display: inline-block; margin-left: 8px; font-size: 11px; font-weight: 700; color: #1d4ed8; background: #eff6ff; border-radius: 999px; padding: 2px 8px; }
.preselect-note { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px; padding: 12px 14px; margin-bottom: var(--space-4); font-size: 14px; color: #1e3a8a; }

@media (max-width: 640px) {
  .container { padding: 16px 16px 48px; }
  .btn-block { max-width: none; }
  .auth-card, .card { max-width: none; }
  h1 { font-size: 24px; }
  .properties-table th:nth-child(3),
  .properties-table td:nth-child(3) { display: none; }
  .tier { padding: 14px 16px; }
  .modal { padding: 24px 20px; }
}

/* Loading skeleton */
.skeleton { background: #f1f5f9; border-radius: 8px; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
/* Property detail panel */
.detail-panel {
  background: #fff; border: 1px solid #e5e5e0; border-radius: 16px;
  padding: 28px; margin-bottom: 24px;
}
.detail-back {
  font-size: 14px; font-weight: 600; color: #2563eb;
  cursor: pointer; text-decoration: none; margin-bottom: 16px; display: inline-block;
}
.detail-back:hover { text-decoration: underline; }
.detail-address {
  font-family: 'Lora', serif; font-size: 22px; font-weight: 700;
  margin-bottom: 4px; color: #1a1a1a;
}
.detail-meta { font-size: 14px; color: #64748b; margin-bottom: 20px; }
.detail-meta span { margin-right: 16px; }
.detail-section-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: #94a3b8; margin: 24px 0 10px;
}
.detail-actions { display: flex; flex-direction: column; gap: 8px; }
.detail-action {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border: 1.5px solid #e2e8f0; border-radius: 12px;
  cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.detail-action:hover { border-color: #2563eb; background: #f8faff; }
.detail-action-info h3 { font-size: 15px; font-weight: 600; color: #1e293b; margin-bottom: 1px; }
.detail-action-info p { font-size: 13px; color: #64748b; }
.detail-action-arrow { color: #94a3b8; font-size: 18px; }
.detail-action.disabled {
  opacity: 0.45; pointer-events: none; cursor: default;
}
.detail-report-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: #2563eb;
  text-decoration: none; margin-top: 8px;
}
.detail-report-link:hover { text-decoration: underline; }

/* Document modals */
.doc-prefilled {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 12px 16px; margin-bottom: 16px;
}
.doc-prefilled-label {
  font-size: 11px; font-weight: 600; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.doc-prefilled-value { font-size: 15px; color: #1e293b; margin-top: 2px; }
.doc-field-label {
  display: block; font-weight: 600; font-size: 14px;
  color: #475569; margin-bottom: 6px; margin-top: 16px;
}
.doc-hint { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.doc-amount-row { display: flex; align-items: center; gap: 6px; }
.doc-dollar { font-size: 17px; font-weight: 600; color: #1e293b; }
.doc-amount-input {
  flex: 1; border: 1.5px solid #e2e8f0; border-radius: 8px;
  padding: 10px 14px; font-size: 17px; font-weight: 600;
  color: #1e293b; font-family: inherit;
}
.doc-amount-input:focus { outline: none; border-color: #2563eb; }
.doc-section-header {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: #94a3b8; margin: 20px 0 8px;
}

/* Deduction cards for deposit return letter */
.deduction-card {
  padding-top: 10px; margin-top: 10px;
  border-top: 1px solid #f1f5f9;
}
.deduction-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;
}
.deduction-label { font-size: 14px; font-weight: 600; color: #64748b; }
.deduction-remove { font-size: 13px; color: #ef4444; font-weight: 500; cursor: pointer; border: none; background: none; }
.deduction-remove:hover { text-decoration: underline; }
.add-deduction-btn {
  font-size: 14px; font-weight: 600; color: #2563eb;
  cursor: pointer; background: none; border: none; margin-top: 10px; padding: 0;
}
.add-deduction-btn:hover { text-decoration: underline; }

/* Summary card */
.doc-summary {
  margin-top: 16px; background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 10px; padding: 14px 16px;
}
.doc-summary-row {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;
}
.doc-summary-label { font-size: 14px; color: #64748b; }
.doc-summary-value { font-size: 14px; font-weight: 600; color: #1e293b; }
.doc-summary-total {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid #e2e8f0;
}
.doc-summary-total .doc-summary-label { font-size: 15px; font-weight: 700; color: #1e293b; }
.doc-summary-total .doc-summary-value { font-size: 17px; font-weight: 700; color: #16a34a; }

/* Delivery chips */
.delivery-row { display: flex; gap: 8px; }
.delivery-chip {
  flex: 1; padding: 10px; border-radius: 10px;
  border: 1.5px solid #e2e8f0; text-align: center;
  font-size: 13px; font-weight: 600; color: #94a3b8;
  cursor: pointer; background: none; font-family: inherit;
  transition: border-color 0.2s, background 0.2s;
}
.delivery-chip:hover { border-color: #93c5fd; }
.delivery-chip.active { border-color: #2563eb; background: #eff6ff; color: #2563eb; }
/* Comparison viewer */
.comparison-container {
  background: #fff; border: 1px solid #e5e5e0; border-radius: 12px;
  padding: 24px; margin-top: 16px; max-height: 60vh; overflow-y: auto;
}
.comparison-container h1 { font-size: 20px; margin: 20px 0 10px; }
.comparison-container h2 {
  font-size: 17px; margin: 20px 0 8px; padding-bottom: 4px;
  border-bottom: 2px solid #e2e8f0;
}
.comparison-container h3 { font-size: 15px; margin: 16px 0 6px; color: #334155; }
.comparison-container p { margin: 6px 0; font-size: 14px; color: #334155; line-height: 1.6; }
.comparison-container ul { padding-left: 20px; margin: 6px 0; }
.comparison-container li { font-size: 14px; color: #334155; margin: 3px 0; }
.comparison-container hr { border: none; border-top: 1px solid #e2e8f0; margin: 16px 0; }
.comparison-container strong { color: #0f172a; }
.comparison-actions {
  display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap;
}
.ds-loading {
  text-align: center; padding: 48px 24px;
}
.ds-loading-spinner {
  width: 36px; height: 36px; border: 3px solid #e2e8f0;
  border-top-color: #2563eb; border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ds-loading-title { font-size: 18px; font-weight: 700; color: #1e293b; margin-bottom: 8px; }
.ds-loading-sub { font-size: 14px; color: #64748b; }
.ds-loading-hint { font-size: 13px; color: #94a3b8; margin-top: 8px; }
.ds-summary-banner {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 16px;
}
.ds-summary-text { font-size: 14px; font-weight: 600; color: #334155; }
.ds-summary-range { font-size: 13px; color: #64748b; margin-top: 4px; }
.ds-section-label {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: #94a3b8; margin: 20px 0 6px;
}
.ds-section-hint { font-size: 13px; color: #64748b; margin-bottom: 12px; }
.ds-finding {
  border: 1.5px solid #e2e8f0; border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px; transition: border-color 0.2s;
}
.ds-finding.selected { border-color: #2563eb; background: #f8faff; }
.ds-finding-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.ds-finding-room { font-size: 12px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.5px; }
.ds-finding-desc { font-size: 14px; font-weight: 600; color: #1e293b; margin-top: 2px; }
.ds-finding-toggle {
  flex-shrink: 0; width: 44px; height: 24px; border-radius: 12px;
  border: none; cursor: pointer; position: relative;
  background: #e2e8f0; transition: background 0.2s;
}
.ds-finding-toggle.on { background: #2563eb; }
.ds-finding-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; transition: transform 0.2s;
}
.ds-finding-toggle.on::after { transform: translateX(20px); }
.ds-finding-meta { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.ds-badge {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
}
.ds-finding-just { font-size: 13px; color: #64748b; margin-top: 6px; line-height: 1.5; }
.ds-finding-amount {
  display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap;
}
.ds-finding-amount-input {
  width: 100px; border: 1.5px solid #e2e8f0; border-radius: 8px;
  padding: 6px 10px; font-size: 15px; font-weight: 600; font-family: inherit;
}
.ds-finding-amount-input:focus { outline: none; border-color: #2563eb; }
.ds-cost-range { font-size: 12px; color: #94a3b8; }
.ds-finding-muted {
  border: 1px solid #f1f5f9; border-radius: 10px; padding: 12px 14px;
  margin-bottom: 8px; opacity: 0.7;
}
.ds-footer {
  border-top: 1px solid #e5e5e0; background: #fff;
  padding: 16px 0; margin-top: 24px;
}
.ds-totals {
  display: flex; gap: 24px; margin-bottom: 14px; justify-content: center;
}
.ds-total-item { text-align: center; }
.ds-total-label { font-size: 12px; color: #94a3b8; font-weight: 600; text-transform: uppercase; }
.ds-total-value { font-size: 20px; font-weight: 700; color: #1e293b; }
