:root {
  --bg: #f4f4f5;
  --card: #ffffff;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --text: #111111;
  --muted: #737373;
  --muted-2: #8a8a8a;
  --radius: 10px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

.hidden {
  display: none !important;
}

.app {
  min-height: 100vh;
}

.simple-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
}

.simple-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

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

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-mark img {
  width: 28px;
  height: 28px;
  display: block;
  object-fit: contain;
}

.brand-name {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.02em;
}

.welcome h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.welcome p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 14.5px;
}

.welcome.compact h1 {
  font-size: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}

.upload-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.field-label {
  font-size: 13px;
  font-weight: 500;
  color: #333;
}

.field input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  outline: none;
}

.field input:focus {
  border-color: #222;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  margin-top: 4px;
}

.primary-btn {
  background: #111;
  color: #fff;
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.primary-btn:hover:not(:disabled) {
  background: #000;
}

.secondary-btn {
  background: #fff;
  color: #111;
  border: 1px solid var(--border-strong);
}

.secondary-btn:hover {
  background: #f7f7f7;
}

.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  padding: 36px 16px;
  background: #fafafa;
  cursor: pointer;
  margin-bottom: 14px;
  text-align: center;
}

.file-drop input {
  display: none;
}

.file-drop-title {
  font-weight: 600;
  font-size: 14px;
}

.file-drop-sub {
  font-size: 12.5px;
  color: var(--muted);
}

.file-name {
  font-size: 12.5px;
  color: #333;
  margin-top: 4px;
}

.status-line {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.status-line.error {
  color: #b42318;
}

.processing-card {
  text-align: center;
}

.progress-pct {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 16px;
}

.progress-track {
  width: 100%;
  height: 10px;
  background: #ececec;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #111;
  border-radius: 999px;
  transition: width 0.25s ease;
}

.progress-stage {
  margin: 16px 0 22px;
  color: var(--muted);
  font-size: 14px;
}

.progress-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0;
}

.progress-stats div {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 10px;
}

.progress-stats dt {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.progress-stats dd {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.progress-stats dd.stage-value {
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
}

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

.results-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.summary-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}

.summary-card span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.summary-card strong {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.result-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-print-card,
.detail-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-print-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.result-print-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.detail-label {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

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

.detail-pct {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.match-pill {
  display: inline-flex;
  align-items: center;
  background: #efefef;
  color: #444;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
}

.detail-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: #222;
}

.detail-body.phrase {
  font-style: italic;
}

.detail-body.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
}

.empty-state {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  color: var(--muted);
  font-size: 14px;
}

.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: #f4f4f5;
  padding: 24px;
}

.lock-screen.hidden {
  display: none;
}

.lock-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 26px 24px;
}

.lock-brand {
  padding: 0 0 18px;
}

.lock-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.lock-card > p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  width: 100%;
  padding-right: 42px;
}

.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: #666;
}

.password-toggle:hover {
  background: #f3f3f3;
}

.password-toggle .hidden {
  display: none;
}

@media (max-width: 720px) {
  .welcome h1 {
    font-size: 22px;
  }

  .progress-stats,
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .results-head {
    flex-direction: column;
  }

  .result-print-head {
    flex-direction: column;
  }
}

@media print {
  body {
    background: #fff;
  }

  .simple-header,
  .no-print,
  .results-actions {
    display: none !important;
  }

  .simple-main {
    max-width: none;
    padding: 0;
  }

  .result-print-card,
  .summary-card {
    break-inside: avoid;
  }
}
