:root {
  --bg: #0b0e14;
  --panel: #12161f;
  --panel2: #171c27;
  --line: #222838;
  --text: #e8ebf2;
  --muted: #8b93a7;
  --dim: #5d6579;
  --green: #22c55e;
  --green-dim: #14532d;
  --red: #f05252;
  --blue: #3b82f6;
  --orange: #f59e0b;
  --purple: #a855f7;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--muted); }

/* layout */
.shell { display: flex; min-height: 100vh; }
.side { width: 220px; flex: none; border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: none; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; letter-spacing: .2px; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; text-decoration: none; color: var(--muted); font-size: 14px; }
.nav a.on { background: var(--panel2); color: var(--text); }
.nav a .ic { width: 18px; height: 18px; }
.nav .badge { margin-left: auto; }
.main { flex: 1; min-width: 0; padding: calc(12px + var(--safe-t)) 14px calc(84px + var(--safe-b)); max-width: 1180px; }
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.top h1 { font-size: 20px; margin: 0; font-weight: 700; flex: 1; }
.iconbtn { position: relative; width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; text-decoration: none; }
.iconbtn .ic { width: 19px; height: 19px; }
.dotcount { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: rgba(11, 14, 20, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); z-index: 20; }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--dim); text-decoration: none; padding: 4px 0; }
.tabbar a.on { color: var(--text); }
.tabbar .ic { width: 22px; height: 22px; }
@media (min-width: 900px) {
  .side { display: flex; }
  .tabbar { display: none; }
  .main { padding: 22px 28px 40px; }
  .top .mobile-only { display: none; }
}
.ic { stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* pills */
.pills { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 0 14px; padding-bottom: 2px; }
.pills::-webkit-scrollbar { display: none; }
.pill { flex: none; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 13px; cursor: pointer; white-space: nowrap; }
.pill.on { background: var(--text); color: #0b0e14; border-color: var(--text); font-weight: 600; }
.pill .n { opacity: .6; margin-left: 4px; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card + .card, .card + .grid, .grid + .card, .note + .card, .card + .note { margin-top: 12px; }
.card h2 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.card h2 .r { margin-left: auto; font-weight: 500; color: var(--dim); font-size: 12px; }
.grid { display: grid; gap: 10px; }
.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 13px; min-width: 0; }
.kpi .l { font-size: 12px; color: var(--muted); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v { font-size: 21px; font-weight: 700; letter-spacing: -.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 11.5px; color: var(--dim); margin-top: 4px; line-height: 1.3; }
.kpi.good .v { color: var(--green); }
.kpi.bad .v { color: var(--red); }
.neg { color: var(--text); }
.green { color: var(--green); }
.red { color: var(--red); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12.5px; }

/* live */
.livehead { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.livehead b { font-size: 15px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: pulse 1.8s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); } 70% { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.step { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; min-width: 0; }
.step .l { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.step .l i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.step .v { font-size: 22px; font-weight: 700; margin-top: 4px; }
.map { width: 100%; height: auto; display: block; margin-top: 4px; }
.map path { fill: #1b2130; stroke: #0b0e14; stroke-width: .5; }
.map path.today { fill: var(--green-dim); }
.map path.live { fill: var(--green); }
.map circle.ping { fill: var(--green); opacity: .35; animation: ring 1.8s infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ring { 0% { transform: scale(.4); opacity: .55; } 100% { transform: scale(2.2); opacity: 0; } }
.flags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 13px; color: var(--muted); }
.flags span { background: var(--panel2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; }

/* lists */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); min-width: 0; }
.li:first-child { border-top: 0; }
.li .grow { flex: 1; min-width: 0; }
.li .t1 { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li .t2 { font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.li .amt { text-align: right; font-weight: 600; white-space: nowrap; }
.li .amt small { display: block; font-weight: 400; color: var(--dim); font-size: 11.5px; margin-top: 2px; }
.flag { font-size: 18px; width: 24px; text-align: center; flex: none; }
.chip { display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); vertical-align: 1px; }
.chip.ok { color: var(--green); border-color: rgba(34, 197, 94, .35); background: rgba(34, 197, 94, .08); }
.chip.warn { color: var(--orange); border-color: rgba(245, 158, 11, .35); background: rgba(245, 158, 11, .08); }
.chip.bad { color: var(--red); border-color: rgba(240, 82, 82, .35); background: rgba(240, 82, 82, .08); }
.chip.fb { color: #60a5fa; border-color: rgba(96, 165, 250, .35); }
.chip.ig { color: #f472b6; border-color: rgba(244, 114, 182, .35); }
.empty { color: var(--muted); text-align: center; padding: 22px 10px; font-size: 14px; }
.empty b { color: var(--text); display: block; margin-bottom: 4px; }

/* table */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: right; font-size: 11.5px; color: var(--dim); font-weight: 600; padding: 6px 6px 8px; white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td { padding: 10px 6px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
.tbl td.name { white-space: normal; max-width: 260px; }
.tbl td.name .s { font-size: 11.5px; color: var(--dim); }
.tbl tr.crow { cursor: pointer; }
.tbl tr.detail td { background: var(--panel2); white-space: normal; text-align: left; font-size: 13px; color: var(--muted); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--dim); }
.dot.on { background: var(--green); }
.hide-sm { display: none; }
@media (min-width: 700px) { .hide-sm { display: table-cell; } }

/* chart */
.chart { width: 100%; height: 140px; display: block; }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.field label { font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=password], input[type=search], input[type=email] { width: 100%; padding: 12px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); outline: none; font-size: 16px; }
input:focus { border-color: #3a4358; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; font-weight: 600; font-size: 14px; text-decoration: none; }
.btn.primary { background: var(--green); border-color: var(--green); color: #05230f; }
.btn.danger { color: var(--red); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg { font-size: 13px; margin-top: 8px; }
.msg.err { color: var(--red); }
.msg.ok { color: var(--green); }
.note { background: rgba(59, 130, 246, .08); border: 1px solid rgba(59, 130, 246, .3); border-radius: 12px; padding: 10px 12px; font-size: 13px; color: #c7d7f5; }
.note a { color: #93c5fd; }
.note.warn { background: rgba(245, 158, 11, .08); border-color: rgba(245, 158, 11, .3); color: #f5deb0; }
details.steps-help { margin-top: 10px; font-size: 13.5px; color: var(--muted); }
details.steps-help summary { cursor: pointer; color: var(--text); font-weight: 600; }
details.steps-help ol { padding-left: 20px; margin: 8px 0 0; }
details.steps-help li { margin: 5px 0; }
.status { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.status .dot { margin: 0; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .box { width: 100%; max-width: 360px; }
.auth .logo { width: 56px; height: 56px; border-radius: 16px; display: block; margin: 0 auto 14px; }
.auth h1 { text-align: center; font-size: 21px; margin: 0 0 4px; }
.auth p { text-align: center; color: var(--muted); margin: 0 0 18px; font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%); background: var(--text); color: #0b0e14; padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; z-index: 50; box-shadow: 0 8px 30px rgba(0, 0, 0, .4); max-width: 90vw; }
.foot { color: var(--dim); font-size: 11.5px; text-align: center; margin: 22px 0 6px; }
.foot a { color: var(--dim); }

/* extras */
[hidden] { display: none !important; }
.nav .dotcount { position: static; margin-left: auto; }
.nav a span:first-of-type { flex: none; }
.card h2 a.r { color: var(--muted); text-decoration: none; }
.card h2 .ic { width: 16px; height: 16px; }
.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); margin-top: 4px; }
.fun { margin: 4px 0 12px; }
.fun:last-child { margin-bottom: 2px; }
.fun-l { display: flex; gap: 8px; align-items: baseline; font-size: 13.5px; margin-bottom: 5px; }
.fun-l span { flex: 1; color: var(--muted); }
.fun-l em { font-style: normal; font-size: 12px; color: var(--dim); }
.bar { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.tblcard { padding: 4px 10px; overflow-x: auto; }
.tbl tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
.lg { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin: 0 4px 0 10px; vertical-align: -1px; }
.lg.live { background: var(--green); }
.lg.today { background: var(--green-dim); }
a.li.link { text-decoration: none; color: inherit; }
.li .t2.wrap { white-space: normal; }
.amt .chip { margin-left: 4px; }
.dot.bad { background: var(--red); }
.dot.warn { background: var(--orange); }
ol.plain { padding-left: 20px; margin: 10px 0 0; }
ol.plain li { margin: 4px 0; }
.steps-help form { margin-top: 10px; }
.msg:empty { display: none; }
.empty a { color: #93c5fd; }
@media (max-width: 480px) {
  .step { padding: 8px 8px 9px; border-top: 3px solid var(--c, var(--line)); }
  .step .l { font-size: 11px; }
  .step .l i { display: none; }
  .step .v { font-size: 20px; }
}
