:root, [data-theme=dark] {
  --bg: #070b14; --panel: #0e1526; --panel2: #121b31; --input: #0a1020; --line: #1f2a44; --text: #e6ecf7;
  --muted: #8a97b3; --code: #b9cdf7; --side1: #0b1222; --side2: #070b14; --on: #fff;
  --gold: #f5c451; --blue: #4f8cff; --green: #22c58b; --red: #ff5d6c; --orange: #ffa94d; --radius: 14px;
}
[data-theme=light] {
  --bg: #f3f5fa; --panel: #ffffff; --panel2: #eef2fa; --input: #f7f9fd; --line: #dde3ef; --text: #172036;
  --muted: #5d6a85; --code: #2a4b8d; --side1: #ffffff; --side2: #f3f5fa; --on: #10204a;
  --blue: #2f6fe8; --green: #12a36f; --red: #e2394b; --orange: #d9822b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Bengali", sans-serif; background: var(--bg);
       color: var(--text); line-height: 1.55; font-size: 14px; }
a { color: var(--blue); text-decoration: none; }
code { font-family: Consolas, "Cascadia Mono", monospace; background: var(--input); padding: 1px 6px; border-radius: 6px;
       color: var(--code); font-size: 12.5px; }
.layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: linear-gradient(180deg, var(--side1), var(--side2)); border-right: 1px solid var(--line); padding: 22px 14px;
        position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 20px; }
.brand .logo { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 900;
               background: linear-gradient(135deg, var(--gold), #ff8a3d); color: #1a1205; font-size: 15px; }
.brand b { display: block; font-size: 14px; letter-spacing: .4px; }
.brand span { font-size: 11px; color: var(--muted); }
.nav a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; color: var(--muted);
         font-weight: 600; margin-bottom: 2px; }
.nav a:hover { background: var(--panel2); color: var(--text); }
.nav a.on { background: rgba(79,140,255,.14); color: var(--on); box-shadow: inset 3px 0 0 var(--blue); }
.prefs { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.who { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 12px; color: var(--muted); }
.who b { color: var(--text); }
main { padding: 26px 30px 60px; max-width: 1200px; }
h1 { font-size: 22px; margin-bottom: 4px; }
.sub { color: var(--muted); margin-bottom: 20px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .v { font-size: 26px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 12px; font-weight: 600; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.card h2 { font-size: 15px; margin-bottom: 12px; display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.cols { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.scroll { overflow-x: auto; }
input[type=text], input[type=number], input[type=date], input[type=password], textarea, select { width: 100%; background: var(--input);
  border: 1px solid var(--line); color: var(--text); padding: 10px 12px; border-radius: 10px; font: inherit; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); }
textarea { min-height: 150px; resize: vertical; }
label { font-size: 12px; color: var(--muted); font-weight: 600; display: block; margin: 10px 0 5px; }
.btn { display: inline-flex; gap: 6px; align-items: center; border: 0; border-radius: 10px; padding: 9px 16px; font: inherit;
       font-weight: 700; cursor: pointer; background: var(--blue); color: #fff; }
.btn.green { background: var(--green); color: #04150e; } .btn.red { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
form.inline { display: inline; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.b-ok { background: rgba(34,197,139,.15); color: var(--green); } .b-bad { background: rgba(255,93,108,.15); color: var(--red); }
.b-warn { background: rgba(255,169,77,.15); color: var(--orange); } .b-off { background: rgba(138,151,179,.15); color: var(--muted); }
.b-info { background: rgba(79,140,255,.15); color: var(--blue); }
.alert { padding: 11px 14px; border-radius: 10px; margin-bottom: 16px; font-weight: 600; }
.alert.ok { background: rgba(34,197,139,.12); color: var(--green); border: 1px solid rgba(34,197,139,.3); }
.alert.err { background: rgba(255,93,108,.12); color: var(--red); border: 1px solid rgba(255,93,108,.3); }
.muted { color: var(--muted); font-size: 12px; }
.checks label { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 13px; margin: 6px 0; }
.pager { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.preview { background: var(--input); border: 1px solid var(--line); border-radius: 10px; padding: 14px; white-space: pre-wrap; }
pre.code { background: var(--input); border: 1px solid var(--line); border-radius: 10px; padding: 16px; overflow: auto;
           max-height: 75vh; font: 12.5px/1.6 Consolas, "Cascadia Mono", "Noto Sans Bengali", monospace; color: var(--code);
           white-space: pre; }
details summary { list-style: none; display: inline-flex; margin-right: 6px; }
details summary::-webkit-details-marker { display: none; }
details[open] { display: block; min-width: 260px; margin-bottom: 6px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 20px 0 6px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.addch { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); align-items: end; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); display: inline-block;
            box-shadow: 0 0 0 0 rgba(34,197,139,.6); animation: pulse 2s infinite; margin-right: auto; }
body.offline .live-dot { background: var(--red); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34,197,139,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,139,0); } }
.stat .v.bump { animation: bump .9s ease; }
@keyframes bump { 0% { color: var(--gold); transform: scale(1.12); } 100% { transform: none; } }
.feed { list-style: none; max-height: 360px; overflow-y: auto; }
.feed li { padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.feed li .ico { margin-right: 6px; }
.feed li.fresh { animation: fresh 3s ease; }
@keyframes fresh { 0% { background: rgba(245,196,81,.18); } 100% { background: transparent; } }
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--blue); padding: 10px 14px;
         border-radius: 10px; max-width: 360px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.35);
         transition: opacity .6s, transform .6s; }
.toast.ev-join, .toast.ev-rejoin { border-left-color: var(--green); } .toast.ev-leave { border-left-color: var(--red); }
.toast.out { opacity: 0; transform: translateY(8px); }
.login { max-width: 420px; margin: 10vh auto; }
.login .card { padding: 30px; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } .side { position: static; height: auto; } main { padding: 18px; } }
