:root {
  color-scheme: light dark;
  --bg: #fffcf6;
  --surface: #fffcf6;
  --surface-2: #f6efe3;
  --surface-3: #efe5d5;
  --ink: #2b2620;
  --muted: #6e6458;
  --line: #e4d8c6;
  --line-strong: #cdbca3;
  --accent: #a84323;
  --accent-ink: #ffffff;
  --accent-soft: #f5e3db;
  --nav-active-text: #8f351b;
  --danger: #9b2c1f;
  --warning-bg: #fbf0dc;
  --warning-line: #e7c995;
  --warning-ink: #6c4b13;
  --success: #3d6b4f;
  --track: #f0e7d9;
  --shadow: 0 10px 30px rgb(69 48 27 / 7%);
  --shadow-dialog: 0 30px 80px rgb(30 20 10 / 30%);
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Source Han Serif SC",
    serif;
  --radius: 20px;
  --tap: 44px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17130f;
    --surface: #211d19;
    --surface-2: #2a241e;
    --surface-3: #342c24;
    --ink: #f2eadf;
    --muted: #b9ac9b;
    --line: #3b332a;
    --line-strong: #5b4d3f;
    --accent: #c96a4b;
    --accent-ink: #17130f;
    --accent-soft: #3a271f;
    --nav-active-text: #f2eadf;
    --danger: #e58b78;
    --warning-bg: #332a1b;
    --warning-line: #5f4c27;
    --warning-ink: #f0d59c;
    --success: #8fc9a6;
    --track: #302820;
    --shadow: 0 10px 30px rgb(0 0 0 / 22%);
    --shadow-dialog: 0 30px 80px rgb(0 0 0 / 55%);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 100% 0%, var(--accent-soft), transparent 34rem),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.has-nav .shell {
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
}

