/* The signed-in frame (app.js buildShell): a sidebar with the logo, a link
   per page and the account button, and the page area next to it. On narrow
   screens (760px and below) the sidebar becomes a bar at the top (logo,
   account button) and the page links a tab bar at the bottom. The logo
   (app.js brand()) also heads the sign-in pages (.auth-brand, style.css).
   Tokens come from style.css. No outlines: things are told apart by fill,
   and the keyboard focus ring is the only outline. */

/* ---- logo ---- */
/* One filled glyph (ui.js ICONS.logo) as tall as the wordmark's font size,
   about 3px of space from it (its own 1px margin, the 1px gap and the
   letter's side bearing), like Apple Music's logo. */
.brand-mark { display: inline-grid; flex: none; place-items: center; }
.logo { display: block; width: 1.35em; height: 1.35em; fill: none; stroke: none; } /* (the parts of the cookie have their own colours) */
.brand-name { font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }

/* ---- frame ---- */
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

/* ---- sidebar ---- */
.sidebar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  border-right: 1px solid var(--side-line);
  background: var(--sidebar);
}
/* Measured on Apple Music's web player: the logo starts 28px from the
   left, centred about 42px from the top, and the page links start at
   80px. */
.brand {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 1px;
  height: 22px;
  margin: 31px 0 23px 28px;
  border-radius: 6px;
  color: var(--side-ink);
  font-size: 22px;
  line-height: 22px;
  text-decoration: none;
}
.side-nav {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  margin: 0;
  padding: 4px 12px 0 20px; /* it scrolls in short windows: room for the focus ring */
  overflow-y: auto;
  list-style: none;
}
.side-item { margin: 0 0 4px; padding: 0; }
/* A link: 36px tall, radius 8; a 24px icon box 6px in, the label 4px after
   it, 14px/20px; the current page on a faint fill, its label semibold. */
