/* app.css (CAF Guide): design tokens (light + dark) and shared pieces, each page's styles, and at the end the role layer that
   gives Anvil components (Button, Label, TextBox, notifications, dialogs, RepeatingPanel grids) the same look.
   Restyle the app by changing the tokens at the top (both the light and the dark blocks). */

/* Tokens: CAF Guide. Navy from the app logo, Canada red for highlights, olive (CADPAT-style) for "got it";
   Barlow Condensed headings over Barlow text. Restyle the app by changing these (light and dark). */
:root {
  --c-bg: #f1f0eb;          /* page: warm paper */
  --c-surface: #ffffff;     /* cards, menus, inputs */
  --c-surface-2: #f8f7f3;   /* subtle fills, hovers */
  --c-ink: #1b2230;         /* text */
  --c-muted: #5d6573;       /* secondary text (4.5:1 on paper and white) */
  --c-faint: #5d6573;       /* hints, placeholders */
  --c-line: #dedbd2;        /* borders */
  --c-brand: #2e4a70;       /* navy: primary buttons, links, focus */
  --c-brand-ink: #ffffff;
  --c-brand-soft: #e2e8f1;
  --c-accent: #c8102e;      /* Canada red */
  --c-red: #c8102e; --c-red-soft: #fbe5e8;
  --c-good: #4d6a2c; --c-good-soft: #e8eedd;
  --c-warn: #8a5d00; --c-warn-soft: #fbf0d2;
  --c-bad: #b3261e;  --c-bad-soft: #fbeae8;
  --c-on-status: #fff;
  --c-hero: #2f4466; --c-hero-ink: #f3f0e6;
  --c-mix: 80%;             /* module colours used as text: mixed toward the ink so they reach 4.5:1 */
  --radius: 12px; --radius-sm: 10px; --radius-btn: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .07);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .22);
  --font-body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;
  --maxw: 980px;
  --header-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --c-bg: #0f1318; --c-surface: #18202a; --c-surface-2: #131a22; --c-ink: #e8eaee; --c-muted: #a3acb8; --c-faint: #a3acb8;
    --c-line: #2a3442; --c-brand: #8fb3e3; --c-brand-ink: #0c1522; --c-brand-soft: #1d2b3f; --c-accent: #ff5d6c;
    --c-red: #ff6b78; --c-red-soft: #3a1820;
    --c-good: #a5c67a; --c-good-soft: #232f18; --c-warn: #e5b94e; --c-warn-soft: #3a3017; --c-bad: #f28b82; --c-bad-soft: #3b201d;
    --c-on-status: #0c1522; --c-hero: #1c2a40; --c-hero-ink: #eef0f3; --c-mix: 45%;
    --shadow: none; --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --c-bg: #0f1318; --c-surface: #18202a; --c-surface-2: #131a22; --c-ink: #e8eaee; --c-muted: #a3acb8; --c-faint: #a3acb8;
  --c-line: #2a3442; --c-brand: #8fb3e3; --c-brand-ink: #0c1522; --c-brand-soft: #1d2b3f; --c-accent: #ff5d6c;
  --c-red: #ff6b78; --c-red-soft: #3a1820;
  --c-good: #a5c67a; --c-good-soft: #232f18; --c-warn: #e5b94e; --c-warn-soft: #3a3017; --c-bad: #f28b82; --c-bad-soft: #3b201d;
  --c-on-status: #0c1522; --c-hero: #1c2a40; --c-hero-ink: #eef0f3; --c-mix: 45%;
  --shadow: none; --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5); color-scheme: dark;
}

/* Design kit: motion tokens, browser surfaces, wrapping, press feedback, reduced motion (APP_MAKER/design/kit.css). */
/* design-kit:start */
:root {
  /* easing: never ease-in on UI */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);      /* entering, exiting, most UI */
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);  /* moving across the screen */
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);   /* sheets, drawers */
  --ease-expo: cubic-bezier(0.16, 1, 0.3, 1);      /* one authored entrance */
  /* durations: UI stays under 300ms, exits faster than entrances */
  --dur-press: 140ms; --dur-fast: 180ms; --dur-base: 220ms; --dur-slow: 320ms; --dur-hero: 640ms;
  /* 4px spacing scale */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 96px;
  --measure: 65ch;
}

/* browser surfaces: the parts nobody draws */
::selection { background: color-mix(in srgb, var(--c-brand) 26%, transparent); color: inherit; }
html {
  accent-color: var(--c-brand); caret-color: var(--c-brand);
  scrollbar-color: color-mix(in srgb, var(--c-ink) 26%, transparent) transparent;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { text-underline-offset: .2em; text-decoration-thickness: from-font; }
h1, h2, h3, h4, [role="heading"], .anvil-role-page-title { text-wrap: balance; }
p, li, dd, blockquote, figcaption { text-wrap: pretty; }
td, th, time, output, progress, .num, .tabular, [data-num] { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--c-brand) 60%, transparent); outline-offset: 2px; }

/* press feedback: pressable things answer the moment they're pressed */
:is(.ui-btn, .anvil-role-btn > button, a.anvil-role-btn, .kit-press) {
  transition: transform var(--dur-press) var(--ease-out), background-color var(--dur-fast) ease,
              border-color var(--dur-fast) ease, color var(--dur-fast) ease, opacity var(--dur-fast) ease,
              box-shadow var(--dur-fast) ease;
}
:is(.ui-btn, .anvil-role-btn > button, a.anvil-role-btn, .kit-press):active:not(:disabled) { transform: scale(.97); }

/* entrances: content is visible by default; these only add the arrival */
@keyframes kit-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes kit-pop { from { opacity: 0; transform: scale(.96); } }
@keyframes kit-fade { from { opacity: 0; } }
.kit-in { animation: kit-in var(--dur-slow) var(--ease-out) both; }
.kit-stagger > * { animation: kit-in var(--dur-slow) var(--ease-out) both; }
.kit-stagger > :nth-child(2) { animation-delay: 40ms; } .kit-stagger > :nth-child(3) { animation-delay: 80ms; }
.kit-stagger > :nth-child(4) { animation-delay: 120ms; } .kit-stagger > :nth-child(5) { animation-delay: 160ms; }
.kit-stagger > :nth-child(n+6) { animation-delay: 200ms; }

/* reduced motion = fewer and gentler, not none: movement goes, short fades that confirm a state stay */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .kit-in, .kit-stagger > * { animation-name: kit-fade; animation-delay: 0ms !important; }
  :is(.ui-btn, .anvil-role-btn > button, a.anvil-role-btn, .kit-press):active:not(:disabled) { transform: none; }
}
/* design-kit:end */

/* The app owns the page (not Anvil's theme). */
html, body { background: var(--c-bg) !important; color: var(--c-ink); }
body { margin: 0; font: 16px/1.55 var(--font-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html.ui-modal-open { overflow: hidden; }

.ui, .ui *, .ui *::before, .ui *::after { box-sizing: border-box; }
.ui { font: 16px/1.55 var(--font-body); color: var(--c-ink); }
.ui h1, .ui h2, .ui h3, .ui h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.015em; font-weight: 700; color: var(--c-ink); }
.ui h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); }
.ui h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); }
.ui h3 { font-size: 1.2rem; }
.ui h4 { font-size: 1rem; }
.ui p { margin: 0 0 .8em; }
.ui :is(p, ul, ol, blockquote, figure) + :is(h2, h3) { margin-top: 1.4em; }  /* more space above a heading than below it */
.ui a { color: var(--c-brand); text-underline-offset: 3px; }
.ui [hidden] { display: none !important; }
.ui img { max-width: 100%; }
.ui .muted { color: var(--c-muted); }
.ui .faint { color: var(--c-faint); }
.ui .small { font-size: .875rem; }
.ui-ic, .ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }

/* layout */
.ui-wrap { max-width: var(--maxw); margin: 0 auto; padding: 32px 24px 72px; }
.ui-narrow { max-width: 720px; margin-left: auto; margin-right: auto; }
.ui-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ui-row.end { justify-content: flex-end; }
.ui-row.between { justify-content: space-between; }
.ui-row.top { align-items: flex-start; }
.ui-spacer { flex: 1; }
.ui-stack > * + * { margin-top: 14px; }
.ui-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ui-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ui-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.ui-page-head h1 { margin: 0; font-size: clamp(1.7rem, 3.4vw, 2.3rem); }
.ui-page-head p { margin: 6px 0 0; }

/* cards */
.ui-card { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.ui-card.flat { box-shadow: none; }
.ui-card.tight { padding: 14px 16px; }
.ui-card > :last-child { margin-bottom: 0; }

/* buttons */
:is(.ui-btn, .anvil-role-btn > button, a.anvil-role-btn) { font: 600 .95rem/1.2 var(--font-body); display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; min-height: 44px; border-radius: 999px; border: 1px solid var(--c-line); background: var(--c-surface); color: var(--c-ink);
  cursor: pointer; text-decoration: none; white-space: nowrap; }  /* transitions + press scale: design kit */
:is(.ui-btn, .anvil-role-btn > button, a.anvil-role-btn):hover { border-color: var(--c-ink); }
:is(.ui-btn.primary, .anvil-role-btn.anvil-role-btn-primary > button, a.anvil-role-btn.anvil-role-btn-primary) { background: var(--c-brand); border-color: var(--c-brand); color: var(--c-brand-ink); }
:is(.ui-btn.primary, .anvil-role-btn.anvil-role-btn-primary > button, a.anvil-role-btn.anvil-role-btn-primary):hover { opacity: .92; }
:is(.ui-btn.ghost, .anvil-role-btn.anvil-role-btn-ghost > button, a.anvil-role-btn.anvil-role-btn-ghost) { background: transparent; border-color: transparent; color: var(--c-muted); }
:is(.ui-btn.ghost, .anvil-role-btn.anvil-role-btn-ghost > button, a.anvil-role-btn.anvil-role-btn-ghost):hover { background: var(--c-surface-2); color: var(--c-ink); }
:is(.ui-btn.danger, .anvil-role-btn.anvil-role-btn-danger > button, a.anvil-role-btn.anvil-role-btn-danger) { color: var(--c-bad); }
:is(.ui-btn.danger, .anvil-role-btn.anvil-role-btn-danger > button, a.anvil-role-btn.anvil-role-btn-danger):hover { border-color: var(--c-bad); }
:is(.ui-btn.danger.solid, .anvil-role-btn.anvil-role-btn-danger.anvil-role-btn-solid > button, a.anvil-role-btn.anvil-role-btn-danger.anvil-role-btn-solid) { background: var(--c-bad); border-color: var(--c-bad); color: var(--c-on-status); }
:is(.ui-btn.sm, .anvil-role-btn.anvil-role-btn-sm > button, a.anvil-role-btn.anvil-role-btn-sm) { min-height: 34px; padding: 6px 12px; font-size: .85rem; }
:is(.ui-btn.lg, .anvil-role-btn.anvil-role-btn-lg > button, a.anvil-role-btn.anvil-role-btn-lg) { min-height: 54px; padding: 14px 26px; font-size: 1.05rem; }
:is(.ui-btn.icon, .anvil-role-btn.anvil-role-btn-icon > button, a.anvil-role-btn.anvil-role-btn-icon) { width: 40px; min-height: 40px; padding: 0; }
:is(.ui-btn.block, .anvil-role-btn.anvil-role-btn-block > button, a.anvil-role-btn.anvil-role-btn-block) { width: 100%; }
:is(.ui-btn, .anvil-role-btn > button, a.anvil-role-btn):disabled { opacity: .5; cursor: not-allowed; transform: none; }
:is(.ui-btn.is-busy, .anvil-role-btn.anvil-role-btn-is-busy > button, a.anvil-role-btn.anvil-role-btn-is-busy) { position: relative; color: transparent !important; }
:is(.ui-btn.is-busy, .anvil-role-btn.anvil-role-btn-is-busy > button, a.anvil-role-btn.anvil-role-btn-is-busy)::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor;
  border-color: var(--c-muted) transparent var(--c-muted) transparent; animation: ui-spin .8s linear infinite; }
:is(.ui-btn.primary.is-busy, .anvil-role-btn.anvil-role-btn-primary.anvil-role-btn-is-busy > button, a.anvil-role-btn.anvil-role-btn-primary.anvil-role-btn-is-busy)::after { border-color: var(--c-brand-ink) transparent var(--c-brand-ink) transparent; }
@keyframes ui-spin { to { transform: rotate(360deg); } }
.ui :focus-visible { outline: 3px solid color-mix(in srgb, var(--c-brand) 55%, transparent); outline-offset: 2px; }

/* forms */
.ui-field { display: block; }
.ui-field > span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.ui-field > span em { font-style: normal; font-weight: 400; color: var(--c-muted); }
.ui input[type=text], .ui input[type=email], .ui input[type=password], .ui input[type=search], .ui input[type=number], .ui input[type=url],
.ui input[type=tel], .ui input[type=date], .ui input[type=time], .ui input[type=datetime-local], .ui select, .ui textarea {
  font: inherit; font-size: 1rem; color: var(--c-ink); background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius-sm);
  padding: 11px 13px; width: 100%; min-height: 46px; margin: 0; box-shadow: none; transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease; }
.ui textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
/* tick boxes and radios keep the focus ring above; typed-in fields swap it for the border + glow */
.ui input:not([type=checkbox]):not([type=radio]):focus, .ui select:focus, .ui textarea:focus { outline: none; border-color: var(--c-brand); box-shadow: 0 0 0 3px var(--c-brand-soft); }
.ui ::placeholder { color: var(--c-faint); }
.ui-hint { font-size: .85rem; color: var(--c-muted); margin: 6px 0 0; }
.ui-check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: .95rem; }
.ui-check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--c-brand); flex: none; }
.ui-error { background: var(--c-bad-soft); color: var(--c-bad); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .92rem; }
.ui-note { background: var(--c-brand-soft); color: var(--c-ink); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .92rem; }
.ui-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.ui-choice input { position: absolute; opacity: 0; pointer-events: none; }
.ui-choice span { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border: 1px solid var(--c-line); border-radius: var(--radius-sm); cursor: pointer; font-weight: 500; background: var(--c-surface); }
.ui-choice input:checked + span { border-color: var(--c-brand); background: var(--c-brand-soft); }
.ui-choice input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--c-brand) 55%, transparent); }

/* small pieces */
.ui-badge { display: inline-flex; align-items: center; gap: 5px; font: 600 .75rem/1.3 var(--font-body); padding: 4px 10px; border-radius: 999px;
  background: var(--c-surface-2); color: var(--c-muted); white-space: nowrap; }
