/* ========================================
   DBPA Auditor — Application Styles
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --accent: #0f172a;
  --accent-light: rgba(15, 23, 42, 0.05);
  --brand: #3b82f6;
  --brand-light: rgba(59, 130, 246, 0.08);
  --brand-dark: #2563eb;
  --green: #22c55e;
  --green-light: rgba(34, 197, 94, 0.08);
  --green-bg: rgba(34, 197, 94, 0.12);
  --amber: #f59e0b;
  --amber-light: rgba(245, 158, 11, 0.08);
  --amber-bg: rgba(245, 158, 11, 0.12);
  --red: #ef4444;
  --red-light: rgba(239, 68, 68, 0.08);
  --red-bg: rgba(239, 68, 68, 0.12);
  --gray: #94a3b8;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.03);
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ─────────────────────────────── */
.app-header {
  background: var(--accent);
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
}
.app-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--brand);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
}
.app-logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.app-logo-text span { opacity: 0.5; font-weight: 400; margin-left: 4px; }
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Dev switcher — remove before production */
.dev-switcher {
  display: flex; gap: 2px; background: rgba(255,255,255,0.08);
  border-radius: 6px; padding: 2px; margin-right: 8px;
}
.dev-tab {
  font-size: 11px; font-weight: 600; padding: 4px 10px;
  border-radius: 4px; color: rgba(255,255,255,0.5);
  text-decoration: none; transition: all 0.15s;
}
.dev-tab:hover { color: rgba(255,255,255,0.8); }
.dev-tab.active { background: rgba(255,255,255,0.15); color: #fff; }

/* ── Tab Navigation ─────────────────────── */
.tab-bar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  padding: 0 24px;
  gap: 0;
  overflow-x: auto;
}
.tab-btn {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}
.tab-btn .tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.tab-dot.green { background: var(--green); }
.tab-dot.amber { background: var(--amber); }
.tab-dot.red { background: var(--red); }
.tab-dot.gray { background: var(--gray); }

/* ── Pro badge on tab ────────────────── */
.pro-badge {
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  line-height: 16px;
}

/* ── Plan badge in user menu ─────────── */
.plan-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
}
.plan-badge.plan-free {
  background: #f1f5f9;
  color: #64748b;
}
.plan-badge.plan-pro {
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  color: white;
}

/* ── Main Content ──────────────────────── */
.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}
.module-panel { display: none; }
.module-panel.active { display: block; }
/* Full-bleed: break out of .app-main max-width constraint */
#panel-projects.active {
  display: block;
  width: 100vw;
  margin-left: calc(-50vw + 50%);
  margin-top: -24px;
  margin-bottom: -24px;
  padding: 0;
}
#panel-projects .dcd-layout { min-height: calc(100vh - 110px); }

