/* ── Matchagraph ──────────────────────────────────────────────────────── */

:root {
  --matcha:        #6b9e3c;
  --matcha-hover:  #5e8d34;
  --matcha-dark:   #4a7a2e;
  --matcha-subtle: #f0f5e8;
  --matcha-wash:   #f6f9f2;

  --gray:          #353934;
  --bg:            #f7f7f6;
  --surface:       #ffffff;
  --text:          #353934;
  --text-secondary:#5a5f5b;
  --text-tertiary: #8a8e8b;
  --border:        #e2e3e0;
  --border-focus:  #6b9e3c;
  --white:         #ffffff;
  --danger:        #ef4444;

  --shadow-sm:     0 1px 2px rgba(0,0,0,0.04);
  --shadow:        0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg:     0 -4px 12px rgba(0,0,0,0.05);
  --radius:        12px;
  --radius-sm:     8px;
}

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

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

/* ── Intro Screen ────────────────────────────────────────────────────── */

.intro-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.intro-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-content {
  text-align: center;
  max-width: 400px;
  padding: 0 24px;
}

.intro-logo {
  height: 56px;
  width: auto;
  margin-bottom: 8px;
}

.intro-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.intro-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.intro-duration {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: 28px;
}

.intro-stages {
  list-style: none;
  text-align: left;
  margin: 0 auto 32px;
  max-width: 280px;
}

.intro-stages li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.intro-stages li:last-child {
  border-bottom: none;
}

.intro-stage-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--matcha-subtle);
  color: var(--matcha-dark);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.btn-begin {
  padding: 12px 36px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 12px;
  background: var(--matcha);
  color: var(--white);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: var(--shadow);
}

.btn-begin:hover {
  background: var(--matcha-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-begin:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

/* ── Header ──────────────────────────────────────────────────────────── */

.app-header {
  background: var(--bg);
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 44px;
  flex-shrink: 0;
}

.header-left {
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.header-logo {
  height: 34px;
  width: auto;
  display: block;
  margin-bottom: -6px;
}

.header-wordmark {
  font-size: 17px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.2px;
  margin-bottom: -6px;
}

/* ── Back Button (in-form nav) ───────────────────────────────────────── */

.btn-stage-back {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: border-color 0.12s, color 0.12s;
  box-shadow: var(--shadow-sm);
}

.btn-stage-back:hover {
  border-color: var(--matcha);
  color: var(--matcha);
}

/* ── Stage Indicator ─────────────────────────────────────────────────── */

.stage-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stage-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.stage-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}

.stage-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.3s, transform 0.2s;
}

.stage-dot.completed {
  background: var(--matcha);
}

.stage-dot.active {
  background: var(--matcha);
  transform: scale(1.3);
}

/* ── Main Layout — Two Columns ───────────────────────────────────────── */

.app-main {
  display: flex;
  flex-direction: row;
  height: calc(100vh - 44px);
  position: relative;
}

/* ── Left Panel: Chat + Form ─────────────────────────────────────────── */

.left-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-main.chart-visible .left-panel {
  border-right: 1px solid var(--border);
}

.scroll-area {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 16px;
}

.content-col {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Right Panel: Radar Chart ────────────────────────────────────────── */

.right-panel {
  display: none;
}

.right-panel.visible {
  width: 46%;
  max-width: 560px;
  min-width: 360px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.chart-panel-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  gap: 16px;
}

.chart-container {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  width: 100%;
  max-width: 500px;
}

.chart-container canvas {
  max-height: 460px;
  cursor: pointer;
}

.chart-panel-footer {
  text-align: center;
  padding-bottom: 8px;
}

/* ── Chat Messages ───────────────────────────────────────────────────── */

.chat-messages {
  padding: 24px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-bubble.user {
  align-self: flex-end;
  background: var(--matcha);
  color: var(--white);
  border-bottom-right-radius: 6px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--matcha-subtle);
  color: var(--text);
  border-bottom-left-radius: 6px;
}

.chat-bubble.system-info {
  align-self: center;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 12px;
  padding: 2px 8px;
}

.typing-indicator {
  align-self: flex-start;
  padding: 12px 16px;
  background: var(--matcha-subtle);
  border-radius: 18px;
  display: none;
}

.typing-indicator.visible { display: flex; gap: 5px; align-items: center; }

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--matcha);
  border-radius: 50%;
  opacity: 0.6;
  animation: typingBounce 1.2s infinite;
}

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

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

/* ── Input Bar (pinned bottom of left panel) ─────────────────────────── */

.input-bar {
  flex-shrink: 0;
  padding: 12px 20px 20px;
  background: var(--bg);
  position: relative;
}

.input-bar::before {
  content: "";
  position: absolute;
  top: -20px;
  left: 0;
  right: 0;
  height: 20px;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}

