:root {
  --bg: #edf2f0;
  --ink: #17211d;
  --muted: #60706a;
  --line: #ccd8d3;
  --panel: #fbfdfc;
  --panel-2: #f4f8f6;
  --accent: #0f766e;
  --accent-dark: #0b4f49;
  --warn: #a15c09;
  --danger: #a33a2f;
  --shadow: 0 20px 45px rgba(31, 45, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 42%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

button,
textarea {
  font: inherit;
}

button,
.file-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

button:hover,
.file-button:hover {
  border-color: #91aaa2;
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.secondary {
  background: var(--panel-2);
}

.shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: 280px minmax(360px, 0.9fr) minmax(420px, 1.2fr);
  gap: 18px;
  min-height: calc(100vh - 48px);
}

.side,
.panel {
  border: 1px solid var(--line);
  background: rgba(251, 253, 252, 0.94);
  box-shadow: var(--shadow);
}

.side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  border-radius: 8px;
}

.panel {
  border-radius: 8px;
  padding: 18px;
  min-width: 0;
}

.input-panel,
.output-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 0.98;
}

h2 {
  font-size: 1.35rem;
}

.lede {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.status-grid {
  display: grid;
  gap: 10px;
}

.status-grid div,
.metrics div {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 8px;
  padding: 12px;
}

.status-label,
.metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

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

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

textarea {
  width: 100%;
  min-height: 0;
  flex: 1;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 14px;
  font-family: "Cascadia Code", Consolas, "SFMono-Regular", monospace;
  font-size: 0.9rem;
}

textarea:focus {
  outline: 2px solid rgba(15, 118, 110, 0.24);
  border-color: var(--accent);
}

.upload-card,
.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 12px;
}

.upload-card strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.upload-card p,
.notice {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.notice.ready {
  color: #17633b;
  border-color: #a8dec0;
  background: #e8f7ef;
}

.notice.warn {
  color: var(--warn);
  border-color: #e4c38c;
  background: #fff3df;
}

.notice.busy {
  color: var(--accent-dark);
  border-color: #95cfc4;
  background: #dff1ed;
}

.notice.error {
  color: var(--danger);
  border-color: #e6aaa4;
  background: #ffebe8;
}

.toolbar,
.export-row {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.quality {
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.quality.good {
  background: #e8f7ef;
  color: #17633b;
  border-color: #a8dec0;
}

.quality.review {
  background: #fff3df;
  color: var(--warn);
  border-color: #e4c38c;
}

.quality.bad {
  background: #ffebe8;
  color: var(--danger);
  border-color: #e6aaa4;
}

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

.metrics strong {
  display: block;
  margin-top: 4px;
  font-size: 1.45rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.tab {
  min-width: 0;
  background: var(--panel-2);
}

.tab.active {
  background: #dff1ed;
  border-color: #95cfc4;
  color: var(--accent-dark);
}

.tab-view {
  display: none;
  flex: 1;
  min-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

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

.output-list {
  margin: 0;
  padding-left: 20px;
}

.output-list li + li {
  margin-top: 10px;
}

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

.action-list {
  display: grid;
  gap: 10px;
}

.action-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel-2);
}

.action-item strong {
  display: block;
  margin-bottom: 4px;
}

.action-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
  }

  .side {
    grid-column: 1 / -1;
    flex-direction: row;
    gap: 24px;
  }

  .status-grid {
    width: min(440px, 48%);
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 12px;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .side {
    flex-direction: column;
  }

  .status-grid {
    width: 100%;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-head {
    align-items: stretch;
  }

  textarea {
    min-height: 340px;
  }
}