/* ── Cards ─────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title svg { width: 18px; height: 18px; stroke: var(--brand); }
.card-body { padding: 20px; }
.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Forms ──────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Buttons ───────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: var(--accent-light); color: var(--text); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-success { background: var(--green-light); color: #16a34a; }
.btn-success:hover { background: var(--green-bg); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-ghost { background: none; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--accent-light); color: var(--text); }
.btn-outline { background: none; border: 1px solid var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--text-secondary); color: var(--text); }

/* ── Status Pills ──────────────────────── */
.status-pills {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.status-pill {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.status-pill:hover { border-color: var(--text-muted); }
.status-pill.active-compliant { background: var(--green-bg); color: #16a34a; border-color: var(--green); }
.status-pill.active-partial { background: var(--amber-bg); color: #d97706; border-color: var(--amber); }
.status-pill.active-non-compliant { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.status-pill.active-na { background: var(--accent-light); color: var(--text-muted); border-color: var(--gray); }

/* ── Traffic Lights ────────────────────── */
.traffic-light {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}
.traffic-light.green { background: var(--green); }
.traffic-light.amber { background: var(--amber); }
.traffic-light.red { background: var(--red); }
.traffic-light.gray { background: #cbd5e1; }

/* ── Score Circle ──────────────────────── */
.score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 6px solid var(--border);
  margin: 0 auto 16px;
}
.score-circle.green { border-color: var(--green); }
.score-circle.amber { border-color: var(--amber); }
.score-circle.red { border-color: var(--red); }
.score-value { font-size: 36px; font-weight: 800; letter-spacing: -1px; }
.score-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

/* ── Tables ────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  vertical-align: top;
}
.data-table tr:hover td { background: var(--accent-light); }
.data-table .col-actions { text-align: right; white-space: nowrap; }

/* ── Tags ──────────────────────────────── */
.tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 4px;
  background: var(--accent-light);
  color: var(--text-secondary);
}
.tag-critical { background: var(--red-bg); color: var(--red); }
.tag-ref { background: var(--brand-light); color: var(--brand); }
.tag-type { background: var(--amber-bg); color: #92400e; }

/* ── Progress Bar ──────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s;
}
.progress-fill.green { background: var(--green); }
.progress-fill.amber { background: var(--amber); }
.progress-fill.red { background: var(--red); }
.progress-fill.brand { background: var(--brand); }

/* ── Checklist Item ────────────────────── */
.checklist-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  background: var(--bg-card);
  overflow: hidden;
}
.checklist-item-header {
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
}
.checklist-item-header:hover { background: var(--accent-light); }
.checklist-item-text {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}
.checklist-item-badges {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.checklist-item-body {
  padding: 0 18px 18px;
  display: none;
}
.checklist-item.expanded .checklist-item-body { display: block; }
.guidance-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 14px;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--brand);
}

/* ── Evidence / Attachments ────────────── */
.evidence-area { margin-top: 12px; }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}
.drop-zone:hover {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand);
}
.drop-zone.drop-active {
  border-color: var(--brand);
  background: rgba(59, 130, 246, 0.08);
  color: var(--brand);
  transform: scale(1.01);
}
.drop-zone-text {
  font-size: 14px;
  font-weight: 600;
}
.drop-zone-hint {
  font-size: 12px;
  opacity: 0.7;
}
.drop-zone svg {
  opacity: 0.5;
}
.drop-zone:hover svg,
.drop-zone.drop-active svg {
  opacity: 1;
}

.evidence-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.evidence-list { list-style: none; }
.evidence-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-size: 13px;
}
.evidence-item .ev-icon { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.evidence-item .ev-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evidence-item .ev-size { color: var(--text-muted); font-size: 11px; }
.evidence-item .ev-remove {
  background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 2px;
}
.evidence-item .ev-remove:hover { color: var(--red); }

/* ── Link Input ────────────────────────── */
.link-input-row {
  display: none;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.link-input-row.show { display: flex; }
.link-input-row input { flex: 1; }

/* ── Empty State ───────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 13px; margin-bottom: 20px; }

/* ── Modal / Terms Gate ────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
.modal-header {
  padding: 24px 24px 0;
}
.modal-header h2 { font-size: 20px; font-weight: 700; }
.modal-body { padding: 16px 24px; font-size: 14px; color: var(--text-secondary); line-height: 1.7; }
.modal-footer { padding: 16px 24px 24px; display: flex; gap: 8px; justify-content: flex-end; }

/* Panel-style modal content (used by projects module) */
.modal .panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal .panel-header h2 { font-size: 18px; font-weight: 700; margin: 0; }
.modal .panel-body { padding: 20px 24px; }
.btn-close {
  background: none; border: none; font-size: 24px;
  color: var(--text-muted); cursor: pointer; line-height: 1; padding: 0;
}
.btn-close:hover { color: var(--text-primary); }

/* ── Section Header ────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.section-head svg { width: 24px; height: 24px; stroke: var(--brand); }
.section-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.section-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; }

/* ── Stats Row ─────────────────────────── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-card .stat-value { font-size: 28px; font-weight: 800; letter-spacing: -1px; }
.stat-card .stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }
.stat-card.green .stat-value { color: var(--green); }
.stat-card.amber .stat-value { color: var(--amber); }
.stat-card.red .stat-value { color: var(--red); }

/* ── Dashboard Grid ────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.dash-grid .card { margin-bottom: 0; }

/* ── Project Rows ────────────────────────── */
.project-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.project-row:hover { background: var(--bg); }
.project-row:last-child { border-bottom: none; }
.project-info { flex: 1; min-width: 0; }
.project-address { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.project-stats { display: flex; gap: 6px; flex-shrink: 0; }
.project-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Project drop target */
.project-drop-target { position: relative; }
.project-drop-hint {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(59, 130, 246, 0.06);
  border: 2px dashed var(--brand);
  border-radius: 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
}
.project-drop-active .project-drop-hint { display: flex; }
.project-drop-active .project-info,
.project-drop-active .project-stats,
.project-drop-active .project-actions { opacity: 0.15; }

/* Logbook project link */
.log-project-link { color: var(--brand); text-decoration: none; font-weight: 600; }
.log-project-link:hover { text-decoration: underline; }

/* ── Section Summary Card ──────────────── */
.section-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-light);
}
.section-summary:last-child { border-bottom: none; }
.section-summary .ss-info { flex: 1; }
.section-summary .ss-title { font-size: 13px; font-weight: 600; }
.section-summary .ss-counts { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.section-summary .ss-bar { width: 100px; }

/* ── Qualification Tags ────────────────── */
.qual-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.qual-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--brand-light);
  color: var(--brand);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.qual-tag .remove-qual {
  background: none; border: none; cursor: pointer; color: var(--brand);
  font-size: 14px; line-height: 1; padding: 0 0 0 4px;
}
.qual-tag .remove-qual:hover { color: var(--red); }

/* ── Profile: Read-only values ─────────── */
.form-value {
  padding: 9px 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  min-height: 38px;
}
.profile-edit-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ── Qualification Drag & Drop ─────────── */
.qual-tag[draggable] { cursor: grab; transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s; }
.qual-tag[draggable]:active { cursor: grabbing; }
.qual-tag.qual-dragging { opacity: 0.4; transform: scale(0.95); }
.qual-tag.qual-drag-over { box-shadow: 0 0 0 2px var(--brand); transform: scale(1.05); }
.qual-drag-handle {
  font-size: 11px;
  color: var(--text-muted);
  cursor: grab;
  user-select: none;
  margin-right: 2px;
  letter-spacing: -1px;
}

/* ── Toolbar ───────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar .search-input {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px 8px 34px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card) 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='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") 10px center no-repeat;
  font-family: inherit;
}
.toolbar .search-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); }
.toolbar .filter-select {
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-family: inherit;
}

/* ── Auth Error ────────────────────────── */
.auth-error {
  background: var(--red-bg);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.auth-error.hidden { display: none; }

/* ── Role Toggle ──────────────────────── */
.role-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.role-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.role-toggle-btn:hover {
  border-color: var(--brand);
  color: var(--text);
}
.role-toggle-btn.active {
  border-color: var(--brand);
  background: var(--brand-light, rgba(59,130,246,0.06));
  color: var(--brand);
}
.role-toggle-btn svg { flex-shrink: 0; }

/* ── User Menu ─────────────────────────── */
.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  color: #94a3b8;
  position: relative;
}
.user-menu-trigger:hover { background: rgba(255,255,255,0.08); }
.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.user-name {
  font-size: 13px;
  font-weight: 500;
  color: #cbd5e1;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#userMenu { position: relative; }
.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 150;
  overflow: hidden;
}
.user-dropdown.hidden { display: none; }
.user-dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
}
.user-dropdown-header strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.user-dropdown-header span {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-dropdown-divider {
  height: 1px;
  background: var(--border-light);
}
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s;
}
.user-dropdown-item:hover { background: var(--accent-light); color: var(--text); }
.user-dropdown-item svg { color: var(--text-muted); flex-shrink: 0; }

