/* ===================== Protocol Color Variables ===================== */
:root {
    --protocol-blue: #4a90d9;
    --protocol-blue-light: #8bb8e0;
    --protocol-blue-bg: #eef5fc;
    --protocol-blue-text: #3a6fa0;
    --protocol-blue-dark: #2a6db5;
    --protocol-green: #6aaa5e;
    --protocol-green-light: #d4e8d0;
    --protocol-green-bg: #eaf3e8;
    --protocol-green-text: #3a7a32;
    --protocol-library-bg: #e8eff6;
    --protocol-library-header: #a3b8ce;
    --protocol-library-heading: #6b89a3;
    --protocol-library-hover: #d4e0ed;
    --protocol-library-empty: #7e9ab5;
    --protocol-library-header-text: #2a3f52;
    --protocol-editor-border: #b5ad9a;
    --protocol-textarea-bg: #FAFAF6;
    --protocol-add-btn-bg: #EDE8E0;
    --protocol-tag-bg: #555;
}

[data-theme="dark"] {
    --protocol-blue: #5A9DE0;
    --protocol-blue-light: #4A7AAA;
    --protocol-blue-bg: #1A2A3A;
    --protocol-blue-text: #7AB0E0;
    --protocol-blue-dark: #5A9DE0;
    --protocol-green: #5A9A4E;
    --protocol-green-light: #2A3A28;
    --protocol-green-bg: #1A2A1A;
    --protocol-green-text: #6ABB5A;
    --protocol-library-bg: #1E2430;
    --protocol-library-header: #3A4A5A;
    --protocol-library-heading: #8A9AB0;
    --protocol-library-hover: #2A3442;
    --protocol-library-empty: #6A7A8A;
    --protocol-library-header-text: #B0C0D0;
    --protocol-editor-border: #4A4438;
    --protocol-textarea-bg: var(--bg-white);
    --protocol-add-btn-bg: var(--bg-surface);
    --protocol-tag-bg: #4A4A4A;
}

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

/* Protocol list modal */
.modal-content.protocol-modal-content {
    position: relative;
    width: 560px;
    max-width: 95vw;
    border: 2px solid var(--primary-color);
    text-align: left;
    display: flex;
    flex-direction: column;
    max-height: 80vh;
    padding-top:18px;
}

.protocol-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 60px;
}

.protocol-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.15s;
    gap: 10px;
}

.protocol-list-item:hover { background: var(--bg-color); }

.protocol-list-item-title {
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.92em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.protocol-list-item-meta {
    font-size: 0.78em;
    color: var(--text-muted);
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.protocol-tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    background: var(--bg-color);
    color: var(--text-muted);
    font-size: 0.82em;
}

/* Protocol editor page */
.protocol-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-white);
    min-height: 0;
}

.protocol-editor-header-wrap {
    border-bottom: 2px solid var(--protocol-editor-border);
    flex-shrink: 0;
    background: var(--border-color);
}

.protocol-editor-header {
    padding: 5px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

.protocol-title-input {
    border: 2px solid var(--protocol-editor-border);
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text-color);
    background: var(--bg-white);
    flex: 1;
    outline: none;
    font-family: var(--font-main);
    min-width: 0;
    padding: 4px 8px;
    border-radius: 6px;
    transition: border-color 0.15s;
}
.protocol-title-input:focus { border-color: var(--primary-color); }
.protocol-title-input::placeholder { color: var(--text-light); }

.protocol-editor-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.protocol-affiliation-cb {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8em;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.protocol-affiliation-cb input[type="checkbox"] {
    accent-color: var(--primary-color);
    margin: 0;
}

.protocol-btn-like {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: opacity 0.15s;
}
.protocol-btn-like:hover {
    opacity: 0.7;
}
.protocol-btn-save {
    padding: 7px 20px;
    min-width: 120px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-main);
    transition: opacity 0.15s;
    text-align: center;
    white-space: nowrap;
}
.protocol-btn-save:hover { opacity: 0.85; }
@keyframes protocol-save-bounce {
    0%, 100% { transform: scale(1); }
    30% { transform: scale(1.12); }
    60% { transform: scale(0.95); }
    80% { transform: scale(1.04); }
}

.protocol-btn-close {
    background: var(--protocol-blue);
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    padding: 6px 16px;
    text-decoration: none;
    white-space: nowrap;
}

.protocol-editor-header .share-toggle-slider {
    border: 2px solid var(--protocol-editor-border);
    box-sizing: border-box;
}
.protocol-editor-header .share-toggle-slider::before {
    bottom: 1px;
    left: 1px;
}
.protocol-editor-header .share-toggle input:checked + .share-toggle-slider {
    border-color: var(--primary-color);
}

.protocol-editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    background: var(--bg-white);
}

.protocol-editor-body-inner {
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    position: relative;
}
.protocol-editor-body-inner.protocol-converting textarea,
.protocol-editor-body-inner.protocol-converting input,
.protocol-editor-body-inner.protocol-converting button,
.protocol-editor-body-inner.protocol-converting .protocol-step,
.protocol-editor-body-inner.protocol-converting .protocol-tags-container {
    pointer-events: none;
    opacity: 0.45;
}
.protocol-editor-body-inner.protocol-converting #protocol-import-loading {
    pointer-events: auto;
    opacity: 1;
}

.protocol-section {
    margin-bottom: 12px;
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.protocol-section-label {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 25px;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin: 0;
    white-space: nowrap;
    z-index: 1;
}

.protocol-section-content {
    min-width: 0;
    padding: 12px 14px;
    padding-left: 39px;
    border-left: 2px solid var(--border-color);
    margin-left: 25px;
    background: var(--bg-color);
}

.protocol-section-flat {
    margin-bottom: 12px;
    padding: 12px 14px;
    background: var(--bg-color);
    border-radius: 10px;
    border: 2px solid var(--border-color);
}

.protocol-section-keywords {
    padding: 6px 6px 4px 6px;
}

.protocol-section-green {
    border-color: var(--protocol-green);
}
.protocol-section-green .protocol-section-label {
    background: var(--protocol-green-light);
    color: var(--protocol-green-text);
}
.protocol-section-green .protocol-section-content {
    background: var(--protocol-green-bg);
    border-left-color: var(--protocol-green);
}
.protocol-section-green .protocol-table th {
    color: var(--protocol-green-text);
}
.protocol-section-green .protocol-table th {
    border-bottom-color: var(--protocol-green);
}
.protocol-section-green .protocol-table td input {
    border-color: var(--protocol-green);
}
.protocol-section-green .protocol-table td input:focus {
    border-color: var(--protocol-green-text);
}
.protocol-section-green .protocol-remove-btn {
    color: var(--protocol-green);
}
.protocol-section-green .protocol-remove-btn:hover {
    color: var(--protocol-green-text);
}
.protocol-section-green .protocol-add-btn {
    background: var(--protocol-green-light);
    border-color: var(--protocol-green);
    color: var(--protocol-green-text);
}
.protocol-section-green .protocol-add-btn:hover {
    border-color: var(--protocol-green-text);
    color: var(--protocol-green-text);
}


.protocol-section textarea,
.protocol-section-flat textarea {
    width: 100%;
    min-height: 60px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 0.9em;
    resize: vertical;
    box-sizing: border-box;
    color: var(--text-color);
    background: var(--protocol-textarea-bg);
    line-height: 1.5;
}
.protocol-section textarea:focus,
.protocol-section-flat textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Protocol tables */
.protocol-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.protocol-table th {
    text-align: left;
    font-size: 0.78em;
    font-weight: 600;
    color: var(--text-muted);
    padding: 6px 8px;
    border-bottom: 2px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.protocol-table td {
    padding: 3px 4px;
    border-bottom: none;
}

.protocol-table td input {
    width: 100%;
    border: 1px solid var(--border-color);
    padding: 6px 8px;
    font-family: var(--font-main);
    font-size: 0.92em;
    background: var(--bg-white);
    outline: none;
    color: var(--text-color);
    border-radius: 4px;
    box-sizing: border-box;
    margin: 0;
}
.protocol-table td input:focus { border-color: var(--primary-color); }

/* Numbered steps */
.protocol-steps { counter-reset: step; }

.protocol-step {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
    cursor: default;
}
.protocol-step-drag {
    cursor: grab;
    color: var(--protocol-green);
    padding-top: 5px;
    font-size: 1em;
    user-select: none;
    flex-shrink: 0;
    order: -1;
    letter-spacing: 2px;
}
.protocol-step-drag:hover {
    color: var(--protocol-green-text);
}
.protocol-step-ghost {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.85;
    box-shadow: 0 4px 16px var(--shadow-color);
    background: var(--bg-white);
    border-radius: 6px;
}
.protocol-step-placeholder {
    border: 2px dashed var(--border-color) !important;
    border-radius: 6px;
    background: rgba(69,184,133,0.06) !important;
}
.protocol-step-placeholder textarea,
.protocol-step-placeholder .protocol-step-drag,
.protocol-step-placeholder .protocol-remove-btn { visibility: hidden; }
.protocol-step-insert-indicator {
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    margin: -1px 0;
    position: relative;
    z-index: 1;
}

.protocol-step::before {
    counter-increment: step;
    content: counter(step) ".";
    font-weight: 700;
    color: var(--text-muted);
    min-width: 18px;
    padding-top: 8px;
    font-size: 0.9em;
    text-align: right;
}

.protocol-step textarea {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 32px;
    min-height: 0;
    padding: 6px 10px;
    overflow: hidden;
    line-height: 1.4;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-family: var(--font-main);
    font-size: 0.9em;
    resize: none;
    overflow: hidden;
    line-height: 1.5;
    color: var(--text-color);
    box-sizing: border-box;
    margin: 0;
}
.protocol-step textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}


/* Tags */

.protocol-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    flex: 1;
}

