:root {
  --bg: #f3f6f8;
  --ink: #17212b;
  --muted: #61707d;
  --line: #d7e0e6;
  --navy: #101820;
  --blue: #145da0;
  --blue-dark: #0d477c;
  --card: #ffffff;
  --green: #18794e;
  --green-bg: #eaf7f0;
  --amber: #8a5b00;
  --amber-bg: #fff6dc;
  --red: #b42318;
  --red-bg: #fff0ee;
  --shadow: 0 4px 18px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
button, input, select, textarea { font: inherit; }
a { color: var(--blue); }

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: center;
  padding: 28px max(22px, calc((100% - 1120px) / 2));
  background: var(--navy);
  color: #fff;
}
.brand-wrap { display: flex; align-items: center; gap: 19px; min-width: 0; }
.brand-logo { width: 112px; max-height: 72px; object-fit: contain; background: #fff; border-radius: 8px; padding: 7px; }
.site-header h1 { margin: 3px 0 2px; font-size: clamp(27px, 4vw, 39px); line-height: 1.12; }
.site-header p { margin: 0; color: #cbd6df; }
.eyebrow { font-size: 12px; font-weight: 850; letter-spacing: .15em; color: #8fc4f4; }
.header-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.header-nav form { margin: 0; }

main { max-width: 1120px; margin: 28px auto; padding: 0 20px 64px; }
main.narrow, .narrow { max-width: 820px; }
footer { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 23px;
  margin: 0 0 22px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 13px; line-height: 1.25; }
.card h3 { margin-bottom: 6px; }
.card p:first-child { margin-top: 0; }
.section-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 15px; }
.section-heading h2, .section-heading p { margin: 0; }
.section-heading p { color: var(--muted); margin-top: 3px; }
.privacy-pill { background: var(--green-bg); color: var(--green); border-radius: 99px; padding: 5px 11px; font-weight: 800; font-size: 13px; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-grid { align-items: start; }
fieldset { border: 0; margin: 0; padding: 0; }
legend { font-weight: 800; margin-bottom: 8px; }
label { display: block; font-weight: 750; margin-bottom: 14px; }
label small { display: block; color: var(--muted); font-weight: 500; margin-top: 4px; }
input, select, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  border: 1px solid #b9c6d0;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(20, 93, 160, .18); border-color: var(--blue); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s ease, transform .05s ease;
}
.button:active { transform: translateY(1px); }
.button.primary { background: var(--blue); color: #fff; }
.button.primary:hover { background: var(--blue-dark); }
.button.secondary { background: #e8eef2; color: #17344b; }
.button.ghost { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35); }
.button.danger { background: var(--red-bg); color: var(--red); }
.button.small { padding: 6px 10px; font-size: 13px; }
.button.full { width: 100%; }
.text-button { border: 0; background: transparent; color: var(--red); text-decoration: underline; cursor: pointer; padding: 8px 0; }
.inline-form { display: inline-block; margin-left: 12px; }
.inline-form.no-left-margin { margin: -9px 0 17px; }
.connect-form { display: inline-block; margin: 3px 0 0; }
.secret-copy { display: flex; align-items: center; gap: 8px; max-width: 780px; }
.secret-copy input { margin: 0; min-width: 0; }

.platforms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 4px 0 20px; }
.platform-check { border: 1px solid var(--line); padding: 13px; border-radius: 10px; margin: 0; background: #fbfcfd; }
.platform-check input { width: auto; margin: 0 7px 0 0; }
.platform-check small { display: block; margin: 5px 0 0 25px; }
.ready { color: var(--green); }
.manual { color: var(--amber); }

.post-list { display: grid; gap: 9px; }
.post-row { display: flex; justify-content: space-between; gap: 18px; align-items: center; background: #fff; border: 1px solid var(--line); padding: 15px 17px; border-radius: 10px; text-decoration: none; color: inherit; }
.post-row:hover { border-color: #9bb6ca; }
.post-row small { color: var(--muted); }
.status { text-transform: capitalize; white-space: nowrap; font-size: 13px; font-weight: 850; padding: 5px 9px; border-radius: 99px; background: #edf2f6; }
.status.published { color: var(--green); background: var(--green-bg); }
.status.scheduled, .status.processing { color: var(--blue); background: #eaf3fb; }
.status.needs_connection, .status.partial { color: var(--amber); background: var(--amber-bg); }

.preview-head { display: flex; justify-content: space-between; gap: 15px; align-items: center; margin-bottom: 12px; }
.preview-head h2 { margin-bottom: 2px; }
.connection { font-size: 12px; font-weight: 850; }
.connection-badge { border-radius: 99px; padding: 4px 9px; font-size: 12px; font-weight: 850; }
.ready-bg { background: var(--green-bg); color: var(--green); }
.manual-bg { background: var(--amber-bg); color: var(--amber); }
.connection-card .button.primary { margin-top: 3px; }
.media-summary { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.media-summary small { color: var(--muted); }
.sticky-actions { position: sticky; bottom: 10px; z-index: 2; text-align: right; margin: -8px 8px 22px; pointer-events: none; }
.sticky-actions .button { box-shadow: 0 4px 14px rgba(0,0,0,.14); pointer-events: auto; }
.actions { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; }
.actions > div { margin-right: auto; }
.actions h2, .actions p { margin: 0; }
.schedule-form { display: flex; gap: 8px; align-items: center; }
.schedule-form input { margin: 0; }

.result { padding: 11px 12px; border-radius: 8px; margin: 8px 0; }
.result.ok { background: var(--green-bg); color: var(--green); }
.result.bad { background: var(--red-bg); color: var(--red); }
.flash { padding: 13px 15px; border-radius: 10px; margin: 0 0 18px; font-weight: 650; }
.flash.success { background: var(--green-bg); color: var(--green); }
.flash.error { background: var(--red-bg); color: var(--red); }
.flash.info { background: #eaf3fb; color: var(--blue); }
.note { font-size: 13px; color: var(--muted); }
.empty { padding: 21px; background: #fff; border: 1px dashed #aebdc8; border-radius: 10px; color: var(--muted); }
.facts { margin: 0 0 20px; }
.facts > div { display: grid; grid-template-columns: 170px 1fr; gap: 12px; border-bottom: 1px solid var(--line); padding: 10px 0; }
.facts dt { font-weight: 800; }.facts dd { margin: 0; overflow-wrap: anywhere; }
code { background: #eef2f5; padding: 3px 6px; border-radius: 5px; overflow-wrap: anywhere; }

.login-shell { max-width: 460px; margin: 42px auto; }
.login-card { padding: 28px; }
.setup-page main { margin-top: 28px; }

@media (max-width: 790px) {
  .site-header { align-items: flex-start; flex-direction: column; padding: 22px; }
  .brand-logo { width: 88px; max-height: 62px; }
  .header-nav { width: 100%; }
  .grid.two, .platforms { grid-template-columns: 1fr; }
  .actions { align-items: stretch; }
  .actions form, .actions .button { width: 100%; }
  .schedule-form { flex-direction: column; }
  .post-row { align-items: flex-start; }
  .facts > div { grid-template-columns: 1fr; gap: 2px; }
}

@media (max-width: 480px) {
  main { padding: 0 13px 48px; margin-top: 18px; }
  .card { padding: 18px; border-radius: 12px; }
  .brand-wrap { align-items: flex-start; }
  .brand-logo { width: 72px; }
  .preview-head { align-items: flex-start; }
  .section-heading { flex-direction: column; }
}
