/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-muted: #718096;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --success: #10b981;
  --warning: #f59e0b;
  --sidebar-w: 220px;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 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);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
}

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

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 20px 16px;
  font-size: 17px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo { font-size: 22px; }

.nav-links {
  list-style: none;
  padding: 12px 0;
  flex: 1;
}
.nav-links li a {
  display: block;
  padding: 10px 20px;
  color: var(--text-muted);
  font-weight: 500;
  border-radius: 6px;
  margin: 2px 8px;
  transition: background 0.15s, color 0.15s;
}
.nav-links li a:hover { background: var(--bg); color: var(--text); }
.nav-links li a.active { background: #eff6ff; color: var(--primary); }

/* ── Main Content ─────────────────────────────────────────────────────────── */
.content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px;
  min-height: 100vh;
  max-width: 1200px;
}

.view { display: none; }
.view.active { display: block; }

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.view-header h1 { margin-bottom: 0; }

h1 { font-size: 24px; font-weight: 700; margin-bottom: 24px; }
h2 { font-size: 18px; font-weight: 600; margin: 24px 0 16px; }
h3 { font-size: 14px; font-weight: 600; color: var(--text-muted); text-transform: uppercase;
     letter-spacing: 0.04em; margin-bottom: 12px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 4px 10px; font-size: 13px; }

.back-btn { margin-bottom: 20px; }

/* ── Stats Grid ───────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 32px; font-weight: 700; line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

/* ── Assets Grid ──────────────────────────────────────────────────────────── */
.assets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.asset-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  position: relative;
}
.asset-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }
.asset-card .type-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 99px;
  margin-bottom: 8px;
}
.badge-house    { background: #dbeafe; color: #1d4ed8; }
.badge-vehicle  { background: #d1fae5; color: #065f46; }
.badge-appliance{ background: #fce7f3; color: #9d174d; }
.badge-hvac     { background: #fff7ed; color: #9a3412; }
.badge-other    { background: #f3f4f6; color: #374151; }

.asset-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; text-transform: none;
                 letter-spacing: normal; color: var(--text); }
.asset-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.asset-footer { display: flex; justify-content: space-between; align-items: center;
                font-size: 13px; color: var(--text-muted); border-top: 1px solid var(--border);
                padding-top: 12px; margin-top: 12px; }
.asset-actions { position: absolute; top: 12px; right: 12px; display: flex; gap: 6px;
                 opacity: 0; transition: opacity 0.15s; }
.asset-card:hover .asset-actions { opacity: 1; }

/* ── Card List ────────────────────────────────────────────────────────────── */
.card-list { display: flex; flex-direction: column; gap: 12px; }
.log-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.log-card:hover { box-shadow: var(--shadow-md); }
.log-title { font-weight: 600; font-size: 15px; }
.log-meta { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.log-meta span + span::before { content: ' · '; }
.log-cost { font-weight: 600; font-size: 15px; color: var(--success); align-self: center; }
.log-actions { display: flex; gap: 6px; align-items: center; }
.due-badge { font-size: 11px; font-weight: 600; background: #fef3c7; color: #92400e;
             padding: 2px 8px; border-radius: 99px; }
.overdue-badge { background: #fee2e2; color: #991b1b; }

/* ── Filter Bar ───────────────────────────────────────────────────────────── */
.filter-bar {
  margin-bottom: 20px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.filter-bar label { font-size: 13px; color: var(--text-muted); display: flex;
                    align-items: center; gap: 8px; }

/* ── Detail View ──────────────────────────────────────────────────────────── */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.detail-actions { display: flex; gap: 8px; flex-shrink: 0; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}
.detail-field label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.detail-field p { font-size: 15px; margin-top: 2px; }

.attachments-list { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.attachment-thumb {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  width: 100px;
  position: relative;
  cursor: pointer;
}
.attachment-thumb img { width: 100%; height: 80px; object-fit: cover; display: block; }
.attachment-thumb .file-icon { width: 100%; height: 80px; display: flex;
  align-items: center; justify-content: center; font-size: 28px; background: var(--bg); }
.attachment-thumb .del-attachment {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,0.5); color: white;
  border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transition: opacity 0.15s;
}
.attachment-thumb:hover .del-attachment { opacity: 1; }
.parsed-info { font-size: 12px; text-align: center; padding: 4px; color: var(--text-muted);
               border-top: 1px solid var(--border); }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 12px; }
.modal-form label { display: flex; flex-direction: column; font-size: 13px; color: var(--text-muted);
                    font-weight: 500; gap: 4px; margin-bottom: 12px; }
.modal-form input, .modal-form select, .modal-form textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  width: 100%;
  transition: border-color 0.15s;
}
.modal-form input:focus, .modal-form select:focus, .modal-form textarea:focus {
  outline: none; border-color: var(--primary);
}
.form-section { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px;
                padding-top: 16px; border-top: 1px solid var(--border); }

/* Dynamic section show/hide */
.vehicle-fields, .house-fields { display: none; }
.vehicle-fields.show, .house-fields.show { display: block; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  padding: 40px 16px;
  overflow-y: auto;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0,0,0,0.15);
  width: 100%;
  max-width: 640px;
  padding: 24px;
  position: relative;
}
.modal-sm { max-width: 400px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { font-size: 18px; font-weight: 600; margin: 0; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer;
               color: var(--text-muted); line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--text); }

/* ── Upload ───────────────────────────────────────────────────────────────── */
.upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  margin-bottom: 16px;
  transition: border-color 0.15s;
  text-align: center;
  color: var(--text-muted);
}
.upload-area:hover { border-color: var(--primary); }
.upload-area input[type="file"] { display: none; }
#upload-preview img { max-width: 100%; max-height: 200px; border-radius: 6px; margin-bottom: 12px; }
.progress-bar { background: var(--border); border-radius: 99px; height: 6px; overflow: hidden; margin-bottom: 8px; }
.progress-fill { background: var(--primary); height: 100%; width: 0; transition: width 0.3s; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state p { margin-bottom: 16px; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  background: var(--text);
  color: white;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.2s ease;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Sidebar footer (user info) ───────────────────────────────────────────── */
.sidebar { display: flex; flex-direction: column; }
.sidebar-footer { margin-top: auto; padding: 12px 12px 16px; border-top: 1px solid var(--border); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--border); }
.user-details { min-width: 0; }
.user-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signout-link { font-size: 12px; color: var(--text-muted); }
.signout-link:hover { color: var(--danger); }

/* ── Nav group labels ─────────────────────────────────────────────────────── */
.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 12px 20px 4px;
  opacity: 0.6;
}

/* ── Practice views ───────────────────────────────────────────────────────── */
.practice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}
.practice-header h1 { margin: 0; }
.practice-header-actions { display: flex; gap: 8px; }

/* ── Goal cards ───────────────────────────────────────────────────────────── */
.goals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.goal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.goal-card.goal-met { border-color: var(--success); }
.goal-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 8px;
}
.goal-card-title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.goal-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.goal-card-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }

