/* ═════════════════════════════════════════════════════════════════════
   SPECTRA /// SHARED — App shell
   Sidebar, topbar, status strip, command palette, notification popover.
   Every product uses this shell without modification.
   ═════════════════════════════════════════════════════════════════════ */

.app {
  display: grid;
  grid-template-columns: var(--shell-sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.28s var(--ease-out);
}
.app.collapsed { grid-template-columns: var(--shell-sidebar-collapsed) 1fr; }

/* ═══════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════ */
.sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width 0.28s var(--ease-out);
  z-index: 30;
}

/* ── Brand block ─────────────────────────────────────────────────── */
.sidebar .brand {
  padding: 18px 16px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
  flex-shrink: 0;
}
.sidebar .brand .logo-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
  transition: opacity 0.2s;
}
.sidebar .brand .logo-row {
  display: flex;
  align-items: center;
  gap: 9px;
  text-transform: uppercase;
  white-space: nowrap;
}
.sidebar .brand .logo-row.top-row {
  font-size: 13px;
  font-weight: 200;
  letter-spacing: 3px;
  color: var(--brand-blue);
  line-height: 1.05;
}
.sidebar .brand .logo-row.bottom-row {
  font-size: 8px;
  font-weight: 300;
  letter-spacing: 3.4px;
  color: var(--fg-bright);
  line-height: 1.05;
}
.sidebar .brand .slashes {
  display: inline-flex;
  gap: 3px;
  transform: skewX(-15deg);
  font-weight: 700;
}
.sidebar .brand .slashes span { display: inline-block; line-height: 1; }
.sidebar .brand .slash-teal  { color: var(--brand-blue); }
.sidebar .brand .slash-mint  { color: var(--product, var(--brand-green)); }
.sidebar .brand .slash-coral { color: var(--brand-pink); }
.sidebar .brand .slash-white { color: var(--fg-bright); }

/* Collapsed brand shows slashes only, in canonical order */
.app.collapsed .sidebar .brand .logo-stack { opacity: 0; pointer-events: none; }
.app.collapsed .sidebar .brand { padding: 18px 0 16px; justify-content: center; }
.app.collapsed .sidebar .brand::before {
  content: '';
  display: inline-flex;
  gap: 3px;
  transform: skewX(-15deg);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -1px;
  color: var(--brand-blue);
}
.app.collapsed .sidebar .brand .collapsed-slashes {
  display: inline-flex;
  gap: 3px;
  transform: skewX(-15deg);
  font-weight: 700;
  font-size: 20px;
  line-height: 1;
}
.app.collapsed .sidebar .brand .collapsed-slashes span:nth-child(2) {
  color: var(--product, var(--brand-green));
}
.app.collapsed .sidebar .brand .collapsed-slashes span:nth-child(1),
.app.collapsed .sidebar .brand .collapsed-slashes span:nth-child(3) {
  color: var(--brand-blue);
}

/* ── Nav scroll ──────────────────────────────────────────────────── */
.sidebar .nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 10px 14px;
}
.sidebar .nav-grp {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-faint);
  font-weight: 600;
  padding: 16px 10px 6px;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.sidebar .nav-grp:first-child { padding-top: 6px; }

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  color: var(--fg-dim);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  position: relative;
  user-select: none;
}
.sidebar .nav-link .nav-ico {
  width: 15px;
  height: 15px;
  stroke-width: 1.75;
  flex-shrink: 0;
  transition: color 0.15s;
}
.sidebar .nav-link .nav-lbl { flex: 1; transition: opacity 0.12s; }
.sidebar .nav-link .nav-badge {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 8px;
  background: var(--bg-4);
  color: var(--fg-mute);
  transition: opacity 0.12s;
}
.sidebar .nav-link .nav-badge.hot { background: var(--red-soft); color: var(--red); }
.sidebar .nav-link .nav-badge.warm { background: var(--amber-soft); color: var(--amber); }

