/* Marketing API Hub — admin shell (tokens.css + components.css + local overrides) */

/* ---------- Tokens ---------- */
:root {
  --display: var(--font);
  --mono: ui-monospace, "Cascadia Code", SFMono-Regular, Menlo, Consolas, monospace;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 16px;
  --sidebar-w: 248px;
  --gap: 1rem;
  --pad: 1.5rem;
  --content-max: 1440px;
}

/* Page height changes (lists reloading) must not toggle the scrollbar and shift the layout */
html {
  scrollbar-gutter: stable;
}

:root,
html[data-theme="light"] {
  --bg: #f4f6f9;
  --surface-2: #f8fafc;
  --surface-3: #f0f3f7;
  --line: rgba(15, 23, 42, 0.075);
  --line-strong: rgba(15, 23, 42, 0.13);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px -8px rgba(15, 23, 42, 0.1);
}

html[data-theme="dark"] {
  --bg: #0a0d13;
  --surface: #10141c;
  --surface-2: #141924;
  --surface-3: #1a202c;
  --line: rgba(232, 238, 248, 0.07);
  --line-strong: rgba(232, 238, 248, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
}

/* Static, GPU-cheap background (no blur filters) */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(56rem 24rem at 15% -8rem, var(--orb-1), transparent 70%),
    radial-gradient(40rem 22rem at 100% 0%, var(--orb-2), transparent 70%);
  opacity: 0.55;
}

.mono {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.chips-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* ---------- Kit refinements (flat surfaces instead of glass) ---------- */
.panel,
.kpi,
.toast,
.sidebar,
.login-card,
.lang-dd-panel {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.btn {
  border-radius: var(--radius-sm);
  font-weight: 700;
}
.btn:hover {
  box-shadow: none;
}
.btn:not(.primary):not(.soft):not(.danger-soft):not(.danger-fill):hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}
.btn.primary:hover {
  box-shadow: 0 8px 18px -10px var(--accent-glow);
  transform: none;
  filter: brightness(1.05);
}
.btn.soft:hover {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  border-color: transparent;
}
.btn.ghost:hover {
  background: var(--surface-3);
}
.btn.danger-soft:hover {
  box-shadow: none;
  border-color: rgba(239, 68, 68, 0.35);
}

.icon-btn {
  border-radius: 9px;
}
.icon-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.seg,
.lang-switch {
  border-radius: 10px;
}
.seg button,
.lang-btn {
  border-radius: 7px;
}
.seg button.active,
.lang-btn.active {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 0 0 1px var(--line);
}

.pill.online {
  color: #059669;
}
html[data-theme="dark"] .pill.online {
  color: #34d399;
}

.chip {
  border-radius: 6px;
}

/* Platform / project chips in schedule */
.chip-platform {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.chip-fansport {
  background: rgba(22, 163, 74, 0.14);
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.35);
}

.chip-bet2fun {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.35);
}

.chip-topbet {
  background: #1a0a0c;
  color: #e8b4bc;
  border-color: #7f1d1d;
}

html[data-theme="dark"] .chip-fansport {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.4);
}

html[data-theme="dark"] .chip-bet2fun {
  background: rgba(248, 113, 113, 0.16);
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.4);
}

html[data-theme="dark"] .chip-topbet {
  background: #0c0506;
  color: #f0a8b2;
  border-color: #9f1239;
}

.field input,
.pass-row input,
select,
.search {
  border-radius: var(--radius-sm);
}
.field input {
  background: var(--surface);
}
.search {
  min-height: 2.45rem;
}

input[type="date"] {
  height: 2.45rem;
  padding: 0 0.7rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: 0.86rem;
  font-weight: 600;
}
input[type="date"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.toast {
  background: var(--surface);
  border-radius: 12px;
}

dialog.modal {
  border-radius: 18px;
}
dialog.modal form {
  padding: 1.35rem 1.4rem;
}
dialog.modal header {
  padding-bottom: 1rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}
dialog.modal footer {
  padding-top: 1rem;
  margin-top: 0.15rem;
  border-top: 1px solid var(--line);
}
.modal-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 11px;
  font-size: 1rem;
}

/* ---------- Boot ---------- */
.boot {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 1rem;
  background: var(--bg);
}

