/* ============================================
   Protocol Module Styles
   ============================================ */

/* Protocol page layout — Session 4: full-height, no outer scroll */
.protocol-page {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.protocol-split-layout {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

/* Left pane: editor — fills remaining space, scrolls internally */
.protocol-editor-pane {
    flex: 2;
    min-height: 0;
    overflow-y: auto;
}

/* Right column: stacked cards, no outer scroll */
.protocol-sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    min-width: 300px;
}

/* Protocol list card — fixed ~50% of right column height */
.protocol-sidebar-list-card {
    flex: 0 0 50%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.protocol-sidebar-list-card .app-card-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Accordion cards: 3D Context and Export */
.protocol-sidebar-accordion-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: flex 0.25s ease;
}

.protocol-sidebar-accordion-card--collapsed {
    flex: 0 0 auto;
}

.protocol-sidebar-accordion-card--expanded {
    flex: 1;
    min-height: 0;
}

.protocol-sidebar-accordion-card .app-card-body {
    overflow-y: auto;
    min-height: 0;
}

.protocol-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.protocol-accordion-header:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* Responsive: stack on narrow screens */
@media (max-width: 1200px) {
    .protocol-split-layout {
        flex-direction: column;
        overflow-y: auto;
    }

    .protocol-editor-pane {
        flex: none;
        overflow-y: visible;
    }

    .protocol-sidebar {
        flex: none;
        overflow: visible;
    }

    .protocol-sidebar-list-card {
        flex: none;
    }

    .protocol-sidebar-accordion-card--expanded,
    .protocol-sidebar-accordion-card--collapsed {
        flex: none;
    }
}

/* Protocol editor */
.protocol-editor {
    padding: 20px;
}

/* ── Title Card ────────────────────────────────────────────────────── */
.protocol-title-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.protocol-title-input {
    font-size: 2rem;
    font-weight: bold;
    border: none;
    border-bottom: 2px solid #e0e0e0;
    padding: 10px 0;
    margin-bottom: 10px;
    width: 100%;
}

.protocol-title-input:focus {
    outline: none;
    border-bottom-color: #0068a8;
}

/* Title toolbar row */
.protocol-title-toolbar {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 8px;
}

/* Generic toolbar button */
.protocol-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--color-primary, #0068a8);
    border-radius: 4px;
    background: #fff;
    color: var(--color-primary, #0068a8);
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.protocol-toolbar-btn:hover:not(:disabled) {
    background: #e8f0fe;
    border-color: #005a91;
    color: #005a91;
}

.protocol-toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Chevron button pushed to the right */
.protocol-toolbar-btn--chevron {
    margin-left: auto;
}

/* Add Section button — no extra spacing, sits right after the date area */
.protocol-toolbar-add-section {
}

/* +BCF action button — same shape as toolbar btn, slightly bolder */
.protocol-bcf-create-btn {
    font-weight: 600;
}

.protocol-bcf-create-btn:hover:not(:disabled) {
    background: #e8f0fe;
    border-color: #005a91;
    color: #005a91;
}

/* Created date badge (green) */
.protocol-created-date-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    background: #2E8540;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.protocol-created-date-badge:hover {
    background: #246a33;
}

/* Due date badge (blue, set date) */
.protocol-due-date-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    background: #0068a8;
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.protocol-due-date-badge:hover {
    background: #005a91;
}

/* Inline due date picker row */
.protocol-due-date-picker-row {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.protocol-date-input {
    padding: 3px 6px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #495057;
}

/* File chips below toolbar */
.protocol-title-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid #f0f0f0;
}

.protocol-file-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: #f3f5f7;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    font-size: 0.78rem;
    color: #495057;
    max-width: 220px;
}

.protocol-file-chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.protocol-file-chip-remove {
    background: none;
    border: none;
    padding: 0 2px;
    color: #dc3545;
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
    flex-shrink: 0;
}

.protocol-file-chip-open {
    background: none;
    border: none;
    padding: 0 2px;
    color: #0d6efd;
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
    flex-shrink: 0;
}

