:root {
  --ink: #171b1f;
  --muted: #68716d;
  --paper: #f7f4ed;
  --panel: #fffdf8;
  --line: #ded8cb;
  --teal: #0f766e;
  --teal-dark: #0a5f59;
  --coral: #c95746;
  --amber: #d69a20;
  --blue: #496ca8;
  --plum: #76516f;
  --soft: rgba(255, 253, 248, 0.78);
  --shadow: 0 18px 48px rgba(23, 27, 31, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.07), transparent 34%),
    linear-gradient(180deg, #fbfaf7 0%, var(--paper) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(292px, 380px) minmax(0, 1fr);
  min-height: 100vh;
}

.tool-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 26px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.95), rgba(255, 253, 248, 0.88)),
    repeating-linear-gradient(0deg, rgba(23, 27, 31, 0.026) 0 1px, transparent 1px 28px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand h1,
.brand p,
.editor-header h2,
.editor-header p,
.status,
.mini-copy,
.disclosure-copy,
.brief-list,
.term-list,
.suggestion-list,
.candidate-list {
  margin: 0;
}

.brand h1 {
  font-size: 1.58rem;
  line-height: 1.05;
}

.brand p {
  max-width: 250px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 118, 110, 0.14);
}

.brand-mark span {
  display: block;
  width: 24px;
  height: 3px;
  border-radius: 999px;
  background: var(--teal);
}

.brand-mark span:nth-child(2) {
  width: 18px;
  background: var(--coral);
}

.brand-mark span:nth-child(3) {
  width: 28px;
  background: var(--amber);
}

.control-group {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.settings-drawer {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.7);
}

.settings-drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 0 15px;
  color: var(--ink);
  font-weight: 750;
  cursor: pointer;
}

.settings-drawer summary small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  text-align: right;
}

.settings-drawer[open] {
  padding-bottom: 14px;
}

.settings-drawer[open] summary {
  border-bottom: 1px solid var(--line);
}

.settings-drawer .control-group {
  margin-right: 14px;
  margin-left: 14px;
}

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

.two-field-group div {
  display: grid;
  gap: 8px;
}

.label-row,
.toggle-row,
.meter-label,
.pane-header,
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

label,
.meter-label span,
.compact-header h3 {
  font-weight: 750;
}

.label-row span,
.range-scale,
.stat-grid small,
.eyebrow,
.status,
.mini-copy,
.disclosure-copy,
.brief-list,
.term-list,
.suggestion-list,
.candidate-list {
  color: var(--muted);
  font-size: 0.82rem;
}

