/* ADR 0033 - the curated notebook (/notebook). Prefix nb-. */
.nb-toolbar {
    display: flex;
    gap: .5rem;
    margin: 1rem 0 .75rem;
}
.nb-search { flex: 1; }
.nb-new { white-space: nowrap; }

.nb-tags {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-bottom: 1rem;
}
.nb-tag {
    border: 1px solid var(--mex-line, #d7e0da);
    background: var(--mex-surface, #fff);
    border-radius: 999px;
    padding: .15rem .7rem;
    font: inherit;
    font-size: .82rem;
    cursor: pointer;
}
.nb-tag.is-active {
    background: var(--mex-accent, #1f9d6b);
    color: #fff;
    border-color: var(--mex-accent, #1f9d6b);
}

.nb-editor {
    border: 1px solid var(--mex-line, #d7e0da);
    border-radius: .7rem;
    padding: 1rem;
    margin-bottom: 1.25rem;
    background: var(--mex-surface, #fff);
    display: grid;
    gap: .6rem;
}
.nb-edit-body { resize: vertical; }
.nb-edit-actions { display: flex; gap: .5rem; }
.nb-delete { margin-left: auto; }

.nb-items { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; }
.nb-item {
    border: 1px solid var(--mex-line, #d7e0da);
    border-radius: .7rem;
    padding: .9rem 1rem;
    background: var(--mex-surface, #fff);
}
.nb-item.is-highlighted { border-color: var(--mex-accent, #1f9d6b); box-shadow: 0 0 0 2px rgba(31,157,107,.12); }
.nb-item-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.nb-item-title { font-size: 1rem; margin: 0; }
.nb-item-edit {
    border: none;
    background: none;
    color: var(--mex-accent, #1f9d6b);
    font: inherit;
    font-size: .82rem;
    cursor: pointer;
}
.nb-item-body { margin: .4rem 0 0; font-size: .92rem; white-space: pre-wrap; }
/* ADR 0040 D7 - a lesson passage quoted into a classroom note. */
.nb-item-quote { margin: .45rem 0 0; padding: .4rem .75rem; border-left: 3px solid var(--mx-nav-action); background: var(--mx-nav-action-tint); border-radius: 0 8px 8px 0; font-size: .88rem; font-style: italic; }
.nb-item-tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }
.nb-item-tag {
    font-size: .74rem;
    background: #eef4f1;
    color: var(--mex-muted, #5c6f66);
    border-radius: 999px;
    padding: .05rem .5rem;
}
.nb-item-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: .6rem;
}
.nb-item-when { font-size: .78rem; color: var(--mex-muted, #5c6f66); }
.nb-item-practise { font-size: .82rem; }
/* ADR 0040 D7 - a classroom note's "from <lesson>" provenance, kept quiet in the item foot. */
.nb-item-source { font-size: .76rem; color: var(--mex-muted, #5c6f66); font-style: italic; }

/* ── ADR 0040 D7 - segmented source filter (All / Courses / Questions / Resources / General) ── */
.nb-seg {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    margin: 0 0 .75rem;
    padding: .25rem;
    border: 1px solid var(--mex-line, #d7e0da);
    border-radius: 999px;
    background: var(--bs-tertiary-bg, #f2f6f4);
    width: fit-content;
    max-width: 100%;
}
.nb-seg-btn {
    border: none;
    background: none;
    border-radius: 999px;
    padding: .28rem .8rem;
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    color: var(--mex-muted, #5c6f66);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}
.nb-seg-btn:hover { color: var(--bs-heading-color); }
.nb-seg-btn.is-active {
    background: var(--mex-surface, #fff);
    color: var(--bs-heading-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}
.nb-seg-count {
    font-size: .7rem;
    font-weight: 700;
    color: var(--mex-muted, #5c6f66);
    background: rgba(0, 0, 0, .06);
    border-radius: 999px;
    padding: 0 .4rem;
    min-width: 1.1rem;
    text-align: center;
}
.nb-seg-btn.is-active .nb-seg-count { background: rgba(var(--bs-primary-rgb, 31, 157, 107), .14); color: var(--mex-accent, #1f9d6b); }

/* ── ADR 0040 D7 - source groups ── */
.nb-group { margin-bottom: 1.4rem; }
.nb-group-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: .6rem;
    padding-bottom: .4rem;
    border-bottom: 1px solid var(--mex-line, #d7e0da);
    margin-bottom: .8rem;
}
.nb-group-toggle {
    border: none;
    background: none;
    font: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: baseline;
    gap: .45rem;
    padding: 0;
    color: var(--bs-heading-color);
    min-width: 0;
}
.nb-group-caret {
    flex: 0 0 auto;
    align-self: center;
    transition: transform .18s ease;
    color: var(--mex-muted, #5c6f66);
    line-height: 0;
}
.nb-group-caret svg { width: 16px; height: 16px; }
.nb-group-caret.is-collapsed { transform: rotate(-90deg); }
.nb-group-title {
    font-family: var(--mx-font-serif, Georgia, serif);
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--bs-heading-color);
}
.nb-group-count {
    font-size: .74rem;
    font-weight: 700;
    color: var(--mex-muted, #5c6f66);
    background: rgba(0, 0, 0, .06);
    border-radius: 999px;
    padding: 0 .45rem;
    align-self: center;
}
.nb-group-open { font-size: .82rem; font-weight: 600; white-space: nowrap; flex: 0 0 auto; }

/* course lesson sub-groups */
.nb-sub { margin-bottom: 1rem; }
.nb-sub-head { margin: 0 0 .45rem; }
.nb-sub-title {
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: var(--mex-accent, #1f9d6b);
    text-decoration: none;
}
.nb-sub-title:hover { text-decoration: underline; }
.nb-sub-title--plain { color: var(--mex-muted, #5c6f66); }

/* ── ADR 0040 D7 - cross-link to the scratch question notes ── */
.nb-crosslink {
    display: flex;
    align-items: center;
    gap: .9rem;
    margin-top: 1.5rem;
    padding: .85rem 1rem;
    border: 1px dashed var(--mex-line, #d7e0da);
    border-radius: .7rem;
    background: var(--mex-surface, #fff);
    text-decoration: none;
    color: inherit;
}
.nb-crosslink:hover { border-color: var(--mex-accent, #1f9d6b); }
.nb-crosslink-ic {
    flex: 0 0 auto;
    width: 38px; height: 38px;
    border-radius: 10px;
    display: grid; place-items: center;
    background: rgba(var(--bs-primary-rgb, 31, 157, 107), .1);
    color: var(--mex-accent, #1f9d6b);
}
.nb-crosslink-ic svg { width: 20px; height: 20px; }
.nb-crosslink-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.nb-crosslink-title { font-weight: 700; font-size: .9rem; color: var(--bs-heading-color); }
.nb-crosslink-sub { font-size: .8rem; color: var(--mex-muted, #5c6f66); }
.nb-crosslink-go { flex: 0 0 auto; color: var(--mex-accent, #1f9d6b); font-weight: 700; }