.sidebar .nav-link:hover { background: var(--card-bg); color: var(--fg-bright); }
.sidebar .nav-link:hover .nav-ico { color: var(--product, var(--accent)); }

.sidebar .nav-link.active {
  background: var(--product-soft, var(--accent-soft));
  color: var(--product, var(--accent));
  font-weight: 500;
}
.sidebar .nav-link.active .nav-ico { color: var(--product, var(--accent)); }
.sidebar .nav-link.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--product, var(--accent));
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--product-glow, var(--accent-glow));
}

.app.collapsed .sidebar .nav-grp { opacity: 0; height: 6px; padding: 2px 0; }
.app.collapsed .sidebar .nav-link { justify-content: center; padding: 10px; }
.app.collapsed .sidebar .nav-link .nav-lbl,
.app.collapsed .sidebar .nav-link .nav-badge { display: none; }
.app.collapsed .sidebar .nav-link.active::before { left: 0; }

/* ── Sidebar footer — identical across products ──────────────────── */
.sidebar .sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 12px 12px 14px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.session-status,
.idle-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-mute);
  padding: 2px 4px;
  transition: opacity 0.12s;
}
.session-status .pip {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--product, var(--accent));
  box-shadow: 0 0 6px var(--product, var(--accent));
  animation: productPulse 2.4s infinite;
}
.idle-chip { display: none; }
.idle-chip .pip {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 6px var(--amber);
  animation: productPulse 1.4s infinite;
}
.idle-chip.show { display: flex; }
@keyframes productPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.sidebar .footer-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 7px 10px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  color: var(--fg-dim);
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  text-align: left;
  width: 100%;
  background: transparent;
  border: none;
}
.sidebar .footer-btn svg {
  width: 14px; height: 14px;
  stroke-width: 1.75;
  flex-shrink: 0;
}
.sidebar .footer-btn:hover { background: var(--card-bg); color: var(--fg-bright); }
.sidebar .footer-btn:hover svg { color: var(--product, var(--accent)); }
.sidebar .footer-btn.logout:hover { color: var(--red); }
.sidebar .footer-btn.logout:hover svg { color: var(--red); }

.app.collapsed .sidebar .session-status,
.app.collapsed .sidebar .idle-chip,
.app.collapsed .sidebar .footer-btn .label { display: none; }
.app.collapsed .sidebar .footer-btn { justify-content: center; padding: 10px; }

/* LABS signature — canonical */
.sidebar .labs-signature {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}
.sidebar .labs-signature .logo-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  user-select: none;
}
.sidebar .labs-signature .logo-row {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  white-space: nowrap;
}
.sidebar .labs-signature .logo-row.top-row {
  font-size: 11px;
  font-weight: 200;
  letter-spacing: 2.6px;
  color: var(--brand-blue);
  line-height: 1.05;
}
.sidebar .labs-signature .logo-row.bottom-row {
  font-size: 7px;
  font-weight: 300;
  letter-spacing: 3px;
  color: var(--fg-bright);
  line-height: 1.05;
}
.app.collapsed .sidebar .labs-signature { display: none; }

/* ═══════════════════════════════════════════════════════════════════
   MAIN
   ═══════════════════════════════════════════════════════════════════ */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

/* ── Topbar ──────────────────────────────────────────────────────── */
.topbar {
  height: var(--shell-topbar-h);
  padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 20;
  flex-shrink: 0;
}
.topbar .crumbs {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-mute);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  min-width: 0;
}
.topbar .crumbs svg { width: 13px; height: 13px; color: var(--product, var(--accent)); flex-shrink: 0; }
.topbar .crumbs .sep { color: var(--fg-faint); }
.topbar .crumbs .cur {
  color: var(--fg-bright);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-spacer { flex: 1; }

.cmd-trigger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px;
  background: var(--card-bg);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-mute);
  cursor: pointer;
  transition: all 0.15s;
  min-width: 220px;
  height: 32px;
}
.cmd-trigger:hover { border-color: var(--product-line, var(--accent-line)); color: var(--product, var(--accent)); }
.cmd-trigger svg { width: 12px; height: 12px; stroke-width: 2; }
.cmd-trigger .kbd {
  margin-left: auto;
  font-size: 9.5px;
  padding: 2px 6px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--fg-faint);
  letter-spacing: 0.06em;
}

