/* ── Firstshift Brand Color System ─────────────────────────────── */
:root {
  --blue:          #3A9BD5;
  --blue-dark:     #2B7AB5;
  --blue-light:    #E8F4FD;
  --blue-xlight:   #F0F8FE;
  --green:         #6DBE45;
  --green-dark:    #56A034;
  --green-light:   #EEF8E8;
  --dark:          #1A1A1A;
  --body:          #374151;
  --muted:         #6B7280;
  --light:         #9CA3AF;
  --bg:            #F3F6F9;
  --surface:       #FFFFFF;
  --border:        #E5E7EB;
  --border-dark:   #D1D5DB;
  --error:         #DC2626;
  --error-light:   #FEF2F2;
  --warning:       #D97706;
  --warning-light: #FFFBEB;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow:        0 4px 6px -1px rgba(0,0,0,.08), 0 2px 4px -1px rgba(0,0,0,.05);
  --shadow-lg:     0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.05);
  --radius:        8px;
  --radius-sm:     5px;
  --radius-lg:     12px;
  /* Test type palette */
  --t-functional:  #3A9BD5;
  --t-edge:        #D97706;
  --t-negative:    #DC2626;
  --t-boundary:    #7C3AED;
  --t-decision:    #0891B2;
  --t-equiv:       #6DBE45;
  --t-error:       #C2410C;
  --t-state:       #4338CA;
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  /* Subtle full-page brand gradient: green tint → blue tint */
  background: linear-gradient(160deg, #EEF8EC 0%, #EAF4FB 50%, #E8F2FA 100%) fixed;
  color: var(--body);
  line-height: 1.55;
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ───────────────────────────────────────────────────── */
.app-header {
  /* Firstshift brand gradient: pastel green (left) → pastel sky blue (right) */
  background: linear-gradient(to right, #C8E8D3 0%, #C0DCF0 55%, #B8D8EE 100%);
  border-bottom: 1px solid rgba(58,155,213,.2);
  box-shadow: 0 2px 8px rgba(58,155,213,.14);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px;
  height: 84px;
  display: flex;
  align-items: center;
  gap: 20px;
}
/* Logo: SVG with name — tall enough to be legible */
.app-logo { height: 64px; width: auto; display: block; }
.header-divider {
  width: 1px;
  height: 38px;
  background: rgba(58,155,213,.35);
  flex-shrink: 0;
}
.header-titles { flex: 1; }
.header-titles h1 {
  font-size: 1.08rem;
  font-weight: 700;
  color: #1A3A28;   /* dark green-black for contrast on gradient */
  line-height: 1.2;
}
.header-titles .subtitle {
  font-size: 0.73rem;
  color: #3A6050;   /* muted dark teal for contrast */
  letter-spacing: 0.02em;
  margin-top: 1px;
}
.header-badge {
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,.65);
  color: var(--blue-dark);
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid rgba(58,155,213,.3);
  backdrop-filter: blur(4px);
}
.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 4px 10px;
  background: rgba(255,255,255,.55);
  border: 1px solid rgba(58,155,213,.25);
  border-radius: 24px;
  backdrop-filter: blur(4px);
}
.header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 1.5px solid rgba(255,255,255,.7);
}
.header-user-name {
  font-size: 0.78rem;
  font-weight: 600;
  color: #1A3A28;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.header-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,.08);
  color: #3A6050;
  font-size: 0.65rem;
  text-decoration: none;
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.header-logout:hover {
  background: rgba(220,38,38,.15);
  color: var(--error);
  text-decoration: none;
}

/* ── Main layout ──────────────────────────────────────────────── */
.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

/* ── Page background decorative strip below header ────────────── */
.app-main::before {
  content: '';
  display: block;
  height: 6px;
  margin: -32px -24px 28px;
  background: linear-gradient(to right, var(--green) 0%, var(--blue) 100%);
  opacity: 0.18;
  border-radius: 0 0 4px 4px;
}

/* ── Views (state machine) ────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ── Card ─────────────────────────────────────────────────────── */
.card {
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(58,155,213,.2);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 14px rgba(58,155,213,.1), 0 1px 4px rgba(0,0,0,.06);
  overflow: hidden;
  position: relative;
}
/* Green → blue gradient accent line on top of every card */
.card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(to right, var(--green) 0%, var(--blue) 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  pointer-events: none;
}
.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.card-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
}
.card-header p { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.card-body { padding: 24px; }

/* ── Form ─────────────────────────────────────────────────────── */
.form-section { margin-bottom: 22px; }
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.form-hint { font-size: 0.75rem; color: var(--muted); margin-top: 4px; display: block; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: var(--dark);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(58,155,213,.15);
}
.form-textarea { resize: vertical; min-height: 88px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* Mode radio */
.mode-tabs {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  overflow: hidden;
  width: fit-content;
}
.mode-tab {
  padding: 8px 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  background: #fff;
  color: var(--muted);
  border: none;
  transition: background .15s, color .15s;
  user-select: none;
}
.mode-tab input[type=radio] { display: none; }
.mode-tab.selected { background: var(--blue); color: #fff; font-weight: 600; }
.mode-tab:not(.selected):hover { background: var(--bg); }

/* Test type checkboxes */
.type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 800px) { .type-grid { grid-template-columns: repeat(2, 1fr); } }
.type-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.83rem;
  color: var(--body);
  transition: border-color .15s, background .15s;
  user-select: none;
}
.type-check:hover { border-color: var(--blue); background: var(--blue-xlight); }
.type-check input[type=checkbox] { display: none; }
.type-check.checked { border-color: var(--blue); background: var(--blue-xlight); color: var(--dark); font-weight: 500; }
.type-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.type-dot.FUNCTIONAL   { background: var(--t-functional); }
.type-dot.EDGE_CASE    { background: var(--t-edge); }
.type-dot.NEGATIVE     { background: var(--t-negative); }
.type-dot.BOUNDARY     { background: var(--t-boundary); }
.type-dot.DECISION_TABLE { background: var(--t-decision); }
.type-dot.EQUIVALENCE_PARTITION { background: var(--t-equiv); }
.type-dot.ERROR_GUESSING { background: var(--t-error); }
.type-dot.STATE_TRANSITION { background: var(--t-state); }

/* Toggle switch */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border-dark);
  border-radius: 24px;
  cursor: pointer;
  transition: background .2s;
}
.toggle input:checked + .toggle-track { background: var(--green); }
.toggle-track::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s;
}
.toggle input:checked + .toggle-track::before { transform: translateX(20px); }
.toggle-label { font-size: 0.85rem; color: var(--body); }
.toggle-label strong { color: var(--dark); }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); box-shadow: var(--shadow-sm); }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-success:hover:not(:disabled) { background: var(--green-dark); border-color: var(--green-dark); box-shadow: var(--shadow-sm); }
.btn-ghost { background: transparent; color: var(--body); border-color: var(--border-dark); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); border-color: var(--blue); color: var(--blue); }
.btn-danger { background: var(--error); color: #fff; border-color: var(--error); }
.btn-lg { padding: 11px 24px; font-size: 0.95rem; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-icon { font-size: 1em; }

/* ── Loading view ─────────────────────────────────────────────── */
.loading-card {
  text-align: center;
  padding: 60px 24px;
}
.loading-card h2 { font-size: 1.05rem; color: var(--dark); margin-bottom: 8px; }
.loading-card p  { font-size: 0.88rem; color: var(--muted); max-width: 480px; margin: 0 auto 20px; }

/* Logo loader — replaces the plain CSS spinner */
.logo-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
}

.logo-loader-img {
  height: 80px;
  width: auto;
  display: block;
  animation: logo-pulse 2.2s ease-in-out infinite;
  transform-origin: center;
}

@keyframes logo-pulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0px rgba(58,155,213,0))
            drop-shadow(0 2px 8px rgba(58,155,213,.08));
    opacity: 1;
  }
  50% {
    transform: scale(1.055);
    filter: drop-shadow(0 0 18px rgba(58,155,213,.55))
            drop-shadow(0 4px 16px rgba(109,190,69,.25));
    opacity: 0.95;
  }
}

