@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
    --bg: #f4f1e8;
    --panel: rgba(255, 255, 255, 0.88);
    --panel-strong: #ffffff;
    --ink: #1f2522;
    --muted: #5b655f;
    --line: rgba(31, 37, 34, 0.12);
    --accent: #116466;
    --accent-soft: rgba(17, 100, 102, 0.14);
    --warm: #d9a441;
    --danger: #b74d45;
    --success: #2f7a47;
    --font-ui: 'IBM Plex Sans', 'Segoe UI Variable Text', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

html,
body,
#app {
    min-height: 100%;
}

body {
    background:
        radial-gradient(circle at top left, rgba(217, 164, 65, 0.18), transparent 32%),
        linear-gradient(180deg, #f7f3ea 0%, #ece7db 100%);
    color: var(--ink);
    font-family: var(--font-ui);
}

.app-shell {
    min-height: 100vh;
}

.app-shell .glass-panel {
    background: #ffffff;
    backdrop-filter: none;
    box-shadow: 0 14px 34px rgba(38, 45, 40, 0.06);
}

.app-shell .tree-panel,
.app-shell .workspace-card,
.app-shell .workspace-section,
.app-shell .empty-state {
    background: #ffffff;
    box-shadow: none;
}

.app-shell .curriculum-tree-row,
.app-shell .ghost-action,
.app-shell .icon-button,
.app-shell .tree-toolbar-button,
.app-shell .primary-action,
.app-shell .secondary-action,
.app-shell .danger-action,
.app-shell .subtle-danger-action {
    transition: background 100ms ease, border-color 100ms ease, color 100ms ease, opacity 100ms ease;
}

.app-shell .primary-action:hover,
.app-shell .secondary-action:hover,
.app-shell .danger-action:hover,
.app-shell .subtle-danger-action:hover,
.app-shell .icon-button:hover {
    transform: none;
}

.glass-panel {
    background: var(--panel);
    backdrop-filter: blur(14px);
    border: 1px solid var(--line);
    box-shadow: 0 18px 60px rgba(38, 45, 40, 0.08);
}

.student-shell {
    background:
        radial-gradient(circle at top, rgba(17, 100, 102, 0.16), transparent 30%),
        linear-gradient(180deg, #f5fbfb 0%, #eef4f4 100%);
}

.page-grid {
    display: grid;
    gap: 1.25rem;
}

.metric-card {
    border-radius: 1.25rem;
    border: 1px solid var(--line);
    background: var(--panel-strong);
    padding: 1rem;
    box-shadow: 0 10px 32px rgba(17, 37, 34, 0.06);
}

.eyebrow {
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.flash-banner {
    border-radius: 1rem;
    border: 1px solid rgba(47, 122, 71, 0.28);
    background: rgba(47, 122, 71, 0.09);
    color: #27573a;
    padding: 0.85rem 1rem;
}

.flash-banner-info {
    border-color: rgba(28, 126, 214, 0.22);
    background: rgba(28, 126, 214, 0.08);
    color: #1e5d8f;
}

.flash-banner-warning {
    border-color: rgba(217, 164, 65, 0.28);
    background: rgba(217, 164, 65, 0.12);
    color: #7a5717;
}

.flash-banner-error {
    border-color: rgba(183, 77, 69, 0.28);
    background: rgba(183, 77, 69, 0.1);
    color: #8c3933;
}

.toast-viewport {
    pointer-events: none;
    position: fixed;
    right: 1.25rem;
    top: 1.25rem;
    width: min(24rem, calc(100vw - 2rem));
    z-index: 120;
}

.toast-card {
    align-items: flex-start;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid var(--line);
    border-radius: 1rem;
    box-shadow: 0 18px 42px rgba(18, 20, 24, 0.16);
    display: flex;
    gap: 0.9rem;
    justify-content: space-between;
    padding: 0.95rem 1rem;
    pointer-events: auto;
}

.toast-card-success {
    border-color: rgba(47, 122, 71, 0.24);
    box-shadow: 0 18px 42px rgba(47, 122, 71, 0.12);
}

.toast-card-info {
    border-color: rgba(28, 126, 214, 0.22);
    box-shadow: 0 18px 42px rgba(28, 126, 214, 0.12);
}

.toast-card-warning {
    border-color: rgba(217, 164, 65, 0.26);
    box-shadow: 0 18px 42px rgba(217, 164, 65, 0.12);
}

.toast-card-error {
    border-color: rgba(183, 77, 69, 0.26);
    box-shadow: 0 18px 42px rgba(183, 77, 69, 0.14);
}

.toast-card-label {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.toast-card-message {
    color: var(--ink);
    font-size: 0.92rem;
    line-height: 1.5;
    margin-top: 0.22rem;
}

.toast-card-close {
    align-items: center;
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    font-size: 1.1rem;
    font-weight: 600;
    height: 1.8rem;
    justify-content: center;
    transition: background 120ms ease, color 120ms ease;
    width: 1.8rem;
}

.toast-card-close:hover {
    background: rgba(31, 37, 34, 0.06);
    color: var(--ink);
}

.toast-stack-enter-active,
.toast-stack-leave-active {
    transition: all 180ms ease;
}

.toast-stack-enter-from,
.toast-stack-leave-to {
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
}

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

.data-table th,
.data-table td {
    border-bottom: 1px solid var(--line);
    padding: 0.85rem 0.75rem;
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border-radius: 999px;
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-soft {
    background: var(--accent-soft);
    color: var(--accent);
}

.badge-warn {
    background: rgba(217, 164, 65, 0.15);
    color: #8a6115;
}

.badge-danger {
    background: rgba(183, 77, 69, 0.12);
    color: var(--danger);
}

.badge-success {
    background: rgba(47, 122, 71, 0.12);
    color: var(--success);
}

.field-input,
.field-select,
.field-textarea {
    width: 100%;
    border-radius: 0.95rem;
    border: 1px solid rgba(31, 37, 34, 0.12);
    background: #fffdf8;
    padding: 0.78rem 0.95rem;
    font-size: 0.95rem;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
    border-color: rgba(17, 100, 102, 0.5);
    box-shadow: 0 0 0 4px rgba(17, 100, 102, 0.12);
    outline: none;
}

.primary-action,
.secondary-action,
.danger-action,
.subtle-danger-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.78rem 1.1rem;
    font-weight: 600;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.primary-action {
    background: var(--ink);
    color: white;
}

.secondary-action {
    background: white;
    border: 1px solid var(--line);
    color: var(--ink);
}

.danger-action {
    background: var(--danger);
    color: white;
}

.subtle-danger-action {
    background: white;
    border: 1px solid rgba(183, 77, 69, 0.22);
    color: var(--danger);
}

.primary-action:hover,
.secondary-action:hover,
.danger-action:hover,
.subtle-danger-action:hover {
    transform: translateY(-1px);
}

.ghost-action {
    border-radius: 999px;
    border: 1px solid var(--line);
    background: white;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.45rem 0.8rem;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.ghost-action:hover {
    background: rgba(17, 100, 102, 0.08);
    border-color: rgba(17, 100, 102, 0.2);
}

.ghost-action-danger:hover {
    background: rgba(183, 77, 69, 0.1);
    border-color: rgba(183, 77, 69, 0.25);
    color: var(--danger);
}

.icon-button {
    align-items: center;
    background: white;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    display: inline-flex;
    height: 2.35rem;
    justify-content: center;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
    width: 2.35rem;
}

.icon-button:hover {
    background: rgba(17, 100, 102, 0.08);
    border-color: rgba(17, 100, 102, 0.2);
    color: var(--accent);
    transform: translateY(-1px);
}

.icon-button-danger:hover {
    background: rgba(183, 77, 69, 0.1);
    border-color: rgba(183, 77, 69, 0.25);
    color: var(--danger);
}

.button-icon {
    height: 1rem;
    width: 1rem;
}

.tree-panel {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--line);
    border-radius: 1.15rem;
    padding: 0.85rem;
}

.resizable-sidebar-layout {
    display: grid;
    gap: 1rem;
    min-width: 0;
}

.resizable-sidebar-layout__sidebar,
.resizable-sidebar-layout__main {
    min-width: 0;
}

.resizable-sidebar-layout__handle {
    display: none;
}

@media (min-width: 1280px) {
    .resizable-sidebar-layout {
        align-items: start;
        gap: 0.85rem;
        grid-template-columns: minmax(0, var(--resizable-sidebar-width, 360px)) 14px minmax(0, 1fr);
    }

    .resizable-sidebar-layout__handle {
        align-items: stretch;
        align-self: stretch;
        background: transparent;
        border: 0;
        cursor: col-resize;
        display: inline-flex;
        justify-content: center;
        min-height: 100%;
        padding: 0;
        position: relative;
    }

    .resizable-sidebar-layout__handle::after {
        background: rgba(17, 100, 102, 0.08);
        border-radius: 999px;
        content: '';
        inset: 0.25rem 0;
        opacity: 0;
        position: absolute;
        transition: opacity 120ms ease;
    }

    .resizable-sidebar-layout__handle:hover::after,
    .resizable-sidebar-layout-dragging .resizable-sidebar-layout__handle::after {
        opacity: 1;
    }

    .resizable-sidebar-layout__handle-track {
        align-self: stretch;
        background: linear-gradient(180deg, rgba(17, 100, 102, 0.22), rgba(17, 100, 102, 0.08));
        border-radius: 999px;
        display: block;
        margin: 0.55rem 0;
        position: relative;
        width: 4px;
        z-index: 1;
    }

    .resizable-sidebar-layout__handle-track::before {
        background: rgba(255, 255, 255, 0.94);
        border: 1px solid rgba(17, 100, 102, 0.18);
        border-radius: 999px;
        box-shadow: 0 10px 24px rgba(17, 100, 102, 0.08);
        content: '';
        height: 3.1rem;
        left: 50%;
        position: absolute;
        top: 50%;
        transform: translate(-50%, -50%);
        width: 0.85rem;
    }
}

.is-resizing-sidebar,
.is-resizing-sidebar * {
    cursor: col-resize !important;
    user-select: none !important;
}

.tree-search-input {
    width: 100%;
    border-radius: 0.85rem;
    border: 1px solid rgba(31, 37, 34, 0.12);
    background: rgba(255, 255, 255, 0.84);
    padding: 0.68rem 0.9rem 0.68rem 2.2rem;
    font-size: 0.88rem;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.tree-search-input:focus {
    border-color: rgba(17, 100, 102, 0.42);
    box-shadow: 0 0 0 4px rgba(17, 100, 102, 0.1);
    outline: none;
}

.tree-toolbar-button {
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.8);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.36rem 0.72rem;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.tree-toolbar-button:hover {
    background: rgba(17, 100, 102, 0.08);
    border-color: rgba(17, 100, 102, 0.2);
    color: var(--accent);
}

.empty-state {
    border: 1px dashed rgba(31, 37, 34, 0.18);
    border-radius: 1.5rem;
    background: rgba(255, 255, 255, 0.56);
    padding: 1.25rem;
}

.curriculum-tree-row {
    align-items: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.85rem;
    display: flex;
    gap: 0.45rem;
    min-height: 2.65rem;
    padding: 0.32rem 0.4rem;
    transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
}

.curriculum-tree-row:hover {
    background: rgba(255, 255, 255, 0.74);
    border-color: rgba(17, 100, 102, 0.14);
}

.curriculum-tree-row-selected {
    background: rgba(17, 100, 102, 0.1);
    border-color: rgba(17, 100, 102, 0.18);
    box-shadow: inset 2px 0 0 var(--accent);
}

.tree-chevron {
    align-items: center;
    background: transparent;
    border-radius: 999px;
    color: var(--accent);
    display: inline-flex;
    height: 1.55rem;
    justify-content: center;
    width: 1.55rem;
}

.tree-type-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: rgba(17, 100, 102, 0.1);
    color: var(--accent);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0.14rem 0.38rem;
    text-transform: uppercase;
}

.tree-row-meta {
    color: var(--muted);
    font-size: 0.73rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-more-button {
    align-items: center;
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    height: 1.7rem;
    justify-content: center;
    opacity: 0;
    transition: background 120ms ease, color 120ms ease, opacity 120ms ease;
    width: 1.7rem;
}

.tree-more-button:hover {
    background: rgba(17, 100, 102, 0.08);
    color: var(--accent);
}

.curriculum-tree-row:hover .tree-more-button,
.curriculum-tree-row:focus-within .tree-more-button,
.curriculum-tree-row-selected .tree-more-button {
    opacity: 1;
}

.tree-menu-item {
    display: block;
    width: 100%;
    padding: 0.6rem 0.9rem;
    text-align: left;
    font-size: 0.88rem;
    color: var(--ink);
    transition: background 120ms ease;
}

.tree-menu-item:hover {
    background: rgba(17, 100, 102, 0.08);
}

.tree-children-rail {
    border-left: 1px solid rgba(31, 37, 34, 0.14);
    margin-left: 0.72rem;
    padding-left: 0.6rem;
}

.workspace-card {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--line);
    border-radius: 1.25rem;
    padding: 1rem 1.05rem;
}

.workspace-section {
    border: 1px solid var(--line);
    border-radius: 1.1rem;
    background: rgba(255, 255, 255, 0.74);
    padding: 0.95rem 1rem;
}

.workspace-subtle-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.82);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.32rem 0.72rem;
}

.workspace-breadcrumb {
    align-items: center;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    font-size: 0.82rem;
    gap: 0.35rem;
    line-height: 1.4;
}

.workspace-breadcrumb-item {
    color: var(--muted);
}

.workspace-breadcrumb-separator {
    color: rgba(91, 101, 95, 0.62);
}

.workspace-breadcrumb-empty {
    color: var(--muted);
}

.workspace-summary-line {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.5;
    margin-top: 0.55rem;
}

.workspace-table th,
.workspace-table td {
    padding: 0.8rem 0.75rem;
}

.workspace-table-link {
    color: var(--ink);
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
    transition: color 120ms ease;
}

.workspace-table-link:hover {
    color: var(--accent);
}

.table-row-menu {
    align-items: center;
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    height: 2rem;
    justify-content: center;
    transition: background 120ms ease, color 120ms ease;
    width: 2rem;
}

.table-row-menu:hover {
    background: rgba(17, 100, 102, 0.08);
    color: var(--accent);
}

.workspace-metadata-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.workspace-summary-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.workspace-metadata-item {
    border-radius: 0.95rem;
    border: 1px solid rgba(31, 37, 34, 0.1);
    background: rgba(244, 241, 232, 0.45);
    padding: 0.85rem 0.95rem;
}

.workspace-metadata-item dt {
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.workspace-metadata-item dd {
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.45rem;
}

.workspace-tabs {
    align-items: center;
    border-bottom: 1px solid rgba(31, 37, 34, 0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding-bottom: 0.4rem;
}

.workspace-tab-button {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    font-size: 0.8rem;
    font-weight: 600;
    gap: 0.35rem;
    padding: 0.45rem 0.78rem;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.workspace-tab-button:hover {
    background: rgba(17, 100, 102, 0.06);
    color: var(--accent);
}

.workspace-tab-button.is-active {
    background: rgba(17, 100, 102, 0.1);
    border-color: rgba(17, 100, 102, 0.14);
    color: var(--accent);
}

.drawer-shell {
    inset: 0;
    pointer-events: none;
    position: fixed;
    z-index: 70;
}

.drawer-backdrop {
    background: rgba(18, 20, 24, 0.38);
    inset: 0;
    pointer-events: auto;
    position: absolute;
    width: 100%;
}

.drawer-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(249, 247, 241, 0.96) 100%);
    border-left: 1px solid rgba(31, 37, 34, 0.12);
    box-shadow: -24px 0 60px rgba(18, 20, 24, 0.18);
    height: 100%;
    max-width: min(94vw, 34rem);
    overflow-y: auto;
    padding: 1.5rem;
    pointer-events: auto;
    position: absolute;
    right: 0;
    top: 0;
    width: 100%;
}

.drawer-panel-wide {
    max-width: min(96vw, 44rem);
}

/* ------------------------------------------------------------------------ */
/* Book generation status (curriculum explorer + book manager)               */
/* ------------------------------------------------------------------------ */

.book-status {
    display: inline-flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

.book-status-pill {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.68rem;
    font-weight: 700;
    gap: 0.35rem;
    letter-spacing: 0.04em;
    line-height: 1;
    padding: 0.3rem 0.6rem;
    text-transform: uppercase;
    white-space: nowrap;
    width: max-content;
}

.book-status-md .book-status-pill {
    font-size: 0.76rem;
    padding: 0.4rem 0.75rem;
}

.book-status-count {
    background: rgba(255, 255, 255, 0.55);
    border-radius: 999px;
    font-size: 0.66rem;
    padding: 0.08rem 0.4rem;
}

.book-status-dot {
    animation: book-status-pulse 1.4s ease-in-out infinite;
    background: currentColor;
    border-radius: 999px;
    display: inline-block;
    height: 0.5rem;
    width: 0.5rem;
}

@keyframes book-status-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.35; transform: scale(0.7); }
}

.book-status-live .book-status-pill { background: rgba(17, 100, 102, 0.16); color: var(--accent); }
.book-status-queued .book-status-pill { background: rgba(59, 91, 219, 0.12); color: #2f48b5; }
.book-status-danger .book-status-pill { background: rgba(183, 77, 69, 0.14); color: var(--danger); }
.book-status-warn .book-status-pill { background: rgba(217, 164, 65, 0.18); color: #8a6115; }
.book-status-success .book-status-pill { background: rgba(47, 122, 71, 0.14); color: var(--success); }
.book-status-muted .book-status-pill { background: rgba(31, 37, 34, 0.07); color: var(--muted); }

.book-status-bar {
    background: rgba(31, 37, 34, 0.08);
    border-radius: 999px;
    display: block;
    height: 4px;
    min-width: 5.5rem;
    overflow: hidden;
    width: 100%;
}

.book-status-bar-fill {
    border-radius: 999px;
    display: block;
    height: 100%;
    transition: width 240ms ease;
}

.book-status-live .book-status-bar-fill { background: var(--accent); }
.book-status-queued .book-status-bar-fill { background: #2f48b5; }
.book-status-danger .book-status-bar-fill { background: var(--danger); }
.book-status-warn .book-status-bar-fill { background: #c48a1c; }
.book-status-success .book-status-bar-fill { background: var(--success); }
.book-status-muted .book-status-bar-fill { background: var(--muted); }

/* Status filter strip */

.book-filter-strip {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.book-filter-chip {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    font-size: 0.74rem;
    font-weight: 600;
    gap: 0.35rem;
    padding: 0.3rem 0.65rem;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.book-filter-chip:hover { border-color: rgba(17, 100, 102, 0.24); color: var(--ink); }

.book-filter-count {
    background: rgba(31, 37, 34, 0.06);
    border-radius: 999px;
    font-size: 0.66rem;
    padding: 0.08rem 0.4rem;
}

.book-filter-active { background: rgba(31, 37, 34, 0.08); border-color: rgba(31, 37, 34, 0.2); color: var(--ink); }
.book-filter-running.book-filter-active { background: rgba(17, 100, 102, 0.14); border-color: rgba(17, 100, 102, 0.3); color: var(--accent); }
.book-filter-scheduled.book-filter-active { background: rgba(59, 91, 219, 0.12); border-color: rgba(59, 91, 219, 0.3); color: #2f48b5; }
.book-filter-failed.book-filter-active { background: rgba(183, 77, 69, 0.12); border-color: rgba(183, 77, 69, 0.3); color: var(--danger); }
.book-filter-pending.book-filter-active { background: rgba(217, 164, 65, 0.16); border-color: rgba(217, 164, 65, 0.4); color: #8a6115; }
.book-filter-complete.book-filter-active { background: rgba(47, 122, 71, 0.12); border-color: rgba(47, 122, 71, 0.3); color: var(--success); }

/* Book rows in the explorer list */

.book-row {
    align-items: center;
    border-bottom: 1px solid rgba(31, 37, 34, 0.07);
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(0, 1fr) auto auto auto auto;
    padding: 0.55rem 0.75rem;
    transition: background 120ms ease;
}

.book-row:last-child { border-bottom: 0; }
.book-row:hover { background: rgba(17, 100, 102, 0.03); }
.book-row-selected { background: rgba(17, 100, 102, 0.06); }

.book-row-main {
    display: block;
    min-width: 0;
    text-align: left;
}

.book-row-title {
    color: var(--ink);
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-row-main:hover .book-row-title { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.book-row-sub {
    color: var(--muted);
    display: block;
    font-size: 0.74rem;
    margin-top: 0.12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-row-status {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 7rem;
}

.book-row-detail {
    color: var(--muted);
    font-size: 0.68rem;
    white-space: nowrap;
}

.book-row-id {
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.74rem;
    font-weight: 600;
    white-space: nowrap;
}

.book-row-id:hover { text-decoration: underline; }

.book-row-preview {
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.28rem 0.6rem;
    transition: border-color 120ms ease, color 120ms ease;
}

.book-row-preview:hover { border-color: rgba(17, 100, 102, 0.3); color: var(--accent); }

@media (max-width: 720px) {
    .book-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .book-row-status { grid-column: 1 / -1; }
    .book-row-id, .book-row-preview { display: none; }
}

.book-card {
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    padding: 0.75rem;
    transition: background 120ms ease, border-color 120ms ease;
}

.book-card:hover { background: rgba(17, 100, 102, 0.02); border-color: rgba(17, 100, 102, 0.18); }
.book-card-selected { background: rgba(17, 100, 102, 0.04); border-color: rgba(17, 100, 102, 0.22); }

/* Book manager: prev / next / jump-to + metric chips */

.book-nav-button {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    display: inline-flex;
    font-size: 0.8rem;
    font-weight: 600;
    gap: 0.45rem;
    max-width: 18rem;
    padding: 0.4rem 0.85rem;
    transition: border-color 120ms ease, color 120ms ease;
}

.book-nav-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.book-nav-button:disabled { cursor: not-allowed; opacity: 0.45; }

.book-nav-target {
    color: var(--muted);
    font-weight: 500;
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-nav-jump select {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    font-size: 0.8rem;
    font-weight: 600;
    max-width: 22rem;
    padding: 0.4rem 2rem 0.4rem 0.85rem;
}

.book-metric-chip {
    align-items: baseline;
    border: 1px solid transparent;
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.72rem;
    gap: 0.35rem;
    padding: 0.22rem 0.6rem;
}

.book-metric-label { font-weight: 500; opacity: 0.85; }
.book-metric-value { font-weight: 700; }

.book-metric-live { background: rgba(17, 100, 102, 0.14); color: var(--accent); }
.book-metric-queued { background: rgba(59, 91, 219, 0.12); color: #2f48b5; }
.book-metric-danger { background: rgba(183, 77, 69, 0.12); color: var(--danger); }
.book-metric-warn { background: rgba(217, 164, 65, 0.18); color: #8a6115; }
.book-metric-success { background: rgba(47, 122, 71, 0.12); color: var(--success); }
.book-metric-muted { background: rgba(31, 37, 34, 0.05); color: var(--muted); }

/* ------------------------------------------------------------------------ */
/* Curriculum page: compact right-hand workspace                            */
/* ------------------------------------------------------------------------ */

.ws-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.9rem 0.95rem;
}

.ws-head {
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding-bottom: 0.8rem;
}

.ws-head-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.ws-title {
    color: var(--ink);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.ws-meta-line {
    color: var(--muted);
    font-size: 0.76rem;
}

.ws-chip {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    font-size: 0.7rem;
    font-weight: 600;
    gap: 0.3rem;
    line-height: 1;
    padding: 0.3rem 0.55rem;
}

.ws-chip-mono {
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

button.ws-chip:hover { border-color: rgba(17, 100, 102, 0.3); color: var(--accent); }

.ws-actions {
    align-items: center;
    display: flex;
    gap: 0.35rem;
    margin-left: auto;
}

.ws-primary {
    align-items: center;
    background: var(--ink);
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
    padding: 0.55rem 0.9rem;
    transition: background 120ms ease, transform 120ms ease;
    white-space: nowrap;
}

.ws-primary:hover { background: var(--accent); transform: translateY(-1px); }

.ws-icon-btn {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    height: 2rem;
    justify-content: center;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
    width: 2rem;
}

.ws-icon-btn:hover { background: rgba(17, 100, 102, 0.08); border-color: rgba(17, 100, 102, 0.24); color: var(--accent); }
.ws-icon-btn-danger:hover { background: rgba(183, 77, 69, 0.1); border-color: rgba(183, 77, 69, 0.28); color: var(--danger); }
.ws-icon-btn-active { background: rgba(17, 100, 102, 0.12); border-color: rgba(17, 100, 102, 0.3); color: var(--accent); }
.ws-icon-btn-sm { height: 1.7rem; width: 1.7rem; }

.ws-section {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: 0.9rem;
    padding: 0.7rem 0.8rem;
}

.ws-section-head {
    align-items: center;
    display: flex;
    gap: 0.5rem;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.ws-section-title {
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ws-stat-grid {
    display: grid;
    gap: 0.4rem;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
}

.ws-stat {
    background: rgba(244, 241, 232, 0.5);
    border: 1px solid rgba(31, 37, 34, 0.08);
    border-radius: 0.7rem;
    padding: 0.45rem 0.6rem;
}

.ws-stat dt {
    color: var(--muted);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ws-stat dd {
    color: var(--ink);
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.1;
    margin-top: 0.15rem;
}

.ws-stat-live dd { color: var(--accent); }
.ws-stat-queued dd { color: #2f48b5; }
.ws-stat-danger dd { color: var(--danger); }
.ws-stat-warn dd { color: #8a6115; }
.ws-stat-success dd { color: var(--success); }

.ws-progress {
    background: rgba(31, 37, 34, 0.08);
    border-radius: 999px;
    height: 6px;
    overflow: hidden;
    width: 100%;
}

.ws-progress-fill {
    border-radius: 999px;
    display: block;
    height: 100%;
    transition: width 240ms ease;
}

/* Shortcut rows */

.shortcut-group + .shortcut-group { margin-top: 0.6rem; }

.shortcut-group-label {
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
}

.shortcut-list { display: flex; flex-direction: column; }

.shortcut-row {
    align-items: center;
    border-radius: 0.6rem;
    display: grid;
    gap: 0.5rem;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    padding: 0.35rem 0.45rem;
    transition: background 120ms ease;
}

.shortcut-row:hover { background: rgba(17, 100, 102, 0.04); }
.shortcut-row-selected { background: rgba(17, 100, 102, 0.07); }

.shortcut-main { display: block; min-width: 0; }

.shortcut-name {
    color: var(--ink);
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.shortcut-main:hover .shortcut-name { color: var(--accent); }

.shortcut-path {
    color: var(--muted);
    display: block;
    font-size: 0.68rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
