.study-layouts-page {
    color: #0f172a;
    margin: 0;
    padding: 0 1rem 2rem;
}

a:visited {
    color: inherit;
}

button {
    padding-top: .5rem;
}

.study-layouts-hero,
.study-layouts-principles,
.study-layout-card,
.study-layouts-dashboard-note,
.study-layouts-state {
    background: #ffffff;
    border: 1px solid #dbeafe;
    border-radius: 1.1rem;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

.study-layouts-hero {
    background: linear-gradient(135deg, #172033 0%, #22345a 100%);
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
    color: #fff;
    margin: 1rem 0;
    padding: 1.5rem 2rem;
}

.study-layouts-eyebrow {
    color: #ff9334;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    margin: 0 0 0.35rem;
    text-transform: uppercase;
}

.study-layouts-hero h1,
.study-layout-card h2,
.study-layouts-principles h2,
.study-layouts-state h2 {
    color: #0f172a;
    line-height: 1.1;
    margin: 0;
}

.study-layouts-hero h1 {
    color: #fff;
    font-size: clamp(2rem, 4vw, 3.2rem);
}

.study-layouts-hero p {
    color: #c7d0e0;
    font-size: 1rem;
    line-height: 1.65;
    margin-bottom: 0;
    max-width: 72rem;
}
.study-layouts-hero .study-layouts-eyebrow {
    color: #ff9334;
    font-size: 0.78rem;
    margin-bottom: 0.35rem;
}

.study-layout-card-header p,
.state-intro p {
    color: #334155;
    font-size: 1rem;
    line-height: 1.65;
    margin-bottom: 0;
    max-width: 72rem;
}

.layout-state-alert {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: 0.8rem;
    color: #1e3a8a;
    font-weight: 800;
    margin-bottom: 1rem;
    padding: 0.8rem 1rem;
}

.layout-state-alert--success {
    background: #ecfdf5;
    border-color: #86efac;
    color: #166534;
}

.study-layouts-state {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.45fr);
    margin-bottom: 1.25rem;
    padding: 1.15rem;
}

.state-intro {
    grid-column: 1 / -1;
}

.layout-state-form {
    display: grid;
    gap: 0.85rem;
}

.layout-state-form label,
.state-module-slots label,
.state-note-draft {
    color: #334155;
    display: grid;
    font-size: 0.86rem;
    font-weight: 800;
    gap: 0.35rem;
}

.layout-state-form input,
.layout-state-form select,
.layout-state-form textarea {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 0.65rem;
    color: #0f172a;
    font: inherit;
    font-weight: 500;
    padding: 0.62rem 0.72rem;
}

.layout-state-form textarea {
    min-height: 7rem;
    resize: vertical;
}

.state-passage-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(9rem, 1fr) minmax(10rem, 1fr) repeat(3, minmax(5.5rem, 0.55fr));
}

.state-module-slots {
    border: 1px solid #bbf7d0;
    border-radius: 0.85rem;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
    padding: 0.85rem;
}

.state-module-slots legend {
    color: #166534;
    font-weight: 900;
    padding: 0 0.3rem;
}

.layout-state-save {
    align-items: center;
    background: #16a34a;
    border: 0;
    border-radius: 0.7rem;
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 900;
    justify-content: center;
    padding: 0.75rem 1rem;
    text-decoration: none;
}

.layout-state-save:hover,
.layout-state-save:focus {
    background: #15803d;
}

.layout-login-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    padding: 1rem;
}

.layout-login-panel h3,
.saved-layout-states h3 {
    margin-top: 0;
}

.saved-layout-states {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    padding: 1rem;
}

.saved-state-list {
    display: grid;
    gap: 0.7rem;
    max-height: 32rem;
    overflow-y: auto;
}

.saved-state-card {
    background: #ffffff;
    border: 1px solid #dbeafe;
    border-radius: 0.75rem;
    display: grid;
    gap: 0.3rem;
    padding: 0.75rem;
}

.saved-state-card strong {
    color: #1d4ed8;
}

.saved-state-card span,
.saved-state-card small,
.saved-state-empty {
    color: #475569;
}

.saved-state-actions {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.saved-state-actions a,
.saved-state-actions button {
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
    border-radius: 999px;
    color: #075985;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 900;
    padding: 0.35rem 0.6rem;
    text-decoration: none;
}

.saved-state-actions button {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.study-layouts-principles {
    margin-bottom: 1.25rem;
    padding: 1.1rem;
}

.study-layouts-dashboard-note {
    background: #f0fdf4;
    border-color: #86efac;
    margin-bottom: 1.25rem;
    padding: 1.1rem;
}

.study-layouts-dashboard-note p {
    color: #334155;
    line-height: 1.6;
    margin-bottom: 0;
}

.study-layouts-dashboard-note a {
    color: #166534;
    font-weight: 900;
}

.dashboard-layout-state {
    grid-template-columns: 1fr;
    margin: 0;
}

.dashboard-layout-state .state-intro,
.dashboard-layout-state .layout-state-form,
.dashboard-layout-state .saved-layout-states,
.dashboard-layout-state .layout-state-alert {
    grid-column: 1 / -1;
    min-width: 0;
}

.dashboard-layout-state .layout-state-form,
.dashboard-layout-state .layout-state-form label,
.dashboard-layout-state .state-module-slots label,
.dashboard-layout-state .state-note-draft {
    width: auto;
    max-width: 100%;
}

.dashboard-layout-state .layout-state-form input,
.dashboard-layout-state .layout-state-form select,
.dashboard-layout-state .layout-state-form textarea {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
}

.dashboard-layout-state .saved-layout-states {
    align-self: start;
}

.principle-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 1rem;
}

.principle-grid article {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.8rem;
    padding: 0.9rem;
}

.principle-grid strong {
    color: #1d4ed8;
    display: block;
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.principle-grid span {
    color: #475569;
    display: block;
    font-size: 0.92rem;
    line-height: 1.45;
}

.study-layout-options {
    display: grid;
    gap: 1.25rem;
}

.study-layout-card {
    overflow: hidden;
}

.study-layout-card.is-selected-layout {
    border-color: #16a34a;
    box-shadow: 0 20px 48px rgba(22, 163, 74, 0.18);
}

.study-layout-card.is-selected-layout .study-layout-card-header {
    background: #ecfdf5;
}

.study-layout-card-header {
    align-items: start;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr) minmax(14rem, 0.34fr);
    padding: 1.15rem;
}

.study-layout-card h2 {
    font-size: clamp(1.35rem, 2.3vw, 2rem);
    margin-bottom: 0.45rem;
}

.layout-use-case {
    background: #ecfdf5;
    border: 1px solid #86efac;
    border-radius: 999px;
    color: #166534;
    display: inline-flex;
    font-size: 0.86rem;
    font-weight: 800;
    justify-self: end;
    line-height: 1.35;
    padding: 0.55rem 0.8rem;
    text-align: center;
}

.layout-preview {
    aspect-ratio: 16 / 10;
    background: #e2e8f0;
    display: grid;
    gap: 0.7rem;
    padding: 0.8rem;
}

.study-layout-card-actions {
    align-items: center;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.9rem 1.15rem 1.1rem;
}

.study-layout-card-actions span {
    color: #475569;
    font-size: 0.9rem;
    font-weight: 700;
}

/* Classic study desk: reader (primary) top-left, tools bottom-left, notes
   full-height in the middle, display panel full-height on the right.
   Mirrors the real classic-desk workspace grid. */
.layout-preview--classic-desk {
    grid-template-areas:
        "primary notes display"
        "tools notes display";
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr) minmax(0, 0.9fr);
    grid-template-rows: 1fr 1fr;
}

