/* SOURCE: appa@c1c77c8 public/app.css */
/* pattern: types-only (styles only; no runtime logic lives here) */
/*
  The WCAG 2.1 AA floor, lifted whole: contrast-checked color variables for
  both schemes, prefers-reduced-motion, :focus-visible outlines, .sr-only,
  and the tablist styles. Removed: the .appa-chat-* bubble and composer
  rules. Class prefix renamed appa- -> hub-. A skip link was added, since
  the shell has a real nav now.

  --muted is the only knob for secondary text, and its value must hold
  4.5:1 against --panel in both schemes. Do not dim it with opacity.

  The login block was added with the same floor in mind. Its rules:
    - every control clears 44px, because these are school iPads;
    - inputs are 16px or larger, because iOS zooms the page on anything
      smaller the moment a field takes focus;
    - --danger is the error colour and holds 4.5:1 in both schemes, but
      colour is never the only signal: errors also carry role="alert" text;
    - the layout is a single column that works from 320px up, since half the
      parents read this on a phone.
*/
/* Appa's navy, team-blue and brass palette, mapped to the hub's existing components.
   No Appa scripts, identity picker, KidWind panels or external font requests. */
:root {
  color-scheme: dark;
  --bg: #071828;
  --panel: #0d2a40;
  --panel-raised: #12385a;
  --border: #1a3d5c;
  --text: #eaf1f7;
  --muted: #c2d3e0;
  --accent: #3a9ae0;
  --accent-text: #071828;
  --brass: #e3a658;
  --danger: #ff9a82;
  --header-text: #eaf1f7;
  --header-brass: #e3a658;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f5f3ec;
    --panel: #ffffff;
    --panel-raised: #eeece3;
    --border: #d4cfbd;
    --text: #0b1d2c;
    --muted: #46596b;
    --accent: #0063a7;
    --accent-text: #ffffff;
    --brass: #a66818;
    --danger: #b2482e;
  }
}
/* An explicit choice overrides the OS; no attribute keeps following it. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f3ec;
  --panel: #ffffff;
  --panel-raised: #eeece3;
  --border: #d4cfbd;
  --text: #0b1d2c;
  --muted: #46596b;
  --accent: #0063a7;
  --accent-text: #ffffff;
  --brass: #a66818;
  --danger: #b2482e;
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
* {
  box-sizing: border-box;
}
/* A view toggled with [hidden] must stay hidden even when a later rule
   gives it display: flex. */
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-image: radial-gradient(
      1200px 600px at 20% -10%,
      rgba(58, 154, 224, 0.07),
      transparent 60%
    ), radial-gradient(900px 500px at 110% 10%, rgba(197, 132, 46, 0.05), transparent 60%);
  color: var(--text);
  font-family: Inter, "Segoe UI", ui-sans-serif, -apple-system, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