.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  color: var(--fg-dim);
  border: 1px solid transparent;
  transition: all 0.15s;
  cursor: pointer;
  position: relative;
  background: transparent;
}
.icon-btn svg { width: 15px; height: 15px; stroke-width: 1.85; }
.icon-btn:hover {
  background: var(--product-soft, var(--accent-soft));
  color: var(--product, var(--accent));
  border-color: var(--product-line, var(--accent-line));
}
.icon-btn .dot {
  position: absolute;
  top: 1px; right: 1px;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--red);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg);
}

/* ── Notification popover ────────────────────────────────────────── */
.notif-wrap { position: relative; }
.notif-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--card-bg-solid);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popIn 0.18s var(--ease-out);
}
.notif-popover[hidden] { display: none; }
@keyframes popIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.notif-popover .np-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-popover .np-title {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-dim);
  font-weight: 600;
}
.notif-popover .np-mark {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-mute);
  cursor: pointer;
  transition: color 0.15s;
  background: transparent;
  border: none;
}
.notif-popover .np-mark:hover { color: var(--product, var(--accent)); }
.notif-popover .np-list { max-height: 320px; overflow-y: auto; }
.notif-popover .np-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-2);
  cursor: pointer;
  transition: background 0.12s;
}
.notif-popover .np-item:hover { background: var(--card-bg); }
.notif-popover .np-item:last-child { border-bottom: none; }
.notif-popover .np-item .np-ic {
  width: 28px; height: 28px;
  border-radius: var(--r-md);
  display: grid; place-items: center;
  flex-shrink: 0;
  background: var(--product-soft, var(--accent-soft));
  color: var(--product, var(--accent));
}
.notif-popover .np-item .np-ic svg { width: 13px; height: 13px; stroke-width: 2; }
.notif-popover .np-item .np-body { flex: 1; min-width: 0; }
.notif-popover .np-item .np-t {
  font-size: 12.5px;
  color: var(--fg-bright);
  font-weight: 500;
  margin-bottom: 2px;
}
.notif-popover .np-item .np-d {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-popover .np-foot {
  padding: 11px 16px;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--product, var(--accent));
  cursor: pointer;
  transition: background 0.12s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: none;
}
.notif-popover .np-foot:hover { background: var(--product-soft, var(--accent-soft)); }
.notif-popover .np-foot svg { width: 12px; height: 12px; stroke-width: 2; }

/* ── User chip ───────────────────────────────────────────────────── */
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 5px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all 0.15s;
}
.user-chip:hover { border-color: var(--product-line, var(--accent-line)); }
.user-chip .avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--product, var(--accent)), var(--accent));
  color: var(--bg);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.user-chip .avatar svg { width: 13px; height: 13px; stroke-width: 2; }
.user-chip .who { display: flex; flex-direction: column; line-height: 1.15; }
.user-chip .who .name { font-size: 12px; font-weight: 600; color: var(--fg-bright); }
.user-chip .who .role {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--fg-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ── Status strip ────────────────────────────────────────────────── */
.status-strip {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--fg-mute);
  letter-spacing: 0.04em;
  flex-shrink: 0;
  overflow-x: auto;
  height: var(--shell-status-strip-h);
}
.status-strip .ss-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.status-strip .ss-item .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--product, var(--accent));
  box-shadow: 0 0 6px var(--product, var(--accent));
}
.status-strip .ss-item .dot.warn { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.status-strip .ss-item .dot.err { background: var(--red); box-shadow: 0 0 6px var(--red); }
.status-strip .ss-item .v { color: var(--fg-bright); }
.status-strip .ss-div { color: var(--fg-faint); }
.status-strip .ss-item.link { cursor: pointer; transition: color 0.15s; }
.status-strip .ss-item.link:hover { color: var(--product, var(--accent)); }
.status-strip .spacer { flex: 1; }

/* ── Content ─────────────────────────────────────────────────────── */
.content {
  flex: 1;
  padding: 26px 26px 60px;
  min-width: 0;
}

/* ── Sidebar scrim (mobile) ──────────────────────────────────────── */
.sidebar-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 199;
  display: none;
}