.layout-preview--classic-desk .panel-primary {
    grid-area: primary;
}

.layout-preview--classic-desk .panel-notes {
    grid-area: notes;
}

.layout-preview--classic-desk .panel-tools {
    grid-area: tools;
}

.layout-preview--classic-desk .panel-display {
    grid-area: display;
}

/* Reader and notes: a full-page study tool (primary) on the left with the
   notes panel capped on the right. Mirrors the real reader-notes grid. */
.layout-preview--reader-notes {
    grid-template-areas:
        "primary notes";
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.45fr);
    grid-template-rows: 1fr;
}

.layout-preview--reader-notes .panel-primary {
    grid-area: primary;
}

.layout-preview--reader-notes .panel-notes {
    grid-area: notes;
}

/* Interlinear workbench: the primary panel spans the full left height while
   tools sit top-middle, notes bottom-middle, and display full-height on the
   right. Mirrors the real grid. */
.layout-preview--interlinear-workbench {
    grid-template-areas:
        "primary tools display"
        "primary notes display";
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.75fr) minmax(0, 1.15fr);
    grid-template-rows: 1fr 1fr;
}

.layout-preview--interlinear-workbench .panel-primary {
    grid-area: primary;
}

.layout-preview--interlinear-workbench .panel-tools {
    grid-area: tools;
}

.layout-preview--interlinear-workbench .panel-notes {
    grid-area: notes;
}

.layout-preview--interlinear-workbench .panel-display {
    grid-area: display;
}

/* Four-panel study room: primary/secondary on the top row, tools/notes on the
   bottom row, display full-height on the right. Mirrors the real grid. */
.layout-preview--four-panel {
    grid-template-areas:
        "primary secondary display"
        "tools notes display";
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.85fr);
    grid-template-rows: 1fr 1fr;
}

.layout-preview--four-panel .panel-primary {
    grid-area: primary;
}

.layout-preview--four-panel .panel-secondary {
    grid-area: secondary;
}

.layout-preview--four-panel .panel-tools {
    grid-area: tools;
}

.layout-preview--four-panel .panel-notes {
    grid-area: notes;
}

.layout-preview--four-panel .panel-display {
    grid-area: display;
}

.layout-panel {
    border-radius: 0.85rem;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
    display: flex;
    flex-direction: column;
    min-height: 10rem;
    overflow: hidden;
    padding: 1rem;
}

.layout-preview .layout-panel {
    min-height: 0;
}

.layout-slot-label {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.layout-panel h3 {
    font-size: 1rem;
    margin: 0.15rem 0 0.45rem;
}

.layout-panel p {
    color: #334155;
    font-size: 0.92rem;
    line-height: 1.45;
    margin: 0 0 0.9rem;
}

.dynamic-module-chip {
    background: rgba(255, 255, 255, 0.76);
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 999px;
    color: #0f172a;
    display: inline-flex;
    font-size: 0.76rem;
    font-weight: 900;
    margin-bottom: 0.75rem;
    padding: 0.3rem 0.55rem;
    width: fit-content;
}

.panel-reader {
    background: #ffffff;
    border: 1px solid #bfdbfe;
}

.panel-reader h3 {
    color: #1d4ed8;
}

.panel-notes {
    background: #fffbeb;
    border: 1px solid #fcd34d;
}

.panel-notes h3 {
    color: #92400e;
}

.panel-tools {
    background: #f0fdf4;
    border: 1px solid #86efac;
}

.panel-tools h3 {
    color: #166534;
}

.panel-original {
    background: #f5f3ff;
    border: 1px solid #c4b5fd;
}

.panel-original h3 {
    color: #5b21b6;
}

.panel-primary {
    background: #ffffff;
    border: 1px solid #bfdbfe;
}

.panel-primary h3 {
    color: #1d4ed8;
}

.panel-secondary {
    background: #f5f3ff;
    border: 1px solid #c4b5fd;
}

.panel-secondary h3 {
    color: #5b21b6;
}

.panel-display {
    background: #f8fafc;
    border: 1px dashed #94a3b8;
}

.panel-display h3 {
    color: #475569;
}

.mock-display-empty {
    color: #94a3b8;
    font-size: 0.82rem;
    line-height: 1.4;
    margin-top: auto;
}

.mock-verse-lines,
.mock-note-lines,
.mock-tool-pills {
    display: grid;
    gap: 0.55rem;
    margin-top: auto;
}

.mock-verse-lines span {
    background: #eff6ff;
    border-radius: 0.55rem;
    color: #1e293b;
    line-height: 1.45;
    padding: 0.6rem;
}

.mock-verse-lines b {
    color: #64748b;
    font-size: 0.78rem;
    margin-right: 0.35rem;
}

.mock-note-lines span {
    background: rgba(146, 64, 14, 0.15);
    border-radius: 999px;
    display: block;
    height: 0.85rem;
}

.mock-note-lines span:nth-child(2) {
    width: 82%;
}

.mock-note-lines span:nth-child(3) {
    width: 58%;
}

.mock-tool-pills {
    align-items: start;
    display: flex;
    flex-wrap: wrap;
}

.mock-tool-pills span {
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 999px;
    color: #166534;
    font-size: 0.78rem;
    font-weight: 800;
    padding: 0.35rem 0.55rem;
}

.mock-original-line {
    color: #4c1d95;
    direction: rtl;
    font-size: 1.45rem;
    line-height: 1.65;
    margin-top: auto;
    text-align: right;
}


.study-workspace-page {
    color: #0f172a;
    margin: 0;
    padding: 0 1rem 2rem;
}

.study-workspace-panel {
    border-radius: 1.1rem;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}

/* Panel colour scheme — mirrors the /study_layouts preview mockups */
.study-workspace-panel--tone-reader {
    background: #ffffff;
    border: 1px solid #bfdbfe;
}

.study-workspace-panel--tone-reader .workspace-panel-heading h2 {
    color: #1d4ed8;
}

.study-workspace-panel--tone-notes {
    background: #fffbeb;
    border: 1px solid #fcd34d;
}

.study-workspace-panel--tone-notes .workspace-panel-heading h2 {
    color: #92400e;
}

.study-workspace-panel--tone-tools {
    background: #f0fdf4;
    border: 1px solid #86efac;
}

.study-workspace-panel--tone-tools .workspace-panel-heading h2 {
    color: #166534;
}

.study-workspace-panel--tone-original {
    background: #f5f3ff;
    border: 1px solid #c4b5fd;
}

.study-workspace-panel--tone-original .workspace-panel-heading h2 {
    color: #5b21b6;
}

.study-workspace-panel--tone-display {
    background: #f8fafc;
    border: 1px solid #94a3b8;
}

.study-workspace-panel--tone-display .workspace-panel-heading h2 {
    color: #334155;
}

/* The "Select workspace" toggle (workspace pages) and the pinned
   "Open in <workspace>" button (mapped study pages) share the same pill
   styling and sit in the same study-toggles-right position. */
.study-workspace-switch-toggle,
.study-workspace-open {
    align-items: center;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 999px;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.2);
    box-sizing: border-box;
    color: #fff;
    cursor: pointer;
    display: flex;
    font-size: 0.875rem;
    font-weight: 900;
    gap: 0.5rem;
    height: 2.1rem;
    justify-content: center;
    line-height: 1;
    margin: 0;
    padding: 0 0.82rem;
    position: static;
    width: max-content;
    z-index: auto;
}
.study-workspace-switch-toggle:hover,
.study-workspace-switch-toggle:focus,
.study-workspace-open:hover,
.study-workspace-open:focus {
    background: #1e293b;
    color: #fff;
    outline: 3px solid rgba(14, 116, 144, 0.24);
}
/* The pinned button is a link, so drop the underline. */
.study-workspace-open {
    text-decoration: none;
}
.study-workspace-open[hidden] {
    display: none;
}

