:root {
  --ink: #102238;
  --muted: #62758a;
  --line: #d8e2eb;
  --canvas: #eef4f7;
  --surface: #fff;
  --brand: #128478;
  --brand-dark: #096c64;
  --brand-soft: #e7f5f2;
  --purple: #6647df;
  --danger: #b83a35;
  font-family: Pretendard, "Noto Sans KR", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }
.review-shell { width: min(1600px, calc(100% - 32px)); margin: 16px auto 48px; }
.topbar, .safety-note, .review-toolbar, .candidate-panel, .editor-panel {
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
  box-shadow: 0 12px 32px rgb(22 47 69 / 7%);
}
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 24px; }
.eyebrow { margin: 0 0 3px; color: var(--brand); font-size: 13px; font-weight: 800; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(26px, 3vw, 36px); }
.header-actions, .topbar-actions { display: flex; align-items: center; gap: 9px; }
.topbar-actions a, .account-menu summary {
  border: 1px solid var(--line); border-radius: 11px; padding: 10px 14px; color: var(--ink);
  background: #fff; text-decoration: none; font-weight: 750; cursor: pointer;
}
.topbar-actions a.active { color: #fff; border-color: var(--brand); background: var(--brand); }
.account-menu { position: relative; }
.account-menu summary { display: flex; gap: 7px; list-style: none; }
.account-popover {
  position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; display: grid; gap: 8px;
  min-width: 270px; padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: #fff;
  box-shadow: 0 18px 45px rgb(17 38 58 / 18%);
}
.account-popover span { color: var(--muted); font-size: 13px; }
.account-popover a, .account-popover button { padding: 5px 0; border: 0; color: var(--brand-dark); background: none; text-align: left; text-decoration: none; cursor: pointer; }
.safety-note { display: flex; gap: 14px; margin-top: 12px; padding: 14px 18px; color: var(--brand-dark); background: var(--brand-soft); }
.review-toolbar { display: flex; align-items: end; gap: 12px; margin-top: 12px; padding: 14px 18px; }
.review-toolbar label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 800; }
.review-toolbar label:nth-child(2) { flex: 1; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; color: var(--ink); background: #fff; }
.review-toolbar input, .review-toolbar select { min-height: 42px; }
.import-request-control { display: grid; gap: 4px; min-width: 170px; }
.import-request-control small { color: var(--muted); font-size: 11px; text-align: center; }
.import-request-control button:disabled { cursor: wait; opacity: .62; }
button { border: 0; border-radius: 9px; padding: 10px 15px; font-weight: 800; cursor: pointer; }
.review-toolbar button, .primary { color: #fff; background: var(--brand); }
.review-workspace { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.candidate-panel, .editor-panel { min-height: 650px; overflow: hidden; }
.candidate-panel > header { padding: 17px 18px; border-bottom: 1px solid var(--line); }
.candidate-panel h2 { margin-bottom: 3px; font-size: 19px; }
.candidate-panel p { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.candidate-list { display: grid; gap: 7px; max-height: calc(100vh - 280px); padding: 10px; overflow: auto; }
.candidate-card { width: 100%; padding: 13px; border: 1px solid var(--line); color: var(--ink); background: #fff; text-align: left; }
.candidate-card:hover, .candidate-card.active { border-color: var(--brand); background: var(--brand-soft); }
.candidate-card strong, .candidate-card span { display: block; }
.candidate-card span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.candidate-card small { display: inline-block; margin-top: 7px; color: var(--brand-dark); }
.empty-list, .empty-editor { display: grid; place-content: center; gap: 8px; min-height: 300px; padding: 28px; color: var(--muted); text-align: center; }
.candidate-form { display: grid; gap: 14px; padding: 20px; }
.candidate-form > header { display: flex; justify-content: space-between; gap: 15px; }
.candidate-form > header p { margin-bottom: 3px; color: var(--muted); font-size: 12px; }
.candidate-form h2 { margin-bottom: 0; font-size: 22px; }
.confidence-badge { align-self: start; border-radius: 999px; padding: 6px 10px; color: var(--purple); background: #eeeaff; font-size: 12px; font-weight: 850; }
.candidate-form label { display: grid; gap: 6px; font-size: 13px; font-weight: 800; }
.candidate-form textarea { min-height: 95px; resize: vertical; line-height: 1.55; }
.form-grid { display: grid; grid-template-columns: 130px 1fr 180px; gap: 10px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.source-panel { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.source-panel > header { display: flex; gap: 10px; padding: 11px 13px; background: #f7f9fb; }
.source-panel > header span { color: var(--muted); font-size: 12px; }
.source-panel details { padding: 12px 13px; }
.source-panel summary { cursor: pointer; font-weight: 800; }
.source-panel pre { max-height: 260px; margin: 12px 0 0; padding: 12px; overflow: auto; border-radius: 8px; color: #33485d; background: #f4f7f9; white-space: pre-wrap; font: 12px/1.55 Pretendard, sans-serif; }
.candidate-form footer { display: grid; grid-template-columns: auto 1fr auto auto; gap: 9px; }
.secondary { border: 1px solid var(--line); background: #fff; }
.secondary.danger { color: var(--danger); }
.toast-stack { position: fixed; z-index: 40; right: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast { max-width: 380px; border-radius: 10px; padding: 12px 15px; color: #fff; background: #263a4d; box-shadow: 0 12px 30px rgb(0 0 0 / 20%); }
.toast.error { background: var(--danger); }

.review-shell .review-toolbar {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(170px, auto) auto;
  align-items: end;
  gap: 4px 12px;
}
.review-shell .review-toolbar > label { grid-row: 1; }
.review-shell .review-toolbar > label:nth-child(2) { grid-column: 2; min-width: 0; }
.review-shell .import-request-control { display: contents; }
.review-shell .review-toolbar #importRequestButton { grid-column: 3; grid-row: 1; min-height: 42px; align-self: end; }
.review-shell .review-toolbar #importRequestStatus { grid-column: 3; grid-row: 2; }
.review-shell .review-toolbar #refreshButton { grid-column: 4; grid-row: 1; min-height: 42px; align-self: end; }
@media (max-width: 900px) {
  .review-shell { width: min(100% - 18px, 720px); margin-top: 9px; }
  .topbar, .header-actions { align-items: stretch; flex-direction: column; }
  .review-shell .account-menu { align-self: flex-end; }
  .topbar-actions { overflow-x: auto; }
  .review-workspace { grid-template-columns: 1fr; }
  .review-shell .candidate-panel { min-height: 0; }
  .candidate-list { max-height: 360px; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .candidate-form footer { grid-template-columns: 1fr 1fr; }
  .candidate-form footer span { display: none; }
  .review-shell .candidate-form footer #applyButton { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  .review-shell .review-toolbar { grid-template-columns: minmax(0, 1fr) auto; }
  .review-shell .review-toolbar > label:first-child { grid-column: 1 / -1; grid-row: 1; }
  .review-shell .review-toolbar > label:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .review-shell .review-toolbar #importRequestButton { grid-column: 1; grid-row: 3; }
  .review-shell .review-toolbar #importRequestStatus { grid-column: 1; grid-row: 4; }
  .review-shell .review-toolbar #refreshButton { grid-column: 2; grid-row: 3; }
}