/* ── Command palette ─────────────────────────────────────────────── */
.palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 100px 24px 24px;
  animation: fadeIn 0.15s ease;
}
.palette-backdrop.show { display: flex; }
.palette {
  background: var(--card-bg-solid);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 620px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}
.palette-input {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.palette-input svg { width: 15px; height: 15px; color: var(--fg-mute); flex-shrink: 0; }
.palette-input input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 15px;
  color: var(--fg);
  font-weight: 300;
}
.palette-input input::placeholder { color: var(--fg-mute); }
.palette-list { flex: 1; overflow-y: auto; padding: 8px; }
.palette-list .cmdp-grp {
  padding: 10px 12px 4px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-faint);
  font-weight: 600;
}
.palette-list .cmdp-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--fg-dim);
  cursor: pointer;
  transition: all 0.08s;
}
.palette-list .cmdp-item svg { width: 14px; height: 14px; stroke-width: 1.8; flex-shrink: 0; }
.palette-list .cmdp-item .cmdp-label { flex: 1; }
.palette-list .cmdp-item .cmdp-kbd {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-faint);
  padding: 2px 6px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.palette-list .cmdp-item.hl,
.palette-list .cmdp-item:hover {
  background: var(--product-soft, var(--accent-soft));
  color: var(--product, var(--accent));
}
.palette-footer {
  padding: 9px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg-3);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-faint);
  letter-spacing: 0.05em;
  display: flex;
  gap: 18px;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 252px !important;
    transform: translateX(-100%);
    transition: transform 0.28s var(--ease-out);
    z-index: 200;
  }
  .app.sidebar-open .sidebar { transform: translateX(0); }
  .app.sidebar-open .sidebar-scrim { display: block; }
  .app.collapsed .sidebar .brand .logo-stack { opacity: 1; pointer-events: auto; }
  .app.collapsed .sidebar .brand::before { display: none; }
  .app.collapsed .sidebar .brand { padding: 18px 16px 16px; justify-content: flex-start; }
  .app.collapsed .sidebar .nav-grp { opacity: 1; height: auto; padding: 16px 10px 6px; }
  .app.collapsed .sidebar .nav-link { justify-content: flex-start; padding: 8px 10px; }
  .app.collapsed .sidebar .nav-link .nav-lbl,
  .app.collapsed .sidebar .nav-link .nav-badge { display: inline-flex; }
  .app.collapsed .sidebar .session-status,
  .app.collapsed .sidebar .idle-chip,
  .app.collapsed .sidebar .footer-btn .label { display: initial; }
  .app.collapsed .sidebar .footer-btn { justify-content: flex-start; padding: 7px 10px; }
  .app.collapsed .sidebar .labs-signature { display: flex; }

  .topbar { padding: 0 14px; }
  .cmd-trigger { min-width: 0; }
  .cmd-trigger .kbd { display: none; }
  .cmd-trigger .label { display: none; }
  .cmd-trigger { padding: 6px 10px; }
  .content { padding: 20px 16px 60px; }
}
@media (max-width: 640px) {
  .user-chip .who { display: none; }
  .user-chip { padding: 4px; }
  .page-head .page-actions { width: 100%; }
  .page-head .page-actions .btn { flex: 1; }
}