/* ── Reset & tokens ── */
:root {
  --bg: #0a0a0f;
  --bg-2: #111118;
  --bg-3: #1a1a24;
  --surface: #16161f;
  --surface-2: #1e1e2a;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --text: #e8e8f0;
  --text-2: #9898b0;
  --text-3: #5c5c74;
  --accent: #6c63ff;
  --accent-glow: rgba(108,99,255,0.25);
  --accent-hover: #7d75ff;
  --green: #22c55e;
  --green-bg: rgba(34,197,94,0.1);
  --red: #f87171;
  --red-bg: rgba(248,113,113,0.1);
  --amber: #fbbf24;
  --amber-bg: rgba(251,191,36,0.1);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
  --font: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --mono: 'SFMono-Regular', Consolas, monospace;
  --transition: 160ms ease;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4 { line-height: 1.2; font-weight: 600; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p  { color: var(--text-2); }

button, input, select, textarea { font: inherit; }

/* ── Utilities ── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.hidden  { display: none !important; }
[hidden] { display: none !important; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-weight: 500;
  padding: 0 14px; height: 36px;
  transition: background var(--transition), border-color var(--transition), opacity var(--transition), transform var(--transition);
  border: 1px solid transparent;
  white-space: nowrap; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-ghost {
  background: transparent; color: var(--text-2); border-color: var(--border-strong);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }

.btn-danger-ghost {
  background: transparent; color: var(--red); border-color: rgba(248,113,113,0.25);
}
.btn-danger-ghost:hover:not(:disabled) { background: var(--red-bg); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

.file-trigger { cursor: pointer; }

/* ── Toast ── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 12px 16px;
  box-shadow: var(--shadow-lg); pointer-events: all;
  animation: slideIn .2s ease forwards;
  font-size: 13px; max-width: 340px;
}
.toast.error   { border-left: 3px solid var(--red); }
.toast.success { border-left: 3px solid var(--green); }
@keyframes slideIn { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform: translateY(0); } }
@keyframes slideOut { to { opacity:0; transform: translateY(12px); } }
.toast.removing { animation: slideOut .2s ease forwards; }

/* ── Header ── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  padding: 0 24px; height: 56px;
}

.brand-lockup { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 0 16px var(--accent-glow);
}
.brand-lockup-text { display: flex; flex-direction: column; }
.brand-name    { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.1; }
.brand-subtitle { font-size: 11px; color: var(--text-3); line-height: 1.1; }

/* Tab nav */
.tab-nav {
  display: flex; gap: 2px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 3px;
  margin: 0 auto;
}
.tab-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; font-size: 12px; font-weight: 500;
  border-radius: 7px; border: none;
  background: transparent; color: var(--text-2);
  cursor: pointer; transition: background var(--transition), color var(--transition);
  position: relative;
}
.tab-btn:hover { color: var(--text); background: var(--surface-2); }
.tab-btn.active { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.tab-badge {
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1;
  padding: 2px 5px; border-radius: 99px; min-width: 16px; text-align: center;
}

/* Header meta */
.header-meta { display: flex; align-items: center; gap: 10px; flex-shrink: 0; margin-left: auto; }
.meta-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; padding: 5px 12px;
  font-size: 12px; color: var(--text-2);
}
.meta-chip strong { color: var(--text); }
.meta-label { color: var(--text-3); }
.meta-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}
.meta-dot.error { background: var(--red); box-shadow: 0 0 6px var(--red); }

/* ── Main layout ── */
.main-content { max-width: 1280px; margin: 0 auto; padding: 28px 24px 48px; }

/* ── Tab panels ── */
.tab-panel { animation: fadeUp .2s ease; }
@keyframes fadeUp { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* ── Brand Setup ── */
.panel-layout {
  display: grid; grid-template-columns: 220px 1fr; gap: 20px;
}

/* Sidebar */
.sidebar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  align-self: start; position: sticky; top: 76px;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-title { font-size: 13px; font-weight: 600; }
.brand-list { display: flex; flex-direction: column; gap: 4px; }
.brand-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; color: var(--text-2);
  border: 1px solid transparent;
  transition: all var(--transition);
  background: transparent;
  text-align: left; width: 100%;
}
.brand-item:hover { background: var(--surface-2); color: var(--text); }
.brand-item.active { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.brand-item-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent);
}
.brand-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-hint { font-size: 12px; color: var(--text-3); text-align: center; padding: 16px 0; }
.empty-hint.center { text-align: center; }

