:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --ink: #1b1f24;
  --muted: #68707b;
  --line: #d9d6ce;
  --panel: #fffdf8;
  --panel-soft: #eeece5;
  --accent: #0f766e;
  --accent-dark: #0b4f49;
  --warning: #a16207;
  --shadow: 0 18px 50px rgba(30, 28, 24, 0.08);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.08), transparent 32%),
    var(--bg);
  color: var(--ink);
}

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  font: inherit;
  cursor: pointer;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    transform 160ms ease;
}

button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

.ghost-button {
  background: transparent;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 245, 242, 0.9);
  backdrop-filter: blur(14px);
}

.app-header h1 {
  margin: 2px 0 0;
  font-size: 32px;
  line-height: 1;
  letter-spacing: 0;
}

.header-actions,
.button-row,
.status-strip,
.source-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
}

.sidebar,
.draft-panel,
.sources-panel,
.review-panel {
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 102px;
  height: calc(100svh - 126px);
  padding: 18px;
  overflow: auto;
}

.sidebar-section + .sidebar-section {
  margin-top: 28px;
}

.eyebrow,
.section-label {
  margin: 0;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tab-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.tab-button {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 74px;
  padding: 12px;
  text-align: left;
  background: transparent;
}

.tab-button strong {
  font-size: 15px;
}

.tab-button span {
  color: var(--muted);
  font-size: 12px;
}

.tab-button.active {
  background: #e4f2ef;
  border-color: var(--accent);
}

.workflow-list {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
  font-size: 14px;
}

.prompt-summary p:last-child {
  color: var(--muted);
  line-height: 1.6;
}

.workspace {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.workspace-topline {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 8px 4px 0;
}

.workspace-topline h2 {
  margin: 4px 0 0;
  font-size: 28px;
  letter-spacing: 0;
}

.status-strip span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted);
  font-size: 13px;
  background: rgba(255, 253, 248, 0.72);
}

.draft-panel,
.sources-panel,
.review-panel {
  padding: 18px;
}

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

.panel-heading h3 {
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.25;
}

.panel-heading.compact h3 {
  font-size: 18px;
}

.source-table {
  width: 100%;
  border-collapse: collapse;
}

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

.source-table th {
  color: var(--accent-dark);
  font-size: 12px;
  text-transform: uppercase;
}

.title-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.title-option {
  display: grid;
  gap: 6px;
  min-height: 92px;
  padding: 12px;
  text-align: left;
  white-space: normal;
}

.title-option span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.title-option strong {
  line-height: 1.35;
}

.title-option.active {
  background: #e4f2ef;
  border-color: var(--accent);
}

.edit-label {
  display: block;
  margin: 14px 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.title-input,
.draft-editor,
.social-editor {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.55;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.title-input:focus,
.draft-editor:focus,
.social-editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.title-input {
  min-height: 44px;
  padding: 0 12px;
  font-size: 18px;
  font-weight: 750;
}

.draft-editor {
  min-height: 620px;
  padding: 16px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
}

.social-editor {
  min-height: 128px;
  margin-top: 8px;
  padding: 12px;
  resize: vertical;
}

.sources-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 18px;
}

.source-tabs {
  margin-bottom: 12px;
}

.source-tabs button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.source-table-wrap {
  overflow: auto;
}

.source-table {
  min-width: 720px;
}

.source-table td {
  color: #303741;
  font-size: 14px;
  line-height: 1.5;
}

.source-table a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.checklist {
  display: grid;
  gap: 10px;
}

.check-item {
  display: flex;
  gap: 10px;
  align-items: start;
  color: #303741;
  line-height: 1.5;
}

.check-item input {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.distribution-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.distribution-box p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  min-width: 180px;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  padding: 12px 14px;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 980px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-shell,
  .sources-layout,
  .title-options {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .workspace-topline,
  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .app-header,
  .app-shell {
    padding: 16px;
  }

  .app-header h1 {
    font-size: 26px;
  }

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

  button {
    flex: 1 1 auto;
  }
}
