:root {
  color-scheme: light;
  --ink: var(--jd-color-text);
  --blue: var(--jd-color-accent-strong);
  --teal: var(--jd-color-accent);
  --amber: var(--jd-color-warning);
  --red: var(--jd-color-danger);
  --paper: var(--jd-color-canvas);
  --surface: var(--jd-color-surface);
  --line: var(--jd-color-border);
  --muted: var(--jd-color-text-muted);
  --wash: var(--jd-color-surface-subtle);
  font-family: var(--jd-font-sans);
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; margin: 0; }
body { background: var(--paper); font-size: var(--jd-text-sm); line-height: var(--jd-leading-sm); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .56; }
a { color: var(--teal); }
[hidden], .hidden { display: none !important; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 0;
  box-shadow: var(--jd-focus-ring);
}

/* Shell */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--jd-sidebar-width) minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: var(--jd-space-4) var(--jd-space-3);
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: var(--jd-space-3); min-height: 48px; padding: 0 var(--jd-space-2) var(--jd-space-4); }
.brand > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--jd-radius-control);
  background: var(--blue);
  color: white;
  font: var(--jd-weight-semibold) var(--jd-text-xs)/1 var(--jd-font-mono);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: var(--jd-text-md); line-height: var(--jd-leading-sm); }
.brand small { margin-top: 1px; color: var(--muted); font-size: 11px; line-height: 16px; }
.sidebar nav { display: grid; gap: var(--jd-space-1); margin-top: var(--jd-space-2); }
.nav-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  width: 100%;
  min-height: var(--jd-control-lg);
  padding: 0 var(--jd-space-3);
  border: 0;
  border-radius: var(--jd-radius-control);
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: color var(--jd-motion-fast), background var(--jd-motion-fast);
}
.nav-item span { color: #7d8590; text-align: center; }
.nav-item:hover { background: var(--wash); color: var(--ink); }
.nav-item.active { background: var(--jd-color-accent-soft); color: var(--blue); font-weight: var(--jd-weight-semibold); }
.nav-item.active span { color: var(--teal); }
.sidebar-foot { display: flex; align-items: center; gap: var(--jd-space-2); margin-top: auto; padding: var(--jd-space-3) var(--jd-space-2); border-top: 1px solid var(--jd-color-border-muted); }
.sidebar-foot p { margin: 0; }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { font-size: var(--jd-text-xs); }
.sidebar-foot small { color: var(--muted); font-size: 11px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--jd-color-warning); }
.status-dot.on { background: var(--jd-color-success); }