/* ── Insights ──────────────────────────── */
.insights-header {
  margin-bottom: 24px;
}
.insights-header-content h1 {
  font-size: 22px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 4px;
}
.insights-header-content p {
  font-size: 14px; color: var(--text-secondary); line-height: 1.6;
}

.insights-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 28px;
}
.insight-stat {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; text-align: center;
}
.insight-stat-value { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.insight-stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.3px; }

.insights-section { margin-bottom: 28px; }
.insights-section-title {
  font-size: 15px; font-weight: 700; margin-bottom: 12px; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.5px; font-size: 12px;
}

.insights-featured-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
.insights-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px;
}

.insight-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; text-decoration: none; color: inherit; display: block;
  transition: all 0.15s ease;
}
.insight-card:hover {
  box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: #cbd5e1;
}
.insight-card.featured {
  border-left: 3px solid var(--brand);
}
.insight-card-badge {
  display: inline-block; padding: 2px 8px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; border-radius: 4px; margin-bottom: 10px;
}
.insight-card-badge.blue { background: var(--brand-light); color: var(--brand); }
.insight-card-badge.green { background: var(--green-light); color: var(--green); }
.insight-card-badge.amber { background: var(--amber-light); color: var(--amber); }
.insight-card-badge.red { background: var(--red-light); color: var(--red); }
.insight-card-badge.purple { background: rgba(139,92,246,0.08); color: #8b5cf6; }

.insight-card h3 {
  font-size: 15px; font-weight: 700; line-height: 1.35; margin-bottom: 6px; letter-spacing: -0.2px;
}
.insight-card p {
  font-size: 13px; color: var(--text-secondary); line-height: 1.55; margin-bottom: 12px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.insight-card-footer {
  display: flex; justify-content: space-between; align-items: center;
}
.insight-read-time { font-size: 11px; color: var(--text-muted); }
.insight-read-link { font-size: 12px; font-weight: 600; color: var(--brand); }
.insight-card:hover .insight-read-link { text-decoration: underline; }

.insights-cta {
  background: var(--accent); color: #fff; border-radius: var(--radius-lg); padding: 28px;
  text-align: center; margin-top: 8px;
}
.insights-cta h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.insights-cta p { font-size: 13px; color: #94a3b8; margin-bottom: 16px; }

/* ── Responsive ────────────────────────── */
@media (max-width: 768px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .tab-btn { padding: 10px 14px; font-size: 12px; }
  .app-main { padding: 16px; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .insights-stats { grid-template-columns: 1fr 1fr; }
  .insights-featured-grid { grid-template-columns: 1fr; }
  .insights-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .header-actions .btn span.hide-mobile { display: none; }
  .insights-stats { grid-template-columns: 1fr 1fr; }
}

/* ========================================
   DCD Submissions Module
   ======================================== */

/* Layout — Sidebar + Main */
.dcd-layout {
  display: flex; min-height: calc(100vh - 110px);
}

/* Sidebar */
.dcd-sidebar {
  width: 280px; flex-shrink: 0;
  background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
}
.dcd-sidebar-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 16px 12px;
}
.dcd-sidebar-header h2 { font-size: 16px; font-weight: 800; margin: 0; }
.dcd-sidebar-tabs {
  display: flex; gap: 2px; padding: 0 12px 12px;
  background: transparent;
}
.dcd-stab {
  flex: 1; text-align: center; padding: 6px 0; font-size: 12px;
  font-weight: 600; border: none; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--text-muted); transition: all 0.15s;
}
.dcd-stab:hover { background: rgba(0,0,0,0.03); }
.dcd-stab.active {
  background: var(--brand); color: #fff;
}
.dcd-sidebar-list {
  flex: 1; overflow-y: auto; padding: 0 8px 12px;
}
.dcd-sidebar-empty {
  padding: 24px 12px; text-align: center; color: var(--text-muted);
  font-size: 13px;
}
.dcd-sidebar-item {
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  margin-bottom: 2px; transition: background 0.1s;
}
.dcd-sidebar-item:hover { background: rgba(0,0,0,0.03); }
.dcd-sidebar-item.selected {
  background: var(--brand-light); border-left: 3px solid var(--brand);
}
.dcd-si-name {
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  line-height: 1.3;
}
.dcd-si-meta {
  font-size: 11px; color: var(--text-muted); margin-top: 2px;
}

/* Main content */
.dcd-main {
  flex: 1; padding: 20px 28px; overflow-y: auto; min-width: 0;
}
.dcd-main-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px; gap: 16px;
}
.dcd-main-title {
  font-size: 18px; font-weight: 800; margin: 0; line-height: 1.3;
}
.dcd-main-meta {
  font-size: 12px; color: var(--text-muted); margin-top: 4px;
}
.dcd-main-actions {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.dcd-status-select {
  font-size: 12px; padding: 4px 8px; width: auto;
}

/* Empty state */
.dcd-empty {
  text-align: center; padding: 80px 20px; color: var(--text-muted);
  font-size: 14px;
}

/* Upload Bar (compact) */
.dcd-upload-bar {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px;
}
.dcd-upload-drop {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: 2px dashed var(--border); border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; transition: all 0.15s;
}
.dcd-upload-drop:hover, .dcd-upload-drop.over {
  border-color: var(--brand); color: var(--brand); background: rgba(59,130,246,0.03);
}
.dcd-table-empty-row {
  text-align: center; padding: 24px 20px !important; color: var(--text-muted);
  font-size: 13px;
}
.dcd-table-upload-row {
  padding: 8px 14px !important; border-top: 1px solid var(--border);
}
.dcd-upload-drop-inline {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 20px; border: 2px dashed var(--border); border-radius: 8px;
  font-size: 13px; color: var(--text-muted); cursor: pointer; transition: all 0.15s;
}
.dcd-upload-drop-inline:hover, .dcd-upload-drop-inline.over {
  border-color: var(--brand); color: var(--brand); background: rgba(59,130,246,0.03);
}
.dcd-upload-drop-inline strong { color: var(--brand); }
.dcd-upload-drop-inline.compact {
  padding: 10px; gap: 8px; font-size: 12px; border-width: 1.5px;
}
.dcd-action-icon {
  width: 32px; height: 32px; border-radius: 8px; display: inline-flex;
  align-items: center; justify-content: center;
}

/* DCD Form Drawer */
.dcd-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 560px;
  background: #fff; box-shadow: -4px 0 30px rgba(0,0,0,0.15);
  z-index: 200; transform: translateX(100%); transition: transform 0.3s ease;
  display: flex; flex-direction: column;
}
.dcd-drawer.open { transform: translateX(0); }
.dcd-drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg-alt); flex-shrink: 0;
}
.dcd-drawer-header strong { font-size: 14px; font-weight: 700; }
.dcd-drawer iframe {
  flex: 1; width: 100%; border: none;
}
@media (max-width: 700px) {
  .dcd-drawer { width: 100%; }
}

