.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--tlt-color-primary);
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Landing page */
.landing {
    max-width: 40rem;
    margin: 3rem auto;
    text-align: center;
}

.landing-byline {
    font-style: italic;
    color: var(--tlt-color-accent);
    font-size: 1.25rem;
    margin-top: -0.5rem;
}

.landing-copy {
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 1.5rem 0 2rem;
}

.landing-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    align-items: center;
}

/* Auth forms (Login/Register) */
.auth-card {
    max-width: 26rem;
    margin: 2rem auto;
    background-color: var(--tlt-color-surface);
    border-radius: var(--tlt-radius);
    box-shadow: var(--tlt-shadow-sm);
    padding: 2.25rem 2.5rem;
}

.card {
    background-color: var(--tlt-color-surface);
    border-radius: var(--tlt-radius);
    box-shadow: var(--tlt-shadow-sm);
    padding: 2rem 2.25rem;
}

.auth-lede {
    color: var(--tlt-color-text-muted);
    margin-bottom: 1.5rem;
}

.auth-card label, .card label {
    display: block;
    margin-bottom: 1rem;
    font-family: var(--tlt-font-body);
}

.auth-card label > input, .card label > input, .card label > select, .card label > textarea {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 4px;
    font-size: 1rem;
    font-family: var(--tlt-font-body);
    background-color: var(--tlt-color-surface);
}

.card label > textarea {
    font-family: var(--tlt-font-reading);
    min-height: 4.5rem;
    resize: vertical;
}

.auth-card button[type="submit"], .card button[type="submit"] {
    margin-top: 0.5rem;
}

/* Dashboard: children list */
.child-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.child-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--tlt-color-bg);
    border: 1px solid var(--tlt-color-border);
    border-radius: 999px;
    padding: 0.4rem 0.9rem 0.4rem 0.6rem;
}

.child-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Settings' Appearance card - theme swatch picker */
.theme-swatch-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.theme-swatch-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--tlt-font-body);
    font-size: 0.9rem;
    color: var(--tlt-color-text);
    background-color: var(--tlt-color-surface);
    border: 2px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 0.5rem 0.9rem;
    cursor: pointer;
}

.theme-swatch-btn:hover {
    border-color: var(--tlt-color-primary);
}

.theme-swatch-btn--active {
    border-color: var(--tlt-color-accent);
}

.theme-swatch-dots {
    display: flex;
}

.theme-swatch-dot {
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-swatch-dot:not(:first-child) {
    margin-left: -0.35rem;
}

.child-switch-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    background-color: var(--tlt-color-accent);
    color: var(--tlt-palette-white);
    font-family: var(--tlt-font-body);
    font-size: 0.65rem;
    font-weight: 600;
    flex-shrink: 0;
}

.child-name {
    font-weight: 600;
}

.child-form {
    color: var(--tlt-color-text-muted);
    font-size: 0.9rem;
}

/* Settings' Groups card - one row per Group, roster chips + member checkboxes below */
.group-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--tlt-color-border);
}

.group-row .child-list {
    flex-basis: 100%;
}

.group-row .checkbox-label {
    flex-basis: 100%;
}

.add-child-card {
    margin-top: 1.5rem;
}

/* School.razor's Subjects/Terms/Courses/Books rows - a proper full-width list row with
   Edit/Delete actions, not the .child-chip pill (that shape suits compact read-only tags
   like the Children list above, not a row that grows an inline edit form). Same visual
   language as Settings' own .group-row, which solved this identical problem first. */
.entity-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--tlt-color-border);
}

.entity-row:last-child {
    border-bottom: none;
}

.entity-row-details {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    flex: 1 1 auto;
    min-width: 0;
}

/* Overrides .card label's own block/full-width default (built for a vertical create
   form) so an edit-in-place row's fields sit compactly inline instead of each taking a
   full line - used inside .entity-row (School.razor) and the Children edit row
   (Settings.razor), wherever editing swaps a couple of read-only spans for real inputs. */
.inline-edit-fields {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.inline-edit-fields label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
    width: auto;
}

.inline-edit-fields label > input,
.inline-edit-fields label > select {
    display: inline-block;
    width: auto;
    margin-top: 0;
}

/* A short, fixed-length choice (Term, Book ownership, parent involvement) rendered as a
   row of .btn-primary/.btn-secondary toggle buttons instead of a native <select>/<radio> -
   same active/inactive language Calendar's view-mode switch and child filter already use.
   Reserved for lists that stay short by nature; a list that can genuinely grow long (Books,
   Courses, Subjects) keeps the native <select> instead. */
.pill-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

/* Settings.razor's "Your avatar" / "Children" cards - one .avatar-picker row per person. */
.avatar-picker {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 0.75rem 0;
}

.avatar-picker + .avatar-picker {
    border-top: 1px solid var(--tlt-color-border);
}

.avatar-preview-large {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 999px;
    background-color: var(--tlt-color-accent);
    color: var(--tlt-palette-white);
    font-family: var(--tlt-font-body);
    font-size: 1.4rem;
    font-weight: 600;
    flex-shrink: 0;
}

.avatar-picker-controls {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.avatar-style-swatches {
    display: flex;
    gap: 0.75rem;
}

.avatar-style-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-family: var(--tlt-font-body);
    font-size: 0.8rem;
}

.avatar-style-swatch:hover {
    background-color: var(--tlt-color-bg);
}

.avatar-preview-small {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background-color: var(--tlt-color-accent);
    color: var(--tlt-palette-white);
    font-family: var(--tlt-font-body);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Documents library */
.document-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* Shares its exact column template with .document-list-item below so the Title/Created/
   Updated headers line up with each row's own cells - Quip-style sortable columns, replacing
   the old Recent/New filter chips (see Library.razor's SetLibrarySortField). The two flanking
   <span> cells in the header markup are empty on purpose - they sit over the kind-badge and
   actions columns, which have nothing sortable to click. */
.document-list-header {
    display: grid;
    grid-template-columns: 8rem 1fr auto auto auto;
    align-items: center;
    gap: 1rem;
    padding: 0 0 0.5rem;
    border-bottom: 2px solid var(--tlt-color-border);
}

.document-list-header-col {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--tlt-color-text-muted);
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}

.document-list-header-col:hover {
    color: var(--tlt-color-text);
}

.document-list-header-col--active {
    color: var(--tlt-color-accent);
}

.document-list-item {
    display: grid;
    grid-template-columns: 8rem 1fr auto auto auto;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--tlt-color-border);
}

/* A folder row's item count, inlined right after its name (list view only - the grid tile
   keeps its own separate .folder-grid-tile-count) now that both of a folder's date columns
   carry real Created/Updated values instead of one of them doubling as the item count. */
.document-list-item-count {
    margin-left: 0.5rem;
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
}

.document-list-item:last-child {
    border-bottom: none;
}

.document-list-item .doc-kind-badge {
    justify-self: start;
}

.document-list-link {
    font-size: 1.05rem;
    text-decoration: none;
}

.document-list-link:hover {
    text-decoration: underline;
}

.document-list-date {
    color: var(--tlt-color-text-muted);
    font-size: 0.85rem;
    white-space: nowrap;
}

.document-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
}

.document-search-input:focus {
    outline: none;
    border-color: var(--tlt-color-primary);
    box-shadow: 0 0 0 3px rgba(92, 109, 120, 0.15);
}

.document-list-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.document-list-page-indicator {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
    white-space: nowrap;
}

/* Folders page (Folders.razor) - a Quip-style grid of folder-shaped, per-folder-colored
   tiles with a List-view alternative, breadcrumb drill-down, and its own search/CRUD.
   Documents.razor no longer hosts a folder sidebar - folder browsing lives entirely here. */
.folders-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.folders-page-header h1 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.folders-page-title-icon {
    flex-shrink: 0;
}

.folders-page-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.folders-view-toggle {
    display: inline-flex;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    overflow: hidden;
}

.folders-view-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem 0.9rem;
    font-family: var(--tlt-font-body);
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.folders-view-toggle-btn + .folders-view-toggle-btn {
    border-left: 1px solid var(--tlt-color-border);
}

.folders-view-toggle-btn--active {
    background-color: var(--tlt-color-bg);
    color: var(--tlt-color-text);
    font-weight: 600;
}

.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 1.5rem;
    margin-top: 1.25rem;
}

/* A real folder shape (body + a small tab along the top-left edge), solid-filled with the
   folder's own color via an inline style - the ::before tab reuses that same color via
   background-color: inherit rather than needing a CSS class per color. */
.folder-grid-tile {
    position: relative;
    /* Confines the illustration overlay's negative z-index (see .folder-grid-tile-illustration)
       to this one tile - without it, a z-index:-1 descendant would compete in the GRID's own
       stacking context instead and could paint underneath a neighboring tile. */
    isolation: isolate;
    display: flex;
    flex-direction: column;
    aspect-ratio: 1.05;
    margin-top: 0.9rem;
    border-radius: 0 0.9rem 0.9rem 0.9rem;
    padding: 1rem 0.9rem;
    border: none;
    cursor: pointer;
    color: var(--tlt-palette-white);
    text-align: left;
    font-family: var(--tlt-font-body);
    /* Only takes effect when a cover image is also set (see Library.razor's FolderTileStyle) -
       harmless no-op otherwise, since there's no background-image to size/position. */
    background-size: cover;
    background-position: center;
}

.folder-grid-tile::before {
    content: "";
    position: absolute;
    top: -0.8rem;
    left: 0;
    width: 42%;
    height: 0.9rem;
    background-color: inherit;
    border-radius: 0.6rem 0.6rem 0 0;
}

.folder-grid-tile-name {
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.3;
    /* Belt-and-suspenders alongside the scrim gradient in Library.razor's FolderTileStyle - a
       busy or bright cover photo can still fight with white text even under a dark scrim. */
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.folder-grid-tile-count {
    margin-top: auto;
    font-size: 0.8rem;
    opacity: 0.85;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.folder-grid-tile-menu {
    font-family: var(--tlt-font-body);
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: rgba(255, 255, 255, 0.25);
    border: none;
    border-radius: var(--tlt-radius-sm);
    color: var(--tlt-palette-white);
    cursor: pointer;
    padding: 0.1rem 0.45rem;
}

.folder-grid-tile-menu:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

/* Drag/drop (Library.razor grid view): a folder or document tile dropped onto a folder tile
   adds/moves it into that folder - this is the "yes, right here" affordance while something is
   dragged over a valid folder target, mirrored on the ring rather than the fill so it stays
   visible over any folder color, cover photo, or illustration underneath. */
.folder-grid-tile--drop-target {
    outline: 3px solid var(--tlt-color-accent);
    outline-offset: -3px;
}

/* FolderKind badge - only rendered for a non-Blank folder (see FolderKindIcons.For's own
   "empty string for Blank" doc comment) - grid tile gets a small inline glyph right before
   the folder name, everywhere else (list row, page header, folder-actions modal, drawer
   tree) gets the fuller pill. */
.folder-grid-tile-kind {
    font-size: 0.95rem;
    margin-right: 0.15rem;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.folder-kind-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    color: var(--tlt-color-text);
    background-color: var(--tlt-color-bg);
    border: 1px solid var(--tlt-color-border);
    white-space: nowrap;
}

.folder-tree-kind {
    font-size: 0.8rem;
}

/* TermPlanning-only "Linked Term" row (Library.razor) - sits directly under the planning
   note, a plain label+select plus a link that only appears once a Term is actually linked. */
.folder-term-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.folder-term-link-view {
    font-size: 0.85rem;
    color: var(--tlt-color-accent);
}

/* Create-time Folder Kind picker (FolderFormModal.razor) - a compact row, not the full
   .document-kind-gallery tile grid, since this dialog already stacks name/color/art. */
.folder-kind-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.folder-kind-option {
    flex: 1 1 8rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    border: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-surface);
    border-radius: var(--tlt-radius-sm);
    padding: 0.5rem 0.6rem;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}

.folder-kind-option--active {
    border-color: var(--tlt-color-accent);
    outline: 2px solid var(--tlt-color-accent);
    outline-offset: -1px;
}

.folder-kind-option-icon {
    font-size: 1.1rem;
}

.folder-kind-option-label {
    font-weight: 600;
    font-size: 0.85rem;
}

.folder-kind-option-description {
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
}

.document-grid-tile {
    position: relative;
    /* Same containment trick .folder-grid-tile's own comment explains - keeps the preview's
       z-index:auto absolute positioning (below) from competing in the GRID's own stacking
       context instead of this one tile's. */
    isolation: isolate;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    aspect-ratio: 1.05;
    border-radius: var(--tlt-radius);
    border: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-surface);
    padding: 1rem;
    text-decoration: none;
    color: var(--tlt-color-text);
    overflow: hidden;
}

.document-grid-tile .doc-kind-badge {
    /* An absolutely-positioned sibling with z-index:auto (the preview below) paints ABOVE an
       ordinary static in-flow element regardless of DOM order - without this, the badge would
       silently end up UNDER the preview text. Same fix applied to .document-grid-tile-meta. */
    position: relative;
    z-index: 1;
    align-self: flex-start;
    flex-shrink: 0;
}

/* The document's own opening content (several blocks' worth, not just the first) superimposed
   behind the title/date footer band below - Steve: "show a preview of the document with the
   current meta data... superimposed on the preview." See DocumentSummaryDto.PreviewText/
   BlockContentPreview.BuildCardPreviewsAsync for where this text comes from. pointer-events:none
   so it never intercepts the card's own click-to-open (the whole tile is one <a>). */
.document-grid-tile-preview {
    position: absolute;
    inset: 2.6rem 0 0 0;
    padding: 0 1rem;
    font-size: 0.7rem;
    line-height: 1.5;
    color: var(--tlt-color-text-muted);
    white-space: pre-wrap;
    word-break: break-word;
    overflow: hidden;
    pointer-events: none;
}

/* Solid footer band the title/date sit in, so they stay legible regardless of how much preview
   text ends up directly behind them - same idea as FolderTileStyle's own scrim gradient for a
   cover-photo folder tile, just a flat opaque band instead of a gradient fade, since the
   "photo" here is plain same-surface-color text, not an actual image. Negative side/bottom
   margins stretch it to the card's own edges despite .document-grid-tile's padding; the
   parent's overflow:hidden (+ border-radius) clips this band's own square corners back down to
   match the card's rounded shape. */
.document-grid-tile-meta {
    position: relative;
    z-index: 1;
    margin-top: auto;
    margin-left: -1rem;
    margin-right: -1rem;
    margin-bottom: -1rem;
    padding: 0.4rem 1rem 0.75rem;
    background-color: var(--tlt-color-surface);
    border-top: 1px solid var(--tlt-color-border);
}

/* Shorter clamp than the bare rule below once a preview sits behind it and a date shares the
   same footer band - 3 lines there would crowd both out. PinnedDocumentsWidget's own pin cards
   reuse .document-grid-tile-title directly (no .document-grid-tile-meta wrapper, no preview),
   so they're unaffected and keep the taller 3-line clamp. */
.document-grid-tile-meta .document-grid-tile-title {
    -webkit-line-clamp: 2;
}

.document-grid-tile-title {
    font-size: 0.95rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.document-grid-tile-date {
    margin-top: auto;
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
}

/* Library's "My Library" tab grid view - a document tile needs an "add to folder" button
   alongside it (ported from Documents.razor's flat list, which had one per row), but
   .document-grid-tile is itself an <a> (the whole card is a document-open link) so the
   button can't nest inside it - this thin wrapper gives the pair a shared position:relative
   context, same corner-badge placement idiom as .folder-grid-tile-menu above. */
.document-grid-tile-wrap {
    position: relative;
    margin-top: 0.9rem;
}

.document-grid-tile-folder-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background-color: var(--tlt-color-bg);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    cursor: pointer;
    padding: 0.1rem 0.4rem;
    font-size: 0.9rem;
}

.document-grid-tile-folder-btn:hover {
    background-color: var(--tlt-color-surface);
    border-color: var(--tlt-color-primary);
}

/* PinnedDocumentsWidget's own grid - narrower columns than Library's .folders-grid, since this
   renders inside a dashboard widget rather than a full page. Reuses .document-grid-tile-wrap/
   .document-grid-tile-folder-btn (the unpin ×) unmodified for visual consistency with Library's
   own document cards. */
.pinned-documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
    gap: 0.75rem;
}

/* The whole tile is the drag handle (Calendar.razor's pattern, not Dashboard.razor's dedicated
   grip - this card is too small for a grip to fit without crowding the kind badge/unpin ×). */
.pinned-documents-grid .document-grid-tile-wrap {
    cursor: grab;
}

.folder-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
    margin-bottom: 0.5rem;
}

.folder-breadcrumb a {
    color: var(--tlt-color-text-muted);
}

.folder-breadcrumb-sep {
    color: var(--tlt-color-border);
}

.folder-breadcrumb-current {
    color: var(--tlt-color-text);
    font-weight: 600;
}

.folder-action-error {
    margin: 0.25rem 0.5rem;
}

.folder-actions-modal .user-menu-item {
    font-size: 1rem;
}

.folder-actions-modal h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.folder-move-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 20rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.folder-move-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: none;
    border: none;
    border-radius: var(--tlt-radius-sm);
    padding: 0.5rem 0.6rem;
    font-family: var(--tlt-font-body);
    font-size: 0.9rem;
    color: var(--tlt-color-text);
    text-align: left;
    cursor: pointer;
}

.folder-move-option:hover:not(:disabled) {
    background-color: var(--tlt-color-bg);
}

.folder-move-option:disabled {
    cursor: default;
}

.folder-move-option--current {
    font-weight: 600;
}

/* "Choose Folder" dialog (AddToFolderModal.razor) - search + a scrollable expandable-tree
   list with a Cancel/Add footer, matching Quip's own picker. */
.choose-folder-modal {
    width: 32rem;
    max-width: 90vw;
    padding: 1.25rem 1.5rem;
}

.choose-folder-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.6rem;
}

.choose-folder-header h2 {
    margin: 0;
}

.choose-folder-new-btn {
    font-family: var(--tlt-font-body);
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: var(--tlt-radius-sm);
    border: 1px solid var(--tlt-color-border);
    background: none;
    font-size: 1.2rem;
    line-height: 1;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

.choose-folder-new-btn:hover {
    background-color: var(--tlt-color-bg);
}

.choose-folder-search {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.25rem;
    border-top: 1px solid var(--tlt-color-border);
    border-bottom: 1px solid var(--tlt-color-border);
}

.choose-folder-search-icon {
    display: flex;
    align-items: center;
    color: var(--tlt-color-text-muted);
    font-size: 0.9rem;
}

.choose-folder-search input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
    background: none;
    color: var(--tlt-color-text);
}

/* A fixed height (not max-height) with its own scroll, independent of the modal itself -
   the box stays the same size whether it holds 1 row or enough to scroll, so searching
   down to a handful of matches doesn't shrink the whole dialog around it. Tall enough to
   show a good number of rows at once, capped so the dialog itself doesn't get unwieldy. */
.choose-folder-list {
    height: 27rem;
    overflow-y: auto;
    padding: 0.35rem 0;
}

.choose-folder-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.25rem;
    border-radius: var(--tlt-radius-sm);
    cursor: pointer;
}

.choose-folder-row:hover {
    background-color: var(--tlt-color-bg);
}

.choose-folder-row--selected {
    background-color: var(--tlt-color-bg);
    font-weight: 600;
}

.choose-folder-expand {
    font-family: var(--tlt-font-body);
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1;
    color: var(--tlt-color-text);
    padding: 0;
    border-radius: var(--tlt-radius-sm);
}

.choose-folder-expand:hover {
    background-color: var(--tlt-color-border);
}

.choose-folder-expand-spacer {
    width: 1.5rem;
    flex-shrink: 0;
}

.choose-folder-row-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.choose-folder-row-check {
    color: var(--tlt-color-primary);
    font-weight: 700;
    flex-shrink: 0;
}

.choose-folder-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--tlt-color-border);
}

.document-list-actions {
    display: flex;
    align-items: center;
    gap: 0.15rem;
}

.document-list-folder-btn {
    font-family: var(--tlt-font-body);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: var(--tlt-radius-sm);
    color: var(--tlt-color-text-muted);
    font-size: 0.9rem;
    line-height: 1;
}

.document-list-folder-btn:hover {
    background-color: var(--tlt-color-bg);
}

@media (max-width: 60rem) {
    .documents-shell {
        flex-direction: column;
    }

    .documents-sidebar {
        width: auto;
        border-right: none;
        border-bottom: 1px solid var(--tlt-color-border);
    }
}

.document-blocks {
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.document-block {
    line-height: 1.6;
}

/* Always-visible, clickable per-block comment-count badge (see
   editor-src/commentBadgeExtension.ts) - a real ProseMirror decoration widget, pulled out
   of document flow via absolute positioning against the block's own .bn-block-outer
   wrapper. Placed on the LEFT, clear of BlockNote's own drag-handle/side-menu - BlockNote
   reserves a fixed 54px via .bn-editor's own "padding-inline" (see
   @blocknote/core/dist/style.css) immediately left of the block, which is separate from and
   in addition to .tlt-document-editor's own left padding below. -5.75rem (92px) lands the
   badge ~10px inside our own padding column, clear of that 54px zone on both sides. */
.bn-block-outer {
    position: relative;
}

/* A comic-style talk-bubble (same path as CommentIcon.razor's own - see
   commentBadgeExtension.ts's comment on why this SVG is hand-duplicated there rather than
   shared) with the count layered on top in a real DOM span, replacing what used to be a
   plain circle - Steve wanted it to read like Quip's own comment indicator. */
.tlt-comment-badge {
    position: absolute;
    left: -5.75rem;
    top: 0.1rem;
    /* Square (not the old 1.5x1.35 rect) - matches the shape's own new rounder, more-circular
       body (17x14 with r=6, was 18x10.5 with r=4) and reads a bit bigger overall, per Steve's
       follow-up ask. */
    width: 1.65rem;
    height: 1.65rem;
    cursor: pointer;
}

.tlt-comment-badge-shape {
    display: block;
    width: 100%;
    height: 100%;
    fill: var(--tlt-color-primary);
}

.tlt-comment-badge-count {
    position: absolute;
    /* Centered on the bubble's own rounded BODY, not the shape's full bounding box - the tail
       (pointing down-right, see commentBadgeExtension.ts's path) extends well past the body on
       one side, so centering within the whole box would land off-center on the body itself
       (confirmed live via a screenshot: the old grid-based centering + an eyeballed
       margin-bottom fudge left the count visibly low and to the right). The body spans x:3-20,
       y:2-16 of the path's 24x24 viewBox - 47.9167%/37.5% are that body's own exact geometric
       center as a fraction of the viewBox, computed directly from those coordinates rather than
       estimated, so this stays exactly correct even if the shape or container size changes
       again. transform:translate(-50%,-50%) centers the text span itself on that point,
       correctly handling "0" vs "18" (different rendered widths) the same way. */
    left: 47.9167%;
    top: 37.5%;
    transform: translate(-50%, -50%);
    color: var(--tlt-palette-white);
    font-size: 0.65rem;
    line-height: 1;
}

/* "Read" state (see commentBadgeExtension.ts) - also used, unmodified, for the placeholder
   "0" badge on the currently-selected empty block, since "0" and "fully read" both mean
   "nothing outstanding here" and should look identical. Outline (stroke), not a solid fill,
   same white-body/colored-ring relationship the old circle badge had. */
.tlt-comment-badge--read .tlt-comment-badge-shape {
    fill: var(--tlt-color-surface);
    stroke: var(--tlt-color-primary);
    stroke-width: 1.5;
}

.tlt-comment-badge--read .tlt-comment-badge-count {
    color: var(--tlt-color-primary);
}

/* Universal Lesson Block (lessonBlock.tsx, alpha overview doc §3) - a heading-weight title
   with a small leading icon, distinct enough from a plain Heading to read as its own thing.
   Deliberately no collapse/expand chrome or background box - see that file's own doc comment
   for why (Steve only asked for visual indentation, which nested children already get for
   free from BlockNote's own default rendering). */
.tlt-lesson-block {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.tlt-lesson-block-icon {
    flex-shrink: 0;
}

.tlt-lesson-block-title {
    flex: 1;
    font-weight: 700;
    font-size: 1.15rem;
}

/* Document detail: a Quip-style full-bleed shell. A slim toolbar spans the top (title +
   document-level actions as popover panels, not stacked cards); below it the document
   fills most of the width and a narrow comment rail sits at the right, separated only by
   a vertical border - not boxed like the rest of the app's ".card" surfaces. min-height: 0
   on the flex containers is what lets the two columns scroll independently instead of
   stretching the page - flex items otherwise default to a min-height based on content,
   which defeats overflow. Only visually "fixed height" on /documents/{id}, where
   MainLayout applies its --fixed modifier classes; elsewhere this lays out as a normal,
   page-scrolling stack. */
.document-shell {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.document-loading {
    padding: 2.5rem 2rem;
}

/* MainLayout's ErrorBoundary fallback (SessionExpiredNotice, generic error) - not
   document-specific, so its own class rather than reusing .document-loading. */
.circuit-error-notice {
    padding: 2.5rem 2rem;
}

.document-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.1rem 2rem 0.5rem;
    flex-shrink: 0;
}

.document-toolbar-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    font-size: 1.3rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toolbar-item {
    position: relative;
    flex-shrink: 0;
}

.toolbar-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 22rem;
    background-color: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius);
    box-shadow: var(--tlt-shadow-sm);
    padding: 1.5rem;
    /* Was 20 - tied or lost against @fortune-sheet/react's own persistent toolbar/grid chrome
       (its own CSS uses z-index: 20 for column/row resize handles and z-index: 25, commented
       "higher than toolbar tips", for its toolbar itself), so opening a document-menubar dropdown
       over a spreadsheet block let the spreadsheet's own toolbar icons visibly paint on top of
       the menu - reported live with a screenshot. 50 matches HomeDrawer's own established tier:
       clearly above every in-page toolbar/popover, clearly below the real-modal tier (100+). */
    z-index: 50;
    text-align: left;
    /* Some panels (Use This Plan especially, once Forms/Groups/Children/Course/Days/
       Duration/Involvement/Starting-lesson are all stacked in) are taller than the
       viewport - without a cap the panel just grows past the bottom of the screen with
       no way to reach its own submit button. Scroll internally instead. This assumes the panel
       opens near the top of the viewport; for one anchored further down (e.g. the document
       menu bar's own dropdowns, opened below the title) site.js's own MutationObserver
       (see its "toolbar-panel height" comment) additionally sets an inline max-height once the
       panel's real on-screen position is known, overriding this default via specificity. */
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
}

.toolbar-panel h2 {
    margin-top: 0;
}

/* Each top-level menu's own root list (DocumentDetail.razor's Document/Edit/Insert/Format/Plan
   bar, plus its trailing "..." overflow) - narrower than the 22rem form panels above, sized to
   its content instead. */
.toolbar-panel--menu {
    width: auto;
    min-width: 14rem;
    padding: 0.5rem;
}

/* Quip-style top-level menu bar, below the document title. container-type: inline-size (not a
   @media viewport query) so collapse reacts to the BAR's own rendered width, matching .tlt-live's
   established container-query precedent rather than .tlt-toolbar-more's viewport-breakpoint one -
   this bar's own width can differ from the viewport (e.g. the outline bar and comments pane eating into
   it), and "collapse only what doesn't fit" is exactly what a container query is for. */
.document-menubar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0 1.5rem 0.6rem;
    border-bottom: 1px solid var(--tlt-color-border);
    container-type: inline-size;
    /* Positioning context a COLLAPSED item's own panel falls back to - see the @container rules
       below, which switch that item's own .toolbar-item off "position: relative" so its panel
       (still position: absolute) anchors here (bottom-right of the whole bar, near "...") instead
       of at its own now-hidden trigger button's location. */
    position: relative;
}

.document-menubar-trigger {
    background: none;
    border: none;
    padding: 0.4rem 0.6rem;
    font-family: var(--tlt-font-body);
    font-size: 0.9rem;
    color: var(--tlt-color-text);
    cursor: pointer;
    border-radius: var(--tlt-radius-sm);
}

.document-menubar-trigger:hover {
    background-color: var(--tlt-color-bg);
}

/* The base .toolbar-panel z-index (50) still loses to @fortune-sheet/react's own PERSISTENT
   chrome - not just its toolbar (25, already beaten): its own scrollbars are z-index: 1003 and
   its bottom sheet-tab/zoom bar is z-index: 1000, both confirmed by grepping the library's own
   CSS, and both visible for the whole time a spreadsheet block renders, not just while actively
   editing it - reported live via screenshot (the spreadsheet's own scrollbar painting over an
   open Insert menu). Scoped to Document/Edit/Insert/Format/the overflow specifically - NOT Plan
   (excluded below) and not the shared base .toolbar-panel rule itself, both deliberately: Plan's
   own Assign/Use-This-Plan panels can open a real app modal from inside them ("Add a child",
   DocumentDetail.razor's OpenAddChildModal, when a family has no children yet) via
   .modal-backdrop at z-index: 100, and that modal must always end up on top of whichever panel
   opened it - raising Plan's own panels to 2000 too would have inverted that. Rotation/
   Send-to-Task-Widget are opened from a block's own context menu, not this bar, so they aren't
   matched by the .document-menubar-scoped selector below - given their own .block-context-menu
   class instead (neither ever opens a modal from inside itself, so no Plan-style exclusion needed
   here). */
.document-menubar :is(.document-menubar-item--document, .document-menubar-item--edit, .document-menubar-item--insert, .document-menubar-item--format, .document-menubar-overflow) > .toolbar-panel,
.block-context-menu > .toolbar-panel {
    /* 2100: above BlockNote's own gutter (side menu / drag handle) popups, which sit at --bn-ui-base-z-index (2000) + their own 10-90 offset;
       at a plain 2000 the gutter's "+" and drag handle painted straight through an open Document menu as the mouse moved down it. */
    z-index: 2100;
}

/* Same spreadsheet-chrome-bleed-through problem, different source: BlockNote's OWN stock toolbar
   buttons (block-type selector, font size, text/background color, alignment, the drag-handle's
   own "..." menu) are @mantine/core Menu components, not anything this app built - their dropdown
   is Mantine's own .mantine-Menu-dropdown, hardcoded to Mantine's default z-index: 300, which still
   loses to Fortune-sheet's scrollbar (1003) - reported live via screenshot (the block-type-select
   dropdown, opened while a spreadsheet sits below it in the same document). Bare (unscoped)
   selector, matching this file's existing .bn-mantine rule's own established precedent just above -
   Mantine's dropdowns aren't consistently portalled to document.body (this one wasn't, confirmed
   live: its real DOM parent was .tlt-editor-toolbar-formatting), so scoping to a specific ancestor
   isn't reliable either way, and .mantine-Menu-dropdown only ever appears inside the BlockNote
   editor bundle in this app. !important is required here (unlike every other z-index rule in this
   file) because Mantine's own floating-ui positioning engine sets z-index: 300 as an INLINE style
   on the dropdown element itself (confirmed live via element.style.zIndex) - an inline style beats
   any external stylesheet rule regardless of selector specificity, so a plain rule here silently
   did nothing (computed style stayed 300 even with this rule loaded and matching). Same 2000 tier
   as the two rules above - safe because Mantine's own default (300) already sits above this app's
   .modal-backdrop (100), so this preserves the same relative order, just clears the higher
   spreadsheet-chrome bar too. */
.mantine-Menu-dropdown {
    z-index: 2000 !important;
}

/* Every top-level dropdown (Document/Edit/Insert/Format/Plan) opens left-justified with its own
   label, expanding rightward - the base .toolbar-panel rule's `right: 0` is correct for the old
   single "⋯" trigger it was written for (anchored at the bar's own right edge already), but wrong
   here: Document is the LEFTMOST item, so right-aligning ITS panel pushed a 14-22rem-wide panel
   off the left edge of the viewport entirely (reported live, screenshot showed the panel's own
   left portion cut off past x=0). The "..." overflow trigger is excluded - it stays right-aligned,
   matching where it actually sits (the bar's own right edge) and where a collapsed item's panel
   falls back to anchoring once its own trigger is hidden (see the @container overrides below,
   which restore right-alignment specifically for that fallback case). */
.document-menubar-item:not(.document-menubar-overflow) > .toolbar-panel {
    left: 0;
    right: auto;
}

/* Hidden until at least one top-level item has actually collapsed - see the @container rules
   below, which are the only things that ever show it. */
.document-menubar-overflow {
    display: none;
}

/* Every overflow-list row mirrors its own inline sibling's collapsed state, inverted: hidden by
   default, only shown once its matching @container rule below has collapsed that category out of
   the inline bar. Selecting one just sets activeTopMenu directly (DocumentDetail.razor's
   SelectFromOverflow) - the category's own panel, still physically nested under its own (now
   CSS-hidden) trigger button, is what actually renders, so no menu content is ever duplicated. */
.document-menubar-overflow-item {
    display: none;
}

/* Progressive collapse order: Plan first (this app's own addition, least essential while actively
   editing text), then Document. Edit/Insert/Format never collapse - they're the core editing
   actions and this bar only has 5 items total, so two collapse tiers are enough headroom for any
   realistic width (including the comments pane's own narrowing effect). */
@container (max-width: 40rem) {
    /* Only the trigger button hides - the .toolbar-item itself stays "displayed" (just with no
       visible content of its own) so its panel, if opened via the overflow list, still renders;
       switching off position:relative here is what redirects that panel's position:absolute
       anchor from this (now invisible) item up to .document-menubar itself, landing near "...". */
    .document-menubar-item--plan {
        position: static;
    }

    .document-menubar-item--plan > .document-menubar-trigger {
        display: none;
    }

    /* Once this item's own trigger is hidden, its panel's position:absolute falls back to
       anchoring against .document-menubar itself (the next positioned ancestor) - restore
       right-alignment for that fallback case specifically, so it lands near "..." (the bar's
       own right edge, where the click that opens it actually came from) instead of inheriting
       the left-alignment above, which would anchor it to the WHOLE BAR's left edge instead. */
    .document-menubar-item--plan > .toolbar-panel {
        left: auto;
        right: 0;
    }

    .document-menubar-overflow {
        display: block;
    }

    .document-menubar-overflow-item--plan {
        display: flex;
    }
}

@container (max-width: 30rem) {
    .document-menubar-item--document {
        position: static;
    }

    .document-menubar-item--document > .document-menubar-trigger {
        display: none;
    }

    /* Same fallback-anchor override as --plan above. */
    .document-menubar-item--document > .toolbar-panel {
        left: auto;
        right: 0;
    }

    .document-menubar-overflow-item--document {
        display: flex;
    }
}

/* The "‹ Back" row at the top of every drilled-in panel (References/History/Pin/Assign/Use
   This Plan/Save as Template/Add to Meal Plan/More) - returns to the root list rather than
   closing the whole menu. Sits flush with the panel's own edge, ahead of that panel's <h2>
   or (References' own case) its tab-strip. */
.doc-menu-back {
    display: inline-block;
    background: none;
    border: none;
    padding: 0;
    margin-bottom: 0.75rem;
    color: var(--tlt-color-text-muted);
    font-family: var(--tlt-font-body);
    font-size: 0.85rem;
    cursor: pointer;
}

.doc-menu-back:hover {
    color: var(--tlt-color-text);
}

/* The rotation panel has no toolbar toggle button of its own (opened only from a block's
   context menu via "Add to Rotation"), so unlike the Assign/Use-This-Plan panels it needs
   its own explicit dismiss control. */
.toolbar-panel .close-icon-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

.format-color-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem 0.5rem;
}

.rotation-kind-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

/* Dashboard: current rotation-focus tiles (Artist Study/Poetry/Scripture/Composer Study) */
.rotation-focus-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.rotation-focus-tile {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    background-color: var(--tlt-color-bg);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius);
    padding: 0.75rem 1rem;
    min-width: 12rem;
}

.rotation-focus-kind {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--tlt-color-text-muted);
}

.rotation-focus-preview {
    font-family: var(--tlt-font-body);
}

.rotation-focus-tile--quote {
    max-width: 22rem;
}

.rotation-focus-quote-text {
    margin: 0;
    font-style: italic;
}

.rotation-focus-quote-source {
    font-size: 0.8rem;
}

.rotation-focus-photo {
    display: block;
    max-width: 100%;
    max-height: 10rem;
    width: auto;
    border-radius: var(--tlt-radius-sm, 4px);
    object-fit: contain;
}

/* Settings.razor's Rotating Content section - one row per curriculum kind, plus the Family
   Photos/Family Quotes subsections below it. */
.rotation-settings-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rotation-settings-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--tlt-color-border);
}

.rotation-settings-row:last-child {
    border-bottom: none;
}

.rotation-settings-kind {
    font-weight: 600;
    min-width: 8rem;
}

.rotation-subsection-heading {
    font-family: var(--tlt-font-heading);
    font-size: 1.1rem;
    margin: 1.25rem 0 0.5rem;
}

.family-photo-grid {
    list-style: none;
    margin: 0.75rem 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    gap: 0.75rem;
}

.family-photo-tile {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.family-photo-tile img {
    width: 100%;
    height: 7rem;
    object-fit: cover;
    border-radius: var(--tlt-radius-sm, 4px);
}

/* Dashboard: widget system (Dashboard.razor + Components/Dashboard/*.razor) - deliberately
   NOT the global .card (kept roomy for Settings/School/auth pages) - a widget needs to be
   compact enough that several can sit on screen at once.
   Full-bleed page (see MainLayout's IsFullBleedContentRoute/.app-content--full-bleed) with
   its own trimmed padding, a fixed 4-column grid, and unit-based row height (--dw-width/
   --dw-height custom props set inline per widget from WidthUnits/HeightUnits, both 1-4).
   ROW_UNIT_HEIGHT = 9rem: header (~1.7rem incl. margin) + card padding (~1.7rem vertical)
   leaves ~5.6rem body budget at 1 unit tall - enough for CurrentHabitWidget/TodaysMealWidget
   without feeling cramped. At 4 units tall (4*9rem + 3*1rem gap = 39rem) a resized-up
   YourLessonsWidget/TasksWidget gets real room before its own internal scroll kicks in. */
.dashboard-page {
    padding: 0.5rem 0.75rem 2rem;
}

.dashboard-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.dashboard-edit-toggle {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    border: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.dashboard-edit-toggle:hover {
    background-color: var(--tlt-color-bg);
}

.dashboard-edit-toggle--active {
    color: var(--tlt-color-primary);
    border-color: var(--tlt-color-primary);
}

.dashboard-widget-grid {
    /* Containing block for a widget mid-drag (position: absolute, set by dashboardResize.js)
       and for the grid-line overlay it shows alongside - both anchor to this element's own
       box rather than drifting up to whatever the next positioned ancestor happens to be. */
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 9rem;
    grid-auto-flow: dense;
    gap: 1rem;
}

/* Graph-paper grid lines shown only while dashboardResize.js has a widget mid-drag, so the
   snap points a release will round to are visible while the widget itself is still following
   the cursor in free pixels. Line spacing is set inline per-drag (via CSS custom
   background-image) since actual column width is a responsive fraction, not a fixed rem
   value - see that file's createOverlay. */
.dashboard-resize-grid-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.4;
    z-index: 1;
}

.dashboard-widget {
    position: relative;
    background-color: var(--tlt-color-surface);
    border-radius: var(--tlt-radius);
    box-shadow: var(--tlt-shadow-sm);
    padding: 0.85rem 1rem;
    display: flex;
    flex-direction: column;
    grid-column: span var(--dw-width, 1);
    grid-row: span var(--dw-height, 1);
    /* min-width: 0 overrides the grid item's implicit min-width: auto - without it, wide
       content (a long unbroken string, a table) can force this item's own grid TRACK wider
       than its "span N" share, which grows the whole grid (and so the page) past screen
       width even though grid-column only ever spans as many columns as currently exist. */
    min-width: 0;
    overflow: hidden;
}

/* Live-preview state while dashboardResize.js is actively dragging this widget's resize
   handle - position/left/top/width/height are all set inline by that script for the
   duration of the drag (taking this widget out of the grid's own layout so it can follow the
   cursor in free pixels instead of snapping straight to the next whole grid unit); this class
   only supplies the visual treatment while that's happening. z-index above the grid overlay
   (1) and any neighboring widget it may grow to overlap; the heavier shadow reads as "lifted"
   the same way a dragged card does elsewhere in this app. */
.dashboard-widget--resizing {
    transition: none;
    user-select: none;
    z-index: 2;
    /* Only --tlt-shadow-sm exists as a design token (theme.css) - this drag-lift needs to
       read as noticeably heavier than that, so it's a plain literal rather than a var(). */
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.dashboard-widget-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
    min-width: 0;
}

.dashboard-widget-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Content lives here, not directly in .dashboard-widget - this is what actually gets the
   fixed-height-cell's own scrollbar when content overflows its WidthUnits/HeightUnits
   allotment, instead of the grid row itself growing to fit. */
.dashboard-widget-body {
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.dashboard-widget-drag-handle {
    cursor: grab;
    color: var(--tlt-color-text-muted);
}

/* Bottom-right drag-to-resize handle (dashboardResize.js) - replaces the old width/height
   ◀▶ stepper buttons with a single corner grip, the more familiar affordance (spreadsheet
   cells, OS windows, Trello/Notion-style card resizing) for "drag to change size" rather than
   two separate click-to-increment controls. touch-action: none stops the browser's own
   scroll/pinch gesture recognition from intercepting the pointer sequence on touch devices,
   since dashboardResize.js drives the whole drag itself via pointer events. */
.dashboard-widget-resize-handle {
    position: absolute;
    right: 0.1rem;
    bottom: 0.1rem;
    width: 1.1rem;
    height: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tlt-color-text-muted);
    cursor: nwse-resize;
    touch-action: none;
}

.dashboard-widget-resize-handle:hover {
    color: var(--tlt-color-text);
}

.dashboard-add-widget-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.dashboard-create-list-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dashboard-create-list-mode {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--tlt-font-body);
    font-size: 0.85rem;
    white-space: nowrap;
    cursor: pointer;
}

/* Tablet: 2 columns - a widget's grid-column clamps visually to span at most 2 rather than
   overflowing; its stored WidthUnits is untouched, so it returns to full width back on
   desktop. Same breakpoint idiom as .documents-shell/.document-body elsewhere in this file. */
@media (max-width: 60rem) {
    .dashboard-widget-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-widget {
        grid-column: span min(var(--dw-width, 1), 2);
    }
}

/* Mobile: stack to 1 column. Explicitly overriding grid-column to span 1 (rather than
   leaving grid-template-columns: 1fr alone) avoids CSS Grid auto-creating implicit columns
   to satisfy a wider span, which would overflow the viewport instead of clamping. */
@media (max-width: 30rem) {
    .dashboard-widget-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-widget {
        grid-column: span 1;
    }
}

/* AtAGlanceWidget internals - one card in child view, one per family child in parent view */
.at-a-glance-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.at-a-glance-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 7rem;
    text-align: center;
}

.at-a-glance-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    color: #fff;
    font-weight: 600;
}

.at-a-glance-progress {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.at-a-glance-continue {
    font-size: 0.85rem;
}

.at-a-glance-all-complete {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tlt-color-status-complete, var(--tlt-color-text-muted));
}

/* Same quiet accent as .lesson-help-active/ActivityFeedWidget's Needs Help section - not a
   loud red, "prioritized" just means "shown," per the Dashboard Details doc's own §8 framing. */
.at-a-glance-needs-help {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tlt-color-status-continues);
}

/* §5 large-family modes - a manual control bar (view toggle + Group by Form + child filter
   pills, shown only when there's more than one child), a compact card variant that just shrinks
   everything (no fields hidden), and independently-collapsible Form groups. */
.at-a-glance-controls {
    margin-bottom: 0.75rem;
}

.at-a-glance-card--compact {
    gap: 0.1rem;
    min-width: 4.5rem;
}

.at-a-glance-card--compact .at-a-glance-avatar {
    width: 1.6rem;
    height: 1.6rem;
    font-size: 0.75rem;
}

.at-a-glance-card--compact .child-name,
.at-a-glance-card--compact .at-a-glance-progress,
.at-a-glance-card--compact .at-a-glance-continue,
.at-a-glance-card--compact .at-a-glance-all-complete,
.at-a-glance-card--compact .at-a-glance-needs-help,
.at-a-glance-card--compact .tlt-reading {
    font-size: 0.72rem;
}

.at-a-glance-group {
    margin-bottom: 0.6rem;
}

.at-a-glance-group-toggle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    padding: 0.2rem 0;
    margin-bottom: 0.4rem;
    font-family: var(--tlt-font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

/* TodaysLessonsWidget internals - per-child grouping */
.todays-lessons-child {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
    font-weight: 600;
}

.todays-lessons-child:first-child {
    margin-top: 0;
}

.todays-lessons-item-list {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
}

.todays-lessons-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    padding: 0.15rem 0;
}

/* Same fix as .tasks-widget-item-label - a subject/document title is free text and can be
   long enough to force this flex row (and so the widget's grid column) wider than intended
   without it. */
.todays-lessons-item-label {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
}

/* TodaysLessonsWidget's parent/shared-work section - shown instead of the lesson groups above
   when a specific parent or "Family/Shared Work" is selected (no lesson is ever parent- or
   nobody-owned, so the two sections are mutually exclusive, never stacked). */
.todays-lessons-tasks-heading {
    font-weight: 600;
    margin: 0 0 0.25rem;
}

/* ActivityFeedWidget - the "visually prioritized above ordinary activity" Needs Help section
   (Dashboard Details doc §8) gets its own quiet accent tone, same --tlt-color-status-continues
   token .lesson-help-active already uses, not a loud red - "prioritized" means "shown first,"
   not "alarming." */
.activity-needs-help {
    background-color: var(--tlt-color-bg);
    border-left: 3px solid var(--tlt-color-status-continues);
    border-radius: var(--tlt-radius-sm);
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
}

.activity-needs-help-heading {
    font-weight: 600;
    margin: 0 0 0.4rem;
}

.activity-needs-help-item {
    padding: 0.35rem 0;
    border-top: 1px solid var(--tlt-color-border);
}

.activity-needs-help-item:first-of-type {
    border-top: none;
}

.activity-needs-help-note {
    margin: 0.15rem 0 0;
    font-style: italic;
}

/* TodaysLessonsWidget - §9's child filter and its own reuse of the Needs Help block above. */
.today-widget-filter {
    margin-bottom: 0.5rem;
}

.today-widget-needs-help {
    margin-bottom: 0.5rem;
}

.activity-feed-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.activity-feed-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--tlt-color-border);
}

.activity-feed-item:last-child {
    border-bottom: none;
}

.activity-feed-time {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.75rem;
}

/* ThisWeekWidget - a 7-column mini-grid, one column per day. Deliberately its own layout
   rather than reusing Calendar's 7-column grid CSS, since a dashboard widget's column is far
   narrower (a fraction of one grid unit) than a full calendar page's own week column. */
.this-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.this-week-day {
    min-width: 0;
    border-radius: var(--tlt-radius-sm, 4px);
    padding: 0.3rem 0.2rem;
}

.this-week-day--today {
    background-color: var(--tlt-color-bg);
}

.this-week-day-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--tlt-color-text-muted);
    margin-bottom: 0.3rem;
}

.this-week-day-number {
    font-weight: 400;
}

.this-week-day-empty {
    display: block;
    text-align: center;
    color: var(--tlt-color-text-muted);
}

.this-week-day-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.this-week-day-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
}

.this-week-day-item .child-dot {
    flex-shrink: 0;
}

/* §10 - each item is clickable straight into its document, so the row is a <button> now, not
   plain text - reset it back to looking like the plain row it replaced. */
.this-week-day-item-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    width: 100%;
    min-width: 0;
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
    border-radius: var(--tlt-radius-sm, 4px);
}

.this-week-day-item-btn:hover,
.this-week-day-item-btn:focus-visible {
    background-color: var(--tlt-color-bg);
}

/* A day column is only a fraction of the widget's own width, so there's rarely room to wrap
   a lesson's full label - truncate with an ellipsis instead (the <li>'s title attribute
   carries the full text as a hover tooltip). min-width: 0 overrides this flex item's own
   default "auto" floor (which would otherwise hold the row at its untruncated min-content
   width) so it actually shrinks to the day column's real width. */
.this-week-day-item-label {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Notifications.razor (§13 Inbox) - full history, not unread-only, so unread items need a
   visual marker (left accent bar) rather than relying on absence-from-list like before. Each
   row is a single full-width clickable link (no underlined inline text, matching
   .this-week-day-item-btn's own "row reads as a button" treatment) with a leading icon badge
   that identifies the item's TYPE (comment vs. which kind of activity event) at a glance. */
.inbox-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.inbox-item {
    border-bottom: 1px solid var(--tlt-color-border);
    border-left: 3px solid transparent;
}

.inbox-item:last-child {
    border-bottom: none;
}

.inbox-item--unread {
    border-left-color: var(--tlt-color-primary);
    background-color: var(--tlt-color-bg);
}

.inbox-item-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.6rem;
    color: inherit;
    text-decoration: none;
    border-radius: var(--tlt-radius-sm, 4px);
}

.inbox-item-link:hover,
.inbox-item-link:focus-visible {
    background-color: var(--tlt-color-bg);
    color: inherit;
    text-decoration: none;
}

.inbox-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
}

/* --tlt-color-link (navy) rather than --tlt-color-accent - the latter IS
   --tlt-color-status-continues (theme.css), so a Note would otherwise land on the identical
   hue as a help.requested Activity item; Notes get their own distinct identity instead. */
.inbox-item-icon--note { background-color: color-mix(in srgb, var(--tlt-color-link) 16%, transparent); color: var(--tlt-color-link); }
.inbox-item-icon--narrationCreated { background-color: color-mix(in srgb, var(--tlt-color-primary) 16%, transparent); color: var(--tlt-color-primary); }
.inbox-item-icon--helpRequested { background-color: color-mix(in srgb, var(--tlt-color-status-continues) 20%, transparent); color: var(--tlt-color-status-continues); }
.inbox-item-icon--scheduleChanged { background-color: color-mix(in srgb, var(--tlt-color-status-rescheduled) 20%, transparent); color: var(--tlt-color-status-rescheduled); }
.inbox-item-icon--lessonCompleted,
.inbox-item-icon--helpResolved,
.inbox-item-icon--dailyWorkCompleted,
.inbox-item-icon--other { background-color: color-mix(in srgb, var(--tlt-color-status-complete) 20%, transparent); color: var(--tlt-color-status-complete); }

.inbox-item-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0.1rem;
}

.inbox-item-text {
    color: var(--tlt-color-text);
}

.inbox-item-time {
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 0.75rem;
}

/* Search.razor page */
.search-result-group {
    margin-top: 1.5rem;
}

.search-result-group h2 {
    font-family: var(--tlt-font-heading);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.search-result-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.search-result-item a {
    font-family: var(--tlt-font-body);
    color: var(--tlt-color-text);
    text-decoration: none;
    padding: 0.4rem 0.6rem;
    border-radius: var(--tlt-radius-sm);
    display: block;
}

.search-result-item a:hover {
    background-color: var(--tlt-color-bg);
    color: var(--tlt-color-primary);
}

/* Tasks.razor page */
.task-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--tlt-color-border);
}

.task-item:last-child {
    border-bottom: none;
}

.task-title {
    flex: 1;
}

.task-title--complete {
    text-decoration: line-through;
    color: var(--tlt-color-text-muted);
}

.task-due-badge {
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
    white-space: nowrap;
}

.task-recurrence-badge {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
    cursor: default;
}

.task-assignee {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* TasksWidget internals */
.tasks-widget-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tasks-widget-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    padding: 0.15rem 0;
}

/* flex:1 + min-width:0 lets this shrink below its own text's natural width instead of
   forcing .tasks-widget-item (and everything up through .dashboard-widget's grid column)
   wider than the widget's allotted WidthUnits - the same class of bug min-width:0 fixes
   for .dashboard-widget itself, just one level deeper. overflow-wrap handles the
   pathological case a plain min-width:0 alone can't: a single unbroken "word" (a long URL,
   a name with no spaces) has no space to wrap at, so it still needs permission to break
   mid-word rather than overflow. */
.tasks-widget-item-label {
    flex: 1;
    min-width: 0;
    overflow-wrap: break-word;
}

.tasks-widget-add-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.6rem;
}

.tasks-widget-add-input {
    font-family: var(--tlt-font-body);
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    padding: 0.3rem 0.5rem;
}

/* Icon-only "add" button - text ("Add Task") plus a flex:1 input never both fit inside a
   narrow dashboard-widget column, so this drops the label in favor of an aria-label/title
   instead of trying to shrink text further. */
.tasks-widget-add-button {
    font-family: var(--tlt-font-body);
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    padding: 0;
    border: none;
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-primary);
    color: var(--tlt-palette-white);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.tasks-widget-add-button:hover:not(:disabled) {
    background-color: var(--tlt-color-primary-dark);
}

.tasks-widget-add-button:disabled {
    opacity: 0.5;
    cursor: default;
}

/* The whole widget body is the click target that opens HabitNotesModal - reset the <button>
   back to a plain block so its own <p> children keep looking like the widget's ordinary text,
   not a button. Reads as clickable via a quiet background highlight on hover/focus, same
   treatment as .this-week-day-item-btn's own per-lesson buttons - not an underlined link.
   Padding + an equal negative margin (rather than plain padding alone) gives the hover highlight
   breathing room around the text without shifting where that text actually starts - it still
   lines up with every other widget's own flush-left heading. */
.current-habit-open {
    display: block;
    text-align: left;
    border: none;
    background: none;
    padding: 0.4rem 0.5rem;
    margin: -0.4rem -0.5rem;
    font: inherit;
    color: inherit;
    cursor: pointer;
    border-radius: var(--tlt-radius-sm, 4px);
}

.current-habit-open:hover,
.current-habit-open:focus-visible {
    background-color: var(--tlt-color-bg);
}

.current-habit-name {
    font-weight: 600;
}

/* The quiet streak line ("3 days running") - deliberately just muted text, same auth-lede
   tone as the habit's own description right above it, no badge/counter chrome. */
.current-habit-streak {
    margin-top: 0.35rem;
}

/* CurrentWeeklyListWidget's own "Week N" heading, ahead of its lesson list. */
.current-weekly-list-week {
    font-weight: 600;
    margin-bottom: 0.4rem;
}

/* The whole "Week N" + list region is one click target that opens WeekCalendarModal - a
   negative-margin/matching-padding pair so the enlarged hit area doesn't shift surrounding
   widget-body spacing, same trick .document-grid-tile uses for its own oversized link area. */
.current-weekly-list-body {
    cursor: pointer;
    margin: -0.4rem;
    padding: 0.4rem;
    border-radius: var(--tlt-radius-sm);
}

.current-weekly-list-body:hover {
    background-color: var(--tlt-color-bg);
}

.document-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* No top padding here (moved to margin-top on the first child below) - overflow-y: auto
   clips scrolled content at this element's own BORDER edge, but position: sticky's
   top: 0 (see .tlt-editor-toolbar) anchors relative to the PADDING edge instead - with a
   2rem top padding here, those two boundaries sat 2rem apart, leaving a real gap where
   scrolled document text stayed visible above the sticky toolbar before the toolbar's own
   background caught up to cover it (confirmed live via elementFromPoint: block content was
   still hit-testable clear up to this element's border edge, a full 2rem above where the
   toolbar actually started painting). Removing the padding makes both boundaries coincide. */
.document-main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding: 0 3rem 2rem;
}

/* A Pdf / PhysicalBook document: the Document | PDF tab strip stays put and exactly ONE thing scrolls below it - the block editor's
   panel on the Document tab, the PDF viewer's own page stack on the PDF tab. (Before, .document-main scrolled the whole column, so
   on the PDF tab it scrolled AROUND the viewer's own scroller and carried the tab strip and the marker button out of view.) */
.document-main--tabbed {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.document-main--tabbed > .tab-strip-row {
    flex-shrink: 0;
    margin: 0.5rem 3rem 0.5rem;
}

.document-main--tabbed > .document-tab-panel {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 3rem 2rem;
}

/* The PDF panel never scrolls itself: its action row and the viewer's top bar stay, the page stack fills the rest. */
.document-main--tabbed > .document-tab-panel--pdf:not(.tab-panel-hidden) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.document-main--tabbed > .document-tab-panel--pdf {
    overflow: hidden;
}

.document-tab-panel--pdf > .pdf-viewer-root {
    flex: 1;
    min-height: 0;
}

/* Heading outline (DocumentDetail.razor, derived from document.Blocks - see RefreshOutline): Quip-style slide-out between the document and the
   comments pane. The dock is a slim bar (the handle) that thickens on hover; hovering it, focusing it, or pinning it (a click) slides the outline
   out over the document's right edge. Every document has one - with no headings the panel says so. */
.document-outline-dock {
    position: relative;
    flex: none;
    width: 0.9rem;
    z-index: 30;
}

.document-outline-handle {
    position: absolute;
    top: 0.5rem;
    bottom: 0.5rem;
    right: 0.25rem;
    width: 4px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--tlt-color-border);
    cursor: pointer;
    transition: width 0.15s ease, background-color 0.15s ease, right 0.15s ease;
}

.document-outline-dock:hover .document-outline-handle,
.document-outline-dock:focus-within .document-outline-handle,
.document-outline-dock--open .document-outline-handle {
    width: 9px;
    right: 0.1rem;
    background: var(--tlt-color-primary);
}

.document-outline-handle:focus-visible {
    outline: 2px solid var(--tlt-color-primary);
    outline-offset: 2px;
}

/* The slider clips the panel so it really slides out from the bar instead of fading over the comments pane. */
.document-outline-slider {
    position: absolute;
    top: 0;
    bottom: 0;
    right: 100%;
    width: 16rem;
    overflow: hidden;
    pointer-events: none;
}

.document-outline-panel {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: 1.25rem 0.75rem 1.25rem 1rem;
    background: var(--tlt-color-surface);
    border-left: 1px solid var(--tlt-color-border);
    box-shadow: -6px 0 18px rgba(15, 23, 42, 0.08);
    transform: translateX(100%);
    visibility: hidden;
    transition: transform 0.18s ease 0.12s, visibility 0s linear 0.3s;
}

.document-outline-dock:hover .document-outline-slider,
.document-outline-dock:focus-within .document-outline-slider,
.document-outline-dock--open .document-outline-slider {
    pointer-events: auto;
}

.document-outline-dock:hover .document-outline-panel,
.document-outline-dock:focus-within .document-outline-panel,
.document-outline-dock--open .document-outline-panel {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.18s ease, visibility 0s;
}

.document-outline-panel h2 {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tlt-color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.document-outline-empty {
    margin: 0;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.document-outline-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.document-outline-item button {
    font-family: var(--tlt-font-body);
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.3rem 0.5rem;
    border-radius: var(--tlt-radius-sm);
    font-size: 0.85rem;
    line-height: 1.3;
    color: var(--tlt-color-text);
    cursor: pointer;
}

.document-outline-item button:hover {
    background-color: var(--tlt-color-bg);
}

.document-outline-item--level-2 button { padding-left: 1.25rem; }
.document-outline-item--level-3 button { padding-left: 2rem; font-size: 0.8rem; }
.document-outline-item--level-4 button,
.document-outline-item--level-5 button,
.document-outline-item--level-6 button { padding-left: 2.75rem; font-size: 0.8rem; }

@media (prefers-reduced-motion: reduce) {
    .document-outline-panel, .document-outline-handle { transition: none; }
}

/* Where the comments pane stacks under the document (a phone): no bar - the View menu's "Show outline" opens the outline as a sheet at the bottom. */
@media (max-width: 60rem) {
    .document-outline-dock { position: static; width: 0; }
    .document-outline-handle { display: none; }
    .document-outline-slider { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; height: min(60vh, 24rem); z-index: 60; }
    .document-outline-dock:hover .document-outline-panel,
    .document-outline-dock:focus-within .document-outline-panel { transform: translateX(100%); visibility: hidden; }
    .document-outline-dock--open .document-outline-panel { transform: translateX(0); visibility: visible; }
    .document-outline-dock:hover .document-outline-slider,
    .document-outline-dock:focus-within .document-outline-slider { pointer-events: none; }
    .document-outline-dock--open .document-outline-slider { pointer-events: auto; }
    .document-outline-panel { border-left: 0; border-top: 1px solid var(--tlt-color-border); box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.18); transform: translateY(100%); }
    .document-outline-dock--open .document-outline-panel { transform: translateY(0); }
}

/* Makes the block editor read as a real document page (like Google Docs/Word) instead of
   collapsing to whatever little height its current blocks happen to need - min-height is a
   floor, not a fixed size, so a long document still grows past this rather than clipping.
   --tlt-color-surface is always pure white regardless of family theme (ThemeCatalog never
   overrides it) - deliberately not using --tlt-color-bg (the page's own off-white background)
   so the page reads as a distinct white sheet rather than blending into its surroundings. */
.tlt-document-editor {
    background-color: var(--tlt-color-surface);
    min-height: 60vh;
    margin-top: 2rem;
    padding: 2rem 3rem 2rem 3rem;
    border-radius: var(--tlt-radius);
    box-shadow: var(--tlt-shadow-sm);
}

/* Phone: the 3rem/2rem-3rem page padding above (and .document-main's own 3rem, set where that
   rule is defined) is a deliberate "paper sheet" margin that works at desktop width but eats
   most of a 375px screen (confirmed live: the document's own content column was ~183px wide
   before this). Tightened to the same order of magnitude every other page already uses at this
   breakpoint (Settings/Dashboard's own max-width: 30rem rules), not removed entirely - the
   white sheet should still read as a sheet, just a narrower one. Deliberately placed AFTER the
   base .tlt-document-editor rule above (not just inside a media query wherever that's
   convenient) - a media query doesn't add specificity, so a same-specificity unconditional rule
   later in the file would otherwise win the cascade even while this one's condition matches;
   source order is what decides between two equal-specificity rules, not which one is "more
   conditional" (found live: moving .document-main's own copy of this rule worked purely by
   accident, because no later unconditional .document-main rule existed to re-win). */
@media (max-width: 30rem) {
    .document-main {
        padding: 0 1rem 1.5rem;
    }

    .tlt-document-editor {
        padding: 1.25rem 1rem;
    }

    /* The badge's -5.75rem offset (see .tlt-comment-badge's own comment) assumes the wide
       desktop left gutter; with .tlt-document-editor's own padding cut above, that much
       clearance no longer exists and the badge would sit off-screen. BlockNote's own 54px
       reserved gutter is unaffected by our padding, so the badge still has that much room to
       work with - a small negative offset keeps it just left of the block, inside that gutter,
       rather than clipped past the viewport edge. */
    .tlt-comment-badge {
        left: -1.5rem;
    }
}

/* The BlockNote/Mantine editor bundle (editor.bundle.css) ships its own hardcoded font
   stacks via these two CSS variables, entirely disconnected from the app's own theme -
   every button/menu/dropdown/slash-menu/color-picker in the editor's toolbar and side
   menu falls back to the browser's system font without this override. Bare (unscoped)
   selectors deliberately, not ".tlt-document-editor .bn-mantine" - Mantine portals its
   dropdowns/menus to document.body, outside .tlt-document-editor's own DOM subtree, but
   they still carry these same root classes wherever they land. Declared after
   editor.bundle.css loads (see App.razor's <head> order), so this wins the cascade at
   equal specificity without needing !important. --mantine-font-family-monospace is left
   alone - code blocks should stay monospace regardless of theme. */
.bn-mantine {
    --mantine-font-family: var(--tlt-font-body);
    --mantine-font-family-headings: var(--tlt-font-body);
}

.bn-root {
    --bn-font-family: var(--tlt-font-body);
    /* Third and last piece of the spreadsheet-chrome-bleed-through fix (after .toolbar-panel/
       .block-context-menu's 2000 and .mantine-Menu-dropdown's 2000 !important): BlockNote's OWN
       floating popups - the slash/suggestion menu (opened by typing "/", reported live via
       screenshot showing it under Fortune-sheet's chrome even after the two fixes above), plus its
       side menu, drag-handle menu, table handles, and others - are NOT Mantine Menu components and
       don't carry a stable class at all (confirmed live: the actual positioned wrapper div around
       the slash menu has an empty className). They instead each set an inline
       `zIndex: calc(var(--bn-ui-base-z-index, 0) + <own small offset, 10-90>)` - grepped directly
       from @blocknote/react's own bundle, one shared formula used by every one of these popups, each
       with its own small offset already correctly ordering them relative to EACH OTHER. --bn-ui-base-
       z-index defaults to 0 (unset), so with Fortune-sheet's scrollbar at 1003 every one of these
       popups was losing regardless of its own offset. This is BlockNote's own intended extension
       point for exactly this - setting it here on .bn-root (CSS custom properties inherit, and this
       popup wrapper IS a real DOM descendant of .bn-root, confirmed live, not portalled) shifts the
       WHOLE family to 2010-2090, past the 1003/1000 spreadsheet-chrome tier, while preserving
       BlockNote's own relative ordering between them - no !important, no guessing at an unclassed
       element's selector. */
    --bn-ui-base-z-index: 2000;
}

/* BlockNoteView renders its OWN editable content (.bn-editor) before whatever children
   we pass it (editorToolbar.tsx's toolbar included) - confirmed live, not documented
   anywhere - so the toolbar always lands AFTER the document text in DOM order
   regardless of JSX child order. Forcing .bn-container into a flex column lets
   order: -1 below visually pull the toolbar to the front without fighting that DOM
   order or needing position: absolute (which would need extra padding elsewhere to
   avoid the toolbar overlapping the first line of text). */
.tlt-document-editor .bn-container {
    display: flex;
    flex-direction: column;
}

/* Quip/Google-Docs-style PERSISTENT formatting toolbar (editor-src/editorToolbar.tsx),
   replacing BlockNote's default floating-on-selection one. Rendered inside
   .tlt-document-editor's own React root, so negative margins bleed it out to the white
   sheet's own edges (canceling that container's 2rem/3rem padding) and round only its
   own top corners to match the card - reads as a header row, not an inset toolbar.
   position: sticky (not fixed) pins it to the top of .document-main's own scroll as the
   document scrolls, without overlapping the app header above that scroll container. */
.tlt-editor-toolbar {
    order: -1;
    position: sticky;
    top: 0;
    z-index: 15;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
    margin: -2rem -3rem 1.5rem;
    padding: 0.5rem 3rem;
    background-color: var(--tlt-color-surface);
    border-bottom: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius) var(--tlt-radius) 0 0;
    /* Mantine's default "filled" button color (Bold/Italic/Colors/alignment/link etc. all
       use this one variable for their solid-blue look) - overridden to a dark grey here
       instead of Mantine's own blue-6, scoped to just this toolbar so nothing else in the
       app that happens to reuse Mantine's primary color is affected. -hover is a touch
       lighter, matching the same relationship Mantine's own blue/blue-hover pair has. */
    --mantine-primary-color-filled: #495057;
    --mantine-primary-color-filled-hover: #343a40;
}

.tlt-editor-toolbar-formatting {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
}

/* The buttons EditorToolbar renders twice (see that file's own doc comment): this inline copy
   is the desktop row, hidden below along with everything else that no longer fits at phone
   width - the identical buttons live on inside the More menu instead (.tlt-toolbar-more). */
.tlt-toolbar-overflow-inline {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
}

.tlt-toolbar-more {
    display: none;
}

.tlt-toolbar-more-dropdown {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    width: auto;
    padding: 0.35rem;
}

@media (max-width: 30rem) {
    .tlt-toolbar-overflow-inline {
        display: none;
    }

    .tlt-toolbar-more {
        display: block;
    }
}

/* Greys out everything except Undo/Redo (outside this wrapper - see EditorToolbar) unless
   focus is somewhere in .bn-container - the toolbar AND the editor share that parent (see
   the comment on .tlt-document-editor .bn-container above), so this stays enabled whether
   focus is in the document text OR in one of this group's own controls (e.g. BlockType
   Select's opened dropdown, which needs real focus for keyboard navigation) - restores the
   "only makes sense once you're actually in the document" signal BlockNote's own floating
   toolbar gave for free by only ever appearing on a selection, now that this bar is always
   visible instead. A JS-computed editor.isFocused() check (an earlier version) got this
   wrong: it went false the instant BlockTypeSelect's own dropdown took focus, disabling
   the very menu that had just opened - see editorToolbar.tsx's own doc comment for the
   full story. */
.bn-container:not(:focus-within) .tlt-editor-toolbar-formatting {
    pointer-events: none;
    opacity: 0.35;
}

.tlt-editor-toolbar-divider {
    width: 1px;
    height: 1.25rem;
    margin: 0 0.35rem;
    background-color: var(--tlt-color-border);
    flex-shrink: 0;
}

.tlt-color-trigger-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    font-size: 0.75rem;
    line-height: 1;
    border-radius: 0.15rem;
}

/* Compact swatch-grid color picker (replaces BlockNote's default 20-row color list) -
   see colorPickerButton.tsx. Kept narrow enough to sit comfortably in a dropdown, matching
   the classic Word/Google-Docs/Quip picker Steve asked for. */
.tlt-color-picker-dropdown {
    width: 12.5rem;
    padding: 0.5rem;
}

.tlt-color-picker-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--tlt-color-text-muted);
    margin: 0.5rem 0.25rem 0.35rem;
}

.tlt-color-picker-section-label:first-child {
    margin-top: 0;
}

.tlt-color-swatch-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.35rem;
    padding: 0 0.25rem;
}

.tlt-color-swatch {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-surface);
    cursor: pointer;
    padding: 0;
}

.tlt-color-swatch--default {
    background-image: linear-gradient(to top right, transparent calc(50% - 1px), var(--tlt-color-border), transparent calc(50% + 1px));
}

.tlt-color-swatch--active {
    outline: 2px solid var(--tlt-color-accent);
    outline-offset: 1px;
}

.tlt-color-custom-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.25rem 0.1rem;
}

.tlt-color-custom-swatch {
    width: 1.5rem;
    height: 1.5rem;
    padding: 0;
    border: 1px solid var(--tlt-color-border);
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
}

.tlt-duration-picker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.25rem 0.1rem;
}

.tlt-duration-preset {
    border: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-surface);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    cursor: pointer;
}

.tlt-duration-preset--active {
    outline: 2px solid var(--tlt-color-accent);
    outline-offset: 1px;
}

.tlt-duration-custom-row {
    display: inline-flex;
}

.tlt-duration-custom-input {
    width: 4.5rem;
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 0.35rem;
    font-size: 0.8rem;
}

.tlt-color-custom-swatch::-webkit-color-swatch-wrapper {
    padding: 0;
}

.tlt-color-custom-swatch::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.tlt-color-custom-hex {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
}

/* Both tab panels stay mounted at all times - PdfCanvasViewer does real work on mount
   (loads the pdf.js module, fetches highlights, parses the PDF, renders a canvas), so
   unmounting/remounting it via @if on every tab click would redo all of that from scratch. */
.tab-panel-hidden {
    display: none;
}

.document-attach-pdf-prompt {
    margin-top: 1rem;
}

/* A flex column so the one shared composer (see DocumentDetail's hoisted document-level
   composer) can sit as a plain trailing flex item, pinned to the bottom of the whole pane
   regardless of how many sidebar-sections are open above it - only .document-sidebar-scroll
   scrolls; the composer itself never moves. */
.document-sidebar {
    width: 22rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border-left: 1px solid var(--tlt-color-border);
}

.document-sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1.5rem;
}

.document-sidebar > .note-composer-area {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--tlt-color-border);
}

.sidebar-section + .sidebar-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--tlt-color-border);
}

/* "Referenced in" backlinks list (DocumentDetail.razor) - plain link list, no bullets. */
.backlink-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

/* DocumentDetail.razor's "History" toolbar panel - a session per continuous editing burst,
   click-to-expand into its own block-level diffs below. */
.history-session-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-session {
    border-bottom: 1px solid var(--tlt-color-border);
    padding-bottom: 0.5rem;
}

.history-session:last-child {
    border-bottom: none;
}

.history-session-toggle {
    font-size: 0.85rem;
    text-align: left;
}

.history-diff {
    margin: 0.4rem 0 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* No dedicated "danger" theme token exists yet - reuses .auth-error's own red, the one place
   this app already draws that color, rather than inventing a new token for just this. */
.diff-segment--added {
    background-color: color-mix(in srgb, var(--tlt-color-success) 20%, transparent);
    color: var(--tlt-color-success);
}

.diff-segment--removed {
    background-color: #fbeaea;
    color: #a00000;
    text-decoration: line-through;
}

/* Block-comment sections only (data-block-id) - see tltSyncCommentAnchors in site.js, which
   drives these with translateY as the document scrolls, Google-Docs/Quip margin-comment
   style. The document-level thread and PDF-highlight sections have no single block anchor
   to track, so they're untouched. */
.sidebar-section[data-block-id] {
    transition: transform 150ms ease-out;
}

.sidebar-section h2,
.sidebar-section h3 {
    margin-top: 0;
    font-size: 1.05rem;
}

.sidebar-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.close-icon-button {
    font-family: var(--tlt-font-body);
    flex-shrink: 0;
    border: none;
    background: none;
    padding: 0;
    width: 1.5rem;
    height: 1.5rem;
    line-height: 1;
    font-size: 1.3rem;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

.close-icon-button:hover {
    color: #a00000;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-content {
    position: relative;
    background-color: var(--tlt-color-surface);
    border-radius: var(--tlt-radius);
    box-shadow: var(--tlt-shadow-sm);
    padding: 2rem 2.25rem;
    width: 100%;
    max-width: 26rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.modal-content h2 {
    margin-top: 0;
}

/* WeekCalendarModal embeds the real Calendar page (Grid/Checklist/Kanban, all of it) - nearly
   full viewport so that page has real room to lay out its own 7-column grid, while staying
   visibly a pop-up (not edge-to-edge) so it still reads as a modal over the Dashboard, not a
   full navigation away from it. */
.modal-content--fullpage {
    max-width: 90rem;
    width: 95vw;
    height: 92vh;
    max-height: 92vh;
}

/* FolderFormModal's cover-image preview (Visual Folder Customization) - same small-thumbnail
   idiom as the avatar preview swatches in Settings.razor, sized to echo the folder grid
   tile's own near-square aspect-ratio. */
.folder-cover-image-preview {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.folder-cover-image-preview img {
    width: 4.5rem;
    height: 4.5rem;
    object-fit: cover;
    border-radius: var(--tlt-radius-sm);
    border: 1px solid var(--tlt-color-border);
}

/* Curated illustration picker (FolderFormModal) - a swatch grid modeled directly on
   .tlt-color-swatch-grid/.tlt-color-swatch above, sized larger (square tiles, not dots) since
   each one needs to show a small line-drawing rather than just a color. Wraps at narrow
   viewports rather than a fixed column count, since 13 entries (None + 12 curated keys) don't
   divide evenly and a fixed grid risked the same off-screen-panel class of bug already fixed
   once this session for the References popover. */
.folder-illustration-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.folder-illustration-swatch {
    width: 3.25rem;
    height: 3.25rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--tlt-radius-sm);
    border: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-surface);
    color: var(--tlt-palette-white);
    cursor: pointer;
    padding: 0.3rem;
    font-size: 0.65rem;
    line-height: 1.1;
    text-align: center;
    /* The "None" swatch has no background-color style attr and no icon child - it falls back
       to the plain surface color above and shows its own text label instead. */
}

.folder-illustration-swatch--active {
    outline: 2px solid var(--tlt-color-accent);
    outline-offset: 1px;
}

.folder-illustration-swatch-icon {
    width: 100%;
    height: 100%;
}

.folder-cover-image-or {
    margin: 0.6rem 0 0.4rem;
}

/* Grid-tile illustration overlay (Library.razor) - a plain white line drawing sitting behind
   the name/count text so both stay fully legible with no scrim needed, unlike a cover photo.
   z-index: -1 alone would paint it behind the WHOLE PAGE background without
   .folder-grid-tile's isolation: isolate (see that rule's own comment) - with it, -1 only
   drops this below its own tile's in-flow content (the name/count spans), not below sibling
   tiles. Sized to fill most of the tile's lower two-thirds and dimmed to read as a subtle
   motif rather than compete with the folder's own name. pointer-events: none so it never
   intercepts the tile's own click. */
.folder-grid-tile-illustration {
    position: absolute;
    left: 8%;
    right: 8%;
    bottom: 8%;
    height: 62%;
    opacity: 0.5;
    z-index: -1;
    pointer-events: none;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
}

@media (max-width: 60rem) {
    .document-body {
        flex-direction: column;
        overflow-y: auto;
    }

    .document-main {
        overflow-y: visible;
    }

    .document-sidebar {
        width: auto;
        overflow-y: visible;
        border-left: none;
        border-top: 1px solid var(--tlt-color-border);
    }
}

/* Library: kind badges, course name, tab strip */
.doc-kind-badge {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    color: var(--tlt-palette-white);
    background-color: var(--tlt-color-primary);
    white-space: nowrap;
}

/* DocumentDetail's editable version of the badge above - same pill look, but a real
   <select> so a parent can reclassify the document (e.g. Log -> Recipe) in place. Kind
   is a pure classification tag (see DocumentKind's own doc comment), so this never
   touches Blocks/Lessons/Meals - changing it is always safe. */
.doc-kind-select {
    appearance: none;
    -webkit-appearance: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.doc-kind-select:hover,
.doc-kind-select:focus {
    background-color: var(--tlt-color-primary-dark);
    outline: none;
}

.doc-kind-select:disabled {
    opacity: 0.6;
    cursor: default;
}

.doc-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
}

.doc-course-name,
.doc-subject-name {
    color: var(--tlt-color-text-muted);
    font-size: 0.85rem;
}

.tab-strip {
    display: flex;
    gap: 0.25rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--tlt-color-border);
    overflow-x: auto;
}

.tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.5rem 0.9rem;
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

/* "+ New" sits at the far end of the Library tab strip: it is an action, not a fourth listing. */
.tab--new {
    margin-left: auto;
    font-weight: 600;
}

.tab--active {
    color: var(--tlt-color-text);
    border-bottom-color: var(--tlt-color-accent);
    font-weight: 600;
}

/* Library.razor: filter chips, resource card grid */
.filter-chip-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.filter-chip {
    background: none;
    border: 1px solid var(--tlt-color-border);
    border-radius: 999px;
    padding: 0.3rem 0.85rem;
    font-family: var(--tlt-font-body);
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

.filter-chip--active {
    background-color: var(--tlt-color-accent);
    border-color: var(--tlt-color-accent);
    color: var(--tlt-palette-white);
    font-weight: 600;
}

/* Documents.razor: "New document" tile gallery (Create New + Import) */
.document-kind-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.document-kind-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    text-align: left;
    background-color: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 0.85rem 1rem;
    cursor: pointer;
    font-family: var(--tlt-font-body);
    text-decoration: none;
    color: var(--tlt-color-text);
    position: relative;
}

.document-kind-tile:hover {
    border-color: var(--tlt-color-primary);
    color: var(--tlt-color-text);
    text-decoration: none;
}

.document-kind-tile-icon {
    font-size: 1.4rem;
}

.document-kind-tile-label {
    font-weight: 600;
    font-size: 0.95rem;
}

.document-kind-tile-description {
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
}

/* Import row - visually secondary to Create New, matching the mockup's lower emphasis */
.document-kind-tile--import {
    background-color: var(--tlt-color-bg);
}

.document-kind-selected {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.document-kind-selected-icon {
    font-size: 1.6rem;
    line-height: 1;
}

.document-kind-selected-label {
    font-size: 1.15rem;
    font-weight: 600;
    font-family: var(--tlt-font-body);
    color: var(--tlt-color-text);
}

.document-kind-selected .btn-link {
    margin-left: 0.3rem;
    font-size: 0.85rem;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 1rem;
}

.library-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    background-color: var(--tlt-color-surface);
    border-radius: var(--tlt-radius);
    box-shadow: var(--tlt-shadow-sm);
    padding: 0.85rem 1rem;
}

.library-card-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    width: 100%;
    color: inherit;
    text-decoration: none;
}

.library-card-link:hover .library-card-title {
    text-decoration: underline;
}

.library-card-cover {
    width: 100%;
    height: 8rem;
    object-fit: cover;
    border-radius: var(--tlt-radius-sm);
}

.library-card-cover--placeholder {
    background-color: var(--tlt-color-bg);
}

.library-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.library-in-use-pill {
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
    margin: 0;
}

.library-card--add {
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    border: 1px dashed var(--tlt-color-border);
    box-shadow: none;
    cursor: pointer;
    min-height: 10rem;
    font-family: var(--tlt-font-reading);
    font-size: 0.9rem;
    color: var(--tlt-color-text-muted);
}

.library-add-icon {
    font-size: 1.5rem;
}

/* Records.razor: summary stat lines + the app's first real data table */
.records-summary-stat {
    margin: 0.2rem 0;
    font-size: 0.9rem;
    color: var(--tlt-color-text-muted);
}

.records-table-wrapper {
    overflow-x: auto;
    margin-top: 1.5rem;
}

.records-child-cell {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
}

.records-table th {
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--tlt-color-text-muted);
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--tlt-color-border);
    white-space: nowrap;
}

.records-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--tlt-color-border);
    vertical-align: middle;
    white-space: nowrap;
}

.records-table tbody tr:last-child td {
    border-bottom: none;
}

/* Meals.razor: week grid */
.meals-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.75rem;
    margin-top: 1rem;
}

.meals-day-column {
    border: 1px solid var(--tlt-color-border);
    border-radius: 8px;
    padding: 0.6rem;
}

.meals-day-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
    margin-bottom: 0.4rem;
}

.meals-category {
    margin-top: 0.5rem;
}

.meals-category-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
}

/* TodaysMealWidget.razor */
.todays-meal-title {
    font-size: 1.05rem;
    font-weight: 600;
}

/* Today.razor / WeeklyChecklist.razor: flat lesson checklist rows */
.checklist-day-group {
    margin-top: 1rem;
}

.checklist-day-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
    margin-bottom: 0.4rem;
}

.checklist-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--tlt-color-border);
}

.checklist-row-actions {
    display: flex;
    gap: 0.4rem;
    margin-left: auto;
}

/* A Lesson block's own children (checklist items, narration prompts, ...) rendered under its
   calendar checklist-row - see Calendar.razor's LessonDisplayTitle/ChildBlocks usage. */
.checklist-row-children {
    margin: 0 0 0.4rem 1.6rem;
    padding: 0;
    list-style: disc;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

/* Settings.razor - §7's "optional push categories," shown only once push is enabled. */
.push-category-heading {
    margin: 0.75rem 0 0.35rem;
    font-weight: 600;
}

/* Use This Plan: child/weekday checkbox rows */
.checkbox-label {
    font-family: var(--tlt-font-body);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0.75rem 0.5rem 0;
    font-family: var(--tlt-font-reading);
    font-size: 0.95rem;
}

/* A Group row in a "Who" picker (Use This Plan, Assign, Quick Add's New Log) - same
   checkbox row, just visually distinguished from the individual-child rows below it so
   Mom can always tell the two apart. */
.checkbox-label--group {
    font-weight: 600;
}

.checkbox-label--group::before {
    /* The outline "people" icon (OutlineIcon.razor), drawn as a mask so it takes the text colour. */
    content: "";
    display: inline-block;
    width: 1em;
    height: 1em;
    margin-right: 0.35em;
    vertical-align: -0.15em;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8.5' r='3'/%3E%3Cpath d='M3 19c0-3.5 2.5-5.5 6-5.5s6 2 6 5.5'/%3E%3Ccircle cx='17' cy='9.5' r='2.4'/%3E%3Cpath d='M16.5 14c3 0 4.5 1.8 4.5 4.5'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8.5' r='3'/%3E%3Cpath d='M3 19c0-3.5 2.5-5.5 6-5.5s6 2 6 5.5'/%3E%3Ccircle cx='17' cy='9.5' r='2.4'/%3E%3Cpath d='M16.5 14c3 0 4.5 1.8 4.5 4.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Use This Plan: Current Schedule - one row per SchedulePattern */
.schedule-pattern-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--tlt-color-border);
}

.schedule-pattern-badge {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--tlt-color-text-muted);
    background-color: var(--tlt-color-bg);
    border: 1px solid var(--tlt-color-border);
    border-radius: 999px;
    padding: 0.1rem 0.6rem;
}

/* Library resource card - same row, shrunk to fit a narrow card, no divider line since it
   sits directly above the Assign button rather than in a list of its own peers. */
.schedule-pattern-row--compact {
    padding: 0.3rem 0;
    border-bottom: none;
    font-size: 0.85rem;
}

/* Today view: lesson list */
.lesson-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.lesson-card {
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 1rem 1.25rem;
}

.lesson-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.lesson-title {
    font-family: var(--tlt-font-reading);
    font-size: 1.1rem;
    font-weight: 600;
}

.lesson-status {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    color: var(--tlt-palette-white);
    white-space: nowrap;
}

.lesson-status--scheduled { background-color: var(--tlt-color-status-scheduled); }
.lesson-status--continues { background-color: var(--tlt-color-status-continues); }
.lesson-status--complete { background-color: var(--tlt-color-status-complete); }
.lesson-status--skipped { background-color: var(--tlt-color-status-skipped); }
.lesson-status--rescheduled { background-color: var(--tlt-color-status-rescheduled); }

/* "Need Help" once flagged - same calm accent tone as .lesson-status--continues, not an
   alarming red, matching this app's own "calm by default" status-color philosophy. */
.lesson-help-active {
    background-color: var(--tlt-color-status-continues);
    border-color: var(--tlt-color-status-continues);
    color: var(--tlt-palette-white);
}

/* Duration/involvement - both optional per Lesson (see Lesson.DurationMinutes' own doc
   comment), so these render only when set, next to lesson-status/kanban-card-child. */
.lesson-duration-badge, .lesson-involvement-badge {
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
    white-space: nowrap;
}

.lesson-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.lesson-narration-count {
    margin-top: 0.75rem;
    color: var(--tlt-color-text-muted);
    font-size: 0.9rem;
}

.narration-toggle {
    font-family: var(--tlt-font-body);
    margin-top: 0.75rem;
    background: none;
    border: none;
    padding: 0;
    color: var(--tlt-color-link);
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
}

.narration-form {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.narration-form textarea {
    font-family: var(--tlt-font-reading);
    font-size: 1rem;
    padding: 0.6rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 4px;
    min-height: 5rem;
    resize: vertical;
}

.narration-form-actions {
    display: flex;
    gap: 0.5rem;
}

.auth-error {
    background-color: #fbeaea;
    border: 1px solid #e50000;
    color: #a00000;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.auth-success {
    background-color: #eaf7ed;
    border: 1px solid #2c9c4a;
    color: #1e6b34;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.auth-switch {
    margin-top: 1.5rem;
    color: var(--tlt-color-text-muted);
}

/* Logout button rendered as a nav-link-styled form button - visual sizing/padding
   comes from AppHeader.razor.css's ::deep .logout-link; this just strips button chrome. */
.logout-link {
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
}

/* Per-child switch button rendered inside AppHeader's dropdown panel (ChildSwitchButton.razor) */
.child-switch-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: none;
    border: none;
    border-radius: var(--tlt-radius-sm);
    padding: 0.5rem 0.6rem;
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
    color: var(--tlt-color-text);
    text-align: left;
    cursor: pointer;
}

.child-switch-btn:hover {
    background-color: var(--tlt-color-bg);
}

/* Avatar dropdown (AppHeader.razor's .user-menu-panel) - global, not AppHeader.razor.css,
   since .user-menu-item is applied to a NavLink's rendered <a> (Settings row) as well as
   plain <button>s (parent-list rows in child view); a NavLink's own markup never carries
   AppHeader's CSS-isolation scope attribute, so a scoped rule here would silently never
   match it (see the notification-bell badge fix for the same gotcha). Global CSS has no
   scoping to fight, so it's the simplest correct choice for a mixed component/plain-element
   selector like this one. */
.user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    background-color: var(--tlt-color-accent);
    color: var(--tlt-palette-white);
    font-family: var(--tlt-font-body);
    font-size: 0.8rem;
    font-weight: 600;
}

/* TltAvatar.razor's photo/generated tiers - layered on top of whichever sizing class
   (user-avatar, at-a-glance-avatar, ...) the caller passes as CssClass. */
.tlt-avatar-photo {
    object-fit: cover;
}

.tlt-avatar-generated {
    overflow: hidden;
}

.tlt-avatar-generated svg {
    display: block;
    width: 100%;
    height: 100%;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    background: none;
    border: none;
    border-radius: var(--tlt-radius-sm);
    padding: 0.5rem 0.6rem;
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
    color: var(--tlt-color-text);
    text-decoration: none;
    text-align: left;
    cursor: pointer;
}

.user-menu-item:hover {
    background-color: var(--tlt-color-bg);
}

.user-menu-divider {
    border: none;
    border-top: 1px solid var(--tlt-color-border);
    margin: 0.4rem 0;
}

.user-menu-heading {
    font-family: var(--tlt-font-body);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--tlt-color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.4rem 0.6rem 0.1rem;
}

/* Calendar: week grid */
.calendar-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.calendar-range {
    font-family: var(--tlt-font-reading);
    color: var(--tlt-color-text-muted);
}

.calendar-filter {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.calendar-child-toggle {
    display: inline-flex;
    align-items: center;
    border: 2px solid var(--child-color, var(--tlt-color-border));
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    background-color: var(--tlt-color-surface);
    color: var(--child-color, var(--tlt-color-text));
    font-family: var(--tlt-font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    opacity: 0.55;
    transition: background-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.calendar-child-toggle:hover {
    opacity: 0.85;
}

.calendar-child-toggle--active {
    background-color: var(--child-color);
    color: var(--tlt-palette-white);
    opacity: 1;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.calendar-day-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.25rem 0;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.calendar-day-header span:last-child {
    font-weight: 600;
    font-size: 1rem;
    color: var(--tlt-color-text);
}

.calendar-day-header--today span:last-child {
    color: var(--tlt-color-accent);
}

.calendar-day-cell {
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 0.5rem;
    min-height: 6rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.calendar-day-cell--today {
    border-color: var(--tlt-color-accent);
}

.calendar-lesson-chip {
    border: 1px solid var(--tlt-color-border);
    border-left: 3px solid var(--tlt-color-accent);
    border-radius: var(--tlt-radius-sm);
    padding: 0.35rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    cursor: grab;
}

.calendar-lesson-chip[draggable="false"] {
    cursor: default;
    opacity: 0.75;
}

.calendar-lesson-chip:hover {
    background-color: var(--tlt-color-bg);
}

.calendar-lesson-chip .lesson-title {
    font-size: 0.9rem;
}

.calendar-lesson-chip .lesson-status {
    align-self: flex-start;
    font-size: 0.7rem;
}

/* Kanban: subject-row x day-column board (Kanban.razor) */
.kanban-board {
    overflow-x: auto;
}

.kanban-row {
    display: grid;
    grid-template-columns: minmax(9rem, 12rem) repeat(6, minmax(9rem, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.kanban-row--header {
    position: sticky;
    top: 0;
    background-color: var(--tlt-color-surface);
    z-index: 1;
}

.kanban-row-label {
    display: flex;
    align-items: center;
    font-family: var(--tlt-font-reading);
    font-weight: 600;
    color: var(--tlt-color-text);
    padding: 0.25rem 0;
}

.kanban-column-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.25rem 0;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.kanban-column-header span:last-child {
    font-weight: 600;
    font-size: 1rem;
    color: var(--tlt-color-text);
}

.kanban-column-header--today span:last-child {
    color: var(--tlt-color-accent);
}

.kanban-cell {
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 0.5rem;
    min-height: 5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.kanban-cell--today {
    border-color: var(--tlt-color-accent);
}

.kanban-card {
    border: 1px solid var(--tlt-color-border);
    border-left: 3px solid var(--tlt-color-accent);
    border-radius: var(--tlt-radius-sm);
    padding: 0.35rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    cursor: grab;
}

.kanban-card[draggable="false"] {
    cursor: default;
    opacity: 0.75;
}

.kanban-card:hover {
    background-color: var(--tlt-color-bg);
}

.kanban-card-child {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--tlt-color-text-muted);
}

.kanban-card .lesson-title {
    font-size: 0.9rem;
}

.kanban-card .lesson-status {
    align-self: flex-start;
    font-size: 0.7rem;
}

/* Term Grid: book/document-row x week-of-term board (TermGrid.razor) - same label-column +
   N-data-columns shape as Kanban above, but the column count is dynamic (a 10/12-week term),
   so grid-template-columns is supplied inline per-render rather than Kanban's hardcoded 6. */
.term-grid-board {
    overflow-x: auto;
}

.term-grid-row {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.term-grid-row--header {
    position: sticky;
    top: 0;
    background-color: var(--tlt-color-surface);
    z-index: 1;
}

.term-grid-row-label {
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-family: var(--tlt-font-reading);
    font-weight: 600;
    color: var(--tlt-color-text);
    padding: 0.25rem 0;
}

.term-grid-row-subject {
    font-family: var(--tlt-font-body);
    font-weight: 400;
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
}

.term-grid-column-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.25rem 0;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.term-grid-column-header span:last-child {
    font-weight: 600;
    font-size: 1rem;
    color: var(--tlt-color-text);
}

.term-grid-cell {
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 0.4rem;
    min-height: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    text-align: center;
    font-size: 0.85rem;
}

.term-grid-cell--clickable {
    cursor: pointer;
}

.term-grid-cell--clickable:hover {
    background-color: var(--tlt-color-bg);
    border-color: var(--tlt-color-accent);
}

/* This Term/Whole Year toggle (TermGrid.razor) - same bare-row shape as Calendar's own
   .calendar-view-switcher (no dedicated styling there either; the btn-primary/btn-secondary
   classes on the buttons carry all the visual weight). */
.term-grid-view-switcher {
    margin-bottom: 0.75rem;
}

/* Whole Year mode's per-Term section heading, between one Term's board and the next. */
.term-grid-year-heading {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Notes/comments thread (NotesThread.razor) */
.notes-thread {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.notes-thread .notes-thread {
    margin-left: 1rem;
    margin-top: 0.5rem;
    padding-left: 0.75rem;
    border-left: 2px solid var(--tlt-color-border);
}

.note-item {
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 0.6rem 0.85rem;
}

.note-item--highlighted {
    background-color: var(--tlt-color-bg);
    border-color: var(--tlt-color-primary);
}

.note-item-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.note-author {
    font-weight: 600;
}

.note-timestamp {
    color: var(--tlt-color-text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.note-content {
    margin: 0.35rem 0 0;
    font-family: var(--tlt-font-reading);
}

.note-edited-marker {
    margin-left: 0.35rem;
    font-style: italic;
}

.note-image {
    display: block;
    max-width: 100%;
    max-height: 20rem;
    margin-top: 0.5rem;
    border-radius: var(--tlt-radius-sm);
}

.note-mention {
    color: var(--tlt-color-primary);
    font-weight: 600;
}

.note-item-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.35rem;
}

.note-action-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--tlt-color-text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: underline;
}

/* Tap-to-react bar (NoteReactionBar.razor) - a row of emoji+count pills, plus a "+" that
   opens EmojiPicker for a fresh reaction. Reactions are a lighter-weight loop than notes
   themselves (no notification, no thread nesting), so they read as pills, not note-items. */
.note-reaction-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    position: relative;
}

.note-reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 999px;
    background-color: var(--tlt-color-surface);
    padding: 0.1rem 0.5rem;
    font-size: 0.8rem;
    cursor: pointer;
}

.note-reaction-pill--mine {
    border-color: var(--tlt-color-primary);
    background-color: var(--tlt-color-bg);
}

.note-reaction-count {
    color: var(--tlt-color-text-muted);
    font-size: 0.75rem;
}

.note-reaction-add {
    border: 1px dashed var(--tlt-color-border);
    border-radius: 999px;
    background: none;
    width: 1.6rem;
    height: 1.6rem;
    line-height: 1;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

/* Emoji picker popover (EmojiPicker.razor) - a plain fixed backdrop + positioned panel, no
   JS interop for outside-click detection (see the Notes/Comments upgrade plan). */
.emoji-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 110;
}

.emoji-picker-popover {
    position: absolute;
    bottom: 100%;
    left: 0;
    z-index: 111;
    margin-bottom: 0.25rem;
    background-color: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    box-shadow: var(--tlt-shadow-sm);
    padding: 0.5rem;
    width: 15rem;
}

.emoji-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.15rem;
    max-height: 12rem;
    overflow-y: auto;
}

.emoji-picker-item {
    font-family: var(--tlt-font-body);
    background: none;
    border: none;
    font-size: 1.1rem;
    line-height: 1.6rem;
    cursor: pointer;
    border-radius: var(--tlt-radius-sm);
}

.emoji-picker-item:hover {
    background-color: var(--tlt-color-bg);
}

/* Shown above the one shared composer when a "Reply" link anywhere in the thread (at any
   nesting depth) has set a reply target - see NotesThread's root-only composer. */
.note-reply-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    padding: 0.35rem 0.6rem;
    background-color: var(--tlt-color-bg);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    font-size: 0.8rem;
}

/* Sidebar mirror of a block's thread (ShowComposer=false) - no composer, just a link back to
   the block's popup editor where composing actually happens. */
.note-open-editor-link {
    background: none;
    border: none;
    padding: 0;
    margin-top: 0.75rem;
    color: var(--tlt-color-link);
    cursor: pointer;
    font-size: 0.85rem;
}

/* Wraps the one composer a root NotesThread renders (plus the reply banner, when replying to
   a specific note) - the anchoring/sticky behavior lives on this wrapper, not the composer
   itself, so the banner and composer stick to the pane's bottom together as one unit. */
.note-composer-area {
    margin-top: 0.75rem;
}

.note-composer-area--anchored {
    /* A genuine non-scrolling flex sibling of .notes-thread-scroll (see NotesThread.razor's
       IsAnchored wrapper), not position:sticky - sticky still let scrolled-up content paint
       BEHIND the composer since it never reserved space for it. flex-shrink:0 keeps this
       footer's own height fixed while .notes-thread-scroll absorbs the rest via flex:1. */
    flex-shrink: 0;
    margin-top: 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-surface);
}

/* DM-style composer (NoteComposer.razor) - shared by the document-level anchored thread and
   every block/highlight/reply thread alike. */
.note-composer {
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 0.6rem 0.75rem;
}

.note-composer-image-preview {
    position: relative;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.note-composer-image-preview img {
    max-width: 8rem;
    max-height: 8rem;
    border-radius: var(--tlt-radius-sm);
    display: block;
}

.note-composer-image-preview .close-icon-button {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    background-color: var(--tlt-color-surface);
    border-radius: 999px;
    border: 1px solid var(--tlt-color-border);
}

/* Single-row "message input" layout (Steve: "more like a standard message input") - icons and
   the send button sit INLINE with the growing textarea, all bottom-aligned so they stay put
   at the input's own baseline while the textarea grows upward above them, matching the iMessage/
   WhatsApp/Slack convention this was modeled on. */
.note-composer-input-row {
    display: flex;
    align-items: flex-end;
    gap: 0.4rem;
}

.note-composer-tool-anchor {
    position: relative;
    flex-shrink: 0;
}

/* The CSS-only "grow-wrap" trick (Chris Coyier's, no JS/measuring needed): both the real
   textarea and an invisible ::after occupy the SAME CSS grid cell, so the ::after - which
   mirrors the textarea's own text via data-replicated-value - sets the row's height from
   the browser's own real line-wrap measurement, and the textarea (height: auto via the grid
   sizing, not its own rows count) stretches to match. Starts at exactly one line (textarea's
   own rows="1" default) and grows from there as text wraps to more lines - capped by
   max-height below so a huge paste scrolls internally instead of taking over the page. */
.note-composer-grow-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
    display: grid;
    max-height: 10rem;
    overflow-y: auto;
    border-radius: var(--tlt-radius-sm);
}

.note-composer-grow-wrap::after {
    content: attr(data-replicated-value) " ";
    white-space: pre-wrap;
    visibility: hidden;
}

.note-composer-grow-wrap > .note-composer-textarea,
.note-composer-grow-wrap::after {
    grid-area: 1 / 1 / 2 / 2;
    font-family: var(--tlt-font-reading);
    font-size: inherit;
    line-height: 1.4;
    padding: 0.4rem 0;
    word-break: break-word;
}

.note-composer-textarea {
    width: 100%;
    resize: none;
    overflow: hidden;
    border: none;
}

.note-composer-textarea:focus {
    outline: none;
}

.note-composer-mention-list {
    position: absolute;
    left: 0;
    bottom: 100%;
    z-index: 111;
    list-style: none;
    margin: 0 0 0.25rem;
    padding: 0.25rem;
    background-color: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    box-shadow: var(--tlt-shadow-sm);
    max-height: 10rem;
    overflow-y: auto;
    min-width: 10rem;
}

.note-composer-mention-list button {
    font-family: var(--tlt-font-body);
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.3rem 0.5rem;
    cursor: pointer;
    border-radius: var(--tlt-radius-sm);
}

.note-composer-mention-list button:hover {
    background-color: var(--tlt-color-bg);
}

/* Flattened outline icons (EmojiIcon/CameraIcon), not colored emoji glyphs - matches the
   line-icon direction the app's chrome is moving to elsewhere (HomeIcon/PencilIcon/etc.). */
.note-composer-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    color: var(--tlt-color-text-muted);
    flex-shrink: 0;
}

.note-composer-tool-btn:hover {
    color: var(--tlt-color-text);
}

.note-composer-image-btn {
    position: relative;
    overflow: hidden;
}

.note-composer-image-btn input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Uploading/error status + the Cancel button (edit mode) moved OUT of the main input row -
   secondary, lower-priority information that would otherwise force the row taller even when
   the composer should read as a single compact line. Only rendered at all when one of these
   three is actually true. */
.note-composer-status-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.4rem;
}

.note-composer-uploading {
    font-size: 0.75rem;
}

/* Round icon-only send button (DM-style) instead of a text "Post"/"Reply"/"Save" button -
   the SVG uses fill="currentColor" rather than an emoji glyph, since emoji ignore the
   button's own color and would stay black-and-white regardless of this background. */
.note-composer-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background-color: var(--tlt-color-primary);
    color: var(--tlt-palette-white);
    cursor: pointer;
    flex-shrink: 0;
    margin-bottom: 0.15rem;
}

.note-composer-send-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.note-thread-modal {
    max-width: 34rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 4rem);
    /* .modal-content's own overflow-y:auto would otherwise let THIS element scroll as a whole -
       .notes-thread-scroll below is the only region that should scroll, same split as
       .document-sidebar/.document-sidebar-scroll. */
    overflow-y: hidden;
}

/* The scrollable region inside an IsAnchored NotesThread (block-comment popup only) - a plain
   sibling of .note-composer-area--anchored below it, not an ancestor, so the composer sits
   genuinely outside the scroll area instead of relying on position:sticky (which still let
   content scroll up from underneath and paint behind the composer - see NotesThread.razor). */
.notes-thread-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

/* HabitNotesModal - "log a completion, optionally with a note" plus the scrollable notes
   history below it. Same shell/sizing idiom as .note-thread-modal. */
.habit-notes-modal {
    max-width: 30rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 4rem);
}

.habit-note-textarea {
    width: 100%;
    min-height: 4.5rem;
    resize: vertical;
    font: inherit;
    color: inherit;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-bg);
    margin-bottom: 0.5rem;
}

.habit-logged-today {
    margin-bottom: 0.5rem;
}

.habit-logged-today-note {
    font-style: italic;
    margin: 0.2rem 0 0.5rem;
}

.habit-notes-history-heading {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.95rem;
}

.habit-notes-history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1 1 auto;
}

.habit-notes-history-item {
    border-top: 1px solid var(--tlt-color-border);
    padding: 0.5rem 0;
}

.habit-notes-history-item:first-child {
    border-top: none;
}

.habit-notes-history-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.habit-notes-history-note {
    margin: 0.25rem 0 0;
    overflow-wrap: break-word;
}

/* Narration items (Dashboard.razor lesson cards, NarrationNotebook.razor) */
.narration-item {
    border: 1px solid var(--tlt-color-border);
    border-left: 3px solid var(--tlt-color-accent);
    border-radius: var(--tlt-radius-sm);
    padding: 0.6rem 0.85rem;
    margin: 0.5rem 0;
}

.narration-item-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
}

.narration-badge {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background-color: var(--tlt-color-accent);
    color: var(--tlt-palette-white);
}

.narration-about {
    display: block;
    color: var(--tlt-color-text-muted);
    font-size: 0.85rem;
    margin: 0.15rem 0;
}

.narration-notebook-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.pdf-chapter-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pdf-chapter-item {
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 0.85rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.pdf-chapter-title {
    font-weight: 600;
    font-family: var(--tlt-font-reading);
}

.pdf-chapter-pages {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.pdf-chapter-title-input {
    font-family: var(--tlt-font-body);
    flex: 1 1 12rem;
}

.pdf-chapter-page-input {
    font-family: var(--tlt-font-body);
    width: 6rem;
}

.pdf-chapter-split-form {
    flex-basis: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.pdf-chapter-add-marker {
    border: 1px dashed var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 0.85rem 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.pdf-chapter-add-marker h2 {
    flex-basis: 100%;
    font-size: 1rem;
    margin: 0 0 0.25rem;
}

.pdf-reader-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pdf-reader-page-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.pdf-chapter-select {
    max-width: 100%;
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    font-family: var(--tlt-font-body);
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
}





.pdf-reader-highlight-hint {
    text-align: center;
    margin: 0;
}

.pdf-reader-canvas-container {
    position: relative;
    max-width: 100%;
    max-height: 75vh;
    overflow: auto;
    margin: 0 auto;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
}

/* One per PDF page, stacked continuously inside .pdf-reader-canvas-container (the actual scroll
   root) - sized up front to that page's real viewport dimensions so the scrollbar/scroll thumb
   is correct even before a page's canvas/text-layer/highlight-layer/marker-layer are lazily
   rendered. Becomes the positioned ancestor for those layers' position:absolute;inset:0, a role
   the container itself held back when it only ever rendered one page at a time. */
.pdf-page-wrapper {
    position: relative;
    margin: 0 auto 1rem;
}

.pdf-highlighter-canvas {
    display: block;
}

/* pdf.js's own selectable-text-layer CSS (flattened from its vendored stylesheet, not
   nested, to match this file's plain-CSS style) - text is real and selectable but rendered
   fully transparent, sitting exactly over the canvas's own painted glyphs. */
.textLayer {
    position: absolute;
    inset: 0;
    text-align: initial;
    overflow: clip;
    opacity: 1;
    line-height: 1;
    text-size-adjust: none;
    forced-color-adjust: none;
    transform-origin: 0 0;
    z-index: 1;
}

.textLayer span, .textLayer br {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
    user-select: text;
}

.pdf-highlight-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.pdf-highlight-mark {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    opacity: 0.4;
    mix-blend-mode: multiply;
}

.pdf-highlight-yellow { background-color: #ffe066; }
.pdf-highlight-green { background-color: #8ce99a; }
.pdf-highlight-blue { background-color: #a5d8ff; }
.pdf-highlight-pink { background-color: #fcc2d7; }




/* Fixed, not in normal document flow: the canvas container scrolls internally (a PDF page
   is usually taller than the visible viewport), so a selection made deep in that internal
   scroll would leave a normal-flow swatch row positioned below the canvas container
   rendered off-screen, with no indication it exists - this pins it to the viewport instead,
   visible regardless of either the outer page's or the canvas's own scroll position. */
.pdf-highlight-swatch-row {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.pdf-highlight-swatch {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    border: 1px solid var(--tlt-color-border);
    cursor: pointer;
    padding: 0;
}

/* Same fixed-overlay reasoning as .pdf-highlight-swatch-row above - a highlight can be
   clicked deep in the canvas's own internal scroll, so this must stay viewport-anchored
   rather than rendering in normal document flow below the (tall) canvas container. */
.pdf-highlight-notes-popover {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    z-index: 100;
    width: 22rem;
    max-width: calc(100vw - 3rem);
    max-height: 70vh;
    overflow-y: auto;
    padding: 1rem;
    background: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.pdf-highlight-notes-popover-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.pdf-highlight-notes-popover-header h2 {
    margin: 0;
}

.pdf-reader-progress {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.pdf-reader-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.pdf-reader-search-results {
    flex-basis: 100%;
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.pdf-reader-search-results li .btn-link {
    text-align: left;
}

.contribute-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background-color: var(--tlt-color-bg);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.contribute-banner .auth-success,
.contribute-banner .auth-error {
    margin-bottom: 0;
    width: 100%;
}

.pdf-reader-physical-instruction {
    font-weight: 600;
}
/* DocumentDetail.razor's "⋯" More panel - Duplicate / Archive / Delete, stacked. */
.document-more-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-restore-btn {
    font-size: 0.8rem;
    margin-top: 0.15rem;
}

/* Inline comments (editor-src/customColorStyles.ts tltComment + commentAnchor.ts): a commented
   phrase is highlighted; resolved ones are dimmed by an injected stylesheet keyed on data-note-id. */
.tlt-comment-anchor {
    background-color: color-mix(in srgb, var(--tlt-color-accent, #d9a441) 28%, transparent);
    border-bottom: 2px solid var(--tlt-color-accent, #d9a441);
    cursor: pointer;
}


/* Inline comments in NotesThread: the quoted phrase, and resolved-thread styling. */
.note-quoted-text {
    margin: 0.25rem 0;
    padding: 0.15rem 0.6rem;
    border-left: 3px solid var(--tlt-color-accent, #d9a441);
    color: var(--tlt-color-text-muted);
    font-size: 0.85rem;
}

.note-item--resolved {
    opacity: 0.65;
}

.note-resolved-marker {
    margin: 0.1rem 0;
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
}

/* Print / Save as PDF (DocumentDetail's Export group). The document page normally locks the app
   shell to the viewport and scrolls inside .document-main, which would print only the first
   screenful - so on paper every wrapper is un-locked and the app chrome is hidden. */
.print-comments {
    display: none;
}

@media print {
    html, body {
        height: auto !important;
        overflow: visible !important;
        background: #fff !important;
    }

    .app-shell, .app-main, .app-content, .document-shell, .document-body, .document-main {
        display: block !important;
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
        position: static !important;
    }

    .app-header, .home-drawer, .home-rail, .top-nav, .trail, .document-toolbar, .document-outline-dock, .document-sidebar,
    .tab-strip, .toolbar-panel, .tlt-editor-toolbar, .bn-side-menu, .tlt-comment-badge,
    .note-thread-modal, .modal-backdrop, .circuit-error-notice, #blazor-error-ui,
    .quick-add-trigger, .document-find-bar {
        display: none !important;
    }

    .bn-block-content[data-content-type="codeBlock"], .bn-block-content[data-content-type="codeBlock"] * {
        background: #f3f1ee !important;
        color: #000 !important;
    }

    .bn-container, .bn-editor, .tlt-document-editor {
        color: #000 !important;
        background: #fff !important;
        box-shadow: none !important;
        border: 0 !important;
    }

    .tlt-find-match, .tlt-find-match--current {
        background-color: transparent !important;
        outline: 0 !important;
    }

    .tlt-comment-anchor {
        background-color: transparent !important;
        border-bottom: 0 !important;
    }

    h1, h2, h3, .bn-block-content[data-content-type="heading"] {
        break-after: avoid;
    }

    table, tr, .print-comment {
        break-inside: avoid;
    }

    .print-comments {
        display: block;
        margin-top: 2rem;
        padding-top: 1rem;
        border-top: 1px solid #999;
        color: #000;
    }

    .print-comment { margin-bottom: 1rem; }
    .print-comment blockquote { border-left: 3px solid #d9b100; margin: 0 0 0.3rem; padding-left: 0.7rem; color: #444; }
    .print-comment-reply { margin-left: 1.5rem; }
}

.document-export {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border, #ddd);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.document-export h3 { margin: 0; font-size: 0.95rem; }

/* Find-in-document (editor-src/findExtension.ts decorations + DocumentDetail's find bar). */
.tlt-find-match {
    background-color: #ffe9a8;
    border-radius: 2px;
}

.tlt-find-match--current {
    background-color: #ffb84d;
    outline: 1px solid #d98a00;
}

.document-find-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-bottom: 1px solid var(--border, #ddd);
    background: var(--surface, #fff);
}

.document-find-input {
    flex: 1;
    min-width: 8rem;
    max-width: 24rem;
}

.document-find-count {
    min-width: 5rem;
    font-size: 0.85rem;
    color: var(--text-muted, #666);
}

/* Second row that drops in below .document-find-bar when the replace toggle is on - same
   look, just without its own top border so the two read as one joined bar. */
.document-replace-bar {
    border-top: none;
}

.document-find-replace-toggle--open {
    background-color: var(--tlt-color-bg);
}

.search-result-snippet {
    margin-top: 0.15rem;
    font-size: 0.9rem;
    color: var(--text-muted, #666);
}

.search-result-snippet mark {
    background-color: #ffe9a8;
    color: inherit;
}

/* @mention chip in a document body (editor-src/mentionInlineContent.tsx). */
.tlt-mention {
    background-color: #e3ecf7;
    color: #1f4a7a;
    border-radius: 3px;
    padding: 0 0.2em;
    font-weight: 500;
}

/* @date chip in a document body (editor-src/dateReference/dateReferenceInlineContent.tsx) -
   the wrapper is a plain inline span so the popover below can anchor to it; the chip itself
   gets the mention-style tinted-pill treatment, same visual language as .tlt-mention. */
.tlt-date-ref-wrap {
    position: relative;
    display: inline-block;
}

.tlt-date-ref {
    display: inline-flex;
    align-items: center;
    gap: 0.25em;
    background-color: #fdeedb;
    color: #8a5a1f;
    border-radius: 3px;
    padding: 0 0.4em;
    font-weight: 500;
    cursor: pointer;
}

/* Floating, not inline like .tlt-live-settings - this chip sits mid-sentence, so its settings
   panel can't push surrounding text around the way a block-level live-app's can. */
.tlt-date-ref-popover {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 30;
    display: grid;
    gap: 0.5rem;
    margin-top: 0.3rem;
    padding: 0.75rem;
    min-width: 14rem;
    background-color: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    box-shadow: var(--tlt-shadow-sm);
    font-family: var(--tlt-font-body);
    font-weight: 400;
    white-space: normal;
}

.tlt-date-ref-field {
    display: grid;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--tlt-color-text-muted);
}

.tlt-date-ref-field input,
.tlt-date-ref-field select {
    font: inherit;
    font-weight: 400;
    color: var(--tlt-color-text);
    background-color: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: 0.5rem;
    padding: 0.4rem 0.6rem;
}

.tlt-date-ref-done {
    justify-self: start;
    border: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-bg);
    color: var(--tlt-color-text);
    border-radius: 0.5rem;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    font-family: var(--tlt-font-body);
}

/* Calendar day-cell chip for a @date reference (Calendar.razor), alongside .calendar-lesson-chip
   but visually distinct - not a Lesson, no status/duration, just title + who inserted it. */
.calendar-date-reference-chip {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.5rem;
    border-radius: var(--tlt-radius-sm);
    background-color: #fdeedb;
    color: #8a5a1f;
    font-size: 0.85rem;
    cursor: pointer;
}

.calendar-date-reference-by {
    color: inherit;
    opacity: 0.75;
    font-size: 0.78rem;
}

/* Callout block (editor-src/calloutBlock.tsx): a tinted box with a variant icon. */
.tlt-callout {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    width: 100%;
    padding: 0.7rem 0.9rem;
    border-radius: 6px;
    border-left: 4px solid var(--callout-accent);
    background: var(--callout-bg);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.tlt-callout--info    { --callout-accent: #3b82c4; --callout-bg: #e8f1fb; }
.tlt-callout--tip     { --callout-accent: #2f9e6b; --callout-bg: #e6f6ee; }
.tlt-callout--warning { --callout-accent: #d9930d; --callout-bg: #fdf3dc; }
.tlt-callout--danger  { --callout-accent: #d1453b; --callout-bg: #fbe8e6; }

.tlt-callout-icon {
    flex: none;
    border: 0;
    background: none;
    padding: 0;
    font-size: 1.1rem;
    line-height: 1.5;
    cursor: pointer;
}

.tlt-callout-body {
    flex: 1;
    min-width: 0;
}

/* Columns (editor-src/columnsBlock.tsx): a `columns` block's child group becomes a row of columns.
   auto-fit + minmax stacks the columns on its own when the editor pane is narrow (no media query,
   since the pane is often narrower than the viewport with the comments sidebar open). BlockNote
   indents every nested group, so that indent is cancelled for both container blocks. React-rendered
   custom blocks sit inside an extra .react-renderer wrapper, hence the selector shape. */
.bn-block:has(> .react-renderer > .bn-block-content[data-content-type="columns"]) > .bn-block-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 1rem;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

.bn-block:has(> .react-renderer > .bn-block-content[data-content-type="column"]) > .bn-block-group {
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* BlockNote draws a block's side menu (the "+" and drag handle, ~48px wide) just to the LEFT of the
   block, and works out which block the mouse is over from the mouse position. For columns 2..N that
   spot was over the previous column, so moving the mouse onto the menu re-targeted a block in
   another column and the menu jumped away. Giving those columns their own left gutter puts the menu
   inside the column it belongs to. (The first column's menu sits in the editor's normal left margin.) */
.bn-block-outer:not(:first-child) > .bn-block:has(> .react-renderer > .bn-block-content[data-content-type="column"]) > .bn-block-group {
    padding-left: 3.25rem !important;
}

.tlt-columns-marker {
    height: 0;
}

.tlt-column-marker {
    height: 0.4rem;
    border-top: 2px dashed var(--border, #d4cfc6);
    border-radius: 2px;
}

/* Transclusion / embedded document (editor-src/transclusionBlock.tsx). */
.tlt-embed {
    width: 100%;
    border: 1px solid var(--border, #d4cfc6);
    border-left: 4px solid #7a8fa8;
    border-radius: 6px;
    background: rgba(122, 143, 168, 0.06);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}

.tlt-embed-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted, #666);
    border-bottom: 1px solid var(--border, #e3dfd6);
}

.tlt-embed-header a { flex: 1; color: inherit; text-decoration: none; font-weight: 500; }
.tlt-embed-header a:hover { text-decoration: underline; }

.tlt-embed-refresh {
    border: 0;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    color: inherit;
}

.tlt-embed-content { padding: 0.25rem 0.5rem; }

/* The nested read-only editor: no editor chrome of its own inside the embed. */
.tlt-embed-content .bn-container,
.tlt-embed-content .bn-editor { background: transparent; padding-inline: 0; }

.tlt-embed-empty { padding: 0.6rem 0.75rem; color: var(--text-muted, #777); font-size: 0.9rem; }

.tlt-embed--picker { padding: 0.6rem 0.75rem; }
.tlt-embed-search { width: 100%; padding: 0.4rem 0.6rem; box-sizing: border-box; }
.tlt-embed-picked { font-weight: 600; margin-bottom: 0.4rem; }
.tlt-embed-list { list-style: none; margin: 0.4rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.tlt-embed-list button { width: 100%; text-align: left; border: 0; background: none; padding: 0.3rem 0.4rem; border-radius: 4px; cursor: pointer; font: inherit; }
.tlt-embed-list button:hover { background: rgba(122, 143, 168, 0.15); }
.tlt-embed-subhead { font-size: 0.8rem; color: var(--text-muted, #777); padding: 0.4rem 0.4rem 0.1rem; }
.tlt-embed--stub { padding: 0.4rem 0.75rem; }

/* An embed is read-only: the code block's language dropdown would just be noise there. */
.tlt-embed-content select { display: none; }

/* Settings (Components/Pages/Settings.razor): a category list on the left and ONE category's settings on
   the right, instead of a long stack of cards. Each category is its own URL (/settings/family). On a wide
   screen both show; on a phone /settings is the list screen and a category is a drill-in with a Back link. */
.settings-layout {
    display: grid;
    grid-template-columns: 14rem minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
}

.settings-title {
    margin: 0 0 0.75rem;
    font-size: 1.6rem;
}

.settings-nav {
    position: sticky;
    top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.settings-nav-item {
    display: block;
    padding: 0.55rem 0.85rem;
    border-radius: var(--tlt-radius-sm, 6px);
    border-left: 3px solid transparent;
    color: var(--tlt-color-text);
    text-decoration: none;
}

.settings-nav-item:hover {
    background-color: color-mix(in srgb, var(--tlt-color-primary) 10%, transparent);
}

.settings-nav-item--active {
    border-left-color: var(--tlt-color-accent);
    background-color: color-mix(in srgb, var(--tlt-color-primary) 14%, transparent);
    font-weight: 600;
}

.settings-pane {
    min-width: 0;
    background-color: var(--tlt-color-surface);
    border-radius: var(--tlt-radius);
    box-shadow: var(--tlt-shadow-sm);
    padding: 1.5rem 2rem 2rem;
}

.settings-pane-title {
    margin: 0 0 0.25rem;
    font-size: 1.35rem;
}

.settings-back {
    display: none;
}

/* Sections inside a pane are separated by a rule and whitespace - not cards inside the pane's card. */
.settings-section {
    padding: 1.25rem 0;
    border-top: 1px solid var(--tlt-color-border);
}

.settings-section:first-of-type {
    border-top: 0;
}

.settings-section > h2 {
    font-size: 1.1rem;
    margin-top: 0;
}

@media (max-width: 47.99rem) {
    .settings-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 1rem;
    }

    .settings-layout--list .settings-pane,
    .settings-layout--detail .settings-nav {
        display: none;
    }

    .settings-nav {
        position: static;
        gap: 0;
        background-color: var(--tlt-color-surface);
        border-radius: var(--tlt-radius);
        box-shadow: var(--tlt-shadow-sm);
        padding: 0 0.5rem;
    }

    .settings-title {
        background: none;
        padding: 0.9rem 0.85rem 0.4rem;
        margin: 0;
    }

    .settings-nav-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.95rem 0.85rem;
        border-left: 0;
        border-top: 1px solid var(--tlt-color-border);
        border-radius: 0;
        font-weight: 400;
        background: none;
    }

    .settings-nav-item::after {
        content: "\203A";
        color: var(--tlt-color-text-muted);
        font-size: 1.3rem;
    }

    .settings-back {
        display: inline-block;
        margin-bottom: 0.5rem;
        color: var(--tlt-color-link);
        text-decoration: none;
    }

    .settings-back::before {
        content: "\2039  ";
    }

    .settings-pane {
        padding: 1.25rem 1.1rem 1.5rem;
    }
}

/* ===== Settings form design system (scoped to .settings-pane) =====================================
   The panes used to inherit `.card label > input` styling; they aren't cards any more, so Settings has
   its own: label above the control, roomy rounded inputs, a clear focus ring, toggle switches for on/off
   settings and round avatar controls. Everything uses theme tokens, so it follows every family theme. */
.settings-pane {
    --settings-control-bg: color-mix(in srgb, var(--tlt-color-surface) 92%, var(--tlt-color-primary));
    --settings-control-border: color-mix(in srgb, var(--tlt-color-border) 80%, var(--tlt-color-text));
}

.settings-pane label:not(.checkbox-label):not(.avatar-option):not(.settings-file-button) {
    display: block;
    margin-bottom: 1rem;
    font-family: var(--tlt-font-body);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--tlt-color-text-muted);
}

.settings-pane .settings-field-label {
    display: block;
}

.settings-pane .settings-field-hint {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--tlt-color-text-muted);
}

.settings-pane input:not([type="checkbox"]):not([type="file"]):not([type="hidden"]),
.settings-pane select,
.settings-pane textarea {
    display: block;
    width: 100%;
    max-width: 30rem;
    box-sizing: border-box;
    min-height: 2.6rem;
    margin-top: 0.35rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--settings-control-border);
    border-radius: 8px;
    background-color: var(--settings-control-bg);
    color: var(--tlt-color-text);
    font-family: var(--tlt-font-body);
    font-size: 1rem;
    font-weight: 400;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.settings-pane textarea {
    min-height: 5.5rem;
    resize: vertical;
    font-family: var(--tlt-font-reading);
}

.settings-pane input::placeholder,
.settings-pane textarea::placeholder {
    color: var(--tlt-color-text-muted);
    opacity: 0.7;
}

.settings-pane input:not([type="checkbox"]):not([type="file"]):hover,
.settings-pane select:hover,
.settings-pane textarea:hover {
    border-color: var(--tlt-color-primary);
}

.settings-pane input:not([type="checkbox"]):not([type="file"]):focus,
.settings-pane select:focus,
.settings-pane textarea:focus {
    outline: none;
    border-color: var(--tlt-color-accent);
    background-color: var(--tlt-color-surface);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tlt-color-accent) 22%, transparent);
}

.settings-pane select {
    appearance: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
}

.settings-pane .invalid,
.settings-pane .validation-message {
    color: var(--tlt-color-accent);
    font-size: 0.85rem;
}

/* A form: fields stack, the action row sits below. Wide screens put short fields side by side. */
.settings-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0 1.25rem;
    align-content: start;
}

@media (min-width: 60rem) {
    .person-card .settings-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .person-card .settings-form .settings-form-actions,
    .person-card .settings-form label:has(select) {
        grid-column: 1 / -1;
    }
}

.settings-form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.settings-status {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.settings-status--ok {
    color: var(--tlt-color-success);
    background-color: color-mix(in srgb, var(--tlt-color-success) 14%, transparent);
}

.settings-status--error {
    color: #b3372f;
    background-color: color-mix(in srgb, #b3372f 12%, transparent);
}

/* Existing <EditForm>s and stray buttons inside panes: consistent rhythm and button sizing. */
.settings-pane form {
    max-width: 44rem;
}

.settings-pane .btn-primary,
.settings-pane .btn-secondary {
    min-height: 2.5rem;
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    font-size: 0.95rem;
}

.settings-pane .btn-primary:disabled,
.settings-pane .btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.settings-pane button[type="submit"] {
    margin-top: 0.25rem;
}

.settings-pane .auth-success,
.settings-pane .auth-error {
    padding: 0.55rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 0.9rem;
}

/* On/off settings are toggle switches (the markup is still a plain checkbox in a .checkbox-label). */
.settings-pane .checkbox-label:not(.group-row .checkbox-label) {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: 100%;
    max-width: 30rem;
    margin: 0 0 0.75rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 10px;
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
    cursor: pointer;
}

.settings-pane .checkbox-label:not(.group-row .checkbox-label) input[type="checkbox"] {
    appearance: none;
    flex: none;
    position: relative;
    width: 2.6rem;
    height: 1.5rem;
    margin: 0;
    border-radius: 999px;
    background-color: color-mix(in srgb, var(--tlt-color-text-muted) 40%, transparent);
    cursor: pointer;
    transition: background-color 0.18s ease;
}

.settings-pane .checkbox-label:not(.group-row .checkbox-label) input[type="checkbox"]::before {
    content: "";
    position: absolute;
    top: 0.15rem;
    left: 0.15rem;
    width: 1.2rem;
    height: 1.2rem;
    border-radius: 50%;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.18s ease;
}

.settings-pane .checkbox-label:not(.group-row .checkbox-label) input[type="checkbox"]:checked {
    background-color: var(--tlt-color-primary);
}

.settings-pane .checkbox-label:not(.group-row .checkbox-label) input[type="checkbox"]:checked::before {
    transform: translateX(1.1rem);
}

.settings-pane .checkbox-label:not(.group-row .checkbox-label) input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--tlt-color-accent);
    outline-offset: 2px;
}

.settings-pane .checkbox-label:not(.group-row .checkbox-label) input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Rows in lists (groups, past habits) read as tidy rows rather than loose text. */
.settings-pane .group-row,
.settings-pane .child-chip {
    border: 1px solid var(--tlt-color-border);
    border-radius: 10px;
    padding: 0.6rem 0.9rem;
    background-color: color-mix(in srgb, var(--tlt-color-surface) 96%, var(--tlt-color-primary));
}

/* ----- People (children) ----- */
.person-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.person-card {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1.25rem 2rem;
    padding: 1.1rem 1.25rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 12px;
    background-color: color-mix(in srgb, var(--tlt-color-surface) 97%, var(--tlt-color-primary));
}

.person-card > .settings-form {
    flex: 1 1 18rem;
    min-width: 0;
}

/* ----- Avatar chooser: three round options; the Photo one is the upload control ----- */
.avatar-chooser {
    display: flex;
    gap: 1rem;
    flex: none;
}

.avatar-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.avatar-choice-caption {
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
}

.avatar-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    padding: 0;
    border: 2px solid var(--tlt-color-border);
    border-radius: 50%;
    background: none;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.avatar-option:hover:not(:disabled) {
    border-color: var(--tlt-color-primary);
    transform: translateY(-1px);
}

.avatar-option:focus-visible,
.avatar-option:focus-within {
    outline: 2px solid var(--tlt-color-accent);
    outline-offset: 2px;
}

.avatar-option:disabled {
    opacity: 0.55;
    cursor: wait;
}

.avatar-option--active {
    border-color: var(--tlt-color-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tlt-color-accent) 25%, transparent);
}

.avatar-option--upload {
    border-style: dashed;
    color: var(--tlt-color-primary);
    background-color: color-mix(in srgb, var(--tlt-color-primary) 7%, transparent);
}

.avatar-option--upload.avatar-option--active {
    border-style: solid;
}

.avatar-option-plus {
    font-size: 2rem;
    font-weight: 300;
    line-height: 1;
}

.avatar-option-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-option-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.38);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.avatar-option--upload:hover .avatar-option-overlay,
.avatar-option--upload:focus-within .avatar-option-overlay {
    opacity: 1;
}

/* On touch screens there is no hover, so the pencil is always faintly visible on an existing photo. */
@media (hover: none) {
    .avatar-option-overlay {
        opacity: 1;
        inset: auto 0 0 0;
        height: 34%;
        background-color: rgba(0, 0, 0, 0.5);
    }
}

.avatar-option-face {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    background-color: var(--tlt-color-accent);
}

.avatar-option-face svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* The real file input stays in the DOM (the <label> around it opens the picker) but is invisible. */
.avatar-file-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    opacity: 0;
    cursor: pointer;
    font-size: 0;
}

/* Styled file-picker button (same hidden-input trick as .avatar-file-input above) - the family
   photo pool's "Add photo" (text only) and the docx/markdown import page's own file button (an
   UploadIcon plus the chosen filename, replacing the browser's native "Choose File"/"No file
   chosen" pairing) both use this. gap/align-items only matter once there's an icon alongside the
   text - a text-only button just ignores them. */
.settings-file-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    overflow: hidden;
}

.settings-file-button--busy {
    opacity: 0.6;
    cursor: wait;
}

@media (max-width: 30rem) {
    .avatar-chooser {
        gap: 0.65rem;
    }

    .avatar-option {
        width: 3.6rem;
        height: 3.6rem;
    }

    .person-card {
        padding: 1rem;
    }
}

/* Font-size dropdown in the editor toolbar - see fontSizeButton.tsx. Each item previews its own size. */
.tlt-font-size-trigger {
    width: auto;
    min-width: 4.5rem;
    padding: 0 0.5rem;
}

.tlt-font-size-trigger-label {
    font-size: 0.8rem;
    white-space: nowrap;
}

.tlt-font-size-dropdown {
    min-width: 9rem;
}

/* Font-family dropdown - see fontFamilyButton.tsx. Same shell as .tlt-font-size-trigger, just
   wider (the label is a word - "Serif"/"Monospace" - not a 1-2 digit number). */
.tlt-font-family-trigger {
    width: auto;
    min-width: 5.5rem;
    padding: 0 0.5rem;
}

.tlt-font-family-trigger-label {
    font-size: 0.8rem;
    white-space: nowrap;
}

.tlt-font-family-dropdown {
    min-width: 9rem;
}


/* ---- Live apps (editor blocks: countdown, tasks, progress, board, calendar, poll) ---- */
/* container-type: inline-size makes this block its own CSS containment context, so the
   @container rules below (board/calendar layout) key off the BLOCK's own rendered width, not
   the viewport - a live-app block can be narrower than the page even on a wide screen (inside
   a 2/3-column layout), which a plain @media query can't see. Same idea as Quip's own embedded
   apps, which check their own container width rather than the window's. width: 100% is required
   alongside it, not just nice-to-have: container-type: inline-size implies containment that
   makes an element's OWN preferred/intrinsic width collapse to near-zero for sizing purposes
   (it can no longer size itself from its children). Inside the columns block's own
   grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)) (see that rule's own comment),
   the grid track's width is partly resolved from its content's preferred size - with no
   explicit width here, that starved the whole column down to a couple of pixels, which in turn
   left BlockNote's own selection/position mapping over near-zero-width blocks returning empty
   results, silently blanking several stock toolbar buttons (found live: a 2-column document with
   a live-app block in one column). width: 100% was needed anyway - a live-app block should
   always fill its column - so this isn't a workaround so much as a rule that was missing. */
/* Same width:100% + container-type:inline-size combination as .tlt-live just below, and the
   same reason: without an explicit width, a block sitting in a columns-block grid track
   (repeat(auto-fit, minmax(11rem,1fr))) can get starved down to a couple of pixels. */
.tlt-spreadsheet {
    container-type: inline-size;
    width: 100%;
    margin: 0.25rem 0;
}

/* A spreadsheet block has content: "none" (it's a leaf/atom node - Fortune-sheet owns all the real
   content), so whenever ProseMirror's own selection resolves to a NodeSelection on it - freshly
   inserted, or the very first block in a freshly-loaded document, both cases where there's no text
   position to place a text cursor into instead - @blocknote/core's own style.css paints its default
   "this node is selected" treatment: a semi-transparent blue fill plus a 4px inset blue ring over the
   ENTIRE block. Confirmed live (not just from reading style.css) that the class actually lands on
   the block's OWN .react-renderer wrapper - BlockNote also stamps that wrapper with a per-type
   `node-<type>` class (here node-spreadsheet), one level ABOVE .bn-block-content, not on
   .bn-block-content itself - so the matching rule is style.css's
   `.ProseMirror-selectednode>.bn-block-content>*:after` form, not the `.bn-block-content
   .ProseMirror-selectednode` form an initial reading suggested. That's the right affordance for an
   atom block like an image, but over a full grid of cells it reads as "the whole spreadsheet is
   selected/highlighted" - reported live as looking odd, confirmed harmless (you can click/type into
   it immediately regardless) but visually wrong. Clicking elsewhere then back in doesn't re-trigger
   it because a click resolves to a real position, never a NodeSelection. */
.node-spreadsheet.ProseMirror-selectednode > .bn-block-content > *::after {
    content: none;
}

.tlt-live {
    container-type: inline-size;
    width: 100%;
    border: 1px solid var(--tlt-color-border);
    border-radius: 0.6rem;
    background-color: var(--tlt-color-surface);
    margin: 0.25rem 0;
    overflow: hidden;
}

.tlt-live--stub {
    padding: 0.5rem 0.75rem;
    color: var(--tlt-color-text-muted);
}

.tlt-live-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-bg);
    font-size: 0.85rem;
}

.tlt-live-title {
    flex: 1;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tlt-live-link {
    font-size: 0.8rem;
    white-space: nowrap;
}

.tlt-live-icon-button {
    border: none;
    background: transparent;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0.2rem 0.35rem;
    border-radius: 0.3rem;
}

.tlt-live-icon-button:hover {
    background-color: var(--tlt-color-border);
}

.tlt-live-settings {
    display: grid;
    gap: 0.6rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--tlt-color-border);
}

.tlt-live-field {
    display: grid;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--tlt-color-text-muted);
}

.tlt-live-field input,
.tlt-live-field select {
    font: inherit;
    font-weight: 400;
    color: var(--tlt-color-text);
    background-color: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: 0.5rem;
    padding: 0.4rem 0.6rem;
    max-width: 22rem;
}

.tlt-live-done {
    justify-self: start;
    border: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    border-radius: 0.5rem;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
}

.tlt-live-body {
    padding: 0.75rem;
}

.tlt-live-empty {
    color: var(--tlt-color-text-muted);
    font-size: 0.9rem;
}

.tlt-countdown {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
}

.tlt-countdown-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.tlt-countdown-caption {
    font-size: 1.1rem;
}

.tlt-countdown-date {
    flex-basis: 100%;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.tlt-live-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.tlt-live-error {
    color: var(--tlt-color-danger, #b3261e);
    font-size: 0.8rem;
}

/* Link preview card body - the whole thing is one <a>, unlike every other .tlt-live block's own
   non-link body, so this drops the default anchor underline/color instead of reusing .tlt-live-body
   directly. */
.tlt-link-preview-body {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    color: inherit;
    text-decoration: none;
}

.tlt-link-preview-body:hover {
    background-color: var(--tlt-color-bg);
}

.tlt-link-preview-text {
    flex: 1;
    min-width: 0;
}

.tlt-link-preview-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tlt-link-preview-description {
    margin-top: 0.2rem;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.tlt-link-preview-image {
    flex-shrink: 0;
    width: 6rem;
    height: 4.5rem;
    object-fit: cover;
    border-radius: 0.4rem;
}

.tlt-live-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
}

.tlt-live-chip {
    font-size: 0.75rem;
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    background-color: var(--tlt-color-bg);
    border: 1px solid var(--tlt-color-border);
}

.tlt-live-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.4rem;
}

.tlt-live-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.6rem;
}

.tlt-live-list label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.tlt-live-done-item .tlt-live-item-text {
    text-decoration: line-through;
    color: var(--tlt-color-text-muted);
}

.tlt-live-option-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.tlt-live-option-row input {
    flex: 1;
    max-width: 22rem;
    font: inherit;
    border: 1px solid var(--tlt-color-border);
    border-radius: 0.5rem;
    padding: 0.4rem 0.6rem;
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
}

.tlt-live-pager {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.6rem;
}

.tlt-live-pager button {
    border: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    border-radius: 0.4rem;
    padding: 0.15rem 0.6rem;
    cursor: pointer;
}

.tlt-live-pager-text {
    margin-left: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Progress */
.tlt-progress {
    display: grid;
    gap: 0.4rem;
}

.tlt-progress-bar {
    height: 0.7rem;
    border-radius: 999px;
    background-color: var(--tlt-color-border);
    overflow: hidden;
}

.tlt-progress-fill {
    height: 100%;
    background-color: var(--tlt-color-primary);
    border-radius: 999px;
}

.tlt-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

/* Lesson chips (board + calendar) */
.tlt-lesson-chip {
    display: grid;
    gap: 0.05rem;
    padding: 0.25rem 0.45rem;
    border: 1px solid var(--tlt-color-border);
    border-left: 4px solid var(--tlt-color-primary);
    border-radius: 0.4rem;
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    text-decoration: none;
    font-size: 0.8rem;
    min-width: 0;
}

.tlt-lesson-chip:hover {
    background-color: var(--tlt-color-bg);
}

.tlt-lesson-chip-title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.tlt-lesson-chip-child {
    color: var(--tlt-color-text-muted);
    font-size: 0.72rem;
}

.tlt-lesson-chip--complete .tlt-lesson-chip-title {
    text-decoration: line-through;
    color: var(--tlt-color-text-muted);
}

.tlt-lesson-chip--skipped {
    opacity: 0.6;
}

.tlt-board {
    display: grid;
    grid-template-columns: repeat(6, minmax(8rem, 1fr));
    gap: 0.5rem;
    overflow-x: auto;
}

.tlt-board-column {
    display: grid;
    gap: 0.35rem;
    align-content: start;
    min-width: 0;
}

.tlt-board-heading {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--tlt-color-text-muted);
}

.tlt-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
    overflow-x: auto;
}

.tlt-calendar-dow {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--tlt-color-text-muted);
}

.tlt-calendar-day {
    display: grid;
    gap: 0.2rem;
    align-content: start;
    min-width: 0;
    min-height: 3.5rem;
    padding: 0.25rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 0.4rem;
}

.tlt-calendar--week .tlt-calendar-day {
    min-height: 7rem;
}

.tlt-calendar-day--today {
    border-color: var(--tlt-color-primary);
    box-shadow: inset 0 0 0 1px var(--tlt-color-primary);
}

.tlt-calendar-day--outside {
    opacity: 0.45;
}

.tlt-calendar-date {
    font-size: 0.72rem;
    color: var(--tlt-color-text-muted);
}

/* Poll */
.tlt-poll {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.tlt-poll-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 0.5rem;
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
    overflow: hidden;
}

.tlt-poll-option--mine {
    border-color: var(--tlt-color-primary);
    font-weight: 600;
}

.tlt-poll-fill {
    position: absolute;
    inset: 0 auto 0 0;
    background-color: var(--tlt-color-primary);
    opacity: 0.15;
    pointer-events: none;
}

.tlt-poll-text,
.tlt-poll-count {
    position: relative;
}

.tlt-poll-count {
    font-variant-numeric: tabular-nums;
}

/* @container, not @media: keyed off .tlt-live's own width (see its container-type rule above),
   so a block collapses to horizontal-scroll whenever IT is narrow - inside a 2/3-column layout
   at full desktop width, just as much as on an actual phone. */
@container (max-width: 40rem) {
    .tlt-board {
        grid-template-columns: repeat(6, 9rem);
    }

    .tlt-calendar--month {
        min-width: 32rem;
    }
}

/* The "audioChapter" BlockNote block (editor-src/audioChapter/audioChapterBlock.tsx) - a real
   in-document block, not a review-page row, so this mirrors .tlt-callout's "small tinted card"
   shape rather than a list-item shape. content:"none", so there's no text-editing surface here,
   just title/reader/duration and the native player. */
.tlt-audio-chapter {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    width: 100%;
    padding: 0.7rem 0.9rem;
    border-radius: 6px;
    border: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-surface);
}

.tlt-audio-chapter-title {
    font-weight: 600;
    font-family: var(--tlt-font-reading);
}

.tlt-audio-chapter-meta {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.tlt-audio-chapter audio {
    width: 100%;
    max-width: 28rem;
    height: 2.25rem;
}

/* ImportLibriVoxModal's search results */
.audiobook-search-results {
    list-style: none;
    padding: 0;
    margin: 0.75rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.audiobook-search-result {
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.audiobook-search-result-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.audiobook-search-result-title {
    font-weight: 600;
    font-family: var(--tlt-font-reading);
}

.audiobook-search-result-meta {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.audiobook-search-result-link {
    font-size: 0.8rem;
}

/* ImportLibriVoxModal's search bar - bordered pill with the submit button as an inline
   icon, matching NoteComposer's own icon-inline-with-input treatment rather than a plain
   unstyled <input>+text button. */
.audiobook-search-bar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 0.2rem 0.2rem 0.2rem 0.75rem;
}

.audiobook-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: none;
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
    color: var(--tlt-color-text);
    padding: 0.5rem 0;
}

.audiobook-search-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: none;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

.audiobook-search-submit:hover:not(:disabled) {
    color: var(--tlt-color-text);
    background-color: var(--tlt-color-bg);
}

.audiobook-search-submit:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Searching/error state lives below the search bar, not inside the button - matches
   NoteComposer's own .note-composer-status-row split (icon-only controls have no room
   left for status text). */
.audiobook-search-status {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0.5rem 0;
}

.audiobook-attribution {
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
    margin-top: 1rem;
}

/* Lesson pop-up (LessonPreviewModal): one lesson's block, read-only, over whatever page opened it. */
.modal-content--lesson {
    max-width: 48rem;
    padding: 1.5rem 1.75rem;
}

.lesson-preview-title {
    margin: 0 2.5rem 1rem 0;
}

.lesson-preview-footer {
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--tlt-color-border);
}

.lesson-preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0 2.5rem 1rem 0;
}

.lesson-preview-header .lesson-preview-title {
    margin: 0;
}

.lesson-today-pages {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tlt-color-text-muted);
    white-space: nowrap;
    align-self: center;
}

.lesson-preview-panel {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* The pop-up shows a lesson block, not a page: no paper-sheet minimum height, margin or shadow
   (the double class beats .tlt-document-editor's own rules, including its phone override). */
.tlt-document-editor.tlt-lesson-preview {
    min-height: 0;
    margin-top: 0;
    padding: 0.5rem 0;
    box-shadow: none;
    background-color: transparent;
}

/* The elevation PIN is a short, easy-to-type code, not a credential - so it is a plain text field
   (browsers' password managers, breach checks and "save password?" prompts only act on type=password)
   that is masked visually instead. -webkit-text-security covers Chrome, Edge and Safari. */
.pin-input {
    -webkit-text-security: disc;
    letter-spacing: 0.15em;
}

/* A document with a cover picture (an imported audiobook's cover art) shows it filling the tile in
   place of the text preview; the badge and the solid title/date band above/below stay on top of it. */
.document-grid-tile-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.audiobook-search-result-cover {
    width: 3.25rem;
    height: 3.25rem;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: var(--tlt-radius-sm);
    border: 1px solid var(--tlt-color-border);
}

/* ===== Plan menu forms (Assign as a lesson / Use this plan / Save as template / Add to meal plan) =====
   These panels were bare browser controls. They now follow the Settings form language: label above
   the control, roomy rounded inputs with a focus ring, the "who" pickers as tap-friendly chips, and a
   full-width primary action. Theme tokens only, so every family theme works. */
/* .tlt-form: the same control look (inputs, selects) for any form that is NOT inside a .plan-panel - wrap the form in it. */
.plan-panel,
.tlt-form {
    --plan-control-bg: color-mix(in srgb, var(--tlt-color-surface) 92%, var(--tlt-color-primary));
    --plan-control-border: color-mix(in srgb, var(--tlt-color-border) 80%, var(--tlt-color-text));
}

.plan-panel {
    width: 24rem;
    max-width: calc(100vw - 2rem);
    overflow-y: auto;
}

.plan-panel h2 {
    margin: 0.25rem 0 1rem;
    font-size: 1.35rem;
}

/* Section captions ("For children", "On these days"...) */
.plan-panel > p.auth-lede,
.plan-panel form > p.auth-lede {
    margin: 1.1rem 0 0.4rem;
    font-family: var(--tlt-font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
}

.plan-panel label:not(.checkbox-label):not(.settings-file-button) {
    display: block;
    margin-top: 1rem;
    font-family: var(--tlt-font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tlt-color-text-muted);
}

:is(.plan-panel, .tlt-form) input:not([type="checkbox"]):not([type="file"]),
:is(.plan-panel, .tlt-form) select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    min-height: 2.5rem;
    margin-top: 0.35rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--plan-control-border);
    border-radius: 8px;
    background-color: var(--plan-control-bg);
    color: var(--tlt-color-text);
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
    font-weight: 400;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

:is(.plan-panel, .tlt-form) input:not([type="checkbox"]):not([type="file"]):hover,
:is(.plan-panel, .tlt-form) select:hover {
    border-color: var(--tlt-color-primary);
}

:is(.plan-panel, .tlt-form) input:not([type="checkbox"]):not([type="file"]):focus,
:is(.plan-panel, .tlt-form) select:focus {
    outline: none;
    border-color: var(--tlt-color-accent);
    background-color: var(--tlt-color-surface);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tlt-color-accent) 22%, transparent);
}

:is(.plan-panel, .tlt-form) input::placeholder {
    color: var(--tlt-color-text-muted);
    opacity: 0.7;
}

:is(.plan-panel, .tlt-form) select {
    appearance: none;
    padding-right: 2.25rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23888' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
}

/* Who / which days: checkboxes become chips; the native box is visually hidden and the chip itself
   shows the state, so a tick is clear without a tiny checkbox to hit. */
.plan-panel .checkbox-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0.4rem 0.45rem 0;
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--plan-control-border);
    border-radius: 999px;
    background-color: var(--plan-control-bg);
    font-family: var(--tlt-font-body);
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.plan-panel .checkbox-label:hover {
    border-color: var(--tlt-color-primary);
}

.plan-panel .checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.plan-panel .checkbox-label:has(input:checked) {
    border-color: var(--tlt-color-primary);
    background-color: var(--tlt-color-primary);
    color: var(--tlt-color-on-primary, #fff);
}

.plan-panel .checkbox-label:has(input:checked)::after {
    content: "✓";
    font-size: 0.8em;
    font-weight: 700;
}

.plan-panel .checkbox-label:has(input:focus-visible) {
    outline: 2px solid var(--tlt-color-accent);
    outline-offset: 2px;
}

.plan-panel .pill-group {
    margin-top: 0.4rem;
}

.plan-panel .pill-group button {
    padding: 0.35rem 0.85rem;
    font-size: 0.9rem;
}

/* The one action at the bottom of each form */
.plan-panel form > button.btn-primary[type="submit"],
.plan-panel > button.btn-primary[type="button"] {
    display: block;
    width: 100%;
    margin-top: 1.4rem;
    padding: 0.7rem 1rem;
    font-size: 1rem;
}

.plan-panel .schedule-pattern-row {
    margin-top: 0.25rem;
}

/* Short confirmation after a Plan-menu action; the menu has already closed. */
.tlt-toast {
    position: fixed;
    left: 50%;
    bottom: 1.75rem;
    transform: translateX(-50%);
    z-index: 400;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    max-width: calc(100vw - 2rem);
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    background-color: var(--tlt-color-text);
    color: var(--tlt-color-surface);
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
    animation: tlt-toast-in 0.2s ease-out;
}

.tlt-toast-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background-color: var(--tlt-color-accent);
    color: #fff;
    font-size: 0.8rem;
}

@keyframes tlt-toast-in {
    from { opacity: 0; transform: translate(-50%, 0.75rem); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .tlt-toast { animation: none; }
}

/* Phone: the 24rem panel would hang off the right edge of the screen, so it spans the screen
   instead (top:auto keeps it directly under the Plan menu it opened from). */
@media (max-width: 30rem) {
    .document-menubar .plan-panel {
        position: fixed;
        top: auto;
        left: 0.5rem;
        right: 0.5rem;
        width: auto;
        max-width: none;
    }
}

/* Save as Template > Cover image: caption, the current picture with a Remove link, then the upload button. */
.plan-cover-field {
    margin-top: 1rem;
}

.plan-field-caption {
    display: block;
    margin-bottom: 0.4rem;
    font-family: var(--tlt-font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tlt-color-text-muted);
}

.plan-cover-preview {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.plan-cover-preview img {
    max-width: 7rem;
    max-height: 9rem;
    object-fit: contain;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-bg);
}

/* The Library's Assign and Add New Resource forms, as pop-ups: the same .plan-panel form design the
   document menus use, centred over the page instead of dropping from a menu bar. */
.plan-modal {
    width: min(26rem, calc(100vw - 2rem));
    max-height: calc(100vh - 3rem);
    padding: 1.75rem 1.75rem 1.5rem;
    overflow-y: auto;
}

.plan-modal .modal-close {
    top: 0.9rem;
    right: 0.9rem;
}

.plan-modal form > button.btn-primary[type="submit"],
.plan-modal > button.btn-primary[type="button"] {
    display: block;
    width: 100%;
    margin-top: 1.4rem;
    padding: 0.7rem 1rem;
    font-size: 1rem;
}

/* Audio guard-rails in the create-lesson/plan forms and Settings: the labels are sentences, so they sit
   as full-width rounded rows rather than the pill chips the plan panels use for names and days. */
.audio-lesson-options .checkbox-label,
.plan-panel .audio-lesson-options .checkbox-label {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 0.45rem;
    border-radius: 0.75rem;
}

.settings-checkbox-help {
    margin: 0.15rem 0 1rem 1.9rem;
    font-size: 0.85rem;
}

.tlt-audio-locked-hint {
    margin-top: 0.35rem;
    font-family: var(--tlt-font-body);
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
}

.lesson-audio-gate-hint {
    margin: 0.5rem 0 0;
    font-size: 0.85rem;
}

.plan-panel .audio-lesson-options > p.auth-lede {
    margin: 1.1rem 0 0.4rem;
    font-family: var(--tlt-font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
}

/* ===== Add a Book (photo flow) ===== */
.addbook-steps {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    margin: 0 0 1.25rem;
    padding: 0;
}

.addbook-step {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border-bottom: 3px solid var(--tlt-color-border);
    font-family: var(--tlt-font-body);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
}

.addbook-step--active {
    border-bottom-color: var(--tlt-color-primary);
    color: var(--tlt-color-text);
}

.addbook-step--done {
    border-bottom-color: var(--tlt-color-accent);
}

.addbook-photo-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0.5rem 0;
}

.addbook-tips {
    margin: 0.25rem 0 1rem;
    font-size: 0.85rem;
}

.addbook-cover-preview {
    display: block;
    max-width: 9rem;
    max-height: 13rem;
    object-fit: contain;
    margin: 0.5rem 0;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-bg);
}

.addbook-cover-preview--small {
    max-width: 5rem;
    max-height: 7rem;
    margin: 0;
}

.addbook-chapters {
    list-style: none;
    margin: 0.5rem 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.addbook-chapter-row {
    display: grid;
    grid-template-columns: 1fr 5rem auto;
    gap: 0.4rem;
    align-items: center;
}

.addbook-chapter-row input {
    margin: 0;
    min-width: 0;
}

.addbook-chapter-row .close-icon-button {
    position: static;
}

.addbook-paste-toggle {
    display: block;
    margin-top: 0.75rem;
}

.addbook-paste {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

.addbook-paste textarea {
    width: 100%;
}

.addbook-summary {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin: 0.5rem 0 1rem;
}

.addbook-summary-title {
    margin: 0;
    font-family: var(--tlt-font-heading, inherit);
    font-size: 1.25rem;
}

.addbook-existing {
    margin: 0 0 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-bg);
}

.addbook-existing-title {
    margin: 0;
    font-weight: 700;
}

.addbook-existing ul {
    margin: 0.25rem 0 0;
    padding-left: 1.1rem;
}

.addbook-audio-option {
    display: flex;
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 0.75rem;
    margin: 0.5rem 0 0.25rem;
}

.addbook-audio-help {
    margin: 0 0 1rem 0.25rem;
    font-size: 0.85rem;
}

.addbook-audio-search {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.addbook-audio-search input {
    flex: 1 1 10rem;
    min-width: 0;
    margin: 0;
}

.addbook-nav {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.addbook-nav .btn-primary:only-child {
    margin-left: auto;
}

@media (max-width: 30rem) {
    .addbook-photo-buttons > label {
        flex: 1 1 100%;
        justify-content: center;
    }
}

/* Phone: the audiobook match rows and the step bar must fit a ~360px card. */
.addbook .audiobook-search-result {
    flex-wrap: wrap;
}

.addbook .audiobook-search-result-info {
    flex: 1 1 8rem;
}

.addbook .audiobook-search-result > .btn-primary {
    flex: 1 1 100%;
}

.addbook-step {
    padding: 0.35rem 0.1rem;
    font-size: 0.7rem;
    letter-spacing: 0.02em;
    text-align: center;
}

/* The "pdfSection" BlockNote block (editor-src/pdfSection/pdfSectionBlock.tsx): a slim row under a chapter's
   lesson - the page range and a link into the PDF reader. */
.tlt-pdf-section {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem 0.9rem;
    border-radius: 6px;
    border: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-surface);
}

.tlt-pdf-section-pages {
    font-size: 0.9rem;
    color: var(--tlt-color-text-muted);
}

/* "Start reading here": a real button (the link fallback shares the look). */
.tlt-pdf-section-start {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid transparent;
    border-radius: var(--tlt-radius-sm);
    background-color: #495057;
    color: #fff;
    font-family: var(--tlt-font-body);
    font-weight: 600;
    font-size: 0.9rem;
    max-width: 100%;
    text-decoration: none;
    cursor: pointer;
}

.tlt-pdf-section-start:hover {
    background-color: #343a40;
}

/* ImportPdfModal ("Import PDF Book"): the two-way chooser, the search fields and a result's cover. */
.pdf-import-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.pdf-import-choice {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    padding: 1rem;
    text-align: left;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    cursor: pointer;
}

.pdf-import-choice:hover {
    border-color: var(--tlt-color-text-muted);
}

.pdf-import-choice-title {
    font-weight: 600;
    font-family: var(--tlt-font-reading);
}

.pdf-import-choice-hint {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.pdf-import-search-fields {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pdf-import-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
}

.pdf-import-cover {
    width: 3rem;
    height: 4.25rem;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: var(--tlt-radius-sm);
    border: 1px solid var(--tlt-color-border);
}

.pdf-import-result {
    margin: 1rem 0;
}

/* ===== PDF viewer: loading message, compact (pop-up) layout and full-screen reading ===== */
.pdf-viewer-stage {
    position: relative;
}

.pdf-viewer-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text-muted);
    font-family: var(--tlt-font-reading);
    z-index: 2;
}

.pdf-viewer-root--compact {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
    height: 100%;
}

.pdf-viewer-root--compact .pdf-viewer-stage {
    flex: 1;
    min-height: 0;
}

.pdf-viewer-root--compact .pdf-reader-canvas-container {
    max-height: none;
    height: 100%;
    margin: 0;
    background-color: var(--tlt-color-bg);
}

.pdf-viewer-root--fullscreen {
    position: fixed;
    inset: 0;
    z-index: 2000;
    padding: 0.75rem;
    background-color: var(--tlt-color-surface);
}

.pdf-fullscreen-exit {
    position: absolute;
    top: 0.9rem;
    left: 0.9rem;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 999px;
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    box-shadow: var(--tlt-shadow-sm);
    cursor: pointer;
}

.pdf-fullscreen-exit:hover {
    background-color: var(--tlt-color-bg);
}

/* ===== PDF chapter lesson pop-up: nearly the whole window, the book on the left, the lesson controls beside it ===== */
.modal-content--lesson-pdf {
    width: 96vw;
    max-width: 96vw;
    height: 94vh;
    max-height: 94vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 1rem 1.25rem;
}

.modal-content--lesson-pdf .lesson-preview-header {
    flex-shrink: 0;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0.6rem;
}

.modal-content--lesson-pdf .lesson-preview-title {
    font-size: 1.15rem;
}

.lesson-pdf-fullscreen-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.lesson-pdf-body {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 21rem;
    gap: 1rem;
}

.lesson-pdf-viewer {
    min-height: 0;
    min-width: 0;
}

.lesson-pdf-side {
    min-height: 0;
    overflow-y: auto;
}

@media (max-width: 62rem) {
    .modal-content--lesson-pdf {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
    }

    .lesson-pdf-body {
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }

    .lesson-pdf-viewer {
        flex: 0 0 72vh;
    }

    .lesson-pdf-side {
        overflow: visible;
    }
}

/* Full width / Full page toggle in the compact PDF viewer's top bar. */
.pdf-fit-toggle {
    display: inline-flex;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    overflow: hidden;
}

.pdf-fit-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 1.9rem;
    border: none;
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

.pdf-fit-button + .pdf-fit-button {
    border-left: 1px solid var(--tlt-color-border);
}

.pdf-fit-button--active {
    background-color: #495057;
    color: #fff;
}

/* A PDF pop-up with only the book (PdfReaderModal): the viewer takes the whole body. */
.lesson-pdf-viewer--alone {
    flex: 1;
    min-height: 0;
}


/* ===== PDF tab: chapter markers ===== */
.pdf-tab-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

/* The marker bar across the top of the page stack: the hint takes whatever width is left and wraps (so a long Spanish or French
   sentence is never covered), with the Save / Cancel icon buttons fixed beside it. */
.pdf-marker-bar {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    right: 1.4rem;
    z-index: 4;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    pointer-events: none;
}

.pdf-marker-hint {
    flex: 1;
    min-width: 0;
    padding: 0.55rem 0.8rem;
    border-radius: var(--tlt-radius-sm);
    background-color: rgba(33, 37, 41, 0.92);
    color: #fff;
    font-size: 0.9rem;
    box-shadow: var(--tlt-shadow-sm);
    pointer-events: auto;
}

.pdf-marker-actions {
    flex: none;
    display: flex;
    gap: 0.4rem;
    pointer-events: auto;
}

.pdf-marker-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 999px;
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    box-shadow: var(--tlt-shadow-sm);
    cursor: pointer;
}

.pdf-marker-icon:hover {
    background-color: var(--tlt-color-bg);
}

.pdf-marker-icon--save {
    background-color: #495057;
    border-color: #495057;
    color: #fff;
}

.pdf-marker-icon--save:hover {
    background-color: #343a40;
}

.chapters-pane {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.25rem 0.1rem;
}

.chapters-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.chapters-pane-header h2 {
    margin: 0;
}

.chapters-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.chapters-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.4rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-surface);
}

.chapters-row--active {
    border-color: #495057;
    box-shadow: 0 0 0 1px #495057;
}

.chapters-page {
    min-width: 2.6rem;
    font-size: 0.78rem;
    color: var(--tlt-color-text-muted);
}

.chapters-title {
    width: 100%;
    min-width: 0;
    padding: 0.2rem 0.3rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--tlt-color-text);
    font-family: var(--tlt-font-reading);
    font-size: 0.95rem;
}

.chapters-title:hover {
    border-color: var(--tlt-color-border);
}

.chapters-title:focus {
    outline: none;
    border-color: #495057;
    background-color: var(--tlt-color-bg);
}

.chapters-actions {
    display: inline-flex;
    gap: 0.1rem;
}

.chapters-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

.chapters-icon:hover:not(:disabled) {
    background-color: var(--tlt-color-bg);
    color: var(--tlt-color-text);
}

.chapters-icon:disabled {
    opacity: 0.35;
    cursor: default;
}

.chapters-delete {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.8rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-bg);
}

.chapters-delete h3 {
    margin: 0;
    font-size: 1rem;
}

.chapters-choice {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.92rem;
}

.chapters-delete-actions {
    display: flex;
    gap: 0.5rem;
}

/* The viewer filling the height it is given (the document page's PDF tab) instead of capping itself at 75vh. */
.pdf-viewer-root--fill {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
}

.pdf-viewer-root--fill .pdf-viewer-stage {
    flex: 1;
    min-height: 0;
}

.pdf-viewer-root--fill .pdf-reader-canvas-container {
    max-height: none;
    height: 100%;
}

.pdf-nav-actions {
    margin-right: auto;
}

.pdf-viewer-root--fill .pdf-reader-search {
    flex-shrink: 0;
}

/* Stacked (tablet / phone) layout: .document-body is the single scroller there (see its own rule above), so the tabbed document
   column goes back to plain flow and the PDF stack caps its own height as it always did. Placed last so it out-ranks the
   desktop-only tabbed rules and the earlier phone padding override. */
@media (max-width: 60rem) {
    .document-main.document-main--tabbed {
        display: block;
        overflow: visible;
    }

    .document-main--tabbed > .document-tab-panel:not(.tab-panel-hidden) {
        display: block;
        overflow: visible;
    }

    .pdf-viewer-root--fill {
        display: block;
    }

    .pdf-viewer-root--fill .pdf-reader-canvas-container {
        max-height: 70vh;
        height: auto;
    }
}

@media (max-width: 30rem) {
    .document-main.document-main--tabbed {
        padding: 0;
    }

    .document-main--tabbed > .tab-strip-row {
        margin: 0.5rem 1rem;
    }

    .document-main--tabbed > .document-tab-panel {
        padding: 0 1rem 1.5rem;
    }
}

/* The Document | PDF tabs with "Search this book" at the end of the same row (shown only on the PDF tab). */
.tab-strip-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 1rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.tab-strip-row {
    border-bottom: 1px solid var(--tlt-color-border);
}

.tab-strip-row > .tab-strip {
    flex: 1;
    min-width: 12rem;
    margin: 0;
    border-bottom: none;
}

.pdf-search {
    position: relative;
    flex: 0 1 22rem;
    min-width: 12rem;
    padding-bottom: 0.3rem;
}

.pdf-search-field {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-surface);
    padding: 0.1rem 0.15rem 0.1rem 0.6rem;
}

.pdf-search-input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: none;
    font-family: var(--tlt-font-body);
    font-size: 0.9rem;
    color: var(--tlt-color-text);
    padding: 0.35rem 0;
}

.pdf-search-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.9rem;
    height: 1.9rem;
    border: none;
    border-radius: 999px;
    background: none;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

.pdf-search-submit:hover:not(:disabled) {
    background-color: var(--tlt-color-bg);
    color: var(--tlt-color-text);
}

.pdf-search-submit:disabled {
    opacity: 0.45;
    cursor: default;
}

.pdf-search-results {
    position: absolute;
    top: calc(100% - 0.2rem);
    right: 0;
    z-index: 30;
    width: 100%;
    max-height: 50vh;
    overflow-y: auto;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-surface);
    box-shadow: var(--tlt-shadow-sm);
}

.pdf-search-results ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.pdf-search-results li + li {
    border-top: 1px solid var(--tlt-color-border);
}

/* One match: the page as a small label, the snippet beneath with the searched word marked. A plain row, not a link. */
.pdf-search-result {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    width: 100%;
    padding: 0.5rem 0.4rem;
    border: none;
    border-radius: 4px;
    background: none;
    text-align: left;
    color: var(--tlt-color-text);
    font-family: var(--tlt-font-body);
    text-decoration: none;
    cursor: pointer;
}

.pdf-search-result:hover,
.pdf-search-result:focus-visible {
    background-color: var(--tlt-color-bg);
    outline: none;
}

.pdf-search-page {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
}

.pdf-search-snippet {
    font-size: 0.9rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.pdf-search-snippet mark {
    background-color: #fff3bf;
    color: #212529;
    border-radius: 2px;
    padding: 0 0.1rem;
}

.pdf-search-close {
    position: absolute;
    top: 0.2rem;
    right: 0.4rem;
}

/* Wider than its field where there is room (the field is only 22rem on a desktop row); on a stacked / phone layout it is the
   field's own width so it can never run off the screen. */
@media (min-width: 60rem) {
    .pdf-search-results {
        width: max(100%, 30rem);
    }
}

/* "Schedule lessons by" - Use This Plan / Library Assign */
.plan-mode-note {
    margin: 0.25rem 0 0.5rem;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.plan-overflow {
    margin: 1rem 0;
    padding: 0.85rem 1rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 0.5rem;
    background: var(--tlt-color-surface);
}

.plan-overflow p {
    margin: 0 0 0.75rem;
}

.plan-overflow-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* Afternoon Occupations (Term Grid modal + the child's checklist) */
.term-grid-actions {
    margin: 0.5rem 0 1rem;
}

.occupation-suggestion-list,
.occupation-checklist,
.occupation-logged {
    list-style: none;
    margin: 0.5rem 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.occupation-suggestion-row,
.occupation-check-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.occupation-suggestion-title,
.occupation-check {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.occupation-suggestion-badge {
    margin-left: 0.4rem;
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
}

.occupation-add-row {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem 0 1rem;
}

.occupation-add-row input {
    flex: 1;
    min-width: 0;
}

.occupation-library {
    margin: 0.75rem 0 1rem;
    max-height: 16rem;
    overflow-y: auto;
    /* The pop-up is a flex column: a scrolling box is allowed to shrink to nothing there unless told not to. */
    flex: 0 0 auto;
}

.occupation-cover {
    width: 2rem;
    height: 2.75rem;
    object-fit: cover;
    border-radius: 0.2rem;
}


.occupation-open-title {
    margin: 0.75rem 0;
}

/* Bounded height: the viewer scrolls its own pages, so it must not grow to the whole book's length. */
.occupation-pdf-viewer {
    height: 70vh;
    min-height: 24rem;
    display: flex;
    flex-direction: column;
}

.occupation-added {
    font-size: 0.85rem;
    color: var(--tlt-color-success);
    white-space: nowrap;
}

/* "Log something else" in the child's afternoon checklist */
.occupation-log {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--tlt-color-border);
}

.occupation-log-heading {
    margin: 0 0 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
}

.occupation-logged {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.occupation-logged-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-surface);
    overflow-wrap: anywhere;
}

.occupation-logged-item svg {
    flex: none;
    margin-top: 0.2rem;
    color: var(--tlt-color-success);
}

.occupation-log-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.7rem 1rem;
    border: 2px dashed var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background: transparent;
    color: var(--tlt-color-primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.occupation-log-button:hover,
.occupation-log-button:focus-visible {
    border-color: var(--tlt-color-primary);
    background-color: var(--tlt-color-surface);
}

.occupation-log-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius);
    background-color: var(--tlt-color-surface);
}

.occupation-log-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.occupation-log-label {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.occupation-log-field input,
.occupation-log-field select {
    width: 100%;
    box-sizing: border-box;
}

.occupation-log-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* School (Components/Pages/School.razor): the Settings layout (category list left, one category right) with a
   wider content area for the detail work to come. Each tab has one "Add ..." button; the form opens in a pop-up. */
@media (min-width: 48rem) {
    .school-layout {
        grid-template-columns: 15rem minmax(0, 1fr);
    }
}

.school-pane-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.school-pane-header .settings-pane-title {
    margin: 0;
}

.school-add-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* Rows, not wrapping chips, inside a School tab. */
.school-layout .child-list {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0;
}

.school-layout .child-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--tlt-color-border);
}

.school-layout .child-chip:last-child {
    border-bottom: 0;
}

@media (max-width: 47.99rem) {
    .school-pane-header {
        align-items: flex-start;
    }

    .school-add-button {
        width: 100%;
        justify-content: center;
    }
}

/* School > Terms rows: name + "Current Term" badge, then the dates and the week count. */
.term-row-details {
    flex: 1 1 0;
    flex-wrap: wrap;
    row-gap: 0.2rem;
}

.term-current-badge {
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    background-color: color-mix(in srgb, var(--tlt-color-success) 18%, transparent);
    color: var(--tlt-color-success);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.term-weeks {
    white-space: nowrap;
}

/* Resources used in a term (Term Grid) and in a course (School > Courses) - derived from the lessons, never entered. */
.term-resources {
    margin-top: 2rem;
}

.term-resources-heading {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
}

.term-resources-subject {
    margin: 1.25rem 0 0.6rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
}

.resource-card-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: 1rem;
}

.resource-card {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.resource-card:hover .resource-title,
.resource-card:focus-visible .resource-title {
    text-decoration: underline;
}

.resource-cover {
    position: relative;
    display: block;
    aspect-ratio: 2 / 3;
    border-radius: var(--tlt-radius-sm);
    overflow: hidden;
    border: 1px solid var(--tlt-color-border);
    background-color: color-mix(in srgb, var(--tlt-color-surface) 85%, var(--tlt-color-primary));
    box-shadow: var(--tlt-shadow-sm);
}

.resource-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.resource-cover-missing {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
}

.resource-type-badge {
    position: absolute;
    left: 0.4rem;
    top: 0.4rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background-color: rgba(30, 30, 30, 0.78);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.resource-title {
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.resource-courses {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.resource-course-chip {
    padding: 0.05rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--tlt-color-border);
    font-size: 0.72rem;
    color: var(--tlt-color-text-muted);
}

.course-row-details {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}

.resource-chip-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.resource-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    max-width: 16rem;
    padding: 0.15rem 0.6rem 0.15rem 0.2rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 999px;
    color: inherit;
    text-decoration: none;
    font-size: 0.8rem;
}

.resource-chip:hover,
.resource-chip:focus-visible {
    border-color: var(--tlt-color-primary);
}

.resource-chip img {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    object-fit: cover;
}

.resource-chip span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 30rem) {
    .resource-card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Ownership of a physical book: Owned / Borrowed (returns ...) / Needed. */
.ownership-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.6rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 999px;
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text-muted);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

button.ownership-tag {
    cursor: pointer;
}

button.ownership-tag:hover,
button.ownership-tag:focus-visible {
    border-color: var(--tlt-color-primary);
}

.ownership-tag--needed {
    border-color: var(--tlt-color-accent);
    color: var(--tlt-color-accent);
}

.ownership-tag--borrowed {
    border-color: color-mix(in srgb, var(--tlt-color-primary) 55%, var(--tlt-color-border));
    color: var(--tlt-color-primary);
}

.ownership-tag--soon {
    border-color: #c28a14;
    background-color: color-mix(in srgb, #c28a14 14%, transparent);
    color: #8a5f00;
}

.ownership-tag--overdue {
    border-color: #b3261e;
    background-color: color-mix(in srgb, #b3261e 12%, transparent);
    color: #b3261e;
}

.document-grid-tile-wrap {
    position: relative;
}

.document-grid-tile-ownership {
    position: absolute;
    left: 0.5rem;
    bottom: 3.9rem;
    z-index: 2;
}

.ownership-picker .pill-group {
    margin-bottom: 0.5rem;
}

.ownership-return-date {
    display: block;
    margin-top: 0.75rem;
}

.addbook-ownership-heading {
    margin-top: 1.25rem;
    font-weight: 600;
}

/* ---- Term Planner (Plan level of the Term Grid) ---- */
.term-grid-levels {
    display: flex;
    gap: 0.5rem;
    margin: 0.75rem 0 1rem;
}

.term-plan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.term-plan-heading {
    margin: 0;
}

.term-plan-courses {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr));
    align-items: start;
}

.term-plan-course {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 12px;
    background: var(--tlt-color-surface);
}

.term-plan-course-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.term-plan-course-title {
    margin: 0;
    font-size: 1.1rem;
}

.term-plan-subject {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.term-plan-confirm {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.term-plan-resource {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.6rem 0;
    border-top: 1px solid var(--tlt-color-border);
}

.term-plan-resource-main {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
}

.term-plan-resource-cover {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 3.25rem;
    border-radius: 4px;
    background: var(--tlt-color-bg);
    overflow: hidden;
}

.term-plan-resource-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.term-plan-resource-info {
    flex: 1 1 9rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.term-plan-resource-title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.term-plan-resource-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.term-plan-resource-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.term-plan-schedules {
    list-style: none;
    margin: 0;
    padding: 0 0 0 3.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.term-plan-schedule {
    font-size: 0.9rem;
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    flex-wrap: wrap;
}

.term-plan-unscheduled {
    padding-left: 3.25rem;
    margin: 0;
}

.term-plan-add-resource {
    align-self: flex-start;
}

.term-plan-library-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.75rem;
}

.term-plan-library-actions .plan-mode-note {
    flex: 1 1 100%;
    margin: 0;
}

/* Weeks-of-the-term chips in the schedule form */
.week-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.week-chip {
    min-width: 2.25rem;
    min-height: 2.25rem;
    padding: 0 0.5rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 8px;
    background: var(--tlt-color-surface);
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.week-chip:hover {
    border-color: var(--tlt-color-primary);
}

.week-chip--on {
    background: var(--tlt-color-primary);
    border-color: var(--tlt-color-primary);
    color: #fff;
}

@media (max-width: 40rem) {
    .term-plan-schedules,
    .term-plan-unscheduled {
        padding-left: 0;
    }

    .term-plan-resource-actions {
        margin-left: auto;
    }
}

/* ---- Term Planner: rhythm matrix (TermRhythmMatrix.razor), built on the Term Grid board/row/cell styles ---- */
.rhythm-course {
    margin: 1rem 0 0.4rem;
    font-size: 1rem;
}

.rhythm-message {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.rhythm-label {
    gap: 0.25rem;
}

.rhythm-title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.rhythm-days {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-top: 0.15rem;
}

.rhythm-day {
    padding: 0.1rem 0.4rem;
    min-height: 1.5rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 6px;
    background: var(--tlt-color-surface);
    color: var(--tlt-color-text-muted);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 400;
    cursor: pointer;
}

.rhythm-day:hover:not(:disabled) {
    border-color: var(--tlt-color-primary);
}

.rhythm-day--on {
    background: var(--tlt-color-primary);
    border-color: var(--tlt-color-primary);
    color: #fff;
}

.rhythm-day:disabled {
    opacity: 0.5;
    cursor: default;
}

.rhythm-week--current {
    color: var(--tlt-color-accent);
}

.rhythm-cell {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.rhythm-cell-days {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.rhythm-cell--on {
    background: color-mix(in srgb, var(--tlt-color-primary) 14%, var(--tlt-color-surface));
    border-color: color-mix(in srgb, var(--tlt-color-primary) 55%, var(--tlt-color-border));
    color: var(--tlt-color-text);
}

.rhythm-cell--off {
    background: transparent;
    border-style: dashed;
}

.rhythm-cell--off:hover,
.rhythm-cell--on:hover {
    border-color: var(--tlt-color-accent);
}

.rhythm-cell--locked {
    cursor: default;
    opacity: 0.55;
}

.rhythm-cell--locked:hover {
    border-color: inherit;
}

.rhythm-cell-done {
    position: absolute;
    top: 0.1rem;
    right: 0.25rem;
    font-size: 0.7rem;
    color: var(--tlt-color-success);
}

.rhythm-row--paused {
    opacity: 0.6;
}

.rhythm-row--busy {
    pointer-events: none;
    opacity: 0.7;
}

.rhythm-unscheduled {
    margin: -0.25rem 0 0.5rem;
}

/* Days the rhythm allows in a week where no lesson sits (yet) - lighter than real lessons. */
.rhythm-cell-days--projected {
    font-weight: 400;
    opacity: 0.45;
}

/* ---- Term Planner: week board (TermWeekBoard.razor), on top of the kanban-* board styles ---- */
.week-board-nav,
.week-board-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.week-board-range {
    font-weight: 600;
    margin-left: 0.5rem;
}

.week-board-row-label {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.week-board-cell {
    min-height: 4rem;
}

.week-board-chapter {
    font-size: 0.78rem;
    color: var(--tlt-color-text-muted);
}

.week-board-children {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.week-board-child {
    padding: 0 0.45rem;
    border: 1px solid var(--child-color, var(--tlt-color-border));
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--child-color, var(--tlt-color-text));
}

/* ---- Term Planner: day view (TermDayView.razor) ---- */
.week-board-day-header {
    border: 0;
    background: transparent;
    font: inherit;
    cursor: pointer;
}

.week-board-day-header:hover span:last-child {
    text-decoration: underline;
}

.day-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.day-strip-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    min-width: 4.5rem;
    padding: 0.4rem 0.7rem;
    border: 1px dashed var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
}

.day-strip-day:hover {
    border-color: var(--tlt-color-accent);
}

.day-strip-day--today {
    border-color: var(--tlt-color-accent);
}

.day-strip-day--current {
    border-style: solid;
    background: var(--tlt-color-primary);
    border-color: var(--tlt-color-primary);
    color: #fff;
}

.day-strip-count {
    font-weight: 600;
}

.day-strip-day--unscheduled {
    justify-content: center;
    cursor: default;
}

.day-columns {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    align-items: start;
}

.day-column {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.day-column-title {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    margin: 0;
    padding-bottom: 0.3rem;
    border-bottom: 3px solid var(--child-color, var(--tlt-color-accent));
}

.day-column-form {
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--tlt-color-text-muted);
}

.day-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
    cursor: grab;
}

.day-card[draggable="false"] {
    cursor: default;
    opacity: 0.75;
}

.day-card-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    cursor: pointer;
}

.day-card-course {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--tlt-color-text-muted);
}

.day-card-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: flex-end;
}

.day-card-field {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1 1 5.5rem;
}

.day-card-field input {
    width: 100%;
}

.day-card-move {
    display: flex;
    gap: 0.1rem;
    margin-left: auto;
}

.day-card-move .btn-link {
    font-size: 1.4rem;
    line-height: 1;
    padding: 0 0.4rem;
}

/* The Term Planner panel: trimmed padding so the boards get the room. */
.card.term-grid-card {
    padding: 1.25rem 1rem 1.5rem;
}

/* ---- Term Planner: Week Builder (TermWeekBuilder.razor) ---- */
.week-builder-switch {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.week-builder-layout {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.week-builder-bin {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    padding: 0.75rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
}

.week-builder-bin-title {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.week-builder-bin-section {
    margin-bottom: 0.75rem;
}

.week-builder-bin-section summary {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.week-builder-bin-cards {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.week-builder-add-form {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
}

/* A card: tinted with its subject's colour, edged with its Form's colour. */
.week-card {
    --subject-color: #888;
    --form-color: transparent;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.3rem 0.45rem 0.3rem 0.6rem;
    border: 1px solid var(--subject-color);
    border-left: 6px solid var(--form-color, var(--subject-color));
    border-radius: 6px;
    background: color-mix(in srgb, var(--subject-color) 20%, var(--tlt-color-surface));
    color: var(--tlt-color-text);
    font-size: 0.82rem;
    cursor: grab;
    overflow: hidden;
}

.week-card--bin {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.week-card-swatch {
    flex: 0 0 auto;
    width: 0.9rem;
    height: 0.9rem;
    padding: 0;
    border: 2px solid var(--tlt-color-surface);
    border-radius: 50%;
    background: var(--subject-color);
    box-shadow: 0 0 0 1px var(--subject-color);
    cursor: pointer;
}

.week-color-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.25rem 0.1rem;
}

.week-color-choice {
    width: 1.3rem;
    height: 1.3rem;
    padding: 0;
    border: 2px solid var(--tlt-color-surface);
    border-radius: 50%;
    cursor: pointer;
}

.week-color-choice--on {
    box-shadow: 0 0 0 2px var(--tlt-color-text);
}

.week-card-name {
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.week-form-badge {
    --form-color: #888;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.2rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    background: var(--form-color);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

.week-builder-templates {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.week-builder-template-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.week-builder-name {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 12rem;
}

.week-builder-applies {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.week-builder-applies-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tlt-color-text-muted);
}

.week-builder-template-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-left: auto;
}

.week-builder-range {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
    margin: 0.5rem 0;
}

.week-builder-range label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.85rem;
}

.week-builder-warning {
    color: var(--tlt-color-accent);
}

.week-builder-clashes {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin: 0.5rem 0;
}

.week-builder-clash {
    margin: 0;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
}

.week-builder-clash--parent {
    background: color-mix(in srgb, #c9544d 15%, var(--tlt-color-surface));
    border: 1px solid #c9544d;
}

.week-builder-clash--form {
    background: color-mix(in srgb, #d9a21b 18%, var(--tlt-color-surface));
    border: 1px solid #d9a21b;
}

/* The time grid: an hour-label column, then one column per day. Each day is a CSS grid of 15-minute rows; cards are placed by grid-row. */
.week-grid {
    display: grid;
    gap: 0 0.35rem;
    overflow-x: auto;
}

.week-grid-day-header {
    position: sticky;
    top: 0;
    z-index: 3;
    padding: 0.3rem 0;
    text-align: center;
    font-weight: 600;
    background: var(--tlt-color-surface);
}

.week-grid-hours {
    display: grid;
}

.week-grid-hour {
    font-size: 0.7rem;
    color: var(--tlt-color-text-muted);
    text-align: right;
    padding-right: 0.3rem;
    line-height: 1;
}

.week-grid-day {
    display: grid;
    column-gap: 2px;
    border-left: 1px solid var(--tlt-color-border);
    border-right: 1px solid var(--tlt-color-border);
    background: var(--tlt-color-surface);
}

.week-grid-slot {
    border-top: 1px dotted color-mix(in srgb, var(--tlt-color-border) 60%, transparent);
}

.week-grid-slot--hour {
    border-top: 1px solid var(--tlt-color-border);
}

.week-grid-slot:hover {
    background: color-mix(in srgb, var(--tlt-color-primary) 10%, transparent);
}

.week-card--placed {
    z-index: 1;
    margin: 1px 0;
    padding-top: 0.2rem;
}

.week-card--parent-clash {
    outline: 2px solid #c9544d;
    outline-offset: -1px;
}

.week-card--form-clash {
    box-shadow: inset 0 0 0 2px #d9a21b;
}

.week-card-head {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
}

.week-card-head .week-card-name {
    flex: 1 1 auto;
}

.week-card-time {
    font-size: 0.7rem;
    color: var(--tlt-color-text-muted);
}

.week-card-course {
    font-size: 0.72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.week-card-course--empty {
    font-style: italic;
    color: var(--tlt-color-text-muted);
}

.week-card-tools {
    display: flex;
    align-items: center;
    gap: 0.15rem;
    margin-top: auto;
}

.week-card-icon,
.week-card-involvement {
    padding: 0 0.3rem;
    min-width: 1.2rem;
    height: 1.2rem;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: 0.75rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.75;
}

.week-card-icon:hover,
.week-card-involvement:hover {
    opacity: 1;
    background: color-mix(in srgb, var(--tlt-color-text) 12%, transparent);
}

.week-card-involvement {
    margin-right: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 5.5rem;
}

.week-card-involvement--on {
    opacity: 1;
    font-weight: 600;
}

.week-builder-totals {
    margin-top: 1rem;
}

.week-builder-totals h4 {
    margin: 0 0 0.4rem;
}

.week-builder-total-row {
    margin: 0.15rem 0;
    font-size: 0.88rem;
}

.week-builder-total-parent {
    color: var(--tlt-color-text-muted);
}

/* Short cards have no room for their tools: show them as an overlay on hover or keyboard focus. */
.week-card--compact .week-card-tools {
    position: absolute;
    right: 2px;
    bottom: 2px;
    display: none;
    padding: 1px 2px;
    border-radius: 4px;
    background: var(--tlt-color-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

.week-card--compact:hover .week-card-tools,
.week-card--compact:focus-within .week-card-tools {
    display: flex;
}

/* ---- Term Planner: slim page bar + single-row builder toolbar, board fills the window ---- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.card.term-grid-card {
    padding: 0.6rem 0.75rem 0.9rem;
}

.tg-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.75rem;
    margin-bottom: 0.5rem;
}

.tg-seg {
    display: inline-flex;
    gap: 0.25rem;
}

.tg-bar button,
.tg-bar .tg-pop > summary,
.wb-toolbar > button,
.wb-toolbar .tg-pop > summary {
    min-height: 1.8rem;
    padding: 0.15rem 0.65rem;
    font-size: 0.82rem;
    line-height: 1.2;
}

.tg-bar .tg-pop > summary {
    font-family: inherit;
    font-weight: 500;
}

.tg-bar select {
    min-height: 1.8rem;
    height: 1.8rem;
    padding: 0 1.6rem 0 0.6rem;
    font-size: 0.82rem;
    width: auto;
    margin: 0;
}

.tg-action {
    margin-left: auto;
}

/* Small dropdown panels (no JS - <details>; site.js closes them on outside click / Escape). */
.tg-pop {
    position: relative;
}

.tg-pop > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    cursor: pointer;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    white-space: nowrap;
}

.tg-pop > summary::-webkit-details-marker {
    display: none;
}

.tg-pop[open] > summary,
.tg-pop > summary:hover {
    border-color: var(--tlt-color-primary);
}

.tg-pop-panel {
    position: absolute;
    top: calc(100% + 0.25rem);
    left: 0;
    z-index: 30;
    min-width: 16rem;
    max-width: 26rem;
    padding: 0.75rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tg-pop-panel--row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-end;
}

.tg-pop-panel label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.82rem;
}

.tg-pop-panel .tg-pop-check {
    flex-direction: row;
    align-items: center;
}

.tg-pop-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.wb-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.4rem;
}

.wb-clash-chip {
    border-color: #c9544d !important;
    color: #c9544d !important;
    font-weight: 600;
}

/* The planning area owns the window height: the grid scrolls inside it, the bin scrolls beside it. */
.week-builder-layout {
    height: calc(100vh - var(--wb-top, 9.6rem));
    min-height: 22rem;
    grid-template-columns: 13rem minmax(0, 1fr);
    gap: 0.75rem;
}

.week-builder {
    --slot-h: clamp(0.95rem, calc((100vh - 14rem) / var(--slots, 32)), 1.45rem);
}

.week-builder-bin {
    position: static;
    height: 100%;
    max-height: none;
    padding: 0.5rem;
}

.week-builder-main {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.week-grid-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.week-builder-totals {
    flex: 0 0 auto;
    margin-top: 0.4rem;
    font-size: 0.85rem;
}

.week-builder-totals > summary {
    cursor: pointer;
    font-weight: 600;
}

.week-builder-bin-title {
    font-size: 0.9rem;
}

.week-builder-bin-section {
    margin-bottom: 0.4rem;
}

.week-builder-bin .plan-mode-note {
    font-size: 0.75rem;
    margin: 0 0 0.3rem;
}

/* ---- Week Builder: Apply modal, budget gauge ---- */
.wb-apply {
    margin-left: auto;
}

.apply-plan-modal {
    max-width: 46rem;
    width: 100%;
}

.apply-plan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin: 0.5rem 0;
}

.apply-plan-table th,
.apply-plan-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--tlt-color-border);
    text-align: left;
}

.apply-plan-table th:not(:first-child),
.apply-plan-table td:not(:first-child) {
    text-align: right;
    width: 5.5rem;
}

.apply-plan-table tfoot td {
    font-weight: 700;
}

.apply-plan-warnings {
    margin: 0.5rem 0;
    padding-left: 1.1rem;
    font-size: 0.85rem;
    color: var(--tlt-color-text);
}

.apply-plan-warnings li {
    margin: 0.2rem 0;
}

.apply-plan-occupations {
    margin: 0.75rem 0;
    padding: 0.6rem 0.75rem;
    border: 1px dashed var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
}

.apply-plan-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.week-budget {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
}

.week-budget input {
    width: 4rem;
    min-height: 1.6rem;
    padding: 0 0.3rem;
}

.week-budget-bar {
    display: inline-block;
    width: 6rem;
    height: 0.5rem;
    margin: 0 0.4rem;
    border-radius: 999px;
    background: var(--tlt-color-border);
    vertical-align: middle;
    overflow: hidden;
}

.week-budget-bar > span {
    display: block;
    height: 100%;
    background: var(--tlt-color-primary);
}

.week-budget-bar--over > span {
    background: #c9544d;
}

/* ---- Week Builder: day focus + drag-to-resize edges ---- */
.week-grid-day-header--btn {
    border: 0;
    border-bottom: 2px solid transparent;
    font: inherit;
    font-weight: 600;
    color: var(--tlt-color-text);
    cursor: pointer;
}

.week-grid-day-header--btn:hover {
    border-bottom-color: var(--tlt-color-accent);
}

.week-grid-day-header--focus {
    background: var(--tlt-color-primary);
    color: #fff;
}

.week-card-resize {
    position: absolute;
    left: 0;
    right: 0;
    height: 6px;
    cursor: ns-resize;
    touch-action: none;
    z-index: 3;
}

.week-card-resize--top {
    top: 0;
}

.week-card-resize--bottom {
    bottom: 0;
}

/* A small grip so the edges announce themselves on hover. */
.week-card-resize::after {
    content: "";
    position: absolute;
    left: 50%;
    width: 1.6rem;
    height: 3px;
    margin-left: -0.8rem;
    border-radius: 2px;
    background: currentColor;
    opacity: 0;
    transition: opacity 0.12s;
}

.week-card-resize--top::after {
    top: 1px;
}

.week-card-resize--bottom::after {
    bottom: 1px;
}

.week-card:hover .week-card-resize::after,
.week-card-resize:focus-visible::after,
.week-card--resizing .week-card-resize::after {
    opacity: 0.55;
}

.week-card--resizing {
    box-shadow: 0 0 0 2px var(--tlt-color-primary);
    user-select: none;
}

.week-card--resizing::after {
    content: attr(data-live);
    position: absolute;
    top: 2px;
    right: 4px;
    padding: 0 0.35rem;
    border-radius: 4px;
    background: var(--tlt-color-primary);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 4;
    pointer-events: none;
}

/* Instant tooltip for the Week Builder card buttons (created by weekGridResize.js, so cards can't clip it). */
.wb-tooltip,
.tlt-tooltip {
    position: fixed;
    z-index: 2000;
    max-width: 17rem;
    padding: 0.3rem 0.55rem;
    border-radius: 6px;
    background: var(--tlt-color-text);
    color: var(--tlt-color-surface);
    font-size: 0.78rem;
    line-height: 1.3;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.tg-pop-panel {
    max-width: min(26rem, calc(100vw - 1rem));
}

/* ---- Term Planner pass 3: the Plan tab (audience + subject + books) ---- */
.plan-audiences {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.plan-audiences > button {
    min-height: 1.8rem;
    padding: 0.15rem 0.7rem;
    font-size: 0.85rem;
}

.plan-audiences .tg-pop > summary {
    min-height: 1.8rem;
    padding: 0.15rem 0.7rem;
    font-size: 0.85rem;
}

.plan-audience-menu {
    min-width: 12rem;
    gap: 0.15rem;
    max-height: 22rem;
    overflow-y: auto;
}

.plan-audience-menu strong {
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: var(--tlt-color-text-muted);
}

.plan-audience-menu .btn-link {
    text-align: left;
}

.plan-entries {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr));
    align-items: start;
    margin-bottom: 1rem;
}

.plan-entry {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 12px;
    background: var(--tlt-color-surface);
}

.plan-entry-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.plan-entry-title {
    margin: 0;
    font-size: 1.05rem;
}

.plan-book {
    padding: 0.4rem 0;
    border-top: 1px solid var(--tlt-color-border);
}

.plan-add-subject {
    display: inline-flex;
    flex-direction: column;
    gap: 0.25rem;
    max-width: 22rem;
    margin-right: 1rem;
}


/* ---- Books (a book is the work; its copies are editions) ---- */
.book-page { display: flex; flex-direction: column; gap: 1.25rem; }
.book-back { align-self: flex-start; }
.book-header { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.book-cover { width: 140px; height: 200px; object-fit: cover; border-radius: 6px; border: 1px solid var(--tlt-color-border); flex-shrink: 0; }
.book-cover--placeholder { display: grid; place-items: center; font-size: 2.5rem; background: var(--tlt-color-surface-alt, rgba(127,127,127,.08)); }
.book-header-fields { flex: 1 1 18rem; display: flex; flex-direction: column; gap: 0.75rem; }
.book-header-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.book-section h2 { margin-bottom: 0.5rem; }
.book-editions, .book-plans { list-style: none; padding: 0; margin: 0 0 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.book-edition { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; padding: 0.5rem 0; border-bottom: 1px solid var(--tlt-color-border); }
.book-edition-detail { flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; }
.book-edition-actions { display: flex; gap: 0.5rem; align-items: center; }
.book-add-editions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.book-add-form { display: flex; flex-direction: column; gap: 0.75rem; max-width: 28rem; }
.book-plan { display: flex; gap: 0.75rem; align-items: baseline; flex-wrap: wrap; }
.book-plan-count { color: var(--tlt-color-text-muted, inherit); font-size: 0.9em; }
.book-edition-badges { display: flex; gap: 0.35rem; flex-wrap: wrap; margin: 0.25rem 0; }
.book-no-editions { font-size: 0.85em; opacity: 0.7; }

/* ---- Book chapters (the Book's own outline) ---- */
.book-chapters { list-style: none; padding: 0; margin: 0 0 0.75rem; display: flex; flex-direction: column; }
.book-chapter { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; padding: 0.4rem 0; border-bottom: 1px solid var(--tlt-color-border); }
.book-chapter-index { min-width: 1.75rem; color: var(--tlt-color-text-muted, inherit); font-variant-numeric: tabular-nums; text-align: right; }
.book-chapter-title { flex: 1 1 12rem; min-width: 0; text-align: left; background: none; border: none; padding: 0; font: inherit; color: inherit; cursor: text; overflow-wrap: anywhere; }
.book-chapter-title:hover { text-decoration: underline dotted; }
.book-chapter-locators { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.book-chapter-actions { display: flex; gap: 0.15rem; }
.book-chapter-edit { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.book-pages-input { width: 6.5rem; }
/* The physical copy's pages are an editable chip: same shape as the other copy badges, but outlined (the filled badge colour is for read-only facts). */
.book-locator--button { cursor: pointer; background: transparent; color: inherit; border: 1px solid var(--tlt-color-border); font: inherit; font-size: 0.75em; letter-spacing: 0.04em; text-transform: uppercase; }
.book-locator--button:hover { border-color: currentColor; }

/* ---- Lesson pop-up: resources the lesson reaches in other copies of its Book (Source Mapping) ---- */
.lesson-mapped-resources { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.75rem 0; padding-top: 0.5rem; border-top: 1px solid var(--tlt-color-border); }
.lesson-mapped-line { margin: 0; }
.lesson-mapped-note { color: var(--tlt-color-text-muted, inherit); font-size: 0.9em; }
.lesson-mapped-audio { display: flex; flex-direction: column; gap: 0.25rem; }

/* ---- Connect a Book to a lesson plan (match review) ---- */
.connect-modal { width: min(41rem, calc(100vw - 2rem)); max-width: none; }
.connect-books { list-style: none; padding: 0; margin: 0.5rem 0 1rem; max-height: 14rem; overflow-y: auto; border: 1px solid var(--tlt-color-border); border-radius: 6px; }
.connect-book-row { display: flex; gap: 0.75rem; align-items: baseline; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--tlt-color-border); padding: 0.5rem 0.75rem; font: inherit; color: inherit; cursor: pointer; }
.connect-book-row:hover { background: var(--tlt-color-surface-alt, rgba(127,127,127,.08)); }
.connect-book-author { color: var(--tlt-color-text-muted, inherit); font-size: 0.9em; }
.connect-new-book { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.connect-table-wrap { max-height: 55vh; overflow: auto; }
.connect-table { width: auto; max-width: 100%; border-collapse: collapse; }
.connect-table th, .connect-table td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--tlt-color-border); vertical-align: top; }
.connect-lesson { overflow-wrap: anywhere; min-width: 10rem; max-width: 15rem; padding-right: 1.75rem; }
.connect-chapter select { min-width: 16rem; max-width: 100%; width: auto; }
.connect-chapters { display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-start; }
.connect-chapter { display: inline-flex; gap: 0.35rem; align-items: center; }
.connect-mark-col { width: 2.5rem; text-align: center; }
.connect-mark { font-weight: 700; }
.connect-mark--sure { color: var(--tlt-color-success, #2e7d32); }
.connect-mark--guess { color: var(--tlt-color-warning, #b26a00); }
.connect-mark--none { opacity: 0.5; }
.connect-note { text-transform: none; letter-spacing: normal; font-size: 0.95rem; line-height: 1.45; margin: 0.25rem 0 0.75rem; }

/* ---- Lesson plan picker (search, not a list) ---- */
.planpick-modal { max-width: 46rem; }
.planpick-search { position: relative; display: flex; align-items: center; margin: 0.25rem 0 0.5rem; }
.planpick-search-icon { position: absolute; left: 0.75rem; opacity: 0.6; display: inline-flex; pointer-events: none; }
.planpick-search input { width: 100%; padding-left: 2.4rem; font-size: 1.05rem; }
.planpick-filters { margin-bottom: 0.25rem; }
.planpick-status { margin: 0.25rem 0 0.5rem; font-size: 0.85rem; color: var(--tlt-color-text-muted, inherit); min-height: 1.2em; }
.planpick-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow-y: auto; border: 1px solid var(--tlt-color-border); border-radius: 6px; }
.planpick-list li + li { border-top: 1px solid var(--tlt-color-border); }
.planpick-row { display: flex; flex-direction: column; gap: 0.2rem; width: 100%; text-align: left; background: none; border: none; padding: 0.6rem 0.8rem; font: inherit; color: inherit; cursor: pointer; }
.planpick-row--active, .planpick-row:hover { background: var(--tlt-color-surface-alt, rgba(127,127,127,.1)); }
.planpick-main { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; }
.planpick-title { font-weight: 600; overflow-wrap: anywhere; }
.planpick-meta { font-size: 0.85rem; color: var(--tlt-color-text-muted, inherit); }
.planpick-match { font-size: 0.85rem; font-style: italic; }
.planpick-connected { font-size: 0.85rem; color: var(--tlt-color-success, #2e7d32); }
.planpick-connected--other { color: var(--tlt-color-text-muted, inherit); }
.planpick-more { margin-top: 0.6rem; }
.planpick-hint { margin: 0.75rem 0 0; font-size: 0.8rem; color: var(--tlt-color-text-muted, inherit); }


/* ---- Things (saved links, uploaded files, documents kept on purpose) ---- */
.library-card--thing { position: relative; }
.library-card--thing .book-folder-btn { align-self: flex-end; margin-top: auto; }
.thing-cover-glyph { display: grid; place-items: center; font-size: 2.5rem; }
.thing-purpose-chip { font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 999px; border: 1px solid var(--tlt-color-border); color: var(--tlt-color-text-muted); }
.thing-purpose-filter { margin-left: auto; display: inline-flex; }
.thing-purpose-filter select { min-width: 10rem; }

.thing-form { display: flex; flex-direction: column; gap: 0.75rem; }
.thing-form-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.thing-book-hint { margin: 0; font-size: 0.9em; }

.thing-link-preview { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.75rem; border: 1px solid var(--tlt-color-border); border-radius: var(--tlt-radius-sm); }
.thing-link-preview-image { width: 6rem; height: 4.5rem; object-fit: cover; border-radius: var(--tlt-radius-sm); flex-shrink: 0; }
.thing-link-preview-text { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; overflow-wrap: anywhere; }
.thing-link-preview-site { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--tlt-color-text-muted); }
.thing-link-preview-title { font-weight: 600; }
.thing-link-preview-description { font-size: 0.9em; color: var(--tlt-color-text-muted); }

.thing-page { display: flex; flex-direction: column; gap: 1.25rem; }
.thing-header { display: flex; flex-direction: column; gap: 0.75rem; align-items: flex-start; }
.thing-header-fields { align-self: stretch; max-width: 40rem; display: flex; flex-direction: column; gap: 0.75rem; }
.thing-document-title { margin: 0; }
.thing-preview { display: flex; flex-direction: column; gap: 0.75rem; align-items: flex-start; }
.thing-link-card { display: flex; gap: 0.75rem; align-items: flex-start; width: 100%; max-width: 40rem; padding: 0.75rem; border: 1px solid var(--tlt-color-border); border-radius: var(--tlt-radius-sm); color: inherit; text-decoration: none; }
.thing-link-card:hover { border-color: currentColor; }
.thing-image { max-width: 100%; max-height: 70vh; border-radius: var(--tlt-radius-sm); border: 1px solid var(--tlt-color-border); }
.thing-pdf { width: 100%; height: 70vh; border: 1px solid var(--tlt-color-border); border-radius: var(--tlt-radius-sm); }
.thing-audio { width: 100%; max-width: 40rem; }
.thing-video { width: 100%; max-width: 48rem; border-radius: var(--tlt-radius-sm); }
.thing-document-note, .thing-file-meta { margin: 0; color: var(--tlt-color-text-muted); font-size: 0.9em; }
.thing-open-btn { display: inline-block; text-decoration: none; }


/* ---- Plan attachments: attach modal, sidebar panel, lesson pop-up layers, Thing pop-up sizes ---- */
.attach-modal { width: min(34rem, calc(100vw - 2rem)); }
.attach-tabs { margin-bottom: 0.75rem; }
.attach-quick-add { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.5rem 0; }
.attach-pick-list { display: flex; flex-direction: column; gap: 0.25rem; max-height: 14rem; overflow-y: auto; margin: 0.5rem 0; }
.attach-existing-title { font-weight: 600; margin: 0 0 0.5rem; overflow-wrap: anywhere; }
.attach-scope { margin: 0.75rem 0; display: flex; flex-direction: column; gap: 0.5rem; }
.attach-scope-summary { margin: 0; overflow-wrap: anywhere; }
.attach-display { margin: 0.5rem 0; display: flex; flex-direction: column; gap: 0.5rem; }

.attachments-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; }
.attachments-panel-head h2 { margin: 0; }
.attachments-empty { font-size: 0.9em; color: var(--tlt-color-text-muted); margin: 0.25rem 0 0.5rem; }
.attachment-list { list-style: none; padding: 0; margin: 0.5rem 0; display: flex; flex-direction: column; gap: 0.25rem; }
.attachment-row { display: flex; gap: 0.5rem; align-items: flex-start; justify-content: space-between; padding: 0.4rem 0; border-bottom: 1px solid var(--tlt-color-border); }
.attachment-row--gone { opacity: 0.6; }
.attachment-row-main { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.attachment-row-title { font-weight: 600; }
.attachment-row-meta { font-size: 0.8rem; color: var(--tlt-color-text-muted); }
.attachment-row-actions { display: flex; gap: 0.15rem; flex-shrink: 0; }
.attachments-plan-modes summary { cursor: pointer; font-size: 0.9em; }
.attachments-modes-form { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.settings-opening-form { display: flex; flex-direction: column; gap: 0.75rem; max-width: 24rem; }

.lesson-attachments { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.75rem 0; padding: 0.5rem 0; border-top: 1px solid var(--tlt-color-border); }
.lesson-attachments--general { border-top: none; border-bottom: 1px solid var(--tlt-color-border); }
.lesson-attachments-heading { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--tlt-color-text-muted); margin: 0; }
.lesson-attachment { display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
.lesson-attachment-open { background: none; border: none; padding: 0.15rem 0; font: inherit; color: inherit; text-decoration: underline dotted; cursor: pointer; text-align: left; overflow-wrap: anywhere; }
.lesson-attachment-open:hover { text-decoration: underline; }
.lesson-attachment-note { margin: 0; }

.thing-viewer { display: flex; flex-direction: column; gap: 0.75rem; align-items: flex-start; width: 100%; }
.thing-viewer--compact .thing-image { max-height: 60vh; }
.thing-viewer--compact .thing-pdf { height: 60vh; }
.thing-popup-backdrop { z-index: 130; }
.thing-popup { display: flex; flex-direction: column; gap: 0.75rem; }
.thing-popup-title { margin: 0 2rem 0 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.modal-content--thing-s { max-width: 22rem; }
.modal-content--thing-m { max-width: 38rem; }
.modal-content--thing-l { max-width: 62rem; width: 94vw; }
.modal-content--thing-full { max-width: none; width: 96vw; height: 94vh; max-height: 94vh; }
.modal-content--thing-full .thing-pdf { height: calc(94vh - 7rem); }
.modal-content--thing-full .thing-image { max-height: calc(94vh - 7rem); }


/* ---- Item-type mark: the dog ear that says Document / Book / Thing (single-colour outline; the shape differs, never a colour) ---- */
.document-grid-tile, .library-card { position: relative; }
.item-corner {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3;
    width: 36px;
    height: 36px;
    line-height: 0;
    color: var(--tlt-color-primary);
    border-top-left-radius: var(--tlt-radius);
    overflow: hidden;
    pointer-events: none;
}
.item-corner svg { display: block; }
.item-corner-fill { fill: color-mix(in srgb, var(--tlt-color-primary) 22%, var(--tlt-color-surface)); }
.item-corner-fold { fill: none; stroke: color-mix(in srgb, var(--tlt-color-primary) 55%, transparent); stroke-width: 1; }
.item-corner + .doc-kind-badge { margin-left: 0.6rem; }
.item-mark { display: inline-flex; align-items: center; gap: 0.3rem; margin-right: 0.4rem; color: var(--tlt-color-primary); vertical-align: -0.2em; line-height: 1; }
.item-mark-label { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.search-result-item .item-mark { margin-right: 0.5rem; }
.document-kind-tile-icon svg, .library-add-icon svg { display: block; margin: 0 auto; }
.doc-kind-badge svg { vertical-align: -0.15em; }


/* ---- Plan workspace: Lesson Plan | Books | closeable tabs (doc 2 s.8-9, 31-33) ---- */
.workspace-strip { overflow-x: auto; }
.workspace-tabs { flex-wrap: nowrap; }
.workspace-tab { display: inline-flex; align-items: center; border-radius: var(--tlt-radius-sm); }
.workspace-tab .tab { max-width: 14rem; display: inline-flex; align-items: center; gap: 0.35rem; }
.workspace-tab-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-tab-close { background: none; border: none; padding: 0 0.4rem; font-size: 1.1rem; line-height: 1; cursor: pointer; color: var(--tlt-color-text-muted); }
.workspace-tab-close:hover { color: var(--tlt-color-text); }
.document-main--tabbed > .workspace-panel { flex: 1; min-height: 0; overflow-y: auto; padding: 0 3rem 2rem; }
.document-main--tabbed > .workspace-panel--pdf:not(.tab-panel-hidden) { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.workspace-pdf { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.workspace-pdf > .pdf-viewer-root { flex: 1; min-height: 0; }
.workspace-pdf-hint { margin: 0 0 0.5rem; font-size: 0.9em; color: var(--tlt-color-text-muted); }
.workspace-thing, .workspace-document, .workspace-audio { display: flex; flex-direction: column; gap: 0.75rem; align-items: flex-start; }
.workspace-thing-title { margin: 0; display: flex; align-items: center; gap: 0.4rem; }

.workspace-section { margin: 0 0 1.5rem; }
.workspace-section h2, .workspace-section h3 { margin: 0 0 0.5rem; }
.workspace-lessons-hint { margin: 0 0 0.5rem; }
.workspace-book-list, .workspace-lesson-list, .workspace-edition-list, .workspace-chapter-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.workspace-book { display: flex; gap: 0.75rem; align-items: center; padding: 0.5rem 0; border-bottom: 1px solid var(--tlt-color-border); }
.workspace-book-cover { width: 3rem; height: 4rem; object-fit: cover; border-radius: var(--tlt-radius-sm); border: 1px solid var(--tlt-color-border); flex-shrink: 0; }
.workspace-book-cover--placeholder { display: grid; place-items: center; background: var(--tlt-color-bg); color: var(--tlt-color-text-muted); }
.workspace-book-info { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.workspace-book-title { background: none; border: none; padding: 0; font: inherit; font-weight: 600; text-align: left; cursor: pointer; color: inherit; text-decoration: underline dotted; overflow-wrap: anywhere; }
.workspace-book-title:hover { text-decoration: underline; }
.workspace-book-author { color: var(--tlt-color-text-muted); font-size: 0.9em; }
.workspace-book-editions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.workspace-lesson, .workspace-chapter, .workspace-edition { display: flex; gap: 0.75rem; align-items: baseline; flex-wrap: wrap; padding: 0.45rem 0; border-bottom: 1px solid var(--tlt-color-border); }
.workspace-lesson-title, .workspace-chapter-title { flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere; }
.workspace-chips { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.workspace-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.6rem; border: 1px solid var(--tlt-color-border); border-radius: 999px; background: var(--tlt-color-surface); color: inherit; font: inherit; font-size: 0.85rem; cursor: pointer; text-decoration: none; }
.workspace-chip:hover { border-color: currentColor; }
.workspace-chip--static { cursor: default; }
.workspace-chip--static:hover { border-color: var(--tlt-color-border); }
.workspace-book-header { display: flex; gap: 0.75rem; align-items: baseline; flex-wrap: wrap; margin-bottom: 1rem; }
.workspace-book-header h2 { margin: 0; }
.attachment-row-open { background: none; border: none; padding: 0; font: inherit; text-align: left; cursor: pointer; color: inherit; overflow-wrap: anywhere; }
.attachment-row-open:hover { text-decoration: underline; }
.lesson-workspace-link { font-size: 0.85rem; margin-left: 0.5rem; }

/* Per-child working copies (doc 1 s.18) */
.working-copy-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--tlt-color-border);
  border-radius: 8px;
  background: var(--tlt-color-bg);
  color: var(--tlt-color-text);
  font-size: 0.9rem;
}
.working-copy-banner-text { display: flex; align-items: flex-start; gap: 0.5rem; flex: 1 1 14rem; }
.working-copy-banner-text svg { flex: none; margin-top: 0.15rem; }
.working-copy-banner .btn-link { margin-left: auto; }
.working-copies-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin: 0.5rem 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--tlt-color-border);
  border-radius: 8px;
  font-size: 0.9rem;
}
.week-card-icon--on { color: var(--tlt-color-accent); }
.plan-group-activity { margin-top: 0.5rem; }

/* Partial mapping inside a chapter */
.connect-part { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; margin: 0.15rem 0 0.35rem 0.25rem; font-size: 0.9rem; }
.tlt-form .connect-part input[type="number"], .connect-part input[type="number"] { width: 4.5rem; flex: none; padding: 0.25rem 0.4rem; }
.connect-part-label, .connect-part-of { color: var(--tlt-color-text-muted); }
.connect-part--invalid input { border-color: #b3261e; }
.connect-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.9rem; padding: 0; border: 1px solid var(--tlt-color-border); border-radius: 6px; background: transparent; color: var(--tlt-color-text-muted); cursor: pointer; }
.connect-icon-btn:hover, .connect-icon-btn:focus-visible { color: var(--tlt-color-text); background: rgba(127, 127, 127, 0.12); }
.connect-seg { display: inline-flex; gap: 0; margin: 0 0 0.35rem 0.25rem; }
.connect-seg button { padding: 0.2rem 0.65rem; font-size: 0.82rem; border-radius: 0; }
.connect-seg button:first-child { border-radius: 6px 0 0 6px; }
.connect-seg button:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.connect-part-error { display: block; margin: 0 0 0.35rem 0.25rem; color: #b3261e; font-size: 0.85rem; }
.connect-part-note { display: block; margin: 0 0 0.35rem 0.25rem; color: var(--tlt-color-text-muted); font-size: 0.85rem; }
.connect-split { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem; margin: 0.5rem 0; font-size: 0.9rem; }
.lesson-pdf-range { margin: 0 0 0.5rem; font-size: 0.9rem; color: var(--tlt-color-text-muted); }

/* Connect a Book: narrow screens - each lesson becomes a stacked block (title, its chapters, the match mark pinned top-right) so nothing is
   cut off at the right edge. */
@media (max-width: 40rem) {
    .connect-modal { padding-left: 1rem; padding-right: 1rem; }
    .connect-table-wrap { max-height: none; overflow-x: hidden; }
    .connect-table, .connect-table tbody, .connect-table tr, .connect-table td { display: block; width: 100%; max-width: none; }
    .connect-table thead { display: none; }
    .connect-table tr { position: relative; padding: 0.6rem 2.25rem 0.6rem 0; border-bottom: 1px solid var(--tlt-color-border); }
    .connect-table td { border: none; padding: 0.1rem 0; }
    .connect-lesson { min-width: 0; max-width: none; padding-right: 0; font-weight: 600; }
    .connect-table td.connect-mark-col { position: absolute; top: 0.6rem; right: 0; width: auto; padding: 0; }
    .connect-chapters { align-items: stretch; width: 100%; }
    .connect-chapter { display: flex; width: 100%; }
    .connect-chapter select { min-width: 0; width: 100%; flex: 1 1 auto; }
    .connect-part { margin-left: 0; }
    .connect-seg { margin-left: 0; }
    .connect-part-error, .connect-part-note { margin-left: 0; }
}

/* Book PDF tab tools (chapter jump, search, edit chapters) */
.workspace-pdf-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.75rem; margin: 0 0 0.5rem; }
.pdf-highlight-delete { margin-top: 0.5rem; font-size: 0.85rem; }

/* Books shelf: favourite star */
.book-favorite-btn { color: var(--tlt-color-text-muted); }
.book-favorite-btn--on { color: var(--tlt-color-accent); }
.book-favorite-btn--on svg path { fill: currentColor; }

/* Merge duplicate books */
.library-duplicates { margin: 0 0 1rem; padding: 0.6rem 0.8rem; border: 1px solid var(--tlt-color-border); border-radius: 8px; font-size: 0.9rem; }
.library-duplicates-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.35rem; }
.merge-book-list { list-style: none; margin: 0.5rem 0; padding: 0; max-height: 16rem; overflow-y: auto; border: 1px solid var(--tlt-color-border); border-radius: 6px; }
.merge-book-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 0.5rem 0; }
.merge-book-side { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.6rem 0.75rem; border: 1px solid var(--tlt-color-border); border-radius: 8px; }
.merge-book-side--keep { border-color: var(--tlt-color-accent); }
.merge-book-label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--tlt-color-text-muted); }
@media (max-width: 40rem) { .merge-book-compare { grid-template-columns: 1fr; } }

/* ---- Shared plans: "Book not connected" and the share preview ---- */
.book-not-connected {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 0.9rem 1rem;
    margin-bottom: 1rem;
    background: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-left: 3px solid var(--tlt-color-accent);
    border-radius: var(--tlt-radius-sm);
    overflow-wrap: anywhere;
}

.book-not-connected h2 {
    margin-top: 0;
}

.library-not-connected-pill {
    display: inline-block;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    border: 1px dashed var(--tlt-color-accent);
    color: var(--tlt-color-accent);
    font-size: 0.78rem;
}

.library-not-connected-note {
    margin: 0 0 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 1px dashed var(--tlt-color-accent);
    border-radius: var(--tlt-radius-sm);
    font-size: 0.9rem;
}

.book-edition-share {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

.share-preview {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.75rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    margin-bottom: 0.75rem;
}

.share-preview-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.share-preview-edition {
    font-size: 0.88rem;
    padding-left: 0.75rem;
}

.share-preview-edition--travels {
    color: var(--tlt-color-success);
}

.share-preview-edition--stays {
    color: var(--tlt-color-text-muted);
}

/* ---- Share list (ShareItemsList): themed tick rows for what travels with a shared plan ---- */
.share-list {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.15rem;
}

.share-list .share-row > label.share-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin: 0;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--tlt-color-text);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.share-list .share-row > label.share-label:hover {
    background-color: color-mix(in srgb, var(--tlt-color-primary) 7%, transparent);
}

.share-check {
    appearance: none;
    flex: none;
    display: grid;
    place-content: center;
    width: 1.2rem;
    height: 1.2rem;
    margin: 0.12rem 0 0;
    border: 1.5px solid color-mix(in srgb, var(--tlt-color-text-muted) 70%, transparent);
    border-radius: 6px;
    background-color: var(--tlt-color-surface);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.share-check::before {
    content: "";
    width: 0.7rem;
    height: 0.7rem;
    background-color: var(--tlt-color-on-primary, #fff);
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
    transform: scale(0);
    transition: transform 0.12s ease;
}

.share-check:checked {
    border-color: var(--tlt-color-primary);
    background-color: var(--tlt-color-primary);
}

.share-check:checked::before {
    transform: scale(1);
}

.share-check:hover:not(:disabled) {
    border-color: var(--tlt-color-primary);
}

.share-check:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tlt-color-accent) 35%, transparent);
}

.share-check:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.share-main {
    flex: 1;
    min-width: 0;
    display: grid;
    gap: 0.15rem;
}

.share-line {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.5rem;
}

.share-title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.share-kind {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
}

.share-detail {
    font-size: 0.82rem;
    color: var(--tlt-color-text-muted);
    overflow-wrap: anywhere;
}

.share-pill {
    padding: 0.02rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--tlt-color-border);
    font-size: 0.72rem;
    color: var(--tlt-color-text-muted);
    white-space: nowrap;
}

.share-pill--new {
    border-color: color-mix(in srgb, var(--tlt-color-accent) 55%, transparent);
    background-color: color-mix(in srgb, var(--tlt-color-accent) 14%, transparent);
    color: var(--tlt-color-accent);
    font-weight: 600;
}

.share-state {
    flex: none;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
    white-space: nowrap;
}

.share-row--home .share-title {
    color: var(--tlt-color-text-muted);
    font-weight: 500;
}

.share-row--blocked > label.share-label {
    cursor: default;
}

.share-row--blocked .share-main,
.share-row--blocked .share-state {
    opacity: 0.5;
}

.share-row--nested {
    border-left: 2px solid var(--tlt-color-border);
    padding-left: 0.25rem;
}

.share-remembered {
    margin: 0 0 0.25rem;
}

/* ---- Calendar hub sections, Month view, Program board ---- */
.calendar-section-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    background: var(--tlt-color-border);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    overflow: hidden;
}

.month-weekday {
    background: var(--tlt-color-bg);
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--tlt-color-text-muted);
}

.month-day {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    min-height: 5.5rem;
    padding: 0.35rem 0.45rem;
    border: 0;
    background: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.month-day:hover {
    background: var(--tlt-color-bg);
}

.month-day--outside {
    background: var(--tlt-color-bg);
    color: var(--tlt-color-text-muted);
}

.month-day--today .month-day-number {
    background: var(--tlt-color-accent);
    color: var(--tlt-palette-white);
    border-radius: 999px;
    padding: 0 0.4rem;
}

.month-day-number {
    font-size: 0.85rem;
    font-weight: 600;
}

.month-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.78rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    border: 1px solid var(--child-color, var(--tlt-color-border));
}

.month-chip-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--child-color, var(--tlt-color-primary));
}

.month-chip-done {
    color: var(--tlt-color-success);
}

.month-note {
    font-size: 0.72rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--tlt-color-text-muted);
}

.month-note--birthday {
    color: var(--tlt-color-accent);
}

.program-board-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.9rem;
}

.program-who-filter {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.program-columns {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.program-column {
    flex: 0 0 15rem;
    min-height: 8rem;
    padding: 0.5rem;
    border: 1px dashed var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-bg);
}

.program-column--over {
    border-color: var(--tlt-color-accent);
    background: var(--tlt-color-surface);
}

.program-column-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
}

.program-column-title {
    font-family: var(--tlt-font-heading);
    font-size: 1.05rem;
}

.program-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0.6rem;
    margin-bottom: 0.5rem;
    background: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    cursor: grab;
}

.program-card--dragging {
    opacity: 0.5;
}

.program-card-title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.program-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    font-size: 0.78rem;
}

.program-frequency {
    padding: 0 0.4rem;
    border-radius: 999px;
    border: 1px solid var(--tlt-color-border);
}

.program-frequency-select {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.week-card-target {
    font-size: 0.72rem;
    color: var(--tlt-color-text-muted);
}

.week-card-target--short {
    color: var(--tlt-color-accent);
    font-weight: 600;
}

/* ---- Subject Areas ---- */
.subject-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.9rem;
}

.subject-area-block {
    margin-bottom: 1.25rem;
}

.subject-area-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--tlt-color-border);
}

.subject-area-title {
    margin: 0;
    font-family: var(--tlt-font-heading);
    font-size: 1.15rem;
}

.subject-area-swatch {
    width: 0.9rem;
    height: 0.9rem;
    border-radius: 50%;
    background: var(--tlt-color-border);
}

.subject-color-input {
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 1px solid var(--tlt-color-border);
    border-radius: 50%;
    background: none;
    cursor: pointer;
}

.subject-area-select {
    max-width: 11rem;
}

.subject-archived {
    opacity: 0.55;
    text-decoration: line-through;
}

.program-column-band {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--tlt-color-text-muted);
}

/* ---- Program creation paths ---- */
.guided-modal,
.import-modal {
    max-height: 90vh;
    overflow-y: auto;
}

.guided-audiences {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    align-items: center;
    margin: 0.5rem 0 1rem;
}

.guided-audience h3 {
    margin: 0.75rem 0 0.35rem;
    font-family: var(--tlt-font-heading);
}

.guided-area-title {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--tlt-color-text-muted);
}

.guided-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.15rem 0;
}

.guided-footer {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 1rem;
}

.import-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin: 0.5rem 0 1rem;
}

.import-table-wrap {
    overflow-x: auto;
    margin-bottom: 0.75rem;
}

.import-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.import-table th,
.import-table td {
    text-align: left;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--tlt-color-border);
    vertical-align: top;
}

.import-row--problem {
    background: var(--tlt-color-bg);
}

.import-chip {
    margin-left: 0.4rem;
    padding: 0 0.4rem;
    border-radius: 999px;
    border: 1px solid var(--tlt-color-success);
    color: var(--tlt-color-success);
    font-size: 0.72rem;
}

.import-problem {
    display: block;
    color: var(--tlt-color-accent);
    font-size: 0.8rem;
}

/* Term / Year plan bundles: the Share and Use dialogs (Program) and the Library's Term plans cards. One shared vocabulary:
   caption (small uppercase label), chips (term toggles), section (spaced group), field (label + control), actions (button row). */
.bundle-modal {
    width: min(38rem, calc(100vw - 2rem));
}

.bundle-lede {
    margin: 0 0 1.25rem;
}

.bundle-section {
    display: grid;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

.bundle-caption {
    display: block;
    font-family: var(--tlt-font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
}

.bundle-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.bundle-modal .bundle-chips .checkbox-label {
    margin: 0;
}

.bundle-chip-note {
    font-family: var(--tlt-font-body);
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
}

.plan-panel .checkbox-label .bundle-chip-note,
.plan-panel .checkbox-label:has(input:checked) .bundle-chip-note {
    color: inherit;
    opacity: 0.8;
}

/* Label + control without the plan-panel's tall label margin. */
.modal-content.plan-panel label.bundle-field {
    display: grid;
    gap: 0.35rem;
    margin: 0;
}

.modal-content.plan-panel label.bundle-field > input,
.modal-content.plan-panel label.bundle-field > select,
.modal-content.plan-panel label.bundle-field > textarea {
    margin-top: 0;
}

.modal-content.plan-panel label.bundle-field > textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--plan-control-border);
    border-radius: 8px;
    background-color: var(--plan-control-bg);
    color: var(--tlt-color-text);
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
    resize: vertical;
}

.bundle-summary {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.bundle-summary strong {
    color: var(--tlt-color-text);
}

.bundle-leftout {
    margin: 0;
}

/* The lesson plans a bundle uses: one row each (title left, how it travels right), its tick list underneath. */
.bundle-plans {
    list-style: none;
    margin: 0;
    padding: 0;
    border: 1px solid var(--tlt-color-border);
    border-radius: 8px;
    overflow: hidden;
}

.bundle-plan {
    padding: 0.55rem 0.8rem;
}

.bundle-plan + .bundle-plan {
    border-top: 1px solid var(--tlt-color-border);
}

.bundle-plan-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.bundle-plan-title {
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.bundle-plan .share-list {
    margin: 0.4rem 0 0;
}

.share-disposition {
    flex: none;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--tlt-color-border);
    font-family: var(--tlt-font-body);
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
    white-space: nowrap;
}

.share-disposition--WillShare {
    border-color: var(--tlt-color-primary);
    color: var(--tlt-color-primary);
}

.bundle-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 0.75rem;
    margin-top: 1.5rem;
}

.bundle-warnings {
    margin: 0.75rem 0;
    padding-left: 1.1rem;
    font-size: 0.88rem;
    color: var(--tlt-color-text-muted);
}

/* Use dialog + Library cards */
.use-plan-list {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.use-plan-card {
    display: grid;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 10px;
    background: var(--tlt-color-surface);
}

.use-plan-card p {
    margin: 0;
}

.use-plan-card > button {
    justify-self: start;
}

.use-plan-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 0.75rem;
}

.use-plan-card-title {
    font-family: var(--tlt-font-heading);
    font-size: 1.05rem;
}

.use-plan-chosen h3 {
    margin: 0;
    font-family: var(--tlt-font-heading);
    font-size: 1.15rem;
}

.use-plan-chosen p {
    margin: 0.25rem 0 0;
}

.use-plan-chosen + .bundle-caption,
.use-plan-chosen ~ .bundle-caption {
    margin-top: 1.25rem;
}

.use-plan-term {
    display: grid;
    gap: 0.6rem;
    margin-top: 0.6rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: 10px;
}

.use-plan-term-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.75rem;
}

.bundle-forms {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.bundle-form-chip {
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--tlt-color-border);
    font-family: var(--tlt-font-body);
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
}

.use-plan-new {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.use-plan-new-name {
    grid-column: 1 / -1;
}

@media (max-width: 30rem) {
    .use-plan-new {
        grid-template-columns: 1fr;
    }
}

/* ---- "Before we create your lesson plans" dialog ---- */
.create-plans-modal {
    width: min(42rem, calc(100vw - 2rem));
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
}

.create-plans-section {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--tlt-color-border);
}

.create-plans-section h3 {
    margin: 0;
    font-size: 1rem;
}

.create-plans-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 9.5rem 9.5rem;
    gap: 0.6rem;
}

.create-plans-children {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.create-plans-child {
    display: grid;
    grid-template-columns: minmax(6rem, 1fr) 1fr 1fr;
    gap: 0.6rem;
    align-items: end;
}

.create-plans-child-name {
    font-weight: 600;
    padding-bottom: 0.55rem;
    overflow-wrap: anywhere;
}

.create-plans-skip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

@media (max-width: 36rem) {
    .create-plans-row,
    .create-plans-child {
        grid-template-columns: 1fr;
    }

    .create-plans-child-name {
        padding-bottom: 0;
    }
}

.plans-created {
    max-width: 40rem;
    margin: 3rem auto;
    padding: 0 1rem;
}

/* ---- Holidays and appointments on the calendar views ---- */
.cal-holiday {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 0.25rem;
    padding: 0.2rem 0.5rem;
    border: 0;
    border-radius: 6px;
    background-color: color-mix(in srgb, var(--tlt-color-accent) 16%, transparent);
    color: var(--tlt-color-text);
    font: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    overflow-wrap: anywhere;
}

.cal-holiday:hover {
    background-color: color-mix(in srgb, var(--tlt-color-accent) 26%, transparent);
}

.cal-appt {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 0.25rem;
    padding: 0.2rem 0.45rem;
    border: 1px solid var(--tlt-color-border);
    border-left: 3px solid var(--tlt-color-primary);
    border-radius: 6px;
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    font: inherit;
    font-size: 0.8rem;
    text-align: left;
    cursor: pointer;
}

.cal-appt:hover {
    border-color: var(--tlt-color-primary);
}

.cal-appt-time {
    flex: none;
    color: var(--tlt-color-text-muted);
    font-variant-numeric: tabular-nums;
}

.cal-appt-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-appt-repeat {
    flex: none;
    margin-left: auto;
    color: var(--tlt-color-text-muted);
}

.cal-holiday--compact,
.cal-appt--compact {
    font-size: 0.72rem;
    padding: 0.1rem 0.35rem;
}

.month-day--holiday,
.calendar-day-cell--holiday {
    background-color: color-mix(in srgb, var(--tlt-color-accent) 6%, var(--tlt-color-surface));
}

.calendar-day-header--holiday {
    box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--tlt-color-accent) 55%, transparent);
}

.month-day:focus-visible {
    outline: 2px solid var(--tlt-color-accent);
    outline-offset: -2px;
}

.calendar-add-event {
    margin-left: auto;
}

.day-events {
    display: grid;
    gap: 0.25rem;
    margin: 0.5rem 0 0.75rem;
    max-width: 32rem;
}

/* The Holiday | Appointment switch uses the same chips as the checkboxes; the radio itself stays out of sight. */
.plan-panel .checkbox-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

/* Inbox header: the title with "Mark all as read" on the right, and the one-line window hint under it. */
.inbox-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
}

.inbox-hint {
    margin: 0 0 1rem;
    font-size: 0.85rem;
}

/* ---- Year view (Program) and School Years (School) ---- */
.school-year-group {
    margin-bottom: 1.1rem;
}

.school-year-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
    margin-bottom: 0.35rem;
}

.school-year-name {
    margin: 0;
    font-family: var(--tlt-font-heading);
    font-size: 1.15rem;
}

.school-year-actions {
    margin-bottom: 0.75rem;
}

.school-year-edit {
    margin-bottom: 0.5rem;
}

.program-year {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.year-print-title {
    display: none;
}

.year-controls .year-print-button {
    margin-left: auto;
    min-height: 1.8rem;
    padding: 0.15rem 0.65rem;
    font-size: 0.82rem;
}

.year-message {
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
    font-size: 0.88rem;
}

.year-scroll {
    overflow-x: auto;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
}

.year-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    min-width: calc(11rem + 14rem * 3);
}

.year-grid th,
.year-grid td {
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--tlt-color-border);
    border-right: 1px solid var(--tlt-color-border);
    vertical-align: top;
    text-align: left;
}

.year-grid thead th {
    background: var(--tlt-color-bg);
}

.year-corner,
.year-row-head {
    position: sticky;
    left: 0;
    z-index: 2;
    width: 11rem;
    background: var(--tlt-color-bg);
}

.year-term-head {
    display: table-cell;
}

.year-term-open {
    display: block;
    padding: 0;
    font-family: var(--tlt-font-heading);
    font-size: 1.05rem;
    text-align: left;
}

.year-row-title {
    display: block;
    font-family: var(--tlt-font-heading);
    font-size: 1.02rem;
    overflow-wrap: anywhere;
}

.year-cell {
    min-height: 3rem;
}

.year-cell--gap {
    background: color-mix(in srgb, var(--tlt-color-accent) 7%, var(--tlt-color-surface));
}

.year-gap-note {
    font-size: 0.78rem;
    color: var(--tlt-color-text-muted);
    font-style: italic;
}

.year-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.4rem 0.5rem;
    margin-bottom: 0.4rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
}

.year-item:last-child {
    margin-bottom: 0;
}

.year-carry {
    align-self: flex-start;
}

.year-carry > summary {
    min-height: 1.5rem;
    padding: 0.05rem 0.5rem;
    font-size: 0.75rem;
    font-family: inherit;
}

/* The carry list opens inline - an absolute popup would be clipped by the grid's own scroll container. */
.year-carry .tg-pop-panel {
    position: static;
    min-width: 0;
    margin-top: 0.3rem;
    padding: 0.35rem 0.5rem;
    box-shadow: none;
    gap: 0.15rem;
}

.year-carry .tg-pop-panel .btn-link {
    text-align: left;
    padding: 0.1rem 0;
}

@media (max-width: 600px) {
    .year-corner,
    .year-row-head {
        width: 7.5rem;
    }

    .year-grid {
        min-width: calc(7.5rem + 13rem * 3);
    }
}

@media print {
    .program-card-page .tg-bar,
    .program-year .year-controls,
    .year-carry,
    .year-message,
    .program-year ~ * {
        display: none !important;
    }

    .program-card-page {
        border: 0 !important;
        box-shadow: none !important;
        padding: 0 !important;
    }

    .program-card-page > h1 {
        display: none;
    }

    .year-print-title {
        display: block;
        margin-bottom: 0.75rem;
    }

    .year-print-title h2 {
        margin: 0;
    }

    .year-scroll {
        overflow: visible;
        border: 0;
    }

    .year-grid {
        min-width: 0;
        table-layout: auto;
        font-size: 10pt;
    }

    .year-corner,
    .year-row-head {
        position: static;
    }

    .year-grid tr,
    .year-item {
        break-inside: avoid;
    }

    .year-cell--gap {
        background: transparent;
    }

    .year-grid th,
    .year-grid td {
        border-color: #999;
    }
}

/* ---- Calendar follow-ups: days off, Agenda, Inbox snooze, narrow Month cells ---- */
.cal-holiday {
    overflow-wrap: normal;
}

.cal-holiday--dayoff {
    background-color: color-mix(in srgb, var(--tlt-color-primary) 16%, transparent);
    border-left: 3px solid var(--tlt-color-primary);
}

.cal-holiday--dayoff:hover {
    background-color: color-mix(in srgb, var(--tlt-color-primary) 26%, transparent);
}

.cal-holiday-who {
    margin-right: 0.35rem;
    font-weight: 500;
    color: var(--tlt-color-text-muted);
}

/* A narrow Month cell keeps each chip on one line (ellipsis, full title in the tooltip) rather than breaking a word in two. */
.cal-holiday--compact,
.cal-appt--compact {
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-holiday--compact .cal-holiday-who,
.cal-holiday--compact .cal-holiday-title {
    display: inline;
    white-space: nowrap;
}

@media (max-width: 600px) {
    /* On a phone the grid cells carry marks, not words: the Day view and the Agenda hold the detail. */
    .month-day .cal-holiday--compact,
    .month-day .cal-appt--compact {
        display: block;
        height: 0.45rem;
        padding: 0;
        margin: 0 0 0.15rem;
        font-size: 0;
        line-height: 0;
        overflow: hidden;
    }

    .month-day .cal-appt--compact {
        height: 0.4rem;
        border-left-width: 6px;
    }

    .month-day .cal-appt--compact .cal-appt-time,
    .month-day .cal-appt--compact .cal-appt-repeat,
    .month-day .cal-holiday--compact .cal-holiday-who {
        display: none;
    }

    .month-day {
        padding: 0.25rem 0.2rem;
    }

    /* "MON" must not wrap to "MO / N" in a ~3rem column. */
    .month-weekday {
        padding: 0.3rem 0.1rem;
        font-size: 0.62rem;
        letter-spacing: 0;
        text-align: center;
        overflow: hidden;
    }
}

.calendar-agenda {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.agenda-day {
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
}

.agenda-day--today {
    border-color: var(--tlt-color-accent);
}

.agenda-day-head {
    padding: 0.4rem 0.7rem;
    background: var(--tlt-color-bg);
    border-bottom: 1px solid var(--tlt-color-border);
}

.agenda-day-title {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-family: var(--tlt-font-heading);
    font-size: 1.05rem;
    color: var(--tlt-color-text);
    cursor: pointer;
}

.agenda-day-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.5rem 0.7rem 0.6rem;
}

.agenda-lessons {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    align-self: flex-start;
    padding: 0.15rem 0.6rem;
    border: 1px solid var(--child-color, var(--tlt-color-border));
    border-radius: 999px;
    background: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.agenda-note {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.agenda-note--birthday {
    color: var(--tlt-color-accent);
}

.agenda-more {
    padding: 0.4rem 0;
}

.inbox-snooze {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.75rem;
    padding: 0 0.6rem 0.5rem 3.3rem;
    font-size: 0.82rem;
}

.inbox-snooze-label {
    color: var(--tlt-color-text-muted);
}

@media print {
    .agenda-more, .calendar-agenda .calendar-nav, .calendar-agenda .calendar-filter {
        display: none !important;
    }
}

/* ---- End-of-year review ---- */
.year-review-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--tlt-color-accent);
    border-radius: var(--tlt-radius-sm);
    background: color-mix(in srgb, var(--tlt-color-accent) 8%, var(--tlt-color-surface));
}

.year-review-modal {
    max-width: 52rem;
}

.year-review-scroll {
    overflow-x: auto;
    margin-bottom: 0.75rem;
    /* A scroll container is a flex item that may shrink to nothing inside the modal's column - keep its rows whole. */
    flex-shrink: 0;
}

.year-review-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.year-review-table th,
.year-review-table td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid var(--tlt-color-border);
    text-align: left;
    vertical-align: top;
}

.year-review-table thead th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tlt-color-text-muted);
}

.year-review-row--behind .year-review-plan {
    font-weight: 600;
}

.year-review-plan {
    display: block;
}

.year-review-behind {
    display: block;
    color: var(--tlt-color-accent);
}

.year-review-table select {
    min-width: 8rem;
    max-width: 100%;
    margin: 0;
}

.year-review-bulk {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.75rem;
}

.year-review-summary,
.year-review-done {
    margin: 0;
    padding-left: 1.1rem;
}

.year-unfinished-chip {
    padding: 0.05rem 0.55rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--tlt-color-accent) 14%, transparent);
    color: var(--tlt-color-accent);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}

.needs-attention-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.needs-attention-item--year a {
    font-weight: 600;
    color: var(--tlt-color-accent);
}

@media print {
    .year-review-banner {
        display: none !important;
    }
}

/* ---- Pause / Resume school ---- */
.pauses-actions {
    margin: 0.5rem 0 1rem;
}

.pauses-heading {
    margin: 1rem 0 0.4rem;
    font-family: var(--tlt-font-heading);
    font-size: 1.1rem;
}

.pause-card {
    padding: 0.7rem 0.85rem;
    margin-bottom: 0.6rem;
    border: 1px solid var(--tlt-color-accent);
    border-radius: var(--tlt-radius-sm);
    background: color-mix(in srgb, var(--tlt-color-accent) 6%, var(--tlt-color-surface));
}

.pause-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
}

.pause-card-title {
    font-family: var(--tlt-font-heading);
    font-size: 1.1rem;
}

.pause-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.9rem;
    margin-top: 0.4rem;
}

.pause-recent {
    margin: 0;
    padding-left: 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.pause-mode {
    font-weight: 600;
}

.needs-attention-item--pause a {
    font-weight: 600;
}

/* Modals opened from inside a Settings/School pane keep the chip look of every other dialog, not the pane's toggle-switch rows. */
.settings-pane .plan-panel .checkbox-label:not(.group-row .checkbox-label) {
    position: relative;
    display: inline-flex;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.4rem;
    width: auto;
    max-width: none;
    margin: 0 0.4rem 0.45rem 0;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.9rem;
}

.settings-pane .plan-panel .checkbox-label:not(.group-row .checkbox-label) input[type="checkbox"] {
    appearance: auto;
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    background: none;
}

.settings-pane .plan-panel .checkbox-label:not(.group-row .checkbox-label) input[type="checkbox"]::before {
    display: none;
}

/* Stars (Documents and Things): a tile's star sits just left of its folder button; the document page's star sits by the title. */
.document-grid-tile-star-btn {
    position: absolute;
    top: 0.5rem;
    right: 2.9rem;
    display: inline-flex;
    align-items: center;
    background-color: var(--tlt-color-bg);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    color: var(--tlt-color-text-muted);
    cursor: pointer;
    padding: 0.1rem 0.4rem;
    font-size: 0.9rem;
}

.document-grid-tile-star-btn:hover {
    background-color: var(--tlt-color-surface);
    border-color: var(--tlt-color-primary);
}

.document-grid-tile-star-btn--on,
.document-list-star-btn--on,
.document-star-btn.book-favorite-btn--on {
    color: var(--tlt-color-accent);
}

.document-grid-tile-star-btn--on svg path,
.document-list-star-btn--on svg path,
.document-star-btn.book-favorite-btn--on svg path {
    fill: currentColor;
}

.document-list-star-btn {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: var(--tlt-radius-sm);
    color: var(--tlt-color-text-muted);
    line-height: 1;
}

.document-list-star-btn:hover {
    background-color: var(--tlt-color-bg);
}

.document-star-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem;
    color: var(--tlt-color-text-muted);
}

.library-card--thing .library-card-actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.15rem; margin-top: auto; }
.library-card--thing .library-card-actions .book-folder-btn { margin-top: 0; }

/* Phones: the Library tabs wrap instead of scrolling sideways, so Term plans (and "+ New") are never hidden off-screen. */
@media (max-width: 640px) {
    .tab-strip {
        flex-wrap: wrap;
        overflow-x: visible;
    }
}

/* ---- Standing days off (School > Pauses & days off) ---- */
.standing-days-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.standing-day-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 0.75rem;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
}

.standing-day-main {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.standing-day-title {
    font-family: var(--tlt-font-heading);
    font-size: 1.05rem;
}

/* ---- Today banners (pause / day off) ---- */
.today-banner {
    margin-bottom: 0.75rem;
}

.today-banner-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.today-off-note {
    margin: 0.35rem 0;
    font-weight: 600;
}

.plan-update-banner {
    margin-bottom: 1rem;
}

/* ---- Year view: lesson progress + drag to another term ---- */
.year-progress {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
}

.year-progress-track {
    flex: 1;
    height: 0.35rem;
    border-radius: 999px;
    background: var(--tlt-color-border);
    overflow: hidden;
}

.year-progress-bar {
    display: block;
    height: 100%;
    background: var(--tlt-color-accent);
}

.year-progress-text {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.year-item {
    cursor: grab;
}

.year-item--dragging {
    opacity: 0.5;
}

.year-cell--over {
    outline: 2px dashed var(--tlt-color-primary);
    outline-offset: -2px;
    background: color-mix(in srgb, var(--tlt-color-primary) 10%, var(--tlt-color-surface));
}

@media print {
    .year-progress-track {
        border: 1px solid #999;
    }
}

/* =====================================================================================================================
   Quip look (Oct 2026): white pages, hairlines instead of slabs, one azure accent. These rules sit last on purpose -
   they re-style the older component rules above without touching each of them.
   ===================================================================================================================== */

/* A page is no longer a rounded white slab on a tinted canvas: its content sits directly on the white page. */
.card {
    background-color: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

.settings-pane {
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0 0 2rem;
}

.auth-card {
    box-shadow: none;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius);
}

/* Page titles: one clear title, not a coloured display heading. */
.card > h1,
.settings-title,
.settings-pane-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 1rem;
}

/* Tabs: Quip's plain text tabs - the active one bold with a thin azure underline. */
.tab-strip {
    margin-top: 0.75rem;
    gap: 0.1rem;
}

.tab {
    padding: 0.45rem 0.8rem;
    font-size: 0.95rem;
}

.tab:hover {
    color: var(--tlt-color-text);
}

.tab--active {
    border-bottom-color: var(--tlt-color-primary);
}

/* Filter chips: hairline, compact, a pale-blue selected state (not a solid slab). */
.filter-chip {
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
}

.filter-chip:hover {
    background-color: var(--tlt-color-chrome);
}

.filter-chip--active {
    background-color: var(--tlt-color-active);
    border-color: var(--tlt-color-active);
    color: var(--tlt-color-primary);
    font-weight: 600;
}

/* Settings / School side list: Quip's pale-blue active row, no left bar. */
.settings-nav-item {
    border-left: none;
    padding: 0.45rem 0.7rem;
}

.settings-nav-item:hover {
    background-color: var(--tlt-color-chrome);
}

.settings-nav-item--active {
    background-color: var(--tlt-color-active);
    color: var(--tlt-color-primary);
}

/* Floating things (menus, popovers, modals) keep a real shadow; everything else is flat. */
.modal-content,
.toolbar-panel,
.user-menu-panel,
.quick-add-panel {
    box-shadow: var(--tlt-shadow-pop);
}

/* Inputs: hairline fields with an azure focus ring. */
input[type="text"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="search"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--tlt-color-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tlt-color-primary) 18%, transparent);
}

/* Kind badge: Quip's quiet grey pill beside the title, not a solid slab. */
.doc-kind-badge {
    color: var(--tlt-color-text-muted);
    background-color: var(--tlt-color-chrome);
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* Calendar's section / view switchers were rows of full buttons; in the Quip look they are plain text tabs. */
.calendar-section-bar,
.calendar-view-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 0.1rem;
    align-items: center;
}

.calendar-section-bar {
    border-bottom: 1px solid var(--tlt-color-border);
    margin-bottom: 0.75rem;
}

.calendar-section-bar > .btn-primary,
.calendar-section-bar > .btn-secondary,
.calendar-view-switcher > .btn-primary,
.calendar-view-switcher > .btn-secondary {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.4rem 0.7rem;
    font-weight: 500;
    color: var(--tlt-color-text-muted);
}

.calendar-section-bar > .btn-secondary:hover,
.calendar-view-switcher > .btn-secondary:hover {
    background: none;
    color: var(--tlt-color-text);
}

.calendar-section-bar > .btn-primary,
.calendar-view-switcher > .btn-primary {
    color: var(--tlt-color-text);
    font-weight: 700;
    border-bottom-color: var(--tlt-color-primary);
}


/* =====================================================================================================================
   Document view (Quip layout): title + pills + actions, text menu row, one toolbar row, a tabbed right-hand pane.
   ===================================================================================================================== */
.document-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.85rem 1.5rem 0.2rem;
}

.document-toolbar-main {
    flex: 1 1 18rem;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
}

.document-toolbar-title {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    min-width: 0;
}

.document-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.document-pills .doc-kind-badge,
.document-pills .doc-subject-name {
    border: none;
    border-radius: 999px;
    padding: 0.15rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--tlt-color-text-muted);
    background-color: var(--tlt-color-chrome);
}

.document-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.document-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: var(--tlt-radius-sm);
    background: none;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

.document-icon-btn:hover {
    background-color: var(--tlt-color-chrome);
    color: var(--tlt-color-text);
}

.document-icon-btn--on {
    background-color: var(--tlt-color-active);
    color: var(--tlt-color-primary);
}

.document-toolbar-error {
    flex-basis: 100%;
}

/* The text menu row: plain words, no bar. */
.document-menubar {
    border-bottom: none;
    padding: 0 1.25rem 0.25rem;
}

.document-menubar-trigger {
    color: var(--tlt-color-text);
    border-radius: var(--tlt-radius-sm);
}

.document-menubar-trigger:hover {
    background-color: var(--tlt-color-chrome);
}

.document-menubar-item--view .toolbar-panel,
.document-menubar-item--edit .toolbar-panel {
    z-index: 2000;
    right: auto;
    left: 0;
}

/* The page itself is the sheet: no shadow, no rounded card. */
.tlt-document-editor {
    box-shadow: none;
    border-radius: 0;
    background-color: var(--tlt-color-surface);
}

/* One thin formatting row: hairlines, quiet icons. */
.tlt-editor-toolbar {
    background-color: var(--tlt-color-surface);
    border-top: 1px solid var(--tlt-color-border);
    border-bottom: 1px solid var(--tlt-color-border);
    border-radius: 0;
    box-shadow: none;
}

/* Right-hand pane. Wide enough for four tabs with counts. */
@media (min-width: 60.01rem) {
    .document-sidebar {
        width: 24rem;
    }
}

.document-sidebar--hidden {
    display: none;
}

.document-pane-tabs {
    display: flex;
    gap: 0;
    flex-shrink: 0;
    padding: 0 0.4rem;
    border-bottom: 1px solid var(--tlt-color-border);
    overflow-x: auto;
    scrollbar-width: none;
}

.pane-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0.65rem 0.35rem;
    font-family: var(--tlt-font-body);
    font-size: 0.82rem;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
    white-space: nowrap;
}

.pane-tab:hover {
    color: var(--tlt-color-text);
}

.pane-tab--active {
    color: var(--tlt-color-text);
    font-weight: 600;
    border-bottom-color: var(--tlt-color-primary);
}

.pane-tab-count {
    margin-left: 0.25rem;
    padding: 0 0.3rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background-color: var(--tlt-color-chrome);
    color: var(--tlt-color-text-muted);
}

.pane-tab--active .pane-tab-count {
    background-color: var(--tlt-color-active);
    color: var(--tlt-color-primary);
}

.document-pane-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem 1.25rem 1.5rem;
}

.pane-feed {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.pane-feed-head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.pane-feed-when,
.pane-feed-sub {
    color: var(--tlt-color-text-muted);
    font-size: 0.85rem;
}

.pane-feed-text {
    margin: 0.25rem 0;
}

.pane-feed-link {
    font-size: 0.9rem;
    margin-right: 0.75rem;
}

/* History feed rows, Quip style: who + when, then a blue "View changes" link. */
.history-session-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-session-head {
    color: var(--tlt-color-text);
}

body.tlt-focus .home-rail,
body.tlt-focus .top-nav,
body.tlt-focus .trail,
body.tlt-focus .quick-add-trigger:not(.quick-add-trigger--inline),
body.tlt-focus .app-header--rail,
body.tlt-focus .home-drawer-panel,
body.tlt-focus .home-drawer-backdrop,
body.tlt-focus .document-outline-dock,
body.tlt-focus .document-sidebar {
    display: none;
}

body.tlt-focus .app-shell--with-rail {
    padding-left: 0;
}

/* Phone width: four tabs with counts must fit the stacked pane without clipping "Narrations". */
@media (max-width: 60rem) {
    .document-pane-tabs {
        padding: 0;
    }

    .pane-tab {
        padding: 0.65rem 0.28rem;
        font-size: 0.78rem;
    }

    .pane-tab-count {
        margin-left: 0.15rem;
        padding: 0 0.25rem;
        font-size: 0.66rem;
    }
}

/* ---- Library (Quip slice 3): one title row with a "Show:" switcher, grid/list toggle and a single "New" menu; one quiet filter bar. ---- */
.library-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}

.library-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0;
    font-size: 1.6rem;
    min-width: 0;
}

.library-head-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.library-menu {
    position: relative;
}

.library-menu > summary {
    list-style: none;
    cursor: pointer;
}

.library-menu > summary::-webkit-details-marker {
    display: none;
}

.library-switch > summary {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.7rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-surface);
    font-size: 0.9rem;
    color: var(--tlt-color-text);
}

.library-switch > summary:hover,
.library-switch[open] > summary {
    background-color: var(--tlt-color-chrome);
}

.library-switch-prefix {
    color: var(--tlt-color-text-muted);
}

.library-switch-current {
    font-weight: 600;
}

.library-menu-caret {
    font-size: 0.7rem;
    color: var(--tlt-color-text-muted);
}

.library-new > summary {
    display: inline-block;
    padding: 0.45rem 0.95rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    user-select: none;
}

.library-menu-panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 30;
    min-width: 13rem;
    display: flex;
    flex-direction: column;
    padding: 0.35rem;
    background-color: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    box-shadow: var(--tlt-shadow-pop);
}

.library-menu-panel--right {
    left: auto;
    right: 0;
    min-width: 16.5rem;
}

.library-menu-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.45rem 0.6rem;
    border: 0;
    border-radius: 4px;
    background: none;
    font-family: var(--tlt-font-body);
    font-size: 0.92rem;
    color: var(--tlt-color-text);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.library-menu-item:hover {
    background-color: var(--tlt-color-chrome);
    color: var(--tlt-color-text);
}

.library-menu-item--active {
    background-color: var(--tlt-color-active);
    color: var(--tlt-color-primary);
    font-weight: 600;
}

.library-menu-divider {
    margin: 0.3rem 0;
    border: 0;
    border-top: 1px solid var(--tlt-color-border);
}

.library-filterbar {
    display: flex;
    align-items: center;
    gap: 0.5rem 0.9rem;
    flex-wrap: wrap;
    margin: 0 0 1rem;
}

.library-filterbar .document-search-input {
    width: 17rem;
    max-width: 100%;
    margin: 0;
}

.library-filterbar .filter-chip-row {
    margin: 0;
}

/* Quieter tiles: folders are a short banner (name + count) instead of a near-square block, and a tile's
   star / "add to folder" / menu buttons appear on hover (they stay visible on touch screens, and a starred
   item keeps its filled star). */
.folder-grid-tile {
    aspect-ratio: 1.9;
    padding: 0.75rem 0.9rem;
}

@media (hover: hover) {
    .document-grid-tile-wrap .document-grid-tile-star-btn:not(.document-grid-tile-star-btn--on),
    .document-grid-tile-wrap .document-grid-tile-folder-btn,
    .folder-grid-tile .folder-grid-tile-menu,
    .document-list-item .document-list-star-btn:not(.document-list-star-btn--on),
    .document-list-item .document-list-folder-btn {
        opacity: 0;
        transition: opacity 0.12s ease;
    }

    .document-grid-tile-wrap:hover .document-grid-tile-star-btn,
    .document-grid-tile-wrap:hover .document-grid-tile-folder-btn,
    .document-grid-tile-wrap:focus-within .document-grid-tile-star-btn,
    .document-grid-tile-wrap:focus-within .document-grid-tile-folder-btn,
    .folder-grid-tile:hover .folder-grid-tile-menu,
    .folder-grid-tile:focus-within .folder-grid-tile-menu,
    .document-list-item:hover .document-list-star-btn,
    .document-list-item:hover .document-list-folder-btn,
    .document-list-item:focus-within .document-list-star-btn,
    .document-list-item:focus-within .document-list-folder-btn {
        opacity: 1;
    }
}

/* Library list view: fixed column widths so Created / Updated line up from row to row (the old "auto" columns shifted with
   how many action buttons a row happened to have - a folder row has one, a document row two). */
.document-list-header,
.document-list-item {
    grid-template-columns: 7rem minmax(0, 1fr) 6.75rem 6.75rem 4.5rem;
}

.document-list-actions {
    justify-content: flex-end;
}

/* Phone width: the header actions wrap onto their own rows, so a right-anchored menu panel would open off the left edge -
   anchor it to the left of its trigger instead and keep it inside the viewport. */
@media (max-width: 40rem) {
    .library-menu-panel--right {
        left: 0;
        right: auto;
        max-width: calc(100vw - 5rem);
    }
}

/* History feed: a one-glance preview of the first change under each session (Quip), clamped and faded. "View changes" opens them all. */
.history-diff--preview {
    max-height: 4.4rem;
    overflow: hidden;
    margin: 0.35rem 0 0.15rem;
    -webkit-mask-image: linear-gradient(#000 55%, transparent);
    mask-image: linear-gradient(#000 55%, transparent);
}

/* Editor formatting toolbar: ONE row on desktop (Quip). When the editor column is too narrow for every tool (conversation pane
   open on a ~1100px window) the less-used group (underline ... link) folds into the existing "More" menu - measured against
   the toolbar's own width, not the window's. NOT made a scroller: its dropdowns are positioned inside it, and an overflow
   container clips them (Mantine's size middleware then gives them max-height: 0). Below ~36rem it may still wrap. */
.tlt-editor-toolbar {
    container-type: inline-size;
    container-name: tlt-toolbar;
}

@container tlt-toolbar (max-width: 57rem) {
    .tlt-toolbar-overflow-inline {
        display: none;
    }

    .tlt-toolbar-more {
        display: block;
    }
}

@media (max-width: 80rem) {
    .tlt-editor-toolbar {
        padding-left: 0.6rem;
        padding-right: 0.6rem;
    }
}

/* ---- Slice 4a: daily-use pages (Tasks, Today) as Quip-style checklists ---- */
/* Status pills: a pale tint of the status colour instead of a solid saturated block (Scheduled, the default, is just quiet text). */
.lesson-status {
    --lesson-status-color: var(--tlt-color-status-scheduled);
    background-color: color-mix(in srgb, var(--lesson-status-color) 14%, var(--tlt-color-bg));
    color: color-mix(in srgb, var(--lesson-status-color) 75%, var(--tlt-color-text));
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.78rem;
    padding: 0.12rem 0.55rem;
}

.lesson-status--scheduled { --lesson-status-color: var(--tlt-color-status-scheduled); background-color: transparent; color: var(--tlt-color-text-muted); padding-left: 0; }
.lesson-status--continues { --lesson-status-color: var(--tlt-color-status-continues); }
.lesson-status--complete { --lesson-status-color: var(--tlt-color-status-complete); }
.lesson-status--skipped { --lesson-status-color: var(--tlt-color-status-skipped); }
.lesson-status--rescheduled { --lesson-status-color: var(--tlt-color-status-rescheduled); }

/* Round checkboxes, everywhere a task is ticked. */
.task-item input[type="checkbox"],
.todays-lessons-widget input[type="checkbox"],
.checklist-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 1.2rem;
    height: 1.2rem;
    margin: 0;
    border: 1.5px solid #9AA5B1;
    border-radius: 50%;
    background-color: var(--tlt-color-bg);
    cursor: pointer;
    display: inline-grid;
    place-content: center;
}

.task-item input[type="checkbox"]:hover,
.checklist-row input[type="checkbox"]:hover {
    border-color: var(--tlt-color-primary);
}

.task-item input[type="checkbox"]:checked,
.checklist-row input[type="checkbox"]:checked {
    background-color: var(--tlt-color-primary);
    border-color: var(--tlt-color-primary);
}

.task-item input[type="checkbox"]:checked::after,
.checklist-row input[type="checkbox"]:checked::after {
    content: "";
    width: 0.3rem;
    height: 0.55rem;
    border: solid var(--tlt-palette-white);
    border-width: 0 2px 2px 0;
    transform: translateY(-1px) rotate(45deg);
}

.task-item {
    padding: 0.65rem 0;
}

/* Tasks: one "Add a task..." line; the rarely-used fields sit behind Options. */
.task-quickadd {
    margin: 0.25rem 0 1rem;
}

.task-quickadd-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.task-quickadd-row .task-quickadd-input {
    flex: 1;
    min-width: 0;
    margin: 0;
}

.task-quickadd-options-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.6rem;
    padding: 0.75rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-chrome);
}

.task-quickadd-options-row label {
    flex: 1 1 11rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

/* Today: a round check completes the lesson; Continues / Skip are quiet text actions that appear on hover (always on touch screens). */
.today-lesson-row {
    padding: 0.55rem 0;
}

.today-check {
    flex-shrink: 0;
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border: 1.5px solid #9AA5B1;
    border-radius: 50%;
    background-color: var(--tlt-color-bg);
    cursor: pointer;
    position: relative;
}

.today-check:hover:not(:disabled) {
    border-color: var(--tlt-color-primary);
    background-color: var(--tlt-color-active);
}

.today-check:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.today-check--done {
    background-color: var(--tlt-color-primary);
    border-color: var(--tlt-color-primary);
    cursor: default;
}

.today-check--done::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 46%;
    width: 0.3rem;
    height: 0.6rem;
    border: solid var(--tlt-palette-white);
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -50%) rotate(45deg);
}

.today-lesson-title {
    flex: 0 1 auto;
}

.today-action {
    border: 0;
    background: none;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-family: var(--tlt-font-body);
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

.today-action:hover:not(:disabled) {
    background-color: var(--tlt-color-chrome);
    color: var(--tlt-color-text);
}

@media (hover: hover) {
    .today-lesson-row .checklist-row-actions {
        opacity: 0;
        transition: opacity 0.12s ease;
    }

    .today-lesson-row:hover .checklist-row-actions,
    .today-lesson-row:focus-within .checklist-row-actions {
        opacity: 1;
    }
}

/* Inbox as a Quip-style updates feed: neutral round icons, an unread dot on the right and bold text instead of a left stripe,
   and the snooze links appear on hover. */
.inbox-item {
    border-left: 0;
}

.inbox-item--unread {
    background-color: transparent;
}

.inbox-item--unread .inbox-item-text {
    font-weight: 600;
}

.inbox-item--unread .inbox-item-link::after {
    content: "";
    flex-shrink: 0;
    width: 0.55rem;
    height: 0.55rem;
    margin-left: auto;
    border-radius: 50%;
    background-color: var(--tlt-color-primary);
}

.inbox-item-icon[class*="inbox-item-icon--"] {
    background-color: var(--tlt-color-chrome);
    color: var(--tlt-color-text-muted);
}

@media (hover: hover) {
    .inbox-item .inbox-snooze {
        opacity: 0;
        transition: opacity 0.12s ease;
    }

    .inbox-item:hover .inbox-snooze,
    .inbox-item:focus-within .inbox-snooze {
        opacity: 1;
    }
}

.task-quickadd-row > input,
.task-quickadd-row > button {
    height: 2.4rem;
    min-height: 0;
    box-sizing: border-box;
    padding-top: 0;
    padding-bottom: 0;
}

/* Dashboard widgets: hairline-bordered flat panels (Quip) instead of a barely-visible drop shadow. */
.dashboard-widget {
    border: 1px solid var(--tlt-color-border);
    box-shadow: none;
}

.dashboard-widget-header h3 {
    font-size: 1rem;
    font-family: var(--tlt-font-heading);
}

/* ---- Slice 4b: Calendar chrome ---- */
.calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-bottom: 0.75rem;
}

.calendar-toolbar .calendar-nav {
    margin-bottom: 0;
    gap: 0.35rem;
}

.calendar-toolbar-right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
}

.calendar-toolbar .calendar-add-event {
    margin-left: 0;
}

.calendar-nav-arrow {
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

.calendar-nav-arrow:hover {
    background-color: var(--tlt-color-chrome);
    color: var(--tlt-color-text);
}

.calendar-toolbar .calendar-range {
    margin-left: 0.4rem;
    font-weight: 600;
    color: var(--tlt-color-text);
}

/* "Show: Anna Ben Clara": small outlined chips with the child's colour as a dot, filled with a tint when on. */
.calendar-filter > span {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.calendar-child-toggle {
    gap: 0.4rem;
    border: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.2rem 0.7rem;
    opacity: 0.65;
}

.calendar-child-toggle::before {
    content: "";
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
    border: 2px solid var(--child-color, var(--tlt-color-text-muted));
    box-sizing: border-box;
}

.calendar-child-toggle--active {
    background-color: color-mix(in srgb, var(--child-color) 12%, var(--tlt-color-bg));
    border-color: color-mix(in srgb, var(--child-color) 55%, var(--tlt-color-border));
    color: var(--tlt-color-text);
    opacity: 1;
}

.calendar-child-toggle--active::before {
    background-color: var(--child-color);
}

/* Week grid: calmer chips - the default "Scheduled" status is just noise inside a chip. */
.calendar-lesson-chip .lesson-status--scheduled {
    display: none;
}

.calendar-lesson-chip {
    border-color: transparent;
    border-left-width: 3px;
    background-color: var(--tlt-color-chrome);
}

.calendar-day-cell {
    border-color: transparent;
    background-color: transparent;
    padding: 0.25rem;
}

.calendar-day-cell--today {
    background-color: color-mix(in srgb, var(--tlt-color-primary) 5%, var(--tlt-color-bg));
}

.calendar-day-header--today span:last-child {
    background-color: var(--tlt-color-primary);
    color: var(--tlt-palette-white);
    border-radius: 999px;
    padding: 0 0.5rem;
}

/* ---- Slice 4b: Program (and the other Term-planner bars) ---- */
/* View switch (List | Board | Year): one joined segmented control, the active segment a pale-blue tint instead of a solid button. */
.tg-bar .tg-seg {
    gap: 0;
}

.tg-bar .tg-seg > button {
    border-radius: 0;
    border: 1px solid var(--tlt-color-border);
    background: var(--tlt-color-surface);
    color: var(--tlt-color-text-muted);
    font-weight: 500;
}

.tg-bar .tg-seg > button + button {
    border-left: 0;
}

.tg-bar .tg-seg > button:first-child {
    border-radius: var(--tlt-radius-sm) 0 0 var(--tlt-radius-sm);
}

.tg-bar .tg-seg > button:last-child {
    border-radius: 0 var(--tlt-radius-sm) var(--tlt-radius-sm) 0;
}

.tg-bar .tg-seg > button.btn-primary {
    background-color: var(--tlt-color-active);
    border-color: var(--tlt-color-border);
    color: var(--tlt-color-primary);
    font-weight: 600;
}

/* Who tabs (Family | Not decided yet | + Add ... | Copy from...): text tabs with an underline, like the Calendar sections. */
.plan-audiences {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.1rem 0.25rem;
    margin: 0.5rem 0 1rem;
    border-bottom: 1px solid var(--tlt-color-border);
}

.plan-audiences > .btn-primary,
.plan-audiences > .btn-secondary {
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    padding: 0.4rem 0.7rem;
    font-weight: 500;
    color: var(--tlt-color-text-muted);
}

.plan-audiences > .btn-secondary:hover {
    background: none;
    color: var(--tlt-color-text);
}

.plan-audiences > .btn-primary {
    color: var(--tlt-color-text);
    font-weight: 700;
    border-bottom-color: var(--tlt-color-primary);
}

.plan-audiences > .tg-pop > summary {
    border: 0;
    background: none;
    color: var(--tlt-color-text-muted);
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
}

.plan-audiences > .tg-pop > summary:hover,
.plan-audiences > .tg-pop[open] > summary {
    color: var(--tlt-color-primary);
}

.tg-pop-panel {
    box-shadow: var(--tlt-shadow-pop);
}

/* ---- Slice 4b: School ---- */
/* The pane's generic "every input is a full-width field" rule turned each subject's colour picker into a wide purple bar and
   stretched the Area select; keep both compact so a subject is one tidy row. */
.settings-pane.settings-pane input[type="color"].subject-color-input.subject-color-input {
    width: 1.6rem;
    height: 1.6rem;
    min-height: 0;
    padding: 0;
    border: 1px solid var(--tlt-color-border);
    border-radius: 50%;
    background: none;
    box-shadow: none;
    flex: 0 0 auto;
}

.settings-pane input[type="color"].subject-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.settings-pane input[type="color"].subject-color-input::-webkit-color-swatch {
    border: 0;
    border-radius: 50%;
}

.settings-pane select.subject-area-select {
    width: auto;
    max-width: 10rem;
    min-height: 0;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    font-size: 0.85rem;
}

.settings-pane .entity-row {
    flex-wrap: wrap;
    row-gap: 0.25rem;
}

.tg-bar select {
    border-color: var(--tlt-color-border);
}

/* Row actions (move / edit / archive / delete) are quiet grey text that appears on hover, not a row of blue underlined links. */
.settings-pane .entity-row .btn-link,
.settings-pane .subject-area-header .btn-link {
    color: var(--tlt-color-text-muted);
    text-decoration: none;
    font-size: 0.85rem;
}

.settings-pane .entity-row .btn-link:hover,
.settings-pane .subject-area-header .btn-link:hover {
    color: var(--tlt-color-primary);
    text-decoration: underline;
}

@media (hover: hover) {
    .settings-pane .entity-row:not(:hover):not(:focus-within) .btn-link,
    .settings-pane .subject-area-header:not(:hover):not(:focus-within) .btn-link {
        opacity: 0;
    }
}

/* =====================================================================================================================
   Slice 4c: Settings / form controls, Library cards (Lesson Plans, Books, Things), Narration notebook, Book detail
   ===================================================================================================================== */
/* Form controls: white fields with a clear hairline (Quip), not a blue-tinted fill. */
.settings-pane {
    --settings-control-bg: var(--tlt-color-surface);
    --settings-control-border: color-mix(in srgb, var(--tlt-color-border) 78%, var(--tlt-color-text));
}

.plan-panel,
.tlt-form {
    --plan-control-bg: var(--tlt-color-surface);
    --plan-control-border: color-mix(in srgb, var(--tlt-color-border) 78%, var(--tlt-color-text));
}

/* Library cards (Lesson Plans / Books / Things / Term plans): hairline cards, a soft cover tile instead of an empty white block. */
.library-card {
    border: 1px solid var(--tlt-color-border);
    box-shadow: none;
}

.library-card-cover {
    height: 6.5rem;
}

.library-card-cover--placeholder {
    background-color: var(--tlt-color-chrome);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 24 24' fill='none' stroke='%23A8B1BC' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5M9 13h6M9 17h4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.library-card--add {
    min-height: 6.5rem;
    background: none;
}

.library-card--add:hover {
    background-color: var(--tlt-color-chrome);
    border-color: var(--tlt-color-text-muted);
}

.thing-purpose-filter select {
    min-width: 8rem;
}

/* Narration notebook: hairline entries, a quiet format label, no accent stripe. */
.narration-item {
    border-left: 1px solid var(--tlt-color-border);
}

.narration-badge {
    background-color: var(--tlt-color-chrome);
    color: var(--tlt-color-text-muted);
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

/* Book detail: the title reads as the page heading (an input that only shows its border on hover / focus), the author beneath it. */
.book-page .book-header-fields label:first-child input {
    font-family: var(--tlt-font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    border-color: transparent;
    background-color: transparent;
    padding-left: 0.4rem;
}

.book-page .book-header-fields label:first-child input:hover,
.book-page .book-header-fields label:first-child input:focus {
    border-color: var(--plan-control-border);
    background-color: var(--tlt-color-surface);
}

/* =====================================================================================================================
   Mobile pass (phones, <= 40rem): nothing may make the page scroll sideways; wide things scroll inside themselves.
   ===================================================================================================================== */
.filter-chip-row {
    flex-wrap: wrap;
}

@media (max-width: 40rem) {
    /* Week grid: seven fixed-width day columns that scroll sideways inside the grid (headers and cells scroll together). */
    .calendar-grid {
        grid-template-columns: repeat(7, 8.5rem);
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    /* Inline plan panels (Book / Thing detail forms) are full width on a phone, not the 24rem side-panel width. */
    .card .plan-panel,
    .book-page .plan-panel {
        width: 100%;
        max-width: 100%;
    }

    .thing-purpose-filter {
        margin-left: 0;
    }
}

@media (max-width: 30rem) {
    /* The editor's page padding shrinks to 1rem here, so the toolbar's desktop -3rem bleed would overshoot the viewport. */
    .tlt-editor-toolbar {
        margin: -1.25rem -1rem 1rem;
    }
}

@media (max-width: 30rem) {
    /* One-column dashboard: every widget is as tall as its own content (the fixed 9rem rows made lists scroll inside a tiny box). */
    .dashboard-widget-grid {
        grid-auto-rows: auto;
    }

    .dashboard-widget {
        grid-row: auto;
        min-height: 6rem;
    }

    .dashboard-widget-body {
        overflow-y: visible;
    }
}

/* =====================================================================================================================
   Quip Reset R1: the one insert menu (@ and /), hover peek card, internal-link chips
   ===================================================================================================================== */
/* BlockNote's own wrapper for the menu: no extra chrome around our two-pane panel. */
.bn-suggestion-menu:has(.tlt-insert-menu) {
    padding: 0;
    background: none;
    box-shadow: none;
    border: 0;
    max-height: none;
}

.tlt-insert-menu {
    display: grid;
    grid-template-columns: 15.5rem minmax(0, 1fr);
    width: min(44rem, 92vw);
    max-height: 23rem;
    background: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: 8px;
    box-shadow: var(--tlt-shadow-pop);
    overflow: hidden;
    font-family: var(--tlt-font-ui-sans, system-ui, sans-serif);
}

.tlt-insert-menu--empty {
    display: block;
    width: 18rem;
    padding: 0.9rem 1rem;
    color: var(--tlt-color-text-muted);
    font-size: 0.9rem;
}

.tlt-insert-menu-list {
    overflow-y: auto;
    padding: 0.35rem 0;
    border-right: 1px solid var(--tlt-color-border);
}

.tlt-insert-menu-group {
    padding: 0.55rem 1rem 0.2rem;
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
}

.tlt-insert-menu-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.4rem 1rem;
    cursor: pointer;
    color: var(--tlt-color-text);
}

.tlt-insert-menu-item--active {
    background-color: var(--tlt-color-chrome);
}

.tlt-insert-menu-icon {
    display: inline-flex;
    flex-shrink: 0;
    color: var(--tlt-color-text-muted);
}

.tlt-insert-menu-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tlt-insert-menu-title {
    font-size: 0.95rem;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tlt-insert-menu-context {
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tlt-insert-menu-preview {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
    padding: 0.9rem 1.1rem 1rem;
    overflow-y: auto;
}

.tlt-insert-menu-preview-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--tlt-color-text);
    overflow-wrap: anywhere;
}

.tlt-insert-menu-preview-sub {
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
}

.tlt-insert-menu-preview-body {
    flex: 1;
    min-height: 6rem;
    display: flex;
    flex-direction: column;
}

.tlt-insert-menu-preview-tile {
    flex: 1;
    display: grid;
    place-items: center;
    min-height: 7.5rem;
    border-radius: 6px;
    background-color: color-mix(in srgb, var(--tlt-color-primary) 9%, var(--tlt-color-bg));
    color: color-mix(in srgb, var(--tlt-color-primary) 55%, var(--tlt-color-bg));
}

.tlt-insert-menu-preview-tile svg {
    width: 3.2rem;
    height: 3.2rem;
}

.tlt-insert-menu-preview-desc {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.tlt-insert-menu-preview-muted,
.tlt-peek-muted {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.tlt-insert-menu-insert {
    margin-top: 0.4rem;
    padding: 0.5rem 1rem;
    border: 0;
    border-radius: 6px;
    background-color: var(--tlt-color-primary);
    color: var(--tlt-palette-white);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.tlt-insert-menu-insert:hover {
    background-color: var(--tlt-color-primary-dark);
}

/* Preview content shared by the menu's pane and the hover card. */
.tlt-peek-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.tlt-peek-cover {
    max-width: 100%;
    max-height: 8rem;
    object-fit: cover;
    border-radius: 6px;
}

.tlt-peek-line {
    font-size: 0.85rem;
    line-height: 1.35;
    color: var(--tlt-color-text);
    overflow-wrap: anywhere;
}

.tlt-peek-detail {
    font-size: 0.78rem;
    color: var(--tlt-color-text-muted);
}

@media (max-width: 40rem) {
    .tlt-insert-menu {
        grid-template-columns: minmax(0, 1fr);
        width: min(22rem, 92vw);
    }

    .tlt-insert-menu-preview {
        display: none;
    }
}

/* Hover peek card + folder list (appended to <body> by internalLinks.ts). */
.tlt-peek-card {
    position: fixed;
    z-index: 1200;
    display: none;
    width: 19rem;
    max-width: 92vw;
    max-height: 22rem;
    overflow-y: auto;
    padding: 0.8rem 0.95rem;
    background: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: 8px;
    box-shadow: var(--tlt-shadow-pop);
    font-family: var(--tlt-font-body);
    color: var(--tlt-color-text);
}

.tlt-peek-header {
    margin-bottom: 0.35rem;
}

.tlt-peek-title {
    font-size: 1.02rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.tlt-peek-sub {
    font-size: 0.78rem;
    color: var(--tlt-color-text-muted);
}

.tlt-peek-list {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
}

.tlt-peek-list-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.35rem;
    border-radius: 4px;
    color: var(--tlt-color-text);
    text-decoration: none;
    font-size: 0.92rem;
}

.tlt-peek-list-link:hover {
    background-color: var(--tlt-color-chrome);
    color: var(--tlt-color-text);
}

.tlt-peek-list-icon {
    display: inline-flex;
    color: var(--tlt-color-text-muted);
}

.tlt-peek-open {
    display: inline-block;
    margin-top: 0.55rem;
    font-size: 0.85rem;
    color: var(--tlt-color-link);
}

/* Internal links read as resources: a small type icon in front of the title, in the editor and in a student's lesson. */
.bn-editor a[href^="/documents/"],
.bn-editor a[href^="/books/"],
.bn-editor a[href^="/things/"],
.bn-editor a[href*="folderId="] {
    text-decoration: none;
    background-color: color-mix(in srgb, var(--tlt-color-primary) 8%, transparent);
    border-radius: 4px;
    padding: 0 0.3rem 0 1.35rem;
    background-repeat: no-repeat;
    background-position: 0.3rem 50%;
    background-size: 0.9rem;
    white-space: normal;
}

.bn-editor a[href^="/documents/"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231A6FEB' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5M9 13h6M9 17h4'/%3E%3C/svg%3E");
}

.bn-editor a[href^="/books/"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231A6FEB' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 5a2 2 0 0 1 2-2h12v15H7a2 2 0 0 0-2 2z'/%3E%3Cpath d='M5 20a2 2 0 0 0 2 1h12v-3M9 7h6'/%3E%3C/svg%3E");
}

.bn-editor a[href^="/things/"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231A6FEB' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 14a4 4 0 0 0 5.66 0l2.83-2.83a4 4 0 0 0-5.66-5.66l-1.5 1.5M14 10a4 4 0 0 0-5.66 0L5.5 12.83a4 4 0 0 0 5.66 5.66l1.5-1.5'/%3E%3C/svg%3E");
}

.bn-editor a[href*="folderId="] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231A6FEB' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7a2 2 0 0 1 2-2h4l2 2.5h8a2 2 0 0 1 2 2V17a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3C/svg%3E");
}

/* =====================================================================================================================
   Quip Reset R2: Live Preview overlay (site.js tltLinks) and the chromeless embedded page (?embed=1)
   ===================================================================================================================== */
.tlt-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2.5vh 3vw;
    background-color: rgba(31, 41, 51, 0.42);
}

.tlt-preview-overlay--open {
    display: flex;
}

body.tlt-preview-open {
    overflow: hidden;
}

.tlt-preview-panel {
    display: flex;
    flex-direction: column;
    width: min(64rem, 94vw);
    height: 90vh;
    background-color: var(--tlt-color-surface);
    border-radius: 10px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.tlt-preview-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.8rem;
    border-bottom: 1px solid var(--tlt-color-border);
    background-color: var(--tlt-color-chrome);
}

.tlt-preview-title {
    flex: 1;
    min-width: 0;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tlt-preview-back,
.tlt-preview-close {
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 6px;
    background: none;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

.tlt-preview-back {
    visibility: hidden;
}

.tlt-preview-back:hover,
.tlt-preview-close:hover {
    background-color: var(--tlt-color-border);
    color: var(--tlt-color-text);
}

.tlt-preview-openlink {
    padding: 0.35rem 0.9rem;
    border-radius: 6px;
    background-color: var(--tlt-color-primary);
    color: var(--tlt-palette-white);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}

.tlt-preview-openlink:hover {
    background-color: var(--tlt-color-primary-dark);
    color: var(--tlt-palette-white);
}

.tlt-preview-frame {
    flex: 1;
    width: 100%;
    border: 0;
    background-color: var(--tlt-color-surface);
}

@media (max-width: 40rem) {
    .tlt-preview-overlay {
        padding: 0;
    }

    .tlt-preview-panel {
        width: 100vw;
        height: 100dvh;
        border-radius: 0;
    }
}

@media print {
    .tlt-preview-overlay,
    .tlt-peek-card {
        display: none !important;
    }
}

/* The embedded page: the same document / book / thing, minus everything that is about moving around the app. */
.app-shell--embed {
    padding-left: 0;
}

.app-shell--embed .app-content {
    max-width: none;
    padding-top: 0.75rem;
}

.app-shell--embed .document-toolbar-actions,
.app-shell--embed .document-menubar,
.app-shell--embed .document-path,
.app-shell--embed .document-pills,
.app-shell--embed .book-back,
.app-shell--embed .thing-back {
    display: none;
}


/* ---- R3: document path (DocumentPath.razor) and the Copy/Move dialogs (DocumentFilingModal.razor) ---- */
.document-path {
    flex: 1 0 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.1rem 0.35rem;
    min-width: 0;
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
}

.document-path-crumbs {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 0.35rem;
    min-width: 0;
}

.document-path-crumb {
    color: var(--tlt-color-text-muted);
    text-decoration: none;
    overflow-wrap: anywhere;
}

a.document-path-crumb:hover {
    color: var(--tlt-color-text);
    text-decoration: underline;
}

.document-path-crumb--current {
    color: var(--tlt-color-text);
    font-weight: 500;
}

.document-path-sep {
    color: var(--tlt-color-border);
}

.document-path-more {
    position: relative;
}

.document-path-more-btn {
    font-family: var(--tlt-font-body);
    font-size: 0.75rem;
    background-color: var(--tlt-color-chrome);
    border: none;
    border-radius: 999px;
    padding: 0.05rem 0.55rem;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
}

.document-path-more-btn:hover {
    color: var(--tlt-color-text);
}

.document-path-popover {
    position: absolute;
    top: calc(100% + 0.3rem);
    left: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 14rem;
    max-width: min(24rem, 90vw);
    padding: 0.6rem 0.75rem;
    background-color: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    box-shadow: var(--tlt-shadow-sm);
}

.document-path-popover-row {
    display: block;
}

.filing-modal {
    max-width: 30rem;
}

.filing-modal .tlt-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 0.5rem 0 1rem;
}

.filing-modal .tlt-form > label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.filing-modal .tlt-form input[type="text"] {
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--plan-control-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--plan-control-bg);
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--tlt-color-text);
}

.filing-modal .tlt-form > label.filing-from-option {
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--plan-control-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--plan-control-bg);
    font-weight: 400;
    font-size: 0.95rem;
    cursor: pointer;
}

.filing-modal .tlt-form label.filing-from-option input[type="radio"] {
    flex: none;
    width: 1.1rem;
    height: 1.1rem;
    padding: 0;
    margin: 0;
}

.filing-from-option:has(input:checked) {
    border-color: var(--tlt-color-primary);
}

.filing-destination {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.filing-destination-label {
    font-weight: 600;
    font-size: 0.85rem;
}

.filing-destination-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 1px solid var(--plan-control-border);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--plan-control-bg);
    font-family: var(--tlt-font-body);
    font-size: 0.95rem;
    color: var(--tlt-color-text);
    text-align: left;
    cursor: pointer;
}

.filing-destination-btn > span:nth-child(2) {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

.filing-destination-change {
    font-size: 0.8rem;
    color: var(--tlt-color-primary);
}

.filing-error {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translateX(-50%);
    z-index: 200;
}

@media (max-width: 40rem) {
    .document-path { font-size: 0.75rem; }
    .document-path-popover { left: auto; right: 0; }
}


/* ---- R4: the References tab of the right-hand pane (ReferencesPane.razor) ---- */
.references-pane {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.25rem 0 1rem;
}

.references-section {
    border-bottom: 1px solid var(--tlt-color-border);
    padding-bottom: 0.4rem;
}

.references-section:last-child {
    border-bottom: none;
}

.references-section-head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.55rem 0.15rem;
    background: none;
    border: none;
    font-family: var(--tlt-font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
    cursor: pointer;
    text-align: left;
}

.references-section-head:hover {
    color: var(--tlt-color-text);
}

.references-section-caret {
    width: 0.8rem;
    font-size: 0.8rem;
}

.references-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.references-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.references-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.15rem 0;
}

.references-row--stack {
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
}

.references-row-link {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    min-width: 0;
    flex: 1;
    padding: 0.4rem 0.35rem;
    border-radius: var(--tlt-radius-sm);
    color: var(--tlt-color-text);
    text-decoration: none;
}

a.references-row-link:hover {
    background-color: var(--tlt-color-bg);
}

.references-row-link > svg {
    flex: none;
    margin-top: 0.15rem;
    color: var(--tlt-color-text-muted);
}

.references-row-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.references-row-title {
    font-size: 0.92rem;
    overflow-wrap: anywhere;
}

.references-row-meta {
    font-size: 0.78rem;
    color: var(--tlt-color-text-muted);
    overflow-wrap: anywhere;
}

.references-pill {
    flex: none;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    color: var(--tlt-color-text-muted);
    background-color: var(--tlt-color-chrome);
}

.references-pill--done {
    color: var(--tlt-color-primary);
    background-color: color-mix(in srgb, var(--tlt-color-primary) 12%, var(--tlt-color-surface));
}

.references-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0 0.35rem 0.3rem 2.1rem;
}

.references-chip {
    font-size: 0.74rem;
    font-weight: 600;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    border: 1px solid var(--tlt-color-border);
    color: var(--tlt-color-text);
    text-decoration: none;
}

a.references-chip:hover {
    background-color: var(--tlt-color-bg);
    border-color: var(--tlt-color-text-muted);
}

.references-chip--plain {
    color: var(--tlt-color-text-muted);
}

.references-subhead {
    margin: 0.5rem 0 0.1rem;
    padding: 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
}

.references-empty {
    margin: 0 0 0.3rem;
    padding: 0 0.35rem;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}


/* ---- R5: click-to-rename title ---- */
.document-toolbar-title--editable {
    cursor: text;
    border-radius: var(--tlt-radius-sm);
}

.document-toolbar-title--editable:hover {
    background-color: var(--tlt-color-bg);
}

.document-toolbar-title-input {
    font: inherit;
    width: min(100%, 36rem);
    padding: 0 0.3rem;
    border: 1px solid var(--tlt-color-primary);
    border-radius: var(--tlt-radius-sm);
    background-color: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    outline: none;
}

.quick-add-menu {
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
}

.quick-add-menu-error {
    margin: 0.25rem 0.5rem;
}


/* ---- Editor toolbar, Quip-light (replaces the heavy dark-grey filled buttons) ----
   BlockNote renders its toolbar buttons as Mantine ActionIcons in the "filled" variant (we had pointed Mantine's primary at #495057, so every
   Bold / Italic / Lesson / More / Comment button was a dark square with a white icon). Quip's bar is flat: grey line icons on white, a pale
   hover, and a pale-blue "on" state. Mantine sets --ai-color inline, hence the !importants. Scoped to the toolbar (and its phone "More"
   dropdown) so BlockNote's own menus and side menu keep their look. */
.tlt-editor-toolbar,
.tlt-toolbar-more-dropdown {
    --tlt-tool-ink: color-mix(in srgb, var(--tlt-color-text) 78%, var(--tlt-color-surface));
    --tlt-tool-hover: color-mix(in srgb, var(--tlt-color-text) 7%, var(--tlt-color-surface));
    --tlt-tool-on-bg: var(--tlt-color-active);
    --tlt-tool-on-ink: var(--tlt-color-primary-dark);
}

.tlt-editor-toolbar {
    gap: 0.15rem;
    padding-top: 0.4rem;
    padding-bottom: 0.4rem;
}

.tlt-editor-toolbar .mantine-ActionIcon-root,
.tlt-toolbar-more-dropdown .mantine-ActionIcon-root {
    --ai-size: 2rem !important;
    min-width: 2rem;
    background-color: transparent !important;
    color: var(--tlt-tool-ink) !important;
    border: none;
    border-radius: 5px;
    box-shadow: none;
}

.tlt-editor-toolbar .mantine-ActionIcon-root:hover:not(:disabled):not([data-disabled]),
.tlt-toolbar-more-dropdown .mantine-ActionIcon-root:hover:not(:disabled):not([data-disabled]) {
    background-color: var(--tlt-tool-hover) !important;
    color: var(--tlt-color-text) !important;
}

/* "On": Bold/Italic while the selection is bold/italic, the active alignment, an open dropdown. */
.tlt-editor-toolbar .mantine-ActionIcon-root[aria-pressed="true"],
.tlt-editor-toolbar .mantine-ActionIcon-root[data-selected="true"],
.tlt-editor-toolbar .mantine-ActionIcon-root[aria-expanded="true"],
.tlt-toolbar-more-dropdown .mantine-ActionIcon-root[aria-pressed="true"],
.tlt-toolbar-more-dropdown .mantine-ActionIcon-root[data-selected="true"] {
    background-color: var(--tlt-tool-on-bg) !important;
    color: var(--tlt-tool-on-ink) !important;
}

.tlt-editor-toolbar .mantine-ActionIcon-root:disabled,
.tlt-editor-toolbar .mantine-ActionIcon-root[data-disabled] {
    background-color: transparent !important;
    color: color-mix(in srgb, var(--tlt-tool-ink) 45%, transparent) !important;
}

.tlt-editor-toolbar .mantine-ActionIcon-root svg {
    width: 1.2rem;
    height: 1.2rem;
}

/* The paragraph-style dropdown ("Paragraph") is a Mantine Button, blue by default - plain ink text with a caret, like Quip's "Normal". */
.tlt-editor-toolbar .mantine-Button-root {
    --button-color: var(--tlt-color-text) !important;
    --button-hover: var(--tlt-tool-hover) !important;
    color: var(--tlt-color-text) !important;
    --button-fz: 0.95rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 5px;
}

.tlt-editor-toolbar .mantine-Button-root svg {
    color: var(--tlt-tool-ink);
}

/* Font / size triggers are action icons that carry a text label rather than an icon. */
.tlt-editor-toolbar .tlt-font-family-trigger,
.tlt-editor-toolbar .tlt-font-size-trigger {
    width: auto;
    padding: 0 0.55rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--tlt-color-text) !important;
}

.tlt-editor-toolbar-divider {
    height: 1.4rem;
    margin: 0 0.4rem;
}

/* Quip's Comment button is an icon plus the word; the word folds away when the toolbar is narrow. */
.tlt-editor-toolbar .tlt-comment-button {
    width: auto;
    gap: 0.4rem;
    padding: 0 0.6rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--tlt-color-text) !important;
}

.tlt-comment-button-inner {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

@container tlt-toolbar (max-width: 44rem) {
    .tlt-comment-button-label {
        display: none;
    }
}

/* Not focused in the document yet: dim, don't ghost. */
.bn-container:not(:focus-within) .tlt-editor-toolbar-formatting {
    opacity: 0.55;
}


/* Quip's "Insert:" group on the toolbar (editor-src/insertToolbarButtons.tsx). */
.tlt-insert-label {
    padding: 0 0.3rem 0 0.15rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--tlt-color-text);
    white-space: nowrap;
}


/* ---- Right pane: icon tabs (tooltip = the label) ---- */
.document-pane-tabs .pane-tab {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 0.6rem 0.4rem;
}

.document-pane-tabs .pane-tab svg {
    flex: none;
}

.document-pane-tabs .pane-tab--active {
    color: var(--tlt-color-primary);
}

.document-pane-tabs .pane-tab .pane-tab-count {
    position: absolute;
    top: 0.2rem;
    left: calc(50% + 0.35rem);
    margin: 0;
    padding: 0 0.28rem;
    min-width: 1rem;
    text-align: center;
    line-height: 1.1rem;
    font-size: 0.68rem;
}

/* References dialog (the pill / Document > References) */
.references-modal {
    max-width: 34rem;
    width: 100%;
}

.references-modal h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

/* The Comments tab's bubble is the document's own comment-badge shape (outline, like the other tab icons). */
.pane-tab-bubble {
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linejoin: round;
}


/* Document text defaults to the site serif. BlockNote's own bundle hard-codes Inter / system sans on the editor element itself
   (.bn-default-styles), which beat --bn-font-family; the toolbar's "Serif" / "Sans Serif" choices still apply per run on top of this. */
.bn-root .bn-default-styles {
    font-family: var(--tlt-font-body);
}


/* Add a Book: fill the lessons from the Book's chapters */
.connect-fill { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; margin: 0.25rem 0 0.75rem; }
.connect-fill-field { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; font-weight: 600; }
.connect-fill-field input[type="number"] { width: 5rem; }
.connect-leftover { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 0 0 0.75rem; padding: 0.6rem 0.75rem; border: 1px solid var(--tlt-color-border); border-radius: var(--tlt-radius-sm); background-color: var(--tlt-color-active); }
.connect-new-tag { display: inline-block; margin-left: 0.4rem; padding: 0 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; background-color: var(--tlt-color-active); color: var(--tlt-color-primary-dark); white-space: nowrap; }


/* "Copies to use" (CopyPicker.razor) */
.copy-picker { border: 1px solid var(--tlt-color-border); border-radius: var(--tlt-radius-sm); padding: 0.5rem 0.9rem 0.6rem; margin: 0 0 0.9rem; }
.copy-picker legend { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--tlt-color-text-muted); padding: 0 0.35rem; width: auto; }
.copy-picker-list { list-style: none; margin: 0.25rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.15rem 1.25rem; }
.copy-picker .checkbox-label { margin: 0.2rem 0; }


/* Each lesson block lists the chapters of the attached Book(s) it covers, right under its title (lessonChapters.ts). */
.tlt-lesson-block-main { flex: 1; min-width: 0; }
.tlt-lesson-chapters { list-style: none; margin: 0.1rem 0 0.15rem; padding: 0; font-size: 0.86rem; font-weight: 400; color: var(--tlt-color-text-muted); }
.tlt-lesson-chapters li { display: flex; flex-wrap: wrap; gap: 0 0.4rem; }
.tlt-lesson-chapters-book { font-weight: 600; color: var(--tlt-color-text-muted); text-decoration: none; }
.tlt-lesson-chapters-book:hover { color: var(--tlt-color-primary); text-decoration: underline; }
.tlt-lesson-chapters-book::after { content: ":"; }
.tlt-lesson-chapters-list { overflow-wrap: anywhere; }

/* Program document: the four choices above the text, and the chips after each line. */
.program-strip { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1.25rem; margin: 0 0 0.35rem; }
.program-strip-field { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; font-size: 0.8rem; color: var(--tlt-color-text-muted); }
.program-strip-field select, .program-strip-field input[type="date"] { min-width: 9rem; }
.program-strip-days { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.program-strip-days button { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.program-strip-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.6rem; margin: 0 0 0.75rem; font-size: 0.82rem; color: var(--tlt-color-text-muted); }
.program-strip-warning { color: var(--tlt-color-warning, #92400e); }

.tlt-program-chips { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; margin-left: 0.6rem; vertical-align: baseline; user-select: none; font-family: var(--tlt-font-sans, inherit); }
.tlt-program-chip { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; border: 0.5px solid var(--tlt-color-border); background: var(--tlt-color-surface); color: var(--tlt-color-text-muted); font: inherit; font-size: 0.74rem; font-weight: 500; line-height: 1.5; white-space: nowrap; }
.tlt-program-chip--ok { color: var(--tlt-color-success); border-color: currentColor; background: transparent; }
.tlt-program-chip--warn { color: var(--tlt-color-warning, #92400e); border-color: currentColor; background: transparent; }
/* A Book that is in the Library: its typed name in the line is a plain link (no chip), so the Program keeps its document look. */
.tlt-program-booklink { color: var(--tlt-color-primary); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 0.15em; cursor: pointer; }
.tlt-program-booklink:hover { text-decoration-color: currentColor; }
/* A Book with no copy yet: just a small blue "+" (always visible, tooltip = "Add book to your library"). */
.tlt-program-add { display: inline-flex; align-items: center; justify-content: center; width: 0.9rem; height: 0.9rem; padding: 0; border: 0.5px solid var(--tlt-color-primary); border-radius: 50%; background: transparent; color: var(--tlt-color-primary); opacity: 0.6; cursor: pointer; align-self: center; transition: opacity 120ms ease, background-color 120ms ease, color 120ms ease; }
.tlt-program-add svg { width: 0.5rem; height: 0.5rem; stroke-width: 2.5; }
.tlt-program-add:hover, .tlt-program-add:focus-visible { opacity: 1; background: var(--tlt-color-primary); color: #fff; }
.tlt-program-add:focus-visible { outline: 2px solid var(--tlt-color-primary); outline-offset: 2px; }
/* The information notes (how much, how often, "In your Library") are not buttons, so they only appear while the line is hovered or being edited
   (focus-within also covers keyboard; devices with no hover show them always); warnings stay visible because they need attention. Hidden notes keep
   their space, so the line never jumps. */
.tlt-program-chips { position: relative; align-items: center; }
.tlt-program-info { position: absolute; left: 100%; top: 50%; transform: translateY(-50%); margin-left: 0.35rem; display: flex; gap: 0.25rem; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.12s ease; z-index: 2; }
.bn-block-outer:hover .tlt-program-info, .bn-block-outer:focus-within .tlt-program-info { opacity: 1; }
@media (hover: none) { .tlt-program-info { opacity: 1; position: static; transform: none; margin-left: 0.25rem; } }
@media print { .tlt-program-chips, .program-strip, .program-strip-note { display: none; } }

.school-term-settings { margin: 0 0 1rem; }
.term-exam-select { display: block; width: 100%; max-width: 16rem; margin-top: 0.3rem; font-size: 0.82rem; }
.program-strip-apply { align-self: flex-end; }
.program-strip-result { margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--tlt-color-success); }
.program-strip-result--error { color: var(--tlt-color-danger, #b91c1c); }

.finish-book-options { display: grid; gap: 0.5rem; margin: 0.75rem 0; }
.finish-book-option { display: flex; align-items: center; gap: 0.85rem; width: 100%; padding: 0.7rem 0.9rem; border: 0.5px solid var(--tlt-color-border); border-radius: 10px; background: var(--tlt-color-surface); color: var(--tlt-color-text); text-align: left; cursor: pointer; font: inherit; }
.finish-book-option:hover { border-color: var(--tlt-color-primary); }
.finish-book-option span { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.finish-book-option small { color: var(--tlt-color-text-muted); font-size: 0.8rem; }
.finish-book-more { margin: 0; }

/* An @reference in a Program header ("Term: @Autumn 2026", "For: @Anna"): a quiet pill, not a person mention. */
.tlt-ref { display: inline-block; padding: 0 0.45rem; border-radius: 999px; background: var(--tlt-color-surface); border: 0.5px solid var(--tlt-color-border); color: var(--tlt-color-primary); font-weight: 500; }
.program-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; margin: 0 0 0.35rem; }
.program-bar .program-strip-note { margin: 0; }
.program-period-map { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0 0 0.5rem; padding: 0; list-style: none; font-size: 0.82rem; color: var(--tlt-color-text); }
.program-period-map li { padding: 0.1rem 0.6rem; border: 0.5px solid var(--tlt-color-border); border-radius: 999px; background: var(--tlt-color-surface); }
.program-period-map .program-period-map--missing { color: var(--tlt-color-text-muted); border-style: dashed; background: transparent; }
@media print { .program-period-map { display: none; } }
.school-days { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0 0 0.35rem; }
.school-days button { padding: 0.3rem 0.65rem; font-size: 0.85rem; }
.school-days-label { margin: 0 0 0.3rem; font-weight: 500; }

/* A Book with sub-books (the Bible): collapsible groups of chapters. */
.book-groups { display: flex; flex-direction: column; gap: 0.25rem; }
.book-group { border-bottom: 0.5px solid var(--tlt-color-border); }
.book-group-header { display: flex; align-items: baseline; gap: 0.5rem; width: 100%; padding: 0.45rem 0.25rem; border: 0; background: transparent; color: var(--tlt-color-text); font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.book-group-header:hover { background: var(--tlt-color-surface); }
.book-group-caret { width: 1rem; color: var(--tlt-color-text-muted); }
.book-group-count { margin-left: auto; font-size: 0.8rem; font-weight: 400; color: var(--tlt-color-text-muted); }
.book-group .book-chapters { margin: 0 0 0.5rem 1.4rem; }

/* System folders (School > year > term > child): the muted "Deleted" tag on a folder whose year/term was deleted, and the date fields in the New Folder dialog. */
.folder-retired-badge {
    display: inline-block;
    margin-inline-start: 0.4rem;
    padding: 0.05rem 0.45rem;
    border: 1px solid var(--color-border, #cbd2dc);
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text-muted, #6b7280);
    background: var(--color-surface-muted, #f1f3f6);
    vertical-align: middle;
}
.folder-date-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-block: 0.5rem;
}
@media (max-width: 480px) {
    .folder-date-fields { grid-template-columns: 1fr; }
}

/* The trail of pages visited, above every page (site.js: tltTrail). One thin line; the earliest crumbs shrink first, the page you are on never does. */
.trail { flex: none; display: flex; align-items: center; gap: 0.35rem; min-width: 0; padding: 0.55rem 1.25rem 0.35rem; font-size: 0.82rem; color: var(--tlt-color-text-muted); white-space: nowrap; }
.trail:empty { display: none; }
.trail-crumb { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: inherit; text-decoration: none; }
a.trail-crumb { flex: 0 1 auto; }
a.trail-crumb:hover, a.trail-crumb:focus-visible { color: var(--tlt-color-primary); text-decoration: underline; }
.trail-crumb--current { flex: 0 0 auto; max-width: 60%; color: var(--tlt-color-text); font-weight: 500; }
.trail-sep { flex: none; opacity: 0.55; }
@media (max-width: 40rem) { .trail { padding-left: 1rem; padding-right: 1rem; } }

/* ---- Top navigation bar: the broad destinations across the very top, above the breadcrumb trail. ---- */
.top-nav { flex: none; display: flex; align-items: stretch; gap: 0.25rem; padding: 0 1.25rem; background-color: var(--tlt-color-surface); border-bottom: 1px solid var(--tlt-color-border); }
.top-nav-link { display: flex; align-items: center; padding: 0.7rem 0.85rem 0.62rem; border-bottom: 2px solid transparent; font-family: var(--tlt-font-heading); font-size: 1.02rem; color: var(--tlt-color-text-muted); text-decoration: none; white-space: nowrap; }
.top-nav-link:hover { color: var(--tlt-color-text); }
.top-nav-link:focus-visible { outline: 2px solid var(--tlt-color-accent); outline-offset: -2px; }
.top-nav-link.active { color: var(--tlt-color-text); border-bottom-color: var(--tlt-color-accent); }
@media (max-width: 40rem) { .top-nav { padding: 0 0.25rem; gap: 0; overflow-x: auto; scrollbar-width: none; } .top-nav-link { padding-left: 0.55rem; padding-right: 0.55rem; font-size: 0.88rem; } }

/* ===================================================================================================================
   Weekly schedule board (ProgramSchedule.razor): a stack of lesson-plan cards dragged onto the weekdays
   =================================================================================================================== */
.sched {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: none;
    margin: 0;
    padding: 0.25rem 0 1rem;
}

.sched-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.sched-head h1 {
    margin: 0;
}

.sched-bar {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.sched-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
}

.sched-save {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sched-unsaved {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.sched-who {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.sched-who-label {
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
    margin-right: 0.25rem;
}

.sched-chip-btn {
    border: 1px solid var(--tlt-color-border);
    background: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    border-radius: 999px;
    padding: 0.25rem 0.8rem;
    font-size: 0.85rem;
    cursor: pointer;
}

.sched-chip-btn.is-on {
    background: var(--tlt-color-primary);
    border-color: var(--tlt-color-primary);
    color: var(--tlt-color-on-primary, #fff);
}

.sched-message {
    margin: 0;
}

.sched-confirm {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
}

.sched-confirm span {
    flex: 1 1 14rem;
}

.sched-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
}

.sched-row h2 {
    margin: 0;
    font-size: 1.15rem;
}

.sched-plans-wrap > summary {
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.sched-plans {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sched-plan {
    border: 1px solid var(--tlt-color-border);
    border-left: 4px solid var(--card-accent, var(--tlt-color-accent));
    border-radius: var(--tlt-radius-sm);
    padding: 0.45rem 0.65rem;
    display: grid;
    grid-template-columns: minmax(10rem, 1.3fr) auto minmax(10rem, 1fr);
    align-items: center;
    gap: 0.4rem 1rem;
    min-width: 0;
}

@media (max-width: 760px) {
    .sched-plan {
        grid-template-columns: minmax(0, 1fr);
    }
}

.sched-plan-name {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.5rem;
}

.sched-plan-name small {
    flex-basis: 100%;
    color: var(--tlt-color-text-muted);
}

.sched-plan-controls .checkbox-label {
    margin: 0;
}

.sched-plan-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.9rem;
}

.sched-plan-controls label:not(.checkbox-label),
.sched-card-edit label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
}

.sched-plan-controls input[type="number"] {
    width: 4.5rem;
}

.sched-forecast {
    margin: 0;
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
    min-height: 1.1em;
}

.sched-forecast.is-over {
    color: var(--tlt-color-danger, #b3261e);
}

.sched-level {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    border: 1px solid currentColor;
    color: var(--tlt-color-text-muted);
}

.sched-week {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.sched-week-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.sched-weekbody {
    display: grid;
    grid-template-columns: minmax(12rem, 15rem) minmax(0, 1fr);
    gap: 0.6rem;
    align-items: start;
}

.sched-day {
    border: 1px dashed var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    padding: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 6rem;
    min-width: 0;
}

.sched-days {
    display: grid;
    grid-template-columns: repeat(var(--sched-day-count, 5), minmax(0, 1fr));
    gap: 0.4rem;
}

.sched-day.is-target {
    border-color: var(--tlt-color-accent);
}

.sched-day-name,
.sched-stack-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
}

.sched-empty {
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
    opacity: 0.7;
}

.sched-card {
    border: 1px solid var(--tlt-color-border);
    border-left: 4px solid var(--card-accent, var(--tlt-color-accent));
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
    padding: 0.3rem 0.45rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem 0.4rem;
    cursor: grab;
    min-width: 0;
}

.sched-card:hover {
    background: var(--tlt-color-bg);
}

.sched-card.is-picked {
    outline: 2px solid var(--tlt-color-accent);
}

.sched-card-title {
    font-size: 0.85rem;
    overflow-wrap: anywhere;
    flex: 1 1 6rem;
}

.sched-card-time {
    border: 0;
    background: none;
    color: var(--tlt-color-text-muted);
    font-size: 0.7rem;
    padding: 0.1rem 0.3rem;
    cursor: pointer;
    border-radius: 999px;
}

.sched-card-time.has-time {
    color: var(--tlt-color-text);
    background: color-mix(in srgb, var(--tlt-color-surface) 85%, var(--tlt-color-primary));
}

.sched-card-edit {
    flex-basis: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.4rem;
    padding-top: 0.3rem;
    cursor: default;
}

.sched-card-edit input[type="number"] {
    width: 4.5rem;
}

.sched-pick-hint {
    position: sticky;
    bottom: 0.75rem;
    align-self: center;
    margin: 0;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: var(--tlt-color-primary);
    color: var(--tlt-color-on-primary, #fff);
    font-size: 0.85rem;
}

@media (max-width: 760px) {
    .sched {
        padding: 0.5rem;
    }

    .sched-weekbody {
        grid-template-columns: minmax(0, 1fr);
    }

    .sched-days {
        grid-template-columns: minmax(0, 1fr);
    }

    .sched-save {
        margin-left: 0;
        width: 100%;
    }
}

/* Flexible scheduling: a day that has no lesson rows yet shows what the rhythm expects there - quiet, not clickable. */
.calendar-lesson-chip--forecast {
    opacity: 0.65;
    border-style: dashed;
    cursor: default;
}

.lesson-status--forecast {
    background: transparent;
    color: var(--tlt-color-text-muted);
    border: 1px dashed var(--tlt-color-border);
}

/* Flexible scheduling: "More you could do today" - plans not on today's list that can be started now. */
.more-to-do {
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--tlt-color-border);
}

.more-to-do-heading {
    margin: 0 0 0.5rem;
    font-size: 1rem;
}

.more-to-do-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.more-to-do-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.more-to-do-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.more-to-do-next,
.more-to-do-child {
    color: var(--tlt-color-text-muted);
}

.more-to-do-row .btn-secondary {
    flex: none;
    white-space: nowrap;
}

/* Schedule board: the "To place" column groups cards by plan; each group carries the plan's own times-a-week input. */
.sched-weekbody {
    grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr);
}

.sched-plan-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.4rem 0.45rem;
    border: 1px solid var(--tlt-color-border);
    border-left: 4px solid var(--card-accent, var(--tlt-color-accent));
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
}

.sched-plan-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.sched-plan-head .sched-plan-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.sched-times {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    flex: none;
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
}

.sched-times input[type="number"] {
    width: 3.6rem;
    padding: 0.2rem 0.35rem;
}

.sched-plan-more > summary {
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
}

.sched-plan-more .sched-plan-controls {
    margin-top: 0.3rem;
}

.sched-plan-group .sched-card {
    border-left-width: 1px;
}

@media (max-width: 760px) {
    .sched-weekbody {
        grid-template-columns: minmax(0, 1fr);
    }
}


/* ---- Schedule board: a physical pile of cards. Only the top card shows; click a card to flip it over for its settings. ---- */
.sched-howto {
    margin: 0 0 0.25rem;
    font-size: 0.9rem;
    color: var(--tlt-color-text-muted);
}

.sched-rowbody {
    display: grid;
    grid-template-columns: minmax(13rem, 16rem) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

/* The piles scroll on their own (a pile per subject is a long column) while the weeks beside them stay put, so a card can always be
   dragged to a day without scrolling the page. The right padding keeps the offset edges of a pile inside the scroll area. */
.sched-deckcol {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    position: sticky;
    top: 0.5rem;
    /* Capped well below the window height and chaining to the page at its ends, so a row never traps the wheel: the page can always be
       scrolled on to the next student or group (a full-height pile that did not chain made every row a scroll trap). */
    max-height: min(30rem, calc(100vh - 1rem));
    overflow-y: auto;
    padding: 0.15rem 0.8rem 0.6rem 0.15rem;
}

.sched-stackmode {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.sched-stackmode-label {
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
}

.sched-subjectpicker {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sched-subjectpicker-select {
    flex: 1;
    min-width: 0;
    padding: 0.3rem 0.4rem;
}

.sched-subjectpile {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sched-subjectpile-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
}

.sched-subjectpile-left {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--tlt-color-text-muted);
}

.sched-deck {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 9rem;
}

.sched-deck-empty {
    display: grid;
    place-items: center;
    min-height: 8rem;
    border: 2px dashed var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    color: var(--tlt-color-text-muted);
    font-size: 0.85rem;
    text-align: center;
    padding: 0.5rem;
}

/* The cards behind the top one show only as edges. */
.sched-pile {
    position: relative;
    padding-bottom: 0.3rem;
}

.sched-pile::before,
.sched-pile::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
    z-index: 0;
    opacity: 0;
}

.sched-pile--1::before,
.sched-pile--2::before {
    opacity: 1;
    transform: translate(4px, 5px);
}

.sched-pile--2::after {
    opacity: 1;
    transform: translate(8px, 10px);
}

.sched-pile > .sched-flip {
    position: relative;
    z-index: 1;
}

.sched-spin {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 0.9rem;
}

.sched-spin-count {
    font-size: 0.8rem;
    color: var(--tlt-color-text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 4.5rem;
    text-align: center;
}

.sched-spin-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    border: 1px solid var(--tlt-color-border);
    background: var(--tlt-color-surface);
    color: var(--tlt-color-text);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.sched-spin--subject {
    margin-top: 0.3rem;
}

.sched-spin--subject .sched-spin-count {
    min-width: 6rem;
    max-width: 8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sched-spin-btn--subject {
    font-size: 1rem;
}

.sched-spin-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.sched-leftout {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.sched-leftout-label {
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
}

.sched-weeks {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    min-width: 0;
    position: sticky;
    top: 0.5rem;
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
    padding: 0.15rem 0.15rem 0.6rem;
}

/* A flip card: front and back share one grid cell and turn on the Y axis. */
.sched-flip {
    perspective: 900px;
    min-width: 0;
    cursor: grab;
}

.sched-flip-inner {
    display: grid;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.sched-flip.is-flipped .sched-flip-inner {
    transform: rotateY(180deg);
}

.sched-face {
    grid-area: 1 / 1;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border: 1px solid var(--tlt-color-border);
    border-left: 4px solid var(--card-accent, var(--tlt-color-accent));
    border-radius: var(--tlt-radius-sm);
    background: var(--tlt-color-surface);
    padding: 0.5rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.12);
}

.sched-face--front {
    cursor: pointer;
}

.sched-face--back {
    transform: rotateY(180deg);
    cursor: default;
    gap: 0.4rem;
}

/* A card on the stack is square at the pile's width (taller only if the back's controls need it). */
.sched-flip.is-deck .sched-flip-inner {
    aspect-ratio: 1;
    grid-template-rows: minmax(0, 1fr);
}

.sched-flip.is-deck .sched-face--back {
    overflow-y: auto;
}

.sched-flip.is-deck .sched-face--back .sched-card-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 0.85rem;
}

/* Clicking anywhere on the back's edge flips it; the hint line costs space a square card doesn't have. */
.sched-flip.is-deck .sched-flip-back-hint {
    display: none;
}

.sched-flip.is-deck .sched-face--front {
    justify-content: center;
}

.sched-flip.is-deck .sched-face--back {
    gap: 0.25rem;
    padding: 0.4rem 0.5rem;
}

.sched-flip.is-deck .sched-back-controls {
    gap: 0.25rem;
}

.sched-flip.is-placed .sched-face {
    padding: 0.3rem 0.45rem;
}

.sched-flip.is-placed .sched-card-title {
    font-size: 0.85rem;
}

/* A placed card is compact at rest: only the face that is showing takes space, except while it turns. */
.sched-flip.is-placed:not(.is-flipped):not(.is-animating) .sched-face--back,
.sched-flip.is-placed.is-flipped:not(.is-animating) .sched-face--front {
    display: none;
}

.sched-card-title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.sched-card-subject {
    font-size: 0.75rem;
    color: var(--tlt-color-text-muted);
}

.sched-face .sched-times {
    margin-top: 0.3rem;
}

.sched-back-controls {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.8rem;
}

.sched-back-controls label:not(.checkbox-label) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sched-back-controls input[type="number"],
.sched-back-controls input[type="time"],
.sched-back-controls select {
    width: 7rem;
    max-width: 55%;
    padding: 0.2rem 0.35rem;
}

.sched-flip-back-hint {
    font-size: 0.7rem;
    color: var(--tlt-color-text-muted);
    text-align: center;
    cursor: pointer;
}

.sched-flip[draggable="true"]:active {
    cursor: grabbing;
}

@media (prefers-reduced-motion: reduce) {
    .sched-flip-inner {
        transition-duration: 0.01s;
    }
}

@media (max-width: 760px) {
    .sched-rowbody {
        grid-template-columns: minmax(0, 1fr);
    }

    .sched-deckcol,
    .sched-weeks {
        position: static;
        max-height: none;
        overflow-y: visible;
    }
}

/* On a placed card the day column is narrow: label above its input. */
.sched-flip.is-placed .sched-back-controls label:not(.checkbox-label) {
    flex-direction: column;
    align-items: stretch;
    gap: 0.1rem;
}

.sched-flip.is-placed .sched-back-controls input[type="number"],
.sched-flip.is-placed .sched-back-controls input[type="time"],
.sched-flip.is-placed .sched-back-controls select {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
}


/* Cards are filled with their subject colour (white text) rather than carrying a coloured edge. */
.sched-face {
    background: var(--card-accent, var(--tlt-color-accent));
    border-color: color-mix(in srgb, var(--card-accent, var(--tlt-color-accent)) 75%, #000);
    border-left-width: 1px;
    color: #fff;
}

.sched-face .sched-card-subject,
.sched-face .sched-times,
.sched-face .sched-flip-back-hint,
.sched-face .sched-forecast,
.sched-face .sched-level {
    color: rgb(255 255 255 / 0.85);
}

.sched-face .sched-forecast.is-over {
    color: #fff;
    font-weight: 700;
}

.sched-face .sched-card-time.has-time {
    color: #fff;
    background: rgb(0 0 0 / 0.25);
}

.sched-pile::before,
.sched-pile::after {
    background: color-mix(in srgb, var(--tlt-color-surface) 80%, var(--tlt-color-text));
}


/* The next card waits under the top one and slides up into place when the top card is lifted off the pile. */
.sched-pile::before {
    display: none;
}

.sched-peek {
    position: absolute;
    inset: 0 0 0.3rem 0;
    z-index: 1;
    transform: translate(5px, 6px);
    transition: transform 0.25s ease-out;
    pointer-events: none;
}

.sched-peek .sched-face {
    height: 100%;
    box-sizing: border-box;
    justify-content: center;
    box-shadow: 0 1px 3px rgb(0 0 0 / 0.18);
}

.sched-pile.is-lifting .sched-peek {
    transform: translate(0, 0);
}

/* The lifted card shrinks toward where it was grabbed (to the size of the copy being dragged) while it fades out. */
.sched-flip.is-deck.is-lifted {
    transition: transform 0.25s ease-out, opacity 0.25s ease-out;
    transform: scale(var(--lift-scale, 0.5));
    opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
    .sched-peek,
    .sched-flip.is-deck.is-lifted {
        transition-duration: 0.01s;
    }
}


/* The count on the front of a card: label on the left, a box just wide enough for its digits and the spinner on the right
   (it grows to the left if the number ever needs a second digit). */
.sched-face .sched-times {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}

.sched-face .sched-times input[type="number"].sched-times-input {
    flex: none;
    box-sizing: content-box;
    width: calc(var(--digits, 1) * 1ch + 1.1rem);
    padding: 0.2rem 0.2rem 0.2rem 0.35rem;
    text-align: right;
}

/* Cards keep their transition at all times, so a cancelled drag animates back to the pile as smoothly as it left. */
.sched-flip.is-deck {
    transition: transform 0.25s ease-out, opacity 0.25s ease-out;
}


/* Count label sits right beside its box, broken after the first word so it takes two rows next to the taller input. */
.sched-face .sched-times {
    justify-content: flex-end;
    gap: 0.4rem;
}

.sched-face .sched-times .sched-times-label {
    text-align: right;
    line-height: 1.15;
}

/* A card dropped back on the pile from a day grows in at the pile: the reverse of being lifted off. */
@keyframes sched-arrive {
    from {
        transform: scale(0.46);
        opacity: 0.2;
    }

    to {
        transform: none;
        opacity: 1;
    }
}

.sched-flip.is-deck.is-arriving {
    animation: sched-arrive 0.28s ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .sched-flip.is-deck.is-arriving {
        animation-duration: 0.01s;
    }
}


.sched-head-links {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

/* The old planning pages sit apart from the everyday destinations, at the far end of the bar. */
.top-nav-link--legacy { margin-left: auto; font-size: 0.9rem; }

/* NewProgramModal: the ways a new program document can start, as a list of radio-style choices (buttons, so the form-control styling never turns them into text boxes). */
.new-program-modal {
    max-width: 36rem;
}

.new-program-modal > label,
.new-program-modal > .btn-primary,
.new-program-modal > .settings-file-button {
    margin-top: 1rem;
}

.program-choice-heading {
    margin: 1.25rem 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--tlt-color-text-muted);
}

.program-choice-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.program-choice {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    align-items: flex-start;
    width: 100%;
    padding: 0.6rem 0.8rem;
    text-align: left;
    color: var(--tlt-color-text);
    background: var(--tlt-color-surface);
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius);
    cursor: pointer;
}

.program-choice span {
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.program-choice:hover {
    border-color: var(--tlt-color-primary);
}

.program-choice[aria-checked="true"] {
    border-color: var(--tlt-color-primary);
    background: color-mix(in srgb, var(--tlt-color-surface) 90%, var(--tlt-color-primary));
    box-shadow: 0 0 0 1px var(--tlt-color-primary);
}
/* Import from Quip (/import/quip) */
.quip-import-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    margin: 0.75rem 0;
}

.quip-import progress {
    width: 100%;
    max-width: 28rem;
    height: 0.6rem;
}

.quip-import-steps {
    padding-left: 1.25rem;
    margin: 0.5rem 0 1rem;
}

.quip-import-steps li {
    margin: 0.25rem 0;
}

.quip-import-advanced {
    margin: 0.5rem 0;
}

.quip-import-problems {
    list-style: none;
    padding: 0;
    max-height: 24rem;
    overflow-y: auto;
}

.quip-import-problems li {
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    overflow-wrap: anywhere;
}

/* Inside .tlt-form every label stacks and every input is full width; a checkbox row stays on one line. */
.quip-import .tlt-form .quip-import-check {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.quip-import .tlt-form .quip-import-check input[type=checkbox] {
    width: auto;
    margin: 0;
}

/* Single checkboxes on the sign-in cards: box and text on one line. */
.auth-card label.auth-check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.auth-card label.auth-check > input[type="checkbox"] {
    display: inline-block;
    width: auto;
    margin: 0.2rem 0 0;
    flex: none;
}

/* Reminder to confirm the email address, above every page until it's done. */
.confirm-email-banner {
    margin: 0 auto 1rem;
    max-width: 72rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--tlt-color-border);
    border-radius: var(--tlt-radius);
    background-color: var(--tlt-color-surface);
    font-family: var(--tlt-font-body);
}

.confirm-email-banner a {
    margin-left: 0.35rem;
}

/* Settings > Family: invitations waiting to be accepted, and a link to copy. */
.invite-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
}

.invite-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.6rem 0;
    border-top: 1px solid var(--tlt-color-border);
}

.invite-row > div:first-child {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-wrap: anywhere;
}

.invite-link {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0;
}

.invite-link > .settings-field-label {
    flex-basis: 100%;
}

.invite-link > input {
    flex: 1 1 16rem;
    min-width: 0;
}

.invite-link > .plan-mode-note {
    flex-basis: 100%;
    margin: 0;
}

.settings-section .settings-subheading {
    margin: 1.75rem 0 0.25rem;
}

/* Settings > Account: download my data, delete my account. */
.account-export-btn {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.account-hint {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--tlt-color-text-muted);
}

.account-plan {
    padding-left: 1.25rem;
    margin: 0.5rem 0 1rem;
}

.account-plan li {
    margin-bottom: 0.35rem;
}

.account-plan-erase {
    color: #b3372f;
}

.account-delete-form {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: 24rem;
}

.account-delete-form .settings-field {
    align-self: stretch;
}

.settings-pane .account-delete-btn {
    color: #b3372f;
    border-color: #b3372f;
}

.settings-pane .account-delete-btn:hover {
    color: #fff;
    background-color: #b3372f;
}
