:root {
  color-scheme: light;
  --bg: #e8e8e6;
  --panel: rgba(232, 232, 230, 0.94);
  --panel-strong: rgba(238, 238, 236, 0.98);
  --text: #313234;
  --muted: #6d6e73;
  --line: rgba(49, 50, 52, 0.18);
  --line-strong: rgba(49, 50, 52, 0.3);
  --brand: #ef140f;
  --brand-dark: #c20d09;
  --radius-xl: 0;
  --radius-lg: 0;
  --radius-md: 0;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  padding: 0;
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  max-width: 468px;
  margin: 0 auto;
  padding: 0 18px 28px;
}

.hero {
  display: block;
  margin-bottom: 0;
}

.hero-copy,
.form-panel,
.action-panel,
.preview-panel {
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius-xl);
}

.hero-copy {
  padding: 24px 0 18px;
  background: transparent;
  border-top: 0;
}

.hero h1 {
  margin: 0;
  font-family: "Instrument Sans", sans-serif;
  font-size: 2.1rem;
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.05em;
  text-transform: lowercase;
}

.copy-button,
.ghost-button {
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 12px 14px;
  cursor: pointer;
  transition:
    background-color 150ms ease,
    color 150ms ease,
    background-color 150ms ease;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  font-weight: 700;
}

.copy-button {
  background: var(--brand);
  color: #f5f5f2;
  border-color: var(--brand);
}

.ghost-button {
  background: transparent;
  color: var(--text);
}

.copy-button:hover,
.ghost-button:hover {
  background: #f1f1ef;
  color: var(--text);
}

.copy-button:hover {
  background: var(--brand-dark);
  color: #f5f5f2;
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.form-panel,
.action-panel,
.preview-panel {
  padding: 18px 0;
}

.panel-header {
  margin-bottom: 14px;
}

.panel-header h2 {
  margin: 0;
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.field {
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 2px 0;
}

.field span,
.subsection legend,
.fluid-label,
.fluid-row-header span {
  font-size: 0.86rem;
  font-weight: 500;
}

.field span {
  line-height: 1.1;
  color: var(--muted);
  white-space: nowrap;
}

.field-control {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.field-control input,
.fluid-row input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(243, 243, 241, 0.85);
  padding: 9px 12px;
  color: var(--text);
}

.field-control-combo input {
  width: 0;
  flex: 1 1 0;
}

.field-control-combo input[name="ftAboveSlips"] {
  max-width: 58px;
  flex: 0 0 58px;
}

.field-inline-text {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.field-control-wide {
  width: 100%;
}

.field-control-wide input {
  width: 100%;
}

.field-clear {
  border: 0;
  background: transparent;
  color: var(--brand);
  padding: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.field-control input:focus,
.fluid-row input:focus {
  outline: none;
  border-color: var(--brand);
  background: #f6f6f4;
  box-shadow: inset 0 -2px 0 var(--brand);
}

.field-clear:hover {
  color: var(--brand-dark);
}

.subsection {
  margin: 14px 0 0;
  padding: 14px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: transparent;
}

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

.fluid-row {
  display: grid;
  grid-template-columns: 100px 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.action-panel {
  display: grid;
  gap: 12px;
  background: transparent;
}

.fluid-entry {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.fluid-entry-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fluid-entry .field-control {
  min-width: 0;
}

.fluid-entry .field-control input {
  width: 100%;
  min-width: 0;
}

.toggle-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  font-size: 0.94rem;
  font-weight: 500;
  cursor: pointer;
}

.toggle-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-ui {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: rgba(49, 50, 52, 0.14);
  transition: background-color 150ms ease;
}

.toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f5f5f2;
  box-shadow: 0 2px 8px rgba(31, 26, 20, 0.16);
  transition: transform 150ms ease;
}

.toggle-row input:checked + .toggle-ui {
  background: var(--brand);
}

.toggle-row input:checked + .toggle-ui::after {
  transform: translateX(20px);
}

.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.preview-panel {
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.preview {
  flex: 1;
  margin: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: "Manrope", sans-serif;
  font-size: 0.96rem;
  line-height: 1.9;
  white-space: pre-wrap;
}

@media (max-width: 680px) {
  body {
    padding: 8px;
  }

  .hero-copy,
  .form-panel,
  .action-panel,
  .preview-panel {
    padding-top: 14px;
    padding-bottom: 14px;
    border-radius: 0;
  }

  .field {
    grid-template-columns: 148px minmax(0, 1fr);
  }

  .fluid-row {
    grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }

  .action-buttons {
    grid-template-columns: 1fr;
  }

  .fluid-row-header {
    display: none;
  }
}