/* Three bouncing dots */
.logo-loader-dots {
  display: flex;
  gap: 7px;
  align-items: center;
}
.logo-loader-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  animation: dot-wave 1.5s ease-in-out infinite both;
}
.logo-loader-dots span:nth-child(1) { animation-delay: 0s;    background: var(--blue); }
.logo-loader-dots span:nth-child(2) { animation-delay: 0.18s; background: linear-gradient(135deg, var(--blue), var(--green)); }
.logo-loader-dots span:nth-child(3) { animation-delay: 0.36s; background: var(--green); }

@keyframes dot-wave {
  0%, 60%, 100% { transform: translateY(0) scale(0.75); opacity: 0.45; }
  30%            { transform: translateY(-7px) scale(1);  opacity: 1;    }
}

/* ── Review header bar ────────────────────────────────────────── */
.review-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px 20px;
  margin-bottom: 18px;
}
.review-stats { display: flex; gap: 20px; flex-wrap: wrap; }
.stat-item { text-align: center; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--dark); line-height: 1; }
.stat-label { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }
.stat-item.blue .stat-value { color: var(--blue); }
.stat-item.green .stat-value { color: var(--green); }
.stat-item.warn .stat-value { color: var(--warning); }
.review-controls { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Story panel ──────────────────────────────────────────────── */
.story-panel {
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(58,155,213,.2);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 14px rgba(58,155,213,.09), 0 1px 3px rgba(0,0,0,.05);
  margin-bottom: 16px;
  overflow: hidden;
  position: relative;
}
.story-panel::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(to right, var(--green) 0%, var(--blue) 100%);
  pointer-events: none;
}
.story-panel-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: background .15s;
  user-select: none;
}
.story-panel-header:hover { background: var(--bg); }
.story-panel.open .story-panel-header { border-bottom-color: var(--border); }
.story-key-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  background: var(--blue-light);
  color: var(--blue-dark);
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.story-summary {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.story-counts { display: flex; gap: 6px; flex-shrink: 0; }
.count-chip {
  font-size: 0.73rem;
  padding: 2px 8px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
}
.count-chip.tests { background: var(--blue-light); color: var(--blue-dark); }
.count-chip.gaps  { background: var(--warning-light); color: var(--warning); }
.count-chip.regr  { background: var(--green-light); color: var(--green-dark); }
.expand-arrow {
  font-size: 0.75rem;
  color: var(--muted);
  transition: transform .2s;
  flex-shrink: 0;
}
.story-panel.open .expand-arrow { transform: rotate(180deg); }

.story-panel-body { display: none; }
.story-panel.open .story-panel-body { display: block; }

/* ── Story tabs ───────────────────────────────────────────────── */
.story-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  background: var(--bg);
}
.story-tab {
  padding: 10px 16px;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}
.story-tab:hover { color: var(--dark); }
.story-tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

.tab-pane { display: none; padding: 20px; }
.tab-pane.active { display: block; }

/* ── Test type group ──────────────────────────────────────────── */
.type-group { margin-bottom: 20px; }
.type-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 6px 0;
}
.type-group-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.type-group-actions { display: flex; gap: 6px; }

/* ── Test card ────────────────────────────────────────────────── */
.test-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: border-color .15s, box-shadow .15s;
  overflow: hidden;
}
.test-card.selected { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(58,155,213,.1); }
.test-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  background: #fff;
  transition: background .1s;
}
.test-card-header:hover { background: var(--bg); }
.test-checkbox-wrap { padding-top: 1px; flex-shrink: 0; }
.test-checkbox {
  width: 18px; height: 18px;
  accent-color: var(--blue);
  cursor: pointer;
}
.test-badges { display: flex; gap: 5px; flex-shrink: 0; flex-wrap: wrap; }
.badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.badge-FUNCTIONAL   { background: #DBEAFE; color: #1D4ED8; }
.badge-EDGE_CASE    { background: #FEF3C7; color: #B45309; }
.badge-NEGATIVE     { background: #FEE2E2; color: #B91C1C; }
.badge-BOUNDARY     { background: #EDE9FE; color: #5B21B6; }
.badge-DECISION_TABLE { background: #CFFAFE; color: #0E7490; }
.badge-EQUIVALENCE_PARTITION { background: var(--green-light); color: var(--green-dark); }
.badge-ERROR_GUESSING { background: #FFEDD5; color: #9A3412; }
.badge-STATE_TRANSITION { background: #E0E7FF; color: #3730A3; }
.badge-IN_SPRINT { background: var(--green-light); color: var(--green-dark); }
.badge-REGRESSION { background: var(--warning-light); color: var(--warning); }
.test-title {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--dark);
  line-height: 1.35;
}
.card-expand-btn {
  font-size: 0.7rem;
  color: var(--muted);
  transition: transform .2s;
  flex-shrink: 0;
  padding-top: 3px;
  user-select: none;
}
.test-card.expanded .card-expand-btn { transform: rotate(180deg); }
.test-card-body { display: none; padding: 0 14px 14px; border-top: 1px solid var(--border); }
.test-card.expanded .test-card-body { display: block; }

/* ── Card sections ────────────────────────────────────────────── */
.card-section { margin-top: 12px; }
.card-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 6px;
}
.preconditions-list {
  list-style: none;
  padding: 0;
}
.preconditions-list li {
  font-size: 0.82rem;
  color: var(--body);
  padding: 3px 0 3px 14px;
  position: relative;
}
.preconditions-list li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--blue);
  font-weight: 700;
}

/* ── Steps table ──────────────────────────────────────────────── */
.steps-table {
  width: 100%;
  /* Fixed layout is CRITICAL — prevents any column from expanding to fit content */
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
/* Locked column widths — all 4 columns always visible regardless of content length */
.steps-table colgroup col:nth-child(1) { width: 36px; }   /* # */
.steps-table colgroup col:nth-child(2) { width: 28%; }    /* Action */
.steps-table colgroup col:nth-child(3) { width: 25%; }    /* Test Data */
.steps-table colgroup col:nth-child(4) { width: auto; }   /* Expected Result — gets remaining space */
.steps-table th {
  background: var(--bg);
  padding: 7px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
  /* Remove fixed widths from th — use colgroup above instead */
}
.steps-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--body);
  line-height: 1.45;
  /* Every cell must wrap — never push other columns off-screen */
  word-break: break-word;
  overflow-wrap: anywhere;
}
.steps-table tr:last-child td { border-bottom: none; }
.steps-table tr:nth-child(even) td { background: #FAFBFC; }
.step-num {
  font-weight: 700;
  color: var(--blue);
  text-align: center;
  width: 36px;
}
.step-data code {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.76em;
  background: var(--bg);
  padding: 3px 6px;
  border-radius: 3px;
  color: var(--t-error);
  /* Block so long values wrap within the column instead of overflowing */
  display: block;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
  max-width: 100%;
}
.step-expected { color: var(--green-dark); }

/* ── DB Queries ───────────────────────────────────────────────── */
.db-query-block {
  background: #1E2936;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 6px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
  color: #A8D8EA;
}
.db-query-block .sql-keyword { color: #79C0FF; font-weight: 600; }
.db-query-block .sql-comment { color: #6E7681; font-style: italic; }
.db-copy-btn {
  font-size: 0.7rem;
  padding: 2px 8px;
  border: 1px solid #374151;
  border-radius: 3px;
  background: transparent;
  color: #9CA3AF;
  cursor: pointer;
  float: right;
  margin-bottom: 4px;
  font-family: inherit;
}
.db-copy-btn:hover { background: #374151; color: #fff; }

/* ── Overall result + rationale ──────────────────────────────── */
.overall-result-box {
  background: var(--green-light);
  border-left: 3px solid var(--green);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--dark);
}
.rationale-box {
  background: var(--blue-xlight);
  border-left: 3px solid var(--blue);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--body);
  font-style: italic;
}
.test-data-box {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.78rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--body);
  white-space: pre-wrap;
}

/* ── AC Gaps table ────────────────────────────────────────────── */
.gaps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.gaps-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--bg);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}
.gaps-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.gaps-table tr:last-child td { border-bottom: none; }
.severity-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.severity-HIGH   { background: #FEE2E2; color: #B91C1C; }
.severity-MEDIUM { background: #FEF3C7; color: #B45309; }
.severity-LOW    { background: #D1FAE5; color: #065F46; }
.gap-type-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--blue-dark);
  background: var(--blue-light);
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}
.ac-complete-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--green-light);
  border-radius: var(--radius);
  color: var(--green-dark);
  font-size: 0.875rem;
  font-weight: 600;
}
.ac-complete-banner .icon { font-size: 1.2em; }

