/* ── Base ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 19.5px; scroll-padding-top: 4rem; }
body {
  font-family: 'Figtree', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Login is on /v2/login.html — app redirects there if unauthenticated */

/* ── App Shell ── */
#app { display: none; }

.app-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  height: 3.7rem;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.header-brand {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
  width: 10rem;
  flex-shrink: 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  align-self: stretch;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
}
.header-brand.welcome-active {
  border-color: var(--accent);
}
.header-tabs {
  flex: 1;
  display: flex;
  justify-content: center;
  overflow-x: auto;
  overflow-y: hidden;
  align-self: stretch;
  scrollbar-width: none;
}
.header-tabs::-webkit-scrollbar { display: none; }
.header-tabs .tb-bar {
  height: 100%;
}
.header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  width: 9rem;
  justify-content: flex-end;
}
.header-actions button {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}
.header-actions button:hover {
  color: var(--accent);
}
.hdr-icon {
  width: 1.05rem;
  height: 1.05rem;
  background: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

/* ── Main Content ── */
.app-main {
  padding: 12px 20px 20px;
  padding-top: calc(3.7rem + 12px); /* clear fixed header */
}

/* ── Stream Sections ── */
.stream-section {
  max-width: 42rem;
  margin: 0 auto;
  padding-bottom: 1.5rem;
}
/* Section headers removed — tab bar serves as section indicator */

/* ── Cards ── */
.g-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 16px;
  position: relative;
}
/* Accent-highlighted helper cards — thin left edge */
.g-card.accent-card {
  border-left: 3px solid var(--accent);
}

/* ── Card Chat Button ── */
/* Card action buttons — hang off top-right edge */
.card-actions {
  position: absolute;
  top: -10px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.2s;
}
.g-card:hover .card-actions { opacity: 1; }
.card-action-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.card-action-btn:hover { background: var(--accent); }
.card-action-btn .ca-icon {
  width: 15px;
  height: 15px;
  background: var(--text-dim);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}
.card-action-btn:hover .ca-icon { background: #fff; }
/* old single-button styles removed — using .card-actions now */

/* ── AI Response Card (inserted after source card) ── */
.ai-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  line-height: 1.6;
  position: relative;
}
.ai-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.75rem;
  color: var(--text-dim);
}
.ai-card-header .ai-icon {
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-card-header .ai-icon span {
  width: 11px;
  height: 11px;
  background: #fff;
  -webkit-mask-image: url(/assets/chat.svg);
  mask-image: url(/assets/chat.svg);
  -webkit-mask-size: contain;
  mask-size: contain;
  display: block;
}
.ai-card-dismiss {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
}
.ai-card-dismiss:hover { color: var(--text); }
.ai-card-question {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text);
}
.ai-card-user-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  background: var(--text-dim);
  -webkit-mask-image: url(/assets/profile.svg);
  mask-image: url(/assets/profile.svg);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  margin-top: 1px;
}
.ai-card-body p { margin: 0 0 8px; }
.ai-card-body p:last-child { margin-bottom: 0; }
.ai-card-body ul, .ai-card-body ol { margin: 0 0 8px; padding-left: 1.5em; }
.ai-card-body li { margin-bottom: 4px; }
.ai-card-body code { background: rgba(128,128,128,0.15); padding: 1px 5px; border-radius: 3px; font-size: 0.85em; }
.ai-card-body pre { background: var(--bg); padding: 10px 12px; border-radius: 6px; overflow-x: auto; margin: 8px 0; }
.ai-card-body pre code { background: none; padding: 0; }

