:root {
  --bg: #f6f7f9; --card: #fff; --text: #111827; --muted: #6b7280; --line: #e5e7eb;
  --accent: #2563eb; --accent-text: #fff; --danger: #b91c1c; --ok: #047857; --warn-bg: #fef3c7; --warn: #92400e;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b0f17; --card: #151b26; --text: #e5e7eb; --muted: #9ca3af; --line: #273042;
    --accent: #3b82f6; --danger: #f87171; --ok: #34d399; --warn-bg: #3a2e0a; --warn: #fcd34d; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
h2 { margin: 0 0 4px; font-size: 22px; } h3 { margin: 0 0 6px; font-size: 16px; }
.muted { color: var(--muted); margin: 0 0 14px; font-size: 14px; }

header { position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 16px; }
.brand { font-size: 17px; }
nav { display: flex; gap: 4px; overflow-x: auto; width: 100%; }
@media (min-width: 760px) { nav { width: auto; margin-left: auto; } }
nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; white-space: nowrap; }
nav a.active { background: var(--bg); color: var(--text); font-weight: 600; }
.count:not(:empty) { background: var(--accent); color: var(--accent-text); border-radius: 999px; padding: 0 7px; font-size: 12px; margin-left: 2px; }
.badge { background: var(--warn-bg); color: var(--warn); font-size: 12px; padding: 2px 8px; border-radius: 999px; }

main { max-width: 760px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.list { display: grid; gap: 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

label { display: block; font-weight: 500; margin-bottom: 12px; }
input[type=text], input[type=password], input:not([type]), textarea {
  width: 100%; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin-top: 4px; }
textarea { resize: vertical; }
button { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 8px; padding: 8px 14px; cursor: pointer; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.danger { color: var(--danger); }
button.link { border: 0; background: none; color: var(--muted); text-decoration: underline; padding: 0; }
button:disabled { opacity: .55; cursor: wait; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 22px; text-align: center; cursor: pointer; font-weight: 400; color: var(--muted); }
.drop.over { border-color: var(--accent); }
.drop input { display: none; }
.drop img, .drop video, .media img, .media video { max-width: 100%; max-height: 340px; border-radius: 8px; display: block; margin: 10px auto 0; }
.platforms { border: 0; padding: 0; margin: 0 0 14px; display: flex; gap: 18px; }
.platforms label { display: flex; align-items: center; gap: 6px; margin: 0; }

.post { display: grid; gap: 12px; }
@media (min-width: 640px) { .post { grid-template-columns: 220px 1fr; } .post .media img, .post .media video { margin-top: 0; max-height: 260px; } }
.meta { font-size: 13px; color: var(--muted); }
.error { color: var(--danger); font-size: 14px; white-space: pre-wrap; }
.note { background: var(--warn-bg); color: var(--warn); padding: 6px 10px; border-radius: 8px; font-size: 13px; }
.chip { display: inline-block; font-size: 12px; border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; margin-right: 4px; }
.quote { border-left: 3px solid var(--line); padding-left: 10px; margin: 6px 0 10px; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; float: right; margin-left: 10px; }

.rules { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 6px; }
.rules li { display: flex; gap: 8px; align-items: center; }
.rules li input { margin: 0; }
.rules .src { font-size: 11px; color: var(--muted); min-width: 52px; }
.add-rule { display: flex; gap: 8px; } .add-rule input { margin: 0; }
.history { margin-top: 24px; } .history summary { cursor: pointer; color: var(--muted); margin-bottom: 12px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 340px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; max-width: calc(100% - 32px); z-index: 10; }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }
