:root {
  --bg: #0f172a; --panel: #111827; --panel-2: #1f2937; --line: #273449;
  --text: #e5e7eb; --muted: #9ca3af; --accent: #22c55e; --danger: #ef4444; --ok: #22c55e; --warn: #f59e0b;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: #93c5fd; text-decoration: none; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); padding-top: max(10px, env(safe-area-inset-top)); }
.brand { color: var(--text); font-weight: 700; }
.topnav { display: flex; gap: 6px; }
.inline { display: inline; }
.container { max-width: 760px; margin: 0 auto; padding: 12px 12px 90px; }
.foot { padding: 10px 14px 24px; color: var(--muted); font-size: 12px; text-align: center; }
.muted { color: var(--muted); }
.error { color: #fca5a5; background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.35); padding: 8px 10px; border-radius: 8px; }
.ok { color: #86efac; }
.warn { color: #fcd34d; }
.flash { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #064e3b; color: #d1fae5; padding: 10px 16px; border-radius: 999px; box-shadow: 0 6px 24px rgba(0,0,0,.4); z-index: 20; max-width: 90vw; }

.filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.chips { display: flex; gap: 6px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
.chip { flex: 0 0 auto; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 14px; }
.chip.on { color: var(--text); border-color: var(--accent); background: var(--panel-2); }
.chip .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; background: var(--panel-2); font-size: 12px; text-align: center; }
.chip.on .count { background: var(--accent); color: #041b0c; }

.cards { display: flex; flex-direction: column; gap: 12px; }
.card, .detail { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); overflow: hidden; }
.card.htmx-request { opacity: .6; }
.card-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px 0; flex-wrap: wrap; }
.tag { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.tag.site { color: var(--text); border: 1px solid var(--accent); }
.tag.platform.ghost { color: #c4b5fd; } .tag.platform.facebook { color: #93c5fd; } .tag.platform.instagram { color: #f9a8d4; }
.status-failed .tag.status { background: rgba(239,68,68,.2); color: #fca5a5; }
.status-published .tag.status { background: rgba(34,197,94,.2); color: #86efac; }
.status-publishing .tag.status { background: rgba(245,158,11,.2); color: #fcd34d; }
.age { margin-left: auto; color: var(--muted); font-size: 12px; }
.card-body { display: flex; gap: 12px; padding: 10px 12px; color: inherit; }
.thumb { flex: 0 0 84px; width: 84px; height: 84px; border-radius: 8px; overflow: hidden; background: var(--panel-2); display: grid; place-items: center; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-ph { color: var(--muted); font-size: 12px; }
.card-text { min-width: 0; }
.card-text h3 { margin: 0 0 4px; font-size: 17px; line-height: 1.3; }
.card-text p { margin: 0 0 4px; font-size: 14px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.card-actions.sticky { position: sticky; bottom: 0; background: var(--panel); margin: 0 -14px -14px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); }

.btn { -webkit-appearance: none; appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); padding: 10px 14px; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; }
.btn-primary { background: var(--ok); border-color: var(--ok); color: #041b0c; margin-left: auto; }
.btn-danger { background: transparent; border-color: rgba(239,68,68,.5); color: #fca5a5; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-block { width: 100%; justify-content: center; }
.btn:active { transform: translateY(1px); }

.empty { text-align: center; padding: 60px 20px; }

.detail { padding: 0 14px 14px; }
.detail .card-head { padding: 12px 0 8px; }
.detail .hero { width: 100%; max-height: 420px; object-fit: contain; border-radius: 8px; background: var(--panel-2); margin: 8px 0; }
.edit-form label { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--muted); }
.edit-form input, .edit-form textarea { width: 100%; margin-top: 4px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 16px; font-family: inherit; }
.edit-form textarea { resize: vertical; }
.edit-form input[readonly], .edit-form textarea[readonly] { opacity: .7; }
.brief { white-space: pre-wrap; font-size: 13px; color: var(--muted); }
details { margin-top: 14px; } summary { cursor: pointer; color: var(--muted); }
.rendered { background: #fff; color: #111; padding: 16px; border-radius: 8px; margin-top: 8px; overflow-x: auto; }
.rendered img { max-width: 100%; }
.history ul { padding-left: 18px; font-size: 13px; }

.login-body { display: grid; place-items: center; min-height: 100vh; margin: 0; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.login-card h1 { margin: 0 0 16px; font-size: 22px; }
.login-card label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.login-card input { width: 100%; padding: 12px; font-size: 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); margin-bottom: 12px; }

@media (min-width: 700px) {
  .card-text h3 { font-size: 18px; }
}

/* social autopilot */
.tag.auto { background: rgba(59,130,246,.2); color: #93c5fd; }
.tag.lint { background: rgba(245,158,11,.2); color: #fcd34d; }
.status-scheduled .tag.status { background: rgba(59,130,246,.2); color: #93c5fd; }
.lint { list-style: none; padding: 0; margin: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.lint li { padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.lint-warn { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.35); }
.lint-error { background: rgba(239,68,68,.12); border: 1px solid rgba(239,68,68,.35); }
.notes { margin: 10px 14px; font-size: 14px; }
.notes p { margin: 6px 0; }
.reason { flex: 1 1 100%; font-size: 13px; color: var(--muted); }
.reason input { width: 100%; margin-top: 4px; }
.small { font-size: 12px; }
.trust { width: 100%; border-collapse: collapse; font-size: 14px; }
.trust th, .trust td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.meter { display: inline-block; width: 80px; height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; vertical-align: middle; margin-right: 6px; }
.meter span { display: block; height: 100%; background: var(--accent); }
.cal { display: flex; flex-direction: column; gap: 10px; }
.cal-day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.cal-day h3 { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.cal-post { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-left: 3px solid var(--accent); margin-bottom: 4px; color: var(--text); background: var(--panel-2); border-radius: 6px; font-size: 14px; }
.cal-post.status-published { opacity: .7; }
.cal-time { color: var(--muted); font-size: 12px; min-width: 64px; }
.cal-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* bulk select + reject reasons */
.card-head .pick { width: 18px; height: 18px; margin: 0 2px 0 0; accent-color: var(--ok); }
.pick-all { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; margin: 0 0 10px 2px; }
.pick-all input { width: 16px; height: 16px; accent-color: var(--ok); }
.bulkbar { position: sticky; bottom: 0; z-index: 15; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 -6px 24px rgba(0,0,0,.35); }
.bulkbar[hidden] { display: none; }
.bulkbar input[name=reason] { flex: 1 1 220px; min-width: 0; }
.pick-count { font-weight: 600; margin-right: 4px; }
.reject-pop { position: relative; }
.reject-pop > summary { list-style: none; cursor: pointer; }
.reject-pop > summary::-webkit-details-marker { display: none; }
.reject-pop[open] > summary { opacity: .6; }
.reject-pop form { position: absolute; z-index: 10; bottom: calc(100% + 6px); left: 0; display: flex; gap: 6px; width: min(360px, 80vw); padding: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.reject-pop form input { flex: 1; min-width: 0; }
.bulkbar input[name=reason], .reject-pop input { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 16px; font-family: inherit; }
@media (max-width: 480px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .topnav { flex-wrap: wrap; gap: 4px; }
  .topnav .btn { padding: 6px 10px; font-size: 14px; }
}
