﻿:root {
  --bg: #0b1218;
  --bg-2: #0e1720;
  --sidebar: #0a1117;
  --card: #121c26;
  --card-2: #16222e;
  --border: #1e2c3a;
  --text: #e7eef5;
  --muted: #8aa0b5;
  --teal: #2ec4b6;
  --teal-2: #1a9e93;
  --link: #7ad7ff;
  --green: #3ddc97;
  --yellow: #f5c542;
  --red: #ff6b6b;
  --orange: #ff9f43;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 10px;
  --glass-sidebar: rgba(4, 13, 20, 0.6);
  --glass-card: rgba(7, 17, 25, 0.55);
  --glass-border: rgba(100, 180, 210, 0.16);
  --glass-border-soft: rgba(100, 180, 210, 0.1);
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "DM Sans", "Segoe UI", sans-serif;
  --delta-up: #3ddc97;
  --delta-down: #ff7a7a;
  --delta-flat: #8aa0b5;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button, input, select { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--sans); font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.hidden { display: none !important; }
.tabular { font-variant-numeric: tabular-nums; font-family: var(--mono); }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(46, 196, 182, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 196, 182, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at top, black 30%, transparent 75%);
}

/* Login */
.login-wrap {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    linear-gradient(180deg, rgba(4, 12, 18, 0.55) 0%, rgba(4, 12, 18, 0.75) 55%, rgba(4, 12, 18, 0.92) 100%),
    url("/static/img/never-cold-banner.png") center 34% / cover no-repeat;
}
.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 28px 22px;
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin: 0 0 4px; }
.login-logo {
  width: 88px;
  height: 85px;
  object-fit: contain;
  flex: none;
  filter: drop-shadow(0 0 6px rgba(46, 196, 182, 0.3));
}
.login-wordmark { display: block; width: 176px; height: 170px; object-fit: contain; }
.login-sub { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
.login-card label { display: block; font-size: 12.5px; font-weight: 500; margin: 14px 0 6px; color: var(--muted); }
.login-card label:first-of-type { margin-top: 0; }
.login-card input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.login-card input:focus { border-color: var(--teal); }
.login-card .btn.block { margin-top: 18px; }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.error { color: var(--red); font-size: 13px; font-weight: 500; margin: 10px 0 0; }
.success { color: var(--green); font-size: 13px; font-weight: 500; margin: 10px 0 0; }
.login-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
}
.login-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 6px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
}
.login-tab.active { background: var(--card-2); color: var(--text); font-weight: 600; }

/* Shell */
:root { --banner-h: 170px; }
.app { display: flex; flex-direction: column; min-height: 100%; }
.app-body { position: relative; display: grid; grid-template-columns: 316px minmax(0, 1fr); flex: 1; min-height: 0; }
.app-banner {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--banner-h);
  background: url("/static/img/never-cold-banner.png") center 34% / cover no-repeat;
  z-index: 0;
  pointer-events: none;
}
.sidebar {
  position: relative;
  z-index: 1;
  background: rgba(4, 13, 20, 0.68);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: 1px solid var(--glass-border-soft);
  padding: 0 16px 16px;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding-top: 0; }
.brand-logo { flex: none; width: 88px; height: 85px; object-fit: contain; filter: drop-shadow(0 0 6px rgba(46, 196, 182, 0.3)); }
.brand-text { display: flex; flex-direction: column; }
.brand-wordmark { display: block; width: 176px; height: 170px; object-fit: contain; }
#nav { display: flex; flex-direction: column; gap: 3px; }
#nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
}
.nav-icon { width: 16px; height: 16px; flex: none; opacity: 0.8; }
#nav button:hover { background: rgba(120, 180, 210, 0.07); color: var(--text); }
#nav button.active {
  background: rgba(46, 196, 182, 0.12);
  border-color: rgba(46, 196, 182, 0.28);
  color: var(--teal);
  font-weight: 600;
}
#nav button.active .nav-icon { opacity: 1; }

