:root {
  --blue: #0866ff; --blue-dark: #0a58d6; --blue-soft: #e7f0ff;
  --ink: #1c2b33; --ink-2: #465a69; --ink-3: #7d8a95; --line: #dee3e9; --line-2: #eceff3;
  --nav-active: #283845; --card: #fff; --bg: #f1f4f8;
  --green: #1a7f37; --green-bg: #e3f6e8; --red: #c62828; --red-bg: #fde8e8;
  --amber: #8a5a00; --amber-bg: #fff3d6; --purple: #5b3cc4; --purple-bg: #ece8fb; --grey-bg: #eef1f4;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.4 -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--blue); text-decoration: none; } a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0; font-weight: 700; } h2 { font-size: 16px; margin: 0 0 4px; } h3 { font-size: 14px; margin: 0; }
.muted { color: var(--ink-3); } .small { font-size: 12px; } .right { text-align: right; } .nowrap { white-space: nowrap; }

/* shell */
.shell { display: flex; min-height: 100vh; background: linear-gradient(180deg, #fdf1f3 0, #eef3fb 220px, var(--bg) 480px); }
.rail { width: 50px; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 10px 0; gap: 4px; position: sticky; top: 0; height: 100vh; }
.rail .logo { width: 30px; height: 30px; margin-bottom: 10px; color: var(--blue); }
.rail a, .rail button { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; color: var(--ink-2); border: 0; background: none; cursor: pointer; }
.rail a:hover, .rail button:hover { background: var(--grey-bg); text-decoration: none; }
.rail a.on { background: var(--nav-active); color: #fff; }
.rail svg { width: 20px; height: 20px; }
.rail .spacer { flex: 1; }
.side { width: 300px; flex: none; padding: 20px 12px 20px 14px; }
.side .group { font-size: 12px; color: var(--ink-3); margin: 14px 8px 6px; }
.side .group:first-child { margin-top: 44px; }
.side a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.side a:hover { background: rgba(0,0,0,.05); text-decoration: none; }
.side a.on { background: var(--nav-active); color: #fff; }
.side a svg { width: 18px; height: 18px; flex: none; }
.main { flex: 1; min-width: 0; padding: 14px 24px 40px 0; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.topbar .sub { color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* cards */
.card { background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.02); margin-bottom: 14px; }
.card > .pad, .pad { padding: 16px 18px; }
.card-h { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.notice { display: flex; gap: 10px; padding: 12px 16px; border-left: 3px solid var(--blue); background: #fff; border-radius: var(--radius); margin-bottom: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.notice.warn { border-left-color: #f0a000; } .notice.err { border-left-color: var(--red); } .notice.ok { border-left-color: #2e9e4f; }
.notice b { display: block; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 6px; padding: 7px 12px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { background: var(--grey-bg); text-decoration: none; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; } .btn.primary:hover { background: var(--blue-dark); }
.btn.danger { color: var(--red); } .btn.sm { padding: 4px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=number], select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); width: 100%; }
select { width: auto; min-width: 140px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
label.field { display: block; font-weight: 600; margin-bottom: 12px; }
label.field > span { display: block; margin-bottom: 4px; font-size: 13px; }
label.field small { display: block; font-weight: 400; color: var(--ink-3); margin-top: 3px; }
.check { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 12px; font-weight: 600; }
.check small { display: block; font-weight: 400; color: var(--ink-3); }
.check input { margin-top: 3px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.inline { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline label.field { margin-bottom: 0; }

/* tabs & tables */
.tabs { display: flex; gap: 4px; padding: 10px 14px 0; border-bottom: 1px solid var(--line-2); }
.tabs a { padding: 8px 12px; margin-bottom: 8px; border-radius: 6px; color: var(--ink); font-weight: 500; }
.tabs a:hover { background: var(--grey-bg); text-decoration: none; }
.tabs a.on { background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.filters { display: flex; gap: 8px; padding: 12px 14px; align-items: center; border-bottom: 1px solid var(--line-2); }
.filters input { max-width: 300px; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-weight: 600; font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--line-2); color: var(--ink); }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click:hover { background: #f8fafc; cursor: pointer; }
.empty { padding: 48px 20px; text-align: center; color: var(--ink-3); }

/* post cell */
.postcell { display: flex; gap: 12px; align-items: center; min-width: 0; }
.thumb { position: relative; width: 54px; height: 54px; flex: none; border-radius: 4px; background: var(--grey-bg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 4px; display: block; }
.thumb .ph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--ink-3); font-size: 11px; }
.thumb .plat { position: absolute; right: -6px; bottom: -6px; }
.postcell .txt { min-width: 0; }
.postcell .ttl { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.postcell .meta { font-size: 12px; color: var(--ink-2); }

/* platform badges */
.plat { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 11px; font-weight: 800; border: 2px solid #fff; flex: none; }
.plat.sm { width: 18px; height: 18px; font-size: 9px; border-width: 1.5px; }
.plat.facebook { background: #1877f2; } .plat.instagram { background: linear-gradient(45deg, #f9ce34, #ee2a7b 55%, #6228d7); }
.plat.linkedin { background: #0a66c2; } .plat.threads { background: #111; } .plat.mastodon { background: #6364ff; } .plat.bluesky { background: #1185fe; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }

/* pills */
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--grey-bg); color: var(--ink-2); white-space: nowrap; }
.pill.green { background: var(--green-bg); color: var(--green); } .pill.red { background: var(--red-bg); color: var(--red); }
.pill.amber { background: var(--amber-bg); color: var(--amber); } .pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.purple { background: var(--purple-bg); color: var(--purple); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.stat { background: #fff; border-radius: var(--radius); padding: 14px 18px; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.stat .n { font-size: 28px; font-weight: 700; line-height: 1.1; } .stat .l { color: var(--ink-2); font-size: 13px; }
.meter { margin: 8px 0; } .meter .bar { height: 7px; border-radius: 4px; background: var(--grey-bg); overflow: hidden; margin-top: 3px; }
.meter .bar i { display: block; height: 100%; background: var(--blue); } .meter .bar i.hi { background: #f0a000; } .meter .bar i.max { background: var(--red); }
.meter .lbl { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); }
.cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }

/* channel rows */
.chan { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-2); align-items: start; }
.chan:last-child { border-bottom: 0; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--grey-bg); object-fit: cover; position: relative; }
.chan .opts { grid-column: 2 / 4; margin-top: 8px; padding: 12px 14px; background: #f7f9fb; border-radius: 6px; display: none; }
.chan.open .opts { display: block; }
.badge-row { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }

/* log */
.log { padding: 10px 16px; border-bottom: 1px solid var(--line-2); display: grid; grid-template-columns: 112px 22px 1fr; gap: 10px; }
.log:last-child { border-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #9aa7b2; margin-top: 5px; } .dot.warning { background: #f0a000; } .dot.error { background: var(--red); } .dot.info { background: #2e9e4f; }
details.d summary { cursor: pointer; color: var(--blue); font-size: 12px; } pre.raw { background: #f4f6f8; padding: 10px; border-radius: 6px; overflow: auto; font-size: 12px; max-height: 260px; margin: 6px 0 0; white-space: pre-wrap; word-break: break-word; }
.caption { white-space: pre-wrap; background: #f7f9fb; border-radius: 6px; padding: 10px 12px; margin: 6px 0; word-break: break-word; }
.note { color: var(--amber); font-size: 12px; margin: 2px 0; }
.media-strip { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; } .media-strip img, .media-strip video { width: 74px; height: 74px; object-fit: cover; border-radius: 4px; background: #000; }
.pager { display: flex; gap: 8px; justify-content: center; padding: 14px; align-items: center; }
.flash-wrap { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 20; display: grid; gap: 8px; width: min(560px, 92vw); }
.flash { background: #fff; padding: 11px 14px; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,.18); border-left: 4px solid var(--blue); }
.flash.error { border-left-color: var(--red); } .flash.success { border-left-color: #2e9e4f; }
.paused-bar { background: #fff3d6; color: var(--amber); padding: 8px 16px; font-weight: 600; border-radius: var(--radius); margin-bottom: 12px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #fdf1f3, #e8f0fd); padding: 20px; }
.login .box { background: #fff; padding: 32px; border-radius: 12px; width: 380px; max-width: 100%; box-shadow: 0 8px 40px rgba(0,0,0,.12); }
.login .logo { width: 44px; color: var(--blue); margin-bottom: 14px; }

@media (max-width: 1000px) {
  .side { display: none; } .main { padding: 14px; } .stats { grid-template-columns: 1fr 1fr; } .cols, .grid2 { grid-template-columns: 1fr; }
}
