/**
 * Rule 219 Exemption Analyzer - Unified Intake UI Styles
 * Path: /static/css/ext_ui/unified_intake.css
 * 
 * Envera Consulting - Light Theme
 */

 :root {
  /* Envera brand colors */
  --envera-green: #76A642;
  --envera-green-dark: #5e8c32;
  --envera-green-light: #8ab856;
  --envera-green-dim: rgba(118, 166, 66, 0.12);
  --envera-green-subtle: rgba(118, 166, 66, 0.06);
  
  /* Light theme base */
  --bg-base: #ffffff;
  --bg-elevated: #f5f7f9;
  --bg-surface: #ffffff;
  --bg-hover: #ebedf0;
  --bg-chat: #f0f2f4;
  
  --border-subtle: rgba(0, 0, 0, 0.06);
  --border-default: rgba(0, 0, 0, 0.1);
  --border-strong: rgba(0, 0, 0, 0.15);
  
  --text-primary: #1a1d21;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  --text-muted: #9ca3af;
  
  /* Semantic colors */
  --accent-green: #059669;
  --accent-green-dim: rgba(5, 150, 105, 0.12);
  --accent-amber: #d97706;
  --accent-amber-dim: rgba(217, 119, 6, 0.12);
  --accent-red: #dc2626;
  --accent-red-dim: rgba(220, 38, 38, 0.1);
  --accent-blue: #3b82f6;
  --accent-blue-dim: rgba(59, 130, 246, 0.1);
  
  /* Thinking state - use Envera green */
  --thinking-bg: linear-gradient(135deg, rgba(118, 166, 66, 0.06), rgba(94, 140, 50, 0.1));
  --thinking-border: rgba(118, 166, 66, 0.3);
  
  --font-sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Subtle background gradient */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(ellipse at 20% 0%, rgba(118, 166, 66, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(94, 140, 50, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.logo {
  height: 30px;
  opacity: 1;
}

.header-text {
  flex: 1;
  min-width: 200px;
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.01em;
}

.header-sub {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.header-chip {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--envera-green-dim);
  color: var(--envera-green);
  font-size: 0.72rem;
  font-weight: 500;
  border: 1px solid rgba(118, 166, 66, 0.2);
}

/* Chat panel */
.chat-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-default);
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-icon {
  width: 36px;
  height: 36px;
  background: var(--envera-green-dim);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.chat-title {
  font-weight: 600;
  font-size: 15px;
}

.chat-meta {
  font-size: 12px;
  color: var(--text-tertiary);
}

.status-chip {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-surface);
  color: var(--text-tertiary);
  border: 1px solid var(--border-subtle);
}

.status-chip.active {
  background: var(--envera-green-dim);
  color: var(--envera-green);
  border-color: rgba(118, 166, 66, 0.25);
}

.status-chip.complete {
  background: var(--accent-green-dim);
  color: var(--accent-green);
  border-color: rgba(16, 185, 129, 0.25);
}

.status-chip.error {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.25);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-chip.active .status-dot {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.9); }
}

.sample-btn {
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sample-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Chat messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 380px;
  max-height: 55vh;
  background: var(--bg-chat);
}

.msg {
  display: flex;
  gap: 12px;
  animation: msgIn 0.3s ease;
}

.msg.user {
  flex-direction: row-reverse;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.msg.assistant .avatar {
  background: var(--envera-green-dim);
  color: var(--envera-green);
}

.msg.user .avatar {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.msg-body {
  max-width: 85%;
}

.msg-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.msg.user .msg-label {
  text-align: right;
}

.bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.55;
}

.msg.assistant .bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.msg.user .bubble {
  background: var(--envera-green);
  color: white;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 12px;
  animation: msgIn 0.3s ease;
}

.typing-indicator .avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--envera-green-dim);
  color: var(--envera-green);
}

.typing-bubble {
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--envera-green);
  border-radius: 50%;
  animation: typingBounce 1.4s ease-in-out infinite;
}

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

@keyframes typingBounce {
  0%, 60%, 100% { 
    transform: translateY(0); 
    opacity: 0.4;
  }
  30% { 
    transform: translateY(-8px); 
    opacity: 1;
  }
}

/* Thinking box */
.thinking-box {
  background: var(--thinking-bg);
  border: 1px solid var(--thinking-border);
  border-radius: 12px;
  padding: 14px 16px;
}

.thinking-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(118, 166, 66, 0.15);
}

