.shell { display: none; height: 100vh; height: 100dvh; }
.shell.is-ready { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }

.sidebar { display: flex; flex-direction: column; min-height: 0; padding: 12px 10px 10px 12px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; text-decoration: none; color: var(--text); }
.brand .brand-mark { color: var(--accent); filter: drop-shadow(0 1px 1.5px light-dark(rgb(150 40 0 / .28), rgb(0 0 0 / .5))); }
.brand-name { font: 680 15px/1 var(--font-display); letter-spacing: -.015em; }
.brand-env { margin-left: auto; font-size: 10.5px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }

.side-search {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 32px; padding: 0 8px 0 10px; margin-bottom: 10px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text-3);
  font-size: 13px; text-align: left; box-shadow: var(--shadow-sm);
  transition: border-color var(--t), color var(--t);
}
.side-search:hover { border-color: var(--border-2); color: var(--text-2); }
.side-search span { flex: 1; }

.nav-group { display: flex; flex-direction: column; gap: 1px; }
.nav-group + .nav-group { margin-top: 16px; }
.nav-head {
  display: flex; align-items: center; justify-content: space-between; height: 24px; padding: 0 4px 0 8px;
  font-size: 11.5px; font-weight: 640; color: var(--text-3); letter-spacing: .02em;
}
.nav-head .icon-btn { width: 22px; height: 22px; border-radius: 6px; }
.nav-link {
  display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px; border-radius: 7px;
  color: var(--text-2); text-decoration: none; font-weight: 500; font-size: 13.5px; white-space: nowrap;
  transition: background var(--t), color var(--t), box-shadow var(--t);
}
.nav-link > span:not(.nav-badge):not(.nav-count) { overflow: hidden; text-overflow: ellipsis; }
.nav-link .i { color: var(--text-3); transition: color var(--t); }
.nav-link:hover { background: var(--hover); color: var(--text); }
.nav-link.is-active { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.nav-link.is-active .i { color: var(--accent-fg); }
.nav-count { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-badge {
  margin-left: auto; min-width: 19px; height: 18px; padding: 0 6px; border-radius: 9px;
  display: inline-grid; place-items: center; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  animation: pop-in 220ms var(--ease);
}
.space-glyph {
  width: 18px; height: 18px; flex: none; border-radius: 5px; display: grid; place-items: center;
  font: 700 10px/1 var(--font); text-transform: uppercase;
  background: light-dark(oklch(.92 .05 var(--h, 40)), oklch(.34 .07 var(--h, 40)));
  color: light-dark(oklch(.45 .13 var(--h, 40)), oklch(.86 .08 var(--h, 40)));
}
.nav-link.is-active .space-glyph { box-shadow: 0 0 0 1.5px light-dark(oklch(.7 .1 var(--h, 40) / .6), oklch(.6 .1 var(--h, 40) / .6)); }

.sidebar-foot { margin-top: auto; padding-top: 14px; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 6px; border-radius: 9px; }
.user-chip:hover { background: var(--hover); }
.user-chip-text { min-width: 0; flex: 1; line-height: 1.25; }
.user-chip-name { font-weight: 620; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-handle { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .icon-btn { width: 28px; height: 28px; }

.main {
  min-width: 0; min-height: 0; margin: 8px 8px 8px 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow-sm);
}
.topbar {
  flex: none; display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 12px 0 20px;
  border-bottom: 1px solid var(--border);
}
.menu-btn, .topbar-search { display: none !important; }
.crumbs { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1; font-weight: 560; color: var(--text-2); font-size: 13.5px; }
.crumbs a { color: var(--text-2); text-decoration: none; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; border-radius: 6px; padding: 2px 4px; margin: -2px -4px; }
.crumbs a:hover { color: var(--text); background: var(--hover); }
.crumbs .sep { color: var(--text-3); flex: none; }
.crumbs .cur { display: inline-flex; align-items: center; gap: 7px; min-width: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs .cur > span { overflow: hidden; text-overflow: ellipsis; }
.crumbs .i { color: var(--text-3); }
.topbar-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.view { flex: 1; min-height: 0; overflow-y: auto; scroll-behavior: smooth; }
.scrim { display: none; }

.page { max-width: 1060px; margin: 0 auto; padding: 30px 40px 80px; }
.page-wide { max-width: 1180px; }
.page-tracker, .page-wide.tracker-page { max-width: 1560px; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font: 700 25px/1.2 var(--font-display); letter-spacing: -.026em; }
.page-head .sub { color: var(--text-2); margin-top: 5px; font-size: 13.5px; max-width: 640px; }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex: none; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-3); margin-bottom: 8px; }

.auth-screen { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(400px, 480px) minmax(0, 1fr); background: var(--panel); }
.auth-pane { display: flex; flex-direction: column; padding: 32px 56px; min-height: 100%; }
.auth-pane .brand { padding: 0; }
.auth-form-wrap { margin: auto 0; width: 100%; max-width: 360px; padding: 32px 0; animation: page-in 320ms var(--ease); }
.auth-title { font: 700 27px/1.15 var(--font-display); letter-spacing: -.03em; }
.auth-sub { color: var(--text-2); margin: 8px 0 24px; font-size: 14px; }
.auth-tabs { display: flex; margin-bottom: 22px; }
.auth-tabs .seg { width: 100%; }
.auth-tabs .seg button { flex: 1; justify-content: center; height: 30px; font-size: 13px; }
.auth-foot { color: var(--text-3); font-size: 12px; display: flex; align-items: center; gap: 8px; }
.auth-foot .i { color: var(--text-3); }
.auth-pane .btn-block { height: 38px; font-size: 14px; margin-top: 4px; }

.auth-art {
  position: relative; overflow: hidden; margin: 10px 10px 10px 0; border-radius: 18px;
  background:
    radial-gradient(120% 70% at 75% 110%, rgb(207 74 27 / .5), transparent 60%),
    radial-gradient(70% 50% at 10% -10%, rgb(255 160 110 / .14), transparent 70%),
    #13120f;
  color: #f3f1eb; display: flex; flex-direction: column; justify-content: space-between; padding: 44px 48px;
  isolation: isolate;
}
.auth-art::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(rgb(255 255 255 / .045) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / .045) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(90% 80% at 50% 45%, #000 30%, transparent 85%);
}
.art-kicker { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgb(255 255 255 / .55); }
.art-kicker::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #ff8d61; box-shadow: 0 0 0 4px rgb(255 141 97 / .18); }
.art-title { font: 700 40px/1.08 var(--font-display); letter-spacing: -.035em; max-width: 560px; margin-top: 18px; }
.art-title em { font-style: normal; color: #ff9a6e; }
.art-sub { color: rgb(255 255 255 / .62); font-size: 15px; max-width: 460px; margin-top: 14px; line-height: 1.55; }
.art-stage { position: relative; height: 330px; margin: 8px -8px; }
.art-stage .art-bridge { top: auto; bottom: 0; height: 250px; }
.art-bridge { position: absolute; inset: 0; width: 100%; height: 100%; }
.art-card {
  position: absolute; width: 300px; padding: 12px 14px; border-radius: 13px;
  background: rgb(30 29 26 / .78); border: 1px solid rgb(255 255 255 / .09);
  box-shadow: 0 20px 50px -18px rgb(0 0 0 / .8); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 12.5px; color: rgb(255 255 255 / .82); animation: float 7s ease-in-out infinite;
}
.art-card .row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.art-card .name { font-weight: 650; color: #fff; }
.art-card .agent-chip { background: rgb(255 255 255 / .08); color: #fff; }
.art-card .agent-chip .bits { color: rgb(255 255 255 / .6); }
.art-card .via { color: rgb(255 255 255 / .45); }
.art-card code { font: 11.5px var(--mono); background: rgb(255 255 255 / .08); padding: 1px 5px; border-radius: 4px; color: #ffc2a6; }
.art-card.c1 { left: 0; top: 0; width: 350px; }
.art-card.c2 { right: 0; top: 30%; width: 250px; animation-delay: -3.5s; }
.art-card .task-line { display: flex; align-items: center; gap: 8px; font-weight: 600; color: #fff; }
.art-card .task-meta { display: flex; gap: 10px; margin-top: 8px; color: rgb(255 255 255 / .55); font-size: 12px; align-items: center; }
.art-foot { display: flex; gap: 22px; color: rgb(255 255 255 / .5); font-size: 12.5px; }
.art-foot span { display: inline-flex; align-items: center; gap: 7px; }
.art-foot .i { color: #ff9a6e; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

@media (max-width: 1080px) {
  .auth-screen { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-pane { align-items: center; padding: 28px 22px; }
  .auth-pane .brand { align-self: flex-start; }
}

@media (max-width: 820px) {
  .shell.is-ready { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 45; background: var(--bg);
    transform: translateX(-104%); transition: transform 240ms var(--ease); box-shadow: var(--shadow-lg);
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .shell.nav-open .sidebar { transform: none; }
  .shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 44; background: rgb(0 0 0 / .38); animation: fade-in 200ms; }
  .main { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .topbar { padding: 0 6px 0 6px; height: 52px; gap: 4px; position: sticky; top: 0; background: var(--panel); }
  .menu-btn, .topbar-search { display: inline-grid !important; }
  .topbar-actions .btn .label, .topbar-actions .btn kbd { display: none; }
  .topbar-actions .btn { width: 34px; padding: 0; }
  .crumbs { font-size: 14px; }
  .crumbs .crumb-parent { display: none; }
  .crumbs .crumb-parent + .sep { display: none; }
  .crumbs a { min-width: 0; flex-shrink: 1; }
  .crumbs a > span { overflow: hidden; text-overflow: ellipsis; }
  .crumbs .cur { flex-shrink: 0; max-width: 60%; }
  .page { padding: 20px 16px 64px; }
  .page-head { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 18px; }
  .page-head h1 { font-size: 22px; }
}
