/*
 * Manoj Engine Studio — Bluestuff's design system. The Studio is an engine inside Bluestuff's dashboard, so it uses
 * Bluestuff's tokens, type, shell and components (BLUESTUFF/mcp-client: src/index.css shadcn "new-york"/slate tokens,
 * DashboardHeader.tsx, Sidebar.tsx, components/ui/*, ne-games.css). Light by default with the same .dark / .light class
 * on <html> and the same "bs-theme" key (theme-init.js). Page groups keep their own files in css/*.css.
 */
@import url('./fonts/inter.css');
@import url('./fonts/dm-sans.css'); /* only the tile renderer's default title font */

:root, :host {
  color-scheme: light;
  --font-brand: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Bluestuff index.css :root (light) */
  --background: #ffffff;
  --foreground: #0f1729;
  --card: #ffffff;
  --popover: #ffffff;
  --primary: #2463eb;
  --primary-foreground: #ffffff;
  --secondary: #f1f5f9;
  --secondary-foreground: #0f1729;
  --muted: #f1f5f9;
  --muted-foreground: #65758b;
  --accent: #f1f5f9;
  --accent-foreground: #0f1729;
  --destructive: #e42525;
  --border: #e1e7ef;
  --input: #e1e7ef;
  --ring: var(--primary);
  --text-mid: #3a4868;

  /* derived (Tailwind opacity steps Bluestuff uses: primary/90, primary/10, muted/30, muted/50) */
  --primary-press: color-mix(in srgb, var(--primary) 90%, var(--background));
  --primary-tint-12: color-mix(in srgb, var(--primary) 10%, transparent);
  --primary-tint-24: color-mix(in srgb, var(--primary) 24%, transparent);
  --primary-300: var(--primary);
  --sidebar-accent: color-mix(in srgb, var(--primary) 10%, transparent);
  --muted-30: color-mix(in srgb, var(--muted) 55%, transparent);
  --muted-50: color-mix(in srgb, var(--muted) 85%, transparent);
  --chip-bg: color-mix(in srgb, var(--foreground) 6%, transparent);
  --hover-faint: color-mix(in srgb, var(--foreground) 3%, transparent);
  --scrim: rgba(15, 23, 42, .72);
  --hairline: var(--border);
  --control-border: var(--input);
  --input-bg: var(--background);
  --input-border: var(--input);

  /* slate steps (old grey-* names kept for the page groups) */
  --grey-950: #f8fafc;
  --grey-850: #f8fafc;
  --grey-800: #f1f5f9;
  --grey-700: #e2e8f0;
  --grey-600: #e1e7ef;
  --grey-500: #cbd5e1;
  --grey-300: #94a3b8;

  /* status: Bluestuff pills (green/amber/red -600/-700 on -100) */
  --success: #16a34a;
  --success-tint-12: #dcfce7;
  --warning: #b45309;
  --warning-tint-12: #fef3c7;
  --danger: #dc2626;
  --danger-tint-12: #fee2e2;
  --orange: #ea580c;
  --partner-yellow: #f59e0b;
  --star: #f59e0b;
  --toast-ok-bg: #ecfdf3; --toast-ok-border: #bbf7d0; --toast-ok-text: #15803d;
  --toast-err-bg: #fef2f2; --toast-err-border: #fecaca; --toast-err-text: #b91c1c;

  /* Bluestuff --chart-1..4 */
  --chart-1: var(--primary);
  --chart-2: hsl(142 71% 45%);
  --chart-3: hsl(38 92% 50%);
  --chart-4: hsl(280 65% 60%);

  /* radius: Bluestuff --radius .625rem; rounded-md 8px, rounded-xl 12px */
  --radius-tag: 6px;
  --radius-field: 8px;
  --radius-card: 12px;
  --radius-card-lg: 12px;
  --radius-control: 8px;

  /* Tailwind shadows as Bluestuff uses them */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);

  --ease-brand-out: cubic-bezier(.16, 1, .3, 1);
  --ease-brand-accelerate: cubic-bezier(.6, 0, .3, 1);

  /* Bluestuff shell: header ≈57px (p-3 + 32px controls + border), sidebar w-64 */
  --topbar-h: 57px;
  --sidebar-w: 256px;
  --gamebar-w: 260px;
}