/* Form area */
.form-area {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.form-area-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
}
.form-area-actions { display: flex; gap: 8px; flex-shrink: 0; padding-top: 4px; }
.form-title { font-size: 20px; margin-top: 4px; }

/* Auto-populate Banner */
.auto-populate-banner {
  margin: 20px 24px;
  background: var(--surface-2);
  border: 1px solid rgba(108, 99, 255, 0.2);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.auto-populate-banner:hover {
  border-color: rgba(108, 99, 255, 0.4);
  box-shadow: 0 4px 16px rgba(108, 99, 255, 0.1);
}
.ap-banner-info {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.ap-banner-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: rgba(108, 99, 255, 0.15);
  color: var(--accent);
  flex-shrink: 0;
}
.ap-banner-info strong {
  display: block; font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.2; margin-bottom: 4px;
}
.ap-banner-info p {
  font-size: 12px; color: var(--text-2); margin: 0; line-height: 1.4;
}
.ap-banner-controls {
  display: flex; align-items: center;
  padding: 12px 16px;
  background: var(--bg-3);
  gap: 16px;
}
.ap-input-group {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0;
  position: relative;
}
.ap-input-icon {
  position: absolute; left: 10px; color: var(--text-3); pointer-events: none;
}
.ap-input-group input {
  width: 100%; height: 34px; padding-left: 32px; padding-right: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 13px; margin: 0;
  box-shadow: none !important;
}
.ap-input-group input:focus {
  border-color: var(--accent); outline: none;
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
}
.ap-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-3); font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.ap-divider::before, .ap-divider::after {
  content: ""; display: block; width: 1px; height: 16px; background: var(--border-strong);
}
.ap-upload-group {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}

/* File indicator (used in auto-populate banner) */
.file-indicator {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: rgba(108,99,255,0.08);
  border-top: 1px solid rgba(108,99,255,0.2);
  font-size: 12px; color: var(--text-2);
}
.file-indicator svg { color: var(--accent); flex-shrink: 0; }
.file-indicator span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-clear {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-3); padding: 2px; line-height: 1;
  border-radius: 4px; flex-shrink: 0;
  display: inline-flex; align-items: center;
}
.file-clear:hover { color: var(--red); background: rgba(248,113,113,0.15); }

/* Accordion */
.accordion { border-bottom: 1px solid var(--border); }
.accordion-item { border-top: 1px solid var(--border); }
.accordion-trigger {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 14px 24px; background: none; border: none;
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-2);
  list-style: none; transition: color var(--transition);
}
.accordion-trigger:hover { color: var(--text); }
details[open] > .accordion-trigger { color: var(--text); }
.accordion-icon { color: var(--accent); display: inline-flex; }
.accordion-chevron { margin-left: auto; color: var(--text-3); transition: transform var(--transition); }
details[open] > .accordion-trigger .accordion-chevron { transform: rotate(180deg); }
.accordion-trigger::-webkit-details-marker { display: none; }

.accordion-body { padding: 4px 24px 20px; display: grid; gap: 14px; }
.accordion-body.two-col { grid-template-columns: 1fr 1fr; }

/* Fields */
.field { display: grid; gap: 6px; }
.field-label { font-size: 12px; font-weight: 500; color: var(--text-2); }
.required-star { color: var(--red); }
.field-hint { font-size: 11px; color: var(--text-3); }



input, select, textarea {
  width: 100%; background: var(--bg-3);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text); padding: 9px 12px; font-size: 13px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
select { cursor: pointer; appearance: none; }

.rules-editor {
  min-height: 140px; font-family: var(--mono); font-size: 12px;
  background: var(--bg); color: #a5f3a5; line-height: 1.6;
}

/* Color tag widget */
.color-tag-field {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-3); padding: 8px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.color-tag-field:focus-within {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}

.color-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  min-height: 0;
}
.color-tags:empty { display: none; }

.color-tag {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 8px 0 6px;
  border-radius: 99px; border: 1px solid rgba(255,255,255,0.12);
  background: var(--surface-2); cursor: default;
  font-size: 12px; font-weight: 500; color: var(--text);
  animation: tagIn .15s ease;
}
@keyframes tagIn { from { opacity:0; transform:scale(.85); } to { opacity:1; transform:scale(1); } }

.color-tag-dot {
  width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.3);
}
.color-tag-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  background: transparent; border: none; cursor: pointer;
  color: var(--text-3); padding: 0; line-height: 1;
  transition: background var(--transition), color var(--transition);
}
.color-tag-remove:hover { background: rgba(248,113,113,0.2); color: var(--red); }

.color-tag-inputs {
  display: flex; align-items: center; gap: 6px;
}

