:root {
  --bg-canvas: #fafafa;
  --bg-surface: #ffffff;
  --bg-subtle: #f4f4f5;
  --bg-hover: #e4e4e7;
  --border: rgba(24, 24, 27, 0.09);
  --border-strong: rgba(24, 24, 27, 0.18);
  --text: #09090b;
  --text-muted: #52525b;
  --accent: #f97316;
  --accent-hover: #ea580c;
  --accent-soft: rgba(249, 115, 22, 0.11);
  --dark-pill: #18181b;
  --dark-pill-text: #ffffff;
  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, 0.12);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.13);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --code-bg: #18181b;
  --code-text: #e4e4e7;
  --img-outline: oklch(0 0 0 / 0.1);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 10px 30px -6px rgba(0, 0, 0, 0.12), 0 4px 12px -4px rgba(0, 0, 0, 0.06);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --font-sans: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-ui: 'Barlow Semi Condensed', 'Barlow', sans-serif;
  --font-display: 'Barlow Condensed', 'Barlow', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg-canvas: #0b0c13;
  --bg-surface: #121420;
  --bg-subtle: #181a28;
  --bg-hover: #212438;
  --border: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.17);
  --text: #f4f5f8;
  --text-muted: #9ca3af;
  --accent: #f97316;
  --accent-hover: #fb923c;
  --accent-soft: rgba(249, 115, 22, 0.16);
  --dark-pill: #bef264;
  --dark-pill-text: #09090b;
  --code-bg: #07080d;
  --code-text: #e4e4e7;
  --img-outline: oklch(1 0 0 / 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  --shadow-md: 0 20px 44px -8px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.theme-switching *, .theme-switching *::before, .theme-switching *::after {
  transition-duration: 0s !important;
  animation-duration: 0s !important;
}

* { box-sizing: border-box; }

html {
  scroll-padding-block-start: 64px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg-canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

a { color: inherit; text-decoration: none; }
code, pre, .mono { font-family: var(--font-mono); }

button, input, select, textarea {
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
}

button, .card.clickable, .ws-check-row, .game-tile, .ts-cat-pill, .pill {
  -webkit-tap-highlight-color: transparent;
}

@keyframes pageIn {
  from { opacity: 0.35; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.98) translateY(4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Auth / Login Split Page */
.auth-page {
  min-height: 100dvh;
  background: #09090b;
  color: #fafafa;
  display: flex;
  flex-direction: column;
}
.auth-topbar {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  font-size: 18px;
  letter-spacing: 0.03em;
}
.brand-badge {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  font-size: 15px;
  flex-shrink: 0;
}
.auth-page .brand-badge { background: #bef264; color: #09090b; }
.auth-grid {
  flex: 1;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 64px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 48px;
  align-items: center;
}
.auth-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 4.4vw, 54px);
  line-height: 1.05;
  margin: 0 0 16px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.015em;
  text-wrap: balance;
}
.auth-hero p {
  font-size: 16.5px;
  line-height: 1.55;
  color: #a1a1aa;
  max-width: 480px;
  margin: 0;
  text-wrap: pretty;
}
.auth-card {
  background: #111114;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.55);
  animation: modalPop 0.2s var(--ease);
}
.auth-card h2 { margin: 0 0 6px; font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: -0.015em; }
.auth-card .sub { color: #a1a1aa; margin: 0 0 20px; font-size: 13.5px; }
.auth-field { margin-bottom: 14px; }
.auth-field label { display: block; font-size: 12.5px; font-weight: 600; color: #d4d4d8; margin-bottom: 6px; }
.auth-field input {
  width: 100%;
  background: #09090b;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.auth-field input:focus { outline: none; border-color: #ffffff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.14); }
.auth-submit {
  width: 100%;
  margin-top: 6px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: #fafafa;
  color: #09090b;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), transform 0.15s var(--ease);
}
@media (hover: hover) {
  .auth-submit:hover { background: #e4e4e7; }
}
.auth-submit:active { transform: scale(0.96); }
.auth-switch { margin-top: 16px; font-size: 13px; color: #a1a1aa; text-align: center; }
.auth-switch a { color: #ffffff; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.auth-error {
  background: rgba(239, 68, 68, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}
.auth-hint {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.28);
  color: #fdba74;
  font-size: 12.5px;
  line-height: 1.45;
}

/* Main Workspace Layout */
.app-shell { display: flex; min-height: 100dvh; }
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 30;
}
.sidebar-top {
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.jump-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease);
}
@media (hover: hover) {
  .jump-btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-strong); }
}
.kbd {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 10px 14px;
}
.nav-section { margin-bottom: 14px; }
.nav-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  cursor: pointer;
}
.nav-plus {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
@media (hover: hover) {
  .nav-plus:hover { border-color: var(--accent); color: var(--accent); }
}
.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: start;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease);
}
@media (hover: hover) {
  .nav-item:hover { background: var(--bg-subtle); }
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  border-inline-start: 3px solid var(--accent);
}
.nav-item-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nav-item-left span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  padding: 0 7px;
  border-radius: 4px;
  background: var(--bg-subtle);
  color: var(--text-muted);
}

.sidebar-bottom {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}
.capacity-widget {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}
@media (hover: hover) {
  .capacity-widget:hover { background: var(--bg-hover); border-color: var(--border-strong); }
}
.cap-row { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; }

.user-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: start;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}
@media (hover: hover) {
  .user-btn:hover { background: var(--bg-subtle); border-color: var(--border); }
}
.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--dark-pill);
  color: var(--dark-pill-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.user-meta { flex: 1; min-width: 0; }
.user-name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-sub { font-size: 11px; color: var(--text-muted); }

.user-popover {
  position: absolute;
  inset-inline: 10px;
  bottom: 58px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 60;
  transform-origin: bottom center;
  animation: modalPop 0.15s var(--ease);
}
.pop-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border: none;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  text-align: start;
  transition: background-color 0.12s var(--ease);
}
@media (hover: hover) {
  .pop-item:hover { background: var(--bg-subtle); }
}
.pop-item.danger { color: var(--danger); }
.pop-sep { height: 1px; background: var(--border); margin: 5px 4px; }

