/* VPS Console — Headlamp jaisa: dark sidebar, cards, status pills. Phone pehle (375px). */
:root {
  --bg: #0b111b;
  --panel: #121a27;
  --panel-2: #172133;
  --line: #233049;
  --text: #e6edf7;
  --muted: #8a9bb5;
  --dim: #5d6e88;
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, .14);
  --ok: #2ecc8f;
  --ok-soft: rgba(46, 204, 143, .14);
  --warn: #f5b041;
  --warn-soft: rgba(245, 176, 65, .14);
  --bad: #ff5d6c;
  --bad-soft: rgba(255, 93, 108, .14);
  --side: #0f1724;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f5f9; --panel: #ffffff; --panel-2: #f6f8fc; --line: #e1e6ef;
    --text: #172033; --muted: #5b6b84; --dim: #8b98ad;
    --accent-soft: rgba(79, 140, 255, .12); color-scheme: light;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); text-decoration: none; }
button { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.loading, .empty { padding: 40px 16px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- shell */
.side { display: none; }
.shell { min-height: 100vh; padding-bottom: calc(68px + var(--safe-b)); }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  height: 54px; padding: 0 12px 0 16px; background: var(--side); color: #e6edf7;
  border-bottom: 1px solid #1c2638;
}
.topbar h1 { flex: 1; margin: 0; font-size: 17px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  position: relative; display: grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: 10px; background: transparent; color: #e6edf7; font-size: 18px; cursor: pointer;
}
.icon-btn.back { font-size: 30px; line-height: 1; margin-left: -10px; width: 34px; }
.bell i {
  position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--bad); color: #fff; font: 700 11px/18px system-ui; font-style: normal;
}
.live { font-size: 10px; color: var(--ok); transition: color .3s; }
.live.stale { color: var(--warn); }
.live.dead { color: var(--bad); }

main { padding: 14px 12px 20px; max-width: 1280px; margin: 0 auto; }

.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex;
  padding-bottom: var(--safe-b); background: var(--side); border-top: 1px solid #1c2638;
}
.bottom a, .bottom button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 1px 9px; border: 0; background: none; color: #8a9bb5; font-size: 10.5px; cursor: pointer; min-width: 0; white-space: nowrap;
  position: relative;
}
.bottom .ico { font-size: 19px; line-height: 1.1; }
.bottom .on { color: #fff; }
.bottom .on .ico { filter: drop-shadow(0 0 6px rgba(79, 140, 255, .7)); }
.bottom i {
  position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--bad); color: #fff; font: 700 10px/16px system-ui; font-style: normal;
}

@media (min-width: 900px) {
  .side {
    display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: 232px; z-index: 40;
    background: var(--side); color: #c8d3e6; border-right: 1px solid #1c2638;
  }
  .side-brand { display: flex; gap: 10px; align-items: center; padding: 16px; }
  .side-brand img { width: 34px; height: 34px; }
  .side-brand b { display: block; color: #fff; }
  .side-brand small { color: #6f82a1; font-size: 12px; }
  .side nav { flex: 1; overflow: auto; padding: 4px 10px; }
  .side-link {
    display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; margin: 2px 0;
    border: 0; border-radius: 9px; background: none; color: #b5c2d8; text-align: left; cursor: pointer; font-size: 14px;
  }
  .side-link:hover { background: #18233a; color: #fff; }
  .side-link.on { background: var(--accent); color: #fff; }
  .side-link i { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font: 700 11px/20px system-ui; font-style: normal; text-align: center; }
  .side-foot { padding: 10px; border-top: 1px solid #1c2638; }
  .shell { margin-left: 232px; padding-bottom: 0; }
  .bottom { display: none; }
  main { padding: 22px 26px 40px; }
  .topbar { padding-left: 26px; }
}

/* ---------------------------------------------------------------- blocks */
.grid { display: grid; gap: 12px; }
@media (min-width: 700px) { .grid.two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .grid.three { grid-template-columns: repeat(3, 1fr); } }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
}
.card.tap { cursor: pointer; transition: border-color .15s, transform .1s; }
.card.tap:active { transform: scale(.99); }
.card.tap:hover { border-color: #33476b; }
.card h2, .section-h { margin: 0 0 10px; font-size: 15px; font-weight: 650; }
.section-h { display: flex; align-items: center; gap: 8px; margin: 20px 2px 10px; color: var(--muted); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; }
.section-h .grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.kpi b { display: block; font-size: 24px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: 12px; }
.kpi.bad b { color: var(--bad); } .kpi.ok b { color: var(--ok); } .kpi.warn b { color: var(--warn); }

.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--panel-2); color: var(--muted);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--accent-soft); color: var(--accent); }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--dim); }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

