:root {
  --bg: #f7f5f0;
  --panel: #ffffff;
  --text: #252525;
  --muted: #6f6a64;
  --line: #e5ded6;
  --accent: #dd6b20;
  --accent-dark: #9c3f10;
  --rose: #d98d8c;
}

* {
  box-sizing: border-box;
}

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

.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 22px 0 28px;
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 38px;
}

h2 {
  font-size: 20px;
}

h3 {
  font-size: 18px;
  margin-bottom: 12px;
}

button {
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 8px;
  min-width: 120px;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: var(--accent-dark);
  border: 1px solid #e9c4aa;
}

button.copy-prompt {
  width: 100%;
  min-width: 0;
  margin-top: 10px;
  padding: 9px 11px;
  background: #fff7f0;
  color: var(--accent-dark);
  border: 1px solid #e9c4aa;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 12px 32px rgba(74, 56, 38, 0.06);
}

.form-panel {
  position: sticky;
  top: 20px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--text);
  background: #fff;
  font: inherit;
  line-height: 1.45;
}

textarea {
  min-height: 78px;
  resize: vertical;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 18px;
}

#status {
  color: var(--muted);
  max-width: 520px;
  font-size: 14px;
}

.empty {
  color: var(--muted);
  padding: 40px 0;
  text-align: center;
}

.summary {
  margin-bottom: 24px;
}

.template-preview:empty {
  display: none;
}

.template-box {
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.template-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.template-title p {
  margin-bottom: 0;
  color: var(--muted);
}

.template-title span {
  color: var(--accent-dark);
  border: 1px solid #ead1bf;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  width: 160px;
  color: var(--accent-dark);
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffdfb;
}

.card.compact p {
  font-size: 13px;
}

.card-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.card-title strong {
  color: var(--accent-dark);
}

.card-title span {
  color: var(--text);
  font-weight: 700;
}

.copy {
  color: var(--accent-dark);
  font-weight: 700;
}

.risk {
  color: #884018;
  background: #fff4e9;
  border: 1px solid #f3d0b5;
  border-radius: 6px;
  padding: 8px;
  font-size: 13px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.tags span {
  border: 1px solid #ead1bf;
  background: #fff7f0;
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}

details {
  margin-top: 12px;
}

.tune-box {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed #e9c4aa;
  border-radius: 8px;
  background: #fffaf5;
}

.tune-box label {
  margin-bottom: 0;
}

.tune-box select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

button.revise-prompt {
  width: 100%;
  min-width: 0;
  background: var(--accent-dark);
}

.revised-output {
  min-height: 150px;
}

summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 700;
}

details textarea {
  margin-top: 10px;
  min-height: 170px;
}

.saved {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .layout,
  .grid {
    grid-template-columns: 1fr;
  }

  .form-panel {
    position: static;
  }

  .topbar,
  .result-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