/* ── Regression pane ──────────────────────────────────────────── */
.regression-impact {
  font-size: 0.85rem;
  color: var(--body);
}
.regression-keys {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.test-key-chip {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 9px;
  background: var(--bg);
  border: 1px solid var(--border-dark);
  border-radius: 20px;
  color: var(--body);
  font-family: 'Consolas', 'Courier New', monospace;
}
.impact-reasoning {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--body);
  line-height: 1.5;
  margin-top: 8px;
}

/* ── Approve bar (sticky bottom) ──────────────────────────────── */
.approve-bar {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1.5px solid var(--border);
  box-shadow: 0 -4px 12px rgba(0,0,0,.06);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 50;
  margin: 0 -24px;
}
.selection-info {
  font-size: 0.875rem;
  color: var(--body);
}
.selection-info strong { color: var(--dark); font-size: 1rem; }
.approve-actions { display: flex; gap: 10px; align-items: center; }
.dry-run-indicator {
  font-size: 0.75rem;
  padding: 3px 10px;
  background: var(--warning-light);
  color: var(--warning);
  border-radius: 20px;
  font-weight: 600;
  border: 1px solid #FDE68A;
}

/* ── Result view ──────────────────────────────────────────────── */
.result-card {
  text-align: center;
  padding: 48px 32px;
  max-width: 640px;
  margin: 0 auto;
}
.result-icon { font-size: 3rem; margin-bottom: 16px; }
.result-card h2 { font-size: 1.3rem; color: var(--dark); margin-bottom: 8px; }
.result-card p { font-size: 0.9rem; color: var(--muted); margin-bottom: 24px; }
.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
  margin-bottom: 24px;
}
.result-table th, .result-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.result-table th { background: var(--bg); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.result-success { color: var(--green-dark); font-weight: 600; }
.result-zero { color: var(--light); }

/* ── Error banner ─────────────────────────────────────────────── */
.error-banner {
  background: var(--error-light);
  border: 1px solid #FECACA;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.875rem;
  color: var(--error);
  margin-top: 16px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.error-banner .icon { flex-shrink: 0; font-size: 1.1em; }

/* ── Merge mode ───────────────────────────────────────────────── */
.merge-pane-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
.btn-merge-toggle { gap: 5px; }
.btn-merge-toggle.active {
  background: var(--warning-light);
  border-color: var(--warning);
  color: var(--warning);
}

/* Merge checkbox: hidden by default, visible in merge mode */
.merge-cb-wrap { display: none; padding-top: 1px; flex-shrink: 0; }
.tab-pane.merge-mode .merge-cb-wrap { display: block; }
.merge-cb {
  width: 18px; height: 18px;
  accent-color: var(--warning);
  cursor: pointer;
}

/* Card highlight when picked for merge */
.test-card.merge-pick {
  border-color: var(--warning) !important;
  box-shadow: 0 0 0 3px rgba(217,119,6,.13) !important;
}

/* Source cards dimmed after merge */
.test-card.merged-source {
  opacity: 0.38;
  filter: grayscale(0.4);
  pointer-events: none;
}

/* The resulting merged test card */
.test-card.merged-result {
  border-color: var(--warning) !important;
  box-shadow: 0 0 0 3px rgba(217,119,6,.12) !important;
}
.badge-MERGED {
  background: #FEF3C7;
  color: #92400E;
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 3px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.merged-from {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
  font-style: italic;
}

/* Group header for merged tests */
.type-group-merged .type-group-header {
  border-bottom: 2px dashed var(--warning);
  padding-bottom: 6px;
  margin-bottom: 10px;
}

/* Merge bar (appears at bottom of test cases tab in merge mode) */
.merge-bar {
  display: none;
  margin-top: 16px;
  background: #FFFBEB;
  border: 1.5px solid var(--warning);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(217,119,6,.1);
}
.tab-pane.merge-mode .merge-bar { display: block; }
.merge-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 12px;
  flex-wrap: wrap;
}
.merge-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: #92400E;
}
.merge-bar-body { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.merge-instructions {
  flex: 1;
  min-width: 200px;
  padding: 8px 10px;
  border: 1.5px solid #FCD34D;
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  resize: vertical;
  font-family: inherit;
  background: #fff;
  min-height: 60px;
}
.merge-instructions:focus { outline: none; border-color: var(--warning); box-shadow: 0 0 0 3px rgba(217,119,6,.15); }
.merge-bar-actions { display: flex; flex-direction: column; gap: 6px; justify-content: center; }
.merge-error { color: var(--error); font-size: 0.8rem; margin-top: 6px; }
@keyframes mspin { to { transform: rotate(360deg); } }
.merge-spinner {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: mspin .7s linear infinite;
  vertical-align: middle;
}

/* ── Per-card AI edit panel ───────────────────────────────────── */
.edit-panel {
  margin-top: 10px;
  background: var(--blue-xlight);
  border: 1.5px solid var(--blue-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: none;
}
.edit-panel.open { display: block; }
.edit-panel-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--blue-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.edit-instructions {
  width: 100%;
  padding: 8px 10px;
  border: 1.5px solid rgba(58,155,213,.4);
  border-radius: var(--radius-sm);
  font-size: 0.83rem;
  resize: vertical;
  font-family: inherit;
  background: #fff;
  min-height: 56px;
}
.edit-instructions:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(58,155,213,.15); }
.edit-panel-actions { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.edit-error { color: var(--error); font-size: 0.78rem; margin-top: 4px; }

/* ── Written-to-Zephyr state ──────────────────────────────────── */
.test-card.written-to-zephyr {
  opacity: 0.42;
  filter: grayscale(0.35);
  pointer-events: none;
}
.badge-WRITTEN {
  background: #D1FAE5;
  color: #065F46;
}

/* ── Write success banner ─────────────────────────────────────── */
.write-banner {
  background: var(--green-light);
  border: 1.5px solid var(--green);
  border-radius: var(--radius);
  padding: 13px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(109,190,69,.12);
}
.write-banner-content { flex: 1; }
.write-banner-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--green-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.write-banner-sub {
  font-size: 0.78rem;
  color: var(--green-dark);
  opacity: 0.75;
  margin-top: 3px;
}
.write-banner-close {
  background: none;
  border: none;
  color: var(--green-dark);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 2px;
  line-height: 1;
  opacity: 0.55;
  flex-shrink: 0;
}
.write-banner-close:hover { opacity: 1; }

/* Write banner: per-story path rows */
.wbanner-story {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(109,190,69,.25);
}
.wbanner-story--error {
  border-top-color: rgba(220,38,38,.2);
}
.wbanner-path {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--green-dark);
  white-space: nowrap;
  flex-shrink: 0;
}
.wbanner-story--error .wbanner-path {
  color: var(--danger, #DC2626);
}
.wbanner-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.wbanner-error-msg {
  font-size: 0.78rem;
  color: var(--danger, #DC2626);
}
.wbanner-name-list {
  list-style: none;
  margin: 5px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}
.wbanner-test-name {
  font-size: 0.74rem;
  color: var(--green-dark);
  opacity: 0.8;
  padding-left: 4px;
  border-left: 2px solid var(--green);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ── Export dropdown ──────────────────────────────────────────── */
.export-dropdown {
  position: relative;
}
.export-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.13);
  min-width: 190px;
  z-index: 300;
  overflow: hidden;
}
.export-menu-section {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 8px 12px 3px;
  border-top: 1px solid var(--border);
}
.export-menu-section:first-child { border-top: none; }
.export-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-size: 0.82rem;
  color: var(--dark);
  text-decoration: none;
  cursor: pointer;
}
.export-item:hover {
  background: var(--blue-light);
  color: var(--blue);
}

/* ── Misc ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-muted { color: var(--muted); font-size: 0.82rem; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.empty-state {
  text-align: center;
  padding: 32px;
  color: var(--muted);
  font-size: 0.875rem;
}
.errors-list {
  background: var(--error-light);
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.errors-list li { font-size: 0.82rem; color: var(--error); list-style: none; padding: 2px 0; }
.errors-list li::before { content: '⚠ '; }

/* ── Home / Dashboard ────────────────────────────────────────────── */
.pending-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}
.pending-section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
}
.pending-section-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 2px;
}