/* Bluestuff index.css .dark */
.dark, :host([data-theme="dark"]) {
  color-scheme: dark;
  --background: #060b13;
  --foreground: #edf1f8;
  --card: #0a111e;
  --popover: #0a111e;
  --primary: #3c83f6;
  --secondary: #121a2b;
  --secondary-foreground: #edf1f8;
  --muted: #121a2b;
  --muted-foreground: #8a93a8;
  --accent: #1a2438;
  --accent-foreground: #edf1f8;
  --destructive: #dc2828;
  --border: #1f2228;
  --input: #262931;
  --text-mid: #b8c0d2;
  --grey-950: #060b13;
  --grey-850: #0a111e;
  --grey-800: #121a2b;
  --grey-700: #1a2438;
  --grey-600: #262931;
  --grey-500: #334155;
  --grey-300: #8a93a8;
  --success: #4ade80;
  --success-tint-12: rgba(34, 197, 94, .15);
  --warning: #fcd34d;
  --warning-tint-12: rgba(245, 158, 11, .15);
  --danger: #f87171;
  --danger-tint-12: rgba(239, 68, 68, .15);
  --orange: #fb923c;
  --toast-ok-bg: #001f0f; --toast-ok-border: #003d1c; --toast-ok-text: #59f3a6;
  --toast-err-bg: #2d0607; --toast-err-border: #4d0408; --toast-err-text: #ff9ea1;
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .4), 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .5), 0 4px 12px rgba(0, 0, 0, .3);
}

*, *::before, *::after { box-sizing: border-box; border-color: var(--border); }
html, body { margin: 0; height: 100%; }
body, :host {
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-brand);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }
input, textarea, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
::selection { background: var(--primary-tint-24); }
.sr-only { position: absolute; top: 0; left: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted-foreground); }
.mono { font-family: var(--font-mono); }
.success { color: var(--success); }
.danger { color: var(--danger); }
.warning { color: var(--warning); }
.nowrap { white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.wrap { flex-wrap: wrap; }
.icon { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: middle; }
.icon svg { width: 100%; height: 100%; display: block; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .5; } }

/* ---------------------------------------------------------------- app shell: Bluestuff DashboardHeader + Sidebar */
.app { display: flex; flex-direction: column; min-height: var(--vh, 100vh); }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px;
  border-bottom: 1px solid var(--border); background: var(--background);
}
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 16px; flex: none; }
.bs-home { display: inline-flex; align-items: center; gap: 8px; transition: opacity .15s; min-width: 0; }
.bs-home:hover { opacity: .8; }
.bs-badge { width: 32px; height: 32px; flex: none; border-radius: 999px; background: var(--primary); color: var(--primary-foreground); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; }
.bs-org { font-size: 16px; line-height: 24px; font-weight: 500; white-space: nowrap; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; list-style: none; margin: 0; padding: 0; }
.crumbs li { display: flex; align-items: center; min-width: 0; white-space: nowrap; }
.crumbs li.c-home { flex: none; }
.crumbs .sep { color: var(--muted-foreground); }
.crumbs a, .crumbs span { font-size: 14px; line-height: 20px; font-weight: 500; color: var(--muted-foreground); overflow: hidden; text-overflow: ellipsis; }
.crumbs a:hover { color: var(--foreground); }
.crumbs .c-studio a, .crumbs .c-studio span { color: var(--primary); }
.crumbs .current { color: var(--foreground); }
.crumbs .bs-org { color: var(--foreground); font-size: 16px; line-height: 24px; overflow: visible; }
.crumbs .bs-badge { color: var(--primary-foreground); font-size: 14px; line-height: 1; overflow: visible; }
.brand-mark { width: 20px; height: 20px; flex: none; display: block; color: var(--primary); }