.side-link {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 4px 0 6px;
  border-radius: 8px;
  color: var(--side-ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
@media (hover: hover) {
  .side-link:hover { background: var(--side-hover); }
}
.side-link[aria-current="page"] { background: var(--surface); font-weight: 600; }
/* The glyph is drawn 18px inside its 24px box: about 14–16px of ink and
   1.2px lines, as Apple Music's sidebar icons. */
.side-link .side-icon { width: 18px; height: 18px; margin: 3px; color: var(--accent); stroke-width: 1.6; }
.side-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* How many people wait for approval (awaiting.js), on 사용자 for
   administrators: a filled count at the end of the link. */
.side-count {
  flex: none;
  min-width: 20px;
  height: 20px;
  margin: 0 4px 0 auto;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 20px;
  text-align: center;
}

/* Account, at the foot of the sidebar like a signed-in Apple Music: a round
   picture (24px, here the name's first letter on Apple's contact grey) and
   the name, 14px semibold; no pill. Its menu opens upwards. */
.side-account { padding: 16px 12px 14px; }
.side-account > .menu-wrap { display: flex; }
.account-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0 8px 0 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--side-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
@media (hover: hover) {
  .account-btn:hover { background: var(--side-hover); }
}
.account-btn[aria-expanded="true"] { background: var(--side-hover); }
.avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffb3c9, #ff8fb1);
  color: #5a1633;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.account-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media not all and (max-width: 760px) {
  /* The account menu opens upwards from the account button, as wide as it. */
  .side-account .menu { top: auto; right: 0; bottom: calc(100% + 8px); left: 0; min-width: 0; max-width: none; }
}

/* ---- page area ---- */
/* Anchored to the sidebar like Apple Music's content (not centred in the
   space beside it, which leaves an empty band on wide windows). */
/* Like Apple Music's content: next to the sidebar and as wide as the
   window (the computer tiles add columns); the title 34px bold, 32px from
   the top, 40px from the sidebar. Forms and long text keep their own
   widths (style.css). */
.page { width: 100%; margin: 0; padding: 32px 40px 88px; }
.page:focus { outline: none; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin-bottom: 8px; }
.page-title { margin: 0; font-size: 34px; font-weight: 700; line-height: 40px; }
.page-title:focus { outline: none; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.page-sub { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.page-sub strong { color: var(--text); font-weight: 600; }
.computer-area, .users-area, .settings-area, .filters { margin-top: 24px; }

@media (min-width: 761px) and (max-width: 1023px) {
  .page { padding: 32px 28px 80px; }
}

/* ---- narrow screens: top bar and bottom tab bar ---- */
@media (max-width: 760px) {
  /* The bars' material is more opaque than the floating glass: white
     banners scroll under them and the labels must stay readable. */
  .shell { --bar-glass: var(--sidebar); display: block; }
  .sidebar {
    z-index: 30;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: auto;
    min-height: 52px;
    padding: 8px 16px;
    border-right: 0;
    background: transparent;
  }
  /* The bar's frosted glass is a layer of its own: a backdrop-filter on the
     bar itself would make it the box the fixed tab bar is placed in. */
  .sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--bar-glass);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
  }
  .brand { align-self: center; height: auto; margin: 0; font-size: 18px; line-height: 1.2; }
  .side-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    flex-direction: row;
    gap: 0;
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px));
    overflow: visible;
    background: var(--bar-glass);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
  }
  .side-item { flex: 1 1 0; min-width: 0; margin: 0; }
  .side-link {
    position: relative; /* the dot below is placed in it */
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    height: auto;
    min-height: 50px;
    padding: 4px 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
  }
  .side-link[aria-current="page"] { background: transparent; color: var(--accent); }
  .side-link .side-icon { width: 26px; height: 26px; margin: 0; color: inherit; }
  .side-label { max-width: 100%; }
  /* The count becomes a dot on the top right corner of the icon (26px wide
     in the middle of the link, 4px from its top). */
  .side-count { position: absolute; top: 3px; left: calc(50% + 8px); width: 9px; min-width: 0; height: 9px; margin: 0; padding: 0; overflow: hidden; font-size: 0; }
  .side-account { padding: 0; }
  /* Only the round picture, a bit larger. */
  .account-btn { justify-content: center; width: 36px; height: 36px; padding: 0; border-radius: 50%; }
  .avatar { width: 32px; height: 32px; font-size: 14px; }
  .account-name { display: none; }
  .page { padding: 22px 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .page-title { font-size: 28px; line-height: 34px; }
  /* Focus and jumps never end under the top bar or the tab bar. */
  html { scroll-padding-top: 64px; scroll-padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)); }
  .settings-card { scroll-margin-top: 16px; }
  /* A menu that opens low on the page can be scrolled clear of the tab bar:
     the space under it adds to the page's height. */
  .shell:not(.single-page) .menu::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 0;
    width: 1px;
    height: calc(72px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
  }
  body:has(.shell:not(.single-page)) .unsaved-bar { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
  /* Only one page (members): no tab bar. */
  .single-page .side-nav { display: none; }
  .single-page .page { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 760px) and (hover: hover) {
  .side-link:hover { background: transparent; }
  .side-link:not([aria-current="page"]):hover { color: var(--text); }
  .account-btn:hover { background: var(--hover); }
}

/* Forced colors (e.g. Windows contrast themes) drop fills, so the sidebar,
   the account button and the current page get a system-colour line. */
@media (forced-colors: active) {
  .sidebar { border-right: 1px solid CanvasText; }
  .account-btn { border: 1px solid ButtonText; }
  .side-link[aria-current="page"] { outline: 2px solid Highlight; outline-offset: -2px; }
  .side-count { border: 1px solid CanvasText; line-height: 18px; }
}
@media (forced-colors: active) and (max-width: 760px) {
  .sidebar { border-right: 0; border-bottom: 1px solid CanvasText; }
  .side-nav { border-top: 1px solid CanvasText; }
  /* The dot has no text to show: it keeps a fill. */
  .side-count { border: 0; background: Highlight; forced-color-adjust: none; }
}

@media (prefers-reduced-motion: reduce) {
  .side-link, .account-btn { transition: none; }
}