.study-workspace-switch {
    background: rgba(15, 23, 42, 0.22);
    bottom: 0;
    margin: 0;
    max-width: 100vw;
    opacity: 0;
    overflow-y: auto;
    padding: 4.5rem 0.75rem 1rem 0;
    pointer-events: none;
    position: fixed;
    right: 0;
    top: 0;
    transform: translateX(calc(100% + 1rem));
    transition: opacity 0.18s ease, transform 0.22s ease;
    width: 18rem;
    z-index: 1490;
}
.study-workspace-switch.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}
.study-workspace-switch-inner {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #cbd5e1;
    border-right: none;
    border-radius: 1rem 0 0 1rem;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.22);
    min-height: 100%;
    padding: 1rem;
}
.study-workspace-switch-links {
    display: grid;
    gap: 0.4rem;
}
.study-workspace-switch-link {
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 0.6rem;
    color: #334155;
    display: grid;
    gap: 0.15rem;
    padding: 0.6rem 0.75rem;
    text-decoration: none;
}
.study-workspace-switch-link:hover,
.study-workspace-switch-link:focus {
    background: #f1f5f9;
    border-color: #94a3b8;
}
.study-workspace-switch-link.is-active {
    background: #eff6ff;
    border-color: #3b82f6;
}
.study-workspace-switch-link span {
    font-weight: 800;
}
.study-workspace-switch-link small {
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.35;
}
.study-workspace-switch-actions {
    border-top: 1px solid #cbd5e1;
    display: grid;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
}
.study-workspace-switch-actions a {
    color: #0f766e;
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}
.study-workspace-switch-actions a:hover {
    color: #115e59;
}

.study-workspace-grid {
    display: grid;
    gap: 1rem;
    grid-template-areas:
        "primary notes display"
        "tools notes display";
    grid-template-columns: minmax(0, 1fr) minmax(40rem, 0.85fr) minmax(21rem, 0.9fr);
    grid-template-rows: auto auto;
    padding-top: 0.25rem;
    position: relative;
}

.study-workspace--verse-workbench .study-workspace-grid {
    grid-template-areas:
        "primary tools notes"
        "display display notes";
    grid-template-columns: minmax(18rem, 0.85fr) minmax(0, 1.15fr) minmax(40rem, 0.9fr);
}

.study-workspace--notebook-first .study-workspace-grid {
    grid-template-areas:
        "primary notes tools"
        "display notes tools";
    grid-template-columns: minmax(16rem, 0.8fr) minmax(40rem, 1.25fr) minmax(16rem, 0.65fr);
}

.study-workspace--four-panel .study-workspace-grid {
    grid-template-areas:
        "primary secondary display"
        "tools notes display";
    grid-template-columns: minmax(0, 1fr) minmax(40rem, 1fr) minmax(21rem, 0.85fr);
    grid-template-rows: auto auto;
}

.study-workspace--interlinear-workbench .study-workspace-grid {
    grid-template-areas:
        "primary tools display"
        "primary notes display";
    grid-template-columns: minmax(0, 0.9fr) minmax(38rem, 0.75fr) minmax(24rem, 1.15fr);
    grid-template-rows: minmax(0, auto) minmax(0, auto);
}

/* Reader-and-notes layout: a full-page study tool on the left takes the
   remaining space while the notes panel stays capped at a comfortable width. */
.study-workspace--reader-notes .study-workspace-grid {
    grid-template-areas:
        "primary notes";
    grid-template-columns: minmax(0, 1fr) minmax(20rem, 0.45fr);
    grid-template-rows: auto;
    align-items: stretch;
}

.study-workspace--reader-notes .study-workspace-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.study-workspace--reader-notes .study-workspace-panel--primary > :not(.workspace-panel-heading) {
    flex: 1;
    min-height: 0;
}

