:root {
  color-scheme: light;
  --ink: #19212a;
  --muted: #65717c;
  --line: #dde3e8;
  --paper: #f7f8f5;
  --surface: #ffffff;
  --teal: #0f6f68;
  --teal-soft: #d9efeb;
  --clay: #a44f35;
  --clay-soft: #f3ddd4;
  --moss: #596d39;
  --gold: #c89f4a;
  --shadow: 0 12px 32px rgba(24, 33, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 3.1rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 0.94rem;
}

.topbar-actions,
.card-actions,
menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary,
.secondary,
.ghost,
.tab,
.icon-button,
.link-button {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.primary {
  background: var(--teal);
  color: #fff;
}

.secondary {
  background: var(--ink);
  color: #fff;
}

.ghost,
.tab {
  background: #edf2f2;
  color: var(--ink);
}

.ghost:hover,
.tab.active {
  background: var(--teal-soft);
  color: #084843;
}

.icon-button {
  width: 40px;
  padding: 0;
  background: #eef2f3;
  color: var(--ink);
}

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

.control-panel,
.main-board {
  min-width: 0;
}

.control-panel {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 18px;
}

.agent-form,
.signal-block,
.import-block,
.connector-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.agent-form {
  display: grid;
  gap: 14px;
  padding: 16px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

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

input,
select {
  min-height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  padding: 12px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.section-head span {
  border-radius: 999px;
  background: var(--clay-soft);
  color: var(--clay);
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 900;
}

.signals,
.connectors,
.import-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.import-actions {
  display: flex;
  gap: 8px;
}

.import-status {
  border-radius: 8px;
  background: #edf2f2;
  color: var(--muted);
  padding: 9px 10px;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1.35;
}

.import-status.success,
.media-success {
  background: var(--teal-soft);
  color: #084843;
}

.import-status.error {
  background: var(--clay-soft);
  color: var(--clay);
}

.import-actions button {
  min-height: 36px;
}

.etsy-status {
  margin: 14px 14px 0;
  border-radius: 8px;
  background: #edf2f2;
  color: var(--muted);
  padding: 10px;
  font-size: 0.78rem;
  font-weight: 900;
}

.etsy-status.connected {
  background: var(--teal-soft);
  color: #084843;
}

.etsy-status.needs-config {
  background: var(--clay-soft);
  color: var(--clay);
}

.signal {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.pottery-thumb {
  width: 58px;
  aspect-ratio: 1;
  border: 1px solid rgba(25, 33, 42, 0.12);
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.7) 0 18%, transparent 19%),
    radial-gradient(circle at 50% 62%, var(--thumb-main) 0 34%, var(--thumb-dark) 35% 42%, transparent 43%),
    linear-gradient(135deg, var(--thumb-soft), #fff);
}

.image-thumb {
  background-color: #eef2f3;
  background-position: center;
  background-size: cover;
}

.signal h3,
.connector h3,
.post-card h3 {
  margin: 0;
  font-size: 0.93rem;
  line-height: 1.25;
}

.signal p,
.connector p,
.post-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.connector {
  border-left: 4px solid var(--connector-color);
  padding-left: 10px;
}

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

.stat {
  display: grid;
  gap: 2px;
  min-height: 86px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 900;
  line-height: 1;
}

.stat-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.stat.accent {
  border-color: rgba(15, 111, 104, 0.35);
  background: var(--teal-soft);
}

.board-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.search-label {
  width: min(320px, 100%);
}

.post-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(250px, 1fr));
  gap: 14px;
}

.post-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 410px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.post-media {
  position: relative;
  min-height: 168px;
  display: grid;
  place-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 24% 38%, rgba(255, 255, 255, 0.72) 0 9%, transparent 10%),
    radial-gradient(circle at 50% 54%, var(--media-main) 0 21%, var(--media-deep) 22% 28%, transparent 29%),
    linear-gradient(135deg, var(--media-soft), #ffffff 56%, rgba(15, 111, 104, 0.14));
}

.post-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-media::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(25, 33, 42, 0.04), rgba(25, 33, 42, 0.3));
  content: "";
}

.media-frame {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  width: min(210px, 88%);
  min-height: 104px;
  align-content: end;
  border: 1px solid rgba(25, 33, 42, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  padding: 12px;
  box-shadow: 0 10px 24px rgba(25, 33, 42, 0.08);
}

.media-frame span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.media-frame strong {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.15;
}

.post-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pill {
  border-radius: 999px;
  background: #eef2f3;
  color: var(--ink);
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 900;
}

.pill.pinterest {
  background: #fde7e5;
  color: #ad1b17;
}

.pill.facebook {
  background: #e3edff;
  color: #155bb9;
}

.pill.instagram {
  background: #f4e3ff;
  color: #7c2c96;
}

.status {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.caption-box,
.creative-box,
.image-plan {
  border: 1px solid #edf1f3;
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfc;
}

.caption-box {
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.5;
}

.creative-box {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

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

.image-plan span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.image-plan strong,
.image-plan p {
  margin: 2px 0 0;
  color: var(--ink);
  font-size: 0.78rem;
  line-height: 1.35;
}

.image-plan-wide,
.media-warning {
  grid-column: 1 / -1;
}

.media-warning,
.media-success {
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.76rem;
  font-weight: 900;
}

.media-warning {
  background: var(--clay-soft);
  color: var(--clay);
}

.hashtags {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.5;
}

.card-actions {
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding: 12px 14px;
}

.card-actions button {
  min-height: 36px;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: 240px;
  display: grid;
  place-items: center;
  border: 1px dashed #b9c4cb;
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  text-align: center;
  padding: 24px;
}

.editor-dialog {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 26px 80px rgba(25, 33, 42, 0.24);
}

.editor-dialog::backdrop {
  background: rgba(25, 33, 42, 0.36);
}

#editorForm {
  display: grid;
  gap: 14px;
  padding: 18px;
}

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

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-label input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--teal);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

menu {
  justify-content: end;
  margin: 0;
  padding: 0;
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .post-board {
    grid-template-columns: repeat(2, minmax(250px, 1fr));
  }
}

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

  .topbar,
  .board-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions button,
  .search-label {
    width: 100%;
  }

  .control-panel,
  .editor-grid,
  .stats-grid,
  .post-board {
    grid-template-columns: 1fr;
  }
}
