/* The shell: a sidebar of sections, the page beside it. On a phone the
   sidebar becomes a drawer opened from the top bar. */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
  padding: 16px 12px; background: var(--surface); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; }
.brand b { display: block; font-size: 1rem; line-height: 1.1; }
.brand small { display: block; font-size: .78rem; }
.side .group { margin: 14px 10px 4px; font-size: .7rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.side nav a {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 520;
}
.side nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.side nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 620; }
.side nav a svg { flex: none; }
.side .spacer { flex: 1; min-height: 16px; }
.account { border-top: 1px solid var(--line); padding: 12px 4px 0; display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; padding: 0 6px; min-width: 0; }
.who .avatar {
  flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-3); color: var(--ink-2); font-weight: 650; font-size: .8rem;
}
.who div { min-width: 0; }
.who b, .who small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who b { font-size: .88rem; font-weight: 600; }
.account .row { padding: 0 2px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-right: 6px; }
.status-dot.bad { background: var(--bad); }

.topbar { display: none; }
main { padding: 26px 36px 64px; max-width: 1240px; width: 100%; }

/* Page header: breadcrumbs, title with status, actions. */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: .85rem; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { color: var(--ink-3); }
.crumbs a:hover { color: var(--ink); }
.pagehead { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.pagehead .title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.pagehead h1 { overflow-wrap: anywhere; }
.pagehead .sub { color: var(--ink-3); margin: 4px 0 0; font-size: .92rem; }
.pagehead .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 14rem; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 14px 18px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.stack > * + * { margin-top: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 18rem; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(24rem, 100%); }
.login .brand { padding: 0 0 18px; }
.login button.primary { width: 100%; height: 40px; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; z-index: 30; inset: 0 auto 0 0; width: min(290px, 86vw);
    transform: translateX(-102%); transition: transform .18s ease; box-shadow: var(--shadow-2);
  }
  .app.open .side { transform: none; }
  .app.open::after { content: ""; position: fixed; inset: 0; z-index: 25; background: var(--scrim); }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
    height: 52px; padding: 0 10px; background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .topbar .brand { padding: 0; }
  main { padding: 18px 16px 48px; }
  .split { grid-template-columns: 1fr; }
}