/* Button variant="outline" size="sm" (header controls) */
.icon-btn, .search-btn {
  height: 32px; min-width: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--input); background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm);
  font-size: 12px; font-weight: 500; white-space: nowrap; transition: background .15s, color .15s;
}
.icon-btn { padding: 0 8px; }
.topbar .icon-btn { padding: 0 12px; }
.icon-btn:hover, .search-btn:hover { background: var(--accent); color: var(--accent-foreground); }
.icon-btn.plain { border-color: transparent; background: transparent; box-shadow: none; }
.icon-btn.plain:hover { background: var(--accent); }
.search-btn { color: var(--muted-foreground); }
.search-btn .kbd { display: flex; align-items: center; gap: 2px; padding: 0 4px; height: 18px; border: 1px solid var(--border); border-radius: 4px; background: var(--muted); font-size: 10px; font-weight: 500; }
.search-btn .kbd .icon { width: 10px; height: 10px; }
/* UserMenu trigger: rounded-md border, 24px gradient avatar with initials, chevron */
.avatar-btn {
  height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0 8px 0 4px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; transition: background .15s;
}
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { background: var(--muted); }
.avatar-btn .avatar-initials {
  width: 24px; height: 24px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 80%, var(--background))); color: var(--primary-foreground); font-size: 11px; font-weight: 600;
}
.avatar-btn .avatar-initials img { width: 100%; height: 100%; object-fit: cover; }
.avatar-btn .icon { width: 14px; height: 14px; color: var(--muted-foreground); }
.user-card { padding: 16px; border-bottom: 1px solid var(--border); background: var(--muted-30); margin: -4px -4px 4px; border-radius: 8px 8px 0 0; display: flex; align-items: center; gap: 12px; }
.user-card .avatar-initials { width: 40px; height: 40px; font-size: 14px; }
.mobile-only { display: none !important; }

.shell { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--background); display: flex; flex-direction: column; border-right: 1px solid var(--border);
  position: sticky; top: var(--topbar-h); height: calc(var(--vh, 100vh) - var(--topbar-h));
}
.sb-block { padding: 12px; border-bottom: 1px solid var(--border); background: var(--background); }
.sb-engine { display: flex; flex-direction: column; gap: 12px; flex: none; }
.sb-engine-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sb-engine-row > .icon { color: var(--primary); }
.sb-title { flex: 1; min-width: 0; font-size: 14px; line-height: 20px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-collapse { width: 28px; height: 28px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted-foreground); flex: none; }
.sb-collapse:hover { background: var(--muted); color: var(--foreground); }
.sb-team {
  width: 100%; height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--input);
  background: var(--background); box-shadow: var(--shadow-sm); font-size: 14px; font-weight: 500; text-align: left;
}
.sb-team:hover { background: var(--accent); }
.sb-team .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-team .icon { color: var(--muted-foreground); }
.sb-nav { flex: none; max-height: 60%; overflow-y: auto; scrollbar-width: thin; }
.sb-host { flex: 1 1 auto; min-height: 0; overflow-y: auto; border-bottom: 0; scrollbar-width: thin; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sb-label { display: flex; align-items: center; gap: 8px; width: 100%; padding: 0 0 8px; font-size: 14px; line-height: 20px; font-weight: 600; text-align: left; }
.sb-label > .icon:last-child { margin-left: 4px; transition: transform .15s; }
.sb-host.closed .sb-label { padding-bottom: 0; }
.sb-host.closed .sb-label > .icon:last-child { transform: rotate(-90deg); }
.sb-host.closed { flex: none; }
.sb-label .icon { color: var(--muted-foreground); }
.sb-label .hint { margin-left: auto; font-size: 12px; font-weight: 400; color: var(--muted-foreground); }
/* nav item: px-3 py-2.5 rounded-md text-sm font-medium; active bg-primary/10 text-primary */
.nav-item {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 10px 12px; border-radius: 8px; color: color-mix(in srgb, var(--foreground) 70%, transparent);
  font-size: 14px; line-height: 20px; font-weight: 500; white-space: nowrap; transition: background .15s, color .15s;
}
.nav-item:hover { color: var(--foreground); background: var(--muted); }
.nav-item.active { background: var(--sidebar-accent); color: var(--primary); }
.nav-item.within { color: var(--primary); }
.nav-item .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-item .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--primary); color: var(--primary-foreground); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.nav-item .ext { width: 12px; height: 12px; color: var(--muted-foreground); }
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sb-title, .sidebar.collapsed .sb-team, .sidebar.collapsed .sb-host, .sidebar.collapsed .nav-item .label,
.sidebar.collapsed .nav-item .count, .sidebar.collapsed .nav-item .ext { display: none; }
.sidebar.collapsed .sb-engine-row { flex-direction: column; gap: 8px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; }