.protocol-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 14px;
    background: var(--protocol-tag-bg);
    color: #f5f5f5;
    font-size: 0.72em;
    font-weight: 500;
    white-space: nowrap;
}

.protocol-tag-chip button {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.1em;
    padding: 0 2px;
    line-height: 1;
}
.protocol-tag-chip button:hover { color: var(--danger-color); }

.protocol-tag-input {
    border: 1px dashed var(--border-color);
    border-radius: 14px;
    padding: 4px 8px;
    font-size: 0.85em;
    font-family: var(--font-main);
    width: 110px;
    outline: none;
    color: var(--text-color);
    box-sizing: border-box;
    margin: 0;
}
.protocol-tag-input:focus { border-color: var(--primary-color); }


/* Add / remove buttons */
.protocol-add-btn {
    background: var(--protocol-add-btn-bg);
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 0.84em;
    color: var(--text-muted);
    cursor: pointer;
    font-family: var(--font-main);
    margin-top: 6px;
    transition: border-color 0.15s, color 0.15s;
    width: 100%;
    box-sizing: border-box;
}
.protocol-add-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }

.protocol-remove-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.2em;
    padding: 2px 6px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s;
    flex-shrink: 0;
    width: auto;
}
.protocol-remove-btn:hover { color: var(--danger-color); }

/* Protocol AI Import */
.protocol-import-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 14px;
    border: 2px dashed var(--protocol-blue-light);
    border-radius: 10px;
    background: var(--protocol-blue-bg);
    color: var(--protocol-blue-text);
    font-size: 0.9em;
}
.protocol-import-text {
    flex: 1;
}
.protocol-import-btn {
    padding: 6px 16px;
    background: var(--protocol-blue);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-main);
    white-space: nowrap;
    width: auto;
}
.protocol-import-btn:hover {
    opacity: 0.85;
}
.protocol-import-loading {
    border-style: solid;
    border-color: var(--protocol-blue);
    background: var(--protocol-blue-bg);
    color: var(--protocol-blue-dark);
    font-weight: 600;
    box-shadow: 0 4px 12px var(--shadow-color);
    position: relative;
    z-index: 20;
}
.protocol-import-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--protocol-blue-light);
    border-top-color: var(--protocol-blue-dark);
    border-radius: 50%;
    animation: protocol-spin 0.8s linear infinite;
    flex-shrink: 0;
}
@keyframes protocol-spin {
    to { transform: rotate(360deg); }
}
.protocol-import-success {
    border-style: solid;
    border-color: var(--protocol-blue);
    background: var(--protocol-blue-bg);
    color: var(--protocol-blue-dark);
}
.protocol-import-error {
    border-style: solid;
    border-color: var(--danger-color);
    background: var(--bg-light);
    color: var(--danger-color);
}
.protocol-overlay {
    position: absolute;
    inset: 0;
    background: rgba(128,128,128,0.3);
    z-index: 10;
    pointer-events: none;
}