.ui-badge.brand { background: var(--c-brand-soft); color: var(--c-brand); }
.ui-badge.good { background: var(--c-good-soft); color: var(--c-good); }
.ui-badge.warn { background: var(--c-warn-soft); color: var(--c-warn); }
.ui-badge.bad { background: var(--c-bad-soft); color: var(--c-bad); }
.ui-seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--c-surface-2); border-radius: 999px; border: 1px solid var(--c-line); }
.ui-seg button { font: 500 .85rem/1 var(--font-body); border: 0; background: none; color: var(--c-muted); padding: 8px 13px; border-radius: 999px; cursor: pointer; }
.ui-seg button.on { background: var(--c-surface); color: var(--c-ink); box-shadow: var(--shadow); }
.ui-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--c-line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.ui-tabs a, .ui-tabs button { font: 600 .92rem/1 var(--font-body); border: 0; background: none; color: var(--c-muted); padding: 12px 14px; border-bottom: 2px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; margin-bottom: -1px; }
.ui-tabs .on { color: var(--c-ink); border-bottom-color: var(--c-brand); }
.ui-tabs .count { font-size: .75rem; background: var(--c-surface-2); border-radius: 999px; padding: 2px 7px; }
.ui-empty { text-align: center; padding: 48px 20px; border: 1px dashed var(--c-line); border-radius: var(--radius); color: var(--c-muted); }
.ui-empty :is(.ui-ic, .ic) { width: 34px; height: 34px; color: var(--c-faint); margin-bottom: 8px; }
.ui-empty :is(h2, h3) { color: var(--c-ink); font-size: 1.15rem; margin-top: 0; }
.ui-avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: var(--c-brand-soft); color: var(--c-brand); font: 700 .85rem/1 var(--font-body); }
.ui-list { display: grid; gap: 10px; }
.ui-item { display: flex; gap: 14px; align-items: flex-start; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius); padding: 16px 18px; }
.ui-item .grow { flex: 1; min-width: 0; }
.ui-item h3 { margin: 0 0 4px; font-size: 1.05rem; }
.ui-item p { margin: 0; overflow-wrap: anywhere; }
.ui-skel { border-radius: var(--radius); background: linear-gradient(90deg, var(--c-surface-2), var(--c-surface), var(--c-surface-2)); background-size: 200% 100%;
  animation: ui-skel 1.4s linear infinite; min-height: 80px; }
@keyframes ui-skel { to { background-position: -200% 0; } }
.ui-stat { display: block; }
.ui-stat b { display: block; font: 700 2rem/1.1 var(--font-display); }
.ui-stat span { color: var(--c-muted); font-size: .9rem; }

/* header */
.ui-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--c-bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--c-line); }
.ui-header-in { max-width: var(--maxw); margin: 0 auto; height: var(--header-h); padding: 0 24px; display: flex; align-items: center; gap: 22px; }
.ui-brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--c-ink) !important; font: 700 1.15rem/1 var(--font-display); letter-spacing: -.01em; }
.ui-brand img { width: 32px; height: 32px; border-radius: 9px; }
.ui-nav { display: flex; gap: 2px; }
.ui-nav a { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 999px; color: var(--c-muted); text-decoration: none; font-weight: 600; font-size: .93rem; }
.ui-nav a:hover { color: var(--c-ink); background: var(--c-surface-2); }
.ui-nav a.on { color: var(--c-ink); background: var(--c-surface-2); }
.ui-header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; position: relative; }
.ui-avatar-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; background: var(--c-brand); color: var(--c-brand-ink); font: 700 .85rem/1 var(--font-body); }
.ui-menu { position: absolute; right: 0; top: calc(100% + 10px); width: 280px; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 8px; z-index: 60; transform-origin: top right; animation: ui-pop var(--dur-fast) var(--ease-out); }
.ui-menu-head { padding: 10px 12px 12px; border-bottom: 1px solid var(--c-line); margin-bottom: 6px; display: grid; gap: 2px; overflow-wrap: anywhere; }
.ui-menu > a, .ui-menu > button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); border: 0; background: none;
  font: 500 .95rem/1.2 var(--font-body); color: var(--c-ink); text-decoration: none; cursor: pointer; text-align: left; }
.ui-menu > a:hover, .ui-menu > button:hover { background: var(--c-surface-2); }
.ui-menu-block { padding: 8px 12px 10px; display: grid; gap: 8px; }
@keyframes ui-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }

/* main + footer */
.ui-shell { min-height: 100vh; display: flex; flex-direction: column; }
.ui-main { flex: 1; }
.ui-shell.no-chrome .ui-header, .ui-shell.no-chrome .ui-footer, .ui-shell.no-chrome .ui-tabbar { display: none; }
.ui-footer { border-top: 1px solid var(--c-line); background: var(--c-surface); }
.ui-footer-in { max-width: var(--maxw); margin: 0 auto; padding: 32px 24px 40px; display: grid; grid-template-columns: 1fr auto; gap: 18px 24px; align-items: start; }
.ui-footer-brand p { margin: 8px 0 0; }
.ui-footer-links { display: flex; gap: 6px 18px; flex-wrap: wrap; justify-content: flex-end; }
.ui-footer-links a, .ui-footer-links button { font: 500 .92rem/1.4 var(--font-body); color: var(--c-muted); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: none; }  /* 24px+ touch height */
.ui-footer-links a:hover, .ui-footer-links button:hover { color: var(--c-ink); }
.ui-footer-legal { grid-column: 1 / -1; margin: 0; }

/* phone tab bar (shown on small screens when signed in) */
.ui-tabbar { display: none; }
.ui-tabbar:empty { display: none !important; }

