.topbar {
  height: var(--header);
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: var(--left) minmax(440px, 1fr) auto;
  align-items: center;
  border-bottom: 1px solid rgba(26, 27, 46, .07);
  background: rgba(255, 255, 255, .60);
  backdrop-filter: saturate(200%) blur(26px);
  -webkit-backdrop-filter: saturate(200%) blur(26px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65);
}
.brand-wrap { height: 100%; display: flex; align-items: center; gap: 10px; padding: 0 22px; border-right: 1px solid rgba(26, 27, 46, .07); }
.brand { font-family: "DM Serif Display", Georgia, serif; font-size: 31px; letter-spacing: -.05em; line-height: 1; color: #0d0d14; }
.brand-dot { display: inline-block; width: 7px; height: 7px; margin-left: 4px; border-radius: 50%; background: var(--violet); }
.brand-beta { align-self: flex-start; margin-top: 22px; font-size: 10px; letter-spacing: .12em; color: var(--subtle); text-transform: uppercase; }
.primary-nav { display: flex; align-items: stretch; height: 100%; gap: 6px; padding-left: 24px; }
.nav-btn {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.nav-btn:hover { color: var(--text); }
.nav-btn[aria-selected="true"] { color: var(--text); }
.nav-btn[aria-selected="true"]::after { content: ""; position: absolute; height: 2px; left: 14px; right: 14px; bottom: -1px; background: var(--violet); }
.live-pill, .demo-pill, .status-pill, .tag, .mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
}
.live-pill { align-self: center; padding: 5px 11px 5px 9px; font-size: 12px; color: var(--muted); margin-left: 10px; background: rgba(255, 255, 255, .55); border-color: rgba(26, 27, 46, .09); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(34, 197, 94, .38); animation: pulse 2.8s ease-out infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); } }
.top-actions { display: flex; align-items: center; gap: 10px; padding: 0 20px; }
.demo-pill { color: var(--violet); background: var(--violet-soft); border-color: rgba(93, 78, 232, .24); padding: 5px 11px; font-size: 11px; letter-spacing: 0; text-transform: none; }
.avatar-btn { width: 36px; height: 36px; display: grid; place-items: center; border: 0; box-shadow: 0 0 0 1px var(--line-strong); background: var(--surface-2); border-radius: 50%; cursor: pointer; font-weight: 700; font-size: 13px; transition: box-shadow .18s; }
.avatar-btn:hover { box-shadow: 0 0 0 2px var(--violet); }