/* Protocol search overlay */
.protocol-search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
}
.protocol-search-box {
    width: 560px;
    max-width: 92vw;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--shadow-color);
    overflow: hidden;
}
.protocol-search-input {
    width: 100%;
    padding: 14px 18px;
    border: none;
    border-bottom: 1px solid var(--border-color);
    font-size: 1em;
    font-family: var(--font-main);
    outline: none;
    box-sizing: border-box;
}
.protocol-search-results {
    max-height: 50vh;
    overflow-y: auto;
}
.protocol-search-section {
    padding: 0;
}
.protocol-search-heading {
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 10px 18px 4px;
    margin: 0;
}
.protocol-search-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.protocol-search-item {
    padding: 10px 18px;
    cursor: pointer;
    transition: background 0.1s;
}
.protocol-search-item:hover {
    background: var(--bg-color);
}
.protocol-search-item-title {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.protocol-search-item-meta {
    font-size: 0.78em;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.protocol-search-empty {
    padding: 8px 18px;
    font-size: 0.82em;
    color: var(--text-light);
    font-style: italic;
}

/* --- Protocol Management View --- */
.pm-container {
    display: flex;
    flex: 1;
    min-height: 0;
    height: calc(100vh - 45px);
    overflow: hidden;
}
.pm-col {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--border-color);
}
.pm-col:last-child { border-right: none; }
.pm-col-library { width: 25%; min-width: 220px; background: var(--protocol-library-bg); }
.pm-col-search { width: 25%; min-width: 220px; background: var(--bg-white); }
.pm-col-preview { width: 50%; background: var(--bg-white); }

.pm-col-header {
    padding: 14px 18px 10px;
    border-bottom: 1px solid var(--border-color);
}
.pm-col-library .pm-col-header {
    background: var(--protocol-library-header);
    border-bottom-color: var(--protocol-library-header);
    color: #fff;
}
.pm-col-library .pm-col-header h3 {
    color: var(--protocol-library-header-text);
}
.pm-col-header h3 {
    margin: 0;
    font-size: 0.95em;
    font-weight: 700;
    color: var(--text-color);
}

/* Search column */
.pm-search-field-wrap {
    margin: 14px 14px 0;
}
.pm-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px dashed var(--protocol-blue-light);
    border-radius: 8px;
    font-size: 0.92em;
    font-family: var(--font-main);
    outline: none;
    box-sizing: border-box;
    background: var(--protocol-blue-bg);
    color: var(--protocol-blue-text);
}
.pm-search-input::placeholder {
    color: var(--protocol-blue-light);
}
.pm-search-input:focus {
    border-style: solid;
    border-color: var(--protocol-blue);
    background: var(--protocol-blue-bg);
}
#pm-liked-only {
    width:15px;
    margin:0;
}
.pm-liked-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 0 8px 18px;
    font-size: 0.8em;
    color: var(--protocol-blue-text);
    cursor: pointer;
    user-select: none;
}
.pm-liked-filter input[type="checkbox"] {
    accent-color: var(--protocol-blue);
}
.pm-search-results {
    flex: 1;
    overflow-y: auto;
}
.pm-search-section { padding: 0; }
.pm-search-heading {
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 10px 18px 0px;
    margin: 0;
}
.pm-search-list { list-style: none; padding: 0; margin: 0; }
.pm-search-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 18px 10px;
    cursor: pointer;
    transition: background 0.1s;
}
.pm-search-item:hover { background: var(--bg-color); }
.pm-search-item-content { flex: 1; min-width: 0; }
.pm-search-save-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-white);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    visibility: hidden;
}
.pm-search-save-btn svg { width: 22px; height: 22px; }
.pm-search-item:hover .pm-search-save-btn { visibility: visible; }
.pm-search-save-btn:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
.pm-search-item-title {
    font-weight: 600;
    font-size: 0.88em;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pm-search-liked {
    color: var(--secondary-color);
    margin-right: 4px;
    font-size: 0.85em;
}
.pm-search-item-meta {
    font-size: 0.76em;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pm-search-empty {
    padding: 8px 18px;
    font-size: 0.82em;
    color: var(--text-light);
    font-style: italic;
    list-style: none;
}

/* Preview column */
.pm-preview-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    gap: 12px;
}
.pm-preview-empty p {
    margin: 0;
    font-size: 0.9em;
}
#pm-preview-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.pm-preview-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}
.pm-preview-title-area { flex: 1; min-width: 0; }
.pm-preview-title-area h2 {
    margin: 0;
    font-size: 1.1em;
    font-weight: 700;
    color: var(--text-color);
    word-wrap: break-word;
}
.pm-preview-meta {
    display: flex;
    gap: 10px;
    margin-top: 4px;
    font-size: 0.78em;
    color: var(--text-muted);
}
.pm-preview-toolbar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.pm-toolbar-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-white);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.pm-toolbar-btn:hover {
    background: var(--bg-color);
    color: var(--text-color);
    border-color: var(--text-muted);
}
.pm-preview-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 24px;
    color: var(--text-muted);
}
.pm-preview-body h4 {
    margin: 1.2em 0 0.4em;
    font-size: 0.9em;
    font-weight: 700;
    color: var(--text-color);
}
.pm-preview-body p {
    margin: 0.4em 0;
    font-size: 0.88em;
    line-height: 1.5;
}
.pm-preview-body table {
    border-collapse: collapse;
    width: 100%;
    margin: 8px 0;
    font-size: 0.85em;
}
.pm-preview-body th,
.pm-preview-body td {
    border: 1px solid var(--border-color);
    padding: 6px 10px;
    text-align: left;
}
.pm-preview-body th {
    background: var(--bg-color);
    font-weight: 600;
    font-size: 0.88em;
}
.pm-preview-body ol,
.pm-preview-body ul {
    padding-left: 1.5em;
    margin: 6px 0;
}
.pm-preview-body li {
    margin-bottom: 4px;
    font-size: 0.88em;
    line-height: 1.5;
}