select,
textarea,
.text-input {
  width: 100%;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

select,
.text-input {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 12px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.range-scale {
  display: flex;
  justify-content: space-between;
}

.toggle-row {
  min-height: 32px;
}

.toggle-row input {
  width: 42px;
  height: 24px;
  margin: 0;
  accent-color: var(--teal);
}

.mini-textarea {
  min-height: 104px;
  max-height: 180px;
  resize: vertical;
  border-radius: 8px;
  padding: 11px;
  line-height: 1.5;
}

.mini-copy {
  min-height: 36px;
  line-height: 1.45;
}

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

.stat-grid div {
  display: grid;
  gap: 2px;
  min-height: 62px;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
}

.stat-grid span {
  font-size: 1.38rem;
  font-weight: 800;
}

.panel-actions,
.icon-cluster,
.profile-row,
.diff-legend {
  display: flex;
  gap: 10px;
}

.profile-row {
  align-items: center;
}

.profile-row .text-input {
  min-width: 0;
}

.panel-actions {
  margin-top: auto;
}

.ghost-button,
.primary-button,
.icon-button,
.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.ghost-button {
  flex: 1;
  min-height: 42px;
  gap: 8px;
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.mini-button {
  min-height: 32px;
  padding: 0 10px;
  color: #fff;
  background: var(--blue);
}

.subtle-button {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.primary-button {
  min-width: 132px;
  min-height: 48px;
  gap: 10px;
  color: #fff;
  background: var(--teal);
  box-shadow: 0 12px 26px rgba(15, 118, 110, 0.24);
}

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

.primary-button:hover {
  background: var(--teal-dark);
}

.mini-button:hover {
  background: #3d5b8f;
}

.subtle-button:hover {
  background: #f7f4ed;
}

svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 30px;
}

.editor-header {
  min-height: 72px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--coral);
  font-weight: 800;
  text-transform: uppercase;
}

.editor-header h2 {
  max-width: 860px;
  font-size: clamp(1.65rem, 3vw, 3.15rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.value-strip,
.workflow-strip,
.step-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.workflow-strip,
.step-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.value-strip div,
.workflow-strip div,
.goal-panel,
.step-card {
  display: grid;
  gap: 8px;
  min-height: 106px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.82);
}

.workflow-strip div {
  min-height: 92px;
  background: rgba(255, 255, 255, 0.68);
}

.goal-panel {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  align-items: center;
  min-height: 124px;
  background: rgba(255, 253, 248, 0.9);
}

.goal-copy {
  display: grid;
  gap: 8px;
}

.goal-copy h3 {
  margin: 0;
  font-size: 1.35rem;
}

.goal-copy p:last-child {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.step-card {
  min-height: 82px;
  background: rgba(255, 255, 255, 0.68);
}

.step-card.active {
  border-color: rgba(15, 118, 110, 0.45);
  background: rgba(15, 118, 110, 0.09);
}

.step-card.done {
  border-color: rgba(73, 108, 168, 0.28);
  background: rgba(73, 108, 168, 0.08);
}

.value-strip strong,
.workflow-strip strong,
.step-card strong {
  color: var(--ink);
  font-size: 0.98rem;
}

.value-strip span,
.workflow-strip span,
.step-card span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  min-height: min(54vh, 620px);
}

.text-pane {
  display: flex;
  flex-direction: column;
  min-height: 410px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.pane-header {
  min-height: 58px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.compact-header {
  min-height: 62px;
}

.compact-header h3 {
  margin: 0;
  font-size: 1rem;
}

.pane-title {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.pane-title small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
}

.icon-button {
  width: 38px;
  height: 38px;
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

textarea {
  flex: 1;
  min-height: 350px;
  resize: none;
  border: 0;
  border-radius: 0;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.93), rgba(255, 255, 255, 0.98)),
    repeating-linear-gradient(0deg, transparent 0 29px, rgba(23, 27, 31, 0.055) 29px 30px);
  font-size: 1rem;
  line-height: 1.72;
}

textarea:focus,
select:focus,
.text-input:focus,
button:focus-visible {
  outline: 3px solid rgba(73, 108, 168, 0.32);
  outline-offset: 2px;
}

.output-pane textarea {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.98)),
    linear-gradient(90deg, rgba(15, 118, 110, 0.08), transparent 58%),
    repeating-linear-gradient(0deg, transparent 0 29px, rgba(23, 27, 31, 0.055) 29px 30px);
}

.insight-strip,
.publish-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.publish-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.meter-card {
  display: grid;
  gap: 10px;
  min-height: 82px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.82);
}

.publish-summary div {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.82);
}

.publish-summary span {
  font-size: 1.45rem;
  font-weight: 800;
}

.publish-summary small {
  color: var(--muted);
  font-size: 0.82rem;
}

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

.meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6e0d1;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--coral), var(--amber), var(--teal));
  transition: width 260ms ease;
}

.brief-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 14px;
}

.brief-column,
.diff-panel,
.priority-panel,
.review-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.advanced-section {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
}

.advanced-section + .advanced-section {
  margin-top: 0;
}

.advanced-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 0 16px;
  color: var(--ink);
  font-weight: 750;
  cursor: pointer;
}

.advanced-section summary small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: right;
}

.advanced-section[open] {
  padding-bottom: 14px;
}

