:root {
  --bg: #070b14;
  --panel: #0f1626;
  --panel-2: #141d31;
  --line: #1f2b45;
  --text: #e7eefb;
  --muted: #8ea0bf;
  --brand: #3b82f6;
  --brand-2: #60a5fa;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 12% -8%, rgba(59, 130, 246, .16), transparent 60%),
    radial-gradient(900px 500px at 92% 0%, rgba(139, 92, 246, .12), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Bengali", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- layout ---------------- */

.topbar {
  display: flex; align-items: center; gap: 22px;
  padding: 14px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 15, 26, .72);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand em { display: block; font-size: 11px; font-style: normal; color: var(--muted); font-weight: 500; letter-spacing: .12em; text-transform: uppercase; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), #8b5cf6);
  border-radius: 10px; font-size: 13px; font-weight: 800; letter-spacing: .5px;
}

.nav { display: flex; gap: 4px; margin-right: auto; flex-wrap: wrap; }
.nav a {
  padding: 8px 14px; border-radius: 9px; color: var(--muted); font-weight: 500; font-size: 14px;
}
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--panel-2); color: #fff; box-shadow: inset 0 0 0 1px var(--line); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.inline { display: inline; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 26px; }
.wrap-narrow { max-width: 780px; margin: 0 auto; padding: 26px; }

.footer {
  max-width: 1180px; margin: 40px auto 0; padding: 20px 26px 40px;
  color: var(--muted); font-size: 13px; border-top: 1px solid var(--line);
}
.footer .dot { margin: 0 8px; opacity: .5; }

/* ---------------- typography ---------------- */

h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0 0 14px; letter-spacing: -.01em; }
h3 { font-size: 14px; margin: 0 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.sub { color: var(--muted); margin: 0 0 22px; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; display: block; }

/* ---------------- panels & grid ---------------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 18px; }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-sidebar { grid-template-columns: 1.7fr 1fr; align-items: start; }

@media (max-width: 900px) {
  .grid-4, .grid-3, .grid-2, .grid-sidebar { grid-template-columns: 1fr; }
  .truncate { max-width: 200px; }
}

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.stat .value { font-size: 30px; font-weight: 700; letter-spacing: -.03em; margin-top: 6px; }
.stat .delta { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------------- forms ---------------- */

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #cddcf3; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.5; }

input[type=text], input[type=url], input[type=password], input[type=search],
input[type=datetime-local], input[type=number], select, textarea {
  width: 100%;
  padding: 11px 13px;
  background: #0a1020;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}
textarea { resize: vertical; min-height: 84px; }
.field { margin-bottom: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .field-row { grid-template-columns: 1fr; } }

.check { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--brand); }
.check label { margin: 0; font-weight: 500; }

.input-group { display: flex; }
.input-group .prefix {
  display: flex; align-items: center; padding: 0 12px;
  background: var(--panel-2); border: 1px solid var(--line); border-right: 0;
  border-radius: 10px 0 0 10px; color: var(--muted); font-size: 13px; white-space: nowrap;
}
.input-group input { border-radius: 0 10px 10px 0; }

/* ---------------- buttons ---------------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: transform .08s, filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(140deg, var(--brand), #6366f1); border-color: transparent; color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: rgba(239, 68, 68, .45); color: #fca5a5; }
.btn-danger:hover { background: rgba(239, 68, 68, .12); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------------- tables ---------------- */

.table-wrap { overflow-x: auto; margin: 0 -20px -20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
tbody tr:hover { background: rgba(59, 130, 246, .05); }
tbody tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- misc ---------------- */

.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.badge-ok { background: rgba(34, 197, 94, .15); color: #86efac; }
.badge-off { background: rgba(148, 163, 184, .15); color: #cbd5e1; }
.badge-warn { background: rgba(245, 158, 11, .15); color: #fcd34d; }
.badge-info { background: rgba(59, 130, 246, .15); color: #93c5fd; }

.flash {
  max-width: 1180px; margin: 18px auto -6px; padding: 12px 18px;
  border-radius: 10px; font-size: 14px; font-weight: 500;
}
.flash-ok { background: rgba(34, 197, 94, .12); color: #a7f3c4; border: 1px solid rgba(34, 197, 94, .3); }
.flash-warn { background: rgba(245, 158, 11, .12); color: #fde68a; border: 1px solid rgba(245, 158, 11, .3); }
.flash-err { background: rgba(239, 68, 68, .12); color: #fecaca; border: 1px solid rgba(239, 68, 68, .3); }

.copy-row { display: flex; align-items: center; gap: 8px; }
.copy-btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  border-radius: 7px; padding: 3px 8px; font-size: 11px; cursor: pointer; font-weight: 600;
}
.copy-btn:hover { color: var(--text); }
.copy-btn.done { color: #86efac; border-color: rgba(34, 197, 94, .4); }

/* bar chart built from divs - no chart library, no external requests */
.chart { display: flex; align-items: flex-end; gap: 3px; height: 150px; padding-top: 10px; }
.chart .bar { flex: 1; background: linear-gradient(180deg, var(--brand-2), rgba(59, 130, 246, .25)); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.chart .bar:hover { background: linear-gradient(180deg, #93c5fd, rgba(59, 130, 246, .4)); }
.chart .bar span {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: #000; color: #fff; font-size: 11px; padding: 3px 7px; border-radius: 6px;
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; margin-bottom: 6px;
}
.chart .bar:hover span { opacity: 1; }
.chart-empty { color: var(--muted); text-align: center; padding: 46px 0; font-size: 14px; }

.bars { display: grid; gap: 9px; }
.bars .row { display: grid; grid-template-columns: 110px 1fr 48px; align-items: center; gap: 10px; font-size: 13px; }
.bars .track { background: var(--panel-2); border-radius: 999px; height: 8px; overflow: hidden; }
.bars .fill { height: 100%; background: linear-gradient(90deg, var(--brand), #8b5cf6); border-radius: 999px; }

.fb-card {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #0a1020; max-width: 500px;
}
.fb-card .img { aspect-ratio: 1200/630; background: #0d1526 center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.fb-card .body { padding: 12px 14px; border-top: 1px solid var(--line); background: #101828; }
.fb-card .host { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; }
.fb-card .t { font-weight: 700; font-size: 15px; margin: 3px 0; line-height: 1.35; }
.fb-card .d { font-size: 13px; color: var(--muted); line-height: 1.4; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; font-weight: 600;
}
.pagination .current { background: var(--brand); color: #fff; border-color: transparent; }

.filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.filters input[type=search] { max-width: 300px; }
.filters select { max-width: 190px; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty h2 { color: var(--text); }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-all; }

.qr-box { text-align: center; }
.qr-box img { width: 190px; height: 190px; background: #fff; border-radius: 10px; padding: 8px; }

/* ---------------- auth / public pages ---------------- */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth .panel { width: 100%; max-width: 400px; }
.auth .brand { justify-content: center; margin-bottom: 22px; }

.hero { text-align: center; padding: 90px 24px 60px; max-width: 720px; margin: 0 auto; }
.hero h1 { font-size: 46px; line-height: 1.1; letter-spacing: -.03em; margin-bottom: 16px; }
.hero p { color: var(--muted); font-size: 18px; }
.hero .actions { justify-content: center; margin-top: 28px; }
@media (max-width: 640px) { .hero h1 { font-size: 32px; } }
