/* TCYB shared styles. Blazor Blueprint ships only bb:-prefixed utilities, so the app's own layout
 * classes live here (prefixed tcyb-) instead of a Tailwind build. Colours come from the brand tokens.
 * This file loads last so the repeated token block wins over Blueprint's themes.css.
 */

/* Brand tokens, repeated with selectors that beat [data-base-color] / [data-primary-color]. */
:root,
html,
html[data-base-color],
html[data-primary-color],
html.dark,
html.dark[data-base-color],
html.dark[data-primary-color],
.dark {
  color-scheme: light;

  --tcyb-navy: #001541;
  --tcyb-orange: #F87F00;
  --tcyb-orange-hover: #D96E00;
  --tcyb-navy-hover: #16305C;
  --tcyb-accent-wash: #FFF3E6;
  --tcyb-surface: #F3F5F8;

  --radius: 0.625rem;
  --background: #FFFFFF;
  --foreground: #001541;
  --card: #FFFFFF;
  --card-foreground: #001541;
  --popover: #FFFFFF;
  --popover-foreground: #001541;
  --primary: #001541;
  --primary-foreground: #FFFFFF;
  --secondary: #F3F5F8;
  --secondary-foreground: #001541;
  --muted: #F3F5F8;
  --muted-foreground: #3E4A63;
  --accent: #FFF3E6;
  --accent-foreground: #001541;
  --destructive: #B42318;
  --destructive-foreground: #FFFFFF;
  --border: #8A96A6;
  --input: #8A96A6;
  --ring: #F87F00;
  --chart-1: #F87F00;
  --chart-2: #001541;
  --chart-3: #16305C;
  --chart-4: #D96E00;
  --chart-5: #3E4A63;
  --sidebar: #FFFFFF;
  --sidebar-foreground: #001541;
  --sidebar-primary: #001541;
  --sidebar-primary-foreground: #FFFFFF;
  --sidebar-accent: #FFF3E6;
  --sidebar-accent-foreground: #001541;
  --sidebar-border: #8A96A6;
  --sidebar-ring: #F87F00;
}

html {
  color-scheme: light only;
}

html, body { margin: 0; min-height: 100%; }
body {
    background: var(--background);
    color: var(--foreground);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; }

/* Focus: orange ring (3:1+ against white and against navy fills). */
:focus-visible {
    outline: 2px solid var(--tcyb-orange);
    outline-offset: 2px;
}

/* ---- Auth pages ---- */
.tcyb-auth-shell {
    min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1.25rem; padding: 2rem 1rem; background: var(--tcyb-surface); box-sizing: border-box;
}
.tcyb-auth-brand { display: flex; flex-direction: column; align-items: center; gap: .5rem; width: min(24rem, 100%); }
.tcyb-auth-name {
    color: var(--tcyb-navy); font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em;
    text-align: center; line-height: 1.3;
}
.tcyb-auth-portal { color: var(--muted-foreground); font-size: .875rem; }
.tcyb-auth-card { width: 100%; max-width: 24rem; }

