:root {
  --bg: #f6f7f3;
  --surface: #ffffff;
  --line: #d9ded2;
  --text: #1d2720;
  --muted: #687368;
  --brand: #246b4b;
  --brand-dark: #174833;
  --soft: #e8f2ea;
  --warn: #fff4d6;
  --danger: #b33a2d;
  font-family: "Segoe UI", Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

button,
.file-btn {
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  padding: 10px 14px;
  cursor: pointer;
}

button:hover,
.file-btn:hover {
  background: var(--brand-dark);
}

button.secondary,
.file-btn {
  background: #edf2ec;
  color: var(--text);
  border: 1px solid var(--line);
}

button.secondary:hover,
.file-btn:hover {
  background: #dfe9de;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 24px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 42px);
}

h2 {
  margin-bottom: 0;
  font-size: 28px;
}

h3 {
  margin-bottom: 16px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.top-actions,
.button-row,
.panel-head,
.compact-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.file-btn input {
  display: none;
}

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

.sidebar {
  padding: 20px;
  border-right: 1px solid var(--line);
  background: #eef3eb;
}

.nav-btn {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
}

.nav-btn:hover,
.nav-btn.active {
  background: var(--surface);
  border-color: var(--line);
}

.safety-box {
  margin-top: 20px;
  padding: 14px;
  border-radius: 8px;
  background: var(--warn);
  border: 1px solid #ebd28c;
}

.safety-box span {
  display: block;
  margin-top: 6px;
  color: #665729;
  font-size: 14px;
}

.workspace {
  padding: 24px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stats-grid article,
.panel,
.post-card,
.idea-card,
.calendar-day {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stats-grid article {
  padding: 16px;
}

.stats-grid span {
  display: block;
  font-size: 30px;
  font-weight: 800;
}

.stats-grid p,
.post-card p,
.idea-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.layout-two {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 18px;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--text);
  padding: 10px 12px;
}

textarea {
  resize: vertical;
}

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

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 0 14px;
  padding: 12px;
}

legend {
  color: var(--muted);
}

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

.checks label {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0;
  color: var(--text);
}

.checks input {
  width: auto;
}

.inline-check {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--text);
}

.inline-check input {
  width: auto;
}

.post-list,
.idea-list,
.caption-list {
  display: grid;
  gap: 10px;
}

.post-card,
.idea-card {
  padding: 14px;
}

.post-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0;
}

.tag {
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand-dark);
  padding: 4px 8px;
  font-size: 12px;
}

.tag.status-posted {
  background: #e6edf7;
  color: #284b75;
}

.tag.status-review {
  background: #fff4d6;
  color: #765c16;
}

.tag.status-approved,
.tag.status-scheduled {
  background: #e7f4eb;
  color: #1f653f;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.card-actions button {
  padding: 8px 10px;
}

.compact-form input {
  flex: 1 1 280px;
}

.idea-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.caption-card {
  border-left: 4px solid var(--brand);
  padding: 12px;
  background: #fbfcfa;
}

.caption-card strong {
  display: block;
  margin-bottom: 6px;
}

.connector-actions {
  margin-bottom: 10px;
}

.connector-status {
  margin-bottom: 20px;
  border-radius: 8px;
  background: #fbfcfa;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 10px 12px;
}

.connector-status.ok {
  background: #e7f4eb;
  color: #1f653f;
}

.connector-status.error {
  background: #fde9e6;
  color: var(--danger);
}

.workflow-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.workflow-toolbar select {
  flex: 1 1 220px;
}

.workflow-canvas {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.workflow-node {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 12px;
}

.workflow-node::after {
  content: "";
  position: absolute;
  left: 31px;
  top: 100%;
  width: 2px;
  height: 10px;
  background: var(--line);
}

.workflow-node:last-child::after {
  display: none;
}

.workflow-node.disabled {
  opacity: .48;
}

.node-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--soft);
  color: var(--brand-dark);
  font-weight: 800;
}

.node-body strong {
  display: block;
  margin-bottom: 4px;
}

.node-body span,
.node-help span {
  color: var(--muted);
}

.node-switch {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.node-switch input {
  width: auto;
}

.node-help {
  display: grid;
  gap: 4px;
  margin: -6px 0 20px;
  padding: 12px;
  border-radius: 8px;
  background: var(--soft);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 10px;
}

.calendar-day {
  min-height: 150px;
  padding: 12px;
}

.calendar-day strong {
  display: block;
  margin-bottom: 8px;
}

.calendar-item {
  margin-top: 6px;
  border-radius: 6px;
  background: var(--soft);
  padding: 7px;
  font-size: 13px;
}

.empty {
  color: var(--muted);
  padding: 18px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

@media (max-width: 980px) {
  .topbar,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .app-shell,
  .layout-two {
    grid-template-columns: 1fr;
  }

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

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

@media (max-width: 620px) {
  .topbar,
  .workspace {
    padding: 18px;
  }

  .stats-grid,
  .form-row,
  .checks,
  .calendar-grid {
    grid-template-columns: 1fr;
  }
}
