:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #627085;
  --line: #dfe5ec;
  --accent: #146c5d;
  --accent-dark: #0f5147;
  --danger-bg: #fff3f0;
  --danger-text: #9b2f22;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
}

.shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(23, 32, 42, 0.06);
}

.upload-panel {
  display: grid;
  gap: 28px;
  max-width: 760px;
  margin: 8vh auto 0;
  padding: 36px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1.08;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.18rem;
}

.lead {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.upload-form {
  display: grid;
  gap: 14px;
}

label {
  font-weight: 700;
}

input[type="file"] {
  width: 100%;
  padding: 14px;
  border: 1px dashed #aeb8c5;
  border-radius: 8px;
  background: #fbfcfd;
}

button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  text-align: center;
  overflow-wrap: anywhere;
}

button:hover,
.secondary-button:hover {
  background: var(--accent-dark);
}

button:disabled,
button[aria-disabled="true"] {
  background: #d7dde5;
  color: #667386;
  cursor: not-allowed;
}

button:disabled:hover,
button[aria-disabled="true"]:hover {
  background: #d7dde5;
}

button.is-complete {
  background: #245a84;
}

button.is-complete:hover {
  background: #1c496b;
}

.button-status {
  flex: 0 0 auto;
  margin-right: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.75rem;
  line-height: 1.3;
}

button:disabled .button-status,
button[aria-disabled="true"] .button-status {
  background: rgba(255, 255, 255, 0.55);
}

.secondary-button {
  background: #233142;
  white-space: nowrap;
}

.secondary-action {
  background: #233142;
}

.secondary-action:hover {
  background: #172332;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.review-actions form {
  margin: 0;
}

.download-button {
  background: var(--accent);
}

.download-button:hover {
  background: var(--accent-dark);
}

.danger-button {
  background: #a63b32;
}

.danger-button:hover {
  background: #842e27;
}

.reference-category {
  margin-top: 26px;
}

.reference-grid {
  display: grid;
  gap: 16px;
}

.reference-card {
  padding: 22px;
}

.reference-card h3 {
  margin-top: 0;
  color: #233142;
  line-height: 1.4;
}

.reference-card p {
  margin-bottom: 8px;
}

.reference-card form {
  margin-top: 16px;
}

.apa-reference {
  padding: 12px;
  border-left: 4px solid var(--accent);
  background: #f5fbf9;
}

.alert {
  padding: 12px 14px;
  border: 1px solid #f1c5bd;
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger-text);
}

.alert p {
  margin-bottom: 0;
}

.result-shell {
  padding-top: 32px;
}

.result-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.result-header h1 {
  font-size: clamp(1.7rem, 4vw, 2.45rem);
  overflow-wrap: anywhere;
}

.workflow {
  display: grid;
  gap: 16px;
}

.workflow-heading h2 {
  margin-bottom: 0;
}

.workflow-steps {
  display: grid;
  gap: 10px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 8px;
  background: #fbfcfd;
}

.workflow-step.is-active {
  border-left-color: var(--accent);
  background: #f5fbf9;
}

.workflow-step.is-complete {
  border-left-color: #245a84;
  background: #f5f9fc;
}

.workflow-step.is-locked {
  border-left-color: #aeb8c5;
  background: #f3f5f7;
}

.workflow-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  min-height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.workflow-step.is-complete .workflow-icon {
  background: #245a84;
}

.workflow-step.is-locked .workflow-icon {
  background: #c8d0da;
  color: #536174;
}

.workflow-content {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.workflow-title {
  margin-bottom: 0;
  font-weight: 800;
}

.workflow-status {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.workflow-form {
  display: grid;
  gap: 12px;
}

.workflow-button {
  width: 100%;
  justify-content: flex-start;
}

.workflow-button.is-locked,
.workflow-step.is-locked .workflow-button {
  background: #d7dde5;
  color: #667386;
}

.workflow-button.is-complete,
.workflow-step.is-complete .workflow-button {
  background: #245a84;
  color: #ffffff;
}

.result-workflow {
  flex: 0 0 min(420px, 42vw);
}

.results {
  display: grid;
  gap: 16px;
}

.result-section {
  padding: 24px;
}

.result-section p {
  margin-bottom: 0;
  white-space: pre-wrap;
}

.result-section ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 20px;
}

pre {
  overflow-x: auto;
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: #f1f4f7;
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1040px);
    padding: 24px 0;
  }

  .upload-panel,
  .result-section {
    padding: 20px;
  }

  .result-header {
    display: grid;
  }

  .result-workflow {
    width: 100%;
    flex-basis: auto;
  }

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

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.result-alert {
  margin-bottom: 18px;
}

.methodology-block {
  margin-top: 34px;
}

.methodology-heading {
  margin-bottom: 18px;
}

.methodology-heading h1 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 4vw, 2.45rem);
}

.detected-methodology {
  margin-bottom: 16px;
}

.detected-methodology p + p {
  margin-top: 10px;
}

.score-panel {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
  padding: 24px;
}

