/* FlowStateAura owner dashboard. Phone first; wider screens get more room. */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5f6b7a;
  --border: #e2e6eb;
  --accent: #1f6feb;
  --ok: #1a7f37;
  --warn: #9a6700;
  --bad: #c62828;
  --hot-bg: #fff4e5;
  --radius-card: 12px;
  --pad-card: 16px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Myanmar", "Myanmar Text", "Pyidaungsu", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #182029;
    --text: #e6edf3;
    --muted: #9aa7b4;
    --border: #2a3542;
    --accent: #58a6ff;
    --ok: #3fb950;
    --warn: #d29922;
    --bad: #f47067;
    --hot-bg: #3a2a12;
    --shadow-card: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); }
main { padding: 12px 16px 32px; max-width: 760px; margin: 0 auto; }
a { color: var(--accent); }
code { font-size: 0.85em; background: var(--bg); padding: 1px 4px; border-radius: 4px; }
h1 { font-size: 1.3rem; margin: 0 0 12px; }
h2 { font-size: 1.05rem; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }

.top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 700; flex: 1; }
.logout { margin: 0; }
.tabs { display: flex; gap: 4px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs a, .tab-soon { padding: 10px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab-soon { opacity: 0.6; cursor: default; }
.tab-soon b { background: var(--accent); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 0.8em; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: var(--pad-card); margin: 0 0 12px; box-shadow: var(--shadow-card); }
.card.narrow { max-width: 400px; margin: 40px auto; }
.card.attention { background: var(--hot-bg); }
.count { font-size: 0.8rem; font-weight: 600; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 0 8px; }

.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 0; border-top: 1px solid var(--border); }
.row:first-child { border-top: 0; padding-top: 0; }
.when { font-weight: 600; font-size: 0.9rem; margin-right: 2px; }
.line { flex-basis: 100%; color: var(--text); overflow-wrap: anywhere; }
.line[lang="my"] { line-height: 1.8; }
.tag { font-size: 0.75rem; border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; color: var(--muted); }
.tag.bad { color: var(--bad); border-color: var(--bad); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stats div { background: var(--bg); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; }
.stats b { font-size: 1.4rem; }
.stats span { color: var(--muted); font-size: 0.85rem; }
.stats .hot { background: var(--hot-bg); }

.pill { font-size: 0.8rem; border-radius: 12px; padding: 2px 10px; border: 1px solid currentColor; white-space: nowrap; }
.pill-running { color: var(--ok); }
.pill-paused { color: var(--warn); }
.pill-not_running { color: var(--muted); }

.setup, .files { list-style: none; margin: 0; padding: 0; }
.setup li, .files li { padding: 4px 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; }
.dot.ok { background: var(--ok); }
.dot.no { background: var(--warn); }
.dot.opt { background: var(--border); }

.muted { color: var(--muted); font-size: 0.9rem; }
.warn { color: var(--warn); }
.alert { color: var(--bad); background: var(--hot-bg); border-radius: 8px; padding: 8px 10px; }
.foot { text-align: center; }

label { display: block; font-weight: 600; margin: 8px 0 4px; }
input { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
button { font: inherit; margin-top: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
button.link { width: auto; margin: 0; padding: 4px 8px; background: none; color: var(--accent); font-weight: 500; }

@media (min-width: 720px) {
  main { padding-top: 20px; }
  .stats { grid-template-columns: repeat(4, 1fr); }

}

/* ---------- D2: drafts list and preview ---------- */
.badge { background: var(--accent); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 0.8em; }
.rowlink { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: inherit; text-decoration: none; width: 100%; }
.rowlink:hover .line { text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.chip { font-size: 0.85rem; text-decoration: none; color: var(--text); border: 1px solid var(--border); border-radius: 16px; padding: 3px 10px; background: var(--bg); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip b { font-weight: 600; opacity: 0.8; }
.status { font-size: 0.75rem; border-radius: 6px; padding: 0 6px; font-weight: 600; }
.st-draft { background: var(--hot-bg); color: var(--warn); }
.st-approved, .st-scheduled { background: rgba(26, 127, 55, 0.12); color: var(--ok); }
.st-posted { background: rgba(31, 111, 235, 0.12); color: var(--accent); }
.st-rejected { background: rgba(198, 40, 40, 0.12); color: var(--bad); }
.tag.warnt, li.warnt { color: var(--warn); }
.tag.okt, .okline { color: var(--ok); }
.tag.warnt { border-color: var(--warn); }
.tag.okt { border-color: var(--ok); }
.crumbs { margin: 0 0 8px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.id { font-family: ui-monospace, Consolas, monospace; font-size: 0.75rem; overflow-wrap: anywhere; }
.probs { margin: 6px 0; padding-left: 20px; }
.probs .bad { color: var(--bad); }

.pv { border-radius: 10px; overflow-wrap: anywhere; }
.pv [lang="my"], .pv[lang="my"] { line-height: 1.9; }
.pv-telegram { background: #dbe7f0; padding: 14px; }
.pv-telegram .bubble { background: #fff; color: #111; border-radius: 12px 12px 12px 4px; padding: 10px 12px; white-space: pre-wrap; max-width: 92%; box-shadow: 0 1px 1px rgba(0,0,0,0.08); }
.pv-facebook { border: 1px solid var(--border); background: var(--surface); }
.fb-head { display: flex; gap: 10px; align-items: center; padding: 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.fb-text { padding: 0 12px 14px; white-space: pre-wrap; }
.pv-tiktok { background: #111; color: #f2f2f2; padding: 12px; max-width: 360px; }
.pv-tiktok a { color: #8ab4f8; }
.tt-video { aspect-ratio: 9 / 16; max-height: 260px; border: 1px dashed #555; border-radius: 8px; display: grid; place-items: center; color: #aaa; font-size: 0.85rem; margin: 0 auto 10px; }
.tt-caption { white-space: pre-wrap; font-size: 0.95rem; }
.tags { margin-top: 6px; color: #8ab4f8; }
.pv-website { border: 1px solid var(--border); padding: 4px 16px 12px; background: var(--surface); }
.pv-website h2 { font-size: 1.3rem; display: block; margin: 14px 0 8px; }
.pv-website h3, .pv-website h4 { font-size: 1.05rem; margin: 14px 0 6px; }

.media { display: flex; flex-wrap: wrap; gap: 10px; }
.media img, .media video { max-width: 100%; max-height: 320px; border-radius: 8px; border: 1px solid var(--border); }
.missing { color: var(--bad); }
details { border-top: 1px solid var(--border); padding: 8px 0; }
details:first-of-type { border-top: 0; }
summary { cursor: pointer; font-weight: 600; }
pre.note { white-space: pre-wrap; overflow-wrap: anywhere; font: 0.9rem/1.6 var(--font); background: var(--bg); padding: 10px; border-radius: 8px; margin: 8px 0 0; }
pre.note[lang="my"] { line-height: 1.9; }
@media (prefers-color-scheme: dark) {
  .pv-telegram { background: #17212b; }
  .pv-telegram .bubble { background: #2b5278; color: #fff; }
}
div.note { font-size: 0.9rem; background: var(--bg); padding: 4px 12px; border-radius: 8px; margin: 8px 0 0; overflow-wrap: anywhere; }
div.note[lang="my"] { line-height: 1.9; }
div.note h2, div.note h3 { font-size: 1rem; display: block; margin: 10px 0 4px; }
.tablewrap { overflow-x: auto; margin: 8px 0; }
.tablewrap table { border-collapse: collapse; font-size: 0.85rem; min-width: 100%; }
.tablewrap th, .tablewrap td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; vertical-align: top; }
.tablewrap th { background: var(--surface); }

/* ---------- D3: owner actions ---------- */
.flash { color: var(--ok); background: rgba(26, 127, 55, 0.1); border-radius: 8px; padding: 8px 10px; }
.actions form { margin: 0 0 8px; }
button.approve { background: var(--ok); }
button.secondary, a.button.secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
a.button { display: block; text-align: center; font-weight: 600; padding: 10px 12px; border-radius: 8px; text-decoration: none; }
button.danger { background: var(--bad); }
details.reject { margin-top: 8px; border-top: 1px solid var(--border); }
textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); resize: vertical; }
textarea[lang="my"] { line-height: 1.9; }

/* ---------- D5: publishing ---------- */
.res-posted { background: rgba(26, 127, 55, 0.12); color: var(--ok); }
.res-failed, .res-refused { background: rgba(198, 40, 40, 0.12); color: var(--bad); }
.res-missed, .res-waiting { background: var(--hot-bg); color: var(--warn); }
form.inline { margin: 0; flex-basis: 100%; }
button.small { width: auto; margin-top: 4px; padding: 4px 12px; font-size: 0.85rem; }