.gamebar {
  width: var(--gamebar-w); flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--background);
  position: sticky; top: var(--topbar-h); height: calc(var(--vh, 100vh) - var(--topbar-h)); overflow-y: auto;
}
.gamebar-head { display: flex; flex-direction: column; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.gamebar-cover { position: relative; height: 80px; background: linear-gradient(135deg, var(--primary), #3b82f6 60%, #38bdf8); display: block; overflow: hidden; }
.gamebar-cover img { width: 100%; height: 100%; object-fit: cover; }
.gamebar-cover .hover-label, .gamebar-tile .hover-label {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; flex-direction: column;
  background: var(--scrim); color: #fff; opacity: 0; transition: opacity .15s; font-size: 13px; font-weight: 600;
}
.gamebar-cover:hover .hover-label, .gamebar-tile:hover .hover-label { opacity: 1; }
.gamebar-stars { position: absolute; right: 8px; top: 8px; display: flex; gap: 2px; padding: 4px 6px; border-radius: 999px; background: var(--scrim); }
.gamebar-stars .icon { width: 14px; height: 14px; color: var(--star); }
.gamebar-stars .icon svg { fill: currentColor; }
.gamebar-id { display: flex; align-items: flex-end; gap: 12px; padding: 0 16px; margin-top: -52px; position: relative; }
.gamebar-tile { position: relative; width: 72px; height: 96px; flex: none; border-radius: 8px; border: 1px solid var(--border); background: var(--muted); overflow: hidden; display: block; box-shadow: var(--shadow-md); }
.gamebar-tile img { width: 100%; height: 100%; object-fit: cover; }
.gamebar-tile .hover-label { font-size: 9px; gap: 4px; }
.gamebar-names { display: flex; flex-direction: column; gap: 2px; padding-bottom: 2px; min-width: 0; }
.gamebar-names .name { font-size: 16px; line-height: 22px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gamebar-names .team { font-size: 13px; line-height: 18px; color: var(--muted-foreground); }
.gamebar-play { padding: 0 16px; }
.gamebar nav { display: flex; flex-direction: column; gap: 4px; padding: 12px; }

.main { flex: 1; min-width: 0; padding-bottom: 64px; }
/* GameDevPageShell: p-8, max-w-7xl mx-auto, h1 text-2xl font-bold, subtitle text-sm muted */
.page-head, .page-body { width: 100%; max-width: calc(1280px + 64px); margin-left: auto; margin-right: auto; }
.page-head { padding: 32px 32px 0; }
.page-head-row { display: flex; align-items: center; gap: 16px; min-height: 36px; }
.page-title { font-size: 24px; line-height: 32px; font-weight: 700; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; max-width: 100%; }
.page-body { padding: 24px 32px 0; display: flex; flex-direction: column; gap: 24px; }
.page-sub { color: var(--muted-foreground); font-size: 14px; margin-top: 4px; }

/* ---------------------------------------------------------------- buttons: components/ui/button.tsx */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: var(--radius-control);
  font-size: 14px; line-height: 20px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; transition: background .15s, color .15s, opacity .15s, border-color .15s;
}
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow); }
.btn-primary:hover:not(:disabled) { background: var(--primary-press); }
.btn-outline { border-color: var(--input); background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }
.btn-outline:hover:not(:disabled) { background: var(--accent); color: var(--accent-foreground); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: color-mix(in srgb, var(--secondary) 80%, var(--foreground) 6%); }
.btn-ghost { color: var(--foreground); }
.btn-ghost:hover:not(:disabled) { background: var(--accent); color: var(--accent-foreground); }
.btn-danger { background: var(--destructive); color: #fff; box-shadow: var(--shadow-sm); }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--destructive) 90%, var(--background)); }
.btn-danger-outline { border-color: color-mix(in srgb, var(--destructive) 50%, transparent); background: var(--background); color: var(--destructive); }
.btn-danger-outline:hover:not(:disabled) { background: color-mix(in srgb, var(--destructive) 10%, transparent); }
.btn:disabled { opacity: .5; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; line-height: 16px; }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; }
.link-btn { color: var(--primary); text-underline-offset: 4px; }
.link-btn:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- inputs: ui/input.tsx, label.tsx, select.tsx */
.input, .textarea, .select-trigger {
  width: 100%; height: 40px; padding: 0 12px; background: var(--input-bg); border: 1px solid var(--input-border); border-radius: var(--radius-field);
  color: var(--foreground); font-size: 14px; outline: none; transition: box-shadow .15s, border-color .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--muted-foreground); }