.app-shell { display: grid; grid-template-columns: var(--left) minmax(0, 1fr) var(--right); min-height: calc(100vh - var(--header)); }
.left-rail { position: sticky; top: var(--header); height: calc(100vh - var(--header)); border-right: 1px solid var(--line); padding: 16px 12px; overflow-y: auto; overflow-x: hidden; background: var(--surface); scrollbar-width: thin; scrollbar-color: transparent transparent; transition: width .18s ease, box-shadow .18s ease; }
.left-rail::-webkit-scrollbar { width: 7px; }
.left-rail::-webkit-scrollbar-track { background: transparent; }
.left-rail::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background-clip: content-box; background-color: transparent; }
.left-rail:hover { scrollbar-color: var(--line-strong) transparent; }
.left-rail:hover::-webkit-scrollbar-thumb { background-color: var(--line-strong); }
.rail-label { margin: 0 4px 9px; color: var(--subtle); font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.publish-btn, .primary-btn, .secondary-btn, .ghost-btn, .bid-btn {
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 700;
  transition: transform .16s ease, background .16s ease, border-color .16s ease, color .16s ease;
}
.publish-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 12px; color: #ffffff; background: var(--violet); margin-bottom: 20px; font-size: 13.5px; white-space: nowrap; }
.publish-btn:hover, .primary-btn:hover, .bid-btn:hover { background: var(--violet-strong); transform: translateY(-1px); }
.category-list { display: grid; gap: 5px; margin-bottom: 20px; }
.category-btn {
  width: 100%; display: flex; align-items: center; gap: 10px;
  border: 1px solid transparent; border-radius: 10px; background: transparent;
  padding: 8px 10px; color: var(--muted); cursor: pointer; text-align: left; font-size: 13.5px; font-weight: 500;
  transition: background .15s, color .15s, box-shadow .18s;
}
.category-btn:hover { background: var(--violet-soft); color: var(--text); }
.category-btn[aria-pressed="true"] { color: #ffffff; background: var(--violet); border-color: var(--violet); box-shadow: 0 6px 16px rgba(93, 78, 232, .28); }
.category-btn .count { margin-left: auto; color: var(--subtle); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.category-btn[aria-pressed="true"] .count { color: rgba(255, 255, 255, .75); }
.cat-icon { width: 20px; height: 20px; display: grid; place-items: center; color: var(--subtle); }
.category-btn[aria-pressed="true"] .cat-icon { color: #ffffff; }
.rail-divider { height: 1px; background: var(--line); margin: 16px 4px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 4px; color: var(--muted); font-size: 13px; cursor: pointer; }
.switch { position: relative; width: 38px; height: 22px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: absolute; inset: 0; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface-2); transition: .2s; }
.switch-track::after { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%; background: var(--muted); transition: .2s; }
.switch input:checked + .switch-track { border-color: rgba(34, 197, 94, .55); background: var(--mint-soft); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: var(--mint); }
.profile-mini { border: 1px solid var(--line); border-radius: 14px; padding: 13px; background: var(--surface-2); }
.profile-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.profile-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; color: #ffffff; background: linear-gradient(135deg, #8b7ff0, #5d4ee8); font-weight: 800; font-size: 12px; }
.profile-name { font-size: 14px; font-weight: 600; }
.profile-copy { color: var(--subtle); font-size: 12px; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini-stat { border: 1px solid var(--line); border-radius: 9px; padding: 8px 9px; background: var(--surface); }
.mini-stat b { display: block; font-size: 16px; font-weight: 600; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }
.mini-stat span { color: var(--subtle); font-size: 10.5px; }

.avatar-btn, .profile-avatar { position: relative; overflow: hidden; }
.avatar-btn img, .profile-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.rail-toggle {
  position: sticky; top: 0; z-index: 6;
  display: grid; place-items: center;
  width: 24px; height: 24px; margin: 0 0 10px auto;
  border: 0; border-radius: 7px; background: transparent;
  color: var(--subtle); cursor: pointer;
  transition: color .15s, background .15s;
}
.rail-toggle:hover { color: var(--violet); background: var(--violet-soft); }
.rail-toggle .icon { width: 15px; height: 15px; transition: transform .2s ease; }

.rail-collapsed .app-shell { grid-template-columns: 62px minmax(0, 1fr) var(--right); }
.rail-collapsed .market { grid-column: 2; }
.rail-collapsed .deal-room { grid-column: 3; }
.rail-collapsed .left-rail { position: fixed; top: var(--header); left: 0; bottom: 0; width: 62px; height: auto; z-index: 45; }
.rail-collapsed .left-rail.rail-open { width: var(--left); box-shadow: 0 18px 48px rgba(26, 27, 46, .14); }
.rail-collapsed .brand-wrap { border-right: 0; }
.rail-collapsed .rail-toggle .icon { transform: rotate(180deg); }

.rail-collapsed .left-rail:not(.rail-open) .rail-label,
.rail-collapsed .left-rail:not(.rail-open) .rail-divider,
.rail-collapsed .left-rail:not(.rail-open) .switch-row,
.rail-collapsed .left-rail:not(.rail-open) .profile-mini,
.rail-collapsed .left-rail:not(.rail-open) .publish-btn span,
.rail-collapsed .left-rail:not(.rail-open) .category-btn > span:not(.cat-icon) { display: none; }
.rail-collapsed .left-rail:not(.rail-open) .rail-toggle { margin: 0 auto 10px; }
.rail-collapsed .left-rail:not(.rail-open) .publish-btn,
.rail-collapsed .left-rail:not(.rail-open) .category-btn { justify-content: center; padding-left: 0; padding-right: 0; }

.role-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); }
.role-btn { border: 0; border-radius: 999px; padding: 5px 11px; background: transparent; color: var(--subtle); cursor: pointer; font-size: 11.5px; font-weight: 600; transition: background .15s, color .15s; }
.role-btn:hover { color: var(--text); }
.role-btn.on { color: #ffffff; background: var(--violet); }
@media (max-width: 430px) { .role-btn { padding: 5px 9px; font-size: 11px; } }
