/* Freedom Tech Social. Brand: navy #0b1c2e, red #be1830. */
:root {
  --bg: #f5f7fa; --surface: #ffffff; --ink: #0b1c2e; --muted: #5a6b7d; --line: #dfe5ec;
  --brand: #be1830; --brand-ink: #ffffff; --navy: #0b1c2e; --focus: #1b5fa8;
  --ok: #1d7a46; --ok-bg: #e5f4ec; --warn: #8a5a00; --warn-bg: #fdf1d8; --bad: #b42318; --bad-bg: #fde7e5;
  --info: #1b5fa8; --info-bg: #e4eefa; --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1c2e; --surface: #12263c; --ink: #eef2f6; --muted: #9fb0c2; --line: #24384f;
    --brand: #e0354b; --focus: #6aa8ec;
    --ok: #6fd39b; --ok-bg: #123527; --warn: #f2c063; --warn-bg: #3a2c0c; --bad: #ff8a80; --bad-bg: #3d1717;
    --info: #8cbcf0; --info-bg: #142f4d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1c2e; --surface: #12263c; --ink: #eef2f6; --muted: #9fb0c2; --line: #24384f;
  --brand: #e0354b; --focus: #6aa8ec;
  --ok: #6fd39b; --ok-bg: #123527; --warn: #f2c063; --warn-bg: #3a2c0c; --bad: #ff8a80; --bad-bg: #3d1717;
  --info: #8cbcf0; --info-bg: #142f4d;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--muted); }
.small, small { font-size: 13px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.error-text { color: var(--bad); font-size: 13px; display: block; white-space: pre-line; }
.spacer { flex: 1; }

/* forms */
label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
}
input[type="checkbox"] { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--brand); }
input[type="color"] { width: 64px; height: 40px; padding: 2px; }
textarea { resize: vertical; }
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 600;
  border-radius: 8px; padding: 9px 16px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap; min-height: 40px;
}
button:disabled { opacity: .55; cursor: not-allowed; }
.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.ghost { background: transparent; }
.danger { color: var(--bad); }
button.danger:not(.ghost) { background: var(--bad); color: #fff; border-color: var(--bad); }
.small { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.tiny { padding: 0 8px; min-height: 26px; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* layout */
.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.panel.narrow { width: 100%; max-width: 400px; }
.panel.narrow button[type="submit"] { width: 100%; margin-top: 20px; }
.panel.error { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.panel.highlight { border: 2px solid var(--brand); }
.panel.empty { text-align: center; padding: 40px 20px; }
.panel.prose { max-width: 720px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; margin-bottom: 8px; }
.brand .mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--brand); color: #fff; font-weight: 800; font-size: 13px; }

.layout { display: grid; grid-template-columns: 240px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; background: var(--navy); color: #fff; }
.topbar .brand { margin: 0; }
.topbar .menu { display: none; color: #fff; border-color: rgba(255,255,255,.3); }
.sidebar { border-right: 1px solid var(--line); background: var(--surface); padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.navhead { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 8px 6px; }
.navlink { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.navlink:hover { background: var(--bg); }
.navlink.active { background: var(--bg); font-weight: 700; box-shadow: inset 3px 0 0 var(--brand); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.warn-dot { margin-left: auto; background: var(--bad); color: #fff; border-radius: 50%; width: 18px; height: 18px; display: grid; place-items: center; font-size: 12px; font-weight: 800; }
.sidebar > .ghost { justify-content: flex-start; margin-top: 6px; }
.navfoot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.navfoot .ghost { justify-content: flex-start; }
.content { padding: 24px; min-width: 0; max-width: 1200px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tab.active { color: var(--ink); border-bottom-color: var(--brand); }
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar h2 { margin: 0 6px; min-width: 150px; text-align: center; }
.toolbar select { width: auto; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card.client { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); border-top: 4px solid var(--brand); }
.card.client:hover { border-color: var(--muted); }

/* badges + network icons */
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.badge.scheduled, .badge.publishing, .badge.pending { background: var(--info-bg); color: var(--info); }
.badge.published { background: var(--ok-bg); color: var(--ok); }
.badge.partial { background: var(--warn-bg); color: var(--warn); }
.badge.failed { background: var(--bad-bg); color: var(--bad); }
.net { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; font-size: 10px; font-weight: 800; color: #fff; flex: none; }
.net.facebook { background: #1b5fa8; }
.net.instagram { background: #a3237a; }
.net.linkedin_org, .net.linkedin_member { background: #0a5ea8; }
.net.threads { background: #1c1c1c; }
.net.bluesky { background: #1666d6; }
.net.google_business { background: #1a73e8; }
.net.youtube { background: #c4122f; }
.net.pinterest { background: #b60b1f; }
.net.tiktok { background: #111; }
.net.x { background: #000; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .net.threads, :root:not([data-theme="light"]) .net.tiktok, :root:not([data-theme="light"]) .net.x { box-shadow: inset 0 0 0 1px #5a6b7d; } }
.inline-form { margin-top: 16px; padding-top: 4px; border-top: 1px solid var(--line); max-width: 420px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar.placeholder { display: grid; place-items: center; background: var(--bg); color: var(--muted); font-weight: 700; }

/* calendar */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--line); gap: 1px; margin-bottom: 16px; }
.dow { background: var(--surface); padding: 6px 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.day { background: var(--surface); min-height: 110px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.day.other { background: var(--bg); }
.day.other .daynum span { color: var(--muted); }
.day.today .daynum span { background: var(--brand); color: #fff; border-radius: 999px; padding: 0 7px; }
.daynum { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; }
.daynum .add { text-decoration: none; color: var(--muted); padding: 0 6px; border-radius: 6px; opacity: 0; }
.day:hover .add, .daynum .add:focus { opacity: 1; background: var(--bg); }
.chip { display: flex; align-items: center; gap: 4px; font-size: 12px; text-decoration: none; color: var(--ink); background: var(--info-bg); border-left: 3px solid var(--info); padding: 3px 5px; border-radius: 5px; min-width: 0; }
.chip.published { background: var(--ok-bg); border-left-color: var(--ok); }
.chip.failed { background: var(--bad-bg); border-left-color: var(--bad); }
.chip.partial { background: var(--warn-bg); border-left-color: var(--warn); }
.chip .net { width: 16px; height: 16px; font-size: 8px; }
.chip .time { font-weight: 700; white-space: nowrap; }
.chip .snippet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ul.plain { margin: 0; padding-left: 18px; }

/* posts */
.list { display: flex; flex-direction: column; gap: 10px; }
.post .content { white-space: pre-wrap; overflow-wrap: anywhere; margin: 10px 0; }
.targets { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.targets li { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; background: var(--bg); display: block; }
.thumbwrap { position: relative; }
.thumbctl { position: absolute; inset: auto 4px 4px 4px; display: flex; justify-content: center; gap: 4px; }
.thumbctl button { background: var(--surface); }
.dropzone { width: 96px; height: 96px; margin: 0; border: 2px dashed var(--line); border-radius: 8px; display: grid; place-content: center; text-align: center; cursor: pointer; font-size: 12px; color: var(--muted); padding: 6px; }
.dropzone small { display: block; font-weight: 400; }
.thumbs.drag .dropzone { border-color: var(--brand); color: var(--brand); }

/* compose */
.compose { max-width: 760px; }
.accounts-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.pick { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 400; }
.pick:has(input:checked) { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.pick.disabled { opacity: .6; cursor: not-allowed; }
.pick span { display: flex; flex-direction: column; min-width: 0; }
.pick small { color: var(--muted); }
.counters { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; color: var(--muted); }
.counter { display: inline-flex; align-items: center; gap: 4px; }
.counter.over { color: var(--bad); font-weight: 700; }
details { margin-top: 14px; }
summary { cursor: pointer; font-weight: 600; }
.override { margin-top: 10px; }
.override textarea { margin-top: 6px; }

/* accounts */
ul.accounts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
ul.accounts li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
ul.accounts li:last-child { border-bottom: 0; }
.grow { flex: 1; min-width: 180px; display: flex; flex-direction: column; }

/* analytics */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi strong { display: block; font-size: 26px; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); }
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 16px; margin-top: 12px; }
.chart { margin: 0; }
.chart figcaption { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .axis { stroke: var(--line); }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .hit { fill: transparent; }
.chart .bar:hover rect:not(.hit) { opacity: .75; }
.chart .pt .dot { opacity: 0; }
.chart .pt:hover .dot { opacity: 1; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: capitalize; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table td.text { min-width: 200px; }

.toast { position: fixed; bottom: 16px; right: 16px; left: auto; max-width: min(420px, calc(100vw - 32px)); background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.2); z-index: 10; white-space: pre-line; }
.toast.error { background: var(--bad); }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .topbar { padding: 10px 16px; }
  .topbar .menu { display: inline-flex; }
  .sidebar { display: none; border-right: 0; border-bottom: 1px solid var(--line); }
  body.nav-open .sidebar { display: flex; }
  .content { padding: 16px; }
  .day { min-height: 70px; padding: 3px; }
  .chip .snippet, .chip .net { display: none; }
  .chip { font-size: 10px; padding: 2px 3px; }
  .dow { padding: 4px; font-size: 11px; }
}