/* Collapsed chat buttons (at bottom of source card) */
.collapsed-chats {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.collapsed-chat-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: var(--panel);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.collapsed-chat-btn:hover { background: var(--accent); }
.collapsed-chat-btn .ca-icon {
  width: 14px;
  height: 14px;
  background: var(--accent);
}
.collapsed-chat-btn:hover .ca-icon { background: #fff; }

/* AI thinking indicator */
.ai-thinking {
  color: var(--text-dim);
  font-size: 0.85rem;
  animation: aiPulse 1.5s ease-in-out infinite;
}
@keyframes aiPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* ── Section Gates ── */
.stream-section.locked { display: none; }
.gate-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 18px 24px;
  margin-bottom: 16px;
  display: none;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 0.88rem;
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
  margin-top: -1rem;
}
.gate-card.active { display: flex; }
.gate-card .gate-icon {
  width: 22px;
  height: 22px;
  background: var(--accent);
  -webkit-mask-image: url(/assets/shield-check.svg);
  mask-image: url(/assets/shield-check.svg);
  -webkit-mask-size: contain;
  mask-size: contain;
  flex-shrink: 0;
}
.gate-card.cleared { display: none; }
.g-card h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.g-card h2::before {
  content: '';
  width: 10px;
  height: 10px;
  background: var(--accent);
  flex-shrink: 0;
}
.g-card .card-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 18px;
  line-height: 1.5;
}
.g-card .card-desc:last-child {
  margin-bottom: 0;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.field-row:last-child { margin-bottom: 0; }
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.field:last-child { margin-bottom: 0; }
.field label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ai-help-link {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
  padding: 1px 8px;
  border: 1px solid var(--accent);
  border-radius: 9999px;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1.6;
}
.field:focus-within .ai-help-link { opacity: 1; }
.ai-help-link:hover { background: var(--accent); color: #fff; text-decoration: none; }
.url-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 9999px;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1.6;
  transition: opacity 0.3s;
}
.url-badge.verified { color: var(--accent); border: 1px solid var(--accent); }
.url-badge.failed { color: var(--red, #e55); border: 1px solid var(--red, #e55); }
.url-badge.checking { color: var(--text-dim); border: 1px solid var(--text-dim); animation: advPulse 1.2s infinite; }
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(80, 200, 120, 0.12);
}
.field textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

/* ── Resume editor (CodeMirror) ── */
#sec-resume-toolbar .CodeMirror {
  height: 50vh;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.7rem;
  line-height: 1.6;
  background: var(--panel);
  color: var(--text);
  border: none;
  border-radius: 0 0 10px 10px;
}
#sec-resume-toolbar .CodeMirror-scroll {
  overscroll-behavior: contain;
}
#sec-resume-toolbar .CodeMirror-gutters {
  background: var(--bg);
  border-right: 1px solid var(--border);
}
#sec-resume-toolbar .CodeMirror-linenumber { color: var(--text-dim); }
#sec-resume-toolbar .CodeMirror-cursor { border-left-color: var(--accent); }
#sec-resume-toolbar .CodeMirror-selected { background: rgba(100, 100, 200, 0.3); }
#sec-resume-toolbar .CodeMirror-focused .CodeMirror-selected { background: rgba(100, 100, 200, 0.4); }
.cm-s-default .cm-header { color: var(--accent); }
.cm-s-default .cm-strong { color: var(--text); font-weight: 700; }
.cm-s-default .cm-em { color: var(--text); font-style: italic; }
.cm-s-default .cm-link { color: var(--accent); }
.cm-s-default .cm-url { color: var(--text-dim); }
.cm-s-default .cm-keyword { color: #c678dd; }
.cm-s-default .cm-tag { color: #e06c75; }
.cm-s-default .cm-string { color: #98c379; }
.cm-s-default .cm-comment { color: var(--text-dim); }
[data-theme="artistry"] #sec-resume-toolbar .CodeMirror,
[data-theme="industry"] #sec-resume-toolbar .CodeMirror { border-radius: 0; }

/* ── Buttons ── */
.g-btn {
  padding: 7px 16px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.g-btn:hover { border-color: var(--accent); color: var(--accent); }
.g-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.g-btn.primary:hover { opacity: 0.85; }
.g-btn.small { padding: 7px 12px; font-size: 0.85rem; }
.g-btn.danger { color: var(--red, #e55); border-color: var(--red, #e55); }
.g-btn.danger:hover { background: var(--red, #e55); color: #fff; }
/* ── Timeline ── */
.tl-entry {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 16px;
  border-left: 6px solid var(--accent);
}
.tl-entry.education { border-left-color: #8b5cf6; }
.tl-entry.certification { border-left-color: #10b981; }
.tl-entry.license { border-left-color: #f59e0b; }
.tl-entry.award { border-left-color: #ef4444; }
.tl-entry.project { border-left-color: #3b82f6; }
.tl-dates {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.tl-title {
  font-size: 0.9rem;
  font-weight: 600;
}
.tl-org {
  font-size: 0.85rem;
  color: var(--text-dim);
}
.tl-desc {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.4;
}
.tl-desc ul, .tl-desc ol { padding-left: 1.2em; margin: 4px 0; }
.tl-desc p { margin: 4px 0; }
#timeline-form .field input,
#timeline-form .field textarea,
#timeline-form .field select { font-size: 0.8rem; padding: 7px 10px; }
#timeline-form .field label { font-size: 0.8rem; }
#timeline-form .field textarea { min-height: 100px; }
.tl-kind-tag {
  position: absolute;
  right: 24px;
  top: 20px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 3px;
  transition: opacity 0.15s;
}
.tl-entry:hover .tl-kind-tag { opacity: 0; }
.tl-kind-tag.job { color: var(--accent); border: 1px solid var(--accent); }
.tl-kind-tag.education { color: #8b5cf6; border: 1px solid #8b5cf6; }
.tl-kind-tag.certification { color: #10b981; border: 1px solid #10b981; }
.tl-kind-tag.license { color: #f59e0b; border: 1px solid #f59e0b; }
.tl-kind-tag.award { color: #ef4444; border: 1px solid #ef4444; }
.tl-kind-tag.project { color: #3b82f6; border: 1px solid #3b82f6; }
.tl-actions {
  position: absolute;
  right: 24px;
  top: 20px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.tl-entry:hover .tl-actions { opacity: 1; }
.tl-actions button {
  background: none;
  border: 1px solid var(--accent);
  border-radius: 9999px;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 1px 8px;
  line-height: 1.6;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.15s;
}
.tl-actions button:hover { background: var(--accent); color: #fff; }
.tl-actions button.danger { border-color: var(--red, #e55); color: var(--red, #e55); }
.tl-actions button.danger:hover { background: var(--red, #e55); color: #fff; }
.tl-kind-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Review Scores ── */
/* Collapsed: small circles row */
.review-circles {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.review-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.review-circle:hover {
  box-shadow: 0 0 8px currentColor;
}
.review-circle.avg {
  width: 44px;
  height: 44px;
  font-size: 1rem;
}
.review-circle-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}
/* Expanded: bar rows */
.review-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.review-row:last-child { margin-bottom: 0; }
.review-label {
  width: 100px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  flex-shrink: 0;
}
.review-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(128,128,128,0.15);
  border-radius: 4px;
  overflow: hidden;
}
.review-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.review-score {
  width: 32px;
  text-align: right;
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.review-finding {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin: -6px 0 10px 112px;
  line-height: 1.5;
}
.review-thumbs {
  display: inline-flex;
  gap: 2px;
  margin-left: 8px;
}
.review-thumb {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  opacity: 0.3;
  transition: opacity 0.15s, background 0.15s;
  display: flex;
  align-items: center;
}
.review-thumb img { width: 16px; height: 16px; }
[data-theme="dark"] .review-thumb img,
[data-theme="artistry"] .review-thumb img { filter: invert(1); }
.review-thumb:hover { opacity: 0.7; }
.review-thumb.active { opacity: 1; background: rgba(128,128,128,0.15); }
.review-note {
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin: -4px 0 10px 112px;
  cursor: pointer;
}
.review-note:hover { color: var(--text); }

/* ── Version list ── */
.version-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  gap: 12px;
}
.version-item:hover { background: rgba(128,128,128,0.08); }
.version-meta {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text);
}
.version-meta small {
  color: var(--text-dim);
  font-size: 0.7rem;
  margin-left: 8px;
}
.version-date {
  font-size: 0.7rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ── Cert cards ── */
.cert-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.cert-card:hover { border-color: var(--accent); }
.cert-card.earned { border-left: 3px solid var(--green, #16a34a); }
.cert-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cert-info { flex: 1; min-width: 0; }
.cert-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}
.cert-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.cert-diff {
  font-size: 0.9rem;
  letter-spacing: 2px;
  flex-shrink: 0;
}
.cert-diff.beginner    { color: var(--accent, #50C878); }
.cert-diff.intermediate { color: var(--yellow, #ca8a04); }
.cert-diff.advanced    { color: var(--red, #e55); }
.cert-score {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--green, #16a34a);
  flex-shrink: 0;
  margin-left: auto;
  padding-right: 4px;
}
.award-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(128,128,128,0.1);
}
.award-item:last-child { border-bottom: none; }

/* ── Skill pills ── */
.skill-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--bg);
  white-space: nowrap;
}
.skill-pill.cert {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}
.skill-pill .skill-x {
  cursor: pointer;
  opacity: 0.4;
  font-size: 0.9rem;
  line-height: 1;
  transition: opacity 0.15s;
}
.skill-pill .skill-x:hover { opacity: 1; color: var(--red, #e55); }

/* ── Section header cards ── */
.section-card h2 {
  font-size: 2.25rem;
  gap: 14px;
}
.section-card h2::before { display: none; }
.section-card .card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: var(--accent);
  border-radius: 6px;
  flex-shrink: 0;
}
.section-card .card-icon img {
  width: 30px;
  height: 30px;
  filter: brightness(0) invert(1);
}
.section-card .card-desc {
  margin-top: 4px;
  margin-bottom: 0;
}

/* ── Exam cover page ── */
.exam-cover {
  position: fixed; inset: 0; z-index: 5000;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px;
}
.exam-cover-card {
  max-width: 540px; width: 100%;
}
.exam-cover-title {
  font-size: 1.4rem; font-weight: 700; margin-bottom: 8px;
}
.exam-cover-desc {
  color: var(--text-dim); line-height: 1.6; margin-bottom: 20px;
}
.exam-cover-meta {
  display: flex; flex-wrap: wrap; gap: 12px 20px;
  font-size: 0.85rem; color: var(--text-dim); margin-bottom: 24px;
}
.exam-cover-meta span { white-space: nowrap; }
.exam-cover-rules {
  background: var(--card-bg, rgba(128,128,128,0.08));
  border-radius: 8px; padding: 16px 20px;
  font-size: 0.85rem; line-height: 1.7; color: var(--text-dim);
  margin-bottom: 28px;
}
.exam-cover-rules strong { color: var(--text); }
.exam-cover-rules ul { margin: 8px 0 0 0; padding-left: 20px; }
.exam-cover-rules li { margin-bottom: 4px; }
.exam-cover-btns {
  display: flex; gap: 12px; justify-content: flex-end;
}
.exam-cover-btns button {
  padding: 10px 28px; border-radius: 6px; font-size: 0.9rem;
  cursor: pointer; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
}
.exam-cover-btns button:hover { filter: brightness(1.15); }
.exam-cover-btns button.primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}

/* ── Exam overlay (full-screen test takeover) ── */
.exam-overlay {
  position: fixed; inset: 0; z-index: 5000;
  background: var(--bg);
  display: flex; flex-direction: column;
  align-items: center;
}
.exam-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; color: var(--text-dim);
  font-size: 1.5rem; cursor: pointer; padding: 4px 8px;
  line-height: 1;
}
.exam-close:hover { color: var(--text); }

/* Progress dots */
.exam-progress {
  display: flex; gap: 6px; padding: 16px 0 8px;
  justify-content: center; flex-wrap: wrap;
  max-width: 500px;
}
.exam-dot {
  width: 12px; height: 12px;
  border-radius: 50%; border: 2px solid var(--border);
  background: transparent; cursor: pointer;
  transition: all 0.2s;
}
.exam-dot.answered { background: var(--accent); border-color: var(--accent); }
.exam-dot.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.exam-dot.locked { background: var(--text-dim); border-color: var(--text-dim); opacity: 0.4; cursor: not-allowed; }

/* Timer */
.exam-timer {
  font-size: 1.8rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent); padding: 8px 0 4px;
}
.exam-timer.urgent { color: var(--red); }

/* Question area */
.exam-body {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  width: 100%; max-width: 540px; padding: 0 24px;
}
.exam-q-num {
  font-size: 0.8rem; color: var(--text-dim);
  margin-bottom: 8px; text-align: center;
}
.exam-q-text {
  font-size: 1.05rem; font-weight: 500;
  color: var(--text); line-height: 1.7;
  margin-bottom: 20px; text-align: center;
}
.exam-choices { width: 100%; }
.exam-choice {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 8px;
  cursor: pointer; transition: background 0.15s;
  font-size: 0.95rem; color: var(--text);
  margin-bottom: 4px;
}
.exam-choice:hover { background: rgba(128,128,128,0.1); }
.exam-choice input[type="radio"] { accent-color: var(--accent); flex-shrink: 0; }
.exam-input {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text);
  font-family: inherit; font-size: 0.95rem; outline: none;
}
.exam-input:focus { border-color: var(--accent); }

/* Navigation */
.exam-nav {
  display: flex; justify-content: space-between;
  width: 100%; max-width: 540px;
  padding: 16px 24px 24px;
}
.exam-nav button {
  padding: 10px 28px; border-radius: 6px;
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  transition: filter 0.15s;
}
.exam-nav button:hover { filter: brightness(1.15); }
.exam-nav button:disabled { opacity: 0.3; cursor: not-allowed; }
.exam-nav button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }


/* ── Results breakdown ── */
.result-q {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 10px;
}
.result-q-score {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 8px;
}
.result-q-score.good { background: rgba(22,163,74,0.15); color: var(--green, #16a34a); }
.result-q-score.mid  { background: rgba(202,138,4,0.15); color: var(--yellow, #ca8a04); }
.result-q-score.bad  { background: rgba(238,85,85,0.15); color: var(--red, #e55); }
.result-q-feedback {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 6px;
}

[data-theme="artistry"] .cert-card,
[data-theme="industry"] .cert-card { border-radius: 0; }
[data-theme="artistry"] .result-q,
[data-theme="industry"] .result-q { border-radius: 0; }

/* ── Board items ── */
.board-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(128,128,128,0.1);
  gap: 12px;
}
.board-item:last-child { border-bottom: none; }
.board-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}
.board-name small {
  font-weight: 400;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-left: 6px;
}
.board-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 1.05rem;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.2s;
}
.board-remove:hover { color: var(--red, #e55); }
.board-suggestion:hover { background: rgba(128,128,128,0.1); }
.board-suggestion:last-child { border-bottom: none; }

/* ── Job cards ── */
.job-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.15s;
}
.job-card:hover { border-color: var(--accent); box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.job-card.expanded { border-color: var(--accent); }
.job-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.job-score {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.job-score.high { background: rgba(22,163,74,0.15); color: var(--green, #16a34a); }
.job-score.mid  { background: rgba(80,200,120,0.15); color: var(--accent, #50C878); }
.job-score.low  { background: rgba(238,85,85,0.15); color: var(--red, #e55); }
.job-score.none { background: rgba(128,128,128,0.1); color: var(--text-dim); }
.job-info { flex: 1; min-width: 0; }
.job-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.job-meta {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 2px;
}
.job-bookmark {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-dim);
  padding: 2px;
  transition: color 0.2s;
}
.job-bookmark:hover, .job-bookmark.active { color: var(--accent); }
.job-detail {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(128,128,128,0.1);
  animation: panelIn 0.2s ease both;
}
.job-detail .job-reason {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 12px;
}
.job-detail .job-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.job-card.stale { opacity: 0.45; }
.job-card.stale:hover { opacity: 0.7; }
.job-stale-badge {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--red, #e55);
  background: rgba(238,85,85,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Deep Search results feed ── */
.deep-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(128,128,128,0.1);
  animation: panelIn 0.25s ease both;
}
.deep-result:last-child { border-bottom: none; }
.deep-result-score {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.deep-result-label {
  font-size: 0.85rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.deep-result-reason {
  font-size: 0.7rem;
  color: var(--text-dim);
}

/* ── Application cards ── */
.app-card { cursor: pointer; transition: border-color 0.2s, box-shadow 0.15s; }
.app-card:hover { border-color: var(--accent); box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.app-card.expanded { border-color: var(--accent); }
.app-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 10px;
}
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
}
.app-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
  flex-shrink: 0;
  white-space: nowrap;
  /* Default fallback styling */
  background: rgba(128,128,128,0.15);
  color: var(--text-dim);
}
.app-status.draft     { background: rgba(128,128,128,0.15); color: var(--text-dim); }
.app-status.applied   { background: rgba(80,200,120,0.15); color: var(--accent); }
.app-status.interview { background: rgba(59,130,246,0.15); color: #3b82f6; }
.app-status.offer     { background: rgba(22,163,74,0.2); color: var(--green, #16a34a); }
.app-status.rejected  { background: rgba(238,85,85,0.15); color: var(--red, #e55); }
.app-status.accepted  { background: rgba(22,163,74,0.2); color: var(--green, #16a34a); }
.app-status.withdrawn { background: rgba(202,138,4,0.15); color: var(--yellow, #ca8a04); }
.app-status.expired   { background: rgba(128,128,128,0.15); color: var(--text-dim); }
.app-info { flex: 1; min-width: 0; }
.app-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-board {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 1px;
}
.app-date {
  font-size: 0.8rem;
  color: var(--text-dim);
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Placeholder panels ── */
.panel-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}
.panel-empty h2 {
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.panel-empty p {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Split Layout: just a stack of divs ── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.app-main {
  flex: 1;
}
#split-divider {
  height: 6px;
  flex-shrink: 0;
  cursor: row-resize;
  background: var(--border);
  padding-top: 8px;
  background-clip: content-box;
}
#split-divider:hover, #split-divider.dragging {
  background: var(--accent);
  background-clip: content-box;
}
/* ── Card input bar (inserted after focused card) ── */
#card-input-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 16px;
  margin-bottom: 16px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 10px;
}
#card-input-bar textarea {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  resize: none;
  outline: none;
  max-height: 80px;
}
#card-input-bar textarea:focus { border-color: var(--accent); }
#card-input-bar button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#card-input-bar button:hover { opacity: 0.85; }

/* Card glow when focused for chat */
.g-card.card-focused {
  box-shadow: 0 0 0 2px var(--accent), 0 0 16px rgba(var(--accent-rgb, 232,145,58), 0.2);
  transition: box-shadow 0.25s;
}

#chat-section {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--bg), black 12%);
  overflow: hidden;
}
#chat-footer {
  position: sticky;
  bottom: 0;
  z-index: 50;
}

/* ── Card Rail ── */
#chat-cards {
  flex: 1 1 0;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 12px calc(50% - 190px);  /* 190px = half card width, centers edge cards */
  align-items: stretch;
  min-height: 0;
  scroll-snap-type: x proximity;
}
#chat-cards::-webkit-scrollbar { height: 4px; }
#chat-cards::-webkit-scrollbar-track { background: transparent; }
#chat-cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Turn Cards ── */
.chat-turn {
  flex: 0 0 auto;
  width: 28rem;
  max-height: 100%;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  animation: turnIn 0.25s ease;
  scroll-snap-align: center;
}
.chat-turn::-webkit-scrollbar { width: 3px; }
.chat-turn::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.turn-user {
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  font-size: 0.8rem;
  line-height: 1.4;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  user-select: none;
}
.turn-user-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  background: #fff;
  -webkit-mask-image: url(/assets/profile.svg);
  mask-image: url(/assets/profile.svg);
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  vertical-align: -1px;
  margin-right: 6px;
}
.turn-user:hover { opacity: 0.85; }
.turn-user { position: relative; }
.turn-action {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 6px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}
.turn-user:hover .turn-action { opacity: 1; }
.turn-action:hover { color: #fff; }
.chat-turn.dismissed { opacity: 0.4; }
.chat-turn.dismissed .turn-user { background: var(--text-dim); }
.turn-ai {
  padding: 10px 12px;
  font-size: 0.8rem;
  line-height: 1.4;
  overflow-y: auto;
  min-height: 0;
}
.turn-ai.collapsed { display: none; }
.turn-ai h1 { font-size: 1.3em; }
.turn-ai h2 { font-size: 1.15em; }
.turn-ai h3 { font-size: 1.05em; }
.turn-ai h4, .turn-ai h5, .turn-ai h6 { font-size: 1em; }
.turn-ai p { margin: 0.5em 0; }
.turn-ai > div + div { margin-top: 0.5em; }
.turn-ai > div:first-child p:first-child { margin-top: 0; }
.turn-ai > div:last-child p:last-child { margin-bottom: 0; }
.turn-ai ul, .turn-ai ol { padding-left: 1.5em; margin: 0.4em 0; font-size: 0.92em; line-height: 1.4; }
.turn-ai li { margin: 1px 0; }
.turn-ai table { margin: 4px 0; font-size: 0.88em; line-height: 1.2; border-collapse: collapse; width: 100%; }
.turn-ai th, .turn-ai td { padding: 3px 8px; border: 1px solid var(--border); text-align: left; }
.turn-ai th { font-weight: 600; background: rgba(128,128,128,0.08); }
.turn-thinking {
  color: var(--text-dim);
  font-size: 0.8rem;
  font-style: italic;
  padding: 8px 0;
  animation: advPulse 1.5s ease infinite;
}
.tool-pill {
  display: inline;
  font-size: 0.7rem;
  cursor: default;
  position: relative;
  opacity: 0.5;
}
.tool-pill svg { display: none; }
.tool-pill:hover { opacity: 1; }
.tool-pill:hover::after {
  content: attr(title);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.7rem;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
}
@keyframes turnIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes advPulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* ── Input Bar (always visible at bottom) ── */
#input-bar {
  display: grid;
  grid-template-columns: 1fr minmax(0, 42rem) 1fr;
  padding: 8px 20px 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  cursor: ew-resize;
}
#input-bar input, #input-bar button, #input-bar select, #input-bar textarea {
  cursor: revert;
}
#input-bar .bar-left { display: flex; align-items: center; }
#input-bar .bar-center { display: flex; gap: 8px; align-items: center; }
#input-bar .bar-right { display: flex; align-items: center; justify-content: flex-end; }
#ask-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  resize: none;
  line-height: 1.5;
  max-height: 80px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#ask-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(80, 200, 120, 0.12);
}
#ask-send {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}
#ask-send:hover { opacity: 0.85; }
#ask-send:disabled { opacity: 0.4; cursor: default; }

/* ── Saved indicator ── */
.save-flash {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.7rem;
  color: var(--green, #16a34a);
  opacity: 0;
  animation: flashIn 1.5s ease;
  pointer-events: none;
}
@keyframes flashIn {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Theme overrides ── */
[data-theme="artistry"] .g-card,
[data-theme="industry"] .g-card, [data-theme="industry"] .tl-entry { border-radius: 0; }
[data-theme="artistry"] .field input,
[data-theme="artistry"] .field textarea,
[data-theme="artistry"] .field select,
[data-theme="industry"] .field input,
[data-theme="industry"] .field textarea,
[data-theme="industry"] .field select { border-radius: 0; }
[data-theme="artistry"] #ask-input,
[data-theme="artistry"] #ask-send,
[data-theme="industry"] #ask-input,
[data-theme="industry"] #ask-send { border-radius: 0; }
[data-theme="artistry"] .header-actions button,
[data-theme="industry"] .header-actions button { border-radius: 0; }
[data-theme="artistry"] .g-btn,
[data-theme="industry"] .g-btn { border-radius: 0; }
[data-theme="artistry"] .review-bar-track,
[data-theme="artistry"] .review-bar-fill,
[data-theme="industry"] .review-bar-track,
[data-theme="industry"] .review-bar-fill { border-radius: 0; }
[data-theme="artistry"] .review-circle,
[data-theme="industry"] .review-circle { border-radius: 0; }
[data-theme="artistry"] .job-card,
[data-theme="industry"] .job-card { border-radius: 0; }
[data-theme="artistry"] .app-card,
[data-theme="industry"] .app-card { border-radius: 0; }
[data-theme="artistry"] .job-score,
[data-theme="industry"] .job-score { border-radius: 0; }
[data-theme="artistry"] .app-status,
[data-theme="industry"] .app-status { border-radius: 0; }

/* ── Viewer (iframe slide-over) ── */
.app-main {
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
body.viewer-open .app-main {
  transform: translateX(-15%);
  opacity: 0.7;
  pointer-events: none;
}
body.viewer-open .app-topbar {
  pointer-events: none;
}
.viewer {
  display: none;
  flex-direction: column;
  position: fixed;
  top: 56px;
  bottom: 0;
  left: 25%;
  right: 0;
  z-index: 150;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(0,0,0,0.25);
  transform: translateX(110%);
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.viewer.open {
  transform: translateX(0);
}
.viewer-back {
  position: absolute;
  left: -40px;
  top: 0;
  bottom: 0;
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
}
.viewer-back-arrow {
  font-size: 1.85rem;
  color: var(--text-dim);
  transition: color 0.2s, transform 0.2s;
}
.viewer-back:hover .viewer-back-arrow {
  color: var(--accent);
  transform: translateX(-3px);
}
.viewer-chrome {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.viewer-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.viewer-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}
.viewer-close:hover { border-color: var(--accent); color: var(--accent); }
.viewer-url {
  flex: 1;
  font-size: 0.8rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.viewer-external {
  font-size: 1.2rem;
  color: var(--text-dim);
  text-decoration: none;
  flex-shrink: 0;
  padding: 2px 4px;
  transition: color 0.2s;
}
.viewer-external:hover { color: var(--accent); text-decoration: none; }
.viewer-frame {
  flex: 1;
  border: none;
  background: #fff;
}
.viewer-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px;
  color: var(--text);
  line-height: 1.7;
  font-size: 0.9rem;
}
.viewer-content .vc-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.viewer-content .vc-title {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0 0 8px;
}
.viewer-content .vc-meta {
  font-size: 0.85rem;
  color: var(--text-dim);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.viewer-content .vc-score {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}
.viewer-content .vc-score.high { color: var(--green, #16a34a); }
.viewer-content .vc-score.mid { color: var(--accent, #50C878); }
.viewer-content .vc-score.low { color: var(--red, #e55); }
.viewer-content .vc-reason {
  font-size: 0.85rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 8px;
}
.viewer-content .vc-stale {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--red, #e55);
  background: rgba(238,85,85,0.1);
  padding: 2px 8px;
  border-radius: 4px;
}
.viewer-content .vc-body {
  line-height: 1.7;
}
.viewer-content .vc-body h1,
.viewer-content .vc-body h2,
.viewer-content .vc-body h3 {
  margin: 1.2em 0 0.5em;
  font-weight: 600;
}
.viewer-content .vc-body h1 { font-size: 1.2rem; }
.viewer-content .vc-body h2 { font-size: 1.05rem; }
.viewer-content .vc-body h3 { font-size: 1rem; }
.viewer-content .vc-body ul,
.viewer-content .vc-body ol {
  padding-left: 24px;
  margin: 0.5em 0;
}
.viewer-content .vc-body li { margin: 4px 0; }
.viewer-content .vc-body p { margin: 0.6em 0; }
.viewer-content .vc-questions {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.viewer-content .vc-questions h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 12px;
}

/* Theme overrides for viewer */
[data-theme="artistry"] .viewer-close,
[data-theme="industry"] .viewer-close { border-radius: 0; }
[data-theme="artistry"] .viewer,
[data-theme="industry"] .viewer { box-shadow: none; }

/* ── Corner buttons (lower left) ── */
.corner-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  opacity: 0.5;
}
.corner-btn:hover {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
}
.corner-btn.active {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Responsive ── */
@media (max-width: 600px) {
  html, body { font-size: 16px; overflow-x: hidden; overscroll-behavior-x: none; width: 100%; }
  #app { overflow-x: hidden; width: 100%; }
  .app-topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 4px 8px 0;
    width: 100%;
    box-sizing: border-box;
  }
  .header-brand { font-size: 1rem; width: auto; flex: 1; min-width: 0; }
  .header-actions { width: auto; flex-shrink: 1; gap: 4px; }
  .header-actions a { font-size: 0.75rem !important; }
  .header-tabs {
    order: 3;
    flex: 0 0 100%;
    overflow-x: auto;
  }
  .tb-btn { padding: 8px 10px 10px !important; font-size: 0 !important; }
  .tb-btn .tb-icon { width: 1.3rem; height: 1.3rem; }
  .field-row { grid-template-columns: 1fr; }
  .app-main { padding: 0; }
  .g-card { padding: 12px; border-radius: 0; margin-bottom: 6px; }
  .stream-section { padding: 4px 0; }
  #input-bar { grid-template-columns: auto 1fr auto; padding: 6px 6px 8px; width: 100%; box-sizing: border-box; }
  .chat-turn { width: 85vw; }
  .modal-box { min-width: auto; max-width: 95vw; }
}

/* ── Custom modal (replaces browser confirm/prompt) ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 3000;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem 1.5rem;
  min-width: 300px;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.5;
}
.modal-box p { margin: 0 0 1rem; }
.modal-box input[type="text"] {
  width: 100%; box-sizing: border-box;
  padding: 6px 8px; margin-bottom: 1rem;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  font-size: 0.85rem;
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
}
.modal-actions button {
  padding: 6px 16px; border-radius: 4px;
  font-size: 0.8rem; cursor: pointer; border: 1px solid var(--border);
  background: var(--panel); color: var(--text);
}
.modal-actions button.primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.modal-actions button:hover { filter: brightness(1.15); }

/* ── Account dropdown ── */
.account-menu-wrap { position: relative; }
.account-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.45);
  min-width: 200px;
  z-index: 2500;
  padding: 6px 0;
  font-size: 0.8rem;
}
.account-menu.open { display: block; }
.account-menu-info {
  padding: 8px 14px;
  color: var(--text-dim);
  font-size: 0.75rem;
  border-bottom: 1px solid var(--border);
}
.account-menu-info div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-item {
  display: block; width: 100%; box-sizing: border-box;
  padding: 8px 14px;
  background: none; border: none;
  color: var(--text); font-size: 0.8rem;
  text-align: left; cursor: pointer;
}
.account-menu-item:hover { background: var(--accent); color: #fff; }
.account-menu-item.danger { color: var(--red); }
.account-menu-item.danger:hover { background: var(--red); color: #fff; }
