/* RWT-style PDF study tools, fitted to Radiology Resident's existing light theme. */
.rr-study-reader {
    --rr-study-accent: #0284c7;
    --rr-study-accent-soft: #e0f2fe;
    --rr-study-border: #dbe5ef;
    --rr-study-text: #1e293b;
    --rr-study-muted: #64748b;
    position: relative !important;
    border-radius: 16px !important;
    background: #f8fafc !important;
    border: 1px solid var(--rr-study-border) !important;
    box-shadow: 0 12px 34px rgba(15, 23, 42, .08);
    overflow: hidden !important;
}
.rr-study-reader .pdf-container {
    background: #edf2f7 !important;
    border-radius: 0 !important;
}
.rr-study-reader .pdf-page {
    background: white;
    box-shadow: 0 4px 24px rgba(15,23,42,.12);
}
.rr-study-reader .flipbook-controls {
    background: #fff !important;
    border-top: 1px solid var(--rr-study-border) !important;
    border-radius: 0 !important;
    color: var(--rr-study-text) !important;
}
.rr-study-reader .flipbook-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 9px;
}
.rr-study-reader .page-info, .rr-study-reader .zoom-display {
    color: var(--rr-study-text) !important;
}
.rr-study-reader .nav-btn, .rr-study-reader .zoom-btn {
    background: #f8fafc !important;
    color: #334155 !important;
    border: 1px solid var(--rr-study-border) !important;
    border-radius: 9px !important;
    box-shadow: none !important;
}
.rr-study-reader .nav-btn:hover:not(:disabled),
.rr-study-reader .zoom-btn:hover:not(:disabled) {
    background: var(--rr-study-accent-soft) !important;
    color: #0369a1 !important;
    border-color: #7dd3fc !important;
}
.rr-study-controls { display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:6px; }
.rr-study-controls button {
    border:1px solid var(--rr-study-border); background:#f8fafc; color:var(--rr-study-text);
    border-radius:9px; min-height:37px; padding:7px 10px; font:inherit; font-size:.78rem;
    display:inline-flex; align-items:center; gap:7px;
}
.rr-study-controls button { cursor:pointer; font-weight:600; }
.rr-study-controls button:hover:not(:disabled), .rr-study-controls button[aria-pressed="true"] {
    color:#0369a1; background:var(--rr-study-accent-soft); border-color:#7dd3fc;
}
.rr-study-controls button:disabled { opacity:.46; cursor:not-allowed; }
.rr-study-reader button:focus-visible, .rr-study-reader input:focus-visible,
.rr-study-reader select:focus-visible, .rr-study-reader textarea:focus-visible {
    outline:2px solid var(--rr-study-accent); outline-offset:2px;
}
.rr-study-canvas-wrap { position:relative !important; }
.rr-study-overlay { position:absolute; z-index:3; pointer-events:none; }
.rr-study-highlight { position:absolute; border:1px solid rgba(15,23,42,.35); border-radius:3px; opacity:.75; cursor:pointer; pointer-events:auto; mix-blend-mode:multiply; padding:0; }
.rr-study-highlight:hover { outline:2px solid #0284c7; outline-offset:2px; }
.rr-study-yellow { background:rgba(255,220,77,.57); }
.rr-study-blue { background:rgba(89,165,255,.48); }
.rr-study-green { background:rgba(105,215,154,.5); }
.rr-study-pink { background:rgba(247,129,189,.48); }
.rr-study-drawing .rr-study-overlay { cursor:crosshair; touch-action:none; pointer-events:auto; }
.rr-study-drawing .rr-study-highlight { pointer-events:none; }
.rr-study-preview { position:absolute; pointer-events:none; background:rgba(255,218,87,.43); border:2px dashed #c58000; }
.rr-study-draft { position:absolute; pointer-events:none; border:2px dashed #0369a1; border-radius:3px; opacity:.9; box-shadow:0 0 0 1px rgba(255,255,255,.75); }
.rr-study-panel {
    position:absolute; z-index:80; top:0; bottom:0; right:0;
    display:flex; flex-direction:column; width:min(390px,100%);
    background:#fff; color:var(--rr-study-text);
    border-left:1px solid var(--rr-study-border); box-shadow:-16px 0 42px rgba(15,23,42,.17);
}
.rr-study-panel[hidden], .rr-study-form[hidden], .rr-study-resume[hidden],
.rr-study-form [hidden] { display:none !important; }
.rr-study-panel-header { display:flex; align-items:center; justify-content:space-between; padding:15px 17px; border-bottom:1px solid var(--rr-study-border); gap:12px; }
.rr-study-panel-header strong { display:block; font-size:1rem; }
.rr-study-panel-header small { display:block; color:var(--rr-study-muted); font-size:.73rem; margin-top:3px; }
.rr-study-panel-header button { border:0; background:#f1f5f9; border-radius:8px; padding:9px 11px; cursor:pointer; color:var(--rr-study-text); }
.rr-study-panel-body { overflow-y:auto; overscroll-behavior:contain; min-height:0; flex:1; display:flex; flex-direction:column; padding:16px; gap:13px; }
.rr-study-resume-btn { width:100%; border:1px solid #bae6fd; border-radius:10px; background:var(--rr-study-accent-soft); color:#075985; padding:12px; text-align:left; font-weight:700; cursor:pointer; }
.rr-study-list { display:grid; gap:8px; }
.rr-study-empty { border-radius:10px; padding:15px; background:#f8fafc; border:1px solid var(--rr-study-border); color:var(--rr-study-muted); font-size:.84rem; line-height:1.5; }
.rr-study-row { display:flex; align-items:center; gap:4px; border:1px solid var(--rr-study-border); background:#f8fafc; border-radius:10px; padding:7px; }
.rr-study-row-main { display:flex; flex:1; align-items:flex-start; gap:9px; border:0; background:transparent; text-align:left; min-width:0; padding:7px; cursor:pointer; color:var(--rr-study-text); }
.rr-study-row-main i { color:var(--rr-study-accent); margin-top:4px; }
.rr-study-row-text { display:grid; min-width:0; overflow-wrap:anywhere; gap:3px; }
.rr-study-row-text strong { font-size:.8rem; }
.rr-study-row-text small { color:var(--rr-study-muted); font-size:.7rem; }
.rr-study-row-link { background:transparent; border:0; color:#0369a1; font-size:.7rem; font-weight:700; cursor:pointer; padding:7px 3px; }
.rr-study-delete { color:#be123c; }
.rr-study-form { display:grid; gap:11px; border:1px solid var(--rr-study-border); background:#f8fafc; border-radius:12px; padding:13px; }
.rr-study-form h3 { font-size:1rem; font-weight:700; margin:0; }
.rr-study-form-page { font-size:.76rem; color:var(--rr-study-muted); margin:0; }
.rr-study-form label { display:grid; gap:5px; font-size:.75rem; font-weight:600; }
.rr-study-form input, .rr-study-form textarea, .rr-study-form select { width:100%; border:1px solid #cbd5e1; background:#fff; color:var(--rr-study-text); border-radius:8px; padding:9px; font-size:.83rem; }
.rr-study-form-buttons { display:flex; justify-content:flex-end; gap:8px; }
.rr-study-form-buttons button { padding:8px 12px; border-radius:8px; border:1px solid var(--rr-study-border); cursor:pointer; font-weight:700; font-size:.8rem; background:#fff; color:var(--rr-study-text); }
.rr-study-form-buttons [type="submit"] { background:var(--rr-study-accent); border-color:var(--rr-study-accent); color:white; }
.rr-study-message { color:var(--rr-study-muted); font-size:.78rem; line-height:1.5; }
@media (max-width: 760px) {
    .rr-study-reader { border-radius:12px !important; }
    .rr-study-controls { width:100%; gap:5px; }
    .rr-study-controls button { flex:1; justify-content:center; font-size:.72rem; padding:7px 6px; }
    .rr-study-controls button span { display:none; }
    .rr-study-panel { width:100%; }
}

/* Native, selectable text above the rendered PDF. PDF.js positions each span. */
.rr-pdf-reader .rr-pdf-text-layer {
    position:absolute; z-index:2; transform-origin:0 0; overflow:hidden;
    line-height:1; text-align:initial; color:transparent; cursor:default;
    pointer-events:auto; margin:0; padding:0; border:0; max-width:none; max-height:none;
    -webkit-user-select:text !important; user-select:text !important;
    -webkit-touch-callout:default; text-size-adjust:none; -webkit-text-size-adjust:none;
}
.rr-pdf-reader .rr-pdf-text-layer :is(span,br) {
    position:absolute; color:transparent !important; white-space:pre;
    transform-origin:0 0; cursor:text; -webkit-user-select:text !important; user-select:text !important;
    line-height:1; margin:0; padding:0; border:0; letter-spacing:normal; word-spacing:normal;
    text-transform:none; font-weight:normal; font-style:normal; text-indent:0;
}
/* Keep the complete PDF text surface interactive for native drag selection. */
.rr-pdf-reader .rr-pdf-text-layer span:not(.markedContent):not(:empty) {pointer-events:auto;}
 .rr-pdf-reader .rr-pdf-text-layer span.markedContent {top:0;height:0;}
.rr-pdf-reader .rr-pdf-text-layer ::selection {background:rgba(0,82,255,.24);color:transparent;}
.rr-pdf-reader .rr-pdf-text-layer br::selection {background:transparent;}
.rr-study-reader .rr-study-highlight.rr-study-text-mark {
    pointer-events:none; border:0; border-radius:2px; opacity:1;
}
.rr-study-reader:has(.rr-pdf-text-layer):not(.rr-study-drawing) .rr-study-highlight {pointer-events:none;}
 .rr-study-reader.rr-study-drawing .rr-pdf-text-layer,
.rr-study-reader.rr-study-drawing .rr-pdf-text-layer * {pointer-events:none !important;}
.rr-study-reader .rr-text-palette {
    position:absolute;z-index:85;display:flex;align-items:center;gap:8px;
    padding:8px 10px;max-width:calc(100% - 16px);border:1px solid #d1d5db;
    border-radius:12px;background:white;box-shadow:0 6px 24px rgba(15,23,42,.2);
    color:#334155;flex-wrap:wrap;font:600 .78rem 'DM Sans',sans-serif;
}
.rr-study-reader .rr-text-palette[hidden] {display:none !important;}
.rr-text-palette button {width:30px;height:30px;min-width:30px;border-radius:50%;border:1px solid #94a3b8;cursor:pointer;}
.rr-text-palette button[data-color=yellow] {background:#ffe066;}
.rr-text-palette button[data-color=blue] {background:#93c5fd;}
.rr-text-palette button[data-color=green] {background:#86efac;}
.rr-text-palette button[data-color=pink] {background:#f9a8d4;}
.rr-text-palette button:disabled {opacity:.5;cursor:wait;}
.rr-text-palette .rr-text-close {background:#f1f5f9;color:#334155;border-radius:8px;}
.rr-text-palette .rr-text-status {flex-basis:100%;font-weight:400;}
@media(max-width:760px) {
    .rr-study-reader .rr-text-palette {left:8px !important;right:8px;top:auto !important;bottom:76px;justify-content:center;}
    .rr-text-palette button {width:40px;height:40px;}
}

/* Compact icon-only study actions, matching the navigation controls. */
.rr-study-controls button.rr-study-icon-btn {
    box-sizing: border-box;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    padding: 0;
    justify-content: center;
}
.rr-study-controls button.rr-study-icon-btn i { margin: 0; font-size: .9rem; }
@media (max-width: 760px) {
    .rr-study-controls button.rr-study-icon-btn { flex-basis: 44px; width: 44px; height: 44px; }
}

/* Optional personal notebook. The reader remains unchanged while collapsed. */
.rr-study-controls button[data-rr-action="notes"][aria-expanded="true"] {
    background:var(--rr-study-accent-soft);border-color:#7dd3fc;color:#0369a1;
}
.rr-study-reader .rr-page-notes {
    position:absolute;inset:0 0 0 auto;z-index:79;display:flex;flex-direction:column;
    width:min(340px,100%);min-width:0;min-height:0;overflow:hidden;
    background:#fff;color:var(--rr-study-text);border-left:1px solid var(--rr-study-border);
    font-family:'DM Sans',Arial,sans-serif;box-shadow:-12px 0 32px rgba(15,23,42,.12);
}
.rr-study-reader .rr-page-notes[hidden] {display:none!important;}
.rr-pdf-reader.rr-notes-open.rr-notes-wide,
.rr-pdf-reader.rr-notes-open.rr-notes-wide:fullscreen {
    display:grid!important;grid-template-columns:minmax(0,1fr) minmax(260px,30%);
    grid-template-rows:minmax(0,1fr) auto;gap:0;
}
.rr-notes-open.rr-notes-wide > .pdf-container {grid-column:1;grid-row:1;min-width:0;}
.rr-notes-open.rr-notes-wide > .flipbook-controls {grid-column:1 / -1;grid-row:2;}
.rr-study-reader.rr-notes-open.rr-notes-wide > .rr-page-notes {
    grid-column:2;grid-row:1;position:relative;inset:auto;width:100%;box-shadow:none;z-index:4;
}
.rr-page-notes-header {display:flex;gap:10px;align-items:flex-start;padding:15px;border-bottom:1px solid var(--rr-study-border);}
.rr-page-notes-header > div:nth-child(2) {flex:1;min-width:0;}
.rr-page-notes-icon {display:grid;place-items:center;flex:0 0 34px;height:34px;border-radius:9px;background:#e8efff;color:#0052ff;}
.rr-page-notes-header strong {display:block;font-size:1rem;font-weight:700;}
.rr-page-notes-header small {display:block;font-size:.78rem;color:var(--rr-study-muted);line-height:1.45;margin-top:3px;}
.rr-page-notes-header button {background:#f1f5f9;border:0;border-radius:7px;width:30px;height:30px;cursor:pointer;}
.rr-page-notes-privacy {padding:10px 14px;margin:0;background:#f8fafc;border-bottom:1px solid var(--rr-study-border);font-size:.76rem;line-height:1.45;color:#475569;}
.rr-page-notes-body {padding:14px;flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;}
.rr-page-notes-heading {display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:10px;font-size:.8rem;font-weight:600;}
.rr-page-notes-heading b {color:#0052ff;background:#e8efff;border-radius:4px;padding:2px 5px;}
.rr-page-notes-heading [data-note-status] {font-size:.69rem;font-weight:400;color:var(--rr-study-muted);text-align:right;}
.rr-page-notes-heading [data-note-status].is-error {color:#b91c1c;}
.rr-page-notes textarea {display:block;width:100%;box-sizing:border-box;min-height:170px;max-height:50vh;resize:vertical;padding:11px;border:1px solid var(--rr-study-border);border-radius:9px;background:#f8fafc;color:#1e293b;font:400 .9rem/1.6 'DM Sans',Arial,sans-serif;user-select:text!important;-webkit-user-select:text!important;-webkit-touch-callout:default;}
.rr-page-notes-actions {display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:12px 0;}
.rr-page-notes-actions button {background:#f8fafc;border:1px solid var(--rr-study-border);border-radius:7px;padding:6px 9px;font-size:.77rem;cursor:pointer;}
.rr-page-notes-actions button[hidden] {display:none;}
.rr-page-notes-actions button:disabled {opacity:.45;cursor:not-allowed;}
.rr-page-notes-actions [data-note-action="clear"] {margin-left:auto;}
.rr-page-notes-index {border-top:1px solid var(--rr-study-border);padding-top:12px;}
.rr-page-notes-index > strong {font-size:.82rem;}
.rr-page-notes-empty {font-size:.8rem;color:var(--rr-study-muted);padding:9px 0;}
.rr-page-note-link {display:grid;gap:3px;width:100%;text-align:left;border:1px solid var(--rr-study-border);background:#f8fafc;border-radius:7px;padding:9px;margin-top:7px;cursor:pointer;overflow-wrap:anywhere;}
.rr-page-note-link[aria-current="page"] {border-color:#93c5fd;background:#eff6ff;}
.rr-page-note-link strong {font-size:.8rem;color:#0052ff;}
.rr-page-note-link small {font-size:.72rem;color:#475569;}
.rr-page-notes footer {padding:10px 14px;font-size:.69rem;color:var(--rr-study-muted);border-top:1px solid var(--rr-study-border);}
@media(max-width:760px){.rr-study-reader .rr-page-notes{width:100%;}.rr-page-notes textarea{font-size:16px;}}