/* Color picker button */
.color-picker-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; flex-shrink: 0;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface-2); cursor: pointer; color: var(--text-2);
  transition: background var(--transition), color var(--transition);
  position: relative; overflow: hidden;
}
.color-picker-btn:hover { background: var(--surface); color: var(--text); }
.color-picker-btn input[type="color"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; border: none; padding: 0;
}

/* Hex text input */
.color-hex-input {
  flex: 1; height: 30px; min-width: 0;
  background: transparent; border: none; padding: 0 4px;
  font-family: var(--mono); font-size: 12px; color: var(--text);
  box-shadow: none !important;
}
.color-hex-input:focus { outline: none; }
.color-hex-input::placeholder { color: var(--text-3); font-family: var(--font); }

/* Add button */
.color-add-btn {
  display: inline-flex; align-items: center; gap: 4px;
  height: 26px; padding: 0 10px; flex-shrink: 0;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-2);
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.color-add-btn:hover { background: var(--surface-2); color: var(--text); }


/* Form footer */
.form-footer {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 16px 24px; border-top: 1px solid var(--border);
  background: var(--bg-2);
}

/* ── Reviewer Tab ── */
.reviewer-layout { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; }

.panel-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.panel-card-header {
  padding: 20px 20px 16px; border-bottom: 1px solid var(--border);
}
.panel-card-title-group h2 { font-size: 18px; margin-top: 4px; }

#reviewForm { display: grid; gap: 16px; padding: 20px; }
.review-form-actions { display: grid; gap: 10px; }

.select-wrapper { position: relative; }
.select-wrapper select { padding-right: 32px; }
.select-arrow {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  pointer-events: none; color: var(--text-3);
}

.model-select-button {
  width: 100%; height: 40px; padding: 0 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); cursor: pointer;
  text-align: left; transition: border-color var(--transition), background var(--transition);
}
.model-select-button:hover:not(:disabled) { background: var(--surface-2); border-color: var(--border-strong); }
.model-select-button:disabled { opacity: .55; cursor: not-allowed; }
#selectedModelLabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(0,0,0,.62);
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: min(520px, 100%); max-height: min(640px, calc(100vh - 40px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.modal-close {
  width: 30px; height: 30px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--bg-2);
  color: var(--text-2); cursor: pointer;
}
.modal-close:hover { color: var(--text); border-color: var(--border-strong); }
.model-list { display: grid; gap: 8px; padding: 14px; overflow: auto; }
.model-option {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--bg-2); color: inherit; text-align: left; cursor: pointer;
}
.model-option:hover,
.model-option.active { border-color: var(--accent); background: rgba(108,99,255,.08); }
.model-option-main { min-width: 0; display: grid; gap: 2px; }
.model-option-name { font-size: 13px; font-weight: 600; color: var(--text); }
.model-option-id { font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-option-check { width: 20px; color: var(--accent); flex-shrink: 0; }

/* Upload zone */
.upload-zone {
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: border-color var(--transition), background var(--transition);
  position: relative; min-height: 140px;
}
.upload-zone:hover { border-color: var(--accent); background: rgba(108,99,255,0.04); }
.upload-zone.drag-over { border-color: var(--accent); background: rgba(108,99,255,0.08); }
.upload-input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; z-index: 2;
}
.upload-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 28px 20px; text-align: center; pointer-events: none;
}
.upload-icon { color: var(--text-3); }
.upload-label { font-size: 13px; color: var(--text-2); }
.upload-link { color: var(--accent); }
.upload-hint { font-size: 11px; color: var(--text-3); }

.saved-logo-list {
  display: grid; gap: 8px; margin: 8px 0 12px;
}
.saved-logo-list-header {
  font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em;
}
.saved-logo-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px;
}
.saved-logo-item {
  min-width: 0; display: grid; gap: 8px; justify-items: center; padding: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-2);
}
.saved-logo-item img {
  width: 100%; max-height: 76px; object-fit: contain;
}
.saved-logo-item span {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; color: var(--text-2);
}