.input:focus, .textarea:focus, .select-trigger:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
.input:disabled, .textarea:disabled, .select-trigger:disabled { opacity: .5; cursor: not-allowed; }
.input.lg { height: 44px; }
.input.invalid, .textarea.invalid { border-color: var(--destructive); }
.input.invalid:focus, .textarea.invalid:focus { box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--destructive); }
.textarea { height: auto; min-height: 80px; padding: 8px 12px; resize: vertical; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 14px; line-height: 20px; font-weight: 500; }
.field-hint { font-size: 12px; line-height: 16px; color: var(--muted-foreground); }
.field-error { font-size: 12px; line-height: 16px; color: var(--danger); }
.select-trigger { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; }
.select-trigger .icon { color: var(--muted-foreground); opacity: .7; }
.checkbox { width: 16px; height: 16px; accent-color: var(--primary); }
/* ui/switch.tsx: h-5 w-9, bg-input off / bg-primary on, h-4 w-4 thumb bg-background shadow-lg */
.switch { position: relative; width: 36px; height: 20px; border-radius: 999px; border: 2px solid transparent; background: var(--input); transition: background .15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 0; left: 0; width: 16px; height: 16px; border-radius: 50%; background: var(--background); box-shadow: var(--shadow-lg); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--primary); }
.switch[aria-checked="true"]::after { transform: translateX(16px); }
.switch:disabled { opacity: .5; }

/* ---------------------------------------------------------------- pills (outline-sm triggers), chips, badges */
.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--input);
  background: var(--background); box-shadow: var(--shadow-sm); font-size: 13px; line-height: 20px; font-weight: 500; color: var(--foreground); white-space: nowrap;
}
.pill .icon { width: 14px; height: 14px; color: var(--muted-foreground); }
.pill:hover { background: var(--accent); }
.pill.active { background: var(--sidebar-accent); border-color: color-mix(in srgb, var(--primary) 30%, transparent); color: var(--primary); }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 12px; font-weight: 500; color: var(--muted-foreground); background: var(--background);
}
.chip:hover { background: var(--muted); color: var(--foreground); }
.chip.active { color: var(--primary); border-color: color-mix(in srgb, var(--primary) 30%, transparent); background: var(--sidebar-accent); }
/* ui/badge.tsx: rounded-md border px-2.5 py-0.5 text-xs font-semibold */
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: var(--radius-tag); background: var(--secondary); color: var(--secondary-foreground); font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag.pink { background: var(--primary-tint-12); color: var(--primary); }
.tag.green { background: var(--success-tint-12); color: var(--success); }
.tag.amber { background: var(--warning-tint-12); color: var(--warning); }
.tag.red { background: var(--danger-tint-12); color: var(--danger); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.amber { background: var(--warning-tint-12); color: var(--warning); }
.badge.red { background: var(--danger-tint-12); color: var(--danger); }
.badge.green { background: var(--success-tint-12); color: var(--success); }
.badge.pink { background: var(--primary-tint-12); color: var(--primary); }

/* ---------------------------------------------------------------- cards / stats: ui/card.tsx (rounded-xl border bg-card shadow) */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 24px; box-shadow: var(--shadow); }
.card-tight { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 16px; box-shadow: var(--shadow); }
.card-title { font-size: 16px; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; box-shadow: var(--shadow); }
.stat-label { color: var(--muted-foreground); font-size: 14px; line-height: 20px; font-weight: 500; }
.stat-value { font-size: 24px; line-height: 32px; font-weight: 700; min-height: 36px; display: flex; align-items: center; font-variant-numeric: tabular-nums; }
.stat-value.positive { color: var(--success); }
.stat-value.negative { color: var(--danger); }
.chart-box { height: 120px; position: relative; }
.chart-box svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart-axis { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; line-height: 15px; color: var(--muted-foreground); }
.chart-tip { position: absolute; pointer-events: none; transform: translate(-50%, -110%); background: var(--popover); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 12px; white-space: nowrap; z-index: 2; box-shadow: var(--shadow-md); }
.section-title { font-size: 18px; line-height: 28px; font-weight: 600; }
.section-h2 { font-size: 15px; line-height: 22px; font-weight: 600; }