/* Official logos: width + height:auto preserves aspect ratio; ~10% clear space via frame padding. */
.tcyb-logo-frame {
    background: #fff;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}
.tcyb-logo-img {
    display: block;
    height: auto;
    max-width: 100%;
}
.tcyb-logo-frame-login {
    padding: 10%;
    width: 24rem;
    max-width: 100%;
}
.tcyb-logo-frame-login .tcyb-logo-img { width: 100%; }
.tcyb-logo-frame-sidebar {
    padding: 10%;
    width: 10.5rem;
    max-width: 100%;
}
.tcyb-logo-frame-sidebar .tcyb-logo-img { width: 100%; }

/* ---- Brand footer (every page, including login) ---- */
.tcyb-brand-footer {
    padding: 1rem 1.5rem 1.25rem;
    text-align: center;
}
.tcyb-brand-footer-notice,
.tcyb-brand-footer-copy {
    margin: 0 auto;
    color: var(--muted-foreground);
    font-size: .75rem;
    line-height: 1.5;
    max-width: 42rem;
}
.tcyb-brand-footer-copy { margin-top: .35rem; }

/* ---- Highlight / CTA fills (orange with navy text, not white-on-orange) ---- */
.tcyb-highlight {
    background-color: var(--tcyb-orange);
    color: var(--tcyb-navy);
}
.tcyb-highlight:hover,
.tcyb-highlight:focus-visible {
    background-color: var(--tcyb-orange-hover);
    color: var(--tcyb-navy);
}

/* ---- Forms ---- */
.tcyb-form { display: flex; flex-direction: column; gap: 1rem; }
.tcyb-field { display: flex; flex-direction: column; gap: .5rem; }
.tcyb-field-row { display: flex; align-items: center; gap: .5rem; }
.tcyb-validation { color: var(--destructive); font-size: .8rem; }
.tcyb-full { width: 100%; }
.tcyb-mb { margin-bottom: 1rem; }
.tcyb-ml { margin-left: .5rem; }
.tcyb-inline-form { display: inline-flex; margin: 0; }

/* ---- App shell (inside BbSidebarInset) ---- */
.tcyb-sidebar-brand {
    display: flex; flex-direction: column; align-items: flex-start; gap: .15rem;
    width: 100%; min-width: 0; padding: .25rem 0;
}
.tcyb-sidebar-portal {
    font-size: .75rem; color: var(--muted-foreground); padding: 0 10%;
}
[data-collapsible="icon"] .tcyb-logo-frame-sidebar {
    width: 100%;
}

.tcyb-topbar {
    display: flex; height: 3.5rem; align-items: center; gap: .5rem; padding: 0 1rem;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--background); z-index: 10;
}
.tcyb-topbar-title { font-weight: 600; font-size: .95rem; }
.tcyb-spacer { flex: 1; }
.tcyb-user { color: var(--muted-foreground); font-size: .85rem; }
.tcyb-shell-main {
    display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0;
    /* Inset uses height:100% against a min-height wrapper, so it otherwise shrinks to
       the content and leaves the footer mid-page. Fill the viewport below the 3.5rem top bar. */
    min-height: calc(100vh - 3.5rem);
}
.tcyb-shell-main .tcyb-brand-footer {
    border-top: 1px solid var(--border); background: var(--background); margin-top: auto;
}
.tcyb-page { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; max-width: 80rem; width: 100%; box-sizing: border-box; flex: 1 1 auto; }
.tcyb-page-header h1 { margin: 0; font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
.tcyb-page-header p { margin: .25rem 0 0; color: var(--muted-foreground); }
.tcyb-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.tcyb-muted { color: var(--muted-foreground); }

/* Collapsed sidebar (icon rail): hide text next to icons. */
[data-collapsible="icon"] .tcyb-hide-collapsed { display: none; }

/* Blazor error UI */
#blazor-error-ui {
    background: var(--destructive); color: #fff; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none; left: 0; padding: .6rem 1.25rem .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; box-sizing: border-box;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* FocusOnNavigate moves focus to the page h1 for screen readers; no visible ring needed there. */
h1:focus, h1:focus-visible { outline: none; }
.tcyb-checkbox { width: 1rem; height: 1rem; margin: 0; accent-color: var(--primary); cursor: pointer; }

/* ---- Account pages (sign-in code, password reset, security) ---- */
.tcyb-label-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tcyb-link { color: var(--tcyb-navy); text-decoration: underline; text-underline-offset: 2px; }
.tcyb-link:hover { color: var(--tcyb-navy-hover); }
.tcyb-small { font-size: .85rem; }
.tcyb-center { text-align: center; }
.tcyb-right { text-align: right; }
.tcyb-m0 { margin: 0; }
.tcyb-mt { margin-top: 1rem; }
.tcyb-resend { display: flex; align-items: center; justify-content: center; gap: .25rem; margin: 1rem 0 .5rem; }
.tcyb-table-wrap { overflow-x: auto; }
.tcyb-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tcyb-table th { text-align: left; font-weight: 600; color: var(--muted-foreground); padding: .5rem .75rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tcyb-table td { padding: .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.tcyb-table tr:last-child td { border-bottom: none; }

/* Page header with actions on the right */
.tcyb-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.tcyb-header-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.tcyb-button-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.tcyb-divider { border-top: 1px solid var(--border); opacity: .5; margin: 1.25rem 0; }

/* Two-column work area: main (tree/list) + side panel (editor) */
.tcyb-split { display: grid; gap: 1rem; grid-template-columns: minmax(0, 3fr) minmax(18rem, 2fr); align-items: start; }
.tcyb-sticky { position: sticky; top: 4rem; }
@media (max-width: 960px) { .tcyb-split { grid-template-columns: 1fr; } .tcyb-sticky { position: static; } }
.tcyb-stack { display: flex; flex-direction: column; gap: 1rem; }
.tcyb-wrap { flex-wrap: wrap; align-items: flex-end; }
.tcyb-grow { flex: 1 1 14rem; }

/* Lesson block editor */
.tcyb-block-editor { border: 1px solid color-mix(in srgb, var(--border) 60%, transparent); border-radius: var(--radius); padding: .75rem; display: flex; flex-direction: column; gap: .75rem; background: var(--card); }
.tcyb-block-toolbar { display: flex; align-items: center; gap: .5rem; font-size: .875rem; }
.tcyb-callout-sample { margin: 0; }

/* Lesson content (shared by Admin preview and the client portal) */
.tcyb-lesson-body > * + * { margin-top: 1rem; }
.tcyb-callout { border-left: 4px solid var(--tcyb-navy); background: var(--tcyb-surface); border-radius: calc(var(--radius) - 2px); padding: .75rem 1rem; }
.tcyb-callout > :last-child { margin-bottom: 0; }
.tcyb-callout-title { font-weight: 700; margin: 0 0 .25rem; }
.tcyb-callout-tip { border-left-color: var(--tcyb-orange); background: var(--tcyb-accent-wash); }
.tcyb-callout-warning { border-left-color: #B54708; background: #FFFAEB; }
.tcyb-callout-important { border-left-color: var(--destructive); background: #FEF3F2; }
.tcyb-video { margin: 0; }
.tcyb-video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: calc(var(--radius) - 2px); overflow: hidden; background: #000; }
.tcyb-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tcyb-video-caption { font-size: .85rem; margin-top: .35rem; }
.tcyb-video-caption a { color: var(--tcyb-navy); text-decoration: underline; }

/* Selectable list (e.g. books) */
.tcyb-pick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .25rem; }
.tcyb-pick-list button { width: 100%; text-align: left; display: flex; flex-direction: column; gap: .1rem; padding: .5rem .75rem; border-radius: calc(var(--radius) - 2px); border: 1px solid transparent; background: none; cursor: pointer; color: inherit; font: inherit; }
.tcyb-pick-list button:hover { background: var(--tcyb-surface); }
.tcyb-pick-list button.is-active { background: var(--tcyb-accent-wash); border-color: var(--tcyb-orange); }
.tcyb-pick-title { font-weight: 600; }
.tcyb-w-num { width: 6.5rem; }
.tcyb-edit-row td { vertical-align: middle; }

/* Book references */
.tcyb-ref { display: flex; align-items: flex-start; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid color-mix(in srgb, var(--border) 40%, transparent); }
.tcyb-ref-main { display: flex; flex-direction: column; gap: .35rem; flex: 1; min-width: 0; }
.tcyb-ref-title { font-weight: 600; }
.tcyb-ref-icon { margin-top: .2rem; color: var(--tcyb-orange); }
.tcyb-ref-add { display: flex; flex-direction: column; gap: .75rem; padding: .75rem; border: 1px dashed var(--border); border-radius: var(--radius); }
.tcyb-fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.tcyb-fieldset legend { font-size: .875rem; font-weight: 500; margin-bottom: .25rem; }
.tcyb-ref-pick { display: flex; flex-direction: column; gap: .35rem; }
.tcyb-ref-pages { padding-left: 1.5rem; }
.tcyb-page-input { width: 7rem; }

/* Exercise form (client view / admin preview) */
.tcyb-exercise-form { display: flex; flex-direction: column; gap: 1.25rem; }
.tcyb-ex-field { display: flex; flex-direction: column; gap: .4rem; padding: .25rem .5rem; margin: 0 -.5rem; border-radius: calc(var(--radius) - 2px); border-left: 3px solid transparent; }
.tcyb-ex-field.is-selected { border-left-color: var(--tcyb-orange); background: var(--tcyb-accent-wash); }
.tcyb-ex-label { font-weight: 600; font-size: .9rem; }
.tcyb-required { color: var(--destructive); margin-left: .15rem; }
.tcyb-ex-options { display: flex; flex-direction: column; gap: .4rem; }
.tcyb-ex-number { display: flex; align-items: center; gap: .5rem; max-width: 18rem; }
.tcyb-ex-affix { color: var(--muted-foreground); font-size: .875rem; }
.tcyb-ex-table td, .tcyb-ex-table th { padding: .35rem .5rem; vertical-align: middle; }
.tcyb-ex-table tfoot td, .tcyb-ex-table tfoot th { border-bottom: 0; font-weight: 700; }
.tcyb-cell { width: 100%; min-width: 6rem; border: 1px solid var(--input); border-radius: 6px; padding: .3rem .5rem; font: inherit; background: var(--background); color: inherit; }
.tcyb-cell:focus { outline: 2px solid var(--ring); outline-offset: 0; }
.tcyb-cell-num { text-align: right; }
.tcyb-icon-btn { border: 0; background: none; cursor: pointer; font-size: 1.1rem; color: var(--muted-foreground); }
.tcyb-ex-upload { display: flex; align-items: center; gap: .75rem; padding: .75rem; border: 1px dashed var(--border); border-radius: var(--radius); }
.tcyb-block { display: block; }
.tcyb-download { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--tcyb-navy); text-decoration: underline; }
.tcyb-ex-plan { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; color: var(--muted-foreground); }
.tcyb-ok { display: inline-flex; align-items: center; gap: .35rem; color: #067647; font-size: .875rem; }
.tcyb-prewrap { white-space: pre-wrap; }
.tcyb-num-field { width: 10rem; }

/* Exercise builder */
.tcyb-split-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .tcyb-split-even { grid-template-columns: 1fr; } }
.tcyb-field-list { display: flex; flex-direction: column; gap: .4rem; min-height: 2.5rem; }
.tcyb-field-item { display: flex; align-items: center; gap: .5rem; padding: .45rem .5rem; border: 1px solid color-mix(in srgb, var(--border) 60%, transparent); border-radius: calc(var(--radius) - 2px); background: var(--card); cursor: pointer; }
.tcyb-field-item.is-selected { border-color: var(--tcyb-orange); background: var(--tcyb-accent-wash); }
.tcyb-field-item-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.tcyb-field-item-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcyb-drag-handle { cursor: grab; color: var(--muted-foreground); display: inline-flex; }
.tcyb-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .5rem; }
.tcyb-palette-item { width: 100%; display: flex; align-items: center; gap: .5rem; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); background: var(--background); color: inherit; font: inherit; font-size: .875rem; cursor: grab; text-align: left; }
.tcyb-palette-item:hover { background: var(--tcyb-accent-wash); border-color: var(--tcyb-orange); }
.tcyb-link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; } .tcyb-link-list a { display: inline-flex; align-items: center; gap: .4rem; }
.tcyb-palette-wrap { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--border); }