/* Pending job card */
.pending-job-card {
  background: rgba(255,255,255,.97);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  transition: border-color .15s, box-shadow .15s;
}
.pending-job-card--pending {
  border-color: rgba(58,155,213,.35);
  box-shadow: 0 2px 8px rgba(58,155,213,.08);
}
.pending-job-card--generating {
  border-color: rgba(109,190,69,.4);
}
.pending-job-card--failed {
  border-color: rgba(220,38,38,.25);
  background: var(--error-light);
}
.pending-job-card--completed {
  opacity: 0.65;
}
.pjob-main { flex: 1; min-width: 200px; }
.pjob-stories {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.pending-story-chip {
  font-size: 0.76rem;
  font-weight: 700;
  padding: 2px 8px;
  background: var(--blue-light);
  color: var(--blue-dark);
  border-radius: 4px;
  font-family: 'Consolas', 'Courier New', monospace;
}
.pjob-meta {
  display: flex;
  gap: 10px;
  font-size: 0.76rem;
  color: var(--muted);
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.pjob-meta span::before { content: '· '; }
.pjob-meta span:first-child::before { content: ''; }
.pjob-status { display: flex; gap: 6px; flex-wrap: wrap; }
.pjob-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.pjob-badge--pending { background: var(--blue-light); color: var(--blue-dark); }
.pjob-badge--written { background: #D1FAE5; color: #065F46; }
.pjob-badge--generating { background: var(--green-light); color: var(--green-dark); }
.pjob-badge--failed { background: var(--error-light); color: var(--error); }
.pjob-badge--done { background: #D1FAE5; color: #065F46; }
.pjob-error { color: var(--error); font-size: 0.73rem; }
.pjob-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ── Duplicate detection badges ───────────────────────────────── */
.badge-DUPLICATE {
  background: #F3F4F6;
  color: #6B7280;
  cursor: help;
}
.badge-UPDATE_EXISTING {
  background: #FEF3C7;
  color: #92400E;
  cursor: help;
}

/* ── Regression checklist ─────────────────────────────────────── */
.regression-checklist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
  margin-bottom: 10px;
}
.regr-check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .12s, border-color .12s;
  user-select: none;
}
.regr-check-item:hover { background: var(--bg); border-color: var(--blue-dark); }
.regr-check-item.verified {
  background: var(--green-light);
  border-color: var(--green);
}
.regr-verify-cb {
  margin-top: 2px;
  width: 16px; height: 16px;
  accent-color: var(--green);
  cursor: pointer;
  flex-shrink: 0;
}
.regr-check-body { flex: 1; }
.regr-check-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.regr-check-name {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--dark);
}
.regr-check-reason {
  font-size: 0.75rem;
  color: var(--blue-dark);
  margin-top: 3px;
  font-style: italic;
  line-height: 1.45;
}
.regr-check-objective {
  font-size: 0.78rem;
  color: var(--body);
  margin-top: 3px;
  line-height: 1.45;
  opacity: 0.85;
}
.regr-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.regr-risk-badge {
  font-size: 0.71rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.regr-risk-HIGH   { background: #FEE2E2; color: #B91C1C; }
.regr-risk-MEDIUM { background: #FEF3C7; color: #B45309; }
.regr-risk-LOW    { background: #D1FAE5; color: #065F46; }
.regr-scope-badge {
  font-size: 0.71rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--blue-light);
  color: var(--blue-dark);
  white-space: nowrap;
}

/* ── Screenshot panel ─────────────────────────────────────────── */
.screenshot-count-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--blue-light);
  color: var(--blue-dark);
  white-space: nowrap;
}

.screenshot-drop-zone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  position: relative;
}
.screenshot-drop-zone:hover,
.screenshot-drop-zone.drag-over {
  border-color: var(--blue);
  background: var(--blue-xlight);
}
.screenshot-drop-zone.uploading {
  opacity: 0.6;
  pointer-events: none;
}
.screenshot-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
  pointer-events: none;
}
.screenshot-drop-inner > label { pointer-events: all; }
.screenshot-browse-link {
  color: var(--blue);
  cursor: pointer;
  text-decoration: underline;
  font-weight: 500;
}