/* toasts + modals */
.ui-toasts { position: fixed; z-index: 1000; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.ui-toast { display: flex; gap: 10px; align-items: center; background: var(--c-ink); color: var(--c-bg); padding: 13px 16px; border-radius: 14px; box-shadow: var(--shadow-lg);
  font-weight: 500; animation: ui-pop var(--dur-base) var(--ease-out); transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.ui-toast.error { background: var(--c-bad); color: var(--c-on-status); }
.ui-toast.ok { background: var(--c-good); color: var(--c-on-status); }
.ui-toast.out { opacity: 0; transform: translateY(8px); }
.ui-modal-wrap { position: fixed; inset: 0; z-index: 900; background: rgba(10, 12, 20, .5); display: grid; place-items: center; padding: 16px; overflow-y: auto; animation: ui-fade var(--dur-fast) ease; }
.ui-modal { position: relative; width: min(100%, 520px); background: var(--c-surface); border-radius: calc(var(--radius) + 4px); padding: 28px; box-shadow: var(--shadow-lg); animation: kit-pop var(--dur-base) var(--ease-out); outline: none; }
.ui-modal.wide { width: min(100%, 760px); }
.ui-modal h2 { padding-right: 40px; }
.ui-modal-x { position: absolute; top: 14px; right: 14px; }
@keyframes ui-fade { from { opacity: 0; } }

@media (max-width: 720px) {
  .ui-wrap { padding: 22px 16px 56px; }
  .ui-header-in { padding: 0 16px; gap: 12px; }
  .ui-nav { display: none; }
  .ui-brand span { font-size: 1.05rem; }
  .ui-header-right :is(.ui-btn, .anvil-role-btn > button, a.anvil-role-btn) { padding: 9px 13px; min-height: 40px; font-size: .9rem; }
  .ui-shell.signed-in .ui-tabbar { display: flex; position: fixed; z-index: 45; left: 0; right: 0; bottom: 0; background: var(--c-surface); border-top: 1px solid var(--c-line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .ui-tabbar a { flex: 1; display: grid; justify-items: center; gap: 3px; padding: 6px 2px; border-radius: 12px; color: var(--c-muted); text-decoration: none; font: 600 .75rem/1 var(--font-body); }
  .ui-tabbar a :is(.ui-ic, .ic) { width: 22px; height: 22px; }
  .ui-tabbar a.on { color: var(--c-brand); }
  .ui-shell.signed-in:has(.ui-tabbar:not(:empty)) .ui-footer { padding-bottom: 72px; }
  .ui-footer-in { grid-template-columns: 1fr; }
  .ui-footer-links { justify-content: flex-start; }
  .ui-grid.two { grid-template-columns: 1fr; }
  .ui-menu { position: fixed; left: 12px; right: 12px; top: calc(var(--header-h) + 6px); width: auto; }
  .ui-modal { padding: 24px 18px; }
}
@media (max-width: 380px) {
  .ui-header-right :is(.ui-btn.ghost, .anvil-role-btn.anvil-role-btn-ghost > button, a.anvil-role-btn.anvil-role-btn-ghost) { display: none; }
}
@media (prefers-reduced-motion: reduce) {  /* drop movement, keep the fades (design/README.md 6) */
  .ui-menu, .ui-toast, .ui-modal { animation-name: kit-fade; }
  .ui-toast.out { transform: none; }
  .ui-skel { animation: none; }
}


/* ===== CAF Guide: shared pieces (the old native_libraries.html .qb styles, facelifted) ===== */
.ui h1, .ui h2, .ui h3, .ui h4 { letter-spacing: .005em; line-height: 1.1; }
.ui h1 { font-size: 2.3rem; } .ui h2 { font-size: 1.5rem; } .ui h3 { font-size: 1.2rem; }
.anvil-role-page-title { font: 700 2.3rem/1.1 var(--font-display); color: var(--c-ink); margin: 0 0 6px; letter-spacing: .005em; }
.anvil-role-lead { color: var(--c-muted); margin: 0; max-width: 62ch; }
.anvil-role-muted { color: var(--c-muted); }
.anvil-role-muted-small { color: var(--c-muted); font-size: .875rem; }
.anvil-role-dlg-h { font: 700 1.5rem/1.15 var(--font-display); color: var(--c-ink); margin: 0 0 14px; padding-right: 32px; }
:is(.ui-btn, .anvil-role-btn > button, a.anvil-role-btn) { border-radius: var(--radius-btn); min-height: 42px; padding: 9px 15px; }
:is(.ui-btn.sm, .btn-sm.ui-btn, .anvil-role-btn.anvil-role-btn-sm > button, a.anvil-role-btn.anvil-role-btn-sm) { min-height: 34px; padding: 5px 11px; font-size: .86rem; }
.ui-btn.block { width: 100%; }
.ui-seg, .ui-seg button { border-radius: var(--radius-sm); }
.ui-seg button { min-height: 32px; }
.ui-wrap { padding: 28px 16px 72px; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .8rem; line-height: 1.5; padding: 2px 9px; border-radius: 99px;
  background: var(--c-surface-2); border: 1px solid var(--c-line); color: var(--c-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge.good { background: var(--c-good-soft); color: var(--c-good); border-color: transparent; }
.badge.warn { background: var(--c-warn-soft); color: var(--c-warn); border-color: transparent; }
.badge.bad { background: var(--c-bad-soft); color: var(--c-bad); border-color: transparent; }
.badge.accent { background: var(--c-brand-soft); color: var(--c-brand); border-color: transparent; }
.badge[hidden] { display: none; }

.bar { display: block; height: 6px; background: var(--c-line); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: var(--c, var(--c-brand)); border-radius: 99px; transition: transform var(--dur-slow) var(--ease-out); }

.avatar { --c: var(--c-brand); width: 36px; height: 36px; border-radius: 50%; background: var(--c); color: #fff; display: inline-grid; place-items: center;
  font: 700 .9rem/1 var(--font-body); flex: none; overflow: hidden; }
.avatar.lg { width: 72px; height: 72px; font-size: 1.6rem; }

.crumbs { font-size: .92rem; margin-bottom: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--c-brand); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; min-height: 24px; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep:not(:empty)::before { content: "·"; margin-right: 8px; color: var(--c-muted); }
.crumbs .sep { color: var(--c-muted); }
.pad { padding: 22px 24px; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--c-line); border-top-color: var(--c-brand); border-radius: 50%;
  animation: ui-spin .8s linear infinite; vertical-align: -2px; }
.ui-row.tight { gap: 6px; }
.ui-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd { font: inherit; font-size: .78rem; border: 1px solid var(--c-line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--c-surface); }
.ui code { font: .9em ui-monospace, Consolas, monospace; background: var(--c-surface-2); padding: 1px 4px; border-radius: 4px; }
.anvil-role-code textarea, textarea.anvil-role-code { font: 12.5px/1.5 ui-monospace, Consolas, monospace !important; min-height: 140px; }

/* ===== the frame: header, Lookup, footer ===== */
.qb-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--c-bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 3px solid var(--c-red); border-bottom: 1px solid var(--c-line); }
.qb-header .in { max-width: var(--maxw); margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; }
.qb-header .brand { display: flex; align-items: center; gap: 10px; color: var(--c-ink); text-decoration: none; min-width: 0; }
.qb-header .brand .name { display: block; font: 700 1.35rem/1 var(--font-display); letter-spacing: .06em; text-transform: uppercase; }
.qb-header .brand .sub { display: block; font-size: .78rem; color: var(--c-muted); font-weight: 500; margin-top: 3px; }
.qb-header .logo { width: 36px; height: 36px; border-radius: 9px; background: var(--c-hero); display: grid; place-items: center; overflow: hidden; flex: none; }
.qb-header .logo img { width: 100%; height: 100%; object-fit: cover; }
.qb-header .tools { display: flex; gap: 4px; margin-left: auto; }
.qb-header .look { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; border: 0; background: none; cursor: pointer; color: var(--c-muted);
  padding: 6px 11px; border-radius: 8px; font: 500 .95rem/1 var(--font-body);
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
.qb-header .look:hover, .qb-header .look.on { color: var(--c-ink); background: var(--c-surface); }
.qb-header .me { position: relative; }
.qb-header .me-btn { display: flex; align-items: center; gap: 8px; border: 0; background: none; cursor: pointer; border-radius: 99px; padding: 2px; color: var(--c-ink); font: inherit; }
.qb-header .xp { font-size: .82rem; color: var(--c-muted); font-variant-numeric: tabular-nums; }
.qb-menu { width: 240px; padding: 6px; }
.qb-menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--c-line); margin-bottom: 4px; overflow-wrap: anywhere; }
.qb-menu > a, .qb-menu > button { padding: 9px 10px; font-size: .95rem; }
.anvil-role-menu-name { font-weight: 700; }
.qb-header .guest { max-width: var(--maxw); margin: 0 auto; padding: 6px 16px 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: .88rem; color: var(--c-muted); }
.qb-header .guest strong { color: var(--c-ink); }
.qb-header .guest button { border: 0; background: none; padding: 2px 0; min-height: 24px; cursor: pointer; color: var(--c-brand); font: 600 .88rem/1.2 var(--font-body); }
.qb-header .guest button:hover { text-decoration: underline; }

.qb-dict { position: fixed; z-index: 70; top: var(--qb-dict-top, 64px); right: max(16px, calc((100vw - var(--maxw)) / 2 + 16px)); width: min(420px, calc(100vw - 32px));
  max-height: calc(100vh - var(--qb-dict-top, 64px) - 16px); display: flex; flex-direction: column; padding: 14px; background: var(--c-surface);
  border: 1px solid var(--c-line); border-radius: var(--radius); box-shadow: var(--shadow-lg); animation: kit-pop var(--dur-fast) var(--ease-out); transform-origin: top right; }
.qb-dict .top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.qb-dict .top h2 { margin: 0; font-size: 1.2rem; }
.qb-dict .x { border: 0; background: none; cursor: pointer; color: var(--c-muted); width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; }
.qb-dict .x:hover { color: var(--c-ink); background: var(--c-surface-2); }
.qb-dict .res { overflow-y: auto; margin: 10px 0 4px; min-height: 0; position: relative; }
.qb-dict .hit { padding: 8px 2px; border-bottom: 1px solid var(--c-line); }
.qb-dict .hit b { color: var(--c-brand); font-weight: 700; margin-right: 6px; }
.qb-dict .hit .src { display: block; font-size: .8rem; color: var(--c-muted); margin-top: 2px; }
.qb-dict .hit .src[hidden] { display: none; }
.anvil-role-dict-note { font-size: .9rem; color: var(--c-muted); padding: 6px 2px; }
.qb-dict .google { margin-top: 8px; }

.qb-page { min-height: calc(100vh - 120px); }
.qb-signed-out .qb-page { min-height: 0; }
.qb-footer { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 18px 16px 28px; border-top: 1px solid var(--c-line); color: var(--c-muted); font-size: .85rem; text-align: center; line-height: 1.55; }
.qb-footer p { margin: 0 auto 6px; max-width: 72ch; }
.qb-footer strong { color: var(--c-ink); font-weight: 600; }
.qb-footer a, .qb-footer .linkish { color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.qb-footer .linkish { border: 0; background: none; padding: 0; font: inherit; }
.qb-footer .links { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 8px; align-items: baseline; }
.qb-footer .links a, .qb-footer .links .linkish { display: inline-block; padding: 3px 0; }

/* ===== auth: the front page ===== */
.qb-auth { min-height: calc(100vh - var(--qb-foot-h, 105px)); min-height: calc(100dvh - var(--qb-foot-h, 105px)); display: grid; grid-template-columns: 1.05fr 1fr; }
.qb-auth .side { background: var(--c-hero); color: var(--c-hero-ink); padding: 52px 48px 40px; display: flex; flex-direction: column; justify-content: flex-start; position: relative; overflow: hidden;
  border-bottom: 6px solid var(--c-red); }  /* design-ok: side-tab (the Canada-red band under the hero, the app's mark) */
.qb-auth .side .inner { position: relative; z-index: 1; }
.qb-auth .side .badge-logo { width: 88px; height: 88px; border-radius: 20px; overflow: hidden; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); margin-bottom: 26px; }
.qb-auth .side .badge-logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qb-auth .side h1 { color: inherit; font-size: 3rem; max-width: 13ch; text-transform: uppercase; letter-spacing: .02em; line-height: 1; margin: 0 0 18px; }
.qb-auth .side p { color: color-mix(in srgb, var(--c-hero-ink) 88%, transparent); max-width: 42ch; font-size: 1.08rem; }
.qb-auth .side .wm { position: absolute; right: -90px; bottom: -70px; width: 420px; height: 420px; color: rgba(255, 255, 255, .05); transform: rotate(-12deg); }
.qb-auth .side ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 11px; }
.qb-auth .side li { display: flex; align-items: center; gap: 10px; }
.qb-auth .side li::before { content: ""; flex: none; width: 8px; height: 8px; background: #ff6b78; transform: rotate(45deg); margin: 0 6px 0 4px; }
.qb-auth .side .civ { margin-top: 28px; padding: 12px 14px; border: 1px solid rgba(255, 255, 255, .22); border-radius: 12px; font-size: .9rem; max-width: 46ch; background: rgba(255, 255, 255, .05); }
.qb-auth .side .civ strong { display: block; margin-bottom: 2px; }
.qb-auth .main { display: grid; place-items: center; padding: 40px 16px; }
.qb-auth .box { width: min(400px, 100%); }
.qb-auth .tabs { display: flex; width: 100%; margin-bottom: 22px; }
.qb-auth .tabs button { flex: 1; font-weight: 600; font-size: .92rem; padding: 9px; }
.anvil-role-au-title { font: 700 1.5rem/1.15 var(--font-display); margin: 0 0 4px; color: var(--c-ink); }
.anvil-role-au-sub { color: var(--c-muted); font-size: .92rem; margin-bottom: 4px; }
.au-form { margin-top: 14px; }
.au-pw { position: relative; display: block; }
.au-pw input { padding-right: 70px !important; }
.anvil-role-au-show { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); margin: 0 !important; line-height: 0; }
.anvil-role-au-show > button { border: 0; background: none; color: var(--c-brand); font: 600 .85rem/1 var(--font-body); padding: 8px 10px; min-height: 32px; cursor: pointer; margin: 0; }
.ui-hint.right { text-align: right; }
.ui-hint a { color: var(--c-brand); }
.au-or { display: flex; align-items: center; gap: 10px; color: var(--c-muted); font-size: .88rem; margin: 18px 0; }
.au-or::before, .au-or::after { content: ""; flex: 1; height: 1px; background: var(--c-line); }
.guest-note { text-align: center; }
.au-back { margin-top: 14px; font-size: .92rem; }
.au-back a { color: var(--c-brand); text-decoration: none; display: inline-flex; gap: 4px; align-items: center; min-height: 24px; }

/* ===== home: the learning path ===== */
.qb-home .hero { margin-bottom: 22px; }
.qb-home .stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.qb-home .stat { padding: 16px 18px; }
.qb-home .stat .v, .qb-prof .stats .v { font: 700 1.9rem/1.1 var(--font-display); font-variant-numeric: lining-nums tabular-nums; }
.qb-home .stat .of, .qb-prof .stats .of { font-size: 1rem; color: var(--c-muted); font-family: var(--font-body); font-weight: 500; }
.qb-home .stat .k, .qb-prof .stats .k { font-size: .85rem; color: var(--c-muted); }
.qb-home .continue { display: flex; gap: 16px; align-items: center; padding: 18px 22px; margin-bottom: 30px; color: inherit; text-decoration: none; border-color: var(--c-brand);
  background: color-mix(in srgb, var(--c-brand-soft) 60%, var(--c-surface)); transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.qb-home .continue.calm { border-color: var(--c-line); background: var(--c-surface); }
.qb-home .continue .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--c-brand); color: var(--c-brand-ink); display: grid; place-items: center; flex: none; }
.qb-home .continue .ico .ic { width: 22px; height: 22px; }
.qb-home .continue.calm .ico { background: var(--c-good-soft); color: var(--c-good); }
.qb-home .continue .body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.qb-home .continue strong { font-size: 1.08rem; }
.qb-home .continue .meta { color: var(--c-muted); font-size: .9rem; }
.qb-home section + section { margin-top: 34px; }
.sechead { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.sechead h2 { margin: 0; font-size: 1.4rem; }
.qb-home .filters { margin-left: auto; }
.qb-home .path-top { padding: 18px 22px; margin-bottom: 14px; }
.qb-home .path-top .big { font: 700 2rem/1 var(--font-display); font-variant-numeric: lining-nums tabular-nums; }
.anvil-role-segbar > div { display: flex; gap: 3px; margin-top: 12px; }
.anvil-role-segbar > div > * { flex: 1; min-width: 0; }
.seg { display: block; height: 10px; border-radius: 3px; background: var(--c-line); position: relative; overflow: hidden; }
.seg > b { position: absolute; inset: 0 auto 0 0; background: var(--c-brand); }
.seg.done, .seg.done > b { background: var(--c-good); }
.anvil-role-modules > div, .anvil-role-parts > div { display: grid; gap: 8px; }
.qb-home .mod { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 16px; color: inherit; text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.qb-home .mod .num { font: 700 1.35rem/1 var(--font-display); width: 54px; height: 54px; border-radius: 12px; display: grid; place-items: center; background: var(--c-surface-2);
  border: 1px solid var(--c-line); color: color-mix(in srgb, var(--c, var(--c-brand)) var(--c-mix), var(--c-ink)); font-variant-numeric: lining-nums tabular-nums; }
.qb-home .mod.complete .num { background: var(--c-good-soft); color: var(--c-good); border-color: transparent; }
.qb-home .mod .mid, .qb-col .item .mid { min-width: 0; display: block; }
.qb-home .mod .t, .qb-col .item .t { display: block; font-weight: 600; overflow-wrap: anywhere; }
.qb-home .mod .sub, .qb-col .item .sub { display: block; font-size: .88rem; color: var(--c-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qb-home .mod .mini, .qb-col .item .mini { display: block; height: 4px; border-radius: 99px; background: var(--c-line); margin-top: 7px; max-width: 260px; overflow: hidden; }
.qb-home .mod .mini > span, .qb-col .item .mini > span { display: block; height: 100%; background: var(--c, var(--c-brand)); }
.qb-home .mod .right, .qb-col .item .badges { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.qb-home .recent { padding: 6px 0; overflow: hidden; }
.sess { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 18px; color: inherit; text-decoration: none;
  border-bottom: 1px solid var(--c-line); margin-bottom: -1px; transition: background-color var(--dur-fast) var(--ease-out); }
.sess .what, .hist-row .what { display: grid; min-width: 0; overflow-wrap: anywhere; }
@media (hover: hover) and (pointer: fine) {
  .qb-home .continue:not(.calm):hover { transform: translateY(-1px); }
  .qb-home .mod:hover, .qb-col .item:hover { border-color: var(--c-brand); transform: translateX(2px); }
  .sess:hover, .hist-row:hover { background: var(--c-surface-2); }
}
@media (max-width: 720px) {
  .qb-home .stats { grid-template-columns: repeat(2, 1fr); }
  .qb-home .mod { grid-template-columns: 46px minmax(0, 1fr); }
  .qb-home .mod .num { width: 46px; height: 46px; font-size: 1.15rem; }
  .qb-home .mod .right { grid-column: 2; justify-content: flex-start; }
  .qb-home .filters { margin-left: 0; }
}

/* ===== collection: one module ===== */
.qb-col .head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: end; margin-bottom: 18px; }
.qb-col .src { font-size: .88rem; margin: 8px 0 0; overflow-wrap: anywhere; }
.qb-col .summary { padding: 16px 20px; margin-bottom: 16px; }
.qb-col .summary .bar { height: 10px; margin: 10px 0 8px; }
.qb-col .item { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 18px; color: inherit; text-decoration: none;
  transition: border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out); }
.qb-col .item .num { font: 600 1.15rem/1 var(--font-display); color: var(--c-muted); width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--c-line); }
.qb-col .item .num.done { background: var(--c-good-soft); color: var(--c-good); border-color: transparent; }
@media (max-width: 620px) {
  .qb-col .head { grid-template-columns: 1fr; }
  .qb-col .item { grid-template-columns: 42px minmax(0, 1fr); }
  .qb-col .item .badges { grid-column: 2; justify-content: flex-start; }
}

/* ===== study: one session ===== */
.qb-study .intro-card > * + * { margin-top: 16px; }
.qb-study .context { margin: 10px 0 0; }
.qb-study .counts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.qb-study .how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; list-style: none; padding: 0; margin: 0 0 16px; }
.qb-study .how li { padding: 12px 14px; border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-surface-2); font-size: .92rem; }
.qb-study .how b { display: block; margin-bottom: 2px; }
.qb-study .toggle { margin-bottom: 16px; }
.qb-study .toggle .ui-hint { margin: 2px 0 0 26px; }
.qb-study .qhead { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: .92rem; color: var(--c-muted); }
.qb-study .qhead .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.qb-study .sess-bar { margin-bottom: 14px; }
.qb-study .flash { padding: 0; overflow: hidden; animation: kit-in var(--dur-base) var(--ease-out); }
.qb-study .front { padding: 30px 30px 26px; }
.qb-study .front.clickable { cursor: pointer; }
.qb-study .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; min-height: 24px; }
.qb-study .level { display: inline-flex; gap: 3px; margin-left: auto; }
.qb-study .level i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-line); }
.qb-study .level i.on { background: var(--c-brand); }
.anvil-role-qtext { font: 600 1.5rem/1.35 var(--font-body); margin: 18px 0 4px; color: var(--c-ink); overflow-wrap: anywhere; }
.qb-study .reveal { display: flex; justify-content: center; margin-top: 22px; }
.qb-study .back { border-top: 1px dashed var(--c-line); background: var(--c-surface-2); padding: 22px 30px 26px; animation: kit-in var(--dur-base) var(--ease-out); outline: none; }
.anvil-role-answer { font: 600 1.6rem/1.25 var(--font-display); color: var(--c-ink); overflow-wrap: anywhere; }
.anvil-role-expl { color: var(--c-muted); margin-top: 10px; overflow-wrap: anywhere; }
.qb-study .rate { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.qb-study .rate .ui-btn { flex-direction: column; gap: 2px; padding: 12px 14px; font-size: 1rem; white-space: normal; }
.qb-study .rate .ui-btn > span { display: inline-flex; align-items: center; gap: 6px; }
.qb-study .rate small { font-weight: 400; font-size: .82rem; }
.qb-study .rate .again { border-color: var(--c-warn); color: var(--c-warn); background: var(--c-warn-soft); }
.qb-study .rate .got { border-color: var(--c-good); color: var(--c-on-status); background: var(--c-good); }
@media (hover: hover) and (pointer: fine) { .qb-study .rate .again:hover, .qb-study .rate .got:hover { filter: brightness(1.06); } }
.qb-study .keys { font-size: .82rem; color: var(--c-muted); margin: 12px 0 0; text-align: center; }
.qb-study .caught { gap: 14px; margin-bottom: 16px; }
.qb-study .caught h2 { margin: 0; font-size: 1.3rem; }
.qb-study .done-ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--c-good-soft); color: var(--c-good); flex: none; }
.qb-study .done-ico .ic { width: 26px; height: 26px; }
.qb-study .summary-card > * + * { margin-top: 14px; }
.anvil-role-done-title { color: var(--c-muted); font-size: .92rem; }
.qb-study .result { gap: 18px; align-items: flex-end; }
.qb-study .big { font: 700 3rem/1 var(--font-display); font-variant-numeric: lining-nums tabular-nums; }
.qb-study .big-k { padding-bottom: 4px; }
.qb-study .split { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--c-line); margin: 0 0 8px; }
.qb-study .split .g { background: var(--c-good); } .qb-study .split .a { background: var(--c-warn); }
.qb-study .still-h { font-size: 1.2rem; margin: 22px 0 10px; }
.anvil-role-still > div { display: grid; gap: 8px; }
.still-card { border: 1px solid var(--c-line); border-radius: 12px; padding: 11px 14px; background: var(--c-surface-2); }
.still-card summary { cursor: pointer; font-weight: 600; overflow-wrap: anywhere; }
.still-card .still-a { margin-top: 8px; overflow-wrap: anywhere; }
@media (max-width: 620px) {
  .qb-study .front, .qb-study .back { padding-left: 20px; padding-right: 20px; }
  .anvil-role-qtext { font-size: 1.3rem; }
  .qb-study .how { grid-template-columns: 1fr; }
  .qb-study .keys { display: none; }
}