/* Users & audit */
.tcyb-strong { font-weight: 600; }
.tcyb-justify-end { justify-content: flex-end; }
.tcyb-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; }
.tcyb-users-table td { vertical-align: middle; }
.tcyb-users-table select { min-width: 7.5rem; }
.tcyb-pager { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: 1rem; }
.tcyb-nowrap { white-space: nowrap; }
.tcyb-click-rows tbody tr { cursor: pointer; }
.tcyb-click-rows tbody tr:hover td { background: var(--tcyb-surface); }
.tcyb-check-list { display: flex; flex-direction: column; gap: .5rem; }
.tcyb-check-row { display: flex; align-items: center; gap: .75rem; justify-content: space-between; padding: .5rem .75rem; border: 1px solid var(--border); border-radius: .5rem; }
.tcyb-check-row label { display: flex; align-items: center; gap: .5rem; cursor: pointer; }
.tcyb-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 1rem; }
.tcyb-stat { border: 1px solid var(--border); border-radius: .75rem; padding: 1rem; background: var(--card); }
.tcyb-stat-value { font-size: 1.75rem; font-weight: 700; color: var(--primary); line-height: 1.2; }
.tcyb-stat-label { font-size: .85rem; color: var(--muted-foreground); }
.tcyb-stat-note { font-size: .75rem; color: var(--muted-foreground); margin-top: .25rem; }
.tcyb-placeholder-stat { border-style: dashed; background: transparent; }
.tcyb-placeholder-stat .tcyb-stat-value { color: var(--muted-foreground); font-size: 1rem; font-weight: 600; }
.tcyb-section-title { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 .75rem; }
.tcyb-inline-check { display: inline-flex; align-items: center; gap: .4rem; cursor: pointer; }
.tcyb-field-end { justify-content: flex-end; }
.tcyb-stat-link { color: inherit; text-decoration: none; } .tcyb-stat-link:hover { text-decoration: underline; }
/* Publishing */
.tcyb-version-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tcyb-version-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.tcyb-version-list li:last-child { border-bottom: 0; }
.tcyb-version-main { min-width: 0; }
.tcyb-preview-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1rem; border: 1px solid var(--tcyb-orange); background: var(--tcyb-accent-wash); border-radius: .5rem; margin-bottom: 1rem; }
.tcyb-client-frame { max-width: 52rem; margin: 0 auto; display: flex; flex-direction: column; gap: 1.25rem; }
.tcyb-client-lesson h1 { margin: .5rem 0 .25rem; font-size: 1.6rem; font-weight: 700; color: var(--tcyb-navy); }
.tcyb-client-meta { color: var(--muted-foreground); font-size: .9rem; margin-bottom: 1rem; }