.score-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.score-value {
  color: var(--accent);
  font-size: clamp(3rem, 10vw, 5rem);
  font-weight: 800;
  line-height: 1;
}

.inline-score {
  color: var(--accent-dark);
  font-size: 1.35rem;
  font-weight: 800;
}

.map-list {
  display: grid;
  gap: 12px;
}

.map-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.map-item p,
.map-item ul {
  margin-top: 6px;
  margin-bottom: 0;
}

.decision-panel {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  padding: 24px;
}

.decision-value {
  color: var(--accent-dark);
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: 800;
  line-height: 1.1;
}

@media (max-width: 720px) {
  .header-actions {
    display: grid;
    justify-content: stretch;
  }

  .header-actions form {
    display: grid;
  }
}

/* --- Hasil analisis rinci ------------------------------------------------ */

.badge {
  display: inline-block;
  padding: 3px 10px;
  margin: 2px 4px 2px 0;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.4;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-kritis { background: #fde8e8; color: #9b1c1c; border-color: #f5b5b5; }
.badge-mayor { background: #fef3e2; color: #92400e; border-color: #f7d9a8; }
.badge-minor { background: #eef6ff; color: #1e429f; border-color: #c3ddfd; }
.badge-warn { background: #fff8e1; color: #8a6d1a; border-color: #f2e2a0; }
.badge-ok { background: #e6f6ee; color: #0f5147; border-color: #b7e4ce; }
.badge-info { background: #eef2f7; color: #233142; border-color: #d5dde8; }
.badge-muted { background: #f4f6f8; color: #627085; border-color: #e2e8ee; }
.badge-score { background: #0f5147; color: #ffffff; border-color: #0f5147; }

.summary-badges { margin-bottom: 10px; }

.article-type-panel {
  margin: 14px 0;
  padding: 16px;
}

.article-type-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.article-type-form select {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 100%;
}

.finding-grid {
  display: grid;
  gap: 14px;
}

.finding-card {
  border: 1px solid var(--line);
  border-left: 5px solid #c3ddfd;
  border-radius: 10px;
  padding: 14px 16px;
  background: #fbfcfd;
}

.finding-card.priority-kritis { border-left-color: #d64545; }
.finding-card.priority-mayor { border-left-color: #e8a33d; }
.finding-card.priority-minor { border-left-color: #6a9fe8; }

.finding-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.finding-id {
  font-family: ui-monospace, monospace;
  font-weight: 800;
  color: #233142;
  margin-right: 6px;
}

.finding-location { font-size: 0.85rem; color: #46536a; margin: 4px 0; }
.finding-location code { background: #eef2f7; padding: 1px 6px; border-radius: 6px; }

.finding-quote {
  margin: 8px 0;
  padding: 10px 14px;
  border-left: 3px solid #0f5147;
  background: #f2f7f5;
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: #233142;
  overflow-wrap: anywhere;
}

.finding-detail { margin: 0; }
.finding-detail dt {
  font-weight: 700;
  color: #0f5147;
  margin-top: 8px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.finding-detail dd { margin: 2px 0 0 0; color: #233142; }
.finding-example { background: #fffdf4; border: 1px dashed #e3d9a8; padding: 8px 10px; border-radius: 8px; }

.table-scroll { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

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

.data-table th { background: #eef2f7; color: #233142; }
.data-table tr:nth-child(even) td { background: #fbfcfd; }

.revision-details summary {
  cursor: pointer;
  list-style: revert;
}
.revision-details summary h2 { display: inline; }
.revision-text { white-space: pre-wrap; }

.note-panel { background: #fffbf0; }
.excluded-panel { background: #f7f8fa; }
.excluded-panel summary { cursor: pointer; font-weight: 700; color: #627085; }
.excluded-item { border-bottom: 1px dashed var(--line); padding: 8px 0; }

@media (max-width: 720px) {
  .article-type-form { align-items: stretch; flex-direction: column; }
  .finding-head { row-gap: 6px; }
}

/* Mode analisis: pilihan di halaman unggah */
.mode-choice {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 12px 0;
  display: grid;
  gap: 10px;
}
.mode-choice legend { font-weight: 700; padding: 0 6px; }
.mode-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
}
.mode-option input { margin-top: 4px; }
.mode-option small { display: block; color: #627085; }
.mode-label { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mode-label .note { color: #627085; font-size: 0.85rem; }

/* Kartu data vertikal pengganti tabel horizontal */
.record-list { display: grid; gap: 10px; }
.record-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fbfcfd;
}
.record-card dl { margin: 0; }
.record-card dt {
  font-weight: 700;
  color: #0F5147;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-top: 8px;
}
.record-card dt:first-child { margin-top: 0; }
.record-card dd { margin: 2px 0 0 0; color: #233142; overflow-wrap: anywhere; }

/* Contoh revisi collapsible pada kartu temuan */
.example-details summary { cursor: pointer; font-weight: 600; color: #146C5D; }
.example-details p { margin: 6px 0 4px 0; white-space: pre-wrap; }
