:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --line: #e3e8ef;
  --text: #1b2433;
  --muted: #667085;
  --accent: #2f6fed;
  --accent-soft: #e8f0fe;
  --ok: #12805c;
  --ok-soft: #e3f6ee;
  --warn: #b25e09;
  --warn-soft: #fff4e5;
  --err: #c0262d;
  --err-soft: #fdecec;
  --sim: #6941c6;
  --sim-soft: #f1ecfd;
  --brand: #5a1f6e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; }
code { background: #f1f3f7; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grow { flex: 1; min-width: 0; }
.err-text { color: var(--err); }

/* Topbar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 24px; height: 60px; padding: 0 24px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand b { color: var(--brand); }
.pills { flex: 1; display: flex; justify-content: center; gap: 8px; }
.pill { padding: 7px 14px; border-radius: 999px; background: #eef1f6; color: #3b4658; font-weight: 500; font-size: 13px; }
.pill:hover { text-decoration: none; background: #e3e8f0; }
.pill.active { background: var(--accent); color: #fff; }
.pill.disabled { opacity: .45; cursor: default; }
.userbox { display: flex; align-items: center; gap: 10px; }
.avatar { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 600; font-size: 13px; }
.uname { font-weight: 500; }
button.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
button.link:hover { color: var(--text); }

/* Layout */
.shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.sidebar { padding: 20px 16px; border-right: 1px solid var(--line); background: var(--bg); }
.side-title { margin: 18px 12px 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.side-title:first-child { margin-top: 4px; }
.side-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #344054; }
.side-item small { display: block; color: var(--muted); font-size: 12px; }
a.side-item:hover { background: #eef2f8; text-decoration: none; }
.side-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.side-link { display: block; margin: 8px 12px; font-size: 13px; }
.main { padding: 20px 24px 60px; max-width: 1100px; }
.main.narrow { max-width: 900px; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.head-card { overflow: hidden; margin-bottom: 18px; }
.head-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; }
.head-row h1 { font-size: 18px; }
.head-row p { margin: 4px 0 0; }
.kpis { display: flex; gap: 0; }
.kpi { padding: 0 18px; border-left: 1px solid var(--line); min-width: 96px; }
.kpi span { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.kpi b { font-size: 20px; }
.kpi em { display: block; font-style: normal; font-size: 11px; color: var(--sim); }
.kpi-err b { color: var(--err); }
.statusbar { display: flex; align-items: center; gap: 10px; padding: 10px 20px; background: var(--accent-soft); color: #23395d; font-size: 13px; border-top: 1px solid #d6e3fb; }
.statusbar.paused { background: var(--warn-soft); border-top-color: #f6dfbd; color: #6b3c06; }
.statusbar.warn .bolt { filter: grayscale(.3); }
.sep { color: #9aa4b5; margin: 0 4px; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 18px; overflow-x: auto; }
.tab { padding: 10px 0; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { text-decoration: none; color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.seg { display: flex; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.seg a { padding: 6px 12px; color: #344054; font-size: 13px; border-left: 1px solid var(--line); }
.seg a:first-child { border-left: 0; }
.seg a:hover { text-decoration: none; background: #f2f5fa; }
.seg a.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }

/* Articles */
.art { display: flex; gap: 16px; padding: 14px; margin-bottom: 10px; }
.thumb { flex: 0 0 136px; height: 88px; border-radius: 6px; overflow: hidden; background: #e9edf3; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-body { flex: 1; min-width: 0; }
.art h3 { font-size: 15px; font-weight: 600; line-height: 1.35; }
.art h3 a { color: var(--text); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 6px 0 4px; font-size: 12px; color: #475467; }
.tag { padding: 2px 8px; border-radius: 999px; background: #eef1f6; font-weight: 500; }
.post { margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.post-failed { border-color: #f5c2c4; background: #fffafa; }
.post-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.post-msg { margin: 6px 0 0; white-space: normal; overflow-wrap: anywhere; color: #263142; }
.post-err { margin: 6px 0 0; color: var(--err); font-size: 12px; overflow-wrap: anywhere; }
.post-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; margin-top: 8px; }
.post-actions:empty { display: none; }
.post-actions form { margin: 0; }
.edit { width: 100%; }
.edit summary { list-style: none; display: inline-block; }
.edit summary::-webkit-details-marker { display: none; }
.edit[open] summary { margin-bottom: 6px; }
.edit textarea { width: 100%; margin-bottom: 6px; }
.empty { padding: 28px; text-align: center; }
.empty p { margin: 4px 0; }

/* Network icons */
.net { width: 16px; height: 16px; flex: 0 0 16px; }
.net-x { fill: #111; }
.net-fb { fill: #1877f2; }
.kpi .net { width: 12px; height: 12px; flex-basis: 12px; }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-sim { background: var(--sim-soft); color: var(--sim); }
.badge-wait { background: var(--warn-soft); color: var(--warn); }
.badge-err { background: var(--err-soft); color: var(--err); }
.badge-muted { background: #eef1f6; color: var(--muted); }
.badge-hot { background: #ffe9e6; color: #c4320a; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-ok { background: #17b26a; }
.dot-err { background: var(--err); }

/* Buttons & forms */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; color: #344054; font: 500 13px/1.2 inherit; font-family: inherit; cursor: pointer; }
.btn:hover { background: #f5f7fa; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #2559c9; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #eef1f6; color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #d0d5dd; border-radius: 8px; background: #fff; color: var(--text); font: inherit;
}
select { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid #b9cffb; border-color: var(--accent); }
label { display: block; font-weight: 500; font-size: 13px; color: #344054; }
label input, label select { margin-top: 6px; }

/* Settings */
.section { padding: 20px; margin-bottom: 16px; scroll-margin-top: 76px; }
.section h2 { font-size: 16px; margin-bottom: 4px; }
.section > p { margin: 0 0 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.acc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.switch { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.switch input { margin: 0; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-form .full { grid-column: 1 / -1; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 12px; }
.tbl td:first-child { white-space: nowrap; }
.tbl .net { vertical-align: -3px; margin-right: 4px; }

/* Flash */
.flash { margin: 14px 24px 0; padding: 10px 14px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-weight: 500; }
.flash-error { background: var(--err-soft); color: var(--err); }

/* Login */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 380px; padding: 32px 28px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 30px rgba(16, 24, 40, .06); text-align: center; }
.login-card h1 { font-size: 20px; margin-top: 12px; }
.login-card h1 b { color: var(--brand); }
.login-card p { margin: 4px 0 18px; }
.login-card label { text-align: left; margin-bottom: 14px; }
.login-card .flash { margin: 0 0 14px; }

/* Responsive */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; }
  .main { padding: 16px; }
  .topbar { gap: 10px; padding: 0 16px; }
  .uname, .brand span { display: none; }
  .pills { justify-content: flex-start; overflow-x: auto; }
  .flash { margin: 12px 16px 0; }
}
@media (max-width: 600px) {
  .art { flex-direction: column; }
  .thumb { flex-basis: auto; height: 160px; }
  .kpis { flex-wrap: wrap; gap: 10px 0; }
  .kpi { min-width: 0; padding: 0 12px; }
  .kpi:first-child { border-left: 0; padding-left: 0; }
  .grid-form { grid-template-columns: 1fr; }
}