.main { position: relative; z-index: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 26px;
  min-height: var(--banner-h);
  border-bottom: 1px solid var(--glass-border-soft);
  background: linear-gradient(90deg, rgba(4, 12, 18, 0.5) 0%, rgba(4, 12, 18, 0.18) 45%, rgba(4, 12, 18, 0.05) 100%);
}
.who-block { display: flex; flex-direction: column; gap: 3px; }
.who { color: var(--muted); font-size: 13px; }
.who strong { color: var(--text); font-weight: 600; }
.motto {
  font-family: var(--sans);
  font-style: italic;
  font-weight: 500;
  font-size: 15px;
  line-height: 1.3;
  color: #d9f2fa;
  text-shadow: 0 0 10px rgba(46, 196, 182, 0.45), 0 2px 4px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.01em;
}
.top-actions { display: flex; gap: 8px; }
.view { padding: 20px 22px 40px; flex: 1; }
.statusbar {
  border-top: 1px solid var(--border);
  padding: 8px 22px;
  color: var(--muted);
  font-size: 12px;
  font-family: var(--mono);
}

.btn {
  background: rgba(22, 34, 46, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--text);
  border: 1px solid var(--glass-border-soft);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13.5px;
  font-weight: 500;
}
.btn:hover { border-color: var(--glass-border); }
.btn.primary {
  background: rgba(46, 196, 182, 0.85);
  color: #06211e;
  border-color: var(--teal);
  font-weight: 600;
  box-shadow: 0 0 12px rgba(46, 196, 182, 0.22);
}
.btn.primary:hover { background: #48d4c6; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; margin-top: 12px; }
.btn:disabled { opacity: 0.55; cursor: default; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.kpi {
  background: var(--glass-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.kpi .label { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; }
.kpi .value { font-family: var(--mono); font-weight: 600; font-size: 22px; letter-spacing: -0.01em; margin-top: 6px; }
.kpi .value.green { color: var(--green); }
.kpi .value.yellow { color: var(--yellow); }
.kpi .value.red { color: var(--red); }

.grid-2 { display: grid; grid-template-columns: 280px 1fr; gap: 12px; margin-top: 14px; }
.card {
  background: var(--glass-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius);
  padding: 14px;
}
.card h3 { margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }

.attention-list { list-style: none; margin: 0; padding: 0; }
.attention-list li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); margin-top: 6px; flex: none; }
.player-link {
  background: none; border: 0; padding: 0;
  color: var(--link); font-weight: 600; font-size: 13.5px;
}
.player-link:hover { text-decoration: underline; }
.sub { color: var(--muted); font-size: 11.5px; font-family: var(--mono); }

.search {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 220px;
  outline: none;
}
.search:focus { border-color: var(--teal); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.chip {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
}
.chip.active { border-color: var(--teal); color: var(--teal); background: #12333a; font-weight: 600; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--glass-border-soft);
  border-radius: var(--radius);
  background: var(--glass-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  /* Flips the browser's horizontal scrollbar to the top edge of the wrapper so it's
     reachable without scrolling past every row first; the table is flipped back so
     its own content still renders right-side up. */
  transform: rotateX(180deg);
}
.table-wrap > table { transform: rotateX(180deg); }
table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.4; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; vertical-align: middle; }
th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  background: #15212c;
  cursor: pointer;
}
th.sorted { color: var(--teal); background: #17303a; }
td.sorted { background: rgba(122, 215, 255, 0.06); }
td { font-weight: 400; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.empty { padding: 28px; text-align: center; color: var(--muted); font-size: 13px; }

/* Players tab: keep the Player column visible while scrolling the rest horizontally. */
.table-wrap.sticky-first th:first-child,
.table-wrap.sticky-first td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
  box-shadow: 2px 0 6px rgba(0, 0, 0, 0.35);
}
.table-wrap.sticky-first th:first-child { background: #15212c; z-index: 4; }
.table-wrap.sticky-first td:first-child { background: #0e1720; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.pill.active { background: #163c2e; color: var(--green); }
.pill.warning { background: #3c3416; color: var(--yellow); }
.pill.inactive { background: #3a1c1c; color: var(--red); }
.pill.online { background: #163c2e; color: var(--green); }
.pill.idle { background: #3c3416; color: var(--yellow); }
.pill.offline { background: #243040; color: var(--muted); }

.share {
  display: flex; align-items: center; gap: 8px;
}
.share .bar { height: 6px; background: #1b3d48; border-radius: 99px; flex: 1; min-width: 60px; overflow: hidden; }
.share .bar > span { display: block; height: 100%; background: var(--teal); }
.bonus { display: inline-block; background: #163c2e; color: var(--green); border-radius: 4px; padding: 1px 5px; margin-right: 3px; font-family: var(--mono); font-size: 11px; }

.chain-list { display: grid; gap: 6px; max-height: 320px; overflow: auto; }
.chain-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
}
.chain-item small { color: var(--muted); display: block; }
.summary-strip { display: flex; gap: 22px; padding: 10px 0 14px; color: var(--muted); font-family: var(--mono); font-size: 13px; }
.summary-strip b { color: var(--text); }

.rank-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rank-card ol { margin: 0; padding: 0 0 0 22px; }
.rank-card li { padding: 5px 0; }

.stat-cell .main { font-family: var(--mono); }
.stat-cell .delta { color: var(--delta-up); margin-left: 6px; font-family: var(--mono); font-size: 12px; }
.stat-cell .per { color: var(--muted); font-size: 11px; }

.cur-delta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1.15;
  min-width: 4.5rem;
}
td:has(.cur-delta) { text-align: right; }
.cur-delta-now {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.cur-delta-now.is-na { color: var(--muted); font-weight: 400; }
.cur-delta-diff {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.cur-delta-diff.is-up { color: var(--delta-up); }
.cur-delta-diff.is-down { color: var(--delta-down); }
.cur-delta-diff.is-flat { color: var(--delta-flat); font-weight: 500; }
.cur-delta-tag {
  margin-left: 4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yellow);
  opacity: 0.9;
}

.promo-card { margin-bottom: 10px; }
.promo-card .missing { color: var(--yellow); font-size: 13px; margin: 6px 0 0; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 820px; }
.settings-grid label { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.settings-grid input,
.settings-grid select {
  width: 100%;
  margin-top: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
}
.settings-grid .sub { display: block; margin-top: 4px; font-weight: 400; }

.cols { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 10px; color: var(--muted); font-size: 12px; }

/* Drawer */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(4, 8, 12, 0.45);
  z-index: 20;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(460px, 100%);
  background: #0f1922;
  border-left: 1px solid var(--border);
  z-index: 21;
  overflow: auto;
  box-shadow: var(--shadow);
  padding: 18px 18px 40px;
}
.drawer-close {
  position: sticky; top: 0; float: right;
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); width: 32px; height: 32px; border-radius: 8px;
  font-size: 18px;
}
.drawer h2 { margin: 0 32px 6px 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.drawer .status-line { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.live-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.live-strip div {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  font-size: 12.5px;
}
.live-strip .k { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.kpi-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.kpi-mini > div {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}
.kpi-mini .k { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.kpi-mini .v { font-family: var(--mono); font-weight: 600; font-size: 16px; margin-top: 4px; }
.block { margin: 16px 0; }
.block h3 { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 13.5px; }
.row span:last-child { font-family: var(--mono); }
.note { color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.bank-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-width: 320px; }
.bank-form label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.bank-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
}
.bank-amount-row { display: flex; gap: 8px; }
.bank-amount-row input { flex: 1; min-width: 0; }
.bank-pending {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.bank-pending p { margin: 0; font-size: 13.5px; }
.bank-steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.banker-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.banker-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-2);
  font-size: 13.5px;
}
.banker-search-results { display: flex; flex-direction: column; gap: 4px; }
.banker-result {
  text-align: left;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 13px;
}
.banker-result:hover { border-color: var(--teal); }

.menu-btn {
  display: none;
  flex: none;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  background: rgba(22, 34, 46, 0.55);
  border: 1px solid var(--glass-border-soft);
  border-radius: 8px;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

@media (max-width: 980px) {
  :root { --banner-h: 170px; }
  .app-body { grid-template-columns: 1fr; }
  .kpis, .grid-2, .rank-grid, .settings-grid { grid-template-columns: 1fr; }
  .drawer { width: 100%; }

  /* Sidebar becomes a slide-in overlay instead of eating half a phone screen. */
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 82vw);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 22;
    overflow-y: auto;
    padding-top: 16px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  #sidebar-backdrop { z-index: 21; }

  .topbar {
    flex-wrap: wrap;
    padding: 12px 16px;
    min-height: 0;
    row-gap: 10px;
  }
  .who-block { min-width: 0; order: 2; flex: 1 1 100%; }
  .top-actions { order: 3; flex: 1 1 100%; flex-wrap: wrap; }
  .top-actions .btn { flex: 1; text-align: center; }
  .motto { display: none; }

  .view { padding: 16px 14px 32px; }
  .page-head { align-items: flex-start; }
  .page-head h2 { font-size: 18px; }
  .search { width: 100%; }
}

@media (max-width: 480px) {
  .kpi .value { font-size: 20px; }
  .btn { padding: 8px 10px; font-size: 13px; }
  th, td { padding: 8px 8px; font-size: 12.5px; }
}