.upload-preview {
  position: relative; margin: 0;
  background: var(--bg-3); display: flex; align-items: center; justify-content: center;
}
.upload-preview img { display: block; max-width: 100%; max-height: 220px; object-fit: contain; }
.upload-preview img:not([src]) { display: none; }
.logo-preview-grid {
  width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; padding: 12px;
}
.logo-preview-item {
  min-width: 0; display: grid; gap: 8px; justify-items: center; padding: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg);
}
.logo-preview-item img { max-height: 96px; }
.logo-preview-item span {
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; color: var(--text-2);
}
.upload-clear {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(10,10,15,0.8); border: 1px solid var(--border-strong);
  color: var(--text); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.upload-clear:hover { background: var(--red-bg); border-color: var(--red); color: var(--red); }

/* Results column */
.reviewer-results-col { display: flex; flex-direction: column; gap: 16px; }

/* Loading card */
.loading-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px 20px;
  color: var(--text-2); font-size: 13px;
}
.spinner {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border-strong); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Summary card */
.summary-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.summary-scores {
  display: grid; grid-template-columns: repeat(4,1fr);
  border-bottom: 1px solid var(--border);
}
.summary-stat { padding: 16px 20px; }
.summary-stat:not(:last-child) { border-right: 1px solid var(--border); }
.summary-stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 4px; }
.summary-stat-value { font-size: 22px; font-weight: 700; color: var(--text); }
.summary-stat-value.pass { color: var(--green); }
.summary-stat-value.fail { color: var(--red); }
.summary-stat-value.review { color: var(--amber); }
.summary-recommendation { padding: 14px 20px; font-size: 13px; color: var(--text-2); line-height: 1.55; border-bottom: 1px solid var(--border); }
.summary-meta { padding: 10px 20px; font-size: 11px; color: var(--text-3); display: flex; gap: 12px; }
.summary-meta-chip {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 99px;
  padding: 2px 8px; font-size: 11px; color: var(--text-3);
}

/* Results empty */
.results-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 60px 24px; text-align: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.results-empty-icon { color: var(--text-3); }
.results-empty-title { font-size: 15px; font-weight: 600; color: var(--text-2); }
.results-empty-hint { font-size: 13px; color: var(--text-3); max-width: 280px; }
.results-empty-hint strong { color: var(--text-2); }

/* Rule results */
.results-list { display: grid; gap: 10px; }
.rule-result {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  transition: border-color var(--transition);
}
.rule-result.pass { border-left-color: var(--green); }
.rule-result.fail { border-left-color: var(--red); }
.rule-result.review { border-left-color: var(--amber); }