/* ---------------------------------------------------------------- tables: GameDevGamesPage (border rounded-lg, muted/50 uppercase head) */
.rtable { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.rtable th {
  text-align: left; font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-foreground);
  padding: 12px 16px; height: 44px; white-space: nowrap; background: var(--muted-50); border-bottom: 1px solid var(--border);
}
.rtable th:first-child { border-top-left-radius: 9px; }
.rtable th:last-child { border-top-right-radius: 9px; }
.rtable th .th { display: inline-flex; align-items: center; gap: 8px; }
.rtable th.num, .rtable td.num { text-align: right; }
.rtable th.center, .rtable td.center { text-align: center; }
.rtable td { padding: 12px 16px; font-size: 14px; vertical-align: middle; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.rtable tbody:first-child tr:first-child td, .rtable thead + tbody tr:first-child td { border-top: 0; }
.rtable > :last-child > tr:last-child > td:first-child { border-bottom-left-radius: 9px; }
.rtable > :last-child > tr:last-child > td:last-child { border-bottom-right-radius: 9px; }
.rtable tr.clickable { cursor: pointer; }
.rtable tbody tr:hover td { background: var(--muted-30); }
.rtable tr.total td, .rtable tfoot td { font-weight: 600; background: var(--muted-50); }
.table-scroll { width: 100%; overflow-x: auto; }
.ltable { width: 100%; border-collapse: collapse; }
.ltable th { text-align: left; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-foreground); font-weight: 500; padding: 12px 16px; background: var(--muted-50); border-bottom: 1px solid var(--border); }
.ltable td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.ltable tr:last-child td { border-bottom: 0; }
.ltable tbody tr:hover td { background: var(--muted-30); }

/* ---------------------------------------------------------------- empty / loading / error: StatePanel, .neg-empty, error banner */
.empty {
  border: 1px dashed var(--border); border-radius: 10px; padding: 48px 24px; display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: 12px; min-height: 220px; justify-content: center; background: var(--muted-30);
}
.empty-icon { display: flex; align-items: center; justify-content: center; color: color-mix(in srgb, var(--muted-foreground) 50%, transparent); }
.empty-icon .icon { width: 32px; height: 32px; }
.empty-copy { display: flex; flex-direction: column; gap: 4px; max-width: 448px; align-items: center; }
.empty-copy > div:last-child:not(.empty-title):not(.empty-text) { margin-top: 12px; }
.empty-title { font-size: 16px; line-height: 24px; font-weight: 500; }
.empty-text { color: var(--muted-foreground); font-size: 14px; line-height: 20px; }
.skeleton { background: var(--muted); border-radius: 6px; animation: pulse 2s cubic-bezier(.4, 0, .6, 1) infinite; }
.error-box { border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); background: var(--danger-tint-12); color: var(--foreground); border-radius: 8px; padding: 12px 16px; display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.error-box .icon { color: var(--danger); margin-top: 2px; }
.notice { border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: flex; gap: 12px; align-items: flex-start; background: var(--card); }
.notice .icon { margin-top: 2px; }
.notice-title { font-weight: 600; }
.notice-text { color: var(--muted-foreground); }
.notice.warn { border-color: color-mix(in srgb, var(--warning) 35%, transparent); background: var(--warning-tint-12); }
.notice.ok { border-color: color-mix(in srgb, var(--success) 35%, transparent); background: var(--success-tint-12); }
.notice.bad { border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: var(--danger-tint-12); }
.full-center { min-height: 60vh; display: flex; align-items: center; justify-content: center; }

/* ---------------------------------------------------------------- overlays: ui/dialog.tsx, popover, menus, sonner toasts */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .8); animation: overlay-in .2s ease-out; }
.dialog {
  position: fixed; z-index: 51; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(512px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  overflow-y: auto; background: var(--background); border: 1px solid var(--border); border-radius: 10px; padding: 24px; display: flex; flex-direction: column; gap: 16px;
  box-shadow: var(--shadow-lg); animation: dialog-in .2s ease-out;
}
.dialog.wide { width: min(672px, calc(100vw - 32px)); }
.dialog.xwide { width: min(960px, calc(100vw - 32px)); }
.dialog-head { display: flex; flex-direction: column; gap: 6px; padding-right: 24px; }
.dialog-title { font-size: 18px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; }
.dialog-desc { color: var(--muted-foreground); font-size: 14px; line-height: 20px; }
.dialog-close { position: absolute; right: 16px; top: 16px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; color: var(--foreground); border-radius: 4px; opacity: .7; transition: opacity .15s; }
.dialog-close:hover { opacity: 1; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@keyframes overlay-in { from { opacity: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translate(-50%, -48%) scale(.95); } }
@keyframes popover-in { from { opacity: 0; transform: translateY(-4px); } }

.popover {
  position: fixed; z-index: 60; min-width: 200px; background: var(--popover); color: var(--foreground); border: 1px solid var(--border); border-radius: 8px; padding: 4px;
  box-shadow: var(--shadow-md); animation: popover-in .14s ease-out; max-height: min(480px, calc(100vh - 80px)); overflow-y: auto;
}
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 6px 8px; border-radius: 6px; font-size: 14px; line-height: 20px; text-align: left; color: var(--foreground); }
.menu-item .icon { color: var(--muted-foreground); }
.menu-item:hover, .menu-item.hl { background: var(--accent); }
.menu-item:disabled { opacity: .5; }
.menu-item.selected { font-weight: 600; }
.menu-item .check { margin-left: auto; color: var(--primary); }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-item.danger:hover { background: color-mix(in srgb, var(--destructive) 10%, transparent); }
.menu-sep { height: 1px; background: var(--border); margin: 4px -4px; }
.menu-label { padding: 6px 8px; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted-foreground); font-weight: 600; }

