@font-face { font-family: "Montserrat"; src: url("Montserrat-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("Montserrat-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("Montserrat-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #14141a;
  --surface: #1b1b23;
  --surface-2: #23232d;
  --surface-3: #2c2c38;
  --line: rgba(255, 255, 255, .10);
  --line-strong: rgba(255, 255, 255, .18);
  --grid: rgba(255, 255, 255, .07);
  --text: #eef0f4;
  --muted: #b1b7c3;
  --faint: #7f8696;
  --accent: #ff66ff;
  --accent-soft: rgba(255, 102, 255, .14);
  --series-1: #3987e5;
  --series-2: #d95926;
  --good: #3ddc84;
  --bad: #ff4b6e;
  --warn: #ffb62b;
  --info: #5ab8ff;
  --radius: 14px;
  --gap: 16px;
  --side: 232px;
  --font: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; }
body { min-height: 100vh; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: .01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; color: var(--muted); font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.app { min-height: 100vh; }
.shell { display: flex; min-height: 100vh; }
.side { display: none; }
.main { flex: 1; min-width: 0; padding: 0 16px 96px; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; margin: 0 -16px 8px;
  background: rgba(20, 20, 26, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand img { width: 28px; height: 28px; border-radius: 8px; }
.brand small { display: block; color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

.bell { position: relative; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; width: 40px; height: 40px; cursor: pointer; display: grid; place-items: center; }
.bell svg { width: 20px; height: 20px; fill: none; stroke: var(--text); stroke-width: 1.8; }
.bell .count { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: #1a0f1a; font-size: 11px; font-weight: 700; display: grid; place-items: center; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: rgba(27, 27, 35, .97); border-top: 1px solid var(--line); }
.tabs a, .tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; font-size: 11px; font-weight: 600; color: var(--muted);
  border: 0; background: none; cursor: pointer; text-decoration: none; border-radius: 10px; }
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs .on { color: var(--accent); }
.more { position: fixed; left: 8px; right: 8px; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 31; background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.more a { display: flex; align-items: center; gap: 12px; padding: 12px; color: var(--text); border-radius: 10px; font-weight: 600; }
.more a:hover { background: var(--surface-3); text-decoration: none; }
.more svg { width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

@media (min-width: 900px) {
  .side { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; width: var(--side); flex: 0 0 var(--side); padding: 18px 12px; border-right: 1px solid var(--line); background: var(--surface); }
  .side .brand { padding: 4px 10px 18px; }
  .side a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; text-decoration: none; }
  .side a:hover { background: var(--surface-2); color: var(--text); }
  .side a.on { background: var(--accent-soft); color: var(--text); }
  .side svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .side .grow { flex: 1; }
  .side .who { color: var(--faint); font-size: 12px; padding: 8px 12px; }
  .tabs, .more { display: none !important; }
  .main { padding: 0 28px 48px; }
  .top { margin: 0 -28px 12px; padding: 14px 28px; }
  .top .brand { display: none; }
}

.page { display: flex; flex-direction: column; gap: var(--gap); max-width: 1280px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 13px; }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card > header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card > header h2 { flex: 1; min-width: 0; }
.grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 700px) { .grid.two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .grid.three { grid-template-columns: 1fr 1fr 1fr; } }

.tiles { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.tile .label { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.tile .value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .sub { color: var(--faint); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.meter.warn > i { background: var(--warn); }
.meter.bad > i { background: var(--bad); }

.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid; font-size: 14px; }
.banner.warn { background: rgba(255, 182, 43, .08); border-color: rgba(255, 182, 43, .35); }
.banner.bad { background: rgba(255, 75, 110, .08); border-color: rgba(255, 75, 110, .35); }
.banner.info { background: rgba(90, 184, 255, .08); border-color: rgba(90, 184, 255, .3); }
.banner .mark { font-weight: 700; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0f1a; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { border-color: rgba(255, 75, 110, .5); color: #ffb3c2; }
.btn.small { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { min-height: 32px; padding: 4px 12px; border-radius: 16px; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; cursor: pointer; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field > label > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.secret-field { display: flex; gap: 6px; align-items: stretch; min-width: 0; }
.secret-field input { flex: 1 1 auto; min-width: 0; }
.secret-field .btn { flex: 0 0 auto; }
.field small { color: var(--faint); font-size: 12px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); }
textarea { min-height: 280px; resize: vertical; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }
.form { display: grid; gap: 12px; grid-template-columns: 1fr; }
.form.cols4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .form.cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form.cols4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding: 4px 0; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: 0 0 auto; }

.switch { position: relative; width: 46px; height: 26px; flex: 0 0 46px; border-radius: 13px; border: 1px solid var(--line-strong); background: var(--surface-3); cursor: pointer; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: left .15s; }
.switch[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.switch[aria-checked="true"]::after { left: 23px; background: #1a0f1a; }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--text); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
td.right, th.right { text-align: right; }

.list { display: flex; flex-direction: column; }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.item:last-child { border-bottom: 0; }
.item.click { cursor: pointer; border-radius: 8px; }
.item.click:hover { background: var(--surface-2); }
.item .body { flex: 1; min-width: 0; }
.item .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .name.wrap { white-space: normal; overflow-wrap: anywhere; }
.item .name.seen { color: var(--muted); font-weight: 500; }
.item .meta { color: var(--faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .figure { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; background: var(--faint); }
.dot.good { background: var(--good); }
.dot.bad { background: var(--bad); }
.dot.warn { background: var(--warn); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 700; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.badge.accent { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.badge.good { border-color: rgba(61, 220, 132, .5); color: #a8f0c6; }
.badge.bad { border-color: rgba(255, 75, 110, .5); color: #ffb3c2; }
.badge.warn { border-color: rgba(255, 182, 43, .5); color: #ffd98f; }
.empty { color: var(--faint); padding: 18px 4px; text-align: center; font-size: 14px; }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .cross { stroke: var(--line-strong); stroke-width: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; cursor: default; }
.hbar.click { cursor: pointer; }
.hbar .label { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .val { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hbar .track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.hbar .track i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--accent); min-width: 2px; }
.hbar.click:hover .label { color: var(--accent); }
.view-toggle { margin-left: auto; }

.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 10px; font-size: 12.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45); max-width: 260px; }
.tip b { display: block; margin-bottom: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.tip .line { display: flex; gap: 8px; align-items: center; justify-content: space-between; white-space: nowrap; }
.tip .line i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 480px; }
.toast > div { background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 14px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.toast > div.bad { border-color: rgba(255, 75, 110, .6); }
.toast > div.good { border-color: rgba(61, 220, 132, .6); }
@media (min-width: 900px) { .toast { bottom: 24px; } }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login .card { width: 100%; max-width: 400px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.login .brand { justify-content: center; font-size: 18px; }
.login .brand img { width: 40px; height: 40px; }
.code-input { letter-spacing: .4em; text-align: center; font-size: 24px !important; font-variant-numeric: tabular-nums; }
.qr { background: #fff; border-radius: 12px; padding: 8px; width: 220px; height: 220px; margin: 0 auto; display: block; }
.secret { text-align: center; font-family: ui-monospace, Consolas, monospace; letter-spacing: .08em; word-break: break-all; color: var(--muted); font-size: 13px; }
.error-text { color: #ffb3c2; font-size: 14px; min-height: 1.2em; }

.period { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.period .dates { display: flex; gap: 6px; align-items: center; }
.period .dates input { width: 150px; min-height: 34px; padding: 4px 8px; }
pre.trace { white-space: pre-wrap; word-break: break-word; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px; max-height: 260px; overflow: auto; font-size: 12px; margin: 0; }
details summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; padding: 6px 0; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 24px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .switch::after { transition: none; } }
@media (forced-colors: active) { .hbar .track i, .meter > i { forced-color-adjust: none; background: Highlight; } }
