.appbody { background: var(--bg); }
.login { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(180deg, var(--navy), var(--navy2)); padding: 20px; }
.lbox { background: #fff; border-radius: 20px; padding: 34px; width: 100%; max-width: 400px; box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.lbox h2 { margin-top: 18px; font-size: 1.4rem; }
.lbox p { color: var(--ink2); }
.logo.dark { color: var(--ink); }
.wide { width: 100%; justify-content: center; }
.or { text-align: center; color: var(--mute); margin: 18px 0 10px; font-size: .85rem; }
.lbox input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); font: inherit; margin-bottom: 10px; }
.err { color: var(--bad); min-height: 1.2em; font-size: .9rem; margin: 8px 0 0; }

.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #c9d6e6; padding: 18px 14px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side select { width: 100%; padding: 9px 10px; border-radius: 10px; border: 1px solid #22405f; background: #12243a; color: #fff; font: inherit; }
.wsbadges { display: flex; gap: 6px; flex-wrap: wrap; }
.wsbadges span { font-size: .72rem; padding: 2px 8px; border-radius: 999px; background: #1b334d; color: #9fe7dc; font-weight: 600; }
.wsbadges span.h { background: #4c1d95; color: #ddd6fe; }
.side nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.side nav a { padding: 9px 12px; border-radius: 9px; cursor: pointer; color: #c9d6e6; text-decoration: none; font-size: .95rem; }
.side nav a:hover { background: #12243a; }
.side nav a.on { background: #134e4a; color: #fff; font-weight: 600; }
.navh { margin: 14px 12px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #6f86a0; }
.me { margin-top: auto; font-size: .85rem; display: flex; justify-content: space-between; gap: 8px; align-items: center; border-top: 1px solid #1c3249; padding-top: 12px; }
.linkbtn { background: none; border: 0; color: #5eead4; cursor: pointer; font: inherit; }
.main { padding: 22px 28px 60px; min-width: 0; }
.bar { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.bar h1 { font-size: 1.5rem; margin: 0; flex: 1; }
.ctrls { display: flex; gap: 8px; }
.ctrls select { padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit; }
.menu { display: none; background: none; border: 0; font-size: 1.4rem; cursor: pointer; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu { display: block; }
  .main { padding: 16px 14px 60px; }
}
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi .l { font-size: .8rem; color: var(--mute); }
.kpi .v { font-size: 1.5rem; font-weight: 750; letter-spacing: -0.02em; }
.kpi .s { font-size: .78rem; color: var(--mute); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; overflow-x: auto; }
.panel h3 { margin: 0 0 12px; font-size: 1rem; }
.panel .hint { color: var(--mute); font-size: .85rem; margin: -6px 0 12px; }
.two { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
@media (max-width: 1100px) { .two { grid-template-columns: 1fr; } }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th { text-align: left; font-size: .75rem; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 9px 10px; border-bottom: 1px solid #f0f3f7; vertical-align: top; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #f6fbfa; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; word-break: break-all; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: .75rem; font-weight: 600; background: #eef2f7; color: var(--ink2); margin: 1px 3px 1px 0; white-space: nowrap; }
.tag.g { background: #dcfce7; color: #166534; }
.tag.r { background: #fee2e2; color: #991b1b; }
.tag.y { background: #fef3c7; color: #92400e; }
.tag.b { background: #ccfbf1; color: #115e59; }
.up { color: var(--good); } .down { color: var(--bad); }
.hbar { height: 10px; border-radius: 5px; background: var(--brand2); min-width: 2px; }
.hbar.ghost { background: #cbd5e1; height: 4px; margin-top: 3px; }
svg.chart { width: 100%; height: 220px; display: block; }
.legend { display: flex; gap: 16px; font-size: .8rem; color: var(--mute); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form input, .form select { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); font: inherit; min-width: 240px; }
pre.code { background: var(--navy); color: #d7f5ef; border-radius: 12px; padding: 14px; overflow-x: auto; font-size: .82rem; white-space: pre-wrap; word-break: break-all; }
.timeline { border-left: 2px solid var(--line); margin-left: 8px; padding-left: 18px; }
.timeline .ev { position: relative; padding: 6px 0 12px; }
.timeline .ev::before { content: ""; position: absolute; left: -25px; top: 11px; width: 12px; height: 12px; border-radius: 50%; background: #cbd5e1; border: 2px solid #fff; }
.timeline .ev.touch::before { background: var(--brand2); }
.timeline .ev.conv::before { background: #f59e0b; }
.timeline .when { font-size: .78rem; color: var(--mute); }
.modal { position: fixed; inset: 0; background: rgba(11,23,38,.5); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal .box { background: #fff; border-radius: 16px; width: 100%; max-width: 720px; max-height: 88vh; overflow-y: auto; padding: 22px; }
.modal .close { float: right; background: none; border: 0; font-size: 1.4rem; cursor: pointer; }
.ok { color: var(--good); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.toggle { display: flex; align-items: center; gap: 8px; }
.empty { color: var(--mute); padding: 20px; text-align: center; }
