:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1c1e21;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --fb: #1877f2;
  --ig: #d62976;
  --ok: #15803d;
  --warn: #b45309;
  --err: #b91c1c;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 480px; margin: 40px auto; }
h1 { font-size: 1.6rem; margin: 20px 0 10px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 20px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.r { text-align: right; }

.top { background: var(--card); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-weight: 700; color: var(--text); }
.top nav a { margin-left: 18px; color: var(--muted); }
.top nav a.active, .top nav a:hover { color: var(--text); text-decoration: none; }
.foot { padding: 30px 20px; color: var(--muted); font-size: .85rem; text-align: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin: 16px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .grid2 { grid-template-columns: 1fr; } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.inline { display: inline; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.tile .num { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.tile .lbl { color: var(--muted); font-size: .85rem; }
.tile.fb .num { color: var(--fb); }
.tile.ig .num { color: var(--ig); }

.flash { padding: 10px 14px; border-radius: 8px; margin: 12px 0; border: 1px solid; }
.flash-ok { background: #ecfdf5; border-color: #a7f3d0; color: var(--ok); }
.flash-warn { background: #fffbeb; border-color: #fde68a; color: var(--warn); }
.flash-error { background: #fef2f2; border-color: #fecaca; color: var(--err); }

form label { display: block; margin: 10px 0; font-weight: 600; font-size: .9rem; }
form input:not([type=radio]), form select { display: block; width: 100%; max-width: 520px; margin-top: 4px; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; font-weight: 400; }
label.radio { font-weight: 400; }
label.radio input { margin-right: 6px; }
button, .btn { display: inline-block; background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; }
button:hover, .btn:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }
button.secondary, .btn.secondary { background: #e5e7eb; color: var(--text); }
button.secondary:hover, .btn.secondary:hover { background: #d1d5db; }
button.danger { background: var(--err); }
details { margin-top: 14px; }
summary { cursor: pointer; color: var(--accent); }

.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filters label { margin: 0; }
.filters input, .filters select { width: auto; min-width: 140px; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr.err td { color: var(--err); }
.table-wrap { overflow-x: auto; }
table.kv th { width: 160px; text-transform: none; font-size: .9rem; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 4px; font-size: .88em; word-break: break-all; }
.msg { max-width: 460px; }
.thumb { float: left; width: 48px; height: 48px; object-fit: cover; border-radius: 6px; margin: 0 10px 4px 0; }
.ok { color: var(--ok); font-weight: 600; }
.bad { color: var(--err); font-weight: 600; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; color: #fff; background: var(--muted); }
.pill.facebook { background: var(--fb); }
.pill.instagram { background: var(--ig); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list .meta { display: flex; gap: 8px; align-items: center; font-size: .85rem; margin-bottom: 2px; }

.chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; }
.bar { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; }
.seg { width: 100%; }
.seg.fb { background: var(--fb); border-radius: 2px 2px 0 0; }
.seg.ig { background: var(--ig); border-radius: 2px 2px 0 0; }
.bar-lbl { font-size: .65rem; color: var(--muted); margin-top: 4px; }
.legend { margin-top: 8px; font-size: .85rem; color: var(--muted); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 4px 0 10px; vertical-align: middle; }
.sw.fb { background: var(--fb); }
.sw.ig { background: var(--ig); }

.pager { display: flex; gap: 16px; justify-content: center; margin: 20px 0; }
