/* App shell — left rail + topbar + page surface */

.app {
  display: grid;
  grid-template-columns: 56px 1fr;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 80% -20%, rgba(242, 162, 89, 0.06), transparent 60%),
    radial-gradient(900px 600px at -10% 100%, rgba(226, 92, 138, 0.05), transparent 60%),
    var(--bg-0);
}

/* Left rail */
.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent 30%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 18px;
  gap: 8px;
  z-index: 10;
}

.rail-logo {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--magenta));
  color: var(--bg-0);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 8px;
  box-shadow: 0 0 0 1px var(--line-2), 0 8px 22px -6px rgba(242, 162, 89, 0.45);
}

.rail-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.12s;
  background: transparent;
  border: 0;
  position: relative;
}
.rail-btn:hover {
  background: var(--bg-2);
  color: var(--ink-0);
}
.rail-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
}
.rail-btn.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 12px var(--accent);
}
.rail-btn svg { width: 18px; height: 18px; }
.rail-spacer { flex: 1; }
.rail-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff8c66, #b85eff);
  display: grid; place-items: center;
  font-size: 11px;
  font-weight: 600;
  color: white;
}

/* Topbar */
.topbar {
  height: 52px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 14px;
  background: rgba(7, 8, 11, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: var(--fs-sm);
}
.crumbs .sep {
  opacity: 0.4;
}
.crumbs .here {
  color: var(--ink-0);
  font-weight: 500;
}

.kbd-cmd {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 4px 10px 4px 8px;
  font-size: var(--fs-xs);
  color: var(--ink-2);
  background: var(--bg-1);
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all 0.12s;
}
.kbd-cmd:hover {
  color: var(--ink-0);
  border-color: var(--line-3);
}
.kbd-cmd svg { width: 14px; height: 14px; }
.kbd-cmd .k {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 4px;
  background: var(--bg-3);
  border-radius: 3px;
  color: var(--ink-1);
}

.top-action {
  border: 1px solid var(--line-2);
  background: var(--bg-1);
  color: var(--ink-1);
  padding: 5px 11px;
  border-radius: 6px;
  font-size: var(--fs-sm);
  cursor: pointer;
}
.top-action:hover { color: var(--ink-0); border-color: var(--line-3); }

/* Page surface */
.page {
  min-height: calc(100vh - 52px);
  padding: 28px 40px 80px;
}
.page-wide { max-width: 1400px; margin: 0 auto; }
.page-narrow { max-width: 880px; margin: 0 auto; }

/* Common typography */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.h-display {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 32px;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0;
  color: var(--ink-0);
}
.h-section {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: -0.01em;
  margin: 0;
}
.muted { color: var(--ink-2); }
.mono { font-family: var(--font-mono); }

/* Surfaces */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  position: relative;
}
.card-pad { padding: 20px; }
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head .h-section { flex: 1; }

/* Buttons */
.btn {
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  color: var(--ink-1);
  padding: var(--pad-y) var(--pad-x);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.12s;
  height: var(--row-h);
  font-weight: 500;
}
.btn:hover { color: var(--ink-0); border-color: var(--line-3); background: var(--bg-3); }
.btn.primary {
  background: var(--accent);
  color: var(--bg-0);
  border-color: var(--accent);
  font-weight: 600;
}
.btn.primary:hover {
  background: oklch(from var(--accent) calc(l + 0.04) c h);
  color: var(--bg-0);
  box-shadow: 0 0 24px -6px var(--accent);
}
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.danger { color: var(--danger); border-color: var(--line-2); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--line-2);
  font-size: 11px;
  color: var(--ink-1);
  background: var(--bg-2);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}
.chip.accent { color: var(--accent); border-color: rgba(242, 162, 89, 0.3); background: var(--accent-soft); }
.chip.magenta { color: var(--magenta); border-color: rgba(226, 92, 138, 0.3); background: var(--magenta-soft); }
.chip.amber { color: var(--amber); border-color: rgba(255, 181, 71, 0.3); background: var(--amber-soft); }
.chip.violet { color: var(--violet); border-color: rgba(155, 140, 255, 0.3); background: var(--violet-soft); }
.chip.ghost { background: transparent; }
.chip.dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }

/* Inputs */
.input {
  width: 100%;
  height: var(--row-h);
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  color: var(--ink-0);
  padding: 0 12px;
  font-family: inherit;
  font-size: var(--fs-sm);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.label {
  display: block;
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

/* Form switch */
.switch {
  width: 32px;
  height: 18px;
  background: var(--bg-3);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  border: 1px solid var(--line-2);
  transition: background 0.15s;
}
.switch::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink-1);
  top: 2px;
  left: 2px;
  transition: all 0.15s;
}
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on::after { left: 16px; background: var(--bg-0); }

/* Grids */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; align-items: center; gap: var(--gap); }
.row-tight { display: flex; align-items: center; gap: 8px; }

/* Decorative grid */
.bg-grid {
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* Status dots */
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block;
}
.status-dot.ok { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.status-dot.danger { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.status-dot.idle { background: var(--ink-3); }

/* Section header pattern (eyebrow + title + side) */
.page-head {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 28px;
}
.page-head .meta { flex: 1; display: flex; flex-direction: column; gap: 6px; }

/* Animations */
@keyframes pulse-soft {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2));
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  border-radius: 4px;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--line-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ============ Sidebar tooltip ============ */
.rail-btn[data-tip] {
  position: relative;
}
.rail-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  background: var(--bg-3);
  color: var(--ink-0);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s, transform 0.12s;
  border: 1px solid var(--line-2);
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.rail-btn[data-tip]::before {
  content: "";
  position: absolute;
  left: calc(100% + 5px);
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-right-color: var(--bg-3);
  opacity: 0;
  transition: opacity 0.12s;
  z-index: 51;
  pointer-events: none;
}
.rail-btn[data-tip]:hover::after,
.rail-btn[data-tip]:hover::before {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

/* ============ Toasts ============ */
.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 12px 14px 12px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 280px;
  max-width: 360px;
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  animation: toastIn 0.22s ease;
  position: relative;
  overflow: hidden;
}
.toast::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
}
.toast.success::before { background: var(--ok); }
.toast.error::before { background: var(--danger); }
.toast.warn::before { background: var(--warn); }
.toast.info::before { background: var(--accent); }

.toast .ic {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  flex-shrink: 0;
  color: var(--bg-0);
}
.toast.success .ic { background: var(--ok); }
.toast.error   .ic { background: var(--danger); color: white; }
.toast.warn    .ic { background: var(--warn); }
.toast.info    .ic { background: var(--accent); }

.toast .body { flex: 1; min-width: 0; }
.toast .ttl { font-size: 13px; font-weight: 500; line-height: 1.3; }
.toast .desc { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; font-family: var(--font-mono); line-height: 1.4; }
.toast .close {
  background: transparent;
  border: 0;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0;
  margin-top: -2px;
  font-size: 16px;
  line-height: 1;
}
.toast .close:hover { color: var(--ink-0); }

@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }
.toast.leaving { animation: toastOut 0.18s ease forwards; }

/* ============ Notifications bell ============ */
.bell-btn {
  position: relative;
  width: 32px; height: 32px;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  border-radius: 7px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.12s;
}
.bell-btn:hover { color: var(--ink-0); border-color: var(--line-3); background: var(--bg-1); }
.bell-btn svg { width: 14px; height: 14px; }
.bell-btn .dot {
  position: absolute;
  top: 4px; right: 5px;
  width: 7px; height: 7px;
  background: var(--magenta);
  border-radius: 50%;
  border: 1.5px solid var(--bg-0);
  box-shadow: 0 0 8px var(--magenta);
}

.bell-panel {
  position: absolute;
  top: 44px;
  right: 0;
  width: 360px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  z-index: 60;
  overflow: hidden;
  display: none;
  animation: popIn 0.14s ease;
}
.bell-panel.open { display: block; }
.bell-panel .ph {
  display: flex;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}
.bell-panel .ph h3 { font-size: 12.5px; font-weight: 500; margin: 0; flex: 1; }
.bell-panel .ph a { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }
.bell-panel .ph a:hover { color: var(--accent); }

.notif {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.12s;
}
.notif:hover { background: var(--bg-2); }
.notif.unread { background: rgba(242, 162, 89, 0.04); }
.notif .ic {
  width: 26px; height: 26px;
  border-radius: 6px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.notif .ic.ok { background: rgba(65, 227, 106, 0.16); color: var(--ok); }
.notif .ic.info { background: var(--accent-soft); color: var(--accent); }
.notif .ic.warn { background: rgba(255, 181, 71, 0.16); color: var(--warn); }
.notif .ic.danger { background: rgba(255, 90, 90, 0.16); color: var(--danger); }
.notif .ic svg { width: 13px; height: 13px; }
.notif .meta .ttl { font-size: 12.5px; font-weight: 500; line-height: 1.35; }
.notif .meta .desc { font-size: 11px; color: var(--ink-2); font-family: var(--font-mono); margin-top: 2px; line-height: 1.4; }
.notif .meta .when { font-size: 10px; color: var(--ink-3); font-family: var(--font-mono); margin-top: 4px; letter-spacing: 0.06em; text-transform: uppercase; }

/* ============ Modals ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  z-index: 150;
  padding-top: 8vh;
  animation: fadeIn 0.14s ease;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(560px, 92vw);
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  max-height: 84vh;
  animation: popIn 0.16s ease;
  overflow: hidden;
}
.modal-wide { width: min(720px, 94vw); }
.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 {
  font-size: 16px;
  font-weight: 500;
  margin: 0;
  flex: 1;
  letter-spacing: -0.01em;
}
.modal-head .sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 4px;
}
.modal-head .modal-ic {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg-3);
  display: grid; place-items: center;
  color: var(--accent);
  flex-shrink: 0;
}
.modal-head .modal-ic svg { width: 16px; height: 16px; }
.modal-close {
  background: transparent;
  border: 0;
  color: var(--ink-3);
  cursor: pointer;
  padding: 4px;
  line-height: 0;
  border-radius: 5px;
}
.modal-close:hover { color: var(--ink-0); background: var(--bg-2); }
.modal-close svg { width: 14px; height: 14px; }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--bg-0);
}
.modal-foot .grow { flex: 1; }
.modal-foot .hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}

.modal .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.modal .field .label { margin: 0; }
.modal .field .help {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  line-height: 1.5;
}
.modal .field .help a { color: var(--accent); }
.modal .field .help a:hover { text-decoration: underline; }

.radio-row {
  display: flex;
  gap: 8px;
}
.radio-row .radio {
  flex: 1;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  border-radius: 7px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-1);
}
.radio-row .radio.on {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.radio-row .radio .ind {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--line-3);
  flex-shrink: 0;
  position: relative;
}
.radio-row .radio.on .ind {
  border-color: var(--accent);
}
.radio-row .radio.on .ind::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: var(--accent);
  border-radius: 50%;
}

.opt-row {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.opt-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--bg-2);
  color: var(--ink-1);
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
}
.opt-pill.on {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(242, 162, 89, 0.3);
}

.modal-test-bar {
  padding: 10px 12px;
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-test-bar.ok { color: var(--ok); border-color: rgba(65, 227, 106, 0.25); background: rgba(65, 227, 106, 0.06); }
.modal-test-bar.err { color: var(--danger); border-color: rgba(255, 90, 90, 0.25); background: rgba(255, 90, 90, 0.06); }

/* Role badge */
.role-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: var(--bg-3);
  color: var(--ink-1);
  border: 1px solid var(--line-2);
}
.role-pill.admin { background: #ff5a5a; color: black; border-color: #ff5a5a; }
.role-pill.studio { background: var(--magenta-soft); color: var(--magenta); border-color: rgba(226, 92, 138, 0.3); }
.role-pill.pro { background: var(--accent-soft); color: var(--accent); border-color: rgba(242, 162, 89, 0.3); }
.role-pill.free { background: var(--bg-3); color: var(--ink-2); }

/* Rate-limit chip */
.rate-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  cursor: pointer;
}
.rate-chip:hover { color: var(--ink-0); border-color: var(--line-3); }
.rate-chip .mini-bar {
  width: 36px;
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
}
.rate-chip .mini-bar i {
  display: block; height: 100%;
  background: var(--accent);
  border-radius: 2px;
}
.rate-chip.warn .mini-bar i { background: var(--warn); }
.rate-chip.warn { color: var(--warn); border-color: rgba(255,181,71,0.3); }
.rate-chip.danger .mini-bar i { background: #ff5a5a; }
.rate-chip.danger { color: #ff5a5a; border-color: rgba(255,90,90,0.3); }

/* Empty state */
.empty-state {
  padding: 60px 30px;
  text-align: center;
  background: var(--bg-1);
  border: 1px dashed var(--line-2);
  border-radius: 14px;
  color: var(--ink-2);
}
.empty-state .glyph {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 16px;
  background: var(--bg-2);
  display: grid;
  place-items: center;
  color: var(--accent);
  position: relative;
}
.empty-state .glyph::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 22px;
  border: 1px dashed var(--line-2);
  pointer-events: none;
}
.empty-state .glyph svg { width: 26px; height: 26px; }
.empty-state h3 {
  color: var(--ink-0);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
}
.empty-state p {
  font-size: 13px;
  max-width: 380px;
  margin: 0 auto 18px;
  line-height: 1.55;
}
.empty-state .row {
  justify-content: center;
}

/* ============ Mobile / responsive (added) ============ */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }

  /* left rail -> fixed bottom bar */
  .rail {
    position: fixed;
    inset: auto 0 0 0;
    top: auto;
    height: auto;
    width: 100%;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 6px 8px;
    gap: 4px;
    border-right: 0;
    border-top: 1px solid var(--line);
    background: var(--bg-1);
  }
  .rail-logo,
  .rail-spacer { display: none; }
  .rail-btn.active::before { display: none; }
  .rail-btn[data-tip]::after,
  .rail-btn[data-tip]::before { display: none; }

  /* topbar wraps; drop the secondary chips that overflow */
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 10px; }
  .role-pill,
  .rate-chip { display: none; }

  /* page surface: tighter gutters + room for the bottom rail */
  .page { padding: 18px 14px 96px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }

  /* stack any fixed-column grids */
  .grid-2,
  .grid-3,
  .grid-4 { grid-template-columns: 1fr; }

  /* page-local grids defined AFTER shell.css need !important to collapse */
  .quick-row { grid-template-columns: 1fr !important; }
  .stats-strip { grid-template-columns: 1fr 1fr !important; }
  /* flex rows (e.g. the featured OpenBeat card) wrap instead of squishing text */
  .quick .row,
  .quick.featured .row { flex-wrap: wrap !important; gap: 12px !important; }

  /* keep popovers / toasts on-screen */
  .bell-panel { width: min(360px, calc(100vw - 24px)); }
  .toast-stack { right: 12px; left: 12px; bottom: 84px; }
  .toast { min-width: 0; max-width: none; }
}

/* ============ Accessibility: visible keyboard focus (global) ============ */
/* The design removes outlines everywhere; restore a visible ring for keyboard users.
   Element selectors (specificity 0,1,1) intentionally beat `.input{outline:none}` (0,1,0). */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible,
[role="switch"]:focus-visible,
.rail-btn:focus-visible,
.switch:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Honor reduced-motion globally as a safety net (per-page heavy animations tracked separately). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
