:root {
  --bg: #070a0c;
  --bg2: #0d1216;
  --card: #121a20;
  --card2: #172028;
  --border: #24323c;
  --text: #eef4f7;
  --muted: #8a9ba8;
  --accent: #6b9f3c;
  --accent2: #3dd6c6;
  --warn: #fbbf24;
  --danger: #f87171;
  --sent: #34d399;
  --partial: #f59e0b;
  --draft: #64748b;
  --ready: #38bdf8;
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(900px 500px at 0% -10%, #1a2e14 0%, transparent 55%),
    radial-gradient(700px 400px at 100% 0%, #0d2a2a 0%, transparent 50%),
    var(--bg);
  color: var(--text);
}

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

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

/* Header */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 13px;
  color: #04120a;
  letter-spacing: -0.04em;
}
h1 {
  margin: 0;
  font-size: 1.75rem;
  letter-spacing: -0.04em;
  font-weight: 900;
}
.sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}
.sub strong { color: var(--accent); font-weight: 700; }

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pill {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--bg2);
}
.pill.on {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.pill.warn {
  border-color: color-mix(in srgb, var(--warn) 40%, var(--border));
  color: var(--warn);
}

/* Layout */
.grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
}
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.card h2 {
  margin: 0 0 12px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 800;
}

label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 10px 0 6px;
}
input, select, textarea {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}
textarea { min-height: 100px; resize: vertical; line-height: 1.45; }

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

button, .btn {
  border: 0;
  border-radius: 11px;
  padding: 11px 14px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
button:disabled { opacity: 0.5; cursor: wait; }
.primary {
  background: linear-gradient(90deg, var(--accent), #4ade80);
  color: #052e12;
}
.send {
  background: linear-gradient(90deg, var(--accent2), #22d3ee);
  color: #042f2e;
}
.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--border));
}

.status-line {
  margin-top: 12px;
  font-size: 13px;
  color: var(--warn);
  line-height: 1.45;
  min-height: 1.2em;
}
.status-line.ok { color: var(--sent); }
.status-line.err { color: var(--danger); }

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.stat b {
  display: block;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}
.stat span {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Posts */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.toolbar h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: -0.02em;
  color: var(--text);
  text-transform: none;
}

.post {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 14px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
@media (max-width: 700px) {
  .post { grid-template-columns: 1fr; }
}
.post video, .post .thumb {
  width: 120px;
  height: 180px;
  object-fit: cover;
  border-radius: 8px;
  background: #0a1014;
  border: 1px solid var(--border);
}
.post .thumb {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 8px;
}
.post-body h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 800;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.badge.draft { color: var(--draft); }
.badge.ready { color: var(--ready); border-color: color-mix(in srgb, var(--ready) 40%, var(--border)); }
.badge.sent { color: var(--sent); border-color: color-mix(in srgb, var(--sent) 40%, var(--border)); }
.badge.partial { color: var(--partial); }
.badge.failed { color: var(--danger); }
.caption {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
  white-space: pre-wrap;
  max-height: 88px;
  overflow: hidden;
}
.post-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 110px;
}
.post-actions button { width: 100%; }

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.empty strong { color: var(--text); display: block; margin-bottom: 6px; }

/* Modal */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 20px;
}
.modal h3 { margin: 0 0 12px; }
.modal video {
  width: 100%;
  max-height: 360px;
  border-radius: 10px;
  background: #000;
  margin-bottom: 12px;
}

.foot {
  margin-top: 28px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.foot code {
  background: #1a2330;
  padding: 2px 6px;
  border-radius: 4px;
}

.connect-list { display: flex; flex-direction: column; gap: 8px; }
.connect-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg2);
}
.connect-row .info { min-width: 0; }
.connect-row .name {
  font-weight: 800;
  font-size: 13px;
  text-transform: capitalize;
}
.connect-row .meta {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.connect-row .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  background: var(--draft);
}
.connect-row .dot.on { background: var(--sent); }
.connect-row .actions { display: flex; gap: 6px; flex-shrink: 0; }
.connect-row .actions button { padding: 8px 10px; font-size: 12px; }
.rumble-box { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.oauth-warn {
  font-size: 12px;
  color: var(--warn);
  margin-bottom: 8px;
  line-height: 1.4;
}

.banner-unlimited {
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, transparent), color-mix(in srgb, var(--accent2) 12%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}
.banner-unlimited strong { color: var(--accent); }

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.4;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.tab {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
}
.tab.on {
  color: #042f2e;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-color: transparent;
}
.panel { display: none; }
.panel.on { display: block; }

.playbooks { font-size: 12px; color: var(--muted); line-height: 1.45; }
.playbooks .pb {
  border-top: 1px solid var(--border);
  padding: 8px 0;
}
.playbooks .pb:first-child { border-top: 0; padding-top: 0; }
.playbooks strong { color: var(--text); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent2);
  background: color-mix(in srgb, var(--accent2) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent2) 30%, var(--border));
  border-radius: 999px;
  padding: 2px 7px;
}

.cal {
  display: grid;
  gap: 10px;
}
.cal-day {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg2);
}
.cal-day h4 {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: -0.02em;
}
.cal-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
}
.cal-item:first-of-type { border-top: 0; }
.cal-item b { color: var(--text); font-weight: 700; }

.modal-wide { width: min(720px, 100%); }
.packs {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--bg2);
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}
.packs .pack {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.packs .pack:last-child { border-bottom: 0; margin-bottom: 0; }
.packs .pack strong {
  color: var(--accent2);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
}
.packs pre {
  white-space: pre-wrap;
  margin: 6px 0 0;
  font-family: inherit;
  color: var(--text);
  font-size: 12px;
}