/* Library column */
.pm-create-btn {
    display: block;
    width: calc(100% - 36px);
    margin: 14px 18px;
    padding: 10px;
    background: var(--link-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.88em;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-main);
    transition: opacity 0.15s;
}
.pm-create-btn:hover { opacity: 0.9; }
.pm-library-section { padding: 0; }
.pm-library-heading {
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--protocol-library-heading);
    padding: 10px 18px 4px;
    margin: 0;
}
.pm-library-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
}
.pm-library-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 8px 10px 8px 18px;
    cursor: pointer;
    transition: background 0.1s;
    gap: 8px;
}
.pm-library-item:hover { background: var(--protocol-library-hover); }
.pm-library-item-info {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}
.pm-library-item-title {
    font-weight: 600;
    font-size: 0.86em;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pm-library-item-meta {
    font-size: 0.74em;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pm-library-action-btns {
    display: flex;
    flex-shrink: 0;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.15s;
}
.pm-library-item:hover .pm-library-action-btns { opacity: 1; }
.pm-library-action-btn {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    padding: 0;
    line-height: 1;
    margin-top: -1px;
}
.pm-library-edit-btn:hover { color: var(--primary-color); }
.pm-library-delete-btn:hover { color: var(--danger-color); }
.pm-library-empty {
    padding: 12px 18px;
    font-size: 0.82em;
    color: var(--protocol-library-empty);
    text-align: center;
    text-transform: uppercase;
    font-style: italic;
    list-style: none;
}

/* Toast */
.pm-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--toast-bg);
    color: #fff;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 0.88em;
    font-family: var(--font-main);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 9000;
}
.pm-toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Print styles for protocol management */
@media print {
    .pm-col-search,
    .pm-col-library,
    .pm-preview-toolbar,
    .navbar { display: none !important; }
    .pm-container { height: auto; }
    .pm-col-preview {
        width: 100% !important;
        border: none !important;
    }
    .pm-preview-body { overflow: visible; }
