:root {
  color-scheme: light;
  --ink: #20221f;
  --muted: #6d7169;
  --line: #d9ddd3;
  --paper: #f7f8f4;
  --panel: #ffffff;
  --green: #315f4d;
  --green-2: #e8f1ec;
  --ochre: #9a6a20;
  --ochre-2: #f4ead9;
  --red: #9b2f2f;
  --red-2: #f5e1df;
  --blue: #385a70;
  --shadow: 0 18px 45px rgba(32, 34, 31, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

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

button {
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: white;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.96);
}

button:disabled {
  cursor: progress;
  opacity: 0.68;
}

button.secondary {
  background: var(--green-2);
  color: var(--green);
  border: 1px solid #b9cec3;
}

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

.login-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 220px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(49, 95, 77, 0.13);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

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

.brand-mark {
  display: inline-grid;
  place-items: center;
  min-width: 78px;
  height: 38px;
  border: 2px solid var(--green);
  color: var(--green);
  font-weight: 900;
  letter-spacing: 0;
}

.brand-mark.small {
  min-width: 64px;
  height: 30px;
  font-size: 13px;
}

.app-title {
  font-size: 22px;
  font-weight: 800;
}

.subline {
  margin: 7px 0 0;
  color: var(--muted);
}

.top-actions,
.button-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 5px 10px;
  background: #eef0eb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pill.good {
  background: var(--green-2);
  color: var(--green);
}

.pill.warn {
  background: var(--ochre-2);
  color: var(--ochre);
}

.pill.bad {
  background: var(--red-2);
  color: var(--red);
}

.system-warning {
  margin: 16px 28px 0;
  padding: 12px 14px;
  border: 1px solid #e1c58e;
  background: var(--ochre-2);
  color: var(--ochre);
  border-radius: 6px;
  font-weight: 700;
}

.workspace {
  width: min(1560px, calc(100vw - 36px));
  margin: 20px auto 48px;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.tab {
  background: transparent;
  color: var(--muted);
  border-radius: 6px 6px 0 0;
  padding: 11px 14px;
}

.tab.active {
  background: #fff;
  color: var(--green);
  border: 1px solid var(--line);
  border-bottom-color: #fff;
  margin-bottom: -1px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.grid.two {
  display: grid;
  grid-template-columns: minmax(430px, 0.86fr) minmax(520px, 1.14fr);
  gap: 18px;
}

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

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

.panel h2 {
  margin: 0;
  font-size: 19px;
}

.muted,
.meta {
  color: var(--muted);
  font-size: 13px;
}

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

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

.output-panel {
  min-height: 760px;
}

.result-box.empty,
.mini-empty,
.loading {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #fbfcf9;
}

.related-box {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.related-box h3,
.output-section h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.production-progress {
  border: 1px solid #b9cec3;
  border-radius: 8px;
  background: #fbfcf9;
  padding: 14px;
  margin-bottom: 14px;
}

.production-progress.hidden {
  display: none;
}

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

.progress-topline strong {
  display: block;
  margin-bottom: 4px;
}

.progress-topline p {
  margin: 0;
  color: var(--muted);
}

.step-list {
  list-style: none;
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.step-list li {
  position: relative;
  display: grid;
  gap: 2px;
  min-height: 46px;
  padding: 10px 10px 10px 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.step-list li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 14px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid #c4cabe;
  background: #fff;
}

.step-list li.done::before {
  border-color: var(--green);
  background: var(--green);
  box-shadow: inset 0 0 0 3px #fff;
}

.step-list li.active {
  border-color: #b9cec3;
  background: var(--green-2);
}

.step-list li.active::before {
  border-color: var(--green);
  animation: pulse 1.1s ease-in-out infinite;
}

.step-list li.failed {
  border-color: #e3aaa3;
  background: var(--red-2);
}

.step-list li.failed::before {
  border-color: var(--red);
  background: var(--red);
}

.step-list li span {
  font-weight: 800;
}

.step-list li small {
  color: var(--muted);
}

.compact-steps {
  gap: 8px;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(49, 95, 77, 0.25);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(49, 95, 77, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(49, 95, 77, 0);
  }
}

.memory-item,
.record-card,
.source-card,
.governance-grid article,
.claim,
.issue,
.pass {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.memory-item p,
.record-card p,
.source-card p,
.governance-grid p,
.claim p,
.issue p {
  margin: 6px 0;
}

.record-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.record-head h2 {
  margin: 0 0 6px;
}

.output-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.output-section:last-child {
  border-bottom: 0;
}

.prose {
  white-space: normal;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  line-height: 1.65;
}

.claim.verified,
.pass {
  background: var(--green-2);
  border-color: #b9cec3;
}

.claim.interpretation_only {
  background: #eef0eb;
  border-color: var(--line);
}

.claim.unresolved,
.claim.partially_verified,
.issue.medium {
  background: var(--ochre-2);
  border-color: #e1c58e;
}

.claim.rejected,
.issue.high {
  background: var(--red-2);
  border-color: #e3aaa3;
}

.source-link {
  display: inline-flex;
  margin: 0 8px 8px 0;
  padding: 7px 9px;
  border-radius: 6px;
  background: #eef0eb;
  color: var(--blue);
  text-decoration: none;
  font-weight: 700;
}

.seo-package {
  display: grid;
  gap: 14px;
}

.seo-language,
.seo-best {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcf9;
}

.seo-language h4,
.seo-best h4 {
  margin: 0;
}

.seo-line {
  display: grid;
  gap: 3px;
}

.seo-line strong,
.keyword-list strong {
  color: var(--green);
  font-size: 12px;
  text-transform: uppercase;
}

.seo-line small,
.seo-best small {
  color: var(--muted);
}

.keyword-list {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.keyword-list span {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 8px;
  background: #eef0eb;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.records-list,
.source-grid,
.governance-grid {
  display: grid;
  gap: 12px;
}

.record-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, auto);
  gap: 18px;
  align-items: start;
}

.record-card h3,
.source-card h3,
.governance-grid h3 {
  margin: 0;
  font-size: 16px;
}

.status-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr)) auto auto;
  gap: 8px;
}

.source-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.source-card {
  position: relative;
}

.source-card.discovery {
  background: #fbfcf9;
}

.source-country {
  color: var(--ochre);
  font-weight: 900;
  font-size: 12px;
  margin-bottom: 8px;
}

.governance-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.login-body {
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-shell {
  width: min(440px, 100%);
}

.login-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-panel h1 {
  margin: 18px 0 8px;
  font-size: 27px;
}

.login-panel p {
  color: var(--muted);
  margin: 0 0 20px;
}

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

.alert {
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-weight: 700;
}

.alert.danger {
  background: var(--red-2);
  color: var(--red);
}

.alert.warning {
  background: var(--ochre-2);
  color: var(--ochre);
}

@media (max-width: 1100px) {
  .grid.two,
  .record-card,
  .source-grid,
  .governance-grid {
    grid-template-columns: 1fr;
  }

  .status-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar,
  .panel-heading,
  .record-head {
    flex-direction: column;
    align-items: stretch;
  }

  .workspace {
    width: min(100vw - 20px, 1560px);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    overflow-x: auto;
  }
}