.advanced-section[open] summary {
  border-bottom: 1px solid var(--line);
}

.advanced-section .tool-grid,
.advanced-section .diff-panel,
.advanced-section .review-panel {
  margin-right: 14px;
  margin-left: 14px;
}

.brief-list {
  display: grid;
  gap: 8px;
  padding: 14px 18px 16px 34px;
  line-height: 1.5;
}

.disclosure-copy {
  min-height: 74px;
  padding: 14px 16px 16px;
  line-height: 1.55;
}

.diff-legend {
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.diff-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.diff-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.added-dot {
  background: var(--teal);
}

.removed-dot {
  background: var(--coral);
}

.diff-view {
  min-height: 92px;
  max-height: 220px;
  overflow: auto;
  padding: 15px 16px 17px;
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.7;
  background: rgba(255, 255, 255, 0.58);
}

.diff-token {
  display: inline;
  padding: 1px 3px;
  border-radius: 5px;
}

.diff-added {
  color: #065f55;
  background: rgba(15, 118, 110, 0.13);
}

.diff-removed {
  color: #9a372b;
  background: rgba(201, 87, 70, 0.14);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.term-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 32px;
  line-height: 1.4;
}

.term-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid rgba(73, 108, 168, 0.22);
  border-radius: 999px;
  color: #2f4a73;
  background: rgba(73, 108, 168, 0.09);
  overflow-wrap: anywhere;
}

.suggestion-list,
.candidate-list {
  display: grid;
  gap: 10px;
  padding: 14px 16px 16px;
}

.panel-intro {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.suggestion-item,
.candidate-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.suggestion-top,
.candidate-top,
.suggestion-actions,
.feedback-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.suggestion-top,
.candidate-top {
  justify-content: space-between;
}

.suggestion-label,
.candidate-label {
  color: var(--ink);
  font-weight: 750;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
  white-space: nowrap;
}

.status-pill.ok {
  color: #075e54;
  background: rgba(15, 118, 110, 0.12);
}

.status-pill.todo {
  color: #9a372b;
  background: rgba(201, 87, 70, 0.14);
}

.status-pill.idea {
  color: #67521b;
  background: rgba(211, 169, 77, 0.18);
}

.suggestion-reason,
.candidate-meta,
.suggestion-text {
  line-height: 1.5;
}

.suggestion-solution {
  margin: 2px 0 0;
  padding: 10px 11px;
  border-left: 3px solid var(--teal);
  border-radius: 6px;
  color: var(--ink);
  background: rgba(15, 118, 110, 0.08);
  line-height: 1.5;
}

.suggestion-text {
  color: var(--ink);
}

.suggestion-action,
.feedback-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

.suggestion-action:hover,
.feedback-button:hover {
  background: #f7f4ed;
}

.candidate-selected {
  border-color: rgba(15, 118, 110, 0.45);
  background: rgba(15, 118, 110, 0.08);
}

.feedback-panel {
  padding: 2px 0 4px;
}

.status {
  min-height: 20px;
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .tool-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .control-group.stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .workspace,
  .tool-panel {
    padding: 18px;
  }

  .editor-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }

  .advanced-section summary {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 12px 16px;
  }

  .advanced-section summary small,
  .settings-drawer summary small {
    text-align: left;
  }

  .value-strip,
  .workflow-strip,
  .goal-panel,
  .step-strip,
  .editor-grid,
  .insight-strip,
  .publish-summary,
  .tool-grid,
  .brief-panel,
  .feedback-panel,
  .control-group.stat-grid,
  .two-field-group {
    grid-template-columns: 1fr;
  }

  .text-pane {
    min-height: 330px;
  }

  textarea {
    min-height: 280px;
  }
}

@media (max-width: 430px) {
  .brand {
    align-items: flex-start;
  }

  .panel-actions {
    flex-direction: column;
  }

  .profile-row {
    align-items: stretch;
    flex-direction: column;
  }

  .ghost-button {
    width: 100%;
  }
}