/* ---------- App shell: sidebar fixed to the viewport, only the main area scrolls ---------- */
/* The Blueprint sidebar is sticky but stretches to the page height in the flex row, which pushed its
   footer (Sign-in & devices, the user) to the bottom of long pages. Pin it to the viewport instead. */
aside[data-side="left"][data-variant] {
    position: sticky; top: 0; align-self: flex-start;
    height: 100vh; height: 100dvh; max-height: 100dvh; overflow: hidden;
}
aside[data-side="left"] [data-sidebar="content"] { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
aside[data-side="left"] [data-sidebar="header"],
aside[data-side="left"] [data-sidebar="footer"] { flex: 0 0 auto; }
aside[data-side="left"] [data-sidebar="footer"] { border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent); background: var(--sidebar); }

/* ---------- Editor workspace (lesson editor, exercise builder) ---------- */
/* Editors use the full width and fill the viewport below the top bar; each column scrolls on its own. */
.tcyb-page:has(> .tcyb-editor) { max-width: none; padding: 0; gap: 0; }
.tcyb-editor { display: flex; flex-direction: column; height: calc(100vh - 3.5rem); height: calc(100dvh - 3.5rem); min-height: 30rem; }

.tcyb-editorbar {
    flex: 0 0 auto; display: flex; flex-direction: column; gap: .35rem;
    padding: .6rem 1.25rem .55rem; border-bottom: 1px solid var(--border); background: var(--background);
    position: sticky; top: 3.5rem; z-index: 5;
}
.tcyb-editorbar-main { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.tcyb-editorbar-title { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1 1 18rem; }
.tcyb-editorbar-crumbs { font-size: .8rem; }
.tcyb-editorbar-crumbs ol { flex-wrap: nowrap; overflow: hidden; }
.tcyb-editorbar-heading { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.tcyb-editorbar-heading h1 { margin: 0; font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tcyb-editorbar-actions { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.tcyb-editorbar-sub { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.tcyb-nowrap { white-space: nowrap; }
.tcyb-unsaved { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--muted-foreground); white-space: nowrap; }
.tcyb-unsaved-dot { width: .5rem; height: .5rem; border-radius: 999px; background: var(--tcyb-orange); }
.tcyb-bar-link {
    display: inline-flex; align-items: center; gap: .35rem; height: 2rem; padding: 0 .65rem; border-radius: calc(var(--radius) - 2px);
    font-size: .875rem; font-weight: 500; color: var(--primary); text-decoration: none;
}
.tcyb-bar-link:hover { background: var(--accent); }
.tcyb-bar-link svg, .tcyb-editorbar-actions svg { width: 1rem; height: 1rem; }

.tcyb-history-sheet { width: min(28rem, 100vw); max-width: 28rem; display: flex; flex-direction: column; }
.tcyb-history-body { display: flex; flex-direction: column; gap: .9rem; padding: 0 1rem 1rem; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.tcyb-publish-dialog { max-width: 32rem; }

.tcyb-ws-errors { padding: .75rem 1.25rem 0; flex: 0 0 auto; }
.tcyb-ws { flex: 1 1 auto; min-height: 0; display: grid; gap: 0; }
.tcyb-ws-col { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--border); background: var(--background); }
.tcyb-ws-col:last-child { border-right: 0; }
.tcyb-ws-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 1rem 1.25rem 1.5rem; display: flex; flex-direction: column; gap: .75rem; }
.tcyb-ws-scroll[hidden] { display: none; }
.tcyb-ws-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-top: .5rem; }
.tcyb-ws-heading h2, .tcyb-ws-panel-head h2 { margin: 0; font-size: 1rem; font-weight: 700; }
.tcyb-ws-panel-head { display: flex; flex-direction: column-reverse; gap: .15rem; padding-bottom: .5rem; border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.tcyb-ws-footer { flex: 0 0 auto; padding: .6rem 1.25rem; border-top: 1px solid var(--border); background: var(--card); align-items: center; }
.tcyb-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tcyb-ws-tabs { display: flex; gap: .25rem; padding: .5rem 1rem 0; border-bottom: 1px solid var(--border); background: var(--background); flex: 0 0 auto; }
.tcyb-ws-tabs button {
    display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border: 0; border-bottom: 2px solid transparent;
    background: none; color: var(--muted-foreground); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer; margin-bottom: -1px;
}
.tcyb-ws-tabs button svg { width: 1rem; height: 1rem; }
.tcyb-ws-tabs button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--tcyb-orange); }
.tcyb-ws-tabs button:hover { color: var(--primary); }

/* Exercise builder: list+palette | settings | preview. */
.tcyb-ws-list { background: var(--muted, #F6F7F9); background: color-mix(in srgb, var(--muted) 55%, var(--background)); }
.tcyb-ws-list .tcyb-field-item { background: var(--background); }
.tcyb-details-item { width: 100%; text-align: left; font: inherit; color: inherit; }
.tcyb-field-item-tools { display: inline-flex; opacity: .55; }
.tcyb-field-item:hover .tcyb-field-item-tools, .tcyb-field-item.is-selected .tcyb-field-item-tools { opacity: 1; }
.tcyb-field-item-tools button { width: 1.75rem; height: 1.75rem; padding: 0; }
.tcyb-ws-list .tcyb-palette-wrap { flex: 0 0 auto; max-height: 36%; overflow-y: auto; margin: 0; padding: .6rem 1.25rem .75rem; border-top: 1px solid var(--border); background: var(--background); }
.tcyb-ws-list .tcyb-palette { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.tcyb-ws-list .tcyb-palette-item { padding: .4rem .5rem; font-size: .8rem; }

.tcyb-ws-exercise { grid-template-columns: minmax(20rem, 24rem) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.tcyb-ws-exercise > .tcyb-ws-list { grid-column: 1; grid-row: 1 / span 2; }
.tcyb-ws-exercise > .tcyb-ws-tabs { grid-column: 2; grid-row: 1; }
.tcyb-ws-exercise > .tcyb-ws-settings, .tcyb-ws-exercise > .tcyb-ws-preview { grid-column: 2; grid-row: 2; }
.tcyb-ws-exercise[data-tab="settings"] > .tcyb-ws-preview { display: none; }
.tcyb-ws-exercise[data-tab="preview"] > .tcyb-ws-settings { display: none; }
.tcyb-ws-preview { background: color-mix(in srgb, var(--muted) 55%, var(--background)); }
.tcyb-wide-only { display: none !important; }
@media (min-width: 1400px) {
    .tcyb-wide-only { display: inline-flex !important; }
    .tcyb-narrow-only { display: none !important; }
    .tcyb-ws-exercise { grid-template-rows: minmax(0, 1fr); }
    .tcyb-ws-exercise[data-preview="on"] { grid-template-columns: minmax(20rem, 24rem) minmax(24rem, 1fr) minmax(24rem, 1fr); }
    .tcyb-ws-exercise[data-preview="off"] { grid-template-columns: minmax(20rem, 24rem) minmax(0, 1fr); }
    .tcyb-ws-exercise > .tcyb-ws-list { grid-row: 1; }
    .tcyb-ws-exercise > .tcyb-ws-settings { grid-column: 2; grid-row: 1; display: flex !important; }
    .tcyb-ws-exercise[data-preview="on"] > .tcyb-ws-preview { grid-column: 3; grid-row: 1; display: flex !important; }
    .tcyb-ws-exercise[data-preview="off"] > .tcyb-ws-preview { display: none !important; }
    .tcyb-ws-exercise[data-preview="off"] > .tcyb-ws-settings { border-right: 0; }
}

/* Lesson editor: blocks editor | live preview / details tabs. */
.tcyb-ws-lesson { grid-template-columns: minmax(0, 1.25fr) minmax(22rem, 1fr); }
.tcyb-ws-side { background: color-mix(in srgb, var(--muted) 45%, var(--background)); }
.tcyb-ws-side .tcyb-ws-tabs { background: var(--background); }
.tcyb-client-frame-inline { max-width: none; margin: 0; gap: .75rem; padding: 1.25rem 1.5rem; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); }
.tcyb-preview-title { margin: 0; font-size: 1.5rem; font-weight: 700; }

@media (max-width: 960px) {
    .tcyb-editor { height: auto; }
    .tcyb-ws, .tcyb-ws-exercise, .tcyb-ws-lesson { grid-template-columns: 1fr; grid-template-rows: none; }
    .tcyb-ws-exercise > * { grid-column: 1 !important; grid-row: auto !important; }
    .tcyb-ws-col { border-right: 0; border-bottom: 1px solid var(--border); }
    .tcyb-ws-list .tcyb-palette-wrap { max-height: none; }
}

/* Book reference chips (open the picker dialog). */
.tcyb-refchips { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; min-width: 0; }
.tcyb-refchips-icon { width: 1rem; height: 1rem; color: var(--tcyb-orange); flex: 0 0 auto; }
.tcyb-chip {
    display: inline-flex; align-items: center; gap: .3rem; height: 1.6rem; padding: 0 .6rem; border-radius: 999px;
    border: 1px solid var(--border); background: var(--background); color: var(--primary); font: inherit; font-size: .78rem; font-weight: 600;
    cursor: pointer; white-space: nowrap;
}
.tcyb-chip:hover { border-color: var(--tcyb-orange); background: var(--tcyb-accent-wash); }
.tcyb-chip svg { width: .85rem; height: .85rem; }
.tcyb-chip-empty { border-style: dashed; color: var(--muted-foreground); font-weight: 500; }
.tcyb-chip-edit { padding: 0 .45rem; color: var(--muted-foreground); }
.tcyb-refdialog { max-width: 40rem; width: min(40rem, calc(100vw - 2rem)); }
.tcyb-refdialog-body { max-height: min(70vh, 40rem); overflow-y: auto; padding-right: .25rem; }
.tcyb-ref-search { margin-bottom: .5rem; }
.tcyb-ws-blocks .tcyb-video-frame { max-width: 26rem; }
.tcyb-inline-confirm { display: flex; flex-direction: column; gap: .4rem; padding: .65rem .75rem; border: 1px solid var(--tcyb-orange); border-radius: calc(var(--radius) - 2px); background: var(--tcyb-accent-wash); }
.tcyb-version-list li:has(.tcyb-version-confirm) { flex-wrap: wrap; }
.tcyb-version-confirm { flex-basis: 100%; }
/* Lighter, navy-tinted overlay behind the history drawer and dialogs. */
[data-slot="sheet-overlay"] { background: rgb(0 21 65 / .28) !important; }
.tcyb-shell-main:has(.tcyb-editor) > .tcyb-brand-footer { display: none; }

/* Exercise builder: "+ Add field" button pinned under the field list, opening a 2-column type menu. */
.tcyb-addfield { position: relative; flex: 0 0 auto; padding: .6rem 1.25rem .75rem; border-top: 1px solid var(--border); background: var(--background); }
.tcyb-addfield-btn { width: 100%; justify-content: center; }
.tcyb-addfield-backdrop { position: fixed; inset: 0; z-index: 30; }
.tcyb-addfield-menu {
    position: absolute; left: .75rem; bottom: calc(100% - .25rem); z-index: 31; width: min(26rem, calc(100vw - 2rem));
    background: var(--popover, #fff); color: var(--popover-foreground, inherit); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 10px 30px rgb(0 21 65 / .18); padding: .75rem; display: flex; flex-direction: column; gap: .6rem;
}
.tcyb-addfield-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.tcyb-addfield-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.tcyb-addfield-grid .tcyb-palette-item { cursor: pointer; font-size: .85rem; padding: .5rem .6rem; }
.tcyb-addfield-grid .tcyb-palette-item svg { flex: 0 0 auto; width: 1rem; height: 1rem; }
/* App site: workshops */
.tcyb-badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; color: var(--primary); background: var(--card); }
.tcyb-badge-draft { color: var(--muted-foreground); }
.tcyb-badge-open { background: #E8EEF9; border-color: #C9D6EE; }
.tcyb-badge-live { background: var(--tcyb-orange); border-color: var(--tcyb-orange); color: #fff; }
.tcyb-badge-done { background: #E7F5EC; border-color: #BFE3CB; color: #1B5E33; }
.tcyb-badge-cancel { background: #FDECEC; border-color: #F5C2C2; color: #9B1C1C; }
.tcyb-dl { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0; }
.tcyb-dl dt { color: var(--muted-foreground); font-size: .85rem; }
.tcyb-dl dd { margin: 0; }
.tcyb-ws-cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); }
.tcyb-ws-card { display: block; border: 1px solid var(--border); border-radius: .75rem; padding: 1rem; background: var(--card); color: inherit; text-decoration: none; }
.tcyb-ws-card:hover { border-color: var(--primary); }
.tcyb-ws-card h3 { margin: .35rem 0 .25rem; font-size: 1rem; }
.tcyb-alert-warn { border: 1px solid var(--tcyb-orange); background: var(--tcyb-accent-wash); border-radius: .5rem; padding: .75rem 1rem; margin-bottom: 1rem; }
.tcyb-segment { display: inline-flex; border: 1px solid var(--border); border-radius: .5rem; overflow: hidden; }
.tcyb-segment button { border: 0; background: var(--card); padding: .4rem .9rem; cursor: pointer; color: var(--primary); font: inherit; }
.tcyb-segment button[aria-pressed="true"] { background: var(--primary); color: #fff; }
/* App site: client learning */
.tcyb-progress { height: .5rem; background: var(--muted, #EEF1F5); border-radius: 999px; overflow: hidden; }
.tcyb-progress-bar { height: 100%; background: var(--tcyb-orange); border-radius: 999px; transition: width .3s; }
.tcyb-client-exercise h2 { font-size: 1.1rem; }
.tcyb-answer { padding: .5rem .75rem; border: 1px solid var(--border); border-radius: .5rem; background: var(--tcyb-surface, #F7F8FA); min-height: 2.25rem; }
.tcyb-file-row { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; }
.tcyb-ex-upload-list { display: flex; flex-direction: column; gap: .4rem; }
label.tcyb-ex-upload { cursor: pointer; }
label.tcyb-ex-upload:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }
/* Action Plan board */
.ap-board { display: flex; flex-direction: column; gap: 1rem; }
.ap-summary { background: var(--card); border: 1px solid var(--border); border-radius: .75rem; padding: 1rem 1.25rem; }
.ap-overdue-text { color: #B42318; font-weight: 600; }
.ap-phase { background: var(--card); border: 1px solid var(--border); border-radius: .75rem; padding: 1rem 1.25rem; }
.ap-phase-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .5rem; }
.ap-phase-head h2 { font-size: 1.05rem; margin: 0; color: var(--tcyb-navy); }
.ap-empty { margin: .25rem 0; }
.ap-item { display: flex; align-items: flex-start; gap: .75rem; padding: .65rem 0; border-top: 1px solid var(--border); }
.ap-item:first-of-type { border-top: 0; }
.ap-item .tcyb-checkbox, .ap-state-icon { margin-top: .2rem; flex: none; }
.ap-main { flex: 1; min-width: 0; }
.ap-title { font-weight: 600; color: var(--tcyb-navy); overflow-wrap: anywhere; }
.ap-item.is-done .ap-title { text-decoration: line-through; color: var(--muted-foreground); font-weight: 500; }
.ap-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; }
.ap-section { font-weight: 500; }
.ap-pri { display: inline-block; font-size: .72rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; border: 1px solid var(--border); white-space: nowrap; }
.ap-pri-high { background: var(--tcyb-orange); border-color: var(--tcyb-orange); color: #fff; }
.ap-pri-medium { background: #E8EEF9; border-color: #C9D6EE; color: var(--tcyb-navy); }
.ap-pri-low { background: var(--card); color: var(--muted-foreground); }
.ap-date { font-size: .8rem; white-space: nowrap; color: var(--muted-foreground); }
.ap-date.is-overdue { color: #B42318; font-weight: 600; }
.ap-editor { border: 1px solid var(--tcyb-navy); border-radius: .6rem; padding: .9rem 1rem; margin: .5rem 0; display: flex; flex-direction: column; gap: .6rem; background: #FBFCFE; }
@media (max-width: 640px) { .ap-item { flex-wrap: wrap; } .ap-meta { width: 100%; justify-content: flex-start; padding-left: 1.75rem; } }

/* Printable Action Plan */
.tcyb-print-shell { background: #fff; min-height: 100vh; }
.ap-print { max-width: 820px; margin: 0 auto; padding: 1.5rem 1.5rem 2rem; color: #1a1a1a; font-size: 10.5pt; }
.ap-print-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.ap-print-btn { background: var(--tcyb-navy); color: #fff; border: 0; border-radius: .5rem; padding: .5rem 1rem; font-weight: 600; cursor: pointer; }
.ap-print-head { display: flex; align-items: center; gap: 1.25rem; border-bottom: 4px solid var(--tcyb-orange); padding-bottom: .9rem; margin-bottom: 1rem; }
.ap-print-logo { flex: 0 0 150px; width: 150px; }
.ap-print-logo * { max-width: 100%; height: auto; }
.ap-print-titles { flex: 1; min-width: 0; }
.ap-print-head h1 { margin: 0; color: var(--tcyb-navy); font-size: 1.6rem; }
.ap-print-who { font-weight: 700; color: var(--tcyb-navy); font-size: 1.05rem; }
.ap-print-sub { color: #555; font-size: .9rem; }
.ap-print-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: 1rem; }
.ap-print-summary div { border: 1px solid #d8dde6; border-radius: .5rem; padding: .5rem .75rem; display: flex; flex-direction: column; }
.ap-print-summary strong { font-size: 1.3rem; color: var(--tcyb-navy); }
.ap-print-summary span { font-size: .8rem; color: #555; }
.ap-print-phase { margin-bottom: 1rem; break-inside: auto; }
.ap-print-phase h2 { background: var(--tcyb-navy); color: #fff; font-size: 1rem; padding: .35rem .75rem; border-radius: .35rem; margin: 0 0 .4rem; }
.ap-print table { width: 100%; border-collapse: collapse; }
.ap-print th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: #555; border-bottom: 1px solid #c9ced8; padding: .3rem .4rem; }
.ap-print td { border-bottom: 1px solid #e3e6ec; padding: .4rem; vertical-align: top; }
.ap-print tr { break-inside: avoid; }
.ap-print tr.is-done .ap-print-title { text-decoration: line-through; color: #777; }
.ap-print-title { font-weight: 600; }
.ap-print-notes { color: #555; font-size: .85rem; white-space: pre-wrap; }
.ap-c-done { width: 1.5rem; font-size: 1.1rem; }
.ap-nowrap { white-space: nowrap; }
.ap-print-empty { color: #777; margin: .2rem .4rem; }
.ap-print-foot { color: #777; font-size: .8rem; margin-top: 1.5rem; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  .no-print { display: none !important; }
  .ap-print { padding: 0; max-width: none; }
  .ap-print-head, .ap-print-phase h2, .ap-pri-high { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
/* Trainer client views */
.tcyb-segment button[aria-selected="true"] { background: var(--primary); color: #fff; }
.tcyb-segment button:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }
.tcyb-segment-sm button { padding: .25rem .6rem; font-size: .8rem; }
.tcyb-min-w { min-width: 150px; }
.tcyb-bench-bar { display: inline-block; height: .45rem; border-radius: 999px; background: var(--tcyb-orange); vertical-align: middle; margin-right: .4rem; }