.rule-result-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.rule-result-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.35; }
.rule-badges { display: flex; gap: 6px; flex-shrink: 0; }
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 99px; white-space: nowrap;
}
.badge-pass { background: var(--green-bg); color: var(--green); }
.badge-fail { background: var(--red-bg); color: var(--red); }
.badge-review { background: var(--amber-bg); color: var(--amber); }
.badge-neutral { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

.rule-result-body { display: grid; gap: 6px; }
.rule-result-body p { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.rule-result-body b { color: var(--text); }
.rule-fix {
  background: var(--bg-3); border-radius: var(--radius-sm); padding: 8px 12px;
  font-size: 12px; color: var(--text-2); margin-top: 4px;
}
.rule-fix b { color: var(--amber); }
.confidence-bar { height: 3px; background: var(--bg-3); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.confidence-bar-fill { height: 100%; background: var(--accent); border-radius: 99px; transition: width .5s ease; }

/* ── Audit Trail ── */
.history-layout { display: grid; gap: 20px; }
.history-header { display: flex; align-items: flex-end; justify-content: space-between; }
.history-count { font-size: 13px; color: var(--text-3); }
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

.history-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0 0 14px;
  display: flex; flex-direction: column; gap: 10px;
  color: inherit; cursor: pointer; font: inherit; text-align: left; width: 100%;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
}
.history-card:hover,
.history-card.active { border-color: var(--border-strong); transform: translateY(-1px); }
.history-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.history-card-image {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  background: var(--bg-3); border-bottom: 1px solid var(--border);
}
.history-card-image-empty {
  display: block;
  background:
    linear-gradient(135deg, transparent 0 45%, var(--border) 45% 55%, transparent 55% 100%),
    var(--bg-3);
}
.history-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.history-card-top,
.history-card-body,
.history-card-footer { margin-left: 16px; margin-right: 16px; }
.history-card-brand { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-card-body { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--border); }
.history-card-score { font-size: 11px; color: var(--text-3); }
.history-card-score span { color: var(--text-2); font-weight: 600; }
.history-card-model {
  margin-left: 16px; margin-right: 16px;
  font-size: 11px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Settings ── */
.settings-layout { display: grid; gap: 18px; max-width: 1180px; margin: 0 auto; }
.settings-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.settings-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); padding: 18px;
}
.settings-card-header { display: grid; gap: 4px; margin-bottom: 14px; }
.settings-copy { font-size: 13px; color: var(--text-2); }
.how-it-works-card { display: grid; gap: 2px; }
.how-it-works-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
}
.how-it-works-step {
  display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start;
  padding-top: 12px; border-top: 1px solid var(--border);
}
.how-it-works-number {
  width: 24px; height: 24px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(108,99,255,.12); color: var(--accent-hover);
  font-size: 11px; font-weight: 700;
}
.how-it-works-step strong { display: block; font-size: 13px; color: var(--text); }
.how-it-works-step p { margin-top: 4px; font-size: 12px; color: var(--text-2); }
.prompt-file-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.prompt-file-item {
  display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-2);
}
.prompt-file-icon {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent); background: rgba(108,99,255,.12);
}
.prompt-file-item strong { display: block; font-size: 13px; color: var(--text); }
.prompt-file-item span { display: block; margin-top: 2px; font-size: 11px; color: var(--accent-hover); }
.prompt-file-item p { margin-top: 6px; font-size: 12px; color: var(--text-2); }
.prompt-editor-grid { display: grid; gap: 14px; }
.prompt-pipeline {
  display: grid; gap: 10px;
}
.prompt-pipeline-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-2);
}
.prompt-pipeline-row span,
.prompt-pipeline-row b {
  display: inline-flex; align-items: center; min-height: 28px; padding: 5px 10px;
  border-radius: 999px; font-size: 12px; white-space: nowrap;
}
.prompt-pipeline-row span { color: var(--text-2); background: var(--bg-3); }
.prompt-pipeline-row b { color: var(--accent-hover); background: rgba(108,99,255,.12); font-weight: 600; }
.prompt-pipeline-row span:not(:last-child)::after,
.prompt-pipeline-row b:not(:last-child)::after {
  content: "→"; color: var(--text-3); margin-left: 10px;
}
.prompt-section-heading {
  display: grid; gap: 2px; padding: 2px 2px 0;
}
.prompt-editor {
  display: grid; gap: 10px; padding: 16px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.prompt-editor-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.prompt-editor-title { font-size: 14px; font-weight: 600; color: var(--text); }
.prompt-editor-copy { font-size: 12px; color: var(--text-2); }
.prompt-source-list { display: grid; gap: 8px; }
.prompt-source-note {
  display: grid; gap: 3px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-2);
}
.prompt-source-note strong { font-size: 12px; color: var(--text); }
.prompt-source-note span { font-size: 12px; color: var(--text-2); }
.prompt-placeholder-row { min-height: 26px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.placeholder-chip {
  width: auto; border: 1px solid rgba(108,99,255,.3); border-radius: 999px;
  background: rgba(108,99,255,.1); color: var(--accent-hover);
  padding: 5px 9px; font-size: 11px; cursor: default;
}
.placeholder-chip:hover { border-color: var(--accent); background: rgba(108,99,255,.18); }
.prompt-no-placeholders { font-size: 11px; color: var(--text-3); }
.prompt-editor textarea { min-height: 180px; font-family: var(--mono); font-size: 12px; line-height: 1.55; }
.prompt-advanced {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.prompt-advanced > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px; cursor: pointer;
}
.prompt-advanced > summary span:first-child { display: grid; gap: 3px; }
.prompt-advanced > summary strong { font-size: 14px; color: var(--text); }
.prompt-advanced-hint { font-size: 12px; color: var(--text-3); }
.prompt-advanced .prompt-editor {
  border: 0; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); box-shadow: none;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .panel-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .reviewer-layout { grid-template-columns: 1fr; }
  .how-it-works-grid { grid-template-columns: 1fr; }
  .prompt-file-grid { grid-template-columns: 1fr; }
  .tab-nav { display: none; }
  .header-inner { flex-wrap: wrap; height: auto; padding: 12px 16px; }
  .header-meta { margin-left: 0; }
  .summary-scores { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .main-content { padding: 16px; }
  .accordion-body.two-col { grid-template-columns: 1fr; }
  .summary-scores { grid-template-columns: 1fr; }
  .history-grid { grid-template-columns: 1fr; }
  .form-area-header { flex-direction: column; }
  .ap-banner-controls { flex-direction: column; align-items: stretch; }
  .ap-divider { flex-direction: row; justify-content: center; }
  .ap-divider::before, .ap-divider::after { width: 30px; height: 1px; }
  .ap-upload-group { flex-direction: column; align-items: stretch; }
  .ap-upload-group .btn { width: 100%; justify-content: center; }
  .settings-header { align-items: flex-start; flex-direction: column; }
  .prompt-editor-header { flex-direction: column; }
}