.thinking-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--envera-green);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.thinking-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--envera-green);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.thinking-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.thinking-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  opacity: 0;
  animation: stepIn 0.3s ease forwards;
  flex-wrap: wrap;
}

@keyframes stepIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.step-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  background: var(--bg-hover);
  color: var(--text-muted);
  flex-shrink: 0;
}

.thinking-step.active .step-icon {
  background: var(--accent-amber-dim);
  color: var(--accent-amber);
}

.thinking-step.done .step-icon {
  background: var(--accent-green-dim);
  color: var(--accent-green);
}

.thinking-step.done {
  color: var(--text-primary);
}

.thinking-step.error .step-icon {
  background: var(--accent-red-dim);
  color: var(--accent-red);
}

/* Step detail - shows subgroup/subclass badges under steps */
.step-detail {
  width: 100%;
  margin-left: 28px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Badge for subgroup/subclass names */
.detail-badge {
  display: inline-block;
  padding: 3px 10px;
  background: var(--accent-blue-dim);
  color: var(--accent-blue);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Confidence percentage */
.detail-conf {
  font-size: 11px;
  color: var(--accent-green);
  font-weight: 600;
  padding: 2px 6px;
  background: var(--accent-green-dim);
  border-radius: 4px;
}

/* Note text (e.g., "→ narrowing...") */
.detail-note {
  font-size: 11px;
  color: var(--text-tertiary);
  font-style: italic;
}

/* Thinking result badge */
.thinking-result {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--accent-green-dim);
  border: 1px solid rgba(5, 150, 105, 0.25);
  border-radius: 8px;
}

.thinking-result.error {
  background: var(--accent-red-dim);
  border-color: rgba(220, 38, 38, 0.2);
}

.thinking-result-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-green);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.thinking-result.error .thinking-result-label {
  color: var(--accent-red);
}

.thinking-result-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

/* Finalized thinking box (after processing completes) */
.thinking-box.finalized {
  padding: 0;
  background: transparent;
  border: none;
}

.thinking-box.finalized .thinking-result {
  margin-top: 0;
}

/* Question styling */
.question-num {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}

.question-text {
  font-weight: 500;
  color: var(--text-primary);
}