.screenshot-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.screenshot-thumb {
  width: 130px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .15s, box-shadow .15s;
}
.screenshot-thumb:has(.screenshot-include-cb:checked) {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(58,155,213,.15);
}

.screenshot-thumb-img-wrap {
  position: relative;
  width: 100%;
  height: 84px;
  background: #f0f0f0;
  overflow: hidden;
}
.screenshot-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.screenshot-delete-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .12s;
  line-height: 1;
  padding: 0;
}
.screenshot-thumb-img-wrap:hover .screenshot-delete-btn { opacity: 1; }

.screenshot-thumb-footer {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 6px 4px;
  cursor: pointer;
}
.screenshot-include-cb {
  flex-shrink: 0;
  accent-color: var(--blue);
  cursor: pointer;
}
.screenshot-thumb-name {
  font-size: 0.7rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.screenshot-thumb-label {
  font-size: 0.68rem;
  color: var(--blue-dark);
  padding: 0 6px 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Test-type info button ────────────────────────────────────── */
.type-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--blue-light);
  color: var(--blue-dark);
  font-size: 0.6rem;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
  border: 1px solid rgba(58,155,213,.3);
  vertical-align: middle;
  transition: background .12s, color .12s;
  user-select: none;
  line-height: 1;
}
.type-info-btn:hover,
.type-info-btn:focus {
  background: var(--blue);
  color: #fff;
  outline: none;
  border-color: var(--blue);
}

/* ── Test-type tooltip popup ─────────────────────────────────── */
.type-info-tooltip {
  position: absolute;
  z-index: 9999;
  width: 420px;
  max-width: calc(100vw - 16px);
  background: var(--surface);
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: none;
  font-size: 0.8rem;
  line-height: 1.5;
  overflow: hidden;
}

.tti-header {
  padding: 10px 14px 8px;
  background: linear-gradient(to right, var(--blue-xlight), #fff);
  border-bottom: 1px solid var(--border);
}
.tti-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--blue-dark);
}

