/* MineReady v2 — Main Stylesheet */
/* Color scheme: navy #1F3864, gold #C9A84C, blue #2E75B6, red #C0392B */

:root {
  --navy: #1F3864;
  --navy-light: #2a4a7a;
  --navy-dark: #152848;
  --gold: #C9A84C;
  --gold-light: #d4bc72;
  --gold-dark: #b8933a;
  --blue: #2E75B6;
  --blue-light: #4a8ec9;
  --red: #C0392B;
  --red-light: #e74c3c;

  --bg: #f7f8fa;
  --bg-white: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f0f2f5;

  --text-primary: #1a1a2e;
  --text-secondary: #555770;
  --text-muted: #8a8da0;
  --text-inverse: #ffffff;

  --border: #e0e3eb;
  --border-light: #eef0f5;

  --shadow-sm: 0 1px 3px rgba(31, 56, 100, 0.08);
  --shadow-md: 0 4px 12px rgba(31, 56, 100, 0.1);
  --shadow-lg: 0 8px 24px rgba(31, 56, 100, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --transition: 0.2s ease;
  --max-width: 1200px;
}

/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === NAVIGATION === */
.nav {
  background: var(--navy);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-inverse);
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
}

.nav-brand svg { flex-shrink: 0; }

.nav-brand span.gold { color: var(--gold); }

.nav-links {
  display: flex;
  gap: 6px;
  align-items: center;
}

.nav-link {
  color: rgba(255,255,255,0.8);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
}

.nav-link:hover { color: #fff; background: rgba(255,255,255,0.1); }
.nav-link.active { color: var(--gold); background: rgba(201,168,76,0.15); }

.nav-state-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.1);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: 12px;
}

/* === LAYOUT === */
.app-container { min-height: calc(100vh - 60px); }

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 24px;
}

.page-narrow { max-width: 800px; }
.page-wide { max-width: 1400px; }

/* === HOME SCREEN === */
.home-hero {
  text-align: center;
  padding: 60px 24px 40px;
  max-width: 720px;
  margin: 0 auto;
}

.home-hero h1 {
  font-size: 3rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 12px;
  line-height: 1.15;
}

.home-hero h1 span { color: var(--gold); }

.home-hero p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 22px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.home-disclaimer {
  background: #fef8e7;
  border: 1px solid #f0d97a;
  border-radius: var(--radius-md);
  padding: 12px 20px;
  font-size: 0.82rem;
  color: #6b5c10;
  line-height: 1.5;
  max-width: 640px;
  margin: 0 auto 14px;
  text-align: left;
}

.state-selector {
  margin-bottom: 40px;
}

.state-selector h3 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.state-cards {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.state-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 28px;
  cursor: pointer;
  transition: var(--transition);
  min-width: 140px;
  text-align: center;
}

.state-card:hover { border-color: var(--blue); box-shadow: var(--shadow-md); }
.state-card.selected { border-color: var(--gold); background: #fdf8ee; }
.state-card.disabled { opacity: 0.5; cursor: not-allowed; }
.state-card.disabled:hover { border-color: var(--border); box-shadow: none; }

.state-card h4 { font-size: 1.05rem; color: var(--navy); margin-bottom: 2px; }
.state-card .badge { font-size: 0.7rem; color: var(--text-muted); }
.state-card .badge.available { color: var(--gold); font-weight: 600; }

.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 640px;
  margin: 0 auto;
}

.mode-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.mode-card:hover {
  border-color: var(--navy);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.mode-card .icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 1.6rem;
}

.mode-card .icon.wizard-icon { background: #eef3fb; color: var(--blue); }
.mode-card .icon.chat-icon { background: #f0ede4; color: var(--gold-dark); }

.mode-card h3 { font-size: 1.1rem; color: var(--navy); margin-bottom: 8px; }
.mode-card p { font-size: 0.85rem; color: var(--text-secondary); }

/* === WIZARD === */
.wizard-container {
  max-width: 680px;
  margin: 0 auto;
}

.progress-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-bottom: 36px;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 4px;
}

.progress-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  border: 2px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-white);
  transition: var(--transition);
}

.progress-dot.active { border-color: var(--navy); color: var(--text-inverse); background: var(--navy); }
.progress-dot.completed { border-color: var(--gold); color: var(--text-inverse); background: var(--gold); }

.progress-line {
  width: 40px;
  height: 2px;
  background: var(--border);
  transition: var(--transition);
}

.progress-line.completed { background: var(--gold); }

.wizard-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-md);
}

