:root {
  color-scheme: light;
  --ink: #1b1d18;
  --muted: #6d6a60;
  --page: #f3f0e8;
  --surface: rgba(255, 252, 246, 0.94);
  --surface-solid: #fffdf8;
  --surface-soft: #f7f2e8;
  --line: rgba(52, 47, 37, 0.16);
  --line-strong: rgba(52, 47, 37, 0.28);
  --brand: #163f35;
  --brand-soft: #e7f0eb;
  --terracotta: #b8643e;
  --sand: #d4c58b;
  --water: #2f7b83;
  --danger: #a93c32;
  --danger-soft: #fff0ec;
  --ok: #1d684f;
  --ok-soft: #e8f4ed;
  --shadow: 0 24px 70px rgba(40, 35, 25, 0.16);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.88) 0%, rgba(243, 240, 232, 0.94) 58%, rgba(243, 240, 232, 1) 100%),
    url("images/coastal-workspace.png") center top / cover no-repeat;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(27, 29, 24, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(27, 29, 24, 0.03) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 60%);
  z-index: -1;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.hero {
  min-height: 310px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: end;
  gap: 22px;
  padding: 34px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.52);
  background:
    linear-gradient(90deg, rgba(14, 21, 18, 0.70) 0%, rgba(14, 21, 18, 0.42) 42%, rgba(14, 21, 18, 0.10) 100%),
    url("images/coastal-workspace.png") center / cover no-repeat;
  box-shadow: var(--shadow);
}

.hero-copy {
  max-width: 740px;
  color: #fffdf8;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  color: inherit;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1,
h2 {
  margin: 0;
}

h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 4.25rem;
  font-weight: 500;
  line-height: 0.98;
}

h2 {
  font-size: 1.05rem;
  line-height: 1.2;
}

.hero-text {
  width: min(620px, 100%);
  margin: 18px 0 0;
  color: rgba(255, 253, 248, 0.86);
  font-size: 1.02rem;
  line-height: 1.7;
}

.hero-status {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(255, 253, 248, 0.88);
  backdrop-filter: blur(16px);
  color: var(--ink);
}

.status-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.status-topline span,
#progress-text,
.safe-note,
.panel-heading p,
.metric p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.status-topline strong {
  color: var(--ok);
  font-size: 0.92rem;
}

.status-topline strong.is-error {
  color: var(--danger);
}

.progress-track {
  height: 8px;
  margin: 16px 0 10px;
  overflow: hidden;
  background: rgba(22, 63, 53, 0.13);
  border: 1px solid rgba(22, 63, 53, 0.16);
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--water), var(--sand));
  transition: width 180ms ease;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.metric {
  min-width: 0;
  min-height: 84px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.82);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 38px rgba(40, 35, 25, 0.08);
}

.metric span {
  display: block;
  color: var(--brand);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(0, 1.08fr);
  gap: 16px;
  align-items: stretch;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(40, 35, 25, 0.11);
}

.panel-heading {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 242, 232, 0.72);
}

.panel-kicker {
  color: var(--terracotta);
}

.heading-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.input-panel,
.output-panel {
  min-height: 520px;
  display: flex;
  flex-direction: column;
}

textarea {
  width: 100%;
  min-height: 300px;
  flex: 1;
  resize: vertical;
  padding: 18px 20px;
  border: 0;
  outline: none;
  background: rgba(255, 253, 248, 0.78);
  color: var(--ink);
  line-height: 1.55;
  font-family: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
}

textarea:focus {
  box-shadow: inset 0 0 0 2px rgba(47, 123, 131, 0.22);
}

textarea[readonly] {
  background: #fcf7ec;
}

.options-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.58);
}

.check-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  user-select: none;
}

.check-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.toolbar {
  padding: 14px 20px;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0 14px;
  font-weight: 850;
  letter-spacing: 0;
}

.primary-button {
  min-width: 118px;
  background: var(--brand);
  color: #fffdf8;
}

.primary-button:hover {
  background: #0f3028;
}

.secondary-button,
.ghost-button {
  background: rgba(255, 253, 248, 0.7);
  border-color: var(--line-strong);
  color: var(--brand);
}

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

.results-panel {
  margin-top: 16px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.88rem;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eee5d5;
  color: #3c382f;
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

tbody tr {
  background: rgba(255, 253, 248, 0.72);
}

tbody tr:hover {
  background: #fff7e8;
}

.line-cell {
  max-width: 480px;
  font-family: "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  overflow-wrap: anywhere;
}

.empty-state {
  height: 190px;
  color: var(--muted);
  text-align: center;
  vertical-align: middle;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid rgba(29, 104, 79, 0.28);
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.tag.error {
  border-color: rgba(169, 60, 50, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
}

.tag.pending {
  border-color: rgba(184, 100, 62, 0.34);
  background: #fff4e9;
  color: #854119;
}

.loader {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(22, 63, 53, 0.18);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  .hero,
  .workbench {
    grid-template-columns: 1fr;
  }

  .hero {
    align-items: start;
  }

  .hero-status {
    width: min(100%, 520px);
  }

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

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 18px, 1480px);
    padding: 9px 0 22px;
  }

  .hero {
    min-height: 420px;
    padding: 24px;
  }

  h1 {
    font-size: 2.65rem;
  }

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

  .panel-heading,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .heading-actions,
  .toolbar,
  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    justify-content: center;
  }
}

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

  .hero {
    padding: 20px;
  }

  h1 {
    font-size: 2.25rem;
  }
}