.toaster { position: fixed; z-index: 80; right: 16px; top: 16px; display: flex; flex-direction: column; gap: 8px; width: min(356px, calc(100vw - 32px)); }
.toast { background: var(--popover); border: 1px solid var(--border); border-radius: 8px; padding: 16px; display: flex; gap: 10px; align-items: flex-start; box-shadow: var(--shadow-lg); animation: popover-in .14s ease-out; font-size: 13px; line-height: 18px; }
.toast .icon { margin-top: 1px; }
.toast.success { background: var(--toast-ok-bg); border-color: var(--toast-ok-border); color: var(--toast-ok-text); }
.toast.error { background: var(--toast-err-bg); border-color: var(--toast-err-border); color: var(--toast-err-text); }
.toast-title { font-weight: 500; }
.toast-desc { opacity: .9; overflow-wrap: anywhere; }

/* command palette (Ctrl/⌘ K) */
.cmdk { position: fixed; z-index: 70; left: 50%; top: 12vh; transform: translateX(-50%); width: min(640px, calc(100vw - 32px)); background: var(--popover); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow-lg); animation: popover-in .14s ease-out; }
.cmdk input { width: 100%; height: 48px; background: transparent; border: 0; border-bottom: 1px solid var(--border); padding: 0 16px 0 44px; font-size: 14px; outline: none; color: var(--foreground); }
.cmdk input::placeholder { color: var(--muted-foreground); }
.cmdk .search-icon { position: absolute; left: 16px; top: 16px; color: var(--muted-foreground); }
.cmdk-list { max-height: 50vh; overflow-y: auto; padding: 6px; }

/* ---------------------------------------------------------------- tabs: NEGamesDeployedPage underline tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { position: relative; height: 40px; padding: 8px 16px; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--muted-foreground); white-space: nowrap; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--foreground); }
.tab.active { color: var(--foreground); border-bottom-color: var(--primary); }

/* ---------------------------------------------------------------- games list */
.game-cell { display: flex; align-items: center; gap: 12px; min-width: 240px; }
.game-thumb { width: 60px; height: 80px; border-radius: 6px; overflow: hidden; background: var(--muted); flex: none; display: flex; align-items: center; justify-content: center; color: var(--muted-foreground); }
.game-thumb img { width: 100%; height: 100%; object-fit: cover; }
.game-name { font-size: 18px; line-height: 1.3; font-weight: 600; }
.playing { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted-foreground); }
.playing b { color: var(--foreground); font-weight: 500; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); display: inline-block; }

/* publishers (/dashboard): Bluestuff item cards (rounded-lg border bg-card p-4 hover:border-primary/50) */
.pub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.pub-card {
  display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--card);
  transition: border-color .15s, box-shadow .15s; min-width: 0;
}
a.pub-card:hover { border-color: color-mix(in srgb, var(--primary) 50%, transparent); box-shadow: var(--shadow-sm); }
.pub-icon { width: 36px; height: 36px; flex: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--sidebar-accent); color: var(--primary); }
.pub-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-meta { font-size: 12px; color: var(--muted-foreground); }
.pub-card > .icon:last-child { color: var(--muted-foreground); margin-left: auto; }
.head-icon { width: 36px; height: 36px; flex: none; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary), #3b82f6); color: #fff; }
.head-icon .icon { width: 20px; height: 20px; }