.wizard-card h2 {
  font-size: 1.3rem;
  color: var(--navy);
  margin-bottom: 24px;
}

.option-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.option-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.option-card:hover { border-color: var(--blue-light); background: #f8fafd; }
.option-card.selected { border-color: var(--navy); background: #eef2f9; }

.option-card .option-icon { font-size: 1.5rem; margin-bottom: 8px; }
.option-card h4 { font-size: 0.9rem; color: var(--navy); margin-bottom: 4px; }
.option-card p { font-size: 0.75rem; color: var(--text-secondary); }

/* Form elements */
.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.form-select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-white);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23555' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.form-select:focus { border-color: var(--navy); outline: none; }

/* Slider */
.acreage-slider-container { margin: 16px 0; }

.acreage-slider {
  width: 100%;
  -webkit-appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
}

.acreage-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--navy);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.acreage-value {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
  margin-top: 8px;
}

.acreage-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.threshold-callout {
  background: #fef3e0;
  border: 1px solid #f5c542;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.82rem;
  color: #7a5a00;
  margin-top: 12px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.threshold-callout .icon { flex-shrink: 0; font-size: 1.1rem; }

/* Checkboxes */
.checkbox-group { display: flex; flex-direction: column; gap: 10px; }

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.checkbox-item:hover { border-color: var(--blue-light); }
.checkbox-item.checked { border-color: var(--navy); background: #eef2f9; }

.checkbox-item input { display: none; }

.checkbox-box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}

.checkbox-item.checked .checkbox-box {
  background: var(--navy);
  border-color: var(--navy);
  color: white;
}

.warning-callout {
  background: #fde8e8;
  border: 1px solid #e8a0a0;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 0.82rem;
  color: #8b2020;
  margin-top: 12px;
}

/* Wizard Navigation */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

/* Buttons */
.btn {
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary { background: var(--navy); color: var(--text-inverse); }
.btn-primary:hover { background: var(--navy-light); }

.btn-gold { background: var(--gold); color: var(--navy-dark); }
.btn-gold:hover { background: var(--gold-light); }

.btn-outline {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--border);
}
.btn-outline:hover { border-color: var(--navy); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { color: var(--navy); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-lg { padding: 14px 32px; font-size: 1rem; border-radius: var(--radius-md); }

/* === REVIEW SCREEN === */
.review-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.review-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.review-item:last-child { border-bottom: none; }

.review-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
}

.review-value { font-size: 0.95rem; color: var(--text-primary); text-align: right; }

.review-edit {
  font-size: 0.8rem;
  color: var(--blue);
  cursor: pointer;
  margin-left: 12px;
}

/* === REPORT === */
.report-container {
  max-width: 800px;
  margin: 0 auto;
}

.report-header {
  background: var(--navy);
  color: var(--text-inverse);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 28px 32px;
}

.report-header h1 { font-size: 1.4rem; margin-bottom: 4px; }
.report-header p { font-size: 0.85rem; opacity: 0.8; }

.report-disclaimer {
  background: #fef8e7;
  border-bottom: 1px solid #f0d97a;
  padding: 12px 32px;
  font-size: 0.78rem;
  color: #6b5c10;
}

.report-body {
  background: var(--bg-card);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.report-body h2 {
  font-size: 1.15rem;
  color: var(--navy);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--gold);
}

.report-body h2:first-child { margin-top: 0; }

.report-body h3 { font-size: 1rem; color: var(--navy-light); margin: 16px 0 8px; }
.report-body p { margin-bottom: 12px; color: var(--text-primary); }
.report-body ul, .report-body ol { margin: 8px 0 16px 20px; }
.report-body li { margin-bottom: 6px; }
.report-body strong { color: var(--navy); }

.report-body code {
  background: #eef2f9;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.85em;
}

.report-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

/* === LOADING STATE === */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 20px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-message {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.loading-submessage {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* === CHAT INTERFACE === */
.chat-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.chat-header h2 { font-size: 1.1rem; color: var(--navy); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-message {
  display: flex;
  gap: 12px;
  max-width: 85%;
}

.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message.assistant { align-self: flex-start; }

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-message.user .chat-avatar { background: var(--navy); color: var(--text-inverse); }
.chat-message.assistant .chat-avatar { background: var(--gold); color: var(--navy-dark); }

.chat-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  line-height: 1.6;
}

.chat-message.user .chat-bubble {
  background: var(--navy);
  color: var(--text-inverse);
  border-bottom-right-radius: 4px;
}

.chat-message.assistant .chat-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-bubble h2 { font-size: 1rem; color: var(--navy); margin: 12px 0 6px; }
.chat-bubble h3 { font-size: 0.95rem; color: var(--navy-light); margin: 10px 0 4px; }
.chat-bubble p { margin-bottom: 8px; }
.chat-bubble ul, .chat-bubble ol { margin: 4px 0 8px 16px; }
.chat-bubble li { margin-bottom: 4px; }
.chat-bubble strong { color: var(--navy); }

.chat-bubble-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
}

.chat-bubble-action {
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  background: none;
  border: none;
}
.chat-bubble-action:hover { color: var(--navy); background: var(--bg-hover); }

.chat-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
}

.chat-chip {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--navy);
  cursor: pointer;
  background: var(--bg-white);
  transition: var(--transition);
}

.chat-chip:hover { border-color: var(--navy); background: #eef2f9; }

.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typing 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

.chat-input-container {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  resize: none;
  font-family: inherit;
  line-height: 1.4;
  max-height: 120px;
}

.chat-input:focus { border-color: var(--navy); outline: none; }

.chat-send {
  padding: 12px 20px;
  background: var(--navy);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
  align-self: flex-end;
}

.chat-send:hover { background: var(--navy-light); }
.chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

.chat-disclaimer {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  padding-top: 8px;
}

/* === HELP BUTTON (FLOATING) === */
.help-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy-dark);
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  z-index: 200;
  transition: var(--transition);
}

