:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --ink: #101820;
  --muted: #66736a;
  --panel: #ffffff;
  --line: #dce3dc;
  --accent: #006c67;
  --accent-strong: #00524f;
  --danger: #b42318;
  --ok: #087443;
  --warn: #9a5b00;
  --shadow: 0 18px 44px rgba(16, 24, 32, .08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

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

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

h1, h2, p { margin: 0; }

h1 {
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
}

.topbar p, .panel-head span, .api-note, small {
  color: var(--muted);
}

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

.metric, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
}

.metric strong {
  display: block;
  font-size: 30px;
}

.metric span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
  gap: 14px;
  align-items: start;
}

.composer, .side {
  display: grid;
  gap: 14px;
}

.panel {
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
}

.field span {
  font-size: 13px;
  font-weight: 700;
}

textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fbfcfb;
  padding: 11px 12px;
  outline: none;
}

textarea:focus, input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 108, 103, .12);
}

.tag-row, .publish-row {
  display: flex;
  gap: 10px;
  align-items: end;
}

.grow { flex: 1; }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -2px 0 14px;
}

.chip {
  border: 1px solid rgba(0, 108, 103, .2);
  background: rgba(0, 108, 103, .08);
  color: var(--accent-strong);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}

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

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

.upload-box {
  display: grid;
  gap: 6px;
  min-height: 132px;
  align-content: center;
  border: 1px dashed #aeb9b0;
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  background: #fbfcfb;
}

.upload-box input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.upload-icon {
  font-size: 28px;
  color: var(--accent);
}

.preview {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 12px;
  margin: 12px 0;
}

.preview video, .preview img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius);
  background: #101820;
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--muted);
  white-space: nowrap;
}

.switch input {
  width: auto;
}

.primary, .ghost, .icon-button {
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}

.primary {
  width: 100%;
  height: 48px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.primary:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.ghost {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.icon-button {
  width: 44px;
  height: 44px;
  color: #fff;
  background: var(--accent);
  font-size: 24px;
  line-height: 1;
}

.api-note {
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #f3faf7;
  border: 1px solid #d5ece3;
  border-radius: var(--radius);
  font-size: 13px;
}

.channel-list, .status-list {
  display: grid;
  gap: 10px;
}

.channel-row, .status-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #fbfcfb;
}

.channel-top, .status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.channel-top strong, .status-top strong {
  font-size: 14px;
}

.channel-controls {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 8px;
}

.channel-extra {
  margin-top: 8px;
}

.status-pill {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  background: #eef2ef;
  color: var(--muted);
}

.status-pill.ok { background: #e8f6ee; color: var(--ok); }
.status-pill.fail { background: #fdebea; color: var(--danger); }
.status-pill.busy { background: #fff4df; color: var(--warn); }

.error {
  min-height: 20px;
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
}

@media (max-width: 840px) {
  .app-shell { padding: 14px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .workspace { grid-template-columns: 1fr; }
  .summary-grid, .media-grid, .cloudinary-grid, .preview { grid-template-columns: 1fr; }
  .publish-row, .tag-row { align-items: stretch; flex-direction: column; }
  .icon-button { width: 100%; }
}
