/* Dark is the default theme; web/theme.js sets data-theme="light" when the user picked it. */
:root { color-scheme: dark;
  --bg: #0b0f14; --surface: #131a22; --th: #10161d; --muted-bg: #1a222c; --track: #0e141a;
  --line: #1f2833; --border: #26303c; --border-strong: #344150; --avatar: #2a3542; --hover: #18202a;
  --seg-on: #2a3542; --text: #e6eaf0; --text-2: #d5dbe3; --text-3: #b8c1cc; --muted: #9aa4b1;
  --muted-2: #8b95a3; --on-text: #0b0f14; --link: #93c5fd; --link-hover: #bfdbfe; --accent: #3b82f6;
  --primary: #1d4ed8; --up: #34d399; --down: #fca5a5; --stale: #fdba74; --error: #fdba74;
  --warn-bg: #2a1a0e; --warn-border: #7c3a12; }
:root[data-theme="light"] { color-scheme: light;
  --bg: #f4f5f7; --surface: #ffffff; --th: #fafbfc; --muted-bg: #f1f3f6; --track: #e8ebef;
  --line: #eef0f3; --border: #e3e6eb; --border-strong: #d4d8df; --avatar: #dde3ea; --hover: #fafbfd;
  --seg-on: #ffffff; --text: #111827; --text-2: #1f2937; --text-3: #374151; --muted: #4b5563;
  --muted-2: #5b6472; --on-text: #ffffff; --link: #1e40af; --link-hover: #1e3a8a; --accent: #3b82f6;
  --primary: #1d4ed8; --up: #047857; --down: #b91c1c; --stale: #9a3412; --error: #9a3412;
  --warn-bg: #fff7ed; --warn-border: #fed7aa; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, sans-serif; }
body.center { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }
.num, .n, .kpi strong { font-family: "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

header { background: var(--surface); border-bottom: 1px solid var(--border); }
.bar { max-width: 1360px; margin: 0 auto; padding: 12px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand h1 { font-size: 17px; margin: 0; }
.brand svg rect { fill: var(--text); }
.brand svg path { stroke: var(--on-text); }
.pill { font-size: 13px; color: var(--text-3); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; }
.pill.warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--stale); }
main { max-width: 1360px; margin: 0 auto; padding: 24px; display: grid; gap: 20px; }
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.head h2 { margin: 0; font-size: 26px; }
.head p { margin: 4px 0 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; }
.card h3 { margin: 0 0 12px; font-size: 16px; }
.narrow { width: 100%; max-width: 360px; display: grid; gap: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#add { flex: 0 1 720px; }
#add input[type=url] { flex: 999 1 320px; min-width: 0; }
#add input[name=creator] { flex: 1 1 160px; min-width: 0; }
label { display: grid; gap: 4px; }
input, select, button { font: inherit; font-size: 14px; min-height: 40px; padding: 0 12px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--surface); color: var(--text); }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; cursor: pointer; }
button.ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text-2); }
button.ghost:hover { background: var(--hover); }
button.link { background: none; border: 0; color: var(--link); min-height: 32px; padding: 0 6px; font-weight: 600; }
button.link:hover { color: var(--link-hover); text-decoration: underline; }
button:disabled { opacity: .5; cursor: default; }

.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--track); border-radius: 8px; }
.seg button { background: transparent; border: 0; color: var(--muted); min-height: 34px; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--seg-on); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; }
.chip { background: var(--surface); border-color: var(--border-strong); color: var(--text-3); border-radius: 999px;
  min-height: 34px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--on-text); }
