/* ─── Nav ─── */
.site-nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--bg-elevated);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--space-md);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}
.nav-logo {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg-primary);
  letter-spacing: -0.02em;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.nav-link {
  color: var(--fg-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--fg-primary); }
.nav-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1rem;
  background: var(--accent);
  color: var(--bg-primary);
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 4px;
  text-decoration: none;
  transition: background 0.2s;
}
.nav-cta:hover { background: var(--accent-glow); }

/* ─── App Shell ─── */
.app-shell {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}
.app-shell-narrow {
  max-width: 760px;
}

/* ─── Page header ─── */
.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  gap: 1rem;
  flex-wrap: wrap;
}
.page-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 0.25rem;
}
.section-title {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.section-subtitle {
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg-secondary);
}
.section-header {
  margin: var(--space-lg) 0 var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--bg-elevated);
}
.breadcrumb { margin-bottom: var(--space-md); }
.breadcrumb-link {
  color: var(--fg-muted);
  font-size: 0.9rem;
  text-decoration: none;
  font-family: var(--mono);
}
.breadcrumb-link:hover { color: var(--fg-secondary); }

/* ─── Buttons ─── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: var(--bg-primary);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-glow); }
.btn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1rem;
  background: transparent;
  color: var(--fg-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--bg-elevated);
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-ghost:hover { border-color: var(--fg-muted); color: var(--fg-primary); }
.btn-sm { padding: 0.25rem 0.6rem; font-size: 0.8rem; }
.btn-danger { color: var(--fg-muted); border-color: transparent; }
.btn-danger:hover { color: #e55; border-color: #e55; }

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
/* Risk profile badges */
.risk-wildfire      { background: rgba(220,80,40,0.15);  color: #e86040; }
.risk-flood         { background: rgba(40,120,220,0.15); color: #4a9af5; }
.risk-infrastructure{ background: rgba(150,100,220,0.15);color: #b080ef; }
.risk-multi-hazard  { background: rgba(212,130,42,0.15); color: var(--accent); }
/* Plan status badges */
.status-assessment  { background: rgba(90,87,82,0.3);    color: var(--fg-muted); }
.status-draft       { background: rgba(212,130,42,0.12); color: var(--accent); }
.status-active      { background: rgba(50,180,100,0.15); color: #4cd48a; }
.status-review-due  { background: rgba(220,100,60,0.15); color: #f07050; }

/* ─── Pipeline bar ─── */
.pipeline-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--bg-elevated);
  border-radius: 8px;
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}
.pipeline-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 70px;
  gap: 2px;
}
.pipeline-count {
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--fg-primary);
}
.pipeline-label {
  font-size: 0.7rem;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.pipeline-arrow {
  font-size: 1.5rem;
  color: var(--bg-elevated);
  padding: 0 0.25rem;
}

/* ─── Detail pipeline ─── */
.detail-pipeline {
  display: flex;
  align-items: center;
  margin: var(--space-md) 0 var(--space-lg);
  gap: 0;
}
.dp-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  opacity: 0.4;
}
.dp-stage.dp-active { opacity: 1; }
.dp-stage.dp-done { opacity: 0.7; }
.dp-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 2px solid var(--fg-muted);
  transition: all 0.2s;
}
.dp-stage.dp-active .dp-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px var(--accent-subtle);
}
.dp-stage.dp-done .dp-dot {
  background: var(--fg-muted);
  border-color: var(--fg-muted);
}
.dp-label {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--fg-muted);
  white-space: nowrap;
}
.dp-stage.dp-active .dp-label { color: var(--accent); font-weight: 500; }
.dp-connector {
  flex: 1;
  height: 2px;
  background: var(--bg-elevated);
  margin-bottom: 18px;
  min-width: 40px;
  max-width: 120px;
}

/* ─── Table ─── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--bg-elevated);
  border-radius: 8px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-family: var(--mono);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--bg-elevated);
  background: var(--bg-secondary);
}
.data-table tbody tr {
  border-bottom: 1px solid var(--bg-elevated);
  transition: background 0.15s;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--accent-subtle); }
.data-table td {
  padding: 0.875rem 1rem;
  vertical-align: middle;
}
.client-name { font-weight: 500; }
.text-muted { color: var(--fg-muted); }
.text-mono { font-family: var(--mono); font-size: 0.85rem; }
.row-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.status-select {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-elevated);
  color: var(--fg-secondary);
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--sans);
}
.status-select:focus { outline: 1px solid var(--accent); }
.milestone-pill {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--fg-muted);
}

/* ─── Flash messages ─── */
.flash {
  padding: 0.75rem 1rem;
  border-radius: 4px;
  margin-bottom: var(--space-md);
  font-size: 0.9rem;
  font-weight: 500;
}
.flash-success { background: rgba(50,180,100,0.12); color: #4cd48a; border: 1px solid rgba(50,180,100,0.2); }
.flash-error   { background: rgba(220,80,40,0.12);  color: #e86040; border: 1px solid rgba(220,80,40,0.2); }

/* ─── Client header ─── */
.client-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-md);
  gap: 1rem;
}
.client-header-meta {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* ─── Meta cards ─── */
.meta-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin: var(--space-md) 0;
}
.meta-card {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-elevated);
  border-radius: 8px;
  padding: var(--space-md);
}
.meta-value {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 0.5rem;
  color: var(--fg-primary);
}
.progress-bar-wrap {
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ─── Notes ─── */
.notes-block {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-elevated);
  border-radius: 8px;
  padding: var(--space-md);
  margin: var(--space-md) 0;
}

/* ─── Milestones ─── */
.milestones-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--bg-elevated);
  border-radius: 8px;
  overflow: hidden;
}
.milestone-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--bg-elevated);
  transition: background 0.15s;
}
.milestone-item:last-child { border-bottom: none; }
.milestone-item:hover { background: var(--accent-subtle); }
.milestone-done .milestone-title { text-decoration: line-through; color: var(--fg-muted); }
.milestone-toggle-form { flex-shrink: 0; }
.milestone-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--bg-elevated);
  border-radius: 4px;
  background: var(--bg-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-size: 0.75rem;
  color: var(--accent);
}
.milestone-done .milestone-checkbox {
  background: var(--accent-subtle);
  border-color: var(--accent);
}
.milestone-checkbox:hover { border-color: var(--accent); }
.milestone-body { flex: 1; min-width: 0; }
.milestone-title { font-size: 0.95rem; font-weight: 500; }
.milestone-desc { font-size: 0.85rem; margin-top: 2px; }
.milestone-meta { font-size: 0.75rem; margin-top: 4px; }
.milestone-delete-form { flex-shrink: 0; }
.add-milestone-section {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-secondary);
  border: 1px solid var(--bg-elevated);
  border-radius: 8px;
}
.add-milestone-section .section-subtitle { margin-bottom: var(--space-sm); }

/* ─── Forms ─── */
.detail-form { display: flex; flex-direction: column; gap: var(--space-md); }
.form-section {
  background: var(--bg-secondary);
  border: 1px solid var(--bg-elevated);
  border-radius: 8px;
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.form-group { display: flex; flex-direction: column; gap: 0.375rem; }
.form-label { font-size: 0.85rem; font-weight: 500; color: var(--fg-secondary); }
.required { color: var(--accent); }
.form-input {
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 4px;
  color: var(--fg-primary);
  font-size: 0.95rem;
  font-family: var(--sans);
  padding: 0.6rem 0.75rem;
  transition: border-color 0.2s;
  width: 100%;
}
.form-input:focus { outline: none; border-color: var(--accent); }
.form-input::placeholder { color: var(--fg-muted); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-row { display: flex; gap: var(--space-sm); align-items: center; }
.form-row .form-input { min-width: 0; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
.form-actions { display: flex; justify-content: flex-end; gap: var(--space-sm); padding-top: var(--space-sm); }
.status-radio-group { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.25rem; }
.status-radio-label { display: flex; align-items: center; gap: 0.4rem; cursor: pointer; }
.status-radio-label input { display: none; }
.status-radio-label:has(input:checked) .badge { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ─── Empty state ─── */
.empty-state {
  padding: var(--space-lg);
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.95rem;
}
.empty-state a { color: var(--accent); }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .meta-cards { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .client-header { flex-direction: column; }
  .detail-pipeline { flex-wrap: wrap; gap: 0.5rem; }
  .dp-connector { display: none; }
  .form-row { flex-direction: column; }
  .pipeline-bar { gap: 0.5rem; }
}