.boot-mark {
  width: 3rem;
  height: 3rem;
  border-radius: 30%;
  background: var(--accent-grad);
  box-shadow: 0 0 0 7px var(--accent-soft);
  animation: boot-pulse 1.2s var(--ease) infinite;
}

.boot p {
  font-weight: 700;
  color: var(--muted);
}

@keyframes boot-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

body:not(.is-booting) #bootScreen {
  display: none !important;
}

/* ---------- Login ---------- */
.login-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.brand-name {
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.76rem;
  font-weight: 600;
}

.login-shell {
  width: min(100%, 1000px);
  min-height: 580px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  border-radius: 22px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  animation: uk-pop-in 0.45s var(--ease) both;
  transition: opacity 0.28s var(--ease), transform 0.28s var(--ease);
}

.login-shell:has(.login-card.leaving) {
  opacity: 0;
  transform: translateY(8px) scale(0.985);
}

/* Left: brand panel (always dark) */
.login-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  padding: 2.25rem 2.25rem 2rem;
  color: #fff;
  background:
    radial-gradient(30rem 20rem at 0% 0%, rgba(59, 130, 246, 0.5), transparent 65%),
    radial-gradient(24rem 18rem at 100% 100%, rgba(14, 165, 233, 0.28), transparent 65%),
    #0a0f1a;
}
.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(ellipse 85% 70% at 20% 10%, #000 15%, transparent 80%);
  mask-image: radial-gradient(ellipse 85% 70% at 20% 10%, #000 15%, transparent 80%);
}

.lh-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.lh-brand .logo {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.lh-brand .brand-sub {
  color: rgba(255, 255, 255, 0.55);
}

.lh-copy {
  display: grid;
  gap: 0.7rem;
  margin-top: auto;
}
.lh-copy h2 {
  max-width: 22rem;
  font-size: clamp(1.5rem, 2.6vw, 1.95rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.035em;
}
.lh-copy p {
  max-width: 24rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.62);
}

.lh-features {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.lh-features li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.lh-features li > div {
  display: grid;
  gap: 0.1rem;
  min-width: 0;
}
.lh-features strong {
  font-size: 0.88rem;
  font-weight: 700;
}
.lh-features li span:not(.lh-ic) {
  font-size: 0.78rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.55);
}
.lh-ic {
  width: 2rem;
  height: 2rem;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(147, 197, 253, 0.18);
}
.lh-ic .i {
  width: 1rem;
  height: 1rem;
}

.lh-preview {
  display: grid;
  gap: 0.9rem;
  padding: 0.95rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.lhp-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}
.lhp-kpi {
  display: grid;
  gap: 0.2rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
}
.lhp-kpi span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.lhp-kpi span::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  flex: none;
  border-radius: 2px;
  background: #60a5fa;
}
.lhp-kpi.ok span::before {
  background: #34d399;
}
.lhp-kpi.live span::before {
  border-radius: 50%;
  background: #f87171;
}
.lhp-kpi b {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.lhp-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  height: 3.6rem;
}
.lhp-bars i {
  flex: 1;
  height: var(--h);
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #60a5fa, rgba(59, 130, 246, 0.35));
  transform-origin: bottom;
  animation: uk-bar-grow 0.8s var(--ease) both;
}
.lhp-bars i:nth-child(2n) {
  animation-delay: 0.06s;
}
.lhp-bars i:nth-child(3n) {
  animation-delay: 0.12s;
}

/* Right: form */
.login-card {
  display: grid;
  align-content: center;
  gap: 0.9rem;
  padding: 2.25rem 2.5rem;
}

.login-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}
.login-foot .i {
  width: 0.95rem;
  height: 0.95rem;
}

.login-card .btn-arrow .i {
  width: 1rem;
  height: 1rem;
}

.login-card-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.login-brand {
  display: none;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.login-heading {
  margin-bottom: 0.35rem;
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.login-lead {
  display: none;
  margin-top: -0.6rem;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.5;
}

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
    width: min(100%, 420px);
    min-height: 0;
    border-radius: 20px;
  }
  .login-hero {
    display: none;
  }
  .login-card {
    padding: 1.75rem 1.5rem 1.5rem;
  }
  .login-card-top {
    justify-content: space-between;
    padding-bottom: 1.1rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid var(--line);
  }
  .login-brand {
    display: flex;
  }
  .login-heading {
    margin-bottom: 0;
    font-size: 1.45rem;
  }
  .login-lead {
    display: block;
  }
  .login-lead:empty {
    display: none;
  }
}