/* Add DCD dropdown */
.dcd-add-bar { margin-bottom: 12px; }
.dcd-add-dropdown { position: relative; display: inline-block; }
.dcd-add-menu {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12); min-width: 320px; overflow: hidden;
}
.dcd-add-dropdown.open .dcd-add-menu { display: block; }
.dcd-add-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  cursor: pointer; transition: background 0.15s; border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
.dcd-add-item:last-child { border-bottom: none; }
.dcd-add-item:hover { background: rgba(59,130,246,0.04); }
.dcd-add-item div strong { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.dcd-add-item div span { font-size: 11px; color: var(--text-muted); }

/* DCD Submissions Table */
.dcd-submissions-table {
  width: 100%; border-collapse: collapse;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; margin-bottom: 16px;
}
.dcd-submissions-table th {
  text-align: left; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: rgba(0,0,0,0.015);
}
.dcd-submissions-table td {
  padding: 10px 14px; font-size: 13px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.dcd-row { cursor: pointer; transition: background 0.1s; }
.dcd-row:hover { background: rgba(59,130,246,0.03); }
.dcd-row.expanded { background: rgba(59,130,246,0.04); }
.dcd-row-chevron { width: 30px; text-align: center; }
.dcd-row-actions { text-align: right; white-space: nowrap; }
.tag-pending { background: rgba(245,158,11,0.1); color: #b45309; }
.tag-warn { background: rgba(245,158,11,0.1); color: #b45309; cursor: help; }
.tag-error { background: rgba(239,68,68,0.1); color: #dc2626; cursor: help; }
.tag-success { background: rgba(34,197,94,0.1); color: #15803d; }

/* DCD issue chips */
.dcd-issues { display: flex; flex-wrap: wrap; gap: 4px; }
.dcd-issue-chip {
  font-size: 11px; font-weight: 500; padding: 2px 8px;
  border-radius: 4px; white-space: nowrap;
}
.tag-warn .dcd-issue-chip { background: rgba(245,158,11,0.1); color: #b45309; }
.tag-error .dcd-issue-chip { background: rgba(239,68,68,0.1); color: #dc2626; }

/* DCD completeness check grid */
.dcd-check-grid {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
}
.dcd-check-item {
  font-size: 12px; display: flex; align-items: center; gap: 5px;
  min-width: 120px;
}
.dcd-check-icon { font-weight: 700; font-size: 11px; width: 16px; text-align: center; }
.dcd-check-item.pass { color: #15803d; }
.dcd-check-item.pass .dcd-check-icon { color: #22c55e; }
.dcd-check-item.fail { color: #94a3b8; }
.dcd-check-item.fail .dcd-check-icon { color: #dc2626; }

/* DCD Detail Row (expanded) */
.dcd-detail-row { background: rgba(0,0,0,0.01); }
.dcd-detail-row td { padding: 0; border-bottom: 1px solid var(--border); }
.dcd-detail-content { padding: 16px 20px; }
.dcd-detail-section { margin-bottom: 14px; }
.dcd-detail-section:last-child { margin-bottom: 0; }
.dcd-detail-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 6px;
}
.dcd-detail-info { font-size: 13px; color: var(--text-secondary); }
.dcd-detail-empty {
  font-size: 13px; color: var(--text-muted); padding: 12px 0;
}
.dcd-detail-empty a { color: var(--brand); }
.dcd-detail-file {
  font-size: 11px; color: var(--text-muted); margin-top: 12px;
  padding-top: 10px; border-top: 1px solid var(--border);
}

/* Declaration chips in expanded view */
.dcd-dec-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.dcd-dec-chip {
  font-size: 11px; color: var(--text-secondary);
  display: inline-flex; align-items: center; gap: 4px;
}

.dcd-draw-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.dcd-draw-table th {
  text-align: left; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted); padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,0.015);
}
.dcd-draw-table td {
  padding: 8px 16px; border-bottom: 1px solid rgba(0,0,0,0.04);
  color: var(--text-primary);
}
.dcd-draw-table tr:last-child td { border-bottom: none; }
.dcd-rev {
  display: inline-block; background: var(--brand-light); color: var(--brand);
  font-weight: 700; font-size: 12px; padding: 1px 8px; border-radius: 4px;
}
.dcd-no-drawings {
  padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px;
}
.dcd-no-drawings a { color: var(--brand); }

/* Declaration badges */
.dec-badge {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px;
}
.dec-yes { background: rgba(34,197,94,0.1); color: #15803d; }
.dec-no { background: rgba(239,68,68,0.1); color: #b91c1c; }
.dec-na { background: rgba(148,163,184,0.1); color: #64748b; }

/* Consultants (collapsible) */
.dcd-consultants {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  margin-top: 16px; overflow: hidden;
}
.dcd-consultants summary {
  padding: 14px 16px; font-size: 14px; font-weight: 700;
  cursor: pointer; list-style: none;
}
.dcd-consultants summary::-webkit-details-marker { display: none; }
.dcd-consultants summary::before { content: '\25B6  '; font-size: 10px; color: var(--text-muted); }
.dcd-consultants[open] summary::before { content: '\25BC  '; }
.dcd-consultants-body { padding: 0 16px 16px; }
.dcd-consultants-empty {
  padding: 16px; text-align: center; color: var(--text-muted); font-size: 13px;
}

/* Drawing Row (in edit modal) */
.dcd-drawing-row {
  display: flex; gap: 6px; margin-bottom: 6px; align-items: center;
}
.dcd-drawing-row .form-input { font-size: 12px; padding: 6px 8px; }
.dcd-drawing-row .form-input:first-child { flex: 1; }

@media (max-width: 768px) {
  .dcd-layout { flex-direction: column; }
  .dcd-sidebar {
    width: 100%; border-right: none; border-bottom: 1px solid var(--border);
    max-height: 200px;
  }
  .dcd-main { padding: 16px; }
  .dcd-main-header { flex-direction: column; }
  .dcd-draw-table { font-size: 12px; }
  .dcd-draw-table th, .dcd-draw-table td { padding: 6px 10px; }
  .dcd-drawing-row { flex-wrap: wrap; }
}