/* box card */
.box-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.box-head h3 { margin: 0; font-size: 16px; }
.box-head small { color: var(--muted); }
.meters { display: grid; gap: 9px; }
.meter { display: grid; grid-template-columns: 44px 1fr 52px; align-items: center; gap: 8px; font-size: 12.5px; }
.meter > span:first-child { color: var(--muted); }
.meter > span:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.bar { height: 8px; border-radius: 5px; background: var(--panel-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 5px; background: var(--accent); transition: width .5s; }
.bar.ok > i { background: var(--ok); } .bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.facts b { color: var(--text); font-weight: 600; }
.spark { display: block; width: 100%; height: 46px; margin-top: 10px; }

/* gauges */
.gauges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gauge { text-align: center; }
.gauge svg { width: 100%; max-width: 92px; }
.gauge b { display: block; margin-top: -4px; font-size: 13px; }
.gauge small { color: var(--muted); font-size: 11px; }

/* tabs + chips */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 16px -12px 10px; padding: 0 12px; scrollbar-width: none; border-bottom: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; padding: 10px 12px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); cursor: pointer; font-weight: 600; font-size: 14px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); font-size: 13px; cursor: pointer; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.chip b { margin-left: 4px; }

.search { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); font-size: 15px; outline: none; }
.search:focus { border-color: var(--accent); }
.toolbar { display: grid; gap: 10px; margin-bottom: 12px; }