@media (max-width: 420px) {
  .login-view {
    padding: 0.75rem;
  }
  .login-card {
    padding: 1.4rem 1.1rem 1.25rem;
  }
}

.login-card .float-field input {
  height: 3.35rem;
  border-width: 1px;
  border-radius: 12px;
  background: var(--surface-2);
}
.login-card .float-field input:focus {
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.login-card .btn.wide {
  margin-top: 0.3rem;
  height: 3.1rem;
}

#capsHint {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--warn);
}

/* ---------- Shell ---------- */
.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.75rem;
  padding: 1rem 0.8rem;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 20;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.25rem 0.45rem 1rem;
  border-bottom: 1px solid var(--line);
}
.side-brand .logo {
  --s: 2rem;
  box-shadow: 0 6px 14px -8px var(--accent-glow);
}
.side-brand .brand-name {
  font-size: 0.92rem;
}
.side-brand .brand-sub {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
}

.nav-scroll {
  overflow: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: 1.1rem;
  align-content: start;
  padding: 0.35rem 0.1rem;
  scrollbar-width: thin;
}

.nav-group {
  display: grid;
  gap: 0.15rem;
}

.nav-group-label {
  padding: 0.25rem 0.65rem 0.35rem;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.85;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: 2.4rem;
  padding: 0.45rem 0.65rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink-2);
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  box-shadow: none;
  font-weight: 700;
}

.nav-item .ni {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  display: grid;
  place-items: center;
  background: none;
  color: var(--muted);
}
.nav-item .ni .i {
  width: 1.05rem;
  height: 1.05rem;
}

.nav-item:hover .ni {
  color: var(--ink-2);
}

.nav-item.active .ni {
  background: none;
  color: var(--accent);
}

.nav-item .nav-badge {
  margin-left: auto;
}

.side-foot {
  display: grid;
  gap: 0.6rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.25rem 0.35rem;
}
.user-card .avatar {
  --s: 2.1rem;
}

.user-meta {
  min-width: 0;
  display: grid;
  gap: 0.15rem;
  justify-items: start;
}

.user-meta strong {
  max-width: 100%;
  font-size: 0.82rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.side-controls .lang-switch {
  margin-right: auto;
}
#logoutBtn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(7, 10, 16, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-height: 4.25rem;
  padding: 0.85rem max(var(--pad), calc((100% - var(--content-max)) / 2 + var(--pad)));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--line);
}

.topbar-titles {
  min-width: 0;
  flex: 1;
}

.topbar-titles h1 {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.topbar-titles p {
  margin-top: 0.1rem;
  font-size: 0.82rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-titles p:empty {
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: none;
}

.online-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.12);
  color: var(--ok);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.online-badge::before {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--ok);
  animation: uk-dot-pulse 1.8s ease-out infinite;
}

.burger {
  display: none;
}

.page-host {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding: 1.25rem var(--pad) 2.5rem;
  display: grid;
  gap: var(--gap);
  align-content: start;
}

.page {
  display: grid;
  gap: var(--gap);
  align-content: start;
  min-width: 0;
  animation: uk-fade-up 0.3s var(--ease) both;
}

.quiet .page,
.quiet .kpi,
.quiet .panel,
.quiet .bar-col,
.quiet .bar-fill,
.quiet .stack-fill,
.quiet .donut {
  animation: none !important;
}

/* ---------- Layout blocks ---------- */
.grid-2,
.grid-2-1 {
  gap: var(--gap);
}