/* Main column */
.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-canvas);
  background-image: radial-gradient(rgba(128, 128, 128, 0.08) 1px, transparent 1px);
  background-size: 18px 18px;
}
[data-theme="dark"] .main-col {
  background-image: radial-gradient(rgba(255, 255, 255, 0.045) 1.15px, transparent 1.15px);
  background-size: 18px 18px;
}
.topbar {
  height: 54px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 6px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.breadcrumb { font-family: var(--font-ui); font-size: 13.5px; font-weight: 600; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.breadcrumb strong { color: var(--text); font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 29px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}
@media (hover: hover) {
  .status-pill:hover { border-color: var(--border-strong); background: var(--bg-hover); }
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); display: inline-block; flex-shrink: 0; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot.warn { background: var(--warn); }
.dot.danger { background: var(--danger); }

.content {
  padding: 24px 28px 56px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}
.page-anim { animation: pageIn 0.2s var(--ease); }

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-header h1 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.05;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-wrap: balance;
}
.page-header p { margin: 0; color: var(--text-muted); font-size: 13.5px; line-height: 1.5; text-wrap: pretty; }
.header-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Buttons (Unified 34px control rhythm + card font + 0.96 press feedback) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.015em;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease), transform 0.15s var(--ease);
}
@media (hover: hover) {
  .btn:not(:disabled):hover { background: var(--bg-subtle); border-color: var(--border-strong); }
}
.btn:not(:disabled):active { transform: scale(0.96); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #ffffff; font-weight: 800; }
@media (hover: hover) {
  .btn.primary:not(:disabled):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
}
.btn.dark { background: var(--dark-pill); border-color: var(--dark-pill); color: var(--dark-pill-text); }
.btn.danger { color: var(--danger); border-color: rgba(239, 68, 68, 0.35); }
@media (hover: hover) {
  .btn.danger:not(:disabled):hover { background: var(--danger-soft); }
}
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 5px; }
.btn:focus-visible, .pill:focus-visible, .ts-cat-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Cards & Grids */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.card.clickable { cursor: pointer; }
@media (hover: hover) {
  .card.clickable:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
}
.card-title { font-family: var(--font-display); font-size: 18px; line-height: 1.15; font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: 0.02em; margin: 0 0 4px; }
.card-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 14px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.kpi-label { font-family: var(--font-ui); font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.kpi-value { font-family: var(--font-display); font-size: 29px; line-height: 1.05; font-weight: 900; font-style: italic; letter-spacing: 0.015em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-family: var(--font-ui); font-size: 12px; color: var(--text-muted); }

/* Onboarding Checklist */
.step-list { display: flex; flex-direction: column; gap: 12px; margin: 16px 0 20px; }
.step-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-canvas);
}
.step-num {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Pills & Segmented Controls */
.pill-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.pill {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 13.5px;
  letter-spacing: 0.015em;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease), border-color 0.14s var(--ease), transform 0.15s var(--ease);
}
@media (hover: hover) {
  .pill:not(:disabled):hover { background: var(--bg-subtle); border-color: var(--border-strong); }
}
.pill:not(:disabled):active { transform: scale(0.96); }
.pill.active {
  background: var(--dark-pill);
  border-color: var(--dark-pill);
  border-inline-start-color: var(--dark-pill);
  color: var(--dark-pill-text);
  font-weight: 800;
}
[data-theme="dark"] .pill.active .tag {
  background: rgba(9, 9, 11, 0.16);
  color: #09090b;
}