/* Final result */
.result-box {
  padding: 14px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.result-box.exempt {
  background: var(--accent-green-dim);
  border: 1px solid rgba(5, 150, 105, 0.25);
}

.result-box.not-exempt {
  background: var(--accent-red-dim);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.result-box.uncertain {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.result-status {
  font-weight: 700;
  font-size: 15px;
}

.result-box.exempt .result-status {
  color: var(--accent-green);
}

.result-box.not-exempt .result-status {
  color: var(--accent-red);
}

.result-box.uncertain .result-status {
  color: rgb(245, 158, 11);
}

.result-citation {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* =========================================================================
   Documentation Requirement Note (219(f)(1) for exempt results)
   ========================================================================= */

.doc-requirement {
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  margin: 12px 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Input area */
.input-area {
  padding: 16px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}

.input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

textarea {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  min-height: 48px;
  max-height: 120px;
  transition: border-color 0.2s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--envera-green);
}

textarea::placeholder {
  color: var(--text-muted);
}

.send-btn {
  padding: 12px 22px;
  background: var(--envera-green);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.send-btn:hover:not(:disabled) {
  background: var(--envera-green-dark);
  transform: translateY(-1px);
}

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

.send-btn svg {
  width: 16px;
  height: 16px;
}

/* Disclaimer */
.disclaimer {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--accent-amber-dim);
  border: 1px solid rgba(217, 119, 6, 0.2);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.disclaimer strong {
  color: var(--accent-amber);
}

.disclaimer a {
  color: var(--accent-amber);
  text-decoration: underline;
}

/* Footer */
.footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 8px;
}

.footer a {
  color: var(--text-tertiary);
  text-decoration: none;
}

.footer a:hover {
  color: var(--envera-green);
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* =========================================================================
   NEW: Feedback Inline (appears below result box)
   ========================================================================= */

.feedback-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
}

.feedback-inline.visible {
  opacity: 1;
  transform: translateY(0);
}

.feedback-inline-label {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 500;
}

.feedback-inline-buttons {
  display: flex;
  gap: 6px;
}

.feedback-btn-mini {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.feedback-btn-mini:hover {
  background: var(--bg-hover);
  transform: scale(1.1);
}

.feedback-btn-mini.selected.positive {
  background: var(--accent-green-dim);
  border-color: var(--accent-green);
}

.feedback-btn-mini.selected.negative {
  background: var(--accent-red-dim);
  border-color: var(--accent-red);
}

.feedback-inline-thanks {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-green);
}

.feedback-inline-thanks.active {
  display: flex;
}

/* =========================================================================
   NEW: Feedback Expanded (text area)
   ========================================================================= */

.feedback-expanded {
  display: none;
  padding: 14px;
  margin: 12px 0;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  animation: feedbackSlideDown 0.3s ease;
}

.feedback-expanded.active {
  display: block;
}

@keyframes feedbackSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.feedback-expanded-header {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.feedback-textarea {
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  background: var(--bg-surface);
  color: var(--text-primary);
}

.feedback-textarea:focus {
  outline: none;
  border-color: var(--envera-green);
  box-shadow: 0 0 0 3px var(--envera-green-dim);
}

.feedback-textarea::placeholder {
  color: var(--text-muted);
}

.feedback-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.feedback-skip {
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.feedback-skip:hover {
  background: var(--bg-hover);
}

.feedback-submit {
  padding: 8px 14px;
  background: var(--envera-green);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.feedback-submit:hover {
  background: var(--envera-green-dark);
}

/* =========================================================================
   NEW: CTA Container
   ========================================================================= */

.cta-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border-default);
}

.cta-container.visible {
  opacity: 1;
  transform: translateY(0);
}

.cta-text {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--envera-green);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(118, 166, 66, 0.3);
  transition: all 0.2s ease;
}

.cta-btn:hover {
  background: var(--envera-green-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(118, 166, 66, 0.35);
}

.cta-btn svg {
  width: 16px;
  height: 16px;
}

/* =========================================================================
   NEW: Contact Modal
   ========================================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 90%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.modal-close {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg-elevated);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-form-group {
  margin-bottom: 14px;
}

.modal-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.modal-label .required {
  color: var(--accent-red);
}

.modal-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal-input:focus {
  outline: none;
  border-color: var(--envera-green);
  box-shadow: 0 0 0 3px var(--envera-green-dim);
}

.modal-input::placeholder {
  color: var(--text-muted);
}

textarea.modal-input {
  min-height: 80px;
  resize: vertical;
}

.modal-submit {
  width: 100%;
  padding: 12px 16px;
  background: var(--envera-green);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  margin-top: 16px;
}

.modal-submit:hover:not(:disabled) {
  background: var(--envera-green-dark);
}

.modal-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.modal-submit svg {
  width: 16px;
  height: 16px;
}

.modal-success {
  display: none;
  text-align: center;
  padding: 16px 0;
}

.modal-success.active {
  display: block;
}

.modal-success-icon {
  width: 56px;
  height: 56px;
  background: var(--accent-green-dim);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 24px;
  color: var(--accent-green);
}

.modal-success-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.modal-success-text {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.modal-success-btn {
  padding: 8px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-success-btn:hover {
  background: var(--bg-hover);
}

/* =========================================================================
   NEW: Disclaimer Modal Styles
   ========================================================================= */

.warning-banner {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid #f59e0b;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
}

.warning-banner-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.warning-banner-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
}

.disclaimer-text {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 16px;
  text-align: center;
}

#disclaimerModal .modal-title {
  text-align: center;
  margin-bottom: 16px;
}

.disclaimer-text a {
  color: var(--envera-green);
  text-decoration: none;
  font-weight: 500;
}

.disclaimer-text a:hover {
  text-decoration: underline;
}

/* =========================================================
   PHASE 1: Sticky Header, Drawer, FAB, Email Gate
   Appended — no existing styles removed or changed.
   ========================================================= */

/* ─── Body adjustment for sticky header ─── */
body { padding-top: 56px; }

.app { margin-top: 0; }

/* ─── Sticky Header ─── */
.app-header { position: fixed; top: 0; left: 0; right: 0; z-index: 50; height: 56px; background: var(--bg-base, #ffffff); border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.06)); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
.app-header-left { display: flex; align-items: center; gap: 12px; }
.hamburger-btn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border-default, rgba(0,0,0,0.1)); background: var(--bg-base, #fff); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .12s; }
.hamburger-btn:hover { background: var(--bg-hover, #ebedf0); }
.hamburger-lines { width: 16px; display: flex; flex-direction: column; gap: 3px; }
.hamburger-lines span { width: 100%; height: 2px; background: var(--text-primary, #1a1d21); border-radius: 1px; }
.app-header-logo { text-decoration: none; display: flex; align-items: center; }
.app-header-logo img { height: 24px; display: block; }
.app-header-logo-fallback { font-size: 14px; font-weight: 600; color: var(--envera-green-dark, #5e8c32); display: none; }
.app-header-center { position: absolute; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 999px; background: var(--bg-base, #fff); border: 1px solid var(--border-default, rgba(0,0,0,0.1)); font-size: 13px; font-weight: 500; color: var(--text-secondary, #4b5563); box-shadow: 0 1px 2px rgba(0,0,0,0.03); }
.app-header-pill-icon { width: 20px; height: 20px; border-radius: 5px; background: linear-gradient(135deg, var(--envera-green, #76A642), var(--envera-green-dark, #5e8c32)); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.app-header-pill-icon svg { width: 13px; height: 13px; }
.app-header-right { display: flex; align-items: center; gap: 8px; position: relative; }
.app-header-user-label { font-size: 12px; color: var(--text-tertiary, #6b7280); }
.user-trigger { width: 34px; height: 34px; border-radius: 50%; background: var(--envera-green, #76A642); border: none; cursor: pointer; font-size: 12px; font-weight: 600; color: #fff; display: flex; align-items: center; justify-content: center; transition: transform .12s; }
.user-trigger:hover { transform: scale(1.06); }

/* ─── User dropdown ─── */
.user-menu { position: absolute; top: calc(100% + 8px); right: 0; min-width: 200px; background: var(--bg-base, #fff); border-radius: var(--radius-md, 10px); border: 1px solid var(--border-default, rgba(0,0,0,0.1)); box-shadow: 0 12px 30px rgba(0,0,0,0.15); padding: 4px 0; z-index: 55; display: none; }
.user-menu.open { display: block; }
.user-menu-header { padding: 10px 14px; border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.06)); }
.user-menu-name { font-size: 13px; font-weight: 600; }
.user-menu-email { font-size: 11px; color: var(--text-muted, #9ca3af); }
.user-menu-item { padding: 9px 14px; font-size: 13px; color: var(--text-secondary, #4b5563); cursor: pointer; display: flex; align-items: center; gap: 8px; transition: background .1s; }
.user-menu-item:hover { background: var(--bg-hover, #ebedf0); }
.user-menu-item svg { width: 15px; height: 15px; color: var(--text-muted, #9ca3af); }
.user-menu-item span { pointer-events: none; }
.user-menu-divider { margin: 4px 0; border-top: 1px solid var(--border-subtle, rgba(0,0,0,0.06)); }
.user-menu-item--danger { color: var(--accent-red, #dc2626); }
.user-menu-item--danger svg { color: var(--accent-red, #dc2626); }

/* ─── Left Drawer ─── */
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.18); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .25s; }
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 300px; background: var(--bg-base, #fff); z-index: 61; transform: translateX(-100%); transition: transform .3s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column; box-shadow: 4px 0 20px rgba(0,0,0,0.08); }
.drawer.open { transform: translateX(0); }
.drawer-hdr { padding: 16px 20px; border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.06)); display: flex; align-items: center; justify-content: space-between; }
.drawer-title { font-size: 14px; font-weight: 600; }
.drawer-close { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border-default, rgba(0,0,0,0.1)); background: var(--bg-base, #fff); cursor: pointer; font-size: 16px; color: var(--text-tertiary, #6b7280); display: flex; align-items: center; justify-content: center; }
.drawer-section-label { padding: 14px 20px 6px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted, #9ca3af); }
.drawer-list { padding: 0 10px; }
.drawer-item { padding: 10px 12px; border-radius: 8px; cursor: pointer; transition: background .12s; margin-bottom: 2px; }
.drawer-item:hover { background: var(--bg-hover, #ebedf0); }
.drawer-item--active { background: var(--envera-green-subtle, rgba(118,166,66,0.06)); }
.drawer-item-title { font-size: 13px; font-weight: 500; color: var(--text-primary, #1a1d21); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-item-meta { font-size: 11px; color: var(--text-muted, #9ca3af); margin-top: 2px; display: flex; align-items: center; gap: 6px; }
.drawer-dot { width: 6px; height: 6px; border-radius: 50%; }
.drawer-dot--exempt { background: var(--envera-green, #76A642); }
.drawer-dot--required { background: var(--accent-red, #dc2626); }
.drawer-dot--pending { background: var(--accent-amber, #d97706); }

/* ─── Floating Action Button ─── */
.fab { position: fixed; bottom: 28px; right: 24px; width: 52px; height: 52px; border-radius: 50%; background: var(--envera-green, #76A642); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 20px rgba(118,166,66,0.35); z-index: 40; transition: all .2s; }
.fab:hover { background: var(--envera-green-dark, #5e8c32); transform: scale(1.08); box-shadow: 0 8px 28px rgba(118,166,66,0.4); }
.fab:active { transform: scale(.96); }
.fab svg { width: 24px; height: 24px; color: #fff; }
.fab-tooltip { position: fixed; bottom: 40px; right: 84px; background: var(--text-primary, #1a1d21); color: #fff; font-size: 12px; font-weight: 500; padding: 6px 12px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 40; }
.fab:hover + .fab-tooltip { opacity: 1; }

/* ─── Email Gate Overlay ─── */
.gate-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); backdrop-filter: blur(6px); z-index: 200; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .35s; }
.gate-overlay.show { opacity: 1; pointer-events: auto; }
.gate-card { background: var(--bg-base, #fff); border-radius: var(--radius-xl, 20px); padding: 36px 32px; max-width: 440px; width: calc(100% - 40px); box-shadow: 0 20px 60px rgba(0,0,0,0.15); text-align: center; transform: translateY(20px) scale(.96); transition: all .35s; }
.gate-overlay.show .gate-card { transform: translateY(0) scale(1); }
.gate-icon { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, var(--envera-green, #76A642), var(--envera-green-dark, #5e8c32)); margin: 0 auto 20px; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 20px rgba(118,166,66,0.25); }
.gate-icon svg { width: 28px; height: 28px; color: #fff; }
.gate-card h2 { font-size: 20px; font-weight: 700; margin: 0 0 6px; font-family: var(--font-sans); }
.gate-card p { font-size: 14px; color: var(--text-tertiary, #6b7280); line-height: 1.55; margin: 0 0 20px; }
.gate-input { width: 100%; padding: 12px 14px; border-radius: var(--radius-md, 10px); border: 1px solid var(--border-default, rgba(0,0,0,0.1)); font-size: 14px; font-family: var(--font-sans); outline: none; margin-bottom: 12px; transition: border-color .15s, box-shadow .15s; }
.gate-input:focus { border-color: var(--envera-green, #76A642); box-shadow: 0 0 0 3px var(--envera-green-dim, rgba(118,166,66,0.12)); }
.gate-btn { width: 100%; padding: 12px 16px; border-radius: 999px; border: none; font-size: 14px; font-weight: 600; font-family: var(--font-sans); cursor: pointer; background: var(--envera-green, #76A642); color: #fff; box-shadow: 0 8px 20px rgba(118,166,66,0.3); transition: background .15s; }
.gate-btn:hover { background: var(--envera-green-dark, #5e8c32); }
.gate-terms { font-size: 11px; color: var(--text-muted, #9ca3af); margin-top: 14px; line-height: 1.5; }
.gate-terms a { color: var(--envera-green-dark, #5e8c32); text-decoration: underline; }

/* ─── Strip card frame, chat-header, disclaimer ─── */
.chat-panel { border: none; border-radius: 0; box-shadow: none; background: transparent; }
.chat-header { display: none; }
.disclaimer { display: none; }
.chat-messages { background: transparent; }

/* ─── Verdict banner ─── */
.verdict { margin: 14px 0; border-radius: var(--radius-md, 10px); padding: 18px 20px; display: flex; align-items: flex-start; gap: 14px; }
.verdict.exempt { background: #F2F9EC; border: 1px solid #C8E6A8; }
.verdict.required { background: #FEF2F2; border: 1px solid #FECACA; }
.verdict.caution { background: #FEFCE8; border: 1px solid #FDE68A; }
.verdict-ic { width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.verdict.exempt .verdict-ic { background: var(--envera-green, #76A642); }
.verdict.required .verdict-ic { background: #C53030; }
.verdict.caution .verdict-ic { background: #A16207; }
.verdict-ic svg { width: 18px; height: 18px; color: white; }
.verdict-label { font-size: 16px; font-weight: 600; margin-bottom: 3px; }
.verdict.exempt .verdict-label { color: var(--envera-green-dark, #5e8c32); }
.verdict.required .verdict-label { color: #C53030; }
.verdict.caution .verdict-label { color: #A16207; }
.verdict-desc { font-size: 13px; color: var(--text-secondary, #4b5563); line-height: 1.5; }

/* ─── Determination summary table ─── */
.data-table { margin: 12px 0; background: var(--bg-surface, #fff); border: 1px solid var(--border-default, rgba(0,0,0,0.1)); border-radius: var(--radius-md, 10px); overflow: hidden; }
.data-table-hdr { padding: 8px 14px; background: var(--bg-elevated, #f5f7f9); border-bottom: 1px solid var(--border-subtle, rgba(0,0,0,0.06)); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted, #9ca3af); display: flex; align-items: center; justify-content: space-between; }
.data-badge { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.02em; }
.badge-green { background: #F2F9EC; color: #4A8C1F; border: 1px solid #C8E6A8; }
.badge-red { background: #FEF2F2; color: #C53030; border: 1px solid #FECACA; }
.badge-amber { background: #FEFCE8; color: #A16207; border: 1px solid #FDE68A; }
.dt-row { display: flex; padding: 8px 14px; align-items: baseline; }
.dt-row + .dt-row { border-top: 1px solid var(--border-subtle, rgba(0,0,0,0.06)); }
.dt-key { width: 120px; flex-shrink: 0; font-size: 12px; color: var(--text-muted, #9ca3af); }
.dt-val { font-size: 13px; font-weight: 500; color: var(--text-primary, #1a1d21); }
.dt-val.green { color: var(--envera-green, #76A642); }
.dt-val.amber { color: #A16207; }
.dt-val.red { color: #C53030; }

/* ─── Contact CTA card ─── */
.contact-cta { margin-top: 14px; padding: 12px 18px; border-radius: var(--radius-md, 10px); background: var(--bg-surface, #fff); border: 1px solid var(--border-default, rgba(0,0,0,0.1)); display: flex; align-items: center; gap: 12px; cursor: pointer; transition: all 180ms; }
.contact-cta:hover { border-color: var(--envera-green-dim, rgba(118,166,66,0.12)); background: var(--envera-green-subtle, rgba(118,166,66,0.06)); transform: translateY(-1px); box-shadow: 0 2px 10px rgba(118,166,66,0.08); }
.contact-cta-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--envera-green, #76A642); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.contact-cta-icon svg { width: 16px; height: 16px; color: white; }
.contact-cta-text { font-size: 13px; font-weight: 600; color: var(--text-primary, #1a1d21); }
.contact-cta-sub { font-size: 11px; color: var(--text-tertiary, #6b7280); font-weight: 400; }

/* ─── Responsive for new components ─── */
@media (max-width: 640px) {
  .app-header-user-label { display: none; }
  .app-header-center { font-size: 12px; padding: 5px 10px; }
  .drawer { width: 85%; }
}

/* ─── Send button: arrow-only, compact green square ─── */
.send-btn { padding: 0; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--envera-green, #76A642), var(--envera-green-dark, #5e8c32)); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 0; color: transparent; transition: all 150ms; }
.send-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(118,166,66,0.25); background: linear-gradient(135deg, var(--envera-green-dark, #5e8c32), var(--envera-green, #76A642)); }
.send-btn:disabled { opacity: 0.3; cursor: default; transform: none; box-shadow: none; }
.send-btn svg { width: 15px; height: 15px; color: white; }

/* ─── Composer hint below input ─── */
.composer-hint { text-align: center; margin-top: 8px; font-size: 11px; color: var(--text-muted, #9ca3af); }
.composer-hint a { color: var(--text-tertiary, #6b7280); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }

/* ─── Hide scrollbar track (remove faint right sidebar) ─── */
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; }
.chat-messages:hover::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.08); }
.chat-messages { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.chat-messages:hover { scrollbar-color: rgba(0,0,0,0.08) transparent; }

/* ─── Dialogue box shading: more pronounced green tint ─── */
.msg.assistant .bubble { background: #f3f8ee; border: 1px solid rgba(118,166,66,0.18); box-shadow: 0 1px 3px rgba(118,166,66,0.06); }
.thinking-box { background: linear-gradient(135deg, rgba(118,166,66,0.10), rgba(94,140,50,0.14)); border: 1px solid rgba(118,166,66,0.35); }

/* ─── Sticky input bar pinned to bottom ─── */
.app { display: flex; flex-direction: column; min-height: calc(100vh - 56px); }
.chat-panel { flex: 1; display: flex; flex-direction: column; }
.chat-messages { flex: 1; overflow-y: auto; max-height: none; min-height: 0; }
.input-area { flex-shrink: 0; padding: 12px 18px 8px; background: var(--bg-surface, #fff); border-top: 1px solid var(--border-subtle, rgba(0,0,0,0.06)); }
.footer { flex-shrink: 0; }
