/* Signed-in app shell (task #98). Uses only the tokens in theme.css.
   One breakpoint at 900px. Sign-in screen styles live in style.css, untouched. */
body:has(.shell) {
  display: block;
  background: var(--bg);
}

.shell {
  color-scheme: light;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.45 var(--font-body);
  overflow-x: hidden;
}

.shell *,
.shell *::before,
.shell *::after {
  box-sizing: border-box;
}

/* Top bar: wordmark top-left, studio name beside it in grey. */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px var(--gutter);
  min-height: 56px;
}
.wordmark {
  font: 800 20px/1 var(--font-brand);
  letter-spacing: -0.01em;
  color: var(--text);
}
.studio {
  color: var(--muted);
  font-size: 15px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar .spacer { flex: 1; }
.switcher {
  display: block;
  padding: 0 var(--gutter) 8px;
}
.switcher select {
  width: 100%;
  min-height: var(--tap);
}

/* Buttons. Base reset overrides the old global button style in style.css. */
.shell button {
  font: 600 17px/1.2 var(--font-body);
  border-radius: var(--radius);
  cursor: pointer;
  min-height: var(--tap);
  padding: 0 18px;
  background: transparent;
  color: var(--text);
  border: 0;
}
.shell button:focus-visible,
.shell a:focus-visible,
.shell input:focus-visible,
.shell select:focus-visible,
.shell summary:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}
.shell button.primary {
  width: 100%;
  min-height: var(--primary-h);
  background: var(--brand);
  color: var(--brand-ink);
}
.shell button.primary:hover { background: var(--brand-dark); }
.shell button.primary:disabled { opacity: 0.6; cursor: default; }
.shell button.outline {
  background: var(--card);
  border: 1px solid var(--line-strong);
}
.shell button.outline:hover { background: var(--bg); }
.shell button.link {
  padding: 0 8px;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
}
.shell button.chip {
  min-width: 64px;
  background: var(--card);
  border: 1px solid var(--line-strong);
}
.shell button.chip[aria-pressed='true'] {
  border: 2px solid var(--text);
}

/* Forms */
.shell label {
  display: block;
  font-weight: 500;
  margin: 0 0 14px;
}
.shell input,
.shell select {
  display: block;
  width: 100%;
  min-height: var(--tap);
  margin-top: 6px;
  padding: 0 12px;
  font: 400 17px var(--font-body);
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.shell details { margin: 4px 0 14px; }
.shell summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  cursor: pointer;
  color: var(--muted);
  font-weight: 500;
}
.shell details[open] summary { margin-bottom: 8px; }

/* Content */
.content { padding: 0 var(--gutter); }
.pane h1 {
  font: 800 28px/1.1 var(--font-brand);
  letter-spacing: -0.02em;
  margin: 8px 0 14px;
}
.pane h2 {
  font: 700 22px/1.2 var(--font-brand);
  margin: 0 0 6px;
}
.kcard {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 0 0 12px;
}
.shell .muted { color: var(--muted); font-size: inherit; word-break: normal; }
.shell .muted.small { font-size: 15px; }
.small { font-size: 15px; }
.err { color: var(--error); font-size: 15px; margin: 6px 0 0; min-height: 0; }
.err:empty { display: none; }
.ok { color: var(--ok); font-size: 15px; margin: 6px 0 0; }
.ok:empty { display: none; }
.big { font: 800 34px/1.1 var(--font-brand); margin: 4px 0; }
.row-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.row-list li + li { border-top: 1px solid var(--line); }
.row-list button.row {
  display: block;
  width: 100%;
  text-align: left;
  min-height: 56px;
  padding: 10px 16px;
  border-radius: 0;
  font-weight: 400;
}
.row-list button.row:hover { background: var(--bg); }
.row-list button.row[aria-current='true'] { background: var(--bg); }
.row-list .t { font-weight: 600; display: block; }
.row-list .s { color: var(--muted); font-size: 15px; display: block; }
.left-line { margin: 4px 0 18px; }
.row-list li.plain { padding: 12px 16px; }
.cancelled .t { text-decoration: line-through; color: var(--muted); }
.line-link {
  display: block;
  width: 100%;
  text-align: left;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 12px; }
.empty { margin: 8px 0 12px; }
.back { margin: 4px 0 4px -8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* Primary button slot: fixed at the bottom on phones (thumb reach). */
.primary-bar {
  position: fixed;
  left: var(--gutter);
  right: var(--gutter);
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  z-index: 5;
}
.shell.no-nav .primary-bar { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.content { padding-bottom: 170px; }
.shell.no-nav .content { padding-bottom: 100px; }

/* Bottom nav on phones; at most 3 items. */
.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px));
}
.shell .nav button {
  flex: 1;
  min-height: 56px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 10px;
}
.shell .nav button[aria-current='page'] {
  color: var(--brand);
  font-weight: 700;
}

/* Phones: list and detail share the screen; detail replaces list. */
.owner .pane.detail { display: none; }
.owner.has-detail .pane.detail { display: block; }
.owner.has-detail .pane.list { display: none; }
.owner .pane.detail .hint { display: none; }
/* A detail screen on a phone is one job: hide the menu, keep Back. */
@media (max-width: 899.98px) {
  .owner.has-detail .nav { display: none; }
  .owner.has-detail .primary-bar { bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .owner.has-detail .content { padding-bottom: 100px; }
}

@media (min-width: 900px) {
  .shell {
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-template-rows: auto auto 1fr;
    align-content: start;
  }
  .nav { grid-row: 3; grid-column: 1; }
  .content { grid-row: 3; }
  .shell.no-nav { grid-template-columns: 1fr; }
  .topbar { grid-column: 1 / -1; padding: 16px 24px; }
  .switcher { grid-column: 1 / -1; padding: 0 24px 8px; max-width: 480px; }
  .nav {
    position: static;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border-top: 0;
    padding: 8px 12px;
  }
  .shell .nav button { flex: 0 0 auto; text-align: left; padding: 0 14px; }
  .content { padding: 0 24px 40px; }
  .shell.no-nav .content { padding-bottom: 40px; }
  .primary-bar { position: static; margin: 8px 0 12px; }
  /* Teacher and student: one centred column, max 480px. */
  .single .content { width: 100%; max-width: 480px; margin: 0 auto; }
  /* Owner and manager: list left, detail right, no page change. */
  .owner .content {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    max-width: 1100px;
    align-items: start;
  }
  .owner .pane.detail,
  .owner.has-detail .pane.detail,
  .owner.has-detail .pane.list { display: block; }
  .owner .pane.detail .hint { display: block; }
  .owner .pane.detail .back { display: none; }
  .owner .pane.detail { padding-top: 54px; }
  /* Only one primary button on screen: hide the list's when the detail has one. */
  .owner.detail-has-primary .pane.list .primary-bar { display: none; }
}
.low { color: var(--brand); font-weight: 600; }