.main { min-width: 0; padding: 0 var(--jd-space-6) var(--jd-space-12); }
.masthead {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--jd-space-4);
  min-height: 72px;
  margin: 0 calc(var(--jd-space-6) * -1) var(--jd-space-6);
  padding: var(--jd-space-3) var(--jd-space-6);
  border-bottom: 1px solid var(--line);
  background: rgb(246 248 250 / 92%);
  backdrop-filter: blur(12px);
}
.masthead h1 { margin: 1px 0 0; font-size: var(--jd-text-xl); line-height: var(--jd-leading-xl); letter-spacing: -.02em; }
.kicker, .eyebrow {
  margin: 0 0 var(--jd-space-1);
  color: var(--muted);
  font-size: var(--jd-text-xs);
  line-height: var(--jd-leading-xs);
  font-weight: var(--jd-weight-medium);
}
.system-state { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--jd-space-2); }
.state-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #a7d7c9;
  border-radius: var(--jd-radius-pill);
  background: var(--jd-color-accent-soft);
  color: var(--blue);
  font-size: var(--jd-text-xs);
}
.state-pill.off { border-color: var(--line); background: var(--surface); color: var(--muted); }
.companion-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--jd-control-sm);
  padding: 0 var(--jd-space-3);
  border: 1px solid var(--line);
  border-radius: var(--jd-radius-control);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-size: var(--jd-text-xs);
  font-weight: var(--jd-weight-medium);
}
.companion-download:hover { border-color: #9ca3af; background: var(--wash); }
.pause-button { min-height: var(--jd-control-sm); padding: 0 var(--jd-space-3); border: 1px solid var(--line); border-radius: var(--jd-radius-control); background: var(--surface); color: var(--muted); font-size: var(--jd-text-xs); }
.pause-button:hover { border-color: #f0b8bd; color: var(--red); }

.view { display: none; width: min(100%, var(--jd-content-max)); margin: 0 auto; }
.view.active { display: block; }
h2, h3 { letter-spacing: -.01em; }
h2 { margin: 0; font-size: var(--jd-text-lg); line-height: var(--jd-leading-lg); }
h3 { margin: 0; font-size: var(--jd-text-md); line-height: var(--jd-leading-md); }
.muted { color: var(--muted); font-size: var(--jd-text-xs); }

/* Controls */
button, .job-actions a {
  min-height: var(--jd-control-md);
  padding: 0 var(--jd-space-3);
  border: 1px solid var(--line);
  border-radius: var(--jd-radius-control);
  background: var(--surface);
  color: var(--ink);
  font-weight: var(--jd-weight-medium);
  transition: background var(--jd-motion-fast), border-color var(--jd-motion-fast), color var(--jd-motion-fast);
}
button:hover, .job-actions a:hover { background: var(--wash); border-color: #a8b0b8; }
button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}
button.primary:hover { border-color: var(--jd-color-accent-hover); background: var(--jd-color-accent-hover); }
.plain-link { min-height: 28px; padding: 0; border: 0; background: transparent; color: var(--teal); }
.plain-link:hover { border-color: transparent; background: transparent; text-decoration: underline; text-underline-offset: 3px; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--jd-space-2); }
input, textarea, select {
  min-height: var(--jd-control-lg);
  padding: var(--jd-space-2) var(--jd-space-3);
  border: 1px solid var(--line);
  border-radius: var(--jd-radius-control);
  background: var(--surface);
  color: var(--ink);
}
input:hover, textarea:hover, select:hover { border-color: #a8b0b8; }
input:focus, textarea:focus, select:focus { border-color: var(--teal); outline: 0; box-shadow: var(--jd-focus-ring); }

/* First-run workflow */
.workflow-card {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, .75fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--jd-radius-surface);
  background: var(--surface);
}
.workflow-copy { padding: var(--jd-space-6); }
.workflow-copy h2 { max-width: 32ch; }
.workflow-copy > p:not(.eyebrow) { max-width: 66ch; margin: var(--jd-space-2) 0 0; color: var(--muted); line-height: var(--jd-leading-md); }
.workflow-main-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)); margin-top: var(--jd-space-6); }
.workflow-main-actions button { min-height: 44px; }
.workflow-main-actions .resume-action { border-color: var(--line) !important; background: var(--surface) !important; color: var(--ink) !important; }
.workflow-main-actions .resume-action:hover { background: var(--wash) !important; }
.workflow-main-actions .job-action { border-color: var(--teal) !important; background: var(--teal) !important; color: white !important; }
.workflow-main-actions .job-action:hover { border-color: var(--jd-color-accent-hover) !important; background: var(--jd-color-accent-hover) !important; }
.workflow-hint { font-size: var(--jd-text-xs); }
.workflow-steps { display: grid; grid-template-columns: repeat(2, 1fr); margin: 0; padding: 0; border-left: 1px solid var(--line); list-style: none; }
.workflow-steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: var(--jd-space-2);
  align-content: center;
  min-height: 100px;
  padding: var(--jd-space-4);
  border-right: 1px solid var(--jd-color-border-muted);
  border-bottom: 1px solid var(--jd-color-border-muted);
  color: var(--muted);
}
.workflow-steps li:nth-child(2n) { border-right: 0; }
.workflow-steps li:nth-last-child(-n + 2) { border-bottom: 0; }
.workflow-steps li > span { color: #8c959f; font: var(--jd-weight-semibold) var(--jd-text-xs)/var(--jd-leading-sm) var(--jd-font-mono); }
.workflow-steps strong, .workflow-steps small { display: block; }
.workflow-steps strong { color: var(--ink); }
.workflow-steps small { margin-top: 2px; font-size: var(--jd-text-xs); }
.workflow-steps li.active { background: var(--jd-color-accent-soft); }
.workflow-steps li.active > span, .workflow-steps li.active strong { color: var(--teal); }
.workflow-steps li.done > span { color: var(--jd-color-success); }
.workflow-results { grid-column: 1 / -1; display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: stretch; border-top: 1px solid var(--line); }
.workflow-results:empty { display: none; }
.workflow-results > div:not([class]) { padding: var(--jd-space-4) var(--jd-space-6); }
.workflow-results > div:not([class]) p { margin: 0 0 var(--jd-space-2); color: #46515c; line-height: 1.6; }
.audit-score { display: grid; place-items: center; align-content: center; min-width: 112px; padding: var(--jd-space-4); border-right: 1px solid var(--line); background: var(--wash); color: var(--blue); text-align: center; }
.audit-score strong, .audit-score small { display: block; }
.audit-score strong { font: var(--jd-weight-semibold) var(--jd-text-xl)/1 var(--jd-font-mono); }
.audit-score small { margin-top: var(--jd-space-2); color: var(--muted); font-size: 11px; }
.workflow-error { padding: var(--jd-space-3) var(--jd-space-6); background: #fff5f5; color: var(--red); font-size: var(--jd-text-xs); }
.autopilot-progress, .resume-apply-progress { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--jd-space-3); align-items: center; padding: var(--jd-space-3) var(--jd-space-6); border-top: 1px solid var(--jd-color-border-muted); background: var(--wash); }
.autopilot-progress p, .resume-apply-progress p { margin: 0; color: var(--muted); font-size: var(--jd-text-xs); }
.autopilot-progress strong, .resume-apply-progress strong { color: var(--teal); font-size: var(--jd-text-xs); white-space: nowrap; }
.autopilot-progress span, .resume-apply-progress span { color: var(--muted); font-size: var(--jd-text-xs); }
.resume-apply-progress.blocked { background: #fff5f5; }
.resume-apply-progress.blocked strong { color: var(--red); }

.brief-strip {
  display: grid;
  grid-template-columns: 1.35fr .9fr .7fr auto;
  align-items: stretch;
  margin-top: var(--jd-space-4);
  border: 1px solid var(--line);
  border-radius: var(--jd-radius-surface);
  background: var(--surface);
}
.brief-strip > div { min-width: 0; padding: var(--jd-space-3) var(--jd-space-4); border-right: 1px solid var(--jd-color-border-muted); }
.brief-strip small, .brief-strip strong { display: block; }
.brief-strip small { color: var(--muted); font-size: var(--jd-text-xs); }
.brief-strip strong { overflow: hidden; margin-top: 2px; text-overflow: ellipsis; white-space: nowrap; }
.brief-strip .plain-link { align-self: center; margin: 0 var(--jd-space-4); }
.pipeline {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: var(--jd-space-4);
  border: 1px solid var(--line);
  border-radius: var(--jd-radius-surface);
  background: var(--surface);
}
.pipeline article { display: grid; grid-template-columns: 24px 1fr auto; gap: var(--jd-space-2); align-items: center; min-height: 72px; padding: var(--jd-space-3) var(--jd-space-4); border-right: 1px solid var(--jd-color-border-muted); }
.pipeline article:last-of-type { border-right: 0; }
.pipeline article > span { color: #8c959f; font: var(--jd-weight-medium) 11px/1 var(--jd-font-mono); }
.pipeline small { color: var(--muted); }
.pipeline strong { font-size: var(--jd-text-lg); line-height: var(--jd-leading-lg); }
.pipeline > i { display: none; }

/* Surfaces and lists */
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--jd-space-4); margin-top: var(--jd-space-4); }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--jd-radius-surface); background: var(--surface); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--jd-space-3); min-height: 64px; padding: var(--jd-space-3) var(--jd-space-4); border-bottom: 1px solid var(--jd-color-border-muted); }
.panel-head h2 { font-size: var(--jd-text-md); line-height: var(--jd-leading-md); }
.action-stage { padding: var(--jd-space-4); }
.action-stage > p { max-width: 66ch; margin: 0 0 var(--jd-space-4); color: var(--muted); }
.count-badge { display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: var(--jd-radius-pill); background: var(--wash); color: var(--muted); font: var(--jd-weight-semibold) var(--jd-text-xs)/1 var(--jd-font-mono); }
.empty { padding: var(--jd-space-8) var(--jd-space-4); color: var(--muted); text-align: center; }
.compact-action, .job-row, .activity-item, .action-item, .history-item { border-bottom: 1px solid var(--jd-color-border-muted); }
.compact-action:last-child, .job-row:last-child, .activity-item:last-child, .action-item:last-child, .history-item:last-child { border-bottom: 0; }
.compact-action { display: grid; grid-template-columns: 1fr auto; gap: var(--jd-space-3); align-items: center; padding: var(--jd-space-3) var(--jd-space-4); }
.compact-action strong, .compact-action small, .job-row strong, .job-row small { display: block; }
.compact-action small, .job-row small { margin-top: 2px; color: var(--muted); font-size: var(--jd-text-xs); }
.compact-action button, .job-row button { min-height: var(--jd-control-sm); font-size: var(--jd-text-xs); }
.job-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: var(--jd-space-3); align-items: center; padding: var(--jd-space-3) var(--jd-space-4); }
.score { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--jd-radius-control); background: var(--wash); color: var(--muted); font: var(--jd-weight-semibold) var(--jd-text-sm)/1 var(--jd-font-mono); }
.score.high { background: var(--jd-color-accent-soft); color: var(--teal); }
.activity-item { display: grid; grid-template-columns: 72px 1fr; gap: var(--jd-space-3); padding: var(--jd-space-3) var(--jd-space-4); }
.activity-item time, .history-item time { color: var(--muted); font: var(--jd-text-xs)/var(--jd-leading-xs) var(--jd-font-mono); }

