:root {
  --ink: #17213c;
  --muted: #64708a;
  --paper: #f5f3ee;
  --line: #dcd9d0;
  --cobalt: #2f56d5;
  --violet: #7453c5;
  --coral: #e35b45;
  --success: #17764b;
  --success-bg: #e9f7ef;
  --warn: #9a4d31;
  --warn-bg: #feeadf;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --radius: 14px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-sans);
  line-height: 1.5;
}

a { color: var(--cobalt); }

:focus-visible {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 clamp(20px, 4vw, 64px);
  height: 72px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.55);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: -.02em;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font: 700 14px var(--font-mono);
}

.admin-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: #596178;
  background: rgba(255,255,255,.5);
}

.admin-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #28a36a;
  box-shadow: 0 0 0 4px rgba(40,163,106,.12);
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(32px, 5vw, 56px) clamp(20px, 4vw, 64px) 64px;
}

.hero {
  margin-bottom: 40px;
}

.kicker {
  margin: 0 0 12px;
  color: #657089;
  font: 650 11px/1.2 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 48px);
  letter-spacing: -.04em;
  line-height: 1.05;
}

.lead {
  max-width: 640px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 17px;
}

.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

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

.panel h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -.02em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: 600 14px var(--font-sans);
  cursor: pointer;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}

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

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

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(227,91,69,.25);
}

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

.btn-cobalt {
  background: var(--cobalt);
  color: #fff;
}

.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.platform-chip {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.platform-chip h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.platform-chip .status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font: 650 10px var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.status-not_connected { color: #596178; background: #eef1f6; }
.status-connected { color: var(--success); background: var(--success-bg); }
.status-pending, .status-publishing { color: #5a4a9f; background: #f3efff; }
.status-published { color: var(--success); background: var(--success-bg); }
.status-failed { color: var(--danger); background: var(--danger-bg); }
.status-ready, .status-validating, .status-draft { color: #475569; background: #f1f5f9; }
.status-partially_published, .status-scheduled { color: var(--warn); background: var(--warn-bg); }

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.post-item:last-child { border-bottom: 0; }

.post-item a {
  font-weight: 600;
  text-decoration: none;
  color: inherit;
}

.post-item a:hover { color: var(--cobalt); }

.meta {
  color: var(--muted);
  font-size: 13px;
}

.empty {
  color: var(--muted);
  padding: 24px 0;
  text-align: center;
}

.auth-gate {
  max-width: 420px;
  margin: 80px auto;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}

textarea { min-height: 100px; resize: vertical; }

.field { margin-bottom: 16px; }

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

.upload-zone {
  border: 2px dashed #c9c4b8;
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  background: #fffcf7;
  cursor: pointer;
}

.upload-zone.dragover {
  border-color: var(--cobalt);
  background: #f5f8ff;
}

.upload-zone input { display: none; }

.video-preview {
  width: 100%;
  max-height: 420px;
  border-radius: 12px;
  background: #000;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  padding: 10px 0 10px 16px;
  border-left: 2px solid var(--line);
  margin-left: 8px;
  font-size: 14px;
}

.timeline time {
  display: block;
  color: var(--muted);
  font: 12px var(--font-mono);
}

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
}

.alert-info { background: #eef3ff; color: #1e3a8a; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }

.validation-list {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
}

footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px clamp(20px, 4vw, 64px) 40px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  color: #747d91;
  font: 12px var(--font-mono);
}

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .post-item { grid-template-columns: 1fr; }
  footer { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn { transition: none; }
}