.help-button:hover { transform: scale(1.08); background: var(--gold-light); }

.help-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: 400px;
  max-height: 520px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border);
}

.help-panel-header {
  background: var(--navy);
  color: var(--text-inverse);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.help-panel-header h3 { font-size: 0.95rem; }

.help-panel-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px;
}
.help-panel-close:hover { color: #fff; }

.help-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
}

.help-panel-input {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border-light);
}

.help-panel-input input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.help-panel-input input:focus { border-color: var(--navy); outline: none; }

/* === FLOWCHART TAB === */
.flowchart-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.flowchart-container h2 {
  font-size: 1.2rem;
  color: var(--navy);
  margin-bottom: 20px;
}

.flow-phase {
  margin-bottom: 28px;
}

.flow-phase-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.flow-phase-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.flow-phase-title { font-size: 1rem; font-weight: 700; color: var(--navy); }
.flow-phase-time { font-size: 0.8rem; color: var(--text-muted); }

.flow-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-left: 38px;
}

.flow-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.82rem;
}

.flow-item .agency { color: var(--blue); font-weight: 600; font-size: 0.75rem; }
.flow-item .permit-name { color: var(--text-primary); margin-top: 2px; }

.flow-connector {
  width: 2px;
  height: 20px;
  background: var(--border);
  margin: 0 0 0 13px;
}

/* === BROWSE/SEARCH TAB === */
.browse-container { max-width: 900px; margin: 0 auto; }

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.search-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
}

.search-input:focus { border-color: var(--navy); outline: none; }

.filter-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  cursor: pointer;
  background: var(--bg-white);
  color: var(--text-secondary);
  transition: var(--transition);
}

.filter-tab:hover { border-color: var(--navy); }
.filter-tab.active { background: var(--navy); color: var(--text-inverse); border-color: var(--navy); }

.permit-list { display: flex; flex-direction: column; gap: 10px; }

.permit-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  transition: var(--transition);
}

.permit-card:hover { box-shadow: var(--shadow-sm); }

.permit-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}

.permit-card h4 { font-size: 0.95rem; color: var(--navy); }

