:root {
  color-scheme: light;
  --green: #42f58d;
  --cyan: #65e4ff;
  --ink: #102018;
  --muted: #65736d;
  --line: #d6e3de;
  --panel: #ffffff;
  --surface: #f4f8f6;
  --soft: #e9f4f1;
  --warn: #b74a2f;
  --shadow: 0 18px 50px rgba(26, 56, 45, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(101, 228, 255, 0.16), rgba(66, 245, 141, 0.05) 42%, #f7faf8 100%);
  font-family: "Segoe UI", Arial, sans-serif;
}

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

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

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.78fr);
  gap: 18px;
  align-items: start;
}

.editor,
.output-panel {
  background: var(--panel);
  border: 1px solid rgba(16, 32, 24, 0.08);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.editor {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.output-panel {
  position: sticky;
  top: 18px;
  padding: 20px;
}

.topbar,
.output-header,
.actions,
.output-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: #16705d;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  font-size: 2rem;
  line-height: 1.05;
}

h2 {
  font-size: 1.2rem;
}

.field-grid {
  display: grid;
  gap: 12px;
}

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

label,
.select-field {
  display: grid;
  gap: 6px;
}

label span,
legend {
  color: #26382f;
  font-size: 0.9rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fbfdfc;
  outline: none;
}

input,
select {
  min-height: 44px;
  padding: 10px 12px;
}

textarea {
  min-height: 120px;
  padding: 12px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #22b987;
  box-shadow: 0 0 0 3px rgba(66, 245, 141, 0.18);
}

.control-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 0.62fr);
  gap: 12px;
  align-items: end;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented legend {
  grid-column: 1 / -1;
  margin: 0 0 2px;
}

.segmented label {
  display: block;
}

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

.segmented span {
  display: grid;
  min-height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  cursor: pointer;
}

.segmented input:checked + span {
  border-color: rgba(66, 245, 141, 0.9);
  background: linear-gradient(135deg, var(--green), var(--cyan));
  color: #03120a;
}

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

.admin-panel summary {
  cursor: pointer;
  font-weight: 800;
}

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

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.check-row span {
  font-weight: 650;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 14px;
  font-weight: 850;
  cursor: pointer;
}

.primary-button {
  background: linear-gradient(135deg, var(--green), var(--cyan));
  color: #03120a;
  border-color: rgba(66, 245, 141, 0.75);
}

.secondary-button {
  background: #f7fbf9;
  color: #173326;
  border-color: var(--line);
}

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

#reviewOutput {
  margin-top: 16px;
  min-height: 420px;
  background: #f9fcfb;
}

.output-meta {
  min-height: 28px;
  color: var(--muted);
  font-size: 0.9rem;
  padding-top: 8px;
}

#copyStatus {
  color: #17735f;
  font-weight: 750;
}

.warning {
  color: var(--warn);
}

@media (max-width: 900px) {
  .workspace,
  .field-grid.two,
  .control-row,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .output-panel {
    position: static;
  }

  .topbar,
  .output-header,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar button,
  .output-header button,
  .actions button {
    width: 100%;
  }
}