/* Tick boxes on goal card */
.goal-ticks {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tick-box {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}
.tick-box.filled { background: var(--success); border-color: var(--success); color: white; }
.tick-box.empty:hover { border-color: var(--primary); background: #eff6ff; }
.tick-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: 4px;
}
.tick-label.met { color: var(--success); font-weight: 600; }

/* ── 52-week grid ─────────────────────────────────────────────────────────── */
.grid-section { margin-bottom: 32px; }
.grid-section h3 { margin-bottom: 12px; }
.week-grid-wrapper {
  overflow-x: auto;
  padding-bottom: 4px;
}
.week-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-width: 460px;
}
.week-grid-segment {
  display: contents;
}
.week-cell {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  flex-shrink: 0;
  cursor: default;
  position: relative;
}
.week-cell.met     { background: #22c55e; }
.week-cell.missed  { background: #fca5a5; }
.week-cell.future  { background: var(--border); }
.week-cell.no-goal { background: #f3f4f6; }
.period-divider {
  width: 3px;
  height: 14px;
  background: var(--text-muted);
  border-radius: 2px;
  flex-shrink: 0;
  opacity: 0.4;
}
.grid-legend {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-swatch { width: 12px; height: 12px; border-radius: 2px; }

/* Grid tooltip */
.week-cell[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  font-size: 11px;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 4px;
  z-index: 10;
  pointer-events: none;
}

/* Goal period label */
.period-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* ── Session cards ────────────────────────────────────────────────────────── */
.session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.session-card.is-milestone {
  border-left: 3px solid var(--warning);
}
.session-milestone-dot {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
.session-body { flex: 1; min-width: 0; }
.session-title { font-weight: 600; font-size: 14px; }
.session-meta { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.session-meta span + span::before { content: ' · '; }
.session-notes { font-size: 13px; color: var(--text-muted); margin-top: 6px;
                 white-space: pre-wrap; }
.session-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ── Goal checkboxes in session form ──────────────────────────────────────── */
.goal-checkboxes { display: flex; flex-direction: column; gap: 8px; }
.goal-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}
.goal-checkbox-item input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* ── Checkbox label ───────────────────────────────────────────────────────── */
.checkbox-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
}
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.checkbox-label span { font-weight: 500; font-size: 14px; color: var(--text); }
.checkbox-label small { font-size: 12px; color: var(--text-muted); display: block; margin-top: 2px; }

/* Milestone filter toggle */
.milestone-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  margin-bottom: 16px;
}
.milestone-toggle input { cursor: pointer; }

/* ── Admin user cards ─────────────────────────────────────────────────────── */
.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}
.user-card-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--border); flex-shrink: 0; }
.user-card-body { flex: 1; min-width: 0; }
.user-card-name { font-weight: 600; font-size: 14px; }
.user-card-email { font-size: 13px; color: var(--text-muted); }
.user-card-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.user-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.status-badge { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: 0.04em; }
.status-pending  { background: #fef3c7; color: #92400e; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-denied   { background: #fee2e2; color: #991b1b; }
.role-badge { font-size: 11px; background: #ede9fe; color: #5b21b6; padding: 2px 8px; border-radius: 99px; font-weight: 600; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .sidebar { width: 60px; }
  .sidebar-header .app-title, .nav-links li a, .nav-group-label { display: none; }
  .logo { margin: 0 auto; }
  .content { margin-left: 60px; padding: 16px; }
}

/* ── Dashboard service reminders ─────────────────────────────────────────── */
.service-reminders { margin-top: 20px; }
.reminder-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.reminder-item.overdue { border-color: #fca5a5; background: #fef2f2; }
.reminder-item.upcoming { border-color: #fde68a; background: #fffbeb; }
@media (prefers-color-scheme: dark) {
  .reminder-item.overdue { border-color: #7f1d1d; background: #1c0808; }
  .reminder-item.upcoming { border-color: #78350f; background: #1c1004; }
}
.reminder-icon { font-size: 20px; flex-shrink: 0; }
.reminder-body { flex: 1; min-width: 0; }
.reminder-title { font-weight: 600; }
.reminder-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.reminder-date { font-size: 12px; font-weight: 600; color: var(--text-muted); flex-shrink: 0; }
.reminder-date.past { color: #ef4444; }

/* ── Dashboard practice summary ──────────────────────────────────────────── */
.dash-practice-summary { margin-top: 20px; display: flex; flex-direction: column; gap: 16px; }
.dash-practice-block { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.dash-practice-name { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.dash-goal-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.dash-goal-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-goal-bar { flex: 2; height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; }
.dash-goal-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width 0.4s ease; }
.dash-goal-fill.met { background: #22c55e; }
.dash-goal-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* ── Stat warn ───────────────────────────────────────────────────────────── */
.stat-warn .stat-value { color: #ef4444; }

/* ── Vendor cards ────────────────────────────────────────────────────────── */
.vendor-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.vendor-body { flex: 1; min-width: 0; }
.vendor-name { font-weight: 700; font-size: 15px; }
.vendor-specialty { font-size: 13px; color: var(--accent); margin-top: 2px; }
.vendor-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.vendor-stars { color: #f59e0b; letter-spacing: 1px; }
.vendor-notes { font-size: 13px; color: var(--text-muted); margin-top: 6px; font-style: italic; }
.vendor-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ── Template cards ──────────────────────────────────────────────────────── */
.template-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.template-body { flex: 1; min-width: 0; }
.template-title { font-weight: 700; font-size: 15px; }
.template-desc { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.template-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); margin-top: 8px; }
.template-actions { display: flex; gap: 4px; flex-shrink: 0; align-items: flex-start; padding-top: 2px; }

/* ── Timeline ────────────────────────────────────────────────────────────── */
.timeline-list { max-width: 680px; }
.timeline-group { margin-bottom: 28px; }
.timeline-month {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.timeline-item {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-icon { font-size: 20px; flex-shrink: 0; width: 32px; text-align: center; padding-top: 2px; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-title { font-weight: 600; font-size: 14px; }
.timeline-sub { font-size: 13px; color: var(--accent); margin-top: 2px; }
.timeline-detail { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.timeline-date { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Cost Analytics ──────────────────────────────────────────────────────── */
.chart-container { margin: 16px 0 8px; }
.bar-chart { width: 100%; height: 160px; display: block; }
.chart-xaxis { width: 100%; height: 24px; display: block; }
.chart-label { font-size: 8px; fill: var(--text-muted); font-family: inherit; }
.bars rect { transition: opacity 0.15s; }
.bars rect:hover { opacity: 0.75; }
.analytics-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 8px;
}
.analytics-table th, .analytics-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.analytics-table th { font-weight: 700; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; }
.analytics-table tr:hover td { background: var(--hover); }

/* ── Asset photo ─────────────────────────────────────────────────────────── */
.asset-card-photo {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px 8px 0 0;
  display: block;
  margin-bottom: 8px;
}
.asset-card .asset-photo-wrap { margin: -16px -16px 12px; overflow: hidden; border-radius: 8px 8px 0 0; }

/* ── Advisor modal ───────────────────────────────────────────────────────── */
.advisor-content { font-size: 14px; line-height: 1.65; color: var(--text); }
.advisor-content h3 { font-size: 15px; font-weight: 700; margin: 16px 0 6px; color: var(--text); }
.advisor-content strong { font-weight: 600; }
.advisor-content ul { padding-left: 20px; margin: 6px 0; }
.advisor-content li { margin-bottom: 4px; }
.advisor-content p { margin: 8px 0; }
.advisor-loading { text-align: center; padding: 32px; color: var(--text-muted); font-style: italic; }
.advisor-loading::after { content: ''; animation: dots 1.5s steps(3,end) infinite; }
@keyframes dots { 0%,20%{content:''} 40%{content:'.'} 60%{content:'..'} 80%,100%{content:'...'} }
.advisor-error { color: #ef4444; padding: 16px; background: #fef2f2; border-radius: 6px; }

/* ── Monthly Reflections ─────────────────────────────────────────────────── */
.reflection-section { margin-top: 40px; }
.reflection-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.reflection-month {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.reflection-body { font-size: 14px; line-height: 1.65; }