.input-pill {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 6px 6px 6px 18px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-pill:focus-within {
  border-color: var(--matcha);
  box-shadow: 0 0 0 3px rgba(107,158,60,0.08);
}

.input-pill textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: transparent;
  padding: 6px 0;
  max-height: 150px;
  overflow-y: auto;
}

.input-pill textarea::placeholder {
  color: var(--text-tertiary);
}

.input-actions {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  padding-bottom: 2px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.15s;
  flex-shrink: 0;
}

.btn-send {
  background: var(--matcha);
  color: var(--white);
}

.btn-send:hover { background: var(--matcha-hover); }
.btn-send:disabled { opacity: 0.35; cursor: default; }

.btn-mic {
  background: transparent;
  color: var(--text-tertiary);
}

.btn-mic:hover {
  color: var(--matcha);
  background: var(--matcha-subtle);
}

.btn-mic.recording {
  background: #fef2f2;
  color: var(--danger);
  animation: micPulse 1.5s infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.25); }
  50% { box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

.btn-mic.transcribing {
  opacity: 0.5;
  pointer-events: none;
  animation: micSpin 1s linear infinite;
}

@keyframes micSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ── Form Sections (inline in scroll area) ───────────────────────────── */

.form-section {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 16px;
  margin-top: 10px;
  margin-bottom: 2px;
  animation: sectionSlideIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.form-section h2 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}

.form-field {
  margin-bottom: 10px;
}

.form-field:last-child { margin-bottom: 0; }

.form-field label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 3px;
}

.form-field input[type="text"],
.form-field input[type="date"],
.form-field textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-field input::placeholder,
.form-field textarea::placeholder { color: var(--text-tertiary); }

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(107,158,60,0.08);
  background: var(--surface);
}

.form-field textarea { resize: vertical; min-height: 36px; }

/* ── Intensity Instructions ──────────────────────────────────────────── */

.intensity-instructions {
  font-size: 12px;
  color: var(--text-tertiary);
  line-height: 1.5;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ── Intensity Row (Stage 2 – flat layout) ───────────────────────────── */

.intensity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.intensity-row:last-child {
  border-bottom: none;
}

.intensity-row-label {
  font-weight: 500;
  font-size: 13px;
  color: var(--text);
  min-width: 120px;
}

.intensity-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.intensity-slider {
  -webkit-appearance: none;
  width: 120px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
}

.intensity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--matcha);
  cursor: pointer;
  border: 2px solid var(--white);
  box-shadow: var(--shadow-sm), 0 0 0 1px rgba(0,0,0,0.05);
  transition: transform 0.1s;
}

.intensity-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.intensity-value {
  font-weight: 600;
  font-size: 12px;
  color: var(--matcha-dark);
  min-width: 14px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ── CATA Descriptors (Stage 3) ──────────────────────────────────────── */

.cata-empty-note {
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 8px 0;
}

.cata-progress {
  float: right;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: none;
  letter-spacing: 0;
}

.descriptor-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cata-pills-large {
  gap: 8px;
  margin-bottom: 12px;
}

.descriptor-pill {
  padding: 2px 8px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
  user-select: none;
}

.cata-pills-large .descriptor-pill {
  padding: 10px 16px;
  font-size: 14px;
  border-radius: 10px;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.descriptor-pill:hover {
  border-color: var(--matcha);
  color: var(--matcha);
}

.descriptor-pill.selected {
  background: var(--matcha);
  color: var(--white);
  border-color: var(--matcha);
}

.other-input {
  margin-top: 6px;
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11px;
  font-family: inherit;
  color: var(--text);
  outline: none;
  background: var(--surface);
  transition: border-color 0.15s;
}

.other-input::placeholder { color: var(--text-tertiary); }
.other-input:focus { border-color: var(--matcha); }

/* ── CATA Navigation ─────────────────────────────────────────────────── */

.cata-nav {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.btn-cata-none {
  padding: 10px 32px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
  box-shadow: var(--shadow-sm);
}

.btn-cata-none:hover {
  border-color: var(--matcha);
  color: var(--matcha);
}

/* ── Summary Text (Stage 1 card) ─────────────────────────────────────── */

.summary-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  padding: 4px 0;
}

/* ── Rating Scales ───────────────────────────────────────────────────── */

.rating-scale {
  display: flex;
  gap: 5px;
  align-items: center;
}

.rating-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-secondary);
  font-family: inherit;
  transition: all 0.12s;
}

.rating-btn:hover {
  border-color: var(--matcha);
  color: var(--matcha);
}

.rating-btn.selected {
  background: var(--matcha);
  color: var(--white);
  border-color: var(--matcha);
}

/* ── Three-Point Scale ───────────────────────────────────────────────── */

.three-point-scale {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.three-point-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  transition: all 0.12s;
}

.three-point-btn:hover {
  border-color: var(--matcha);
  color: var(--matcha);
}