.seg {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
}
.seg button {
  border: none;
  background: transparent;
  height: 28px;
  padding: 0 11px;
  border-radius: 4px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--text-muted);
  transition: background-color 0.14s var(--ease), color 0.14s var(--ease), box-shadow 0.14s var(--ease);
}
.seg button.active {
  background: var(--bg-surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  font-weight: 800;
}

/* Forms */
.field { margin-bottom: 12px; }
.field label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 5px; }
.input, select.input, textarea.input {
  width: 100%;
  min-height: 34px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text);
  transition: border-color 0.14s var(--ease), box-shadow 0.14s var(--ease);
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { resize: vertical; min-height: 110px; font-family: var(--font-mono); font-size: 12.5px; }

/* Checkboxes & Switches */
.ws-check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  margin-bottom: 8px;
  transition: border-color 0.14s var(--ease), background-color 0.14s var(--ease);
}
@media (hover: hover) {
  .ws-check-row:hover { border-color: var(--border-strong); background: var(--bg-subtle); }
}
.ws-check-label { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 13px; }
.ws-check-sub { font-size: 11.5px; color: var(--text-muted); font-weight: 500; display: block; }
.ws-check-input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.ws-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.ws-checkbox svg { width: 12px; height: 12px; stroke: #ffffff; stroke-width: 2.5; fill: none; opacity: 0; transform: scale(0.6); transition: opacity 0.15s var(--ease), transform 0.15s var(--ease); }
.ws-check-input:checked + .ws-checkbox { background: var(--dark-pill); border-color: var(--dark-pill); }
[data-theme="dark"] .ws-check-input:checked + .ws-checkbox svg { stroke: #09090b; }
.ws-check-input:checked + .ws-checkbox svg { opacity: 1; transform: scale(1); }

.ws-switch {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  flex-shrink: 0;
  transition: background-color 0.18s var(--ease);
}
.ws-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s var(--ease);
}
.ws-check-input:checked + .ws-switch { background: var(--accent); }
.ws-check-input:checked + .ws-switch::after { transform: translateX(16px); }

/* Tables (sticky headers, tabular figures, min-width: 0 track safety) */
.table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: auto;
  max-height: 68vh;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  padding: 9px 12px;
  text-align: start;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th.num, td.num {
  text-align: end;
  font-variant-numeric: tabular-nums;
  width: 64px;
}
th.ts-split-col, td.ts-split-col {
  border-inline-start: 1px solid var(--border-strong);
}
th {
  position: sticky;
  top: 0;
  z-index: 2;
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-subtle);
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color 0.12s var(--ease); }
@media (hover: hover) {
  tbody tr:hover { background: rgba(128, 128, 128, 0.05); }
}
tfoot td {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-strong);
  border-bottom: none;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 13px;
  padding: 11px 14px;
}
tfoot td strong {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.01em;
}
.ts-section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
  overflow: hidden;
  min-width: 0;
}
.ts-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.ts-section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.015em;
}
.ts-section-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
}
.ts-section-foot > span {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.ts-foot-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.ts-foot-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ts-foot-stat strong {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 800;
  font-style: italic;
  font-variant-numeric: tabular-nums;
}
.ts-fruit-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.ts-fruit-frame {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.ts-row-zero .ts-fruit-frame {
  opacity: 0.58;
}
.ts-row-zero .ts-fruit-name {
  color: var(--text-muted);
  font-weight: 600;
}
.ts-owners-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 240px;
  white-space: normal;
}

/* ============== Blox Fruits Mythical-Only Reference Cards (Exact Reference Match) ============== */
.bf-cyber-shell {
  background: #10111a;
  border-color: rgba(255, 255, 255, 0.11);
}
.bf-cyber-shell .ts-section-foot {
  background: #151724;
  border-top-color: rgba(255, 255, 255, 0.08);
  color: #f4f5f8;
}
.bf-cyber-shell .ts-section-foot .muted { color: #9ca3af; }
.bf-foot-lime { color: #bef264; }
.bf-foot-rose { color: #fb7185; }

.bf-ref-stage {
  background-color: #10111a;
  background-image: radial-gradient(rgba(255, 255, 255, 0.065) 1.25px, transparent 1.25px);
  background-size: 16px 16px;
  padding: 16px;
}
.bf-ref-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.bf-ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px;
  background: #171926;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-inline-start: 3px solid #fb7185;
  border-radius: 4px;
  color: #e4e4e7;
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
}
.bf-ref-chip.chip-lime { border-inline-start-color: #bef264; }
.bf-ref-chip.chip-sky { border-inline-start-color: #38bdf8; }
.bf-ref-chip-val {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  font-style: italic;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}
.bf-ref-toggle-btn {
  background: #181a28;
  border-color: rgba(255, 255, 255, 0.16);
  color: #f4f5f8;
}
@media (hover: hover) {
  .bf-ref-toggle-btn:not(:disabled):hover {
    background: #23263a;
    border-color: rgba(255, 255, 255, 0.28);
  }
}
.bf-ref-banner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.bf-ref-banner-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.bf-ref-lime-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 15px;
  background: linear-gradient(90deg, #bef264, #d9f99d);
  color: #09090b;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 16px;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transform: skewX(-12deg);
  border-radius: 3px;
  box-shadow: 0 2px 10px rgba(190, 242, 100, 0.25);
}
.bf-ref-lime-tag > * {
  transform: skewX(12deg);
}
.bf-ref-banner-meta {
  font-family: var(--font-ui);
  color: #a1a1aa;
  font-size: 13px;
  font-weight: 600;
}
.bf-ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 12px;
}
.bf-ref-card-wrap {
  background: rgba(244, 63, 94, 0.72);
  padding: 1.5px;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  transition: transform 0.16s var(--ease), background-color 0.16s var(--ease), opacity 0.16s var(--ease);
}
.bf-ref-card-wrap.zero {
  background: rgba(161, 161, 170, 0.22);
  opacity: 0.76;
}
@media (hover: hover) {
  .bf-ref-card-wrap:hover {
    transform: translateY(-2px);
    background: #fb7185;
    opacity: 1;
  }
}
.bf-ref-card {
  position: relative;
  background-color: #161722;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(135deg, rgba(244, 63, 94, 0.28) 0%, rgba(244, 63, 94, 0.12) 48%, rgba(20, 21, 31, 0.96) 50%, rgba(16, 17, 26, 0.99) 100%);
  background-size: 8px 8px, 100% 100%;
  clip-path: polygon(0 0, calc(100% - 13px) 0, 100% 13px, 100% 100%, 13px 100%, 0 calc(100% - 13px));
  padding: 11px 13px 12px;
  display: flex;
  flex-direction: column;
  min-height: 184px;
}
.bf-ref-card-wrap.zero .bf-ref-card {
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(135deg, rgba(161, 161, 170, 0.11) 0%, rgba(20, 21, 30, 0.98) 52%);
}
.bf-ref-pill {
  align-self: flex-start;
  background: #fb7185;
  color: #18181b;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 10px;
  transform: skewX(-12deg);
  border-radius: 2px;
}
.bf-ref-art {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 4px 6px 6px 0;
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.55));
}
.bf-ref-name {
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 18.5px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.1;
  padding-bottom: 6px;
  margin-bottom: 7px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bf-ref-stats {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.bf-ref-qty {
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 900;
  font-style: italic;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}
.bf-ref-holders {
  color: #a1a1aa;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ============== Pet Simulator 99 Dashboard (Unified Card Typography + db.biggames.io) ============== */
.ps99-shell {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
}
.ps99-rail {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow-sm);
}
.ps99-rail-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 4px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 12px;
  transition: background-color 0.14s var(--ease), border-color 0.14s var(--ease), transform 0.15s var(--ease);
}
@media (hover: hover) {
  .ps99-rail-btn:hover { background: var(--bg-subtle); }
}
.ps99-rail-btn:active { transform: scale(0.95); }
.ps99-rail-btn.active {
  background: rgba(56, 189, 248, 0.14);
  border-color: #38bdf8;
}
.ps99-rail-btn img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}
.ps99-rail-badge {
  position: absolute;
  top: 2px;
  inset-inline-end: 2px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 4px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  font-style: italic;
  padding: 0 5px;
  line-height: 1.35;
}
.ps99-stage {
  background-color: var(--bg-surface);
  background-image: radial-gradient(rgba(128, 128, 128, 0.11) 1.5px, transparent 1.5px),
    radial-gradient(rgba(128, 128, 128, 0.08) 1.5px, transparent 1.5px);
  background-size: 32px 32px;
  background-position: 0 0, 16px 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.ps99-stage-foot {
  margin: 14px -18px -16px;
  border-radius: 0 0 9px 9px;
}
.ps99-stage-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.ps99-var-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ps99-var-btn {
  height: 30px;
  padding: 0 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  font-size: 13.5px;
  letter-spacing: 0.03em;
  transform: skewX(-8deg);
  cursor: pointer;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.65);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  opacity: 0.88;
  transition: transform 0.14s var(--ease), opacity 0.14s var(--ease), box-shadow 0.14s var(--ease);
}
.ps99-var-btn.gold { background: linear-gradient(180deg, #fde047, #eab308); color: #18181b; text-shadow: none; border-color: #ca8a04; }
.ps99-var-btn.rainbow { background: linear-gradient(90deg, #ef4444, #f59e0b, #10b981, #38bdf8, #a855f7); }
.ps99-var-btn.shiny { background: linear-gradient(180deg, #60a5fa, #0284c7); }
.ps99-var-btn.active {
  opacity: 1;
  outline: 2px solid var(--text);
  outline-offset: 2px;
  transform: skewX(-8deg) translateY(-1px);
}
.ps99-var-btn:active { transform: skewX(-8deg) scale(0.96); }
.ps99-tier-head {
  text-align: center;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  margin: 14px 0 12px;
  letter-spacing: 0.02em;
}
.ps99-tier-head .ps99-tier-cnt {
  color: #0284c7;
  margin-inline-start: 4px;
}
[data-theme="dark"] .ps99-tier-head .ps99-tier-cnt { color: #38bdf8; }
.ps99-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 14px 12px;
  margin-bottom: 10px;
}
.ps99-pet-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  min-width: 0;
}
.ps99-pet-box {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 10px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px;
  box-shadow: var(--shadow-sm);
}
.ps99-pet-box.var-golden {
  background: linear-gradient(145deg, #fef08a, #eab308);
  border-color: #ca8a04;
}
.ps99-pet-box.var-rainbow {
  background: linear-gradient(135deg, #fecaca, #fde68a, #a7f3d0, #bae6fd, #e9d5ff);
  border-color: #9333ea;
}
.ps99-pet-box.var-shiny {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35), 0 4px 12px rgba(14, 165, 233, 0.25);
}
.ps99-pet-qty {
  position: absolute;
  top: -7px;
  inset-inline-end: -8px;
  background: var(--bg-surface);
  color: var(--text);
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  transform: skewX(-8deg);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  font-style: italic;
  padding: 0 6px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.ps99-pet-name {
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  max-width: 110px;
}
.ps99-pet-accs {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}
.ps99-pet-rap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  font-style: italic;
  font-variant-numeric: tabular-nums;
}
.ps99-pet-rap img { width: 13px; height: 13px; object-fit: contain; }

@media (max-width: 960px) {
  .bf-ref-grid { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
  .ps99-shell { grid-template-columns: 1fr; }
  .ps99-rail { flex-direction: row; overflow-x: auto; justify-content: flex-start; }
}
@media (max-width: 540px) {
  .bf-ref-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  background: var(--bg-subtle);
  color: var(--text-muted);
}
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }

.muted { color: var(--text-muted); font-size: 12px; }
.empty-box { text-align: center; padding: 44px 20px; color: var(--text-muted); text-wrap: pretty; }

.code-block {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.5;
  margin: 0;
}

/* Game selector cards in New Folder Modal (concentric radius) */
.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px;
}
.game-tile {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: start;
  cursor: pointer;
  transition: border-color 0.14s var(--ease), background-color 0.14s var(--ease), transform 0.15s var(--ease);
}
@media (hover: hover) {
  .game-tile:hover { border-color: var(--border-strong); background: var(--bg-subtle); }
}
.game-tile:active { transform: scale(0.97); }
.game-tile.selected { border-color: var(--accent); background: var(--accent-soft); }
.game-tile-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.game-tile .g-title { font-weight: 700; font-size: 13px; margin: 0; }
.game-tile .g-sub { font-size: 11.5px; color: var(--text-muted); display: flex; justify-content: space-between; gap: 4px; }

/* ============== Trackstats 2026 Visual Architecture ============== */
.ts-game-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ts-game-logo {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  outline: 1px solid var(--img-outline);
  outline-offset: -1px;
}

.ws-item-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
  vertical-align: middle;
}
.ws-icon-svg { display: inline-flex; width: 100%; height: 100%; }
.ws-icon-svg svg { width: 100%; height: 100%; display: block; }
.ws-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ts-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.ts-kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--ok);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  transition: box-shadow 0.16s var(--ease), transform 0.16s var(--ease), border-color 0.16s var(--ease);
}
.ts-kpi-grid .ts-kpi-card:nth-child(2) { border-inline-start-color: #bef264; }
.ts-kpi-grid .ts-kpi-card:nth-child(3) { border-inline-start-color: #f43f5e; }
.ts-kpi-grid .ts-kpi-card:nth-child(4) { border-inline-start-color: #f59e0b; }
.ts-kpi-grid .ts-kpi-card:nth-child(5) { border-inline-start-color: #38bdf8; }
.ts-kpi-grid .ts-kpi-card:nth-child(6) { border-inline-start-color: #a855f7; }
@media (hover: hover) {
  .ts-kpi-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
    transform: translateY(-1px);
  }
}
.ts-kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.ts-kpi-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ts-kpi-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 3px;
  border-radius: 5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.ts-kpi-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.ts-kpi-val-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.ts-kpi-val {
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0.015em;
  font-variant-numeric: tabular-nums;
}
.ts-rate-pill {
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 3px;
  transform: skewX(-10deg);
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.ts-pct-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  font-style: italic;
  color: var(--ok);
}

/* 24h Activity Bar */
.ts-activity-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 15px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.ts-activity-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}
.ts-spark {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(24, minmax(4px, 1fr));
  align-items: end;
  gap: 4px;
  height: 22px;
  max-width: 720px;
}
.ts-spark-col {
  border-radius: 3px;
  background: var(--border-strong);
  min-height: 3px;
  transition: height 0.2s var(--ease), background-color 0.15s var(--ease);
}
.ts-spark-col.lit { background: var(--ok); }

/* Grouped Catalog Filter Panel */
.ts-catalog-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.ts-catalog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.ts-catalog-title {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}
.ts-catalog-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.ts-cat-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: var(--bg-subtle);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s var(--ease), opacity 0.16s var(--ease), filter 0.16s var(--ease), border-color 0.14s var(--ease), background-color 0.14s var(--ease);
}
@media (hover: hover) {
  .ts-cat-pill:hover {
    transform: translateY(-1px);
    opacity: 1;
    filter: none;
    border-color: var(--border-strong);
    background: var(--bg-hover);
  }
}
.ts-cat-pill:not(:disabled):active { transform: scale(0.96); }
.ts-cat-pill.zero {
  opacity: 0.45;
  filter: grayscale(0.55);
}
@media (hover: hover) {
  .ts-cat-pill.zero:hover { opacity: 0.94; filter: grayscale(0.05); }
}
.ts-cat-pill.has-items {
  border-color: var(--border);
  background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}
.ts-cat-pill.active {
  opacity: 1 !important;
  filter: none !important;
  border-color: var(--accent) !important;
  background: var(--accent-soft) !important;
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.ts-cat-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
}
.ts-cat-count {
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
}
.ts-cat-pill.has-items .ts-cat-count { color: var(--text); }

/* Toolbar & Inline chips */
.ts-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.ts-toolbar-left, .ts-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ts-icon-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 260px;
}
.ts-inline-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* Grid Card View */
.ts-grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(295px, 1fr));
  gap: 14px;
}
.ts-acc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-inline-start: 3px solid var(--accent);
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  min-width: 0;
}
.ts-acc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ts-acc-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  font-size: 12px;
}
.ts-acc-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 9px;
  background: var(--bg-subtle);
  border-radius: 6px;
  font-weight: 600;
}