.protocol-file-chip-open:hover { color: #0a58ca; }

.protocol-file-chip-remove:hover { color: #a71d2a; }

/* Formatting toolbar */
.protocol-format-toolbar {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-top: 4px;
}

.protocol-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
    align-items: center;
}

.protocol-toolbar .btn {
    display: flex;
    align-items: center;
    gap: 5px;
}

.toolbar-separator {
    width: 1px;
    height: 24px;
    background: #dee2e6;
    margin: 0 4px;
}

/* Protocol sections */
.protocol-section {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    background: #fafafa;
    margin-bottom: 16px;
}

.section-header {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Section header row: person name left, buttons right */
.section-header-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    margin-bottom: 4px;
}

/* Left: responsible person name in italic */
.section-person-label {
    flex: 1;
    min-width: 0;
    font-size: 0.82rem;
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Right: action buttons group */
.section-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.section-header-row .section-title-input {
    flex: 1;
    min-width: 0;
}

/* Make the due-date picker compact inline */
.section-due-date-picker {
    width: 130px;
    flex-shrink: 0;
}

.section-title-input {
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-bottom: 1px solid #e0e0e0;
    background: transparent;
    padding: 5px 0;
    width: 100%;
    display: block;
    margin-bottom: 4px;
}

.section-title-input:focus {
    outline: none;
    border-bottom-color: #0068a8;
}

/* Section action icons */
.section-actions {
    display: flex;
    gap: 5px;
    align-items: center;
    position: relative;
}

/* 3D Context badge button (inline in section header actions) */
.protocol-context-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 500;
    border: 1px solid var(--color-border-subtle, #e0e0e0);
    background: transparent;
    color: var(--color-text-muted, #6b7280);
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.5;
    transition: background 0.15s, color 0.15s;
}

.protocol-context-badge:hover {
    background: var(--color-primary-light, #e8f0fe);
    color: var(--color-primary, #005f9e);
    border-color: var(--color-primary, #005f9e);
}

.protocol-context-badge.has-context {
    background: #e8f0fe;
    color: var(--color-primary, #005f9e);
    border-color: var(--color-primary, #005f9e);
}

.btn-icon i {
    font-size: 1rem;
}

/* When person is assigned - use primary color */
.btn-icon.btn-primary {
    background: var(--color-button-primary);
    color: var(--color-white);
    border-color: var(--color-button-primary);
}

.btn-icon.btn-primary:hover {
    background: var(--color-button-primary-hover);
    border-color: var(--color-button-primary-hover);
}

.btn-icon.btn-locked {
    background: #fff3cd;
    border-color: #ffc107;
}

.btn-icon.btn-locked:hover {
    background: #ffe69c;
}

.btn-danger-icon {
    border-color: #dc3545;
    color: #dc3545;
}

.btn-danger-icon:hover {
    background: #dc3545;
    color: white;
}

/* Section user dropdown - positioned relative to section header */
.section-user-dropdown {
    position: relative;
    margin-top: 8px;
    margin-bottom: 8px;
}

.section-user-dropdown .person-dropdown {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.person-dropdown-remove {
    padding: 8px;
    border-top: 1px solid #e0e0e0;
}

.person-dropdown-item.selected {
    background-color: #e6f2f8;
    border-left: 3px solid #0068a8;
}

.person-dropdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.person-dropdown-item i.bi-check-lg {
    margin-left: auto;
}


.modal.show.d-block {
    z-index: 1050;
}

.user-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.user-item {
    padding: 10px 15px;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
}

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

.user-item:hover {
    background-color: #f8f9fa;
}

.user-item.selected {
    background-color: #e6f2f8;
    border-left: 3px solid #0068a8;
}

.user-item i {
    color: #6c757d;
}

/* User tooltip (shows on hover when user is assigned) */
.user-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.875rem;
    white-space: nowrap;
    z-index: 1000;
    top: 100%;
    margin-top: 5px;
    left: 0;
    pointer-events: none;
}

.user-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 10px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid rgba(0, 0, 0, 0.8);
}

.section-content {
    background: white;
    padding: 15px;
    border-radius: 4px;
}

.protocol-block {
    padding: 10px;
    border-radius: 4px;
    background: white;
    position: relative;
}

/* Block insert controls */
.block-insert-controls {
    display: flex;
    gap: 5px;
    padding: 5px 0;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.block-insert-controls:hover {
    opacity: 1;
}

.btn-insert {
    font-size: 0.85rem;
    padding: 3px 8px;
}

/* Block action row — below each block: [Para][List][Bold][Italic][Underline] ... [Delete] */
.block-actions-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding-top: 4px;
    border-top: 1px solid #f0f0f0;
}

.block-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: #fff;
    color: #495057;
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
    min-width: 0;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.block-action-btn:hover {
    background: #f0f0f0;
    border-color: #adb5bd;
}

.block-action-btn--delete {
    margin-left: auto;
    color: #dc3545;
    border-color: #dc3545;
}

.block-action-btn--delete:hover {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

/* Bullet list placeholder styling */
input.list-item-placeholder-input::placeholder {
    color: #6c757d;
    font-style: italic;
}

/* Editable block styles */
.heading-input {
    font-weight: 600;
    border: 1px solid #e0e0e0;
    padding: 8px;
    border-radius: 4px;
}

.heading-input.h1-style {
    font-size: 2rem;
}

.heading-input.h2-style {
    font-size: 1.5rem;
}

.heading-input:focus {
    outline: none;
    border-color: #0068a8;
}

.paragraph-textarea {
    border: 1px solid #e0e0e0;
    padding: 8px;
    border-radius: 4px;
    resize: vertical;
}

.paragraph-textarea:focus {
    outline: none;
    border-color: #0068a8;
}

/* Paragraph editor with contenteditable - single inline field */
.paragraph-editor-contenteditable {
    border: 1px solid #e0e0e0;
    padding: 12px;
    border-radius: 4px;
    min-height: 80px;
    line-height: 1.6;
    background: white;
    cursor: text;
}

.paragraph-editor-contenteditable:focus {
    outline: none;
    border-color: #0068a8;
    box-shadow: 0 0 0 0.2rem rgba(0, 104, 168, 0.25);
}

.paragraph-editor-contenteditable:empty:before {
    content: attr(data-placeholder);
    color: #6c757d;
    pointer-events: none;
}

.paragraph-editor-contenteditable strong {
    font-weight: bold;
}

.paragraph-editor-contenteditable em {
    font-style: italic;
}

.paragraph-editor-contenteditable u,
.paragraph-editor-contenteditable [style*="text-decoration: underline"] {
    text-decoration: underline;
}

.list-editor {
    padding: 5px;
}

.list-item-editor {
    display: flex;
    align-items: center;
    gap: 5px;
}

.list-item-input {
    flex: 1;
    min-width: 0;
}

.bullet-point {
    font-weight: bold;
    font-size: 1.2rem;
    color: #333;
}

.list-item-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    flex-shrink: 0;
    line-height: 1;
}

.list-item-btn-add {
    background-color: #0d6efd;
    color: #fff;
}

.list-item-btn-add:hover {
    background-color: #0b5ed7;
}

.list-item-btn-remove {
    background-color: #dc3545;
    color: #fff;
}

.list-item-btn-remove:hover {
    background-color: #bb2d3b;
}

.user-mention-editor,
.object-reference-editor {
    padding: 5px;
}

.protocol-block h1,
.protocol-block h2,
.protocol-block h3 {
    margin: 10px 0;
}

.protocol-block p {
    margin: 8px 0;
    line-height: 1.6;
}

.protocol-block ul {
    margin: 8px 0;
    padding-left: 20px;
}

.user-mention {
    color: #0068a8;
    background: #e6f2f8;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.object-reference {
    color: #6a4c93;
    background: #f0eaf6;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

/* Protocol list */
.protocol-list-scroll-area {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 0;
}

.protocol-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 15px;
}

.protocol-list-table {
    margin-bottom: 0;
}

.protocol-list-row {
    cursor: pointer;
    transition: background-color 0.2s;
}

.protocol-list-row:hover {
    background-color: #f5f5f5;
}

.protocol-list-row.active {
    background-color: #e6f2f8;
    border-left: 3px solid #0068a8;
}

.new-protocol-form {
    flex-shrink: 0;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

/* Protocol action buttons - horizontal layout */
.protocol-action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.protocol-action-buttons .btn {
    flex: 1;
}

.protocol-status-message {
    flex-shrink: 0;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.protocol-status-message--success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.protocol-status-message--bcf {
    background-color: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

.protocol-status-message--error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Block delete button - inline red X */
.block-content-wrapper {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.block-content-wrapper > *:first-child {
    flex: 1;
}

.btn-delete-block {
    background: var(--color-button-danger-bg);
    color: var(--color-error);
    border: 1px solid var(--color-error);
    border-radius: var(--radius-small);
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.btn-delete-block:hover {
    background: var(--color-error);
    color: var(--color-white);
}

.btn-delete-block:focus {
    outline: var(--focus-outline);
    outline-offset: var(--focus-outline-offset);
}

/* Card styles for protocol */
.card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.card-header h3,
.card-header h4 {
    margin: 0 0 5px 0;
}

.card-body {
    padding: 20px;
}

/* ── ProtocolModelContextCard ─────────────────────────────────────────────── */

.context3d-card-body {
    padding: 4px 0;
    min-height: 80px;
}

.context3d-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 12px;
    color: var(--mud-palette-text-disabled, #a0a0a0);
    font-size: 0.82rem;
}

.context3d-empty i {
    font-size: 1.4rem;
}

.context3d-tab-panel {
    padding: 4px 0;
}

.context3d-empty-tab {
    padding: 12px 8px;
    font-size: 0.8rem;
    color: var(--mud-palette-text-disabled, #a0a0a0);
}

.context3d-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 0;
}

.context3d-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
}

.context3d-item:hover {
    background: rgba(0,0,0,0.04);
}

.context3d-icon {
    margin-top: 2px;
    color: var(--mud-palette-primary, #005f9e);
    flex-shrink: 0;
}

.context3d-item-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.context3d-item-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.context3d-item-sub {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary, #666);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.context3d-snapshots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0;
}

.context3d-snapshot-item {
    width: 72px;
    height: 54px;
    border-radius: 4px;
    overflow: hidden;
    background: #f0f0f0;
}

.context3d-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.context3d-thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
}

/* ── ProtocolFileList ────────────────────────────────────────────────────── */

.protocol-files-empty {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
    font-size: 0.82rem;
    color: var(--mud-palette-text-disabled, #a0a0a0);
}

.protocol-files-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.protocol-file-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.82rem;
}

.protocol-file-item:hover {
    background: rgba(0,0,0,0.04);
}

.protocol-file-icon {
    color: var(--mud-palette-primary, #005f9e);
    flex-shrink: 0;
}

.protocol-file-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.protocol-file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.protocol-file-date {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary, #666);
}

.protocol-files-actions {
    padding: 4px 0 0 0;
}

/* ── Protocol Export actions ────────────────────────────────────────────── */

.protocol-export-actions {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.08);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── Protocol image thumbnail grid ─────────────────────────────────────────── */

.protocol-image-thumb {
    display: grid;
    grid-template-columns: repeat(3, 80px);
    gap: 8px;
    padding: 8px 0;
}

.protocol-image-thumb__item {
    position: relative;
    width: 80px;
    height: 80px;
}

.protocol-image-thumb__img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.protocol-image-thumb__placeholder {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    background: var(--mud-palette-background-grey, #f5f5f5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--mud-palette-text-secondary, #666);
    font-size: 1.5rem;
}

.protocol-image-thumb__delete {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.6rem;
    line-height: 1;
    padding: 0;
}

.protocol-image-thumb__delete:hover {
    background: rgba(220, 38, 38, 0.85);
}

/* Upload button shown inside Images tabs */
.v3d-image-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px dashed var(--mud-palette-primary, #594ae2);
    color: var(--mud-palette-primary, #594ae2);
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.v3d-image-upload-btn:hover {
    background: rgba(89, 74, 226, 0.06);
}

.v3d-context-images {
    padding: 8px;
}

/* ── DocSection two-level hierarchy ─────────────────────────────────────────── */

/* Outer card wrapping one DocSection and its subsections */
.protocol-doc-section {
    background: #fff;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 12px;
}

/* Header row: collapse toggle + title input + progress badge + actions */
.protocol-doc-section-header {
    display: flex;
    align-items: center;
    gap: var(--space-8, 8px);
    background: var(--color-surface-raised, #f4f6f8);
    padding: 6px 12px;
    border-radius: var(--radius-sm, 4px);
    margin-bottom: 8px;
}

/* H3-level title input; no border in default state */
.protocol-doc-section-title-input {
    flex: 1;
    min-width: 0;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    border-bottom: 1px solid transparent;
    background: transparent;
    padding: 2px 0;
}

.protocol-doc-section-title-input:focus {
    outline: none;
    border-bottom-color: #0068a8;
}

/* Small pill badge: "X/Y" subsection progress */
.protocol-doc-section-progress {
    display: inline-block;
    background: var(--color-surface-raised, #e8ecf0);
    font-size: 0.72rem;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
    color: var(--color-text-muted, #6b7280);
}

/* Minimal icon button for collapse toggle */
.protocol-section-collapse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--color-text-muted, #6b7280);
    border-radius: 4px;
    flex-shrink: 0;
    transition: background 0.12s;
}

.protocol-section-collapse-btn:hover {
    background: rgba(0, 0, 0, 0.07);
}

/* Visual left indent for subsections inside a DocSection */
.protocol-doc-section .protocol-subsection {
    margin-left: var(--space-8, 8px);
}

/* ── Participants & Location toolbar widgets ──────────────────────────────── */

/* Badge button (participant count) — styled like .protocol-due-date-badge */
.protocol-toolbar-participant-badge {
    background: #0068a8;
    color: #fff;
    border-color: #0068a8;
}

.protocol-toolbar-participant-badge:hover:not(:disabled) {
    background: #005a91;
    border-color: #005a91;
    color: #fff;
}

/* Location badge (already-set text) */
.protocol-location-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background: transparent;
    color: var(--color-text-secondary, #495057);
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.protocol-location-badge:hover {
    background: #f0f0f0;
}

/* Compact inline location text input */
.protocol-location-input {
    padding: 3px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #495057;
    width: 180px;
    flex-shrink: 0;
}

.protocol-location-input:focus {
    outline: none;
    border-color: #0068a8;
}

/* ── Participants modal ──────────────────────────────────────────────────── */

.protocol-participants-modal-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.protocol-participants-table {
    width: 100%;
    margin-bottom: 0;
}

.protocol-participants-divider {
    margin: 12px 0;
    border-color: #e9ecef;
}

.protocol-participants-section {
    margin-bottom: 8px;
}

.protocol-participants-section-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.protocol-participants-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.protocol-participants-search-results {
    max-height: 160px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.protocol-participants-search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.87rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.12s;
}

.protocol-participants-search-item:hover:not(.disabled) {
    background: #f4f6f8;
}

.protocol-participants-search-item.disabled {
    cursor: default;
    opacity: 0.7;
}

.protocol-participants-external-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.protocol-participants-remove-btn {
    padding: 2px 6px;
    font-size: 0.78rem;
    color: var(--color-danger, #dc3545);
    border-color: var(--color-danger, #dc3545);
}

.protocol-participants-remove-btn:hover:not(:disabled) {
    background: #fef2f2;
    border-color: #a71d2a;
    color: #a71d2a;
}

/* ── 3D Context tab narrowing ─────────────────────────────────────────── */
/* Reduce MudTab button width ~20% in the 3D Context card */
.context3d-card-body .mud-tab {
    min-width: 0;
    padding: 6px 10px;
}