.three-point-btn.selected {
  background: var(--matcha);
  color: var(--white);
  border-color: var(--matcha);
}

/* ── Stage Navigation Button ─────────────────────────────────────────── */

.stage-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 0 8px;
}

.btn-next-stage {
  padding: 10px 32px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  background: var(--matcha);
  color: var(--white);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}

.btn-next-stage:hover {
  background: var(--matcha-hover);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.btn-next-stage:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

/* ── Metadata Detailed Fields Toggle ─────────────────────────────────── */

.btn-toggle-detailed {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  padding: 8px 0 4px;
  margin-top: 4px;
  transition: color 0.15s;
}

.btn-toggle-detailed:hover {
  color: var(--matcha);
}

.detailed-fields-wrap {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ── Section Slide-In Animation ──────────────────────────────────────── */

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

/* ── AI Highlight Pulse ──────────────────────────────────────────────── */

.ai-highlight {
  animation: highlightPulse 1.2s ease;
}

@keyframes highlightPulse {
  0%   { box-shadow: 0 0 0 0 rgba(107,158,60,0.35); }
  40%  { box-shadow: 0 0 0 5px rgba(107,158,60,0.08); }
  100% { box-shadow: none; }
}

/* ── Submit ───────────────────────────────────────────────────────────── */

.submit-section {
  text-align: center;
  padding: 20px 0 32px;
}

.btn-submit {
  padding: 10px 32px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: 10px;
  background: var(--matcha);
  color: var(--white);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}

.btn-submit:hover {
  background: var(--matcha-hover);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.btn-submit:active { transform: translateY(0); box-shadow: var(--shadow-sm); }

/* ── Overlay Panel (shown after completion) ──────────────────────────── */

.overlay-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px 20px;
  width: 100%;
  max-width: 500px;
}

.overlay-panel h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
}

.overlay-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.overlay-actions button {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
}

.overlay-actions button:hover {
  border-color: var(--matcha);
  color: var(--matcha);
}

.overlay-list {
  list-style: none;
}

.overlay-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

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

.overlay-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.overlay-item label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  font-weight: 500;
}

.overlay-item input[type="checkbox"] {
  accent-color: var(--matcha);
}

.btn-back {
  display: inline-block;
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
}

.btn-back:hover {
  border-color: var(--matcha);
  color: var(--matcha);
}

.no-past {
  color: var(--text-tertiary);
  font-size: 13px;
}

/* ── Update Cards (rich field-update feedback in chat) ───────────────── */

.update-card {
  align-self: flex-start;
  max-width: 85%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12.5px;
  line-height: 1.5;
}

.update-card-section {
  margin-bottom: 8px;
}

.update-card-section:last-child {
  margin-bottom: 0;
}

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

.update-card-title {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
}

.update-card-link {
  font-size: 11px;
  font-weight: 500;
  color: var(--matcha);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
}

.update-card-link:hover {
  color: var(--matcha-dark);
}

.update-card-field {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
}

.update-card-label {
  font-weight: 500;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.update-card-value {
  color: var(--text);
}

.update-card-intensity {
  font-weight: 600;
  color: var(--matcha-dark);
  font-variant-numeric: tabular-nums;
}

.update-card-descriptors {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 2px;
}

.update-card-pill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--matcha-subtle);
  color: var(--matcha-dark);
  font-size: 11px;
  font-weight: 500;
}

/* ── Section "Updated" Badge ─────────────────────────────────────────── */

.section-updated-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--matcha);
  background: var(--matcha-subtle);
  padding: 1px 7px;
  border-radius: 8px;
  margin-left: 8px;
  text-transform: none;
  letter-spacing: 0;
  vertical-align: middle;
  transition: opacity 0.4s ease;
}

.section-updated-badge.fade-out {
  opacity: 0;
}

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .app-main {
    flex-direction: column;
  }

  .left-panel {
    border-right: none;
    flex: 1;
    min-height: 0;
  }

  .right-panel.visible {
    width: 100%;
    max-width: none;
    min-width: 0;
    max-height: 50vh;
    border-top: 1px solid var(--border);
  }

  .chart-panel-inner {
    padding: 16px;
  }

  .chart-container {
    max-width: 400px;
  }
}

@media (max-width: 640px) {
  .content-col { padding: 0 12px; }
  .input-bar { padding: 8px 12px 16px; }
  .form-section { padding: 16px; }
  .app-header { padding: 0 16px; }

  .intensity-row-label { min-width: 90px; font-size: 12px; }
  .intensity-slider { width: 90px; }

  .intro-content { padding: 0 16px; }
  .intro-stages { max-width: 100%; }
}

/* ── Dashboard Screen ────────────────────────────────────────────────── */

.dashboard-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.dashboard-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.dashboard-content {
  text-align: center;
  width: 100%;
  max-width: 480px;
  padding: 0 24px;
}