/* Agent workspace: the only visually expressive area */
.assistant-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 112px); overflow: hidden; border: 1px solid var(--line); border-radius: var(--jd-radius-surface); background: var(--surface); }
.mode-panel { padding: var(--jd-space-3); border-right: 1px solid var(--line); background: var(--wash); }
.mode { display: block; width: 100%; padding: var(--jd-space-3); border: 0; background: transparent; text-align: left; }
.mode strong, .mode small { display: block; }
.mode small { margin-top: 2px; color: var(--muted); font-size: var(--jd-text-xs); }
.mode.active { background: var(--surface); color: var(--blue); box-shadow: inset 3px 0 0 var(--teal); }
.truth-note { margin-top: var(--jd-space-6); padding: var(--jd-space-3); border: 1px solid var(--line); border-radius: var(--jd-radius-control); background: var(--surface); }
.truth-note p { margin: var(--jd-space-1) 0 0; color: var(--muted); font-size: var(--jd-text-xs); }
.chat-panel { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; }
.messages { max-height: calc(100vh - 290px); overflow: auto; padding: var(--jd-space-6); }
.welcome-message, .message { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: var(--jd-space-3); max-width: 820px; margin-bottom: var(--jd-space-6); }
.welcome-message > span, .message > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--blue); color: white; font: var(--jd-weight-semibold) 10px/1 var(--jd-font-mono); }
.message.user > span { background: var(--wash); color: var(--muted); }
.welcome-message p, .message p { margin: var(--jd-space-1) 0 0; white-space: pre-wrap; color: #46515c; line-height: 1.7; }
.message-body { min-width: 0; }
.chat-task { position: relative; margin-top: var(--jd-space-4); padding: var(--jd-space-4) var(--jd-space-4) var(--jd-space-4) 44px; border: 1px solid #b7d9d1; border-radius: var(--jd-radius-surface); background: #f7fcfb; }
.chat-task::before { content: ""; position: absolute; top: 20px; bottom: 20px; left: 22px; width: 2px; background: #b7d9d1; }
.chat-task::after { content: ""; position: absolute; top: 18px; left: 18px; width: 10px; height: 10px; border: 2px solid #f7fcfb; border-radius: 50%; background: var(--teal); }
.chat-task > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: var(--jd-space-3); }
.chat-task span, .chat-task small { color: var(--muted); font: var(--jd-text-xs)/var(--jd-leading-xs) var(--jd-font-mono); }
.chat-task small { display: block; margin-top: var(--jd-space-2); }
.chat-task p { margin-top: var(--jd-space-2); font-size: var(--jd-text-xs); }
.chat-task-track { height: 4px; margin-top: var(--jd-space-3); overflow: hidden; border-radius: var(--jd-radius-pill); background: #dcebe7; }
.chat-task-track i { display: block; height: 100%; background: var(--teal); transition: width var(--jd-motion-overlay); }
.chat-agent { border-color: #98c6bd; background: linear-gradient(135deg, #f7fcfb 0%, #ffffff 70%); }
.chat-agent-goal { color: var(--ink) !important; font-weight: var(--jd-weight-semibold); }
.chat-agent-plan { margin: var(--jd-space-3) 0; padding-left: var(--jd-space-6); color: #46515c; line-height: 1.6; }
.chat-agent-steps { display: grid; gap: 0; margin: var(--jd-space-3) 0 0; padding: 0; list-style: none; }
.chat-agent-steps li { display: grid; grid-template-columns: minmax(120px, .35fr) minmax(0, 1fr); gap: var(--jd-space-3); padding: var(--jd-space-2) 0; border-top: 1px solid #dfece8; color: var(--muted); font-size: var(--jd-text-xs); }
.chat-agent-steps li b { color: var(--ink); }
.chat-agent-steps li.error b { color: var(--red); }
.chat-agent-stop { margin-top: var(--jd-space-3); }
.message.streaming p::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 4px; vertical-align: -2px; background: var(--teal); animation: stream-caret .85s steps(1) infinite; }
@keyframes stream-caret { 50% { opacity: 0; } }
.composer { padding: var(--jd-space-4); border-top: 1px solid var(--line); background: var(--surface); }
.composer textarea { width: 100%; min-height: 88px; resize: vertical; }
.composer > div { display: flex; align-items: center; justify-content: space-between; margin-top: var(--jd-space-2); }
.composer span { color: var(--muted); font-size: var(--jd-text-xs); }

/* Jobs, resume, automation and settings */
.section-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--jd-space-4); padding-bottom: var(--jd-space-4); }
.toolbar-actions { display: flex; align-items: center; gap: var(--jd-space-2); }
.all-jobs { overflow: hidden; border: 1px solid var(--line); border-radius: var(--jd-radius-surface); background: var(--surface); }
.job-card { display: grid; grid-template-columns: 64px minmax(0, 1fr) 190px; gap: var(--jd-space-4); padding: var(--jd-space-4); border-bottom: 1px solid var(--jd-color-border-muted); }
.job-card:last-child { border-bottom: 0; }
.job-card .large-score { display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--jd-radius-control); background: var(--wash); font: var(--jd-weight-semibold) var(--jd-text-md)/1 var(--jd-font-mono); }
.job-card .meta { margin: 3px 0 0; color: var(--muted); font-size: var(--jd-text-xs); }
.job-card .summary { margin: var(--jd-space-2) 0 0; color: #46515c; line-height: 1.6; }
.job-actions { display: flex; flex-wrap: wrap; align-content: center; justify-content: flex-end; gap: var(--jd-space-2); }
.job-actions a { display: inline-flex; align-items: center; text-decoration: none; font-size: var(--jd-text-xs); }
.resume-layout, .settings-grid, .automation-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: var(--jd-space-4); }
.form-grid, .settings-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--jd-space-4); padding: var(--jd-space-4); }
.form-grid label, .settings-form label { display: block; }
.form-grid label.full, .settings-form .full { grid-column: 1 / -1; }
.form-grid label span, .settings-form label span, .reward-controls label span, .proof-step label span { display: block; margin-bottom: var(--jd-space-2); color: #46515c; font-size: var(--jd-text-xs); font-weight: var(--jd-weight-semibold); }
.form-grid input, .form-grid textarea, .settings-form input, .settings-form textarea, .settings-form select { width: 100%; }
.fact-list { padding: var(--jd-space-2) var(--jd-space-4); }
.fact { padding: var(--jd-space-3) 0; border-bottom: 1px solid var(--jd-color-border-muted); }
.fact::before { content: "✓"; margin-right: var(--jd-space-2); color: var(--jd-color-success); font-weight: var(--jd-weight-semibold); }
.fact-help { margin: var(--jd-space-2) var(--jd-space-4) var(--jd-space-4); padding: var(--jd-space-3); border-radius: var(--jd-radius-control); background: var(--wash); color: var(--muted); font-size: var(--jd-text-xs); }
.resume-current, .resume-optimization, .ranking-board { margin-top: var(--jd-space-4); border: 1px solid var(--line); border-radius: var(--jd-radius-surface); background: var(--surface); }
.workflow-results > .resume-optimization, .workflow-results > .ranking-board { grid-column: 1 / -1; margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
.resume-optimization > header, .ranking-board > header, .ranking-board > footer { display: flex; align-items: center; justify-content: space-between; gap: var(--jd-space-4); padding: var(--jd-space-4); border-bottom: 1px solid var(--jd-color-border-muted); }
.ranking-board > footer { border-top: 1px solid var(--jd-color-border-muted); border-bottom: 0; }
.resume-optimization header p:not(.eyebrow) { max-width: 76ch; margin: var(--jd-space-1) 0 0; color: var(--muted); font-size: var(--jd-text-xs); }
.resume-optimization-tools, .ranking-tools { display: flex; flex-wrap: wrap; gap: var(--jd-space-2); }
.resume-field-list, .ranking-list { display: grid; }
.resume-field-card { display: grid; grid-template-columns: 180px minmax(0, 1fr); border-bottom: 1px solid var(--jd-color-border-muted); }
.resume-field-card:last-child { border-bottom: 0; }
.resume-field-meta { display: grid; gap: var(--jd-space-2); align-content: start; padding: var(--jd-space-4); border-right: 1px solid var(--jd-color-border-muted); background: var(--wash); }
.resume-field-meta > span { color: var(--muted); font-family: var(--jd-font-mono); font-size: var(--jd-text-xs); }
.resume-field-meta strong, .resume-field-meta small { display: block; }
.resume-field-meta small { margin-top: var(--jd-space-1); color: var(--muted); font-size: var(--jd-text-xs); font-weight: var(--jd-weight-regular); }
.resume-field-card > div:last-child { padding: var(--jd-space-4); }
.resume-current { margin: 0 !important; padding: var(--jd-space-3) var(--jd-space-4) 0; color: #7a4b45; font-size: var(--jd-text-xs); }
.resume-field-state { color: var(--red); font-size: var(--jd-text-xs); }
.resume-field-card pre { overflow: auto; margin: 0; padding: var(--jd-space-3) var(--jd-space-4) var(--jd-space-4); white-space: pre-wrap; color: #34404b; font: var(--jd-text-xs)/1.7 var(--jd-font-sans); }
.resume-optimization > footer { padding: var(--jd-space-3) var(--jd-space-4); background: var(--wash); color: var(--muted); font-size: var(--jd-text-xs); }
.ranking-row { display: grid; grid-template-columns: 20px 32px 72px minmax(220px, 1fr) minmax(260px, .8fr); gap: var(--jd-space-3); align-items: center; padding: var(--jd-space-3) var(--jd-space-4); border-bottom: 1px solid var(--jd-color-border-muted); cursor: pointer; transition: background var(--jd-motion-fast) ease; }
.ranking-row:hover { background: var(--wash); }
.ranking-row.selected { background: var(--jd-color-accent-soft); box-shadow: inset 3px 0 var(--accent); }
.ranking-row.low-score:not(.selected) { opacity: .7; }
.ranking-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.rank-number, .rank-score { font-family: var(--jd-font-mono); }
.rank-score { color: var(--accent-strong); font-size: var(--jd-text-lg); font-weight: var(--jd-weight-semibold); }
.rank-score small, .rank-main strong, .rank-main small { display: block; }
.rank-score small { margin-top: var(--jd-space-1); color: var(--muted); font: var(--jd-text-xs)/var(--jd-leading-xs) var(--jd-font-sans); }
.rank-main { min-width: 0; }
.rank-main small { overflow: hidden; margin-top: var(--jd-space-1); color: var(--muted); font-size: var(--jd-text-xs); text-overflow: ellipsis; white-space: nowrap; }
.rank-main p { margin: var(--jd-space-2) 0 0; color: #46515c; font-size: var(--jd-text-xs); }
.rank-dimensions { display: grid; grid-template-columns: repeat(5, minmax(42px, 1fr)); gap: var(--jd-space-2); color: var(--muted); font-size: var(--jd-text-xs); }
.rank-dimensions > span { position: relative; overflow: hidden; min-width: 0; padding-top: 5px; border-top: 2px solid var(--jd-color-border-muted); }
.rank-dimensions i { position: absolute; top: -2px; left: 0; width: var(--score); max-width: 100%; height: 2px; background: var(--accent); }
.rank-dimensions b, .rank-dimensions em { display: block; font-style: normal; font-weight: var(--jd-weight-regular); }
.rank-dimensions em { color: var(--ink); font-family: var(--jd-font-mono); }
.approve-compact { min-height: var(--jd-control-sm); padding: 0 var(--jd-space-3); }
.automation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.task-composer { margin-bottom: var(--jd-space-4); }
.task-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--jd-space-3); align-items: end; padding: var(--jd-space-4); }
.task-form textarea { width: 100%; min-height: 84px; resize: vertical; }
.plan-summary { min-height: 20px; margin: 0; padding: 0 var(--jd-space-4) var(--jd-space-4); color: var(--muted); }
.action-item { padding: var(--jd-space-4); }
.action-item p { margin: var(--jd-space-1) 0 var(--jd-space-3); color: var(--muted); }
.history-item { display: grid; grid-template-columns: 72px 1fr auto; gap: var(--jd-space-3); padding: var(--jd-space-3) var(--jd-space-4); }
.history-item b { color: var(--jd-color-success); }
.history-item b.error, .history-item b.rejected { color: var(--red); }
.settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.account-panel { grid-column: 1 / -1; }
.account-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.account-columns > form + form { border-left: 1px solid var(--line); }
.compact-form h3 { font-size: var(--jd-text-md); }
.inline-control { display: grid; grid-template-columns: 1fr auto; gap: var(--jd-space-2); }
.account-summary { display: flex; align-items: center; justify-content: space-between; gap: var(--jd-space-4); padding: var(--jd-space-4); border-bottom: 1px solid var(--line); }
.account-summary div { display: grid; gap: 2px; }
.account-summary small, .account-summary span { color: var(--muted); font-size: var(--jd-text-xs); }
.star-reward-card { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(320px, 1.2fr); gap: var(--jd-space-6); padding: var(--jd-space-4); background: #fffbeb; }
.star-reward-card h3 { margin: var(--jd-space-1) 0; }
.star-reward-card p { margin: 0; color: var(--muted); font-size: var(--jd-text-xs); }
.reward-controls { display: grid; grid-template-columns: 1fr auto; gap: var(--jd-space-2); align-content: center; }
.reward-controls label { grid-column: 1 / -1; }
.reward-controls input[type="file"] { height: auto; padding: var(--jd-space-2); background: var(--surface); }
.reward-controls a { align-self: center; color: var(--accent); font-size: var(--jd-text-xs); }
.proof-step { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: var(--jd-space-3); padding-top: var(--jd-space-4); border-top: 1px solid #e8d9a8; }
.proof-step p, .proof-step pre, .proof-step label { grid-column: 1 / -1; }
.proof-step pre { overflow: auto; margin: 0; padding: var(--jd-space-3); border: 1px solid var(--line); border-radius: var(--jd-radius-control); background: var(--surface); white-space: pre-wrap; font: var(--jd-text-xs)/var(--jd-leading-sm) var(--jd-font-mono); }

/* Auth and feedback */
.toast { position: fixed; right: var(--jd-space-6); bottom: var(--jd-space-6); z-index: 20; max-width: 360px; transform: translateY(10px); opacity: 0; pointer-events: none; border-radius: var(--jd-radius-control); background: var(--ink); color: white; padding: var(--jd-space-3) var(--jd-space-4); box-shadow: var(--jd-shadow-overlay); transition: opacity var(--jd-motion-overlay), transform var(--jd-motion-overlay); }
.toast.show { transform: translateY(0); opacity: 1; }
.auth-gate { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: var(--jd-space-6); background: var(--jd-color-overlay); backdrop-filter: blur(6px); }
.auth-card { width: min(440px, 100%); padding: var(--jd-space-8); border: 1px solid var(--line); border-radius: var(--jd-radius-surface); background: var(--surface); box-shadow: var(--jd-shadow-overlay); }
.auth-card h1 { margin: 0; font-size: var(--jd-text-xl); line-height: var(--jd-leading-xl); }
.auth-card p:not(.eyebrow) { color: var(--muted); }
.auth-card label { display: grid; gap: var(--jd-space-2); margin: var(--jd-space-6) 0 var(--jd-space-4); font-weight: var(--jd-weight-semibold); }
.auth-card input { width: 100%; }

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 72px minmax(0, 1fr); }
  .sidebar { padding-inline: var(--jd-space-2); }
  .brand { justify-content: center; padding-inline: 0; }
  .brand div, .sidebar-foot p { display: none; }
  .nav-item { grid-template-columns: 1fr; justify-items: center; padding: 0; font-size: 0; }
  .nav-item span { font-size: var(--jd-text-md); }
  .sidebar-foot { justify-content: center; }
  .workflow-card { grid-template-columns: 1fr; }
  .workflow-steps { border-top: 1px solid var(--line); border-left: 0; }
  .dashboard-grid, .resume-layout { grid-template-columns: 1fr; }
  .pipeline article { grid-template-columns: 20px 1fr; }
  .pipeline strong { grid-column: 2; }
  .job-card { grid-template-columns: 56px minmax(0, 1fr); }
  .job-actions { grid-column: 2; justify-content: flex-start; }
}

@media (max-width: 780px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; right: 0; bottom: 0; left: 0; top: auto; z-index: 30; width: 100%; height: auto; padding: var(--jd-space-2); border-top: 1px solid var(--line); border-right: 0; }
  .brand, .sidebar-foot { display: none; }
  .sidebar nav { grid-template-columns: repeat(5, 1fr); margin: 0; }
  .nav-item { min-height: 44px; }
  .main { padding: 0 var(--jd-space-3) 76px; }
  .masthead { position: static; align-items: flex-start; flex-direction: column; min-height: auto; margin: 0 calc(var(--jd-space-3) * -1) var(--jd-space-4); padding: var(--jd-space-4) var(--jd-space-3); }
  .masthead h1 { font-size: var(--jd-text-lg); line-height: var(--jd-leading-lg); }
  .system-state { justify-content: flex-start; }
  .state-pill { display: none; }
  .workflow-copy { padding: var(--jd-space-4); }
  .workflow-steps { grid-template-columns: repeat(4, minmax(130px, 1fr)); overflow-x: auto; }
  .workflow-steps li { min-height: 80px; border-right: 1px solid var(--jd-color-border-muted) !important; border-bottom: 0; }
  .workflow-results { grid-template-columns: 1fr; }
  .audit-score { grid-template-columns: auto 1fr; justify-content: start; gap: var(--jd-space-2); min-width: 0; border-right: 0; border-bottom: 1px solid var(--jd-color-border-muted); text-align: left; }
  .audit-score small { margin-top: 0; }
  .autopilot-progress, .resume-apply-progress { grid-template-columns: 1fr; }
  .brief-strip { grid-template-columns: 1fr 1fr; }
  .brief-strip > div:nth-child(2) { border-right: 0; }
  .brief-strip > div:nth-child(3), .brief-strip .plain-link { border-top: 1px solid var(--jd-color-border-muted); }
  .pipeline { overflow-x: auto; grid-template-columns: repeat(5, minmax(130px, 1fr)); }
  .assistant-layout { grid-template-columns: 1fr; min-height: calc(100vh - 140px); }
  .mode-panel { display: flex; gap: var(--jd-space-1); overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .mode-panel > .eyebrow, .truth-note { display: none; }
  .mode { min-width: 120px; }
  .messages { max-height: calc(100vh - 380px); padding: var(--jd-space-4); }
  .settings-grid, .automation-grid, .account-columns, .star-reward-card { grid-template-columns: 1fr; }
  .account-columns > form + form { border-top: 1px solid var(--line); border-left: 0; }
  .section-toolbar { align-items: flex-start; flex-direction: column; }
  .resume-field-card { grid-template-columns: 1fr; }
  .resume-field-meta { border-right: 0; border-bottom: 1px solid var(--jd-color-border-muted); }
  .ranking-row { grid-template-columns: 20px 32px 64px minmax(0, 1fr); }
  .rank-dimensions { grid-column: 2 / -1; }
}

@media (max-width: 560px) {
  .workflow-main-actions, .brief-strip, .form-grid, .settings-form, .task-form { grid-template-columns: 1fr; }
  .workflow-main-actions button { width: 100%; }
  .brief-strip > div { border-right: 0; border-bottom: 1px solid var(--jd-color-border-muted); }
  .form-grid label.full, .settings-form .full { grid-column: auto; }
  .job-card { grid-template-columns: 1fr; }
  .job-actions { grid-column: 1; }
  .chat-agent-steps li { grid-template-columns: 1fr; }
  .account-summary { align-items: flex-start; flex-direction: column; }
  .resume-optimization > header, .ranking-board > header, .ranking-board > footer { align-items: flex-start; flex-direction: column; }
  .ranking-row { grid-template-columns: 20px 28px 56px minmax(0, 1fr); padding-inline: var(--jd-space-3); }
  .rank-dimensions { grid-template-columns: repeat(5, minmax(36px, 1fr)); }
  .toolbar-actions { align-items: stretch; flex-direction: column; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