.tti-definition {
  padding: 10px 14px 8px;
  color: var(--body);
  line-height: 1.55;
  border-bottom: 1px solid var(--border);
}

.tti-example-label {
  padding: 7px 14px 5px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--bg);
}

.tti-cases {
  padding: 4px 0 6px;
  max-height: 220px;
  overflow-y: auto;
}

.tti-case {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 14px;
  font-size: 0.78rem;
  border-radius: 0;
}
.tti-case:hover { background: var(--bg); }

.tti-case-label {
  flex: 1;
  color: var(--body);
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.74rem;
}
.tti-case-result {
  flex-shrink: 0;
  font-weight: 600;
  font-size: 0.74rem;
}
.tti-pass .tti-case-result { color: var(--green-dark); }
.tti-fail .tti-case-result { color: var(--error); }


/* ═══ MODIFY EXISTING TESTS ══════════════════════════════════════ */

/* btn-outline: blue border, transparent bg */
.btn-outline { background: transparent; color: var(--blue); border-color: var(--blue); }
.btn-outline:hover:not(:disabled) { background: var(--blue-light); box-shadow: var(--shadow-sm); }

/* ── Home action cards grid ───────────────────────────────────── */
.home-action-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}
@media (max-width: 680px) { .home-action-cards { grid-template-columns: 1fr; } }

.home-action-card .card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}
.home-action-icon {
  font-size: 1.8rem;
  line-height: 1;
  margin-bottom: 4px;
}
.home-action-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--dark);
}
.home-action-desc {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.45;
}

/* Dashboard badge for modify jobs */
.pjob-badge--modify {
  background: rgba(109,190,69,.12);
  color: var(--green-dark);
  border: 1px solid rgba(109,190,69,.25);
}

/* ── Folder browser ───────────────────────────────────────────── */
.folder-browser-wrap {
  margin-top: 10px;
  border: 1.5px solid var(--border-dark);
  border-radius: var(--radius-sm);
  background: var(--surface);
  max-height: 280px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.folder-tree { padding: 8px 0; }
.folder-tree-node { user-select: none; }
.folder-tree-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.84rem;
  color: var(--body);
  border-radius: 0;
  transition: background .1s;
  white-space: nowrap;
}
.folder-tree-row:hover { background: var(--blue-xlight); color: var(--blue); }
.folder-tree-row.selected { background: var(--blue-light); color: var(--blue-dark); font-weight: 600; }
.folder-tree-toggle {
  width: 14px;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.68rem;
  color: var(--light);
  cursor: pointer;
}
.folder-tree-toggle.has-children { color: var(--muted); }
.folder-icon { font-size: 0.85rem; flex-shrink: 0; }
.folder-children { padding-left: 18px; }
.folder-browser-loading {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
}
.folder-browser-empty {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.84rem;
}

/* ── Modify folder info bar ───────────────────────────────────── */
.modify-folder-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--blue-xlight);
  border: 1px solid rgba(58,155,213,.2);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  color: var(--body);
  margin-bottom: 16px;
}
.modify-folder-info:empty { display: none; }
.modify-folder-path {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.82rem;
  color: var(--blue-dark);
  font-weight: 600;
}

/* ── Modification card ────────────────────────────────────────── */
.mod-card {
  background: rgba(255,255,255,.97);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color .15s;
}
.mod-card.has-changes { border-color: rgba(58,155,213,.4); }
.mod-card.unchanged { opacity: .65; }
.mod-card.applied { border-color: rgba(109,190,69,.5); background: rgba(109,190,69,.04); }

.mod-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  user-select: none;
}
.mod-card-header:hover { background: var(--blue-xlight); }
.mod-card.open .mod-card-header { background: var(--blue-xlight); }

.mod-key-badge {
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--blue);
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  flex-shrink: 0;
  font-family: 'SFMono-Regular', Consolas, monospace;
}
.mod-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mod-change-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.mod-change-badge.changed {
  background: rgba(58,155,213,.15);
  color: var(--blue-dark);
}
.mod-change-badge.unchanged {
  background: var(--bg);
  color: var(--light);
  border: 1px solid var(--border);
}
.mod-change-badge.applied {
  background: var(--green-light);
  color: var(--green-dark);
}
.mod-select-cb { width: 16px; height: 16px; cursor: pointer; flex-shrink: 0; }
.mod-expand-arrow {
  color: var(--light);
  font-size: 0.7rem;
  transition: transform .2s;
  flex-shrink: 0;
}
.mod-card.open .mod-expand-arrow { transform: rotate(180deg); }

.mod-card-body { display: none; padding: 0; }
.mod-card.open .mod-card-body { display: block; }

.mod-change-summary {
  padding: 10px 16px;
  font-size: 0.82rem;
  color: var(--body);
  background: rgba(58,155,213,.05);
  border-bottom: 1px solid var(--border);
  font-style: italic;
}

/* Diff tabs */
.mod-diff-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.mod-diff-tab {
  padding: 8px 18px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  font-family: inherit;
}
.mod-diff-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.mod-diff-tab:hover:not(.active) { color: var(--body); background: var(--blue-xlight); }

.mod-diff-pane { display: none; padding: 14px 16px; }
.mod-diff-pane.active { display: block; }

