/* Kubuca Admin */
:root {
  color-scheme: light;
  --page: #f9f9f7; --card: #ffffff; --ink: #0b0b0b; --ink2: #52514e; --muted: #898781;
  --grid: #e1e0d9; --axis: #c3c2b7; --ring: rgba(11, 11, 11, .10); --soft: #f0efec;
  --up: #006300; --down: #d03b3b; --warn-bg: #fff8e6; --warn-ink: #7a5200; --warn-ring: #f3dfa8;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --side: #0f1117;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--page); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--s1); }
.hidden { display: none !important; }

/* ── Layout ── */
.app { display: flex; min-height: 100vh; }
.side { width: 220px; background: var(--side); color: #fff; padding: 22px 14px; flex-shrink: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; margin: 0 6px 26px; }
.brand img { height: 17px; width: auto; display: block; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; font-size: 13.5px; color: #a1a1aa; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.nav button:hover { color: #fff; }
.nav button.on { background: rgba(255, 255, 255, .10); color: #fff; font-weight: 600; }
.nav .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .6; flex-shrink: 0; }
.nav .count { margin-left: auto; background: rgba(255, 255, 255, .14); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 600; padding: 1px 7px; }
.nav .sep { height: 1px; background: rgba(255, 255, 255, .08); margin: 12px 6px; }
.side .who { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 12.5px; color: #a1a1aa; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side .who button { background: none; border: 1px solid rgba(255, 255, 255, .2); color: #fff; border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; }

.main { flex: 1; min-width: 0; padding: 22px 28px 40px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.top h1 { font-size: 22px; font-weight: 700; letter-spacing: -.3px; }
.top .sub { font-size: 12.5px; color: var(--ink2); margin-top: 3px; }
.ctrls { display: flex; gap: 8px; align-items: center; }
.updated { font-size: 11.5px; color: var(--muted); }
.pill, select.pill { border: 1px solid var(--ring); background: var(--card); border-radius: 9px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer; }
.btn { border: 0; border-radius: 10px; padding: 10px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer; background: var(--ink); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: var(--card); color: var(--ink); border: 1px solid var(--ring); }
.btn.small { padding: 6px 11px; font-size: 12px; border-radius: 8px; }

/* ── Tiles and cards ── */
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.tile { background: var(--card); border: 1px solid var(--ring); border-radius: 14px; padding: 13px 14px; min-width: 0; }
.tile .l { font-size: 11.5px; color: var(--ink2); font-weight: 500; }
.tile .v { font-size: 24px; font-weight: 700; letter-spacing: -.5px; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .d { font-size: 11.5px; margin-top: 4px; color: var(--muted); line-height: 1.35; }
.tile .d b { font-weight: 600; }
.up { color: var(--up); } .down { color: var(--down); }
.live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #0ca30c; margin-right: 7px; vertical-align: middle; box-shadow: 0 0 0 3px rgba(12, 163, 12, .18); }

.row { display: grid; gap: 14px; margin-bottom: 14px; }
.r2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.r3 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
.r31 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.card { background: var(--card); border: 1px solid var(--ring); border-radius: 14px; padding: 15px 16px; min-width: 0; }
.card h3 { font-size: 13.5px; font-weight: 600; }
.card .h3s { font-size: 11.5px; color: var(--muted); margin-top: 2px; margin-bottom: 10px; }
.card h3 + :not(.h3s) { margin-top: 12px; }
.btn.more { margin-top: 10px; }
.chart { position: relative; min-height: 40px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 11.5px; color: var(--ink2); margin: -2px 0 6px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.empty { font-size: 12.5px; color: var(--muted); padding: 22px 0; text-align: center; }
.note { font-size: 11.5px; color: var(--warn-ink); background: var(--warn-bg); border: 1px solid var(--warn-ring); border-radius: 10px; padding: 8px 10px; margin-top: 10px; line-height: 1.45; }
.error-bar { font-size: 12.5px; color: var(--down); background: #fdecec; border: 1px solid #f4c7c7; border-radius: 10px; padding: 9px 12px; margin-bottom: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { font-size: 11px; color: var(--muted); font-weight: 600; text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
td { padding: 8px 8px; border-bottom: 1px solid var(--soft); font-variant-numeric: tabular-nums; color: var(--ink); }
td.n, th.n { text-align: right; }
td.m { color: var(--ink2); }
.table-wrap { overflow-x: auto; }
.tag { display: inline-block; border-radius: 6px; padding: 2px 7px; font-size: 11px; font-weight: 600; background: var(--soft); color: var(--ink2); }
.tag.spark { background: #e6f0fb; color: #1c5cab; }
.tag.elite { background: #fdeee6; color: #a3401a; }
.tag.test { background: var(--warn-bg); color: var(--warn-ink); }

/* ── Tooltip ── */
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; border-radius: 8px; padding: 7px 9px; line-height: 1.45; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); white-space: nowrap; }
.tip .t { color: #c9c9c4; font-size: 11px; margin-bottom: 2px; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ── Broadcasts ── */
.form label { display: block; font-size: 12px; font-weight: 600; color: var(--ink2); margin: 12px 0 6px; }
.form label:first-child { margin-top: 0; }
.form input[type=text], .form input[type=url], .form textarea { width: 100%; border: 1px solid var(--ring); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; background: #fff; }
.form textarea { min-height: 110px; resize: vertical; }
.form .check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 14px; color: var(--ink); font-weight: 500; }
.form .hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }
.form .actions { display: flex; gap: 10px; margin-top: 18px; align-items: center; }
.form .status { font-size: 12.5px; color: var(--ink2); }
.preview { border: 1px solid var(--ring); border-radius: 14px; padding: 14px; background: #fafaf8; }
.preview .pt { font-weight: 700; font-size: 14px; }
.preview .pm { font-size: 13px; color: var(--ink2); margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.preview img { width: 100%; border-radius: 10px; margin-top: 10px; max-height: 180px; object-fit: cover; }
.preview .pl { font-size: 12px; margin-top: 8px; word-break: break-all; }
.preview .when { font-size: 11px; color: var(--muted); margin-top: 8px; }
.push { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid var(--ring); border-radius: 14px; padding: 10px 12px; margin-bottom: 12px; }
.push img { width: 30px; height: 30px; border-radius: 7px; }
.push .pt { font-size: 13px; }
.push .pm { font-size: 12.5px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.list-item { border-bottom: 1px solid var(--soft); padding: 11px 0; display: flex; gap: 12px; align-items: flex-start; }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .ttl { font-weight: 600; font-size: 13.5px; }
.list-item .msg { font-size: 12.5px; color: var(--ink2); margin-top: 3px; white-space: pre-wrap; word-break: break-word; }
.list-item .meta { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* ── Tickets ── */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { border: 1px solid var(--ring); background: var(--card); border-radius: 99px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--ink2); }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ── Modal ── */
.modal-bg { position: fixed; inset: 0; background: rgba(11, 11, 11, .45); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal { background: #fff; border-radius: 18px; padding: 22px; width: 100%; max-width: 380px; }
.modal h4 { font-size: 16px; }
.modal p { font-size: 13px; color: var(--ink2); margin-top: 8px; line-height: 1.5; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* ── Sign-in ── */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--side); }
.auth-card { background: #fff; border-radius: 20px; padding: 28px 26px; width: 100%; max-width: 380px; }
.auth-card .brand { color: var(--ink); margin: 0 0 22px; }
.auth-card h1 { font-size: 20px; letter-spacing: -.3px; }
.auth-card .sub { font-size: 13px; color: var(--ink2); margin-top: 6px; line-height: 1.5; }
.auth-card label { display: block; font-size: 12px; font-weight: 600; color: var(--ink2); margin: 16px 0 6px; }
.auth-card input { width: 100%; border: 1px solid var(--ring); border-radius: 11px; padding: 12px 13px; font-size: 15px; background: #fff; }
.auth-card input:focus, .form input:focus, .form textarea:focus { outline: 2px solid var(--s1); outline-offset: -1px; border-color: transparent; }
.auth-card input.code { font-size: 26px; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; padding: 12px 8px; }
.auth-card .btn { width: 100%; margin-top: 20px; padding: 13px; font-size: 14.5px; }
.auth-card .msg { font-size: 12.5px; color: var(--down); margin-top: 12px; min-height: 18px; line-height: 1.45; }
.auth-card .link { background: none; border: 0; color: var(--ink2); font-size: 12.5px; margin-top: 14px; cursor: pointer; text-decoration: underline; width: 100%; }

/* ── Small screens ── */
@media (max-width: 1100px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .r3, .r31 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; padding: 12px 12px 10px; }
  .brand { margin: 0 4px 10px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 2px; }
  .nav button { width: auto; white-space: nowrap; padding: 7px 10px; font-size: 13px; }
  .nav .dot, .nav .sep { display: none; }
  .side .who { margin-top: 10px; padding: 10px 4px 0; }
  .main { padding: 16px 16px 32px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .r2 { grid-template-columns: minmax(0, 1fr); }
  .tile .v { font-size: 21px; }
}