.study-workspace--reader-notes .workspace-fullpage-embed {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.study-workspace--reader-notes .workspace-fullpage-embed iframe {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: 1px solid var(--border, #cbd5e1);
    border-radius: 0.65rem;
    background: #fff;
}

.study-workspace-panel {
    overflow: hidden;
    padding: 1rem;
}

.study-workspace-panel--primary {
    grid-area: primary;
}

.study-workspace-panel--notes {
    grid-area: notes;
}

@media (min-width: 821px) {
    .study-workspace-panel--notes {
        min-width: min(100%, 40rem);
    }
}

.study-workspace-panel--secondary {
    grid-area: secondary;
}

.study-workspace-panel--tools {
    grid-area: tools;
}

.study-workspace-panel--display {
    grid-area: display;
}

.study-workspace--notebook-first .study-workspace-panel--notes textarea {
    min-height: 26rem;
}

.study-workspace--interlinear-workbench .study-workspace-panel--primary {
    max-height: none;
}

/* Equal-height panels: each panel is a flex column so the heading stays at
   the top and the content area fills the remaining height. */
.study-workspace--interlinear-workbench .study-workspace-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Primary and display panels span both grid rows: their content fills the
   stretched panel and scrolls internally. */
.study-workspace--interlinear-workbench .study-workspace-panel--primary > :not(.workspace-panel-heading),
.study-workspace--interlinear-workbench .study-workspace-panel--display > :not(.workspace-panel-heading) {
    flex: 1;
    min-height: 0;
}

/* Tools panel: keep the passage picker at its natural height; the interlinear
   embed shows its content and scrolls if it exceeds the panel. */
.study-workspace--interlinear-workbench .workspace-passage-picker {
    flex: 0 0 auto;
}

.study-workspace--interlinear-workbench .workspace-interlinear-embed {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Primary panel: the Paleo Hebrew embed fills the panel and scrolls. */
.study-workspace--interlinear-workbench .workspace-hebrew-concepts-embed {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 90rem;
}

/* Primary panel: the concordance embed fills the panel and scrolls. */
.study-workspace--interlinear-workbench .workspace-concordance-embed {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 90rem;
}

/* Notes panel: the form and textarea keep their natural heights so the
   editor stays practical for writing. */
.study-workspace--interlinear-workbench .workspace-note-form {
    display: flex;
    flex-direction: column;
}

.study-workspace--interlinear-workbench .workspace-note-form textarea {
    min-height: 0;
}

/* Notes panel: override the sticky/fixed-height behaviour (used on other
   workspaces) so it stretches to its grid area and aligns with the other
   panels at the bottom. */
.study-workspace--interlinear-workbench #workspace-notes-panel {
    position: static;
    align-self: stretch;
    height: auto;
    overflow-y: hidden;
}

/* The note label wraps the toolbar and textarea: keep it a flex column so
   the textarea can shrink to fill the panel height. */
.study-workspace--interlinear-workbench .workspace-note-form > label {
    display: flex;
    flex-direction: column;
}

.study-workspace--verse-workbench .workspace-interlinear-embed {
    max-height: 58rem;
}

.study-workspace--four-panel .workspace-interlinear-embed,
.study-workspace--four-panel .study-workspace-panel--notes {
    max-height: 44rem;
    overflow-y: auto;
}

.workspace-panel-heading {
    border-bottom: 1px solid #e2e8f0;
    margin: -1rem -1rem 1rem;
    padding: 1rem;
}

.workspace-panel-heading h2 {
    color: #0f172a;
    margin: 0;
}

.workspace-passage-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.85rem;
    margin-bottom: 0.8rem;
    padding: 0.9rem;
}

.workspace-passage-block h3 {
    color: #1d4ed8;
    margin: 0 0 0.65rem;
}

.workspace-verse-list {
    display: grid;
    gap: 0.55rem;
}

.workspace-verse-list p {
    background: #ffffff;
    border: 1px solid #dbeafe;
    border-radius: 0.65rem;
    color: #1e293b;
    line-height: 1.62;
    margin: 0;
    padding: 0.65rem 0.75rem;
}

.workspace-verse-list sup {
    color: #64748b;
    font-size: 0.76rem;
    font-weight: 900;
    margin-right: 0.3rem;
}

.workspace-display-panel {
    display: grid;
    gap: 0.85rem;
}

.workspace-display-tabs {
    flex-wrap: nowrap;
    margin-bottom: 0.1rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    scrollbar-width: thin;
}

.workspace-display-tabs .xpnd-tab {
    font-size: 0.75rem;
    padding: 0.3rem 0.55rem;
    white-space: nowrap;
}

.workspace-display-tab-panel {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 0 0.85rem 0.85rem 0.85rem;
    padding: 0.85rem;
}

.workspace-display-intro {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    color: #334155;
    display: grid;
    gap: 0.55rem;
    padding: 0.85rem;
}

.workspace-display-intro h3,
.workspace-display-intro p {
    margin: 0;
}

.workspace-display-intro h3 {
    color: #0f172a;
    font-size: 1rem;
}

.workspace-display-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.workspace-display-actions a,
.workspace-display-frame-bar a {
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
    border-radius: 999px;
    color: #075985;
    font-size: 0.82rem;
    font-weight: 900;
    padding: 0.35rem 0.65rem;
    text-decoration: none;
}

.workspace-display-frame-wrap {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.75rem;
}

.workspace-display-frame-bar {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
}

.workspace-display-frame-bar strong {
    color: #334155;
    font-size: 0.9rem;
}

.workspace-display-frame-wrap iframe {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 0.85rem;
    height: min(68vh, 52rem);
    width: 100%;
}

.workspace-display-token {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.75rem;
}

.workspace-display-token-body {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 0.85rem;
    max-height: min(68vh, 52rem);
    overflow-y: auto;
    padding: 0.85rem;
}

.workspace-display-token-close {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    color: #334155;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.3rem 0.65rem;
}

.workspace-display-token-close:hover,
.workspace-display-token-close:focus {
    background: #e2e8f0;
    color: #0f172a;
}

.workspace-display-fallback {
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.45;
    margin: 0;
}

.workspace-empty {
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 0.75rem;
    color: #9a3412;
    font-weight: 800;
    padding: 0.75rem;
}

.workspace-module-launcher {
    background: #f8fafc;
    border: 1px solid #dbeafe;
    border-radius: 0.85rem;
    display: grid;
    gap: 0.75rem;
    padding: 0.9rem;
}

.workspace-module-launcher h3 {
    color: #075985;
    margin: 0;
}

.workspace-module-launcher p {
    color: #334155;
    line-height: 1.5;
    margin: 0;
}

.workspace-module-context {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.65rem;
    padding: 0.65rem;
}

.workspace-module-primary {
    align-self: start;
    background: #0f766e;
    border-radius: 999px;
    color: #ffffff;
    font-weight: 900;
    justify-self: start;
    padding: 0.55rem 0.9rem;
    text-decoration: none;
}

.workspace-module-primary:hover,
.workspace-module-primary:focus {
    background: #115e59;
}

.workspace-lexicon-embed,
.workspace-concordance-embed,
.workspace-websters-embed,
.workspace-false-friends-embed,
.workspace-hebrew-concepts-embed,
.workspace-greek-hebrew-embed {
    background: #f8fafc;
    border: 1px solid #dbeafe;
    border-radius: 0.85rem;
    display: grid;
    gap: 0.85rem;
    padding: 0.85rem;
}

.workspace-lexicon-search,
.workspace-concordance-search,
.workspace-websters-search,
.workspace-false-friends-search,
.workspace-hebrew-concepts-search,
.workspace-greek-hebrew-search {
    align-items: end;
    display: grid;
    gap: 0.65rem;
    grid-template-columns: minmax(0, 1fr) auto;
}

/* Concordance search: the source-language filter sits on its own row beneath
   the search box, spanning the full width of the form. */
.workspace-concordance-search {
    grid-template-columns: minmax(0, 1fr) auto;
}

.workspace-concordance-search .workspace-concordance-languages {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    padding: 0.15rem 0 0.1rem;
}

.workspace-concordance-search .workspace-concordance-languages .language-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
    margin: 0;
}

