@font-face {
  font-family: Urbanist;
  src: url("/fonts/Urbanist.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #111113;
  --muted: #64646f;
  --line: #e8e8ed;
  --surface: #ffffff;
  --canvas: #f5f5f8;
  --brand: #ff1493;
  --brand-hover: #f00083;
  --brand-soft: #ffe4f3;
  --focus: #b30064;
  --danger: #b42318;
  --warning: #9a6700;
  --success: #067647;
  font-family: Urbanist, "Segoe UI", sans-serif;
  accent-color: var(--brand);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button { border: 1px solid transparent; border-radius: 12px; padding: .7rem 1rem; background: var(--brand); color: var(--ink); cursor: pointer; font-weight: 750; }
button:hover { background: var(--brand-hover); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
button.secondary:hover { background: var(--canvas); }
button.danger { background: #fff0ee; color: var(--danger); }
button.danger:hover { background: #fee4e2; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: .72rem .8rem; background: #fafafb; color: var(--ink); }
textarea { resize: vertical; }
label { color: var(--ink); font-size: .9rem; font-weight: 650; }
:is(a, button, input, select, textarea):focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { width: min(1320px, calc(100% - 3rem)); min-height: 84px; margin-inline: auto; display: flex; align-items: center; gap: 1.75rem; }
.wordmark { color: var(--ink); font-size: 1.45rem; font-weight: 850; letter-spacing: -.06em; text-decoration: none; white-space: nowrap; }
.main-menu, .topbar-actions { display: flex; align-items: center; gap: .35rem; }
.main-menu a { padding: .7rem .85rem; border-radius: 12px; color: var(--muted); font-weight: 700; text-decoration: none; white-space: nowrap; }
.main-menu a:hover { background: var(--canvas); color: var(--ink); }
.main-menu a[aria-current="location"] { background: var(--brand-soft); box-shadow: inset 0 -3px var(--brand); color: var(--ink); }
.topbar-actions { margin-inline-start: auto; }
.topbar-actions button { white-space: nowrap; }
.overview-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.overview-heading h1 { margin: 0 0 .25rem; font-size: clamp(1.75rem, 4vw, 2.25rem); letter-spacing: -.04em; }
.subtitle { margin: 0; color: var(--muted); }
.eyebrow { display: inline-block; margin: 0; padding: .35rem .55rem; border-radius: 7px; background: var(--brand); color: var(--ink); font-size: .72rem; letter-spacing: .12em; font-weight: 850; }
.layout { width: min(1320px, calc(100% - 3rem)); margin: 1.75rem auto 4rem; display: grid; gap: 1.25rem; }
.layout [id]:is(section, article) { scroll-margin-top: 1rem; }
.grid.two { display: grid; grid-template-columns: .9fr 1.1fr; gap: 1.25rem; }
.summary-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: .8rem; }
.summary-card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 1rem; }
.summary-card span { display: block; color: var(--muted); font-size: .78rem; font-weight: 650; }
.summary-card strong { display: block; margin-top: .2rem; font-size: 1.65rem; }
.card { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 1.35rem; }
.card h2 { margin: 0 0 .9rem; font-size: 1.25rem; letter-spacing: -.025em; }
.section-heading h2 { margin-bottom: 0; }
.login-layout { width: min(450px, calc(100% - 2rem)); margin: clamp(2rem, 12vh, 8rem) auto; }
.login-card { padding: clamp(1.5rem, 6vw, 2.25rem); border-radius: 24px; box-shadow: 0 8px 40px #16162808; }
.login-card .wordmark { margin: .9rem 0 .15rem; font-size: 2rem; }
.login-layout h1 { margin: 0 0 1.5rem; color: var(--muted); font-size: 1.1rem; font-weight: 650; }
.login-layout form { display: grid; gap: 1rem; }
.login-layout label input { display: block; margin-top: .35rem; }
.login-layout [role="status"] { margin: 0; color: var(--muted); }
.login-layout [role="status"]:empty { display: none; }
.login-layout button { min-height: 46px; }
.section-heading, .form-footer, .post-actions { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.form-help { margin: -.3rem 0 1rem; color: var(--muted); font-size: .86rem; line-height: 1.5; }
.field-hint { margin: -.55rem 0 0; color: var(--muted); font-size: .78rem; }
.check-label { display: flex !important; grid-template-columns: auto 1fr; align-items: center; }
.check-label input { width: auto; }
.form-stack { display: grid; gap: 1rem; }
.form-stack label { display: grid; gap: .4rem; }
.form-footer span { color: var(--muted); font-size: .82rem; }
.form-actions, .filter-bar, .post-title-line { display: flex; align-items: center; gap: .55rem; }
.upload-row { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: .65rem; }
.upload-row #uploadStatus { grid-column: 1 / -1; color: var(--muted); font-size: .78rem; }
.file-picker { display: grid; gap: .4rem; }
.file-picker input { padding: .5rem; }
.filter-bar input { min-width: 220px; }
.filter-bar select { width: auto; min-width: 130px; }
.hidden { display: none !important; }
.image-preview-wrap { position: relative; min-height: 130px; border: 1px dashed #b9c4d2; border-radius: 10px; overflow: hidden; background: #f8fafc; }
.image-preview-wrap :is(img, video) { display: block; width: 100%; max-height: 280px; object-fit: contain; }
.preview-error { position: absolute; inset: auto 0 0; padding: .55rem .75rem; background: rgba(122,39,26,.92); color: white; font-size: .8rem; }
.empty { padding: 1rem 0; color: var(--muted); }
.status { border-radius: 999px; padding: .5rem .8rem; font-size: .84rem; font-weight: 750; }
.status.neutral { background: var(--brand-soft); color: var(--ink); }
.status.healthy, .pill.Published { background: #dcfae6; color: var(--success); }
.status.unhealthy, .pill.Failed { background: #fee4e2; color: var(--danger); }
.connection { padding: .85rem 0; border-top: 1px solid var(--line); }
.connection:first-child { border-top: 0; }
.connection strong { display: block; }
.connection span { color: var(--muted); font-size: .86rem; }
.connection .connection-token-status { display: block; margin-top: .3rem; }
.connection .connection-token-error { color: var(--danger); }
.post-list { display: grid; gap: .75rem; }
.post { display: grid; grid-template-columns: 74px 1fr auto; gap: 1rem; align-items: center; padding: .85rem; border: 1px solid var(--line); border-radius: 11px; }
.post img { width: 74px; height: 74px; object-fit: cover; border-radius: 8px; background: #edf1f5; }
.post-placeholder { width: 74px; height: 74px; display: grid; place-items: center; padding: .4rem; border-radius: 8px; background: #edf1f5; color: var(--muted); font-size: .7rem; text-align: center; }
.post-copy { min-width: 0; }
.post-copy p { margin: .35rem 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta { color: var(--muted); font-size: .8rem; }
.account-label { color: var(--muted); font-size: .76rem; font-weight: 650; }
.post-error { margin-top: .35rem; color: var(--danger); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-flex; border-radius: 999px; padding: .28rem .55rem; background: #eef2f6; color: #344054; font-size: .75rem; font-weight: 750; }
.pill.Scheduled, .pill.RetryPending, .pill.Publishing { background: #fff4cc; color: var(--warning); }
.pill.Cancelled { color: var(--muted); }
.post-actions { flex-wrap: wrap; justify-content: flex-end; }
.post-actions button { padding: .5rem .7rem; font-size: .8rem; }
.toast { position: fixed; right: 1rem; bottom: 1rem; max-width: 420px; border-radius: 10px; padding: .9rem 1rem; background: #17202a; color: white; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
dialog { border: 0; border-radius: 14px; padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
dialog::backdrop { background: rgba(16,24,40,.45); }
.dialog-form { width: min(430px, calc(100vw - 2rem)); padding: 1.4rem; }
.dialog-form p { color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1rem; }
.attempt-list { display: grid; gap: .6rem; max-height: 50vh; overflow: auto; }
.attempt { display: grid; gap: .2rem; padding: .75rem; border: 1px solid var(--line); border-left: 4px solid var(--success); border-radius: 8px; }
.attempt.failure { border-left-color: var(--danger); }
.attempt span { color: var(--muted); font-size: .82rem; }

@media (max-width: 820px) {
  .topbar-inner { width: calc(100% - 2rem); flex-wrap: wrap; min-height: 0; padding-block: .75rem; gap: .65rem; }
  .main-menu { order: 1; flex: 0 0 100%; overflow-x: auto; padding: 3px; }
  .main-menu a { padding-inline: .65rem; }
  .layout { width: calc(100% - 2rem); }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .grid.two { grid-template-columns: 1fr; }
  .posts-heading { align-items: stretch; flex-direction: column; }
  .filter-bar { align-items: stretch; flex-direction: column; }
  .filter-bar input, .filter-bar select { width: 100%; min-width: 0; }
  .post { grid-template-columns: 58px 1fr; }
  .post img, .post-placeholder { width: 58px; height: 58px; }
  .post-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

@media (max-width: 420px) {
  .overview-heading { align-items: flex-start; flex-direction: column; }
  .topbar-actions button { padding-inline: .55rem; }
  .upload-row { grid-template-columns: 1fr; }
}