/* sign in: Bluestuff AuthPage ("Welcome back": 56px gradient tile, 30px title, soft card, uppercase labels, gradient button) */
.signin { min-height: 100vh; display: flex; flex-direction: column; background: var(--grey-950); }
.signin-top { height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; padding: 12px; border-bottom: 1px solid var(--border); background: var(--background); }
.signin-form { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 16px; }
.signin-inner { width: min(432px, 100%); display: flex; flex-direction: column; gap: 20px; }
.signin-head { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.signin-mark { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); box-shadow: 0 4px 20px color-mix(in srgb, var(--primary) 30%, transparent); }
.signin-mark .icon { width: 26px; height: 26px; }
.signin h1 { font-size: 30px; line-height: 36px; font-weight: 700; letter-spacing: -.02em; }
.signin-sub { color: var(--muted-foreground); font-size: 15px; }
.signin-card { border: 1px solid var(--border); border-radius: 16px; background: var(--card); box-shadow: var(--shadow-lg); padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.signin-card .field-label { font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-foreground); }
.signin-card .input { height: 44px; }
.signin-card .btn { height: 44px; font-size: 15px; font-weight: 600; }
.signin-card .btn-primary { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); border: 0; }
.signin-card .btn-primary:hover:not(:disabled) { background: linear-gradient(135deg, #5096ff 0%, #2563eb 100%); }
.divider-label { display: flex; align-items: center; gap: 12px; color: var(--muted-foreground); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; }
.divider-label::before, .divider-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.signin-art { display: none; }

/* ---------------------------------------------------------------- misc page bits */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-input { width: 256px; max-width: 100%; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; }
.kv dt { color: var(--muted-foreground); }
.kv dd { margin: 0; }
.prose { line-height: 1.6; overflow-wrap: anywhere; }
.prose p + p { margin-top: 12px; }
.prose code { font-family: var(--font-mono); font-size: .9em; background: var(--muted); border-radius: 4px; padding: 1px 4px; }
.prose pre { background: var(--grey-950); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; }
.prose ul, .prose ol { padding-left: 20px; }
.prose a { color: var(--primary); }
.hr { height: 1px; background: var(--border); border: 0; margin: 0; }
.progress { height: 6px; border-radius: 999px; background: var(--muted); overflow: hidden; }
.progress > div { height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s; }
.stars { display: inline-flex; gap: 2px; }
.stars .icon { width: 16px; height: 16px; color: var(--grey-500); }
.stars .icon.on { color: var(--star); }
.stars .icon.on svg { fill: currentColor; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.dropzone { border: 1px dashed var(--input); border-radius: 10px; padding: 32px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--muted-foreground); cursor: pointer; background: var(--muted-30); }
.dropzone.drag { border-color: var(--primary); background: var(--primary-tint-12); color: var(--foreground); }

/* ---------------------------------------------------------------- responsive (Bluestuff: sidebar becomes an overlay below md) */
/* tablets: the sidebar folds to its icon rail so pages with their own column (accounting filters, game panel) keep room */
@media (min-width: 768px) and (max-width: 1023px) {
  .sidebar { width: 64px; }
  .sidebar .sb-title, .sidebar .sb-team, .sidebar .sb-host, .sidebar .sb-collapse, .sidebar .nav-item .label, .sidebar .nav-item .count { display: none; }
  .sidebar .sb-engine-row { justify-content: center; }
  .sidebar .nav-item { justify-content: center; padding: 10px 0; }
}
@media (max-width: 767px) {
  .sidebar, .gamebar { display: none; }
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  .topbar-right { gap: 6px; }
  .crumbs li.c-mid { display: none; }
  .stat-grid, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .page-head { padding: 16px 12px 0; }
  .page-body { padding: 16px 12px 0; }
  .page-head-row { flex-wrap: wrap; }
  .page-actions { max-width: 100%; justify-content: flex-start; overflow-x: auto; flex-wrap: nowrap; }
}
@media (max-width: 600px) {
  .search-btn .label-full, .search-btn .kbd, .bs-org { display: none; }
  .page-title { font-size: 22px; line-height: 30px; }
  .search-input { width: 100%; }
  .topbar .icon-btn { padding: 0 8px; }
}
.drawer-overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .5); }
.drawer { position: fixed; z-index: 41; top: 0; bottom: 0; left: 0; width: min(256px, 86vw); background: var(--background); border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; box-shadow: var(--shadow-lg); animation: popover-in .14s ease-out; }
.drawer nav { display: flex; flex-direction: column; gap: 4px; padding: 4px 12px 12px; }
.drawer-head { height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid var(--border); }
.drawer .menu-label { padding: 12px 24px 4px; }
.mobile-search-row { display: none; }