.hub-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--panel);
  color: var(--text);
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  z-index: 10;
}
.hub-skip-link:focus {
  left: 0;
}
.hub-shell-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1.5rem;
  background: linear-gradient(180deg, #0d2a40, #071828);
  color: var(--header-text);
  border-bottom: 2px solid #3a9ae0;
}
.hub-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}
.hub-brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  height: 40px;
  width: 40px;
  border: 2px solid var(--header-brass);
  border-radius: 8px;
  color: var(--header-brass);
  font-size: 1.35rem;
  font-weight: 700;
}
.hub-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.hub-subtitle {
  color: var(--header-brass);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.hub-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
  min-width: 0;
}
.hub-theme-label {
  color: var(--header-text);
  font-size: 0.9rem;
}
.hub-theme-select {
  min-height: 44px;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--header-brass);
  border-radius: 8px;
  background: #0d2a40;
  color: var(--header-text);
  font: inherit;
  cursor: pointer;
}
.hub-theme-select:focus-visible {
  outline: 2px solid var(--header-brass);
  outline-offset: 2px;
}
.hub-identity {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.hub-who {
  color: var(--header-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hub-shell-header .hub-button-quiet {
  background: #0d2a40;
  border-color: var(--header-brass);
  color: var(--header-text);
}
.hub-tabs {
  display: flex;
  gap: 0.15rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.hub-tabs button {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.75rem 1rem;
  min-height: 48px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  scroll-snap-align: start;
  border-bottom: 2px solid transparent;
}
.hub-tabs button:hover,
.hub-tabs button.active {
  color: var(--text);
}
.hub-tabs button.active {
  border-bottom-color: var(--accent);
  font-weight: 700;
}
.hub-button-primary:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 2px;
}
.hub-tabs button:focus-visible,
.hub-main:focus-visible,
.hub-tab-content:focus-visible,
.hub-login-heading:focus-visible,
.hub-button:not(.hub-button-primary):focus-visible,
.hub-switch-option:focus-visible,
.hub-field input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.hub-shell-header .hub-button-quiet:focus-visible {
  outline: 2px solid var(--header-brass);
  outline-offset: 2px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hub-main {
  padding: 0;
}
.hub-tab-content {
  padding: 1.5rem;
}
.hub-tab-content a,
.hub-main a {
  color: var(--accent);
}
.hub-tabs::-webkit-scrollbar {
  display: none;
}
.hub-empty {
  color: var(--muted);
  max-width: 60ch;
}

/* --- Buttons -------------------------------------------------------------- */

.hub-button {
  min-height: 44px;
  min-width: 44px;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
}
.hub-button[disabled] {
  cursor: default;
  /* Dimming with opacity would sink the label below 4.5:1, so the disabled
     state is carried by the border and the cursor instead. */
  border-style: dashed;
}
.hub-button-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  width: 100%;
}
.hub-button-quiet {
  color: var(--text);
}

/* --- Child onboarding ------------------------------------------------------ */
.hub-onboarding,
.hub-child-setup {
  max-width: 44rem;
  margin: 1rem auto;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
.hub-onboarding h2,
.hub-child-setup h1 {
  margin-top: 0;
}
.hub-child-list,
.hub-invitation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.hub-child-choice {
  text-align: left;
  font-weight: 600;
}
.hub-invitation {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.hub-invitation label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.hub-invitation input {
  width: 100%;
  min-height: 48px;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.hub-invitation-actions {
  margin: 0.7rem 0 1rem;
}
.hub-qr {
  display: block;
  max-width: min(100%, 330px);
  height: auto;
  margin: 1rem auto;
  image-rendering: pixelated;
}
.hub-passkey-login {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.hub-child-setup .hub-button {
  margin: 0.5rem 0;
}

/* --- Login ---------------------------------------------------------------- */

.hub-login {
  padding: 1rem;
  /* Comfortable on a phone, not a stretched ribbon on a monitor. */
  max-width: 34rem;
  margin: 0 auto;
}
.hub-login-heading {
  margin: 0.25rem 0 1rem;
  font-size: 1.5rem;
}
.hub-switch {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.hub-switch-option {
  flex: 1;
  min-height: 44px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 1rem;
  font-family: inherit;
  cursor: pointer;
}
.hub-switch-option[aria-pressed="true"] {
  color: var(--text);
  border-color: var(--accent);
  /* Not colour alone: the selected option is also the heavier one. */
  font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--accent);
}
.hub-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.hub-form-lede {
  margin: 0;
  color: var(--muted);
}
.hub-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.hub-field label {
  font-weight: 600;
}
.hub-field input {
  width: 100%;
  min-height: 52px;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  /* 16px minimum: anything smaller makes iOS zoom on focus. */
  font-size: 1.15rem;
  font-family: inherit;
}
#hub-code {
  /* A code is read character by character off a card. */
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#hub-pin {
  font-size: 1.4rem;
  letter-spacing: 0.4em;
  max-width: 9rem;
}
.hub-pin-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.hub-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.hub-error {
  margin: 0;
  color: var(--danger);
  font-weight: 600;
}
.hub-note {
  margin: 0;
  color: var(--text);
}
.hub-preview-banner {
  margin: 0;
  padding: 0.45rem 1rem;
  background: #765014;
  color: #ffffff;
  font-weight: 700;
  text-align: center;
}
.hub-status {
  margin: 0;
  padding: 0.6rem 1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
/* A live region has to stay in the document to announce, so it is collapsed
   when empty rather than removed or hidden. */
.hub-status:empty,
.hub-error:empty,
.hub-note:empty {
  display: none;
}

@media (max-width: 30rem) {
  .hub-shell-header {
    flex-wrap: wrap;
  }
  .hub-header-actions {
    justify-content: flex-start;
    width: 100%;
  }
  .hub-switch {
    flex-direction: column;
  }
  .hub-tabs {
    padding: 0 0.5rem;
    flex-wrap: wrap;
    overflow-x: visible;
    scroll-snap-type: none;
  }
  .hub-tabs button {
    flex: 1 1 auto;
    padding: 0.6rem;
  }
  .hub-tab-content {
    padding: 1rem;
  }
}

/* --- Tab fragments -------------------------------------------------------- */
/*
  Same floor as the login block, for the same reasons: every control clears
  44px because these are school iPads, --muted is the only knob for secondary
  text, and nothing is signalled by colour alone -- .hub-warn carries weight as
  well as --danger, and the coverage shortfall says the number in words.
*/

.hub-panel {
  max-width: 44rem;
}
.hub-panel-heading {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
}
.hub-section-heading {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.05rem;
}
.hub-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.hub-card-title {
  font-weight: 600;
}
.hub-card img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
.hub-compact-list {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.hub-compact-list li {
  overflow-wrap: anywhere;
  padding: 0.4rem 0.65rem;
  border-left: 3px solid var(--border);
  background: var(--panel);
}
.hub-card-body {
  margin: 0.2rem 0 0;
  /* An announcement keeps the line breaks whoever wrote it typed. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.hub-meta {
  color: var(--muted);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.hub-badge {
  align-self: flex-start;
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
}
.hub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
/* .hub-button-primary is full width in the login column; in a row it is not. */
.hub-actions .hub-button {
  width: auto;
}
.hub-inline-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}
.hub-field select,
.hub-field textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  /* 16px minimum: anything smaller makes iOS zoom on focus. */
  font-size: 1rem;
  font-family: inherit;
}
.hub-field textarea {
  min-height: 6rem;
  resize: vertical;
}
.hub-field select:focus-visible,
.hub-field textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.hub-choice {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
}
.hub-choice input[type="checkbox"] {
  width: 22px;
  height: 22px;
}
.hub-feed-url,
.hub-code-printed {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow-wrap: anywhere;
}
.hub-code-printed {
  font-size: 1.2rem;
  letter-spacing: 0.1em;
}
.hub-warn {
  color: var(--danger);
  font-weight: 600;
}