.workspace-concordance-search .workspace-concordance-languages input[type="checkbox"] {
    width: auto;
    height: auto;
    accent-color: #0f766e;
    margin: 0;
}

.workspace-lexicon-search label,
.workspace-concordance-search label,
.workspace-websters-search label,
.workspace-false-friends-search label,
.workspace-hebrew-concepts-search label,
.workspace-greek-hebrew-search label {
    color: #334155;
    display: grid;
    font-size: 0.9rem;
    font-weight: 900;
    gap: 0.35rem;
}

.workspace-lexicon-search input,
.workspace-concordance-search input,
.workspace-websters-search input,
.workspace-false-friends-search input,
.workspace-hebrew-concepts-search input,
.workspace-greek-hebrew-search input {
    border: 1px solid #cbd5e1;
    border-radius: 0.65rem;
    color: #0f172a;
    font: inherit;
    padding: 0.58rem 0.7rem;
}

.workspace-lexicon-search button,
.workspace-concordance-search button,
.workspace-websters-search button,
.workspace-false-friends-search button,
.workspace-hebrew-concepts-search button,
.workspace-greek-hebrew-search button,
.workspace-lexicon-actions a,
.workspace-concordance-actions a,
.workspace-websters-actions a,
.workspace-false-friends-actions a,
.workspace-hebrew-concepts-actions a,
.workspace-greek-hebrew-actions a {
    background: #0f766e;
    border: 0;
    border-radius: 999px;
    color: #ffffff;
    cursor: pointer;
    font-weight: 900;
    padding: 0.58rem 0.85rem;
    text-decoration: none;
}

.workspace-lexicon-suggestions,
.workspace-lexicon-results,
.workspace-lexicon-entry,
.workspace-concordance-suggestions,
.workspace-concordance-results,
.workspace-concordance-study,
.workspace-concordance-scope,
.workspace-websters-suggestions,
.workspace-websters-results,
.workspace-websters-entry,
.workspace-false-friends-suggestions,
.workspace-false-friends-results,
.workspace-false-friends-entry,
.workspace-false-friends-scope,
.workspace-hebrew-concepts-suggestions,
.workspace-hebrew-concepts-results,
.workspace-hebrew-concepts-entry,
.workspace-hebrew-concepts-scope,
.workspace-greek-hebrew-suggestions,
.workspace-greek-hebrew-results,
.workspace-greek-hebrew-verse,
.workspace-greek-hebrew-scope {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    display: grid;
    gap: 0.65rem;
    padding: 0.75rem;
}

