/*
 * The frame every admin page shares: the main menu down the left on wide
 * screens; on phones, the main pages in a bar along the bottom and the rest
 * in a sheet. Pages keep their own look inside .shell-main. Classes here are
 * specific enough to beat the pages' element rules (button, dialog, h2).
 */

:root {
  --nav-bg: #0E2A33; --nav-ink: #E6F0F2; --nav-dim: #C6D7DC; --nav-muted: #93AEB6;
  --nav-hover: #143A45; --nav-current: #1D4C59; --nav-line: #22434D; --nav-focus: #8ED8EA;
  --nav-badge: #F2B544; --nav-badge-ink: #2A1A00;
}
@media (prefers-color-scheme: dark) {
  :root { --nav-bg: #071318; --nav-hover: #10282F; --nav-current: #18414C; --nav-line: #1B323A; }
}

.shell { display: flex; align-items: flex-start; min-height: 100vh; }
.shell-main { flex: 1; min-width: 0; padding: 1.5rem 1.25rem 3rem; }

.shell-nav {
  position: sticky; top: 0; flex: none; width: 15.5rem; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 1.1rem; padding: 1.25rem .75rem 1rem;
  background: var(--nav-bg); color: var(--nav-ink); border-right: 1px solid var(--nav-line);
  font-size: .9rem; line-height: 1.45;
}

.shell-brand { display: grid; gap: .1rem; padding: 0 .75rem; min-width: 0; }
.shell-logo { color: #fff; font-size: 1.1rem; font-weight: 700; letter-spacing: .01em; text-decoration: none; }
.shell-org { font-size: .78rem; color: var(--nav-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.shell-full { display: grid; gap: .9rem; }
.shell-group { display: grid; gap: .1rem; }
.shell-heading { margin: 0; padding: 0 .75rem .2rem; font-size: .72rem; font-weight: 600; letter-spacing: .04em; color: var(--nav-muted); }
.shell-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }

.shell-link {
  display: flex; align-items: center; gap: .7rem; min-height: 2.75rem; padding: 0 .75rem;
  border-radius: 8px; color: var(--nav-dim); text-decoration: none;
}
.shell-link:hover { background: var(--nav-hover); color: #fff; }
.shell-link[aria-current="page"] { background: var(--nav-current); color: #fff; font-weight: 600; }
.shell-link svg, .shell-tab svg, .shell-icon-button svg { flex: none; width: 1.2rem; height: 1.2rem; }
.shell-text { flex: 1; min-width: 0; }
.shell-badge {
  min-width: 1.45rem; padding: .05rem .4rem; border-radius: 999px; text-align: center;
  font-size: .72rem; font-weight: 700; line-height: 1.4; background: var(--nav-badge); color: var(--nav-badge-ink);
}
.shell-badge[hidden] { display: none; }

.shell-user { margin-top: auto; display: grid; gap: .2rem; padding: .9rem .75rem 0; border-top: 1px solid var(--nav-line); }
.shell-who { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.shell-avatar {
  flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%; display: grid; place-items: center;
  background: #2C5A66; color: #fff; font-weight: 600;
}
.shell-who-text { min-width: 0; display: grid; }
.shell-name { font-size: .85rem; font-weight: 600; overflow-wrap: anywhere; }
.shell-role { font-size: .75rem; color: var(--nav-muted); }
.shell-actions { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.shell-actions a, .shell-actions .shell-button {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0; border: 0; border-radius: 0;
  background: none; color: #BFE3EC; font: inherit; font-size: .82rem; font-weight: 400; cursor: pointer; text-decoration: none;
}
.shell-actions a:hover, .shell-actions .shell-button:hover { color: #fff; text-decoration: underline; }
.shell-actions a[aria-current="page"] { color: #fff; font-weight: 600; }

.shell-link:focus-visible, .shell-tab:focus-visible, .shell-actions a:focus-visible,
.shell-button:focus-visible, .shell-logo:focus-visible, .shell-icon-button:focus-visible {
  outline: 2px solid var(--nav-focus); outline-offset: -2px;
}

/* The phone bar: hidden until the screen is narrow. */
.shell-tabs { display: none; }
.shell-tab {
  position: relative; display: grid; justify-items: center; align-content: center; gap: .15rem;
  min-height: 3.6rem; padding: .35rem .15rem; border: 0; border-radius: 0; background: none;
  color: var(--nav-dim); font: inherit; font-size: .72rem; font-weight: 400; text-decoration: none; cursor: pointer;
}
.shell-tab[aria-current="page"] { color: #fff; font-weight: 600; box-shadow: inset 0 3px 0 var(--nav-focus); }
.shell-tab .shell-badge { position: absolute; top: .3rem; left: calc(50% + .35rem); min-width: 1.2rem; padding: 0 .3rem; font-size: .66rem; }

.shell-sheet {
  margin: auto auto 0; width: 100%; max-width: 30rem; max-height: 85vh; overflow-y: auto;
  padding: .75rem .75rem calc(1rem + env(safe-area-inset-bottom)); border: 0; border-radius: 16px 16px 0 0;
  background: var(--nav-bg); color: var(--nav-ink); font-size: .9rem; line-height: 1.45;
}
.shell-sheet::backdrop { background: rgba(4, 16, 20, .55); }
.shell-sheet-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 0 .5rem .75rem; }
.shell-sheet .shell-full { margin-bottom: 1rem; }
.shell-icon-button {
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem; padding: 0; border: 0; border-radius: 8px;
  background: none; color: var(--nav-dim); cursor: pointer;
}
.shell-icon-button:hover { background: var(--nav-hover); color: #fff; }

@media (max-width: 860px) {
  .shell { display: block; }
  .shell-main { padding: 1rem .85rem calc(5.25rem + env(safe-area-inset-bottom)); }
  .shell-nav {
    position: fixed; z-index: 40; top: auto; right: 0; bottom: 0; left: 0; width: auto; height: auto;
    overflow: visible; flex-direction: row; gap: 0; padding: 0 0 env(safe-area-inset-bottom);
    border-right: 0; border-top: 1px solid var(--nav-line);
  }
  .shell-nav > .shell-brand, .shell-nav > .shell-full, .shell-nav > .shell-user { display: none; }
  .shell-nav > .shell-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
}

@media print {
  .shell-nav, .shell-sheet { display: none !important; }
  .shell { display: block; }
  .shell-main { padding: 0; }
}
