/* Base: reset, typography, application shell, auth shell. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--yo-font);
  font-size: var(--yo-fs-body);
  line-height: 1.5;
  color: var(--yo-text);
  background: var(--yo-canvas);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; color: var(--yo-ink); line-height: 1.25; }
h1 { font-size: var(--yo-fs-page); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: var(--yo-fs-section); font-weight: 650; }
h3 { font-size: var(--yo-fs-card); font-weight: 600; }
p { margin: 0; }
a { color: var(--yo-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--yo-red); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--yo-font-mono); font-size: 0.95em; letter-spacing: 0.01em; }
.muted { color: var(--yo-muted); }
.small { font-size: var(--yo-fs-small); }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }
.mt-2 { margin-top: var(--yo-s2); }
.mt-4 { margin-top: var(--yo-s4); }
.mb-4 { margin-bottom: var(--yo-s4); }
.fake-link { color: var(--yo-ink); font-weight: 600; text-decoration: underline; }

/* ------------------------------------------------------------ app shell */
.app {
  display: flex; min-height: 100vh;
  /* Paint the sidebar column to the bottom of long pages (the sidebar itself is sticky). */
  background: linear-gradient(to right, var(--yo-surface) calc(var(--yo-sidebar-w) - 1px), var(--yo-border) calc(var(--yo-sidebar-w) - 1px), var(--yo-border) var(--yo-sidebar-w), var(--yo-canvas) var(--yo-sidebar-w));
}
.sidebar {
  position: sticky; top: 0; height: 100vh; flex: 0 0 var(--yo-sidebar-w);
  width: var(--yo-sidebar-w); background: var(--yo-surface);
  border-right: 1px solid var(--yo-border);
  display: flex; flex-direction: column; padding: var(--yo-s5) var(--yo-s4);
  z-index: 30;
}
.sidebar-brand { display: block; padding: 0 var(--yo-s2) var(--yo-s5); text-decoration: none; }
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand img { height: 30px; width: auto; }
.sidebar-brand .product {
  display: block; margin-top: 6px; padding-left: 2px;
  font-size: var(--yo-fs-label); font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--yo-muted);
}
.nav { flex: 1; overflow-y: auto; }
.nav-section {
  margin: var(--yo-s5) var(--yo-s2) var(--yo-s2);
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--yo-subtle);
}
.nav-item {
  display: flex; align-items: center; gap: var(--yo-s3);
  min-height: 40px; padding: 0 var(--yo-s3); margin: 2px 0;
  border-radius: var(--yo-r-control); color: var(--yo-text);
  font-weight: 500; text-decoration: none;
  transition: background var(--yo-ease), color var(--yo-ease);
}
.nav-item svg { color: var(--yo-muted); flex: 0 0 auto; }
.nav-item:hover { background: var(--yo-hover); text-decoration: none; }
.nav-item.active { background: var(--yo-red-soft); color: var(--yo-ink); font-weight: 600; }
.nav-item.active svg { color: var(--yo-red); }
.nav-item.disabled { color: var(--yo-subtle); cursor: not-allowed; }
.nav-item.disabled:hover { background: transparent; }
.nav-item.disabled svg { color: var(--yo-border-strong); }
.nav-item .lock { margin-left: auto; }
.sidebar-user {
  border-top: 1px solid var(--yo-border); padding-top: var(--yo-s4); margin-top: var(--yo-s4);
}
.user-chip { display: flex; align-items: center; gap: var(--yo-s3); padding: 0 var(--yo-s2); }
.avatar {
  flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--yo-neutral-bg); color: var(--yo-ink);
  font-size: var(--yo-fs-small); font-weight: 650;
}
.user-chip .who { min-width: 0; }
.user-chip .name { font-weight: 600; color: var(--yo-ink); line-height: 1.3; }
.user-chip .org { font-size: var(--yo-fs-label); color: var(--yo-muted); }
.user-chip .name, .user-chip .org { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-form { margin: var(--yo-s3) 0 0; }
.logout-btn {
  display: flex; align-items: center; gap: var(--yo-s3); width: 100%;
  min-height: 40px; padding: 0 var(--yo-s3); border: 0; background: none;
  border-radius: var(--yo-r-control); color: var(--yo-muted); font-weight: 500; cursor: pointer;
}
.logout-btn:hover { background: var(--yo-hover); color: var(--yo-ink); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--yo-s4);
  height: 64px; padding: 0 var(--yo-s7);
  background: var(--yo-canvas-glass);
  backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid transparent;
}
.topbar .crumbs { display: flex; align-items: center; gap: var(--yo-s2); color: var(--yo-muted); font-size: var(--yo-fs-small); min-width: 0; }
.topbar .crumbs a { color: var(--yo-muted); }
.topbar .crumbs .current { color: var(--yo-ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.topbar .identity { display: flex; align-items: center; gap: var(--yo-s3); }
.topbar .identity .meta { text-align: right; line-height: 1.25; }
.topbar .identity .meta .name { font-weight: 600; color: var(--yo-ink); font-size: var(--yo-fs-small); }
.topbar .identity .meta .org { font-size: var(--yo-fs-label); color: var(--yo-muted); }
.menu-btn {
  display: none; width: 40px; height: 40px; align-items: center; justify-content: center;
  border: 1px solid var(--yo-border); background: var(--yo-surface); border-radius: var(--yo-r-control);
  cursor: pointer;
}
.page { width: 100%; max-width: var(--yo-content-max); padding: var(--yo-s4) var(--yo-s7) var(--yo-s8); margin: 0 auto; }
.page.narrow { max-width: calc(var(--yo-form-max) + 2 * var(--yo-s7)); }
.page-header { display: flex; align-items: flex-start; gap: var(--yo-s4); margin-bottom: var(--yo-s6); }
.page-header .titles { flex: 1; min-width: 0; }
.page-header .titles p { margin-top: var(--yo-s2); color: var(--yo-muted); font-size: var(--yo-fs-body-lg); }
.page-header .actions { display: flex; gap: var(--yo-s3); flex-wrap: wrap; align-items: center; }
.section { margin-top: var(--yo-s6); }
.section-head { display: flex; align-items: center; gap: var(--yo-s3); margin-bottom: var(--yo-s4); }
.section-head h2 { flex: 1; }
.scrim { display: none; }
.page-anon { padding-top: var(--yo-s8); }
.anon-brand img { margin-bottom: var(--yo-s6); }

/* ------------------------------------------------------------ auth shell */
.auth { min-height: 100vh; display: grid; grid-template-columns: 45% 55%; background: var(--yo-surface); }
.auth-brand {
  position: relative; overflow: hidden; background: var(--yo-red-soft);
  padding: var(--yo-s8); display: flex; flex-direction: column;
}
.auth-brand img { height: 44px; width: auto; align-self: flex-start; position: relative; z-index: 1; }
.auth-brand .product {
  position: relative; z-index: 1; margin-top: var(--yo-s2); padding-left: 2px;
  font-size: var(--yo-fs-label); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--yo-muted);
}
.auth-brand .sun {
  position: absolute; width: 420px; height: 420px; border-radius: 50%;
  right: -90px; bottom: 12%; background: var(--yo-red-tint);
}
.auth-brand .sun.small { width: 160px; height: 160px; right: auto; left: 12%; bottom: auto; top: 46%; opacity: 0.7; }
.auth-brand .tagline { position: relative; z-index: 1; margin-top: auto; max-width: 360px; color: var(--yo-ink); font-size: var(--yo-fs-section); font-weight: 600; line-height: 1.35; }
.auth-brand .tagline small { display: block; margin-top: var(--yo-s2); font-size: var(--yo-fs-body); font-weight: 400; color: var(--yo-muted); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: var(--yo-s7) var(--yo-s5); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 28px; }
.auth-card .lead { margin-top: var(--yo-s2); margin-bottom: var(--yo-s6); color: var(--yo-muted); font-size: var(--yo-fs-body-lg); }
.auth-card .footnote { margin-top: var(--yo-s5); color: var(--yo-muted); font-size: var(--yo-fs-small); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .page { padding-left: var(--yo-s6); padding-right: var(--yo-s6); }
  .topbar { padding: 0 var(--yo-s6); }
}
@media (max-width: 767px) {
  .app { background: var(--yo-canvas); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100%;
    transform: translateX(-100%); transition: transform var(--yo-ease);
    box-shadow: var(--yo-shadow-pop);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: var(--yo-overlay); z-index: 25; }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 var(--yo-s4); height: 56px; }
  .topbar .identity .meta { display: none; }
  .topbar .crumbs > a, .topbar .crumbs > svg { display: none; }
  .page { padding: var(--yo-s3) var(--yo-s4) var(--yo-s7); }
  .page-header { flex-direction: column; margin-bottom: var(--yo-s5); }
  h1 { font-size: 24px; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: var(--yo-s5) var(--yo-s4); min-height: 0; }
  .auth-brand .sun, .auth-brand .tagline { display: none; }
  .auth-brand img { height: 34px; }
  .auth-main { align-items: flex-start; padding: var(--yo-s6) var(--yo-s4); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