.workspace-lexicon-suggestions > div,
.workspace-concordance-suggestions > div,
.workspace-websters-suggestions > div,
.workspace-false-friends-suggestions > div,
.workspace-hebrew-concepts-suggestions > div,
.workspace-greek-hebrew-suggestions > div {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.workspace-lexicon-suggestions a,
.workspace-concordance-suggestions a,
.workspace-websters-suggestions a,
.workspace-websters-false-friends a,
.workspace-false-friends-suggestions a,
.workspace-false-friends-websters a,
.workspace-hebrew-concepts-suggestions a,
.workspace-greek-hebrew-suggestions a {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 999px;
    color: #1e1b4b;
    display: inline-flex;
    gap: 0.35rem;
    padding: 0.42rem 0.65rem;
    text-decoration: none;
}

.workspace-lexicon-suggestions span,
.workspace-concordance-scope,
.workspace-concordance-definition,
.workspace-concordance-glosses,
.workspace-concordance-count,
.workspace-websters-meta,
.workspace-websters-source,
.workspace-false-friends-scope,
.workspace-false-friends-source,
.workspace-hebrew-concepts-scope,
.workspace-greek-hebrew-scope {
    color: #475569;
}

.workspace-lexicon-results a,
.workspace-concordance-results a,
.workspace-concordance-occurrences a,
.workspace-websters-results a,
.workspace-false-friends-results a,
.workspace-hebrew-concepts-results a,
.workspace-greek-hebrew-results a {
    border-bottom: 1px solid #e2e8f0;
    color: #0f172a;
    display: grid;
    gap: 0.18rem;
    padding-bottom: 0.55rem;
    text-decoration: none;
}

.workspace-lexicon-results a:last-child,
.workspace-concordance-results a:last-child,
.workspace-concordance-occurrences a:last-child,
.workspace-websters-results a:last-child,
.workspace-false-friends-results a:last-child,
.workspace-hebrew-concepts-results a:last-child,
.workspace-greek-hebrew-results a:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.workspace-lexicon-results small,
.workspace-concordance-results small,
.workspace-lexicon-definition,
.workspace-lexicon-count {
    color: #475569;
    line-height: 1.5;
    margin: 0;
}

.workspace-lexicon-entry h3,
.workspace-concordance-study h3,
.workspace-websters-entry h3,
.workspace-false-friends-entry h3,
.workspace-hebrew-concepts-entry h3 {
    color: #075985;
    margin: 0;
}

.workspace-false-friends-meaning-grid {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace-false-friends-meaning-grid div,
.workspace-false-friends-occurrences,
.workspace-false-friends-evidence {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    display: grid;
    gap: 0.35rem;
    padding: 0.55rem;
}

.workspace-false-friends-meaning-grid p,
.workspace-false-friends-occurrences span,
.workspace-false-friends-evidence span {
    color: #334155;
    line-height: 1.5;
    margin: 0;
}

.workspace-websters-senses,
.workspace-websters-false-friends,
.workspace-websters-actions,
.workspace-false-friends-websters,
.workspace-false-friends-actions {
    display: grid;
    gap: 0.5rem;
}

.workspace-hebrew-concepts-strong,
.workspace-hebrew-concepts-paleo {
    color: #0f766e;
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: 0.03em;
    margin: 0;
}

.workspace-hebrew-concepts-paleo {
    color: #92400e;
    font-size: 1.45rem;
}

.workspace-hebrew-concepts-facts {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace-hebrew-concepts-facts div,
.workspace-hebrew-concepts-lexicon,
.workspace-hebrew-concepts-mappings,
.workspace-hebrew-concepts-occurrences {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    display: grid;
    gap: 0.35rem;
    padding: 0.55rem;
}

.workspace-hebrew-concepts-facts span,
.workspace-hebrew-concepts-lexicon span {
    color: #334155;
    line-height: 1.5;
}

.workspace-hebrew-concepts-letters {
    display: grid;
    gap: 0.55rem;
}

.workspace-hebrew-concepts-letters > div {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workspace-hebrew-concepts-letters a,
.workspace-hebrew-concepts-mappings a,
.workspace-hebrew-concepts-occurrences a {
    background: #ffffff;
    border: 1px solid #dbeafe;
    border-radius: 0.65rem;
    color: #0f172a;
    display: grid;
    gap: 0.2rem;
    padding: 0.55rem;
    text-decoration: none;
}

.workspace-hebrew-concepts-letters span:nth-child(2) {
    color: #92400e;
    font-size: 1.2rem;
}

.workspace-hebrew-concepts-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.workspace-hebrew-concepts-alphabet {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    display: grid;
    gap: 0.65rem;
    padding: 0.75rem;
}

.workspace-hebrew-concepts-alphabet > strong {
    color: #334155;
    font-size: 0.9rem;
}

.workspace-hebrew-concepts-alphabet-grid {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
}

.workspace-hebrew-concepts-letter-card {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 0.65rem;
    color: #0f172a;
    cursor: pointer;
    display: grid;
    gap: 0.15rem;
    height: auto;
    justify-items: center;
    line-height: 1.2;
    margin: 0;
    min-height: 0;
    padding: 0.55rem 0.4rem;
    text-align: center;
}

.workspace-hebrew-concepts-letter-card:hover,
.workspace-hebrew-concepts-letter-card:focus-visible {
    background: #eef2ff;
    border-color: #6366f1;
    outline: none;
}

.workspace-hebrew-concepts-letter-paleo {
    color: #92400e;
    font-size: 1.5rem;
    line-height: 1.2;
}

.workspace-hebrew-concepts-letter-modern {
    color: #1e1b4b;
    font-size: 1.1rem;
    font-weight: 800;
}

.workspace-hebrew-concepts-letter-card b {
    font-size: 0.78rem;
}

.workspace-hebrew-concepts-letter-card small {
    color: #64748b;
    font-size: 0.72rem;
}

/* Letter fragment injected into the Display panel: single column,
   letter card on top with the word examples underneath. */
.workspace-display-token-body .concept-study-layout-inline {
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.workspace-display-token-body .concept-study-layout-inline .concept-study-overview,
.workspace-display-token-body .concept-study-layout-inline .concept-study-source {
    grid-column: 1;
    grid-row: auto;
    position: static;
}

.workspace-display-token-body .concept-study-layout-inline .concept-letter-word-grid {
    grid-template-columns: 1fr;
}

/* Word concept fragment injected into the Display panel: stacked cards,
   header/overview first (not sticky) with the letter cards underneath. */
.workspace-display-token-body [data-concept-word-fragment] .concept-word-fragment-header,
.workspace-display-token-body [data-concept-word-fragment] .concept-word-fragment-letters,
.workspace-display-token-body [data-concept-word-fragment] .concept-study-panel {
    grid-column: auto;
    grid-row: auto;
    position: static;
}

.workspace-display-token-body [data-concept-word-fragment] {
    display: grid;
    gap: 0.75rem;
}

#paleo-concept-fragment {
    padding: 0;
}

.workspace-display-token-body [data-concept-word-fragment] .concept-word-fragment-header {
    position: static;
}

.workspace-display-token-body [data-concept-word-fragment] .letter-card-grid {
    grid-template-columns: 1fr;
}

/* Compact word view inside the Display panel: keep the table scrollable
   within the token body instead of overflowing the panel. */
.workspace-display-token-body [data-concept-word-fragment] .word-compact-view {
    margin-top: 0.5rem;
}

/* Display panel and resource tab fill the available vertical height
   (Paleo Hebrew / interlinear-workbench layout). */
.study-workspace--interlinear-workbench .workspace-display-panel {
    flex: 1;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: start;
    max-height: 90rem;
}

.study-workspace--interlinear-workbench .workspace-display-tab-panel {
    min-height: 0;
}

.study-workspace--interlinear-workbench #workspace-display-resource {
    display: grid;
    grid-template-rows: minmax(0, 1fr);
    align-content: start;
    overflow: auto;
    min-height: 0;
    max-height: none;
}

.study-workspace--interlinear-workbench .workspace-display-token {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
}

.study-workspace--interlinear-workbench .workspace-display-token-body {
    max-height: none;
    min-height: 0;
    overflow-y: auto;
}

/* Standalone word profile overview: compact view sits between the header
   content and the letter cards. */
.concept-word-header .concept-compact-view-block {
    margin-top: 1.25rem;
    border-top: 1px solid #eef2f8;
    padding-top: 1rem;
}

.concept-word-header .concept-compact-view-block .concept-section-heading {
    margin-bottom: 0.25rem;
}

.concept-word-header .concept-compact-view-block .concept-section-heading p {
    margin: 0;
}

.workspace-greek-hebrew-verse,
.workspace-greek-hebrew-actions {
    display: grid;
    gap: 0.55rem;
}

.workspace-greek-hebrew-verse article {
    background: #ffffff;
    border: 1px solid #dbeafe;
    border-radius: 0.65rem;
    display: grid;
    gap: 0.35rem;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr);
    padding: 0.55rem;
}

.workspace-greek-hebrew-gloss {
    color: #334155;
    font-weight: 800;
}

.workspace-greek-hebrew-results a {
    gap: 0.3rem;
    grid-template-columns: 1fr;
}

.workspace-websters-senses div {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    display: grid;
    gap: 0.25rem;
    padding: 0.55rem;
}

.workspace-websters-senses b {
    color: #075985;
}

.workspace-websters-senses span {
    color: #334155;
    line-height: 1.5;
}

.workspace-lexicon-facts,
.workspace-concordance-occurrences,
.workspace-concordance-actions {
    display: grid;
    gap: 0.45rem;
    margin: 0;
}

.workspace-lexicon-facts div {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    padding: 0.55rem;
}

.workspace-lexicon-facts dt {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 900;
    text-transform: uppercase;
}

.workspace-lexicon-facts dd {
    color: #0f172a;
    margin: 0.15rem 0 0;
}

.workspace-lexicon-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.workspace-tool-grid--compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.workspace-note-form {
    display: grid;
    gap: 0.4rem;
}

.workspace-note-form label {
    color: #334155;
    display: grid;
    font-size: 0.9rem;
    font-weight: 900;
    gap: 0;
    margin: 0;
}

.workspace-note-form label:has(.text-editor-toolbar) {
    gap: 0;
}

.workspace-note-form input,
.workspace-note-form textarea {
    border: 1px solid #cbd5e1;
    border-radius: 0.65rem;
    color: #0f172a;
    font: inherit;
    font-weight: 500;
    padding: 0.65rem 0.75rem;
}

.workspace-note-status-row {
    align-items: center;
    display: flex;
    gap: 0.6rem;
    justify-content: space-between;
}

.workspace-note-status-chip {
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    border-radius: 999px;
    color: #065f46;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.25rem 0.7rem;
}

.workspace-note-status-chip.is-error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

.workspace-interlinear-embed {
    background: #f8fafc;
    border: 1px solid #dbeafe;
    border-radius: 0.85rem;
    max-height: 42rem;
    overflow-y: auto;
    padding: 0.75rem;
}

.workspace-interlinear-embed .interlinear-toolbar,
.workspace-interlinear-embed .interlinear-passage-header,
.workspace-interlinear-embed .interlinear-study-tabs {
    margin-bottom: 0.8rem;
}

.workspace-interlinear-embed .interlinear-passage-header h1 {
    font-size: 1.35rem;
}

.workspace-interlinear-embed .interlinear-layout {
    grid-template-columns: 1fr;
}

.workspace-interlinear-embed .interlinear-detail-panel {
    margin-top: 0.85rem;
    max-height: 22rem;
}

.workspace-interlinear-language {
    border: 0;
    margin: 0;
    padding: 0;
}

.workspace-interlinear-header {
    align-items: flex-end;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.workspace-interlinear-header .interlinear-filter {
    margin-left: auto;
}

.workspace-interlinear-header .interlinear-filter-toggle {
    font-size: 0.82rem;
    padding: 0.3rem 0.7rem;
}

.workspace-interlinear-header .interlinear-filter-panel .interlinear-layer-controls {
    gap: 0.25rem;
}

.workspace-interlinear-header .interlinear-filter-panel .interlinear-layer-controls label {
    gap: 0.35rem;
}

.workspace-interlinear-header .interlinear-filter-panel .interlinear-layer-controls input[type="checkbox"] {
    margin: 0;
}

.workspace-interlinear-language legend {
    color: #475569;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
}

.workspace-interlinear-language-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.workspace-interlinear-language-options label {
    align-items: center;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    color: #334155;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.85rem;
    font-weight: 700;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
}

.workspace-interlinear-language-options label:has(input:checked) {
    background: #dbeafe;
    border-color: #60a5fa;
    color: #1e40af;
}

.workspace-interlinear-language-options input {
    accent-color: #2563eb;
    margin: 0;
}

.workspace-interlinear-passage.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

.workspace-tool-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workspace-tool-card {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 0.85rem;
    color: #0f172a;
    display: grid;
    gap: 0.35rem;
    min-height: 7.5rem;
    padding: 0.9rem;
    text-decoration: none;
}

.workspace-tool-card strong {
    color: #166534;
    font-size: 1rem;
}

.workspace-tool-card span {
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.45;
}

.workspace-tool-card:hover,
.workspace-tool-card:focus {
    border-color: #16a34a;
    box-shadow: 0 12px 28px rgba(22, 163, 74, 0.16);
}

@media (max-width: 1280px) {
    .study-workspace-grid,
    .study-workspace--verse-workbench .study-workspace-grid,
    .study-workspace--notebook-first .study-workspace-grid,
    .study-workspace--four-panel .study-workspace-grid,
    .study-workspace--interlinear-workbench .study-workspace-grid {
        grid-template-areas:
            "primary notes"
            "tools display";
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .study-workspace--four-panel .study-workspace-grid {
        grid-template-areas:
            "primary secondary"
            "tools notes"
            "display display";
    }

    .study-workspace--notebook-first .study-workspace-grid {
        grid-template-areas:
            "notes primary"
            "notes tools"
            "display display";
    }
}

@media (max-width: 1180px) {
    .study-layouts-state,
    .principle-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .state-intro {
        grid-column: auto;
        grid-row: auto;
    }

    .state-passage-grid,
    .state-module-slots {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .study-layouts-page {
        padding: 0.75rem;
    }

    .study-layout-card-header {
        grid-template-columns: 1fr;
    }

    .layout-use-case {
        justify-self: start;
        text-align: left;
    }

    .study-layouts-state,
    .state-passage-grid,
    .state-module-slots,
    .principle-grid,
    .layout-preview,
    .layout-preview--classic-desk,
    .layout-preview--reader-notes,
    .layout-preview--interlinear-workbench,
    .layout-preview--four-panel {
        grid-template-columns: 1fr;
    }

    .layout-preview--classic-desk,
    .layout-preview--reader-notes,
    .layout-preview--interlinear-workbench,
    .layout-preview--four-panel {
        grid-template-areas: none;
    }

    .layout-preview--classic-desk .panel-primary,
    .layout-preview--classic-desk .panel-notes,
    .layout-preview--classic-desk .panel-tools,
    .layout-preview--classic-desk .panel-display,
    .layout-preview--reader-notes .panel-primary,
    .layout-preview--reader-notes .panel-notes,
    .layout-preview--interlinear-workbench .panel-primary,
    .layout-preview--interlinear-workbench .panel-tools,
    .layout-preview--interlinear-workbench .panel-notes,
    .layout-preview--interlinear-workbench .panel-display,
    .layout-preview--four-panel .panel-primary,
    .layout-preview--four-panel .panel-secondary,
    .layout-preview--four-panel .panel-tools,
    .layout-preview--four-panel .panel-notes,
    .layout-preview--four-panel .panel-display {
        grid-area: auto;
        grid-column: auto;
        grid-row: auto;
    }

    .layout-preview {
        aspect-ratio: auto;
        min-height: auto;
    }

    .study-workspace-grid {
        grid-template-areas:
            "primary"
            "secondary"
            "notes"
            "tools"
            "display";
        grid-template-columns: 1fr;
    }

    .workspace-tool-grid {
        grid-template-columns: 1fr;
    }

    .workspace-lexicon-search,
    .workspace-concordance-search,
    .workspace-websters-search,
    .workspace-false-friends-search,
    .workspace-hebrew-concepts-search,
    .workspace-greek-hebrew-search,
    .workspace-false-friends-meaning-grid,
    .workspace-hebrew-concepts-facts,
    .workspace-hebrew-concepts-letters > div,
    .workspace-greek-hebrew-verse article {
        grid-template-columns: 1fr;
    }

    .workspace-lexicon-search button,
    .workspace-concordance-search button,
    .workspace-websters-search button,
    .workspace-false-friends-search button,
    .workspace-hebrew-concepts-search button,
    .workspace-greek-hebrew-search button {
        justify-self: start;
    }

    .study-workspace-panel--primary,
    .study-workspace-panel--secondary,
    .study-workspace-panel--notes,
    .study-workspace-panel--tools {
        grid-column: auto;
        grid-row: auto;
    }
}

/* Phase 2: zigzag workspace index */
.study-layout-row {
    align-items: stretch;
    display: grid;
    gap: 2rem;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    margin: 0 0 3rem;
}
.study-layout-row__desc {
    background: rgba(148, 163, 184, 0.12);
    border-radius: 0.75rem;
    display: flex;
    flex-direction: column;
    grid-column: 1;
    grid-row: 1;
    padding: 1.25rem;
}
.study-layout-row__preview {
    grid-column: 2;
    grid-row: 1;
}
.study-layout-row.is-reversed {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}
.study-layout-row.is-reversed .study-layout-row__desc {
    grid-column: 2;
    grid-row: 1;
}
.study-layout-row.is-reversed .study-layout-row__preview {
    grid-column: 1;
    grid-row: 1;
}
.study-layout-row__desc h2 {
    font-size: 1.6rem;
    margin: 0.25rem 0 0.5rem;
}
.study-layout-row__desc > p {
    color: #475569;
    line-height: 1.55;
}
.study-layout-row__meta {
    display: grid;
    gap: 0.4rem;
    margin: 1rem 0;
}
.study-layout-row__meta div {
    display: flex;
    gap: 0.5rem;
}
.study-layout-row__meta dt {
    color: #64748b;
    font-weight: 700;
    min-width: 5rem;
}
.study-layout-row__meta dd {
    color: #0f172a;
    margin: 0;
}
.study-layout-row__actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: auto;
}
.study-layout-row__actions .button-primary {
    background: #ecfdf5;
    border: 1px solid #6ee7b7;
    border-radius: 999px;
    color: #065f46;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    margin: 0;
    padding: 0.55rem 1rem;
    text-decoration: none;
}
.study-layout-row__actions .button-primary:hover {
    background: #d1fae5;
    border-color: #34d399;
    color: #065f46;
}
.study-layout-row__preview .layout-preview {
    width: 100%;
}
@media (max-width: 820px) {
    .study-layout-row,
    .study-layout-row.is-reversed {
        grid-template-columns: 1fr;
    }
    .study-layout-row__desc,
    .study-layout-row__preview,
    .study-layout-row.is-reversed .study-layout-row__desc,
    .study-layout-row.is-reversed .study-layout-row__preview {
        grid-column: auto;
    }
}

/* Phase 3: notes in workspace + move controls */
.workspace-notes-list {
    border-top: 1px solid #e2e8f0;
    margin-top: 1rem;
    padding-top: 0.75rem;
}
.workspace-notes-list h3 {
    font-size: 0.9rem;
    margin: 0 0 0.5rem;
}
.workspace-notes-list__item {
    border: 1px solid #e2e8f0;
    border-radius: 0.6rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem 0.6rem;
}
.workspace-notes-list__title {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: space-between;
}
.workspace-notes-list__title a {
    color: #1e3a8a;
    font-weight: 700;
    text-decoration: none;
}
.workspace-notes-list__ref {
    color: #64748b;
    font-size: 0.8rem;
}
.workspace-note-move {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.4rem;
}
.workspace-note-move select,
.note-move-form select {
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    font: inherit;
    font-size: 0.82rem;
    padding: 0.25rem 0.4rem;
}
.workspace-note-move__btn,
.note-move-btn {
    background: #e0f2fe;
    border: 1px solid #7dd3fc;
    border-radius: 999px;
    color: #075985;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 800;
    padding: 0.25rem 0.7rem;
}
.workspace-note-move__btn:hover,
.note-move-btn:hover {
    background: #bae6fd;
}
.note-move-form {
    align-items: center;
    display: flex;
    gap: 0.4rem;
    margin-top: 0.4rem;
}
.sr-only {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

/* Phase 3: open existing note in workspace editor */
.workspace-note-editing-banner {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 0.6rem;
    color: #1e40af;
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0;
    padding: 0.5rem 0.7rem;
}
.workspace-note-editing-banner a {
    color: #1d4ed8;
}
.workspace-notes-list__title a.is-editing {
    box-shadow: 0 0 0 2px #3b82f6;
    border-radius: 0.25rem;
}

/* Title row: Note title left, Open note right — two equal columns */
.workspace-note-title-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    align-items: start;
    margin-bottom: -0.25rem;
}
.workspace-note-title-group {
    display: flex;
    flex-direction: column;
}
.workspace-note-title-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.35rem;
}
.workspace-note-title-input {
    width: 100%;
    min-width: 0;
}
.workspace-note-open-group {
    display: flex;
    flex-direction: column;
}
.workspace-note-open-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
    margin-bottom: 0.35rem;
}
.workspace-note-open-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.workspace-note-open-controls > input[type="checkbox"] {
    accent-color: #2563eb;
    width: 0.95rem;
    height: 0.95rem;
    margin: 0;
}
/* Anti-jump: dropdown always reserves space, revealed via sibling selector */
.workspace-note-open-dropdown {
    height: 2rem;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}
#workspace-note-open-toggle:checked ~ .workspace-note-open-dropdown {
    visibility: visible;
    opacity: 1;
}
.workspace-note-open-dropdown select {
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    font: inherit;
    font-size: 0.82rem;
    padding: 0.3rem 0.5rem;
    max-width: 20rem;
}

/* Sticky notes panel */
#workspace-notes-panel {
    position: sticky;
    top: 0.75rem;
    align-self: start;
    height: calc(100vh - 1.5rem);
    overflow-y: auto;
}

/* ─── Dashboard: Study Sessions panel ─── */
.study-session-open,
.study-session-save {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.study-session-open label,
.study-session-save label {
    color: #334155;
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0;
}

.study-session-select,
.study-session-save input[type="text"] {
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    font: inherit;
    font-size: 0.85rem;
    max-width: 24rem;
    padding: 0.4rem 0.6rem;
    width: 100%;
}

.study-session-save input[type="text"] {
    flex: 1 1 14rem;
}