/* Field rows in diff */
.mod-field { margin-bottom: 12px; }
.mod-field-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.mod-field-value {
  font-size: 0.84rem;
  color: var(--body);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  white-space: pre-wrap;
  word-break: break-word;
}
.mod-field-value.proposed { background: rgba(58,155,213,.08); border-left: 3px solid var(--blue); }
.mod-field-value.empty-val { color: var(--light); font-style: italic; font-size: 0.78rem; }

/* Steps in diff */
.mod-steps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 6px;
}
.mod-steps-table th {
  text-align: left;
  padding: 5px 8px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.mod-steps-table td {
  padding: 6px 8px;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  color: var(--body);
}
.mod-steps-table tr:last-child td { border-bottom: none; }
.mod-step-num {
  font-weight: 700;
  color: var(--muted);
  font-size: 0.75rem;
  width: 28px;
  text-align: center;
}
.mod-step-action { min-width: 200px; }
.mod-step-data { min-width: 100px; color: var(--muted); font-size: 0.78rem; }
.mod-step-expected { min-width: 200px; color: var(--body); }
.mod-diff-pane.proposed-pane .mod-steps-table {
  background: rgba(58,155,213,.04);
}
.mod-diff-pane.proposed-pane .mod-steps-table tr td { border-bottom-color: rgba(58,155,213,.12); }

/* ── Document upload zone ───────────────────────────────────────── */
.doc-drop-zone {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  background: var(--bg);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.doc-drop-zone.drag-over {
  border-color: var(--blue);
  background: var(--blue-xlight);
}
.doc-drop-zone.uploading {
  opacity: .7;
  pointer-events: none;
}
.doc-drop-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.875rem;
}
.doc-drop-icon { font-size: 1.5rem; }

/* Doc file list */
.doc-file-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.doc-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.doc-file-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.doc-file-badge--pdf  { background: #FEE2E2; color: #DC2626; }
.doc-file-badge--docx { background: #DBEAFE; color: #2563EB; }
.doc-file-badge--xlsx { background: #D1FAE5; color: #059669; }
.doc-file-badge--txt  { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.doc-file-badge--md   { background: #F3F4F6; color: #374151; }
.doc-file-badge--csv  { background: #ECFDF5; color: #047857; }
.doc-file-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--body);
}
.doc-parse-status {
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  white-space: nowrap;
}
.doc-parse-status--ok        { background: var(--green-light); color: var(--green-dark); }
.doc-parse-status--truncated { background: var(--warning-light); color: var(--warning); }
.doc-parse-status--failed    { background: var(--error-light); color: var(--error); }
.doc-parse-status--uploading { background: var(--bg); color: var(--muted); }
.doc-file-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.doc-file-delete:hover { color: var(--error); background: var(--error-light); }

/* Docgen dashboard badge */
.pjob-badge--docgen { background: #EDE9FE; color: #7C3AED; }

/* ── Breadcrumb ───────────────────────────────────────────────────── */
.app-breadcrumb {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 0 18px;
  flex-wrap: wrap;
}
.bc-sep {
  color: var(--light);
  font-size: 0.78rem;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
}
.bc-link {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--blue);
  cursor: pointer;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.bc-link:hover {
  background: var(--blue-xlight);
  color: var(--blue-dark);
}
.bc-current {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--dark);
  padding: 4px 9px;
  background: rgba(255,255,255,.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  line-height: 1;
  white-space: nowrap;
}

/* ── Modify feedback UI ─────────────────────────────────────────── */
.btn-secondary {
  background: var(--blue-xlight);
  color: var(--blue);
  border-color: rgba(58,155,213,.35);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(58,155,213,.18);
  border-color: var(--blue);
  box-shadow: var(--shadow-sm);
}

.mod-global-feedback-bar {
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(58,155,213,.3);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mod-global-feedback-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.mod-global-feedback-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--blue-dark);
}
.mod-global-feedback-hint {
  font-size: 0.78rem;
  color: var(--muted);
}
.mod-global-feedback-input {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--body);
  background: var(--surface);
  transition: border-color .15s;
  box-sizing: border-box;
}
.mod-global-feedback-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(58,155,213,.12);
}

.mod-feedback-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 8px 16px 4px;
  padding: 5px 11px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.mod-feedback-toggle:hover { background: var(--blue-xlight); color: var(--blue); border-color: rgba(58,155,213,.4); }
.mod-feedback-toggle.active { background: var(--blue-xlight); color: var(--blue); border-color: var(--blue); }

.mod-feedback-section {
  padding: 4px 16px 12px;
}
.mod-feedback-section.hidden { display: none; }
.mod-feedback-input {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.84rem;
  font-family: inherit;
  color: var(--body);
  background: var(--surface);
  transition: border-color .15s;
  box-sizing: border-box;
}
.mod-feedback-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(58,155,213,.12);
}

/* ── Re-analyse checkbox on mod cards ───────────────────────────── */
.mod-reanalyse-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  margin-right: 8px;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}
.mod-reanalyse-label input[type="checkbox"] {
  accent-color: var(--blue);
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.mod-reanalyse-label-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  transition: color .15s;
}
.mod-reanalyse-label:hover .mod-reanalyse-label-text,
.mod-reanalyse-label input:checked ~ .mod-reanalyse-label-text {
  color: var(--blue);
}