.permit-badge {
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.permit-badge.federal { background: #eef3fb; color: var(--blue); }
.permit-badge.state { background: #f0ede4; color: var(--gold-dark); }
.permit-badge.county { background: #e8f5e8; color: #2e7d32; }

.permit-card .agency { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.permit-card .trigger { font-size: 0.85rem; color: var(--text-secondary); }
.permit-card .regulation { font-size: 0.78rem; color: var(--blue); margin-top: 4px; }
.permit-card .timeline-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  background: #f7f8fa;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .nav { padding: 0 16px; }
  .nav-links { display: none; }
  .mode-cards { grid-template-columns: 1fr; }
  .option-cards { grid-template-columns: 1fr; }
  .flow-items { grid-template-columns: 1fr; }
  .home-hero h1 { font-size: 2.4rem; }
  .wizard-card { padding: 24px 20px; }
  .help-panel { width: calc(100vw - 48px); right: 24px; }
  .chat-container { height: calc(100vh - 100px); }
  .report-body { padding: 20px; }
}

/* ============================================================
   PREMIUM REPORT STYLES
   ============================================================ */

/* Page */
.rpt-page { max-width: 960px; }

/* Section 1 — Summary Bar */
.rpt-summary-bar {
  background: var(--navy);
  color: var(--gold);
  padding: 18px 28px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.rpt-summary-text { font-size: 0.95rem; font-weight: 600; line-height: 1.4; }
.rpt-summary-date { font-size: 0.78rem; opacity: 0.7; color: #fff; white-space: nowrap; }

/* Report card (shared wrapper) */
.rpt-card {
  background: var(--bg-card);
  padding: 28px 28px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.rpt-card + .rpt-card { border-top: 1px solid var(--border-light); }
.rpt-section-title {
  font-size: 1.15rem;
  color: var(--navy);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--gold);
}

/* Section 2 — Flowchart */
.rpt-flowchart-wrap { position: relative; }
.rpt-flowchart-scroll { overflow-x: auto; padding-bottom: 8px; }
.rpt-flowchart-svg { display: block; min-width: 100%; }
.rpt-flowchart-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.rpt-fc-phase-label { font-weight: 700; }

/* Flowchart tooltip */
.rpt-fc-tooltip {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  z-index: 50;
  max-width: 360px;
  width: max-content;
  pointer-events: none;
}
.rpt-fc-tooltip-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 4px; }
.rpt-fc-tooltip-agency { color: var(--gold-light); font-size: 0.78rem; margin-bottom: 8px; }
.rpt-fc-tooltip-row { margin-bottom: 3px; }
.rpt-fc-tooltip-row strong { color: var(--gold); }

/* Flowchart legend */
.rpt-fc-legend {
  display: flex;
  gap: 20px;
  padding-top: 14px;
  justify-content: center;
}
.rpt-fc-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}
.rpt-fc-legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

/* Section 3 — Permit Sequence Table */
.rpt-sequence { padding-top: 4px; }
.rpt-seq-phase { margin-bottom: 20px; }
.rpt-seq-phase:last-child { margin-bottom: 0; }

.rpt-seq-phase-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.rpt-seq-phase-num {
  background: var(--navy);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.rpt-seq-phase-name { font-weight: 700; font-size: 0.95rem; color: var(--navy); }
.rpt-seq-phase-desc { font-size: 0.8rem; color: var(--text-muted); }

.rpt-seq-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 8px;
}
.rpt-seq-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.rpt-seq-permit-name { font-weight: 700; font-size: 0.9rem; color: var(--navy); }
.rpt-seq-permit-id { font-size: 0.75rem; color: var(--text-muted); font-family: monospace; }

.rpt-seq-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  flex-shrink: 0;
}
.rpt-seq-badge.start { background: #e8f5e9; color: #2e7d32; }
.rpt-seq-badge.parallel { background: #e3f2fd; color: #1565c0; }
.rpt-seq-badge.sequential { background: #fff3e0; color: #e65100; }

.rpt-seq-card-details {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  font-size: 0.8rem;
}
.rpt-seq-detail-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-weight: 600;
  margin-bottom: 2px;
}

/* Section 4 — Warnings */
.rpt-warnings {
  background: #fefaf0;
  border-left: 4px solid var(--gold);
  border-right: 1px solid var(--border);
  padding: 24px 28px;
}
.rpt-warnings-title {
  font-size: 1.05rem;
  color: var(--navy);
  margin-bottom: 14px;
  font-weight: 700;
}
.rpt-warning-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  font-size: 0.88rem;
  color: var(--text-primary);
  line-height: 1.5;
}
.rpt-warning-item + .rpt-warning-item { border-top: 1px solid #f0e6c8; }
.rpt-warning-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

/* Section 5 — Next Step */
.rpt-nextstep {
  background: var(--navy);
  color: var(--gold);
  padding: 28px;
  border-left: 1px solid var(--navy);
  border-right: 1px solid var(--navy);
}
.rpt-nextstep-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--gold);
}
.rpt-nextstep p {
  font-size: 0.92rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.92);
}

/* Full Analysis (expandable) */
.rpt-full-analysis { border-top: 1px solid var(--border-light); }
.rpt-analysis-body { font-size: 0.88rem; line-height: 1.7; color: var(--text-primary); }
.rpt-analysis-body h1, .rpt-analysis-body h2 {
  font-size: 1.05rem;
  color: var(--navy);
  margin: 20px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-light);
}
.rpt-analysis-body h2:first-child { margin-top: 0; }
.rpt-analysis-body h3 { font-size: 0.95rem; color: var(--navy-light); margin: 14px 0 6px; }
.rpt-analysis-body p { margin-bottom: 10px; }
.rpt-analysis-body ul, .rpt-analysis-body ol { margin: 6px 0 12px 18px; }
.rpt-analysis-body li { margin-bottom: 4px; }
.rpt-analysis-body strong { color: var(--navy); }
.rpt-analysis-body code {
  background: #eef2f9;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.84em;
}

/* Section 6 — Disclaimer */
.rpt-disclaimer {
  background: var(--bg);
  padding: 16px 28px;
  font-size: 0.76rem;
  color: var(--text-muted);
  line-height: 1.5;
  border: 1px solid var(--border);
  border-top: none;
}

/* Section 7 — Action Buttons */
.rpt-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  padding: 28px 0;
  flex-wrap: wrap;
}
.rpt-pdf-btn-wrap { position: relative; text-align: center; }
.rpt-pdf-tip {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Loading State */
.rpt-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  min-height: 50vh;
}
.rpt-loading-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}
.rpt-loading-brand {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--navy);
}
.rpt-loading-brand span { color: var(--gold); }
.rpt-loading-bar-track {
  width: 320px;
  max-width: 80vw;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 24px;
}
.rpt-loading-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--navy), var(--gold));
  border-radius: 3px;
  transition: width 0.3s ease;
}
.rpt-loading-msg {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  min-height: 1.4em;
}
.rpt-loading-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Error State */
.rpt-error {
  text-align: center;
  padding: 60px 24px;
  max-width: 520px;
  margin: 0 auto;
}
.rpt-error-icon {
  font-size: 2.4rem;
  margin-bottom: 16px;
}
.rpt-error h2 {
  font-size: 1.15rem;
  color: var(--navy);
  margin-bottom: 12px;
}
.rpt-error-detail {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.rpt-error-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ============================================================
   RESPONSIVE — REPORT
   ============================================================ */
@media (max-width: 900px) {
  .rpt-seq-card-details { grid-template-columns: 1fr; }
  .rpt-summary-bar { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 600px) {
  .rpt-card { padding: 18px 16px; }
  .rpt-summary-bar { padding: 14px 16px; }
  .rpt-warnings { padding: 18px 16px; }
  .rpt-nextstep { padding: 20px 16px; }
  .rpt-disclaimer { padding: 12px 16px; }
  .rpt-fc-legend { flex-direction: column; align-items: flex-start; gap: 6px; }
  .rpt-actions { flex-direction: column; align-items: stretch; }
  .rpt-actions .btn { justify-content: center; }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  /* Hide non-report elements */
  .nav, .help-button, .help-panel, .no-print,
  .rpt-actions, .chat-input-container,
  .report-actions { display: none !important; }

  /* Reset page layout */
  body { background: #fff; }
  .app-container { min-height: auto; }
  .page, .rpt-page { max-width: 100%; padding: 0; margin: 0; }

  /* Page margins */
  @page {
    size: letter;
    margin: 0.75in;
  }

  /* Branded header/footer on each page */
  @page {
    @top-left { content: "MineReady"; font-size: 9pt; color: #1F3864; }
    @top-right { content: "Confidential \2014 Decision Support Only"; font-size: 8pt; color: #8a8da0; }
    @bottom-center { content: "Page " counter(page) " of " counter(pages); font-size: 8pt; color: #8a8da0; }
  }

  /* Cards print flat */
  .rpt-card { border: none; box-shadow: none; padding: 16px 0; }
  .rpt-summary-bar {
    border-radius: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .rpt-nextstep {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .rpt-warnings {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Flowchart prints at full width */
  .rpt-flowchart-scroll { overflow: visible; }
  .rpt-flowchart-svg { width: 100%; height: auto; }
  .rpt-fc-tooltip { display: none !important; }

  /* Avoid breaks inside cards */
  .rpt-seq-card { break-inside: avoid; page-break-inside: avoid; }
  .rpt-seq-phase { break-inside: avoid; page-break-inside: avoid; }
  .rpt-warning-item { break-inside: avoid; }

  /* Disclaimer visible in print */
  .rpt-disclaimer { border: none; padding: 12px 0; margin-top: 16px; }

  /* Ensure colors print */
  .rpt-seq-badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .rpt-seq-phase-num {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .rpt-fc-legend-dot {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
