/* App shell: sidebar, top bar, command palette, sign-in. */

.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.shell-main { min-width: 0; display: flex; flex-direction: column; }
main#main { flex: 1; min-width: 0; padding: 28px 28px 64px; outline: none; }

/* ---------- sidebar ---------- */
.rail {
  background: var(--sidebar-bg); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; padding: 16px 12px; overflow-y: auto; z-index: 40;
}
.rail .brand, a.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; text-decoration: none; color: var(--text); border-radius: var(--radius); }
.rail .brand img, a.brand img { width: 32px; height: 32px; border-radius: 8px; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 600; font-size: 15px; line-height: 20px; letter-spacing: -0.1px; }
.brand-org { font-size: 12px; line-height: 16px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.navgroup { margin: 0; padding: 14px 10px 4px; font-size: 12px; line-height: 16px; color: var(--muted); font-weight: 500; }
.nav a {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--radius);
  text-decoration: none; color: var(--text-2); font-weight: 400; font-size: 14px; margin-top: 2px;
}
.nav a svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.nav a:hover { background: var(--surface-hover); color: var(--text); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-text); font-weight: 500; }
.nav a[aria-current="page"] svg { color: var(--brand-text); }
.nav a:focus-visible { outline-offset: -2px; }
.rail .spacer { flex: 1; min-height: 16px; }
.rail-foot { padding: 8px 10px 0; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar); background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 28px;
}
.topbar .menubtn { display: none; }
.searchbtn {
  flex: 1 1 auto; max-width: 520px; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  border: 1px solid var(--control); border-radius: var(--radius); background: var(--surface); color: var(--muted); text-align: left; min-width: 0;
}
.searchbtn:hover { border-color: var(--muted); }
.searchbtn svg { width: 16px; height: 16px; }
.searchbtn .ph { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
kbd, .kbd { font: 500 12px/16px var(--font); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 1px 6px; color: var(--muted); background: var(--surface); }
.topbar .spacer { flex: 1; }
.topbar .iconbtn.bordered { border-color: var(--line); }
.userbtn { height: 38px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px 0 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 500; }
.userbtn:hover { background: var(--surface-hover); }
.userbtn .name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-head { padding: 8px 10px 6px; }
.menu-head .who { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.menu-head .role { color: var(--muted); font-size: 13px; }

.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 35; border: 0; }

/* ---------- command palette ---------- */
dialog.palette { width: min(600px, calc(100vw - 24px)); margin: 12vh auto auto; max-height: 70vh; overflow: hidden; }
dialog.palette[open] { display: flex; flex-direction: column; }
.palette-search { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.palette-search svg { color: var(--muted); }
.palette-search input { flex: 1; height: 52px; border: 0; outline: none; background: transparent; font-size: 15px; min-width: 0; }
.palette-list { overflow-y: auto; padding: 8px; }
.palette-group { padding: 8px 10px 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.palette-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 6px 10px; border-radius: var(--radius); cursor: pointer; color: var(--text-2); }
.palette-item svg { width: 16px; height: 16px; color: var(--muted); }
.palette-item[aria-selected="true"] { background: var(--brand-soft); color: var(--brand-text); }
.palette-item[aria-selected="true"] svg, .palette-item[aria-selected="true"] .palette-sub { color: var(--brand-text); }
.palette-item .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-sub { color: var(--muted); font-size: 13px; }
.palette-empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 12px; color: var(--muted); }

/* ---------- sign in ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--surface); }
.login .form-side { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.login .form-wrap { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 28px; }
.login .mark { display: flex; align-items: center; gap: 10px; }
.login .mark img { width: 36px; height: 36px; border-radius: 9px; }
.login .mark span { font-weight: 600; font-size: 18px; }
.login .intro { display: flex; flex-direction: column; gap: 6px; }
.login h1 { font-size: 28px; line-height: 36px; font-weight: 600; letter-spacing: -0.4px; }
.login .intro p { color: var(--text-2); }
.login form { display: flex; flex-direction: column; gap: 16px; }
.login .input { height: 42px; }
.login form .btn { height: 44px; font-weight: 600; font-size: 15px; }
.login .fine { color: var(--muted); font-size: 13px; line-height: 18px; }
.login .sky {
  background: #141416; color: #F5EFE8; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; gap: 24px; overflow: hidden;
}
.login .sky .top { display: flex; justify-content: flex-end; font-size: 13px; color: #A39A90; }
.login .sky .hero { width: min(520px, 100%); align-self: center; }
.login .sky .copy { display: flex; flex-direction: column; gap: 10px; max-width: 460px; }
.login .tagline { font-size: 24px; line-height: 32px; font-weight: 600; color: #F5EFE8; }
.login .tagline-sub { color: #A39A90; }

/* ---------- responsive ---------- */
@media (max-width: 959px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); transform: translateX(-100%); visibility: hidden; transition: transform .2s, visibility 0s linear .2s; box-shadow: var(--shadow-overlay); }
  .shell.nav-open .rail { transform: none; visibility: visible; transition: transform .2s; }
  .topbar { padding: 0 16px; gap: 8px; }
  .topbar .menubtn { display: inline-grid; }
  main#main { padding: 20px 16px 48px; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login .sky { display: none; }
  .login .form-side { padding: 32px 20px; align-items: flex-start; }
  .page-head h1 { font-size: 22px; line-height: 30px; }
}
@media (max-width: 560px) {
  .searchbtn kbd, .searchbtn .ph { display: none; }
  .searchbtn { flex: 0 0 38px; width: 38px; padding: 0; justify-content: center; }
  .userbtn .name { display: none; }
  .userbtn { padding: 0 4px; }
  .userbtn .chev { display: none; }
}

/* Single sign-on on the sign-in page. */
.login .sso { display: flex; flex-direction: column; gap: 16px; }
.login .sso:empty { display: none; }
.login .sso-btn { height: 44px; justify-content: center; font-weight: 600; font-size: 15px; }
.login form[hidden] { display: none; }
.login .login-breakglass { align-self: center; color: var(--muted); }