.panel {
  gap: 0.9rem;
  padding: 1.15rem 1.25rem 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-head {
  margin: -0.1rem 0 0.1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 {
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* .panel is a grid: keep compact controls at their natural width */
.panel > .seg,
.panel > .lang-switch {
  justify-self: start;
}

/* Panel that only wraps a table: edge-to-edge content */
.panel.flush {
  padding: 0;
  overflow: hidden;
}
.panel.flush .table-wrap {
  border: 0;
  border-radius: 0;
}
.panel.flush > div > .empty {
  padding: 3rem 1rem;
}

/* Filter bar on list pages */
.page > .toolbar {
  gap: 0.5rem;
  padding: 0.6rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.page > .toolbar select {
  min-width: 10rem;
  height: 2.45rem;
}
.page > .toolbar .btn.sm {
  height: 2.45rem;
  padding-inline: 0.85rem;
}

/* Schedule filters: two fixed lines; every item grows so a wrap never leaves ragged gaps */
.schedule-filters {
  flex-direction: column;
  align-items: stretch;
}

.filters-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.filters-line + .filters-line {
  padding-top: 0.5rem;
  border-top: 1px solid var(--line);
}

.schedule-filters .search.grow {
  flex: 1 1 16rem;
  min-width: 12rem;
}
.schedule-filters .filters-line select {
  flex: 0 1 13rem;
  min-width: 9rem;
}

.filters-line > .seg,
.filters-group {
  flex: 1 1 auto;
}
.filters-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.filters-group > .seg {
  flex: 1 1 auto;
}
.schedule-filters .seg {
  display: flex;
  flex-wrap: nowrap;
}
.schedule-filters .seg button {
  flex: 1 1 auto;
  justify-content: center;
  white-space: nowrap;
}

/* ---------- KPI ---------- */
.kpi-grid {
  gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.kpi {
  gap: 0.55rem;
  padding: 1rem 1.1rem 1.05rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.kpi::before {
  display: none;
}

.kpi-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.7rem;
  letter-spacing: 0.07em;
}
.kpi-label::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  flex: none;
  border-radius: 3px;
  background: var(--tone);
}

.kpi-value {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--ink);
}

/* ---------- Bar chart ---------- */
.bar-chart {
  --chart-h: 200px;
  padding-top: 1.6rem;
}

.bar-scale {
  flex: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: var(--chart-h);
  padding-right: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.bar-scale span {
  line-height: 1;
}

.bar-track {
  position: relative;
  background: var(--surface-3);
}

.bar-tip {
  position: absolute;
  left: 50%;
  bottom: calc(var(--v) + 0.35rem);
  transform: translateX(-50%);
  font-size: 0.74rem;
  font-weight: 800;
  color: var(--ink-2);
  pointer-events: none;
}

.bar-col.zero .bar-fill {
  opacity: 0.25;
}

.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Overview: projects chart ---------- */
.proj-chart {
  --seg-prematch: #3b82f6;
  --seg-live: #ef4444;
  --seg-finished: #f59e0b;
  --seg-closed: #94a3b8;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1.5rem 2rem;
  align-items: center;
  padding-top: 0.25rem;
}
html[data-theme="dark"] .proj-chart {
  --seg-prematch: #60a5fa;
  --seg-live: #f87171;
  --seg-finished: #fbbf24;
  --seg-closed: #64748b;
}

.seg-prematch { background: var(--seg-prematch); }
.seg-live { background: var(--seg-live); }
.seg-finished { background: var(--seg-finished); }
.seg-closed { background: var(--seg-closed); }

.donut-wrap {
  display: grid;
  justify-items: center;
  gap: 1rem;
}

.donut-box {
  position: relative;
  width: 9.5rem;
  height: 9.5rem;
}

.donut {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  /* Ring: the hole is cut out so the panel background shows through */
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 1.15rem), #000 calc(100% - 1.1rem));
  mask: radial-gradient(farthest-side, transparent calc(100% - 1.15rem), #000 calc(100% - 1.1rem));
  animation: donut-in 0.7s var(--ease) both;
}

/* Sibling of .donut: the ring mask would hide it if it were a child */
.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.donut-center b {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.donut-center span {
  margin-top: 0.2rem;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

@keyframes donut-in {
  from {
    opacity: 0;
    transform: rotate(-90deg) scale(0.92);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.chart-legend {
  display: grid;
  gap: 0.35rem;
  min-width: 10rem;
  padding: 0;
  list-style: none;
}
.chart-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-2);
}
.chart-legend li.zero {
  opacity: 0.45;
}
.lg-dot {
  flex: none;
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 3px;
}
.lg-label {
  flex: 1;
}
.lg-value {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.proj-rows {
  display: grid;
  gap: 1.1rem;
}

.proj-row {
  display: grid;
  gap: 0.45rem;
}
.proj-row.zero .stack,
.proj-row.zero .proj-total {
  opacity: 0.5;
}

.proj-row-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.proj-total {
  margin-left: auto;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.proj-share {
  min-width: 2.6rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.stack {
  height: 0.7rem;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.stack-fill {
  display: flex;
  gap: 2px;
  width: var(--w);
  height: 100%;
  transform-origin: left;
  animation: stack-grow 0.8s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 0.08s);
}
.stack-seg {
  min-width: 4px;
  flex-basis: 0;
}
.stack-seg:first-child {
  border-radius: 99px 0 0 99px;
}
.stack-seg:last-child {
  border-radius: 0 99px 99px 0;
}
.stack-seg:only-child {
  border-radius: 99px;
}

@keyframes stack-grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

.proj-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.85rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}
.proj-breakdown span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.proj-breakdown .lg-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 2px;
}

@media (max-width: 1100px) {
  .proj-chart {
    grid-template-columns: 1fr;
  }
  .donut-wrap {
    grid-template-columns: auto minmax(0, 1fr);
    justify-items: start;
    align-items: center;
    gap: 1.25rem;
  }
}

@media (max-width: 420px) {
  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.table th,
.table td {
  padding: 0.7rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table th {
  padding-block: 0.6rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table tbody tr {
  transition: background 0.12s ease;
}
.table tbody tr:hover {
  background: var(--surface-2);
}

.table .row-actions {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.match-cell {
  display: grid;
  gap: 0.15rem;
  min-width: 12rem;
}

.match-cell strong {
  font-size: 0.88rem;
  font-weight: 700;
}

.match-cell .mono {
  font-size: 0.74rem;
}

.match-logos {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.match-logos img {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  object-fit: contain;
  border-radius: 5px;
  background: var(--surface-3);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Match type pills ---------- */
.pill.prematch {
  background: rgba(37, 99, 235, 0.11);
  color: #2563eb;
}
html[data-theme="dark"] .pill.prematch {
  background: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}

/* ---------- Schedule table ---------- */
.schedule-table {
  --row-live: var(--danger);
  --row-prematch: #3b82f6;
}

.schedule-table thead th {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface-2));
  color: color-mix(in srgb, var(--accent-ink) 45%, var(--muted));
  border-bottom-color: color-mix(in srgb, var(--accent) 16%, var(--line));
}

.schedule-table .th-actions {
  width: 1%;
}

.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: -0.25rem -0.4rem;
  padding: 0.25rem 0.4rem;
  border: 0;
  border-radius: 6px;
  background: none;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
}
.th-sort:hover {
  color: var(--accent-ink);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.th-sort:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.th-sortable.sorted {
  color: var(--accent-ink);
}
.sort-ic .i {
  width: 0.85rem;
  height: 0.85rem;
  transition: transform 0.18s var(--ease);
}
.th-sortable:not(.sorted) .sort-ic {
  opacity: 0.35;
}
.th-sort.asc .sort-ic .i {
  transform: rotate(180deg);
}

.schedule-table tbody tr:not(.group-row):hover {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

/* Type stripe on the start cell: red live, blue prematch */
.schedule-table tr.row-live > td:first-child {
  box-shadow: inset 3px 0 0 var(--row-live);
}
.schedule-table tr.row-prematch > td:first-child {
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--row-prematch) 75%, transparent);
}

.schedule-table tr.is-done > td:not(:last-child) {
  opacity: 0.6;
}

.schedule-table tr.group-row > td {
  padding: 0.45rem 1rem;
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 12%, var(--line));
}

.group-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.group-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-day .group-title {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.schedule-table tr.group-tournament > td {
  padding-block: 0.55rem;
}
.group-tournament .group-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--ink);
}

.group-sub {
  flex: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.group-logo {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
  border-radius: 5px;
  background: var(--surface-3);
}
.group-logo.empty-logo {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface-3));
}

.group-count {
  flex: none;
  margin-left: auto;
  min-width: 1.5rem;
  padding: 0.05rem 0.45rem;
  border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-ink);
  font-size: 0.7rem;
  font-weight: 800;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Group / sort controls above the schedule table */
.table-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
}

.table-head-group {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.table-head-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-head .seg button {
  padding-block: 0.3rem;
  font-size: 0.78rem;
}

/* Auto width fits the longest option; the kit's vertical padding would clip text at this height */
.table-head select {
  width: auto;
  min-width: 0;
  height: 2.1rem;
  padding-block: 0;
  line-height: normal;
}

.td-start {
  width: 1%;
  white-space: nowrap;
}

.start-cell {
  display: grid;
  gap: 0.05rem;
  min-width: 5.5rem;
}
.start-time {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.start-cell.is-today .start-time {
  color: var(--accent-ink);
}
.start-date {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}
.start-rel {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-ink);
}

.match-meta {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
}

.td-added,
.td-by {
  font-size: 0.78rem;
  color: var(--muted);
}
.td-added {
  white-space: nowrap;
}
.td-by {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-table .row-actions .btn-text {
  display: none;
}

/* ---------- Table footer / pagination ---------- */
.table-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.table-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pager {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.pager-btn {
  display: inline-grid;
  place-items: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.pager-btn:hover:not(:disabled):not(.active) {
  border-color: var(--line-strong);
  background: var(--surface-3);
}
.pager-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.pager-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.pager-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.pager-ic .i {
  width: 1rem;
  height: 1rem;
}
.pager-ic.prev .i {
  transform: rotate(90deg);
}
.pager-ic.next .i {
  transform: rotate(-90deg);
}
.pager-gap {
  padding: 0 0.2rem;
  color: var(--muted);
}

.pager-size {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}
.pager-size select {
  width: auto;
  min-width: 0;
  height: 2rem;
  padding-block: 0;
  line-height: normal;
}

/* ---------- Browse ---------- */
.browse-cols {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.browse-list {
  display: grid;
  gap: 0.3rem;
  /* Fixed height: switching prematch/live swaps skeleton/empty/list without
     resizing the columns, and leaves room for the event detail below */
  height: clamp(220px, calc(100vh - 640px), 440px);
  height: clamp(220px, calc(100dvh - 640px), 440px);
  overflow: auto;
  overscroll-behavior: contain;
  margin-right: -0.4rem;
  padding-right: 0.4rem;
  align-content: start;
  scrollbar-width: thin;
}

.browse-loading {
  display: grid;
  gap: 0.4rem;
  padding: 0.15rem 0;
}

.browse-load-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.25rem;
  padding: 0.45rem 0.6rem;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.browse-load-spin {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: browse-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes browse-spin {
  to {
    transform: rotate(360deg);
  }
}

.browse-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.6rem 0.7rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--ink);
  transition: border-color 0.12s ease, background 0.12s ease;
  /* Long lists: skip layout/paint of off-screen rows */
  content-visibility: auto;
  contain-intrinsic-size: auto 3rem;
}

button.browse-item:hover {
  background: var(--surface-3);
}

button.browse-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.browse-item.active {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--accent-soft);
}
.browse-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 22%;
  bottom: 22%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.browse-item .muted {
  margin-top: 0.1rem;
  font-weight: 600;
  font-size: 0.74rem;
}

.browse-item > div {
  min-width: 0;
}
.browse-item > div > div:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

#overviewRecent .browse-list {
  height: auto;
  max-height: none;
  margin-right: 0;
  padding-right: 0;
}

/* ---------- Event cards ---------- */
.event-detail {
  display: grid;
  gap: 0.85rem;
}

.event-head {
  display: grid;
  gap: 0.3rem;
}

.event-head h3 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.event-head p {
  font-size: 0.82rem;
}

.event-detail-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  align-items: start;
}

.event-detail-grid > .empty {
  grid-column: 1 / -1;
}

.event-card {
  position: relative;
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.event-card.active-card {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.event-card > .toolbar {
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.event-card-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2rem;
  height: 2rem;
}

.odds-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.odds-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 700;
}

.odds-pill .ol {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.odds-pill .ov {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

.schedule-interval {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.schedule-interval[hidden] {
  display: none !important;
}

/* ---------- Language picker ---------- */
.lang-dd {
  position: relative;
  width: min(320px, 100%);
}

.lang-dd-toggle {
  width: 100%;
  justify-content: space-between;
}

.lang-dd-toggle .chev {
  transition: transform 0.2s var(--ease);
}

.lang-dd.open .lang-dd-toggle .chev {
  transform: rotate(180deg);
}

.lang-dd-panel {
  position: absolute;
  z-index: 12;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  display: none;
  gap: 0.5rem;
  padding: 0.6rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
}

.lang-dd.open .lang-dd-panel {
  display: grid;
}

.lang-dd-list {
  display: grid;
  gap: 0.1rem;
  max-height: 220px;
  overflow: auto;
  overscroll-behavior: contain;
}

.lang-dd-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
}

.lang-dd-item:hover {
  background: var(--surface-2);
}

.lang-dd-item input {
  accent-color: var(--accent);
}

.lang-dd-item .code {
  min-width: 2.2rem;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.lang-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  min-height: 1.8rem;
}

.lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.3rem 0.22rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.76rem;
  font-weight: 800;
}

.lang-chip button {
  width: 1.3rem;
  height: 1.3rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.lang-chip button:hover {
  background: var(--surface);
}

/* Project checkboxes in user modal */
.project-checks {
  gap: 0.45rem;
}
.project-checks .lang-dd-item {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.project-checks .lang-dd-item:has(input:checked) {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}

/* ---------- Load by link ---------- */
.by-link-loading {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.by-link-result {
  display: grid;
  gap: 0.7rem;
  padding: 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.by-link-result h3 {
  font-size: 0.98rem;
  font-weight: 800;
  margin: 0;
}

/* ---------- Credentials ---------- */
.cred-grid {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

.cred-card {
  display: grid;
  gap: 0.85rem;
}

.cred-card .cred-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.cred-card h3 {
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.cred-card .cred-title p {
  margin-top: 0.15rem;
  font-size: 0.74rem;
}

.cred-card .field {
  gap: 0.3rem;
  font-size: 0.74rem;
  color: var(--muted);
}

.cred-card .field .mono {
  padding: 0.55rem 0.7rem;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.cred-card > .btn {
  justify-self: start;
}

/* ---------- Settings ---------- */
.tz-field {
  max-width: 28rem;
}
.tz-field select {
  width: 100%;
  height: 2.6rem;
}

body.app-enter .sidebar {
  animation: uk-fade-in 0.35s var(--ease) both;
}

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .browse-cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .browse-cols > .panel:last-child {
    grid-column: 1 / -1;
  }
  /* Two rows of lists here — split the height so the detail stays on screen */
  .browse-list {
    height: clamp(180px, calc(50vh - 330px), 300px);
    height: clamp(180px, calc(50dvh - 330px), 300px);
  }
}

@media (max-width: 1100px) {
  :root {
    --pad: 1.25rem;
  }
  .grid-2-1 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(var(--sidebar-w), 86vw);
    /* visibility keeps off-screen links out of the Tab order */
    visibility: hidden;
    transform: translateX(-105%);
    transition:
      transform 0.26s var(--ease),
      visibility 0.26s;
    box-shadow: var(--shadow-lg);
    will-change: transform;
  }

  body.nav-open {
    overflow: hidden;
  }

  body.nav-open .sidebar {
    visibility: visible;
    transform: none;
  }

  .scrim {
    display: block;
  }

  body.nav-open .scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .burger {
    display: inline-grid;
    margin-left: -0.35rem;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .browse-cols {
    grid-template-columns: 1fr;
  }
  .browse-list {
    height: auto;
    max-height: 320px;
  }
}

@media (max-width: 640px) {
  :root {
    --pad: 0.9rem;
    --gap: 0.75rem;
  }

  body {
    font-size: 14px;
  }

  .topbar {
    min-height: 3.6rem;
    padding-block: 0.6rem;
  }
  .topbar-titles h1 {
    font-size: 1.05rem;
  }
  .topbar-titles p {
    display: none;
  }

  .page-host {
    padding-top: 0.9rem;
  }

  .panel {
    padding: 1rem;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .kpi {
    padding: 0.85rem 0.9rem;
  }
  .kpi-value {
    font-size: 1.4rem;
  }

  .online-badge,
  .hide-sm {
    display: none !important;
  }

  /* Filters: full-width rows, segmented controls scroll instead of wrapping */
  .page > .toolbar {
    padding: 0.5rem;
  }
  .page > .toolbar select,
  .page > .toolbar .btn,
  .schedule-interval {
    flex: 1 1 100%;
  }
  .page > .toolbar .seg {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .page > .toolbar .seg::-webkit-scrollbar {
    display: none;
  }
  .page > .toolbar .seg button {
    white-space: nowrap;
  }
  .schedule-interval input {
    flex: 1 1 0;
    min-width: 0;
  }

  /* Tables become cards */
  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    display: grid;
    gap: 0.45rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--line);
  }
  .table tbody tr:last-child {
    border-bottom: 0;
  }

  .table td {
    display: grid;
    grid-template-columns: 6.5rem minmax(0, 1fr);
    align-items: center;
    gap: 0.6rem;
    padding: 0;
    border: 0;
  }

  .table td::before {
    content: attr(data-label);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .match-cell {
    min-width: 0;
  }

  .table td:last-child {
    grid-template-columns: 1fr;
    margin-top: 0.3rem;
  }
  .table td:last-child::before {
    display: none;
  }

  .table .row-actions {
    justify-content: stretch;
  }
  .table .row-actions .btn {
    flex: 1 1 auto;
  }

  /* Schedule cards: stripe on the whole card, day headers as plain bands */
  .schedule-table tr.row-live > td:first-child,
  .schedule-table tr.row-prematch > td:first-child {
    box-shadow: none;
  }
  .schedule-table tbody tr.row-live {
    box-shadow: inset 3px 0 0 var(--row-live);
  }
  .schedule-table tbody tr.row-prematch {
    box-shadow: inset 3px 0 0 color-mix(in srgb, var(--row-prematch) 75%, transparent);
  }
  .schedule-table tr.group-row {
    padding: 0;
  }
  .schedule-table tr.group-row > td {
    display: block;
    margin-top: 0;
    padding: 0.5rem 1rem;
  }
  .schedule-table tr.group-row > td::before {
    display: none;
  }
  .schedule-table .row-actions .btn-text {
    display: inline;
  }
  .td-start,
  .td-by {
    width: 100%;
    max-width: none;
  }
  .table-foot {
    justify-content: center;
  }
  .table-head-group {
    flex: 1 1 100%;
    justify-content: space-between;
  }
  .table-head .seg {
    overflow-x: auto;
    scrollbar-width: none;
  }
  .table-head .seg button {
    white-space: nowrap;
  }
  .table-head select {
    min-width: 0;
    flex: 1 1 auto;
  }

  .event-card > .toolbar .btn {
    flex: 1 1 auto;
  }

  .cred-card > .btn {
    justify-self: stretch;
  }
}

.range-field {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.85rem;
}

.range-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.range-head label {
  margin: 0;
  font-weight: 600;
}

.range-head strong {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-size: 1.15rem;
  min-width: 1.5rem;
  text-align: right;
}

.range-ends {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Filled track slider */
input.range-fill[type="range"] {
  --range-pct: 0%;
  --range-track: var(--surface-3, #e8edf4);
  --range-fill: var(--accent, #2563eb);
  --range-thumb: #fff;
  width: 100%;
  height: 0.55rem;
  margin: 0.35rem 0;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--range-fill) 0%,
    var(--range-fill) var(--range-pct),
    var(--range-track) var(--range-pct),
    var(--range-track) 100%
  );
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

input.range-fill[type="range"]::-webkit-slider-runnable-track {
  height: 0.55rem;
  border-radius: 999px;
  background: transparent;
}

input.range-fill[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: calc((0.55rem - 1.15rem) / 2);
  border-radius: 50%;
  border: 2px solid var(--range-fill);
  background: var(--range-thumb);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
  /* scale() blurs the thumb on fractional DPI; also overrides the kit's hover scale */
  transform: none;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

input.range-fill[type="range"]:hover::-webkit-slider-thumb,
input.range-fill[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow:
    0 1px 3px rgba(15, 23, 42, 0.22),
    0 0 0 4px color-mix(in srgb, var(--range-fill) 20%, transparent);
}

input.range-fill[type="range"]:focus-visible {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--range-fill) 28%, transparent);
}

input.range-fill[type="range"]::-moz-range-track {
  height: 0.55rem;
  border: none;
  border-radius: 999px;
  background: transparent;
}

input.range-fill[type="range"]::-moz-range-progress {
  height: 0.55rem;
  border: none;
  border-radius: 999px;
  background: var(--range-fill);
}

input.range-fill[type="range"]::-moz-range-thumb {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  border: 2px solid var(--range-fill);
  background: var(--range-thumb);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.22);
}

html[data-theme="dark"] input.range-fill[type="range"] {
  --range-track: rgba(232, 238, 248, 0.12);
  --range-thumb: #10141c;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