/* Visual Inventory Modal Grid */
.ws-inv-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.ws-inv-card {
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
}
.ws-inv-name { font-size: 12.5px; font-weight: 700; line-height: 1.25; }

/* Rarity outlines */
.rar-chroma { border-color: rgba(168, 85, 247, 0.72) !important; box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.25); }
.rar-mythic { border-color: rgba(239, 68, 68, 0.52) !important; }
.rar-legend { border-color: rgba(245, 158, 11, 0.52) !important; }
.rar-rare { border-color: rgba(59, 130, 246, 0.45) !important; }

/* Modals & Toasts */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.56);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 90;
}
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 700px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  animation: modalPop 0.2s var(--ease);
}
.modal.sm { max-width: 500px; }
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 1.15;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.modal-body { padding: 18px 20px; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast-root {
  position: fixed;
  inset-inline-end: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 120;
}
.toast {
  background: var(--dark-pill);
  color: var(--dark-pill-text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.18s var(--ease);
}

@media (max-width: 960px) {
  .auth-grid { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset-inline-start: -260px; transition: inset-inline-start 0.2s var(--ease); }
  .sidebar.open { inset-inline-start: 0; }
  .menu-toggle { display: inline-flex; }
  .grid-4, .grid-3, .grid-2, .game-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .content { padding: 16px 14px 40px; }
  .ws-inv-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .input, select.input, textarea.input { font-size: 16px; }
}

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