[hidden] {
  display: none !important;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button,
summary,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3,
.brand-title,
.result-title,
.partner-name,
.summary-text,
.quote-text {
  font-family: var(--font-serif);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  background: var(--bg);
}

@supports (background: color-mix(in srgb, red 50%, transparent)) {
  .topbar {
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: blur(14px);
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-seal {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 12%);
}

.brand-text {
  display: grid;
  line-height: 1.18;
  min-width: 0;
}

.brand-title {
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-sub {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.shell {
  width: min(100%, 780px);
  margin: 0 auto;
  padding: 26px 18px calc(42px + env(safe-area-inset-bottom));
}

.view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: rise-in 0.28s ease-out both;
}

.narrow-view {
  width: min(100%, 600px);
  margin: 0 auto;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero {
  padding: 8px 2px 6px;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--accent);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.hero h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.hero-copy {
  max-width: 36rem;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.resume-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background: linear-gradient(135deg, var(--accent-soft), var(--surface) 76%);
}

.resume-title {
  margin-bottom: 3px;
  font-size: 1.08rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.resume-actions {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}

.upload-card {
  padding: 16px;
}

.dropzone {
  display: flex;
  width: 100%;
  min-height: 196px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--ink);
  text-align: center;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone:active {
  transform: scale(0.995);
}

.dropzone-mark {
  display: grid;
  width: 52px;
  height: 44px;
  place-items: center;
  margin-bottom: 4px;
  border: 1.5px solid var(--accent);
  border-radius: 9px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.dropzone-title {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-weight: 700;
}

.dropzone-hint {
  color: var(--muted);
  font-size: 0.78rem;
}

.hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.small {
  font-size: 0.78rem;
}

.muted {
  color: var(--muted);
}

.paste-fallback {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.paste-fallback summary,
.advanced-options summary,
.table-details summary {
  display: flex;
  min-height: var(--tap);
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
}

.paste-fallback[open] summary,
.advanced-options[open] summary,
.table-details[open] summary {
  color: var(--ink);
}

.paste-fallback .secondary-button {
  margin-top: 10px;
}

.file-card {
  display: grid;
  gap: 14px;
}

.file-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.file-name-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.file-name {
  margin: 0;
  max-width: 100%;
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field > span,
.label-row label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  transition: border-color 0.16s ease;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
  outline-offset: 0;
}

input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.stat {
  min-width: 0;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 14px;
  background: var(--surface-2);
}

.stat-label {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.stat-value {
  font-family: var(--font-ui);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.stat-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-title {
  margin-bottom: 2px;
  font-size: 1.08rem;
  line-height: 1.35;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading .section-title {
  margin-bottom: 2px;
}

.section-heading .muted {
  margin: 0;
}

.preview-copy-wrap {
  display: grid;
  gap: 4px;
}

.preview-copy {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 0.88rem;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.advanced-options {
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.advanced-options .field {
  margin-top: 6px;
}

.advanced-options .hint {
  margin-bottom: 4px;
}

.warning-list {
  display: grid;
  gap: 8px;
}

.warning-item {
  display: flex;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--warning-line);
  border-radius: 12px;
  background: var(--warning-bg);
  color: var(--warning-ink);
  font-size: 0.78rem;
  line-height: 1.55;
}

.warning-item::before {
  content: "!";
  display: grid;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  place-items: center;
  margin-top: 1px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 0.62rem;
  font-weight: 800;
}

.warning-item.is-info {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

.warning-item.is-info::before {
  content: "i";
  font-family: var(--font-serif);
  font-style: italic;
}

.chart-wrap {
  margin-top: 4px;
}

.chart {
  display: grid;
  gap: 7px;
}

.chart-row {
  display: grid;
  grid-template-columns: 4.1rem minmax(0, 1fr) 3.6rem;
  gap: 9px;
  align-items: center;
  min-height: 24px;
  font-size: 0.78rem;
}

.chart-label {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-track {
  display: flex;
  height: 13px;
  align-items: stretch;
  border-radius: 3px;
  background: var(--track);
  overflow: hidden;
}

.chart-bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--accent);
  transition: inline-size 0.35s ease;
}

.chart-bar.is-preface {
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: repeating-linear-gradient(
    45deg,
    var(--muted) 0 2px,
    transparent 2px 5px
  );
}

.chart-value {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  text-align: right;
}

.table-details {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.table-wrap {
  overflow-x: auto;
  padding-bottom: 2px;
}

.data-table {
  width: 100%;
  min-width: 280px;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.data-table caption {
  padding: 8px 0;
  color: var(--muted);
  text-align: left;
}

.data-table th,
.data-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table thead th {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
}

.data-table tbody th {
  font-weight: 600;
  white-space: nowrap;
}

.data-table .numeric {
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.start-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-soft), var(--surface) 82%);
}

.start-panel .hint {
  margin: 0;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.text-button {
  display: inline-flex;
  min-height: var(--tap);
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 999px;
  font-weight: 650;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.primary-button {
  min-height: 50px;
  padding: 12px 22px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.primary-button:hover {
  filter: brightness(1.04);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active {
  transform: translateY(1px);
}

.secondary-button {
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--ink);
}

.secondary-button:hover,
.ghost-button:hover {
  border-color: var(--accent);
}

.ghost-button {
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.ghost-button.compact,
.secondary-button.compact {
  min-height: var(--tap);
  padding: 7px 13px;
  font-size: 0.8rem;
}

.icon-button {
  flex: 0 0 var(--tap);
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 1.4rem;
  font-weight: 400;
}

.icon-button:hover {
  color: var(--ink);
}

.text-button {
  min-height: var(--tap);
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.8rem;
}

.text-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.danger-text {
  color: var(--danger);
}

.start-panel .primary-button {
  width: 100%;
}

.inline-error {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 38%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--danger) 9%, var(--surface));
  color: var(--danger);
  font-size: 0.8rem;
  line-height: 1.55;
}

.progress-head {
  padding: 14px 2px 2px;
}

.progress-title {
  margin-bottom: 4px;
  font-size: 1.9rem;
  letter-spacing: -0.025em;
}

.progress-title + p {
  margin: 0;
  overflow-wrap: anywhere;
}

.steps {
  display: grid;
  gap: 9px;
  margin: 4px 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  color: var(--muted);
  font-size: 0.86rem;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: grid;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.steps li.is-active {
  color: var(--ink);
  font-weight: 650;
}

.steps li.is-active::before {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.steps li.is-done {
  color: var(--ink);
}

.steps li.is-done::before {
  content: "✓";
  border-color: color-mix(in srgb, var(--success) 55%, var(--line));
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
  color: var(--success);
}

.progress-track {
  height: 10px;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.4s ease;
}

.progress-text {
  margin: 10px 0 0;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
}

#analysis-current {
  min-height: 1.4em;
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.progress-actions {
  display: grid;
  gap: 4px;
  margin-top: 24px;
}

.progress-actions .secondary-button {
  width: 100%;
}

.error-box {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 38%, var(--line));
  border-radius: 14px;
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
}

.error-box p {
  margin: 0;
  color: var(--danger);
  font-size: 0.84rem;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 2px 2px;
}

.result-head > div {
  min-width: 0;
}

.result-head .eyebrow {
  margin-bottom: 4px;
}

.result-title {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 7vw, 2.3rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.result-banner {
  display: grid;
  gap: 9px;
}

.result-banner:empty {
  display: none;
}

.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--warning-line);
  border-radius: 14px;
  background: var(--warning-bg);
  color: var(--warning-ink);
  font-size: 0.8rem;
  line-height: 1.55;
}

.banner > div {
  min-width: 12rem;
  flex: 1;
}

.banner strong {
  display: block;
  margin-bottom: 1px;
  font-size: 0.85rem;
}

.banner.is-info {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--muted);
}

.banner .secondary-button {
  flex: 0 0 auto;
}

.partner-overview {
  display: grid;
  gap: 12px;
}

.partner-overview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.partner-name {
  margin: 2px 0 0;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.partner-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.partner-reason {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 0.88rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.partner-empty {
  display: grid;
  gap: 10px;
  padding: 4px 0;
}

.partner-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.stack {
  display: grid;
  gap: 12px;
}

.summary-card,
.quote-group,
.empty-state {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-card.is-missing {
  opacity: 0.72;
}

.summary-head,
.quote-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.chapter-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.chapter-label {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.03em;
}

.chapter-title {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.summary-text {
  margin: 8px 0 0;
  font-size: 1.02rem;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

.summary-warning {
  margin: 7px 0 0;
  color: var(--warning-ink);
  font-size: 0.72rem;
}

.quote-group {
  display: grid;
  gap: 0;
}

.quote-group-head {
  padding-bottom: 8px;
}

.quote-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.quote-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.quote-text {
  margin: 0;
  font-size: 1.01rem;
  line-height: 1.9;
  overflow-wrap: anywhere;
}

.quote-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.chip {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 650;
  white-space: nowrap;
}

.copy-button {
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 650;
}

.copy-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.empty-state {
  display: grid;
  gap: 10px;
  border-style: dashed;
  box-shadow: none;
  color: var(--muted);
  text-align: center;
}

.empty-state p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.6;
}

.empty-state .secondary-button {
  justify-self: center;
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 -10px 28px rgb(40 26 12 / 8%);
  backdrop-filter: blur(14px);
}

.tab-button {
  min-height: 48px;
  padding: 6px 4px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 650;
}

.tab-button.is-active {
  background: var(--accent-soft);
  color: var(--nav-active-text);
}

.dialog {
  width: min(92vw, 680px);
  max-width: none;
  max-height: 88vh;
  max-height: 88dvh;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-dialog);
}

.dialog::backdrop {
  background: rgb(24 17 10 / 52%);
  backdrop-filter: blur(3px);
}

.dialog[open] {
  animation: dialog-in 0.2s ease-out both;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dialog-body {
  display: flex;
  max-height: 88vh;
  max-height: 88dvh;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.dialog-head .eyebrow {
  margin-bottom: 3px;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 4px;
}

.dialog-actions.spread {
  justify-content: space-between;
}

.wrap-actions > :first-child {
  margin-right: auto;
}

.candidate-list {
  display: grid;
  gap: 9px;
}

.candidate {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  cursor: pointer;
}

.candidate:hover {
  border-color: var(--line-strong);
}

.candidate:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.candidate input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 4px;
  accent-color: var(--accent);
}

.candidate-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.candidate-name {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 700;
}

.candidate-meta {
  color: var(--muted);
  font-size: 0.73rem;
  line-height: 1.45;
}

.candidate-evidence {
  margin: 4px 0 0;
  padding-left: 9px;
  border-left: 2px solid var(--line-strong);
  color: var(--muted);
  font-family: var(--font-serif);
  font-size: 0.8rem;
  line-height: 1.65;
}

.settings-section {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.settings-section h3 {
  margin-bottom: 0;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 700;
}

.settings-section > .hint {
  margin: 0;
}

.requirement-field {
  display: grid;
  gap: 5px;
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.label-row .text-button {
  min-height: var(--tap);
  font-size: 0.72rem;
}

.requirement-field textarea {
  min-height: 94px;
  font-size: 16px;
}

.char-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.68rem;
  text-align: right;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.privacy-note {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.7;
}

.prompt-pre {
  max-height: 50vh;
  max-height: 50dvh;
  margin: 0;
  padding: 13px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.7rem;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  bottom: calc(26px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 100;
  max-width: 86vw;
  padding: 9px 16px;
  border: 1px solid color-mix(in srgb, var(--ink) 15%, transparent);
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

body.has-nav .toast {
  bottom: calc(88px + env(safe-area-inset-bottom));
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .shell {
    padding-right: 24px;
    padding-left: 24px;
  }

  .card {
    padding: 22px;
  }

  .chart-row {
    grid-template-columns: 4.6rem minmax(0, 1fr) 4rem;
  }
}

@media (max-width: 390px) {
  .shell {
    padding-right: 14px;
    padding-left: 14px;
  }

  .card {
    padding: 15px;
  }

  .topbar {
    padding-right: 14px;
    padding-left: 14px;
  }

  .chart-row {
    grid-template-columns: 3.7rem minmax(0, 1fr) 3.2rem;
    gap: 7px;
    font-size: 0.73rem;
  }

  .resume-card {
    align-items: stretch;
    flex-direction: column;
  }

  .resume-actions {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
  }

  .dialog-body {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