#search { width: 240px; max-width: 100%; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; display: grid; gap: 4px; }
.kpi span { color: var(--muted); font-size: 13px; }
.kpi strong { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; }
.kpi small { font-size: 12px; color: var(--muted-2); }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.barrow { display: grid; gap: 6px; margin-bottom: 12px; }
.barrow div:first-child { display: flex; justify-content: space-between; font-size: 13px; }
.track { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.fill { height: 8px; border-radius: 4px; background: var(--accent); }
.alert { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.alert:first-of-type { border-top: 0; padding-top: 0; }
.alert .muted { display: block; }
.count { font-size: 12px; font-weight: 600; background: var(--warn-bg); color: var(--stale); padding: 2px 10px; border-radius: 999px; }

.mark { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 6px;
  color: #fff; font-size: 10px; font-weight: 700; flex: none; }
.mark.facebook { background: #1d4ed8; } .mark.instagram { background: #be185d; } .mark.tiktok { background: #3f4b5b; }
.mark.x { background: #475569; } .mark.youtube { background: #b91c1c; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; margin-top: 7px; }
.dot.fresh { background: #059669; } .dot.wait { background: #9ca3af; } .dot.stale { background: #d97706; } .dot.error { background: #c2410c; }
.dot.queued { background: #3b82f6; }
#fetchBar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 20px 14px; border-bottom: 1px solid var(--line, #26303c); }
#fetchBar .muted { font-size: 13px; }
td.pick, th.pick { width: 28px; padding-right: 0; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--avatar); color: var(--text-2); font-size: 12px; font-weight: 700; flex: none; }

.table-card { padding: 0; overflow: hidden; }
.table-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 20px; padding: 4px 20px; }
.tabs { display: flex; gap: 24px; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--muted);
  min-height: 48px; padding: 0 2px; font-size: 15px; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs .num { color: var(--muted-2); font-weight: 500; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend .dot { margin-top: 0; }
#selBar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 0 20px 14px; }
.scroll { overflow-x: auto; position: relative; }  /* relative: keeps .sr labels inside the scroll box */
table { width: 100%; border-collapse: collapse; }
table.wide { min-width: 1080px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 14px; }
th { color: var(--muted-2); font-weight: 600; font-size: 12px; background: var(--th); white-space: nowrap; }
th.n, td.n { text-align: right; white-space: nowrap; }
tbody tr:hover td { background: var(--hover); }
.post { display: flex; gap: 10px; align-items: flex-start; max-width: 360px; }
.post a { color: var(--text); text-decoration: none; font-weight: 500; word-break: break-word; }
.post a:hover { text-decoration: underline; }
.who { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-weight: 600; }
.status { display: flex; gap: 6px; white-space: nowrap; }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 20px; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--error); font-size: 13px; }
.stale { color: var(--stale); }
td .muted, td .error { max-width: 240px; }
.up { color: var(--up); font-size: 12px; }
.down { color: var(--down); font-size: 12px; }
.tag { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--muted-bg); color: var(--text-3); white-space: nowrap; }
.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.info h3 { font-size: 15px; margin: 0 0 6px; }
.info p, .info ol { margin: 0; font-size: 14px; color: var(--text-3); line-height: 1.6; }
code { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 13px; background: var(--muted-bg); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: 12px; }
dialog { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 20px 24px;
  margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(640px, 100vw); border-radius: 0; }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
dialog h2 { font-size: 18px; margin: 0 0 16px; }
@media (max-width: 700px) {
  .bar, main { padding-left: 16px; padding-right: 16px; }
  details table, dialog table { display: block; overflow-x: auto; }
}

/* Public site: homepage, pricing, legal and contact pages (body.site). */
.site header .bar { max-width: 1120px; }
.site nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; }
.site nav a { color: var(--text-2); text-decoration: none; font-weight: 500; }
.site nav a:hover { color: var(--text); }
.site nav a.cta { background: var(--primary); color: #fff; border-radius: 8px; padding: 7px 14px; font-weight: 600; }
.site main { max-width: 1120px; gap: 28px; padding: 32px 24px 48px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, 1fr); gap: 32px; align-items: center; }
.hero h2 { font-size: clamp(28px, 4vw, 42px); line-height: 1.2; margin: 0 0 14px; }
.hero p.lead { font-size: 17px; color: var(--text-3); margin: 0 0 18px; }
.hero ul { margin: 0; padding-left: 20px; color: var(--text-3); display: grid; gap: 6px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.grid3 .card p { color: var(--text-3); margin: 0; }
.section-title { font-size: 22px; margin: 8px 0 0; }
.plan { display: grid; gap: 10px; align-content: start; }
.plan.best { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan .price { font-size: 30px; font-weight: 700; }
.plan .price small { font-size: 14px; font-weight: 500; color: var(--muted); }
.plan ul { margin: 0; padding-left: 20px; color: var(--text-3); display: grid; gap: 4px; }
.plan a.button, a.button { display: inline-block; text-align: center; background: var(--primary); color: #fff; border-radius: 8px;
  padding: 9px 14px; font-weight: 600; text-decoration: none; }
a.button.ghost { background: var(--surface); color: var(--text-2); border: 1px solid var(--border-strong); }
.prose { max-width: 760px; }
.prose h2 { margin-top: 0; }
.prose h3 { margin: 22px 0 6px; }
.prose p, .prose li { color: var(--text-3); }
.site footer { border-top: 1px solid var(--border); }
.site footer .bar { max-width: 1120px; color: var(--muted); font-size: 13px; }
.site footer a { color: var(--muted); }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } }
