:root {
  --bg-top: #f7efe6;
  --bg-bottom: #dfe9f2;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-solid: #ffffff;
  --ink: #13222f;
  --muted: #5d6974;
  --line: rgba(19, 34, 47, 0.12);
  --accent: #0f8a7c;
  --accent-deep: #0f5e57;
  --accent-soft: rgba(15, 138, 124, 0.12);
  --warm: #b1532c;
  --warm-soft: rgba(177, 83, 44, 0.12);
  --shadow: 0 18px 60px rgba(19, 34, 47, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Outfit", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 138, 124, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(177, 83, 44, 0.12), transparent 24%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
}

code,
.text-preview,
.log,
table {
  font-family: "IBM Plex Mono", monospace;
}

.app-shell {
  width: min(1360px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.hero {
  display: flex;
  gap: 18px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.hero-copy {
  min-width: 0;
}

.eyebrow,
.step-label {
  margin: 0 0 8px;
  color: var(--accent-deep);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hero h1,
.panel h2,
.rule-card h3 {
  margin: 0;
  line-height: 1;
}

.hero h1 {
  font-size: clamp(1.5rem, 4vw, 3.2rem);
}

.hero-subtitle {
  max-width: 840px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.badge {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(12px);
  font-size: 0.84rem;
}

.control-grid,
.results-grid {
  display: grid;
  gap: 14px;
}

.control-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
  align-items: start;
}

.results-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  margin-bottom: 14px;
}

.panel {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

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

.panel-head-stack {
  align-items: center;
}

.panel-copy {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.upload-box {
  display: block;
  margin-top: 14px;
  padding: 18px;
  border: 1.5px dashed rgba(15, 138, 124, 0.36);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(15, 138, 124, 0.08), rgba(255, 255, 255, 0.98)),
    var(--panel-solid);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.upload-box:hover,
.upload-box.drag-over {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: 0 16px 34px rgba(15, 138, 124, 0.14);
}

.upload-title,
.upload-subtitle {
  display: block;
}

.upload-title {
  font-weight: 700;
  font-size: 0.98rem;
}

.upload-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.field-stack {
  margin-top: 14px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 700;
}

.required-mark {
  color: var(--warm);
}

.text-input,
.text-preview {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(19, 34, 47, 0.16);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font: inherit;
}

.text-input:focus,
.text-preview:focus {
  outline: 2px solid rgba(15, 138, 124, 0.2);
  outline-offset: 2px;
  border-color: rgba(15, 138, 124, 0.45);
}

.text-preview {
  resize: none;
  line-height: 1.55;
}

.field-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.status,
.summary,
.log,
.empty-block {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.status {
  background: rgba(19, 34, 47, 0.05);
  color: var(--muted);
}

.status-ready {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.status-error {
  background: var(--warm-soft);
  color: var(--warm);
}

.summary {
  background: linear-gradient(180deg, rgba(15, 138, 124, 0.08), rgba(255, 255, 255, 0.95));
  white-space: pre-wrap;
}

.log {
  background: rgba(19, 34, 47, 0.05);
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
}

.empty-block {
  color: var(--muted);
  background: rgba(19, 34, 47, 0.04);
}

.action-panel {
  display: grid;
  gap: 14px;
}

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

.rule-card {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
}

.rule-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.primary-button,
.secondary-button,
.ghost-button,
.download-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.primary-button,
.secondary-button {
  width: 100%;
  padding: 14px 18px;
  font-weight: 700;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #ffffff;
}

.secondary-button {
  background: rgba(19, 34, 47, 0.08);
  color: var(--ink);
}

.panel-head-stack .secondary-button {
  width: auto;
  min-width: 210px;
}

.ghost-button {
  padding: 8px 12px;
  background: rgba(19, 34, 47, 0.07);
  color: var(--ink);
  font-size: 0.88rem;
}

.download-button {
  padding: 10px 14px;
  background: rgba(15, 138, 124, 0.1);
  color: var(--accent-deep);
  font-weight: 700;
}

.primary-button:hover:not(:disabled),
.secondary-button:hover:not(:disabled),
.ghost-button:hover,
.download-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.download-list,
.preview-grid {
  display: grid;
  gap: 12px;
}

.download-card,
.preview-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
}

.download-meta,
.preview-meta {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
}

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

th,
td {
  padding: 9px 11px;
  border-bottom: 1px solid rgba(19, 34, 47, 0.08);
  text-align: left;
  font-size: 0.83rem;
}

thead th {
  position: sticky;
  top: 0;
  background: #eef9f7;
}

tbody tr:nth-child(even) {
  background: rgba(19, 34, 47, 0.025);
}

.hidden {
  display: none;
}

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

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

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 18px, 1360px);
    padding-top: 14px;
  }

  .hero {
    display: grid;
    align-items: start;
  }

  .hero-badges {
    justify-content: flex-start;
  }

  .panel {
    padding: 15px;
    border-radius: 20px;
  }

  .panel-head,
  .panel-head-stack {
    flex-direction: column;
    align-items: stretch;
  }
}