/* ===== profile ===== */
.qb-prof .top { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 24px; }
.qb-prof .top .who { min-width: 0; overflow-wrap: anywhere; }
.anvil-role-bio { margin: 6px 0 0; max-width: 60ch; }
.qb-prof .cols { display: grid; grid-template-columns: 1.1fr 1fr; gap: 16px; align-items: start; }
.qb-prof .cols > div > * + * { margin-top: 16px; }
.qb-prof .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.qb-prof .stats > div { padding: 12px 14px; border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-surface-2); }
.qb-prof .stats .v { font-size: 1.5rem; }
.anvil-role-prog > div { display: grid; gap: 12px; }
.prog-row { display: block; color: inherit; text-decoration: none; }
.prog-row .bar { margin-top: 6px; }
@media (hover: hover) and (pointer: fine) { .prog-row:hover strong { color: var(--c-brand); } }
.anvil-role-swatches > div { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--c); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35); cursor: pointer; padding: 0; }
.swatch.on { outline: 3px solid var(--c-ink); outline-offset: 2px; }
.qb-prof .paste { margin-top: 10px; }
.qb-prof details summary { cursor: pointer; min-height: 24px; }
.qb-prof .history { margin-top: 16px; }
.hist-head, .hist-row { display: grid; grid-template-columns: minmax(0, 1fr) 120px auto; gap: 10px; align-items: center; }
.hist-head { font-weight: 600; color: var(--c-muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; padding: 0 10px 8px; }  /* design-ok: kicker-eyebrow (table column headings) */
.hist-row { padding: 10px; border-top: 1px solid var(--c-line); color: inherit; text-decoration: none; font-size: .95rem; transition: background-color var(--dur-fast) var(--ease-out); }
.hist-head .r, .hist-row .r { text-align: right; }
@media (max-width: 760px) {
  .qb-prof .cols { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .hist-head, .hist-row { grid-template-columns: minmax(0, 1fr) auto; }
  .qb-prof .stats { grid-template-columns: repeat(2, 1fr); }
}

/* ===== manage curriculum (admins) ===== */
.qb-cur .head { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.qb-cur .note { margin: 0 0 14px; max-width: 70ch; }
.qb-cur .tools { margin-bottom: 14px; max-width: 360px; }
.anvil-role-cur-list > div { display: grid; gap: 10px; }
.qb-cur .mod { padding: 0; overflow: hidden; }
.qb-cur .mhead, .qb-cur .phead { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; }
.qb-cur .tog { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 200px; border: 0; background: none; padding: 4px 0; text-align: left; cursor: pointer; color: inherit; font: inherit; border-radius: 6px; }
.qb-cur .tog .chev { color: var(--c-muted); transform: rotate(-90deg); transition: transform var(--dur-fast) var(--ease-out); }
.qb-cur .tog[aria-expanded="true"] .chev { transform: none; }
.qb-cur .num { font: 700 1.1rem/1 var(--font-display); color: color-mix(in srgb, var(--c, var(--c-brand)) var(--c-mix), var(--c-ink)); min-width: 1.6em; font-variant-numeric: lining-nums tabular-nums; }
.qb-cur .t { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.qb-cur .sub { display: block; font-weight: 400; font-size: .88rem; color: var(--c-muted); }
.qb-cur .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.qb-cur .body { border-top: 1px solid var(--c-line); background: var(--c-surface-2); padding: 12px 16px 16px; }
.qb-cur .body > * + *, .qb-cur .pbody > * + * { margin-top: 10px; }
.qb-cur .desc { margin: 0; }
.anvil-role-cur-parts > div { display: grid; gap: 10px; }
.qb-cur .part { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 10px; }
.qb-cur .part .phead { padding: 10px 12px; }
.qb-cur .part .num { font-size: 1rem; color: var(--c-muted); }
.qb-cur .pbody { border-top: 1px solid var(--c-line); padding: 10px 12px 12px; }
.qb-cur .cards { display: grid; gap: 8px; }
.qb-cur .crd { display: grid; grid-template-columns: 2.2em minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 12px; border: 1px solid var(--c-line); border-radius: 10px; background: var(--c-surface-2); }
.qb-cur .crd .n { color: var(--c-muted); font-size: .88rem; padding-top: 2px; }
.qb-cur .crd .q { font-weight: 600; overflow-wrap: anywhere; }
.qb-cur .crd .a, .qb-cur .crd .e { grid-column: 2; overflow-wrap: anywhere; }
.qb-cur .crd .a-k { color: var(--c-good); font-weight: 700; }
.qb-cur .crd .e { font-size: .9rem; color: var(--c-muted); }
.qb-cur .crd .e[hidden] { display: none; }
.qb-cur .crd .acts { grid-column: 3; grid-row: 1 / span 3; align-self: start; }
.cur-edit .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.anvil-role-color-in, .anvil-role-color-in input, input.anvil-role-color-in { width: 56px !important; min-height: 42px; padding: 2px !important; cursor: pointer; }
.cur-pv .face { min-height: 180px; display: grid; align-content: center; gap: 10px; text-align: center; padding: 18px 6px; }
.cur-pv .qq { font: 700 1.5rem/1.2 var(--font-display); overflow-wrap: anywhere; }
.cur-pv .aa { font-size: 1.15rem; font-weight: 600; color: var(--c-good); overflow-wrap: anywhere; }
.cur-pv .ee { color: var(--c-muted); overflow-wrap: anywhere; }
.cur-pv .keys { margin: 10px 0 0; }
.cur-pv [hidden] { display: none; }
@media (max-width: 620px) {
  .qb-cur .crd { grid-template-columns: 2em minmax(0, 1fr); }
  .qb-cur .crd .acts { grid-column: 2; grid-row: auto; }
  .cur-edit .grid2 { grid-template-columns: 1fr; }
  .qb-cur .tog { min-width: 0; flex-basis: 100%; }
}

@media (max-width: 820px) {
  .qb-auth { grid-template-columns: 1fr; min-height: 0; }
  .qb-auth .side { padding: 32px 20px; }
  .qb-auth .side h1 { font-size: 2.1rem; }
  .qb-auth .side ul, .qb-auth .side .wm, .qb-auth .side .badge-logo { display: none; }
}
@media (max-width: 620px) { .ui h1, .anvil-role-page-title { font-size: 1.7rem; } .pad { padding: 18px; } }
@media (max-width: 520px) {
  .qb-header .look span { display: none; }
  .qb-header .xp, .qb-header .brand .sub { display: none; }
  .qb-header .brand .name { font-size: 1.15rem; }
  .qb-header .in { gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .qb-study .flash, .qb-study .back, .qb-dict { animation-name: kit-fade; }
}

/* =====================================================================================================
   Anvil components: the same look through roles (prop:role='["btn", "btn-primary", "ic-wand"]').
   Button = .anvil-button wrapper > button; Link = a; TextBox = input; TextArea = textarea; DropDown = wrapper > select;
   RepeatingPanel = root > items container > item forms (grid rules go on "> div").
   ===================================================================================================== */

/* Anvil buttons: the wrapper is inline, the button inside resets Anvil's own padding and margins */
.anvil-role-btn { display: inline-block; }
.anvil-role-btn > button { margin: 0; }
.anvil-role-btn-block, .anvil-role-btn-block > button { display: flex; width: 100%; }
.anvil-role-btn-icon > button > span, .anvil-role-btn-icon > button .anvil-button-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* the round account button in the header */
.anvil-role-avatar > button { width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer; background: var(--c-brand);
  color: var(--c-brand-ink); font: 700 .85rem/1 var(--font-body); padding: 0; margin: 0; }

/* text from Label components */
.anvil-role-menu-name { font-weight: 700; }
.anvil-role-menu-email { color: var(--c-muted); font-size: .875rem; }
.anvil-role-fine-print { color: var(--c-muted); font-size: .875rem; }
.anvil-label { padding: 0; margin: 0; }

/* notifications (state.toast) look like the old toasts */
.anvil-notification { background: var(--c-ink); color: var(--c-bg); border: 0; border-radius: 14px; box-shadow: var(--shadow-lg);
  font: 600 1rem/1.4 var(--font-body); }
.anvil-notification.anvil-role-ok { background: var(--c-good); color: var(--c-on-status); }
.anvil-notification.anvil-role-error { background: var(--c-bad); color: var(--c-on-status); }
.anvil-notification .anvil-notification-title { font-weight: 700; }

/* dialogs (alert / confirm with a Form inside) look like the old modals */
.anvil-modal-content { background: var(--c-surface); color: var(--c-ink); border: 1px solid var(--c-line); border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow-lg); font: 16px/1.55 var(--font-body); }
.anvil-modal-header { border-bottom: 0; padding: 22px 26px 0; }
.anvil-modal-title { font: 700 1.6rem/1.1 var(--font-display); color: var(--c-ink); }
.anvil-modal-body { padding: 18px 26px 24px; }
.anvil-modal-footer { border-top: 0; padding: 0 26px 22px; }
.anvil-modal-header .anvil-close { color: var(--c-muted); opacity: 1; text-shadow: none; }
@media (max-width: 720px) { .anvil-modal-body { padding: 16px 18px 20px; } .anvil-modal-header { padding: 18px 18px 0; } }

/* ---- shared helpers for the component version */
.anvil-role-contents, .anvil-role-contents > div { display: contents; }
.anvil-role-sec-title { font: 700 1.6rem/1.08 var(--font-display); color: var(--c-ink); margin: 0; }
.anvil-role-card-title { font: 700 1.3rem/1.08 var(--font-display); color: var(--c-ink); margin: 4px 0 0; }
.anvil-role-faint { color: var(--c-faint); }
.ui-empty > .ic { width: 34px; height: 34px; color: var(--c-faint); margin-bottom: 8px; }

/* ---- reading pages, dialogs, profile, admin (component version) */
.anvil-modal-content .ui h2.dlg-h, .anvil-role-dlg-title { font: 700 1.6rem/1.1 var(--font-display); color: var(--c-ink); margin: 0 0 .5em; padding-right: 36px; }
.anvil-modal-content .ui { font: 16px/1.55 var(--font-body); }
.anvil-role-strong { font-weight: 700; }
.anvil-notification.alert-success, .anvil-notification.anvil-notification-success { background: var(--c-good); color: var(--c-on-status); }
.anvil-notification.alert-danger, .anvil-notification.anvil-notification-danger { background: var(--c-bad); color: var(--c-on-status); }

/* The open-source runtime (App Server 1.18) wraps named elements and components in <anvil-dropzone> tags; hosted Anvil
   has dropped them. Make them invisible to layout so child selectors and grids behave the same on both. */
anvil-dropzone { display: contents; }
/* Notifications on the open-source runtime (1.18): Bootstrap-style alerts. Same look as .anvil-notification above. */
[data-notify="container"].anvil-alert { background: var(--c-ink); color: var(--c-bg); border: 2.5px solid var(--c-line); border-radius: 14px;
  box-shadow: var(--shadow); font: 700 1rem/1.4 var(--font-body); padding: 12px 40px 12px 16px; }
[data-notify="container"].anvil-alert-success { background: var(--c-good); color: var(--c-on-status); }
[data-notify="container"].anvil-alert-danger { background: var(--c-bad); color: var(--c-on-status); }
[data-notify="container"].anvil-alert .anvil-close, [data-notify="container"].anvil-alert [data-notify="dismiss"] { color: inherit; opacity: .8; text-shadow: none; }
/* header: the guest buttons stay on one line, the logo never shrinks */
.ui-brand img { flex: none; }
.ui-header-right .ui-row { flex-wrap: nowrap; gap: 8px; }
@media (max-width: 480px) {
  .ui-brand span { font-size: .98rem; line-height: 1.05; }
  .ui-header-right .ui-btn { padding: 8px 11px; min-height: 38px; font-size: .86rem; }
}
/* Toast colours win over the plain rule above on both runtimes (hosted: anvil-role-ok/error; App Server 1.18: alert-success/danger). */
:is(.anvil-notification, [data-notify="container"]):is(.anvil-role-ok, .anvil-alert-success) { background: var(--c-good); color: var(--c-on-status); }
:is(.anvil-notification, [data-notify="container"]):is(.anvil-role-error, .anvil-alert-danger) { background: var(--c-bad); color: var(--c-on-status); }
/* Our dialogs: Anvil's normal alert is a 300 px "small" modal; give them the old modal's width. */

.item-title { gap: 8px; }
.anvil-role-item-body { overflow-wrap: anywhere; margin-top: 2px; }
.anvil-role-initials { font: 700 .85rem/1 var(--font-body); color: inherit; }
.nav-link { display: inline-flex; align-items: center; gap: 7px; }
.anvil-role-dlg-title, .anvil-modal-content .ui h2.dlg-h { font: 700 1.5rem/1.15 var(--font-display); color: var(--c-ink); margin: 0 0 .5em; padding-right: 36px; }

.anvil-modal-content .ui-row.end { margin-top: 18px; }
.anvil-modal-content textarea { width: 100%; }
/* Our dialogs: Anvil's normal alert is a 300 px "small" modal; give them a comfortable width. */
.anvil-modal-dialog.anvil-role-app-dialog.anvil-modal-sm, .anvil-modal-dialog.anvil-role-app-dialog:not(.anvil-modal-lg) { width: min(calc(100vw - 24px), 540px); max-width: none; }
.anvil-modal-dialog.anvil-role-app-dialog.anvil-modal-lg { width: min(calc(100vw - 24px), 780px); max-width: none; }/* badges from Label components: prop:role='["badge"]' (+ "badge-brand", "badge-good", "badge-warn", "badge-bad") */
.anvil-role-badge { display: inline-flex; align-items: center; gap: 5px; font: 600 .75rem/1.3 var(--font-body); padding: 4px 10px; border-radius: 999px;
  background: var(--c-surface-2); color: var(--c-muted); white-space: nowrap; }
.anvil-role-badge.anvil-role-badge-brand { background: var(--c-brand-soft); color: var(--c-brand); }
.anvil-role-badge.anvil-role-badge-good { background: var(--c-good-soft); color: var(--c-good); }
.anvil-role-badge.anvil-role-badge-warn { background: var(--c-warn-soft); color: var(--c-warn); }
.anvil-role-badge.anvil-role-badge-bad { background: var(--c-bad-soft); color: var(--c-bad); }
/* auth page parts made of components */
.au-pw { position: relative; display: block; }
.anvil-role-au-show { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.anvil-role-msg-error { background: var(--c-bad-soft); color: var(--c-bad); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .92rem; }
.anvil-role-msg-note { background: var(--c-brand-soft); color: var(--c-ink); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .92rem; }

/* Screen-reader-only text (Label role "sr", or class ui-sr): read out, not shown */
.anvil-role-sr, .ui-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Anvil's own notifications animate everything (transition: all): only fade and move (design kit) */
.anvil-notification, [data-notify="container"] { transition-property: opacity, transform !important; }
.anvil-notification .anvil-close, [data-notify="dismiss"] { min-width: 24px; min-height: 24px; }