.dashboard-logo {
  height: 52px;
  width: auto;
  margin-bottom: 10px;
}

.dashboard-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.dashboard-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.dashboard-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: var(--shadow-sm);
}

.dash-card:hover {
  border-color: var(--matcha);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.dash-card:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.dash-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--matcha-subtle);
  color: var(--matcha-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.dash-card-body {
  flex: 1;
  min-width: 0;
}

.dash-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.dash-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.dash-card-arrow {
  color: var(--text-tertiary);
  font-size: 11px;
  flex-shrink: 0;
}

/* ── Header home button ──────────────────────────────────────────────── */

.header-home-btn {
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  margin: -2px -6px;
  transition: background 0.12s;
}

.header-home-btn:hover {
  background: var(--matcha-subtle);
}

/* ── Fullscreen Overlays (Compare & Search) ──────────────────────────── */

.fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.fullscreen-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.overlay-screen-header {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
}

.overlay-screen-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.btn-overlay-back {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
  flex-shrink: 0;
}

.btn-overlay-back:hover {
  border-color: var(--matcha);
  color: var(--matcha-dark);
}

.overlay-empty {
  font-size: 13px;
  color: var(--text-tertiary);
  padding: 24px 0;
  text-align: center;
}

/* ── Compare Screen ──────────────────────────────────────────────────── */

.compare-layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

.compare-sidebar {
  width: 280px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.compare-eval-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}

.compare-eval-item:hover {
  background: var(--matcha-wash);
  border-color: var(--border);
}

.compare-eval-item input[type="checkbox"] {
  margin-top: 2px;
  accent-color: var(--matcha);
  cursor: pointer;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

.compare-eval-info {
  flex: 1;
  min-width: 0;
}

.compare-eval-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compare-eval-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compare-chart-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
}

.compare-chart-area canvas {
  max-width: 560px;
  max-height: calc(100vh - 130px);
  width: 100%;
}

.compare-hint {
  font-size: 13px;
  color: var(--text-tertiary);
  position: absolute;
  bottom: 50%;
  transform: translateY(50%);
  pointer-events: none;
}

/* ── Search Screen ───────────────────────────────────────────────────── */

.search-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
  padding: 20px 20px 0;
  min-height: 0;
}

.search-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  flex-shrink: 0;
  transition: border-color 0.15s;
}

.search-bar-wrap:focus-within {
  border-color: var(--border-focus);
}

.search-icon-inline {
  color: var(--text-tertiary);
  font-size: 13px;
  flex-shrink: 0;
}

.search-field {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}

.search-field::placeholder {
  color: var(--text-tertiary);
}

.search-results-list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 24px;
}

.search-product-group {
  margin-bottom: 20px;
}

.search-product-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--matcha-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 4px;
  margin-bottom: 6px;
}

.search-eval-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  gap: 12px;
}

.search-eval-brand {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-eval-brand:empty::before {
  content: "No brand listed";
  color: var(--text-tertiary);
  font-style: italic;
  font-weight: 400;
}

.search-eval-date {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Responsive: Compare & Search ────────────────────────────────────── */

@media (max-width: 640px) {
  .compare-sidebar {
    width: 180px;
    padding: 12px;
  }

  .compare-chart-area {
    padding: 16px;
  }

  .dashboard-cards {
    gap: 8px;
  }
}

/* ── Auth Screens (login / register) ────────────────────────────────── */

.auth-body {
  overflow: auto;
}

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow-md);
}

.auth-logo-wrap {
  text-align: center;
  margin-bottom: 24px;
}

.auth-logo {
  height: 44px;
  width: auto;
  margin-bottom: 8px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.4px;
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.form-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.auth-field-hint {
  font-weight: 400;
  color: var(--text-tertiary);
  font-size: 11px;
}

.auth-field input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-field input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(107,158,60,0.08);
  background: var(--surface);
}

.btn-auth {
  padding: 11px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--matcha);
  color: var(--white);
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}

.btn-auth:hover {
  background: var(--matcha-hover);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.btn-auth:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.auth-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 16px;
}

/* ── Header User Pill ────────────────────────────────────────────────── */

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--text-tertiary);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  font-size: 13px;
}

.header-logout:hover {
  background: var(--matcha-subtle);
  color: var(--matcha-dark);
}

/* ── Dashboard Recent Evaluations ────────────────────────────────────── */

.dash-recent {
  margin-top: 20px;
  text-align: left;
}

.dash-recent-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 8px;
}

.dash-recent-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  transition: border-color 0.12s;
}

.dash-recent-item:hover {
  border-color: var(--matcha);
}

.dash-recent-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.dash-recent-meta {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ── Search eval meta right ──────────────────────────────────────────── */

.search-eval-meta-right {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Scrollbar ───────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