/* list rows (workloads) */
.list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list + .list { margin-top: 12px; }
.list-h { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--panel-2); font-size: 12.5px; font-weight: 650; color: var(--muted); cursor: pointer; user-select: none; }
.list-h .grow { color: var(--text); }
.item { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-top: 1px solid var(--line); cursor: pointer; min-height: 56px; }
.item:first-child { border-top: 0; }
.list-h + .item { border-top: 1px solid var(--line); }
.item:hover { background: var(--panel-2); }
.item .t { font-weight: 600; font-size: 14.5px; }
.item .s { color: var(--muted); font-size: 12px; }
.item .r { text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.item .r b { display: block; color: var(--text); font-size: 13px; }
.chev { color: var(--dim); font-size: 18px; flex: none; }

/* detail */
.kv { display: grid; grid-template-columns: minmax(96px, 34%) 1fr; gap: 0; font-size: 13.5px; }
.kv > div { padding: 9px 0; border-top: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.kv > div:nth-child(-n+2) { border-top: 0; }
.kv > div:nth-child(odd) { color: var(--muted); padding-right: 10px; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text);
  font-weight: 600; font-size: 14px; cursor: pointer; text-align: center;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: var(--bad-soft); border-color: rgba(255, 93, 108, .4); color: var(--bad); }
.btn.danger.solid { background: var(--bad); color: #fff; }
.btn.okb { background: var(--ok-soft); border-color: rgba(46, 204, 143, .4); color: var(--ok); }
.btn.big { width: 100%; min-height: 50px; font-size: 16px; }
.btn.sm { min-height: 34px; padding: 0 10px; font-size: 13px; }
.note { padding: 10px 12px; border-radius: 10px; background: var(--panel-2); color: var(--muted); font-size: 13px; }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.note.warn { background: var(--warn-soft); color: var(--warn); }
pre.out { margin: 8px 0 0; padding: 10px; border-radius: 8px; background: #070b12; color: #c9d6ea; font: 12px/1.5 var(--mono); white-space: pre-wrap; max-height: 160px; overflow: auto; }

/* table (processes etc.) */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; background: var(--panel-2); }
.tbl td { padding: 9px 10px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.tbl td.num, .tbl th.num { text-align: right; }
.scroll-x { overflow-x: auto; }

/* alerts / events */
.alert { display: flex; gap: 11px; padding: 12px 14px; border-top: 1px solid var(--line); }
.alert:first-child { border-top: 0; }
.alert .ic { font-size: 16px; line-height: 1.3; }
.alert .t { font-weight: 600; font-size: 14px; }
.alert .s { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.alert.tap { cursor: pointer; }

/* logs */
.logs-page main { padding: 0; max-width: none; }
.logbar { position: sticky; top: 54px; z-index: 10; display: grid; gap: 8px; padding: 10px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.logbar .row select, .logbar .row .btn { flex: none; }
select.sel { min-height: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--text); font-size: 13.5px; }
.logview {
  margin: 0; padding: 10px 12px 90px; min-height: calc(100vh - 200px); background: #070b12; color: #c9d6ea;
  font: 12px/1.55 var(--mono); white-space: pre; overflow-x: auto;
}
.logview.wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.logview .ts { color: #56688a; }
.logview .e { color: #ff8a95; }
.logview .w { color: #f5c26b; }
.logview mark { background: #4f8cff55; color: inherit; border-radius: 2px; }
.logmeta { padding: 6px 12px; font-size: 12px; color: var(--muted); background: var(--panel); border-bottom: 1px solid var(--line); }
.fab {
  position: fixed; right: 16px; bottom: calc(84px + var(--safe-b)); z-index: 25; width: 46px; height: 46px; border-radius: 50%;
  border: 0; background: var(--accent); color: #fff; font-size: 20px; box-shadow: 0 6px 18px rgba(0,0,0,.4); cursor: pointer;
}
@media (min-width: 900px) { .fab { bottom: 24px; } }

/* sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(3, 6, 12, .6); animation: fade .15s; }
.sheet {
  position: relative; width: 100%; max-width: 520px; max-height: 88vh; overflow: auto;
  padding: 8px 18px calc(20px + var(--safe-b)); border-radius: 18px 18px 0 0; background: var(--panel);
  border: 1px solid var(--line); animation: up .2s ease-out;
}
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 16px; } }
.grab { width: 40px; height: 4px; margin: 4px auto 12px; border-radius: 2px; background: var(--line); }
.sheet h3 { margin: 4px 0 6px; font-size: 18px; }
.sheet p { margin: 6px 0 12px; color: var(--muted); }
.sheet .stack { display: grid; gap: 10px; margin-top: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 10px; background: var(--bad-soft); color: var(--text); font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--bad); flex: none; }
.menu-list a, .menu-list button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 4px; border: 0; border-top: 1px solid var(--line); background: none; color: var(--text); font-size: 15px; text-align: left; cursor: pointer; }
.menu-list > :first-child { border-top: 0; }
.menu-list i { margin-left: auto; color: var(--dim); font-style: normal; }

.toast {
  position: fixed; left: 50%; bottom: calc(86px + var(--safe-b)); z-index: 70; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 12px; background: #1e2a40; color: #fff;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: up .2s;
}
.toast.bad { background: #5a1d26; } .toast.ok { background: #14503a; }
@media (min-width: 900px) { .toast { bottom: 28px; } }
.spin { display: inline-block; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.toast { animation: none; }

/* login */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px 16px; background: radial-gradient(circle at 50% 0, #17233a, var(--bg) 60%); }
.login { width: 100%; max-width: 360px; display: grid; gap: 14px; padding: 26px 22px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); text-align: center; }
.login h1 { margin: 0; font-size: 22px; }
.login p { margin: -6px 0 6px; }
.login img { margin: 0 auto; }
.login label { display: grid; gap: 6px; text-align: left; font-size: 13px; color: var(--muted); }
.login input { padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--text); font-size: 16px; outline: none; }
.login input:focus { border-color: var(--accent); }
.err { margin: 0; color: var(--bad); font-size: 14px; }
.gbox { display: flex; justify-content: center; min-height: 44px; }
.pw { text-align: left; }
.pw summary { cursor: pointer; color: var(--muted); font-size: 13px; text-align: center; padding: 6px; list-style: none; }
.pw summary::-webkit-details-marker { display: none; }
.pw form { display: grid; gap: 14px; margin-top: 10px; }

/* ---------------------------------------------------------------- YouTube tab */
.yt-cal { padding: 0; }
.yt-day { display: grid; grid-template-columns: 74px 1fr; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); align-items: start; }
.yt-day:first-child { border-top: 0; }
.yt-day.empty-day { padding-top: 5px; padding-bottom: 5px; }
.yt-day.empty-day .yt-dl, .yt-day.empty-day .dim { font-size: 11.5px; }
.yt-dl { font-size: 12.5px; font-weight: 650; color: var(--muted); padding-top: 3px; }
.yt-evs { display: grid; gap: 6px; min-width: 0; }
.yt-ev { display: grid; gap: 3px; min-width: 0; padding: 6px 8px; border-radius: 8px; background: var(--panel-2); border-left: 3px solid var(--c); color: var(--text); text-decoration: none; font-size: 13px; }
.yt-ev.long { background: color-mix(in srgb, var(--c) 14%, var(--panel-2)); font-weight: 600; }
.yt-l1 { display: flex; align-items: center; gap: 7px; min-width: 0; }
.yt-l1 .grow { flex: 1; min-width: 0; }
.yt-t { font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.yt-ev:not(.long) .yt-t { color: var(--muted); }
.yt-legend { display: flex; flex-wrap: wrap; gap: 4px 0; margin: -4px 2px 8px; }
.yt-ev b { color: var(--c); font-weight: 650; font-size: 12.5px; }
.yt-time { flex: none; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.yt-tag { flex: none; padding: 1px 6px; border-radius: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--c); }
.yt-leg { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); margin-right: 12px; }
.yt-leg::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.yt-card { border-top: 3px solid var(--c); }
.yt-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); margin-top: 5px; flex: none; }
.yt-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.yt-kpis > div { background: var(--panel-2); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.yt-kpis b { display: block; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.yt-kpis span { color: var(--muted); font-size: 11.5px; }
.yt-bw { display: grid; gap: 8px; margin-top: 10px; font-size: 13px; }
.yt-bw > div { display: grid; gap: 2px; min-width: 0; }
.yt-bw .muted { font-size: 11.5px; }
.yt-bw .s { color: var(--muted); font-size: 12px; }
.yt-bw a.ell { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yt-more { margin-top: 10px; font-size: 13px; }
.yt-more summary { cursor: pointer; color: var(--accent); font-size: 13px; padding: 4px 0; }
.yt-more .tbl { margin-top: 6px; }
.yt-sched { display: grid; gap: 6px; margin-top: 6px; font-size: 13px; }
.yt-sched .row { min-width: 0; }
.yt-sched .grow { min-width: 0; }
.yt-ul { margin: 6px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.45; }
.yt-ul li + li { margin-top: 4px; }
.stepper { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; margin-top: 7px; }
.stepper span { height: 5px; border-radius: 3px; background: var(--panel-2); border: 1px solid var(--line); }
.stepper .done { background: var(--ok); border-color: var(--ok); }
.stepper .now { background: var(--accent); border-color: var(--accent); }
.ok-t { color: var(--ok); } .bad-t { color: var(--bad); }
