/* MedProtocol -- base styles (expanded in Phase 2+) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Figtree:wght@600;700&display=swap');

/* Design system tokens — single source of truth.
   Primary palette: clinical cyan per PROJECT.md (Accessible & Ethical + Minimalism). */
:root {
    --color-primary:        #0891B2;
    --color-primary-hover:  #0E7490;
    --color-primary-active: #155E75;
    --color-primary-tint:   #67E8F9;
    --color-primary-shadow: rgba(8, 145, 178, 0.35);
    --color-primary-ring:   rgba(8, 145, 178, 0.18);

    --color-accent:  #059669;
    --color-danger:  #DC2626;
    --color-text:        #111827;
    --color-text-muted:  #6b7280;
    --color-border:      #e5e7eb;
    --color-bg:          #f9fafb;
    --color-bg-card:     #ffffff;
    --color-bg-zebra:    #fafbfc;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: #111827;
    background: #f9fafb;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: contain;
}

/* ── Skip link (a11y: keyboard bypass for sidebar nav) ── */
.skip-link {
    position: absolute;
    top: -999px;
    left: 0;
    background: #0891B2;
    color: #fff;
    padding: 8px 16px;
    border-radius: 0 0 8px 0;
    z-index: 9999;
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
}
.skip-link:focus { top: 0; }

/* ── App shell layout ── */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: 300px;
    flex-shrink: 0;
    background: #111827;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: 20;
    transition: transform 220ms ease, box-shadow 220ms ease;
}

.sidebar-top {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 10px 0 0;
}

.sidebar-header {
    padding: 8px 12px;
    margin: 0 4px 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    width: calc(100% - 8px);
    text-align: left;
    font-family: inherit;
    transition: background 150ms ease;
}
.sidebar-header:hover { background: rgba(255, 255, 255, 0.06); }
.sidebar-header:focus-visible { outline: 2px solid #67E8F9; outline-offset: 1px; }

.sidebar-brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: linear-gradient(135deg, #0891B2, #0E7490);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(8, 145, 178, 0.4);
}

.sidebar-brand {
    font-family: 'Figtree', -apple-system, sans-serif;
    font-size: 19px;
    font-weight: 700;
    color: #f5f5f4;
    letter-spacing: -0.02em;
}

.new-session-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: calc(100% - 16px);
    margin: 6px 8px 12px;
    padding: 16px 18px;
    background: #0891B2;
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 150ms ease, box-shadow 150ms ease, transform 100ms ease;
    box-shadow: 0 2px 8px rgba(8, 145, 178, 0.3);
}

.new-session-btn:hover {
    background: #0E7490;
    box-shadow: 0 4px 14px rgba(8, 145, 178, 0.4);
}

.new-session-btn:active {
    transform: scale(0.98);
}

.new-session-btn svg {
    width: 20px;
    height: 20px;
}
.new-session-btn:focus-visible { outline: 2px solid #67E8F9; outline-offset: 1px; }
.session-item-btn:focus-visible { outline: 2px solid #67E8F9; outline-offset: -2px; border-radius: 6px; }

.sidebar-section-label {
    padding: 6px 14px 4px;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.session-list {
    flex: 1;
    overflow-y: auto;
    list-style: none;
    padding: 2px 8px;
    margin: 0;
}

.session-list::-webkit-scrollbar { width: 4px; }
.session-list::-webkit-scrollbar-track { background: transparent; }
.session-list::-webkit-scrollbar-thumb { background: #374151; border-radius: 2px; }

.session-item {
    display: flex;
    align-items: center;
    border-radius: 8px;
    margin-bottom: 1px;
    position: relative;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: background 120ms ease;
}

.session-item:hover { background: #1f2937; }
.session-item.active {
    background: #1f2937;
    border-left-color: #67E8F9;
}

.session-item-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 8px 10px;
    min-height: 44px;
    text-align: left;
    cursor: pointer;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.session-item-name {
    display: block;
    font-size: 14px;
    color: #d6d3d1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    flex: 1;
    min-width: 0;
}

.session-item.active .session-item-name { color: #f5f5f4; }

.session-protocol-badge {
    flex-shrink: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22D3EE;
    box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.18);
    display: inline-block;
}

.session-item-menu-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #9ca3af;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    opacity: 0;
    transition: opacity 100ms ease, background 100ms ease;
    margin-right: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (hover: none) {
    .session-item-menu-btn { opacity: 1; width: 44px; height: 44px; }
}

.session-item:hover .session-item-menu-btn,
.session-item.menu-open .session-item-menu-btn { opacity: 1; }

.session-item-menu-btn:hover { background: #374151; color: #d6d3d1; }
.session-item-menu-btn:focus-visible { outline: 2px solid #67E8F9; outline-offset: 1px; opacity: 1; }

.session-rename-input {
    width: 100%;
    background: #1f2937;
    border: 1px solid #4b5563;
    border-radius: 4px;
    color: #f5f5f4;
    font-size: 13px;
    padding: 2px 6px;
    outline: none;
    font-family: inherit;
}


.sidebar-footer {
    padding: 8px;
    border-top: 1px solid #1f2937;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background 150ms ease;
}

.sidebar-user { cursor: default; }

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #d6d3d1;
}

.user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.user-name {
    font-size: 14px;
    font-weight: 500;
    color: #d6d3d1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.user-role {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.settings-btn {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #9ca3af;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 150ms ease, background 150ms ease;
}

.settings-btn:hover { color: #d6d3d1; background: #1f2937; }
.settings-btn:focus-visible { outline: 2px solid #67E8F9; outline-offset: 1px; }

/* ── Session context menu ── */
.session-menu {
    position: fixed;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 4px;
    min-width: 160px;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.session-menu-item {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: 4px;
    text-align: left;
    font-size: 13px;
    color: #d6d3d1;
    cursor: pointer;
    font-family: inherit;
    transition: background 100ms ease;
}

.session-menu-item:hover { background: #374151; }
.session-menu-item-danger { color: #f87171; }
.session-menu-item-danger:hover { background: #450a0a; }

/* ── Main content area ── */
.main-content {
    margin-left: 300px;
    flex: 1;
    min-height: 100vh;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom);
    background: #f9fafb;
    display: flex;
    flex-direction: column;
}

#app {
    padding: 2rem;
    flex: 1;
}

/* ── Session page header ── */
.session-header {
    padding: 20px 2rem 16px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.session-header-name {
    font-family: 'Figtree', -apple-system, sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.session-header-role {
    font-size: 13px;
    color: #6b7280;
    margin-top: 3px;
    font-weight: 400;
}

/* Recording card */
.recording-card {
    background: #FFFFFF;
    border: 1px solid #e5e7eb;
    border-top: 3px solid #0891B2;
    border-radius: 16px;
    padding: 32px;
    max-width: 660px;
    width: 100%;
    margin: 32px auto 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 8px 32px rgba(0,0,0,0.04);
    animation: cardFadeIn 300ms ease-out;
}

.recording-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: #0891B2;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
    box-shadow: 0 4px 14px rgba(8, 145, 178, 0.15);
}

@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .recording-card { animation: none; }
}

.card-heading {
    font-family: 'Figtree', -apple-system, sans-serif;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    color: #0f172a;
    margin-bottom: 24px;
}

/* Mode selector */
.mode-selector {
    border: none;
    padding: 0;
    margin-bottom: 28px;
}

.mode-selector legend {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.mode-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 400;
    line-height: 1.5;
    color: #374151;
    margin-bottom: 8px;
    background: #fafafa;
    transition: border-color 200ms ease, background-color 200ms ease, box-shadow 200ms ease;
}

.mode-option:hover {
    border-color: #67E8F9;
    background: #ecfeff;
}

.mode-option:has(input:checked) {
    border-color: #0891B2;
    background: #eef2ff;
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.08);
    color: #155E75;
    font-weight: 500;
}

.mode-option input[type="radio"] {
    accent-color: #0891B2;
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    margin: 0;
}

/* Buttons */
.btn {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 150ms ease, box-shadow 150ms ease, transform 100ms ease;
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

.btn:focus-visible {
    outline: 3px solid #0891B2;
    outline-offset: 2px;
}

.btn-primary {
    background: #0891B2;
    color: #FFFFFF;
}

.btn-primary:hover {
    background: #0E7490;
    box-shadow: 0 4px 14px rgba(8, 145, 178, 0.35);
}

.btn-danger {
    background: #DC2626;
    color: #FFFFFF;
}

.btn-danger:hover {
    background: #B91C1C;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn:disabled:hover {
    background: inherit;
    box-shadow: none;
}

/* Recording status */
.recording-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 20px 0 16px;
    background: #f8fafc;
    border-radius: 12px;
    padding: 12px 20px;
}

.recording-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #DC2626;
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.4); }
}

@media (prefers-reduced-motion: reduce) {
    .recording-dot { animation: none; }
}

.timer {
    font-size: 36px;
    font-weight: 600;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    color: #111827;
}

/* Audio indicator */
.audio-indicator {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 48px;
    padding: 0 24px;
    margin-bottom: 16px;
}

.audio-bar {
    flex: 1;
    min-height: 2px;
    background: #0891B2;
    border-radius: 1px;
    transition: height 50ms linear;
}

.pulse-ring {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid #0891B2;
    margin: auto;
}

@media (prefers-reduced-motion: reduce) {
    .audio-bar { display: none; }
    .pulse-ring { display: block; }
}

/* Safari gate */
.safari-gate {
    background: #FEF2F2;
    border: 1px solid #DC2626;
    border-radius: 8px;
    padding: 24px;
    max-width: 680px;
    margin: 48px auto 0;
}

.safari-gate h2 {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 8px;
}

.safari-gate p {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;
}

/* Modal */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 40;
    opacity: 0;
    transition: opacity 150ms ease-out;
}

.modal-backdrop.visible {
    opacity: 1;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    background: #FFFFFF;
    padding: 24px;
    border-radius: 12px;
    max-width: 400px;
    width: calc(100% - 32px);
    z-index: 50;
    opacity: 0;
    transition: opacity 150ms ease-out;
}

.modal.visible {
    opacity: 1;
}

.modal .mic-off-icon {
    display: block;
    margin-bottom: 12px;
}

.modal h2 {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 8px;
}

.modal p {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;
    color: #475569;
    margin-bottom: 24px;
}

.modal .btn {
    width: auto;
    display: inline-block;
    padding: 12px 24px;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.modal-actions .btn,
.modal-actions .btn-ghost {
    width: 100%;
}

.btn-ghost {
    background: transparent;
    color: #64748B;
    border: 1.5px solid #CBD5E1;
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    padding: 12px 24px;
    min-height: 44px;
    cursor: pointer;
    transition: background 150ms, color 150ms, border-color 150ms;
}

.btn-ghost:hover {
    background: #F1F5F9;
    border-color: #94A3B8;
    color: #334155;
}

.btn-ghost:focus-visible {
    outline: 3px solid var(--color-primary-tint);
    outline-offset: 2px;
}

/* Focus rings */
input[type="radio"]:focus-visible {
    outline: 3px solid #0891B2;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .modal, .modal-backdrop { transition: none; }
}

/* ── Delete confirmation modal ── */
.delete-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 200;
    animation: fadeIn 120ms ease-out;
}

.delete-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #2a2826;
    border: 1px solid #3d3a37;
    border-radius: 12px;
    padding: 28px 28px 24px;
    width: 340px;
    max-width: calc(100vw - 32px);
    z-index: 201;
    animation: scaleIn 140ms ease-out;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.delete-modal-title {
    font-size: 17px;
    font-weight: 600;
    color: #f5f5f4;
    margin-bottom: 8px;
}

.delete-modal-body {
    font-size: 14px;
    color: #a8a29e;
    margin-bottom: 24px;
    line-height: 1.5;
}

.delete-modal-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.delete-modal-actions .btn {
    padding: 10px 18px;
    font-size: 14px;
    width: auto;
    min-width: 80px;
    min-height: 38px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.delete-modal-actions .btn-outline {
    border-color: #4b5563;
    color: #d6d3d1;
}

.delete-modal-actions .btn-outline:hover {
    background: #3d3a37;
    border-color: #6b7280;
    color: #f5f5f4;
}

#pending-recording-modal .delete-modal-actions {
    flex-direction: column;
    gap: 8px;
}

#pending-recording-modal .delete-modal-actions .btn {
    width: 100%;
    white-space: normal;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes scaleIn {
    from { opacity: 0; transform: translate(-50%, -48%) scale(0.96); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.upload-error {
    color: #DC2626;
    font-size: 14px;
    margin-top: 8px;
}

.help-link {
    color: #0891B2;
    text-decoration: underline;
}

/* Transcript section */
.transcript-section {
    background: #FFFFFF;
    border: 1px solid #e5e7eb;
    border-top: 3px solid #0891B2;
    border-radius: 16px;
    padding: 28px;
    max-width: 660px;
    width: 100%;
    margin: 20px auto 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 8px 32px rgba(0,0,0,0.04);
}

.transcribing-status {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.stage-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 400;
    color: #CBD5E1;
    transition: color 200ms;
}

.stage-step.stage-active {
    color: #0891B2;
    font-weight: 500;
}

.stage-step.stage-done {
    color: #10B981;
}

.stage-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid currentColor;
    flex-shrink: 0;
    position: relative;
    transition: border-color 200ms;
}

.stage-step.stage-active .stage-dot {
    border-color: rgba(8, 145, 178, 0.3);
    border-top-color: #0891B2;
    animation: spin 0.75s linear infinite;
}

.stage-step.stage-done .stage-dot {
    border-color: #10B981;
    background: #10B981;
}

.stage-step.stage-done .stage-dot::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 7px;
    height: 4px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .stage-step.stage-active .stage-dot { animation: none; border-color: #0891B2; }
}

.transcript-content {
    max-height: 480px;
    overflow-y: auto;
    margin-bottom: 16px;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db transparent;
}
.transcript-content:focus-visible {
    outline: 2px solid #0891B2;
    outline-offset: 1px;
    border-radius: 4px;
}

.transcript-content::-webkit-scrollbar { width: 4px; }
.transcript-content::-webkit-scrollbar-track { background: transparent; }
.transcript-content::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

.transcript-sentences {
    list-style-type: decimal;
    padding-left: 24px;
}

.transcript-empty {
    padding: 16px 12px;
    font-size: 14px;
    color: #6b7280;
    font-style: italic;
    text-align: center;
}

.transcript-sentence {
    padding: 10px 12px;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    font-size: 15px;
    line-height: 1.7;
    color: #1f2937;
    transition: background-color 120ms ease;
    border-radius: 6px;
}

.transcript-sentence:last-child {
    border-bottom: none;
}

.transcript-sentence:hover {
    background: #f5f3ff;
}


/* ===================================================================
   Phase 4 — Protocol generation (protocol card, error banner, status)
   Source: .planning/phases/04-protocol-generation/04-UI-SPEC.md
   =================================================================== */

.protocol-section {
    background: #FFFFFF;
    border: 1px solid #e5e7eb;
    border-top: 3px solid #059669;
    border-radius: 16px;
    padding: 28px;
    max-width: 660px;
    width: 100%;
    margin: 20px auto 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 8px 32px rgba(0,0,0,0.04);
}

.protocol-section-item {
    padding: 16px 8px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 120ms ease;
    border-radius: 6px;
}

.protocol-section-item:hover {
    background: #fafafa;
}

.protocol-section-item:last-child {
    border-bottom: none;
}

.protocol-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: 'Figtree', -apple-system, sans-serif;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: #0f172a;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

.protocol-section-title-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: #eef2ff;
    color: #0891B2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.protocol-section-title-icon svg {
    width: 14px;
    height: 14px;
}

.protocol-section-text {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.7;
    color: #1e293b;
}

.generate-error {
    background: #FEF2F2;
    border: 1px solid #DC2626;
    border-radius: 8px;
    padding: 24px;
    max-width: 680px;
    margin: 24px auto 0;
}

.generate-error .error-message {
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;
    color: #DC2626;
    margin-bottom: 16px;
}

.btn-secondary {
    background: transparent;
    color: #0891B2;
    border: 1px solid #0891B2;
    font-size: 14px;
    font-weight: 400;
    padding: 8px 16px;
    min-height: auto;
    width: auto;
    display: inline-block;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 200ms ease;
}

.btn-secondary:hover {
    background: #eef2ff;
}

.btn-small {
    font-size: 14px;
    padding: 8px 16px;
}

.raw-output {
    margin-top: 16px;
    padding: 16px;
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.5;
    color: #1A1A1A;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.generating-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #0891B2;
    margin-bottom: 16px;
}

.generating-status::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(8, 145, 178, 0.25);
    border-top-color: #0891B2;
    animation: spin 0.75s linear infinite;
    flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
    .generating-status::before { animation: none; border-color: #0891B2; }
}

/* === Phase 5: Split-panel editor === */

#editor-layout.split-active {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

#editor-layout.split-active #transcript-section,
#editor-layout.split-active #protocol-section {
    max-height: 82vh;
    overflow-y: auto;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

@media (max-width: 1080px) {
    #editor-layout.split-active {
        grid-template-columns: 1fr;
    }
    #editor-layout.split-active #transcript-section,
    #editor-layout.split-active #protocol-section {
        max-height: none;
        overflow-y: visible;
    }
}

.protocol-section-textarea {
    width: 100%;
    min-height: 60px;
    padding: 0.4rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    resize: none;
    overflow: hidden;
    background: #fff;
    color: #1f2937;
    box-sizing: border-box;
}

.protocol-section-textarea:focus {
    outline: 2px solid #0891B2;
    outline-offset: 1px;
    border-color: transparent;
}

.icd10-field {
    position: relative;
}

.icd10-input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.6;
    background: #fff;
    color: #1f2937;
    box-sizing: border-box;
}

.icd10-input:focus {
    outline: 2px solid #0891B2;
    outline-offset: 1px;
    border-color: transparent;
}

.icd10-input::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.drug-search-field {
    position: relative;
    margin-bottom: 6px;
}

.drug-search-input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.6;
    background: #f8fafc;
    color: #1f2937;
    box-sizing: border-box;
}

.drug-search-input:focus {
    outline: 2px solid #0891B2;
    outline-offset: 1px;
    border-color: transparent;
    background: #fff;
}

.drug-search-input::placeholder {
    color: #9ca3af;
    font-style: italic;
}

.icd10-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 220px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.icd10-dropdown.open {
    display: block;
}

.icd10-dropdown-item {
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icd10-dropdown-item:hover,
.icd10-dropdown-item.active {
    background: #e0f2fe;
}

.transcript-sentence.source-highlight {
    background: #fef08a;
    border-radius: 2px;
    transition: background 0.15s;
}

.protocol-section-item.section-highlight {
    border-left: 3px solid #0891B2;
    padding-left: 0.6rem;
    background: #eef2ff;
    border-radius: 0 4px 4px 0;
}

@media (prefers-reduced-motion: reduce) {
    .transcript-sentence.source-highlight {
        transition: none;
    }
}

/* === v1.1: Export button + split-panel tweaks === */
#export-btn {
    margin-top: 1.25rem;
}


/* === Pause/resume recording controls === */
.btn-success {
    background: #059669;
    color: #fff;
}
.btn-success:hover {
    background: #047857;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}
.btn-success:disabled {
    background: #059669;
    box-shadow: none;
}

.btn-outline {
    background: transparent;
    color: #374151;
    border: 1.5px solid #d1d5db;
}
.btn-outline:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.recording-buttons {
    display: flex;
    gap: 0.5rem;
}
.recording-buttons .btn {
    flex: 1;
    display: block;
    width: auto;
}

.pause-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.pause-actions-row {
    display: flex;
    gap: 0.5rem;
}
.pause-actions-row .btn {
    flex: 1;
}

/* "Начать заново" — red outline, fills on hover */
.pause-actions-row .btn-danger {
    background: transparent;
    color: #DC2626;
    border: 1.5px solid #fca5a5;
    font-weight: 500;
}
.pause-actions-row .btn-danger:hover {
    background: #fef2f2;
    border-color: #DC2626;
    box-shadow: none;
}

.stop-confirm {
    margin-top: 0.5rem;
}
.stop-confirm-text {
    font-size: 15px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.75rem;
}
.stop-confirm-actions {
    display: flex;
    gap: 0.5rem;
}
.stop-confirm-actions .btn {
    flex: 1;
}

/* Paused state: amber static dot instead of pulsing red */
.recording-status.paused .recording-dot {
    background: #d97706;
    animation: none;
}

/* === v1.1: Speaker labels === */
.speaker-label {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    margin-right: 7px;
    vertical-align: middle;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.speaker-doctor {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}
.speaker-patient {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

/* ── Mobile header ── */
.mobile-header {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 1rem;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 30;
    isolation: isolate;
}

.mobile-brand {
    font-family: 'Figtree', -apple-system, sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

.sidebar-toggle {
    background: none;
    border: none;
    width: 44px;
    height: 44px;
    cursor: pointer;
    color: #374151;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms ease;
}
.sidebar-toggle:hover { background: #f3f4f6; }

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 15;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}
.sidebar-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── Responsive breakpoints ── */

/* Tablet (900–1200px): narrower sidebar */
@media (max-width: 1200px) {
    .sidebar { width: 260px; }
    .main-content { margin-left: 260px; }
    #app { padding: 1.75rem; }
}

/* Small tablet / large phone (≤ 720px): sidebar becomes overlay */
@media (max-width: 720px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: none;
        z-index: 40;
    }
    .sidebar.sidebar-open {
        transform: translateX(0);
        box-shadow: 4px 0 32px rgba(0, 0, 0, 0.28);
    }
    .sidebar-overlay {
        display: block;
        z-index: 35;
    }

    .main-content { margin-left: 0; }
    .mobile-header { display: flex; }

    #app {
        padding: 1rem;
    }
    .session-header {
        padding: 14px 1rem 12px;
    }

    .recording-card,
    .transcript-section,
    .protocol-section {
        border-radius: 12px;
        padding: 20px 16px;
        margin-top: 16px;
    }

    .card-heading { font-size: 18px; }
    .timer { font-size: 22px; }
}

/* Very small screens (≤ 400px) */
@media (max-width: 400px) {
    .recording-card,
    .transcript-section,
    .protocol-section {
        padding: 16px 12px;
    }
    .mode-option { padding: 12px; font-size: 14px; }
}

/* ── Toast notification system ── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    max-width: 320px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: toastIn 200ms ease, toastOut 200ms ease 2.8s forwards;
    pointer-events: auto;
    line-height: 1.4;
}

.toast-success { background: #059669; }
.toast-error   { background: #DC2626; }
.toast-info    { background: #0891B2; }

@keyframes toastIn  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    .toast { animation: none; }
}

/* ── Session item text wrapper (name + date stacked) ── */
.session-item-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.session-item-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

/* ── Session item meta (date line) ── */
.session-item-meta {
    display: block;
    font-size: 12px;
    color: #4b5563;
    line-height: 1.3;
    margin-top: 1px;
}

/* ── Session empty state ── */
.session-empty {
    padding: 20px 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-style: normal;
}

.session-empty-icon {
    color: #374151;
    opacity: 0.4;
}

.session-empty-text {
    font-size: 12px;
    text-align: center;
    line-height: 1.5;
    color: #6b7280;
}

/* ── Session header meta subtitle ── */
.session-header-meta {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 3px;
    font-weight: 400;
}

/* ── Tech info link + modal ── */
.tech-info-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin: 16px auto 0;
    background: none;
    border: none;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 13px;
    color: #9ca3af;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: #e5e7eb;
    text-underline-offset: 3px;
    transition: color 150ms ease, text-decoration-color 150ms ease;
}
.tech-info-link:hover {
    color: #0891B2;
    text-decoration-color: #67E8F9;
}
.tech-info-link:focus-visible {
    outline: 2px solid #0891B2;
    outline-offset: 3px;
    border-radius: 4px;
}

.tech-info-modal {
    width: 420px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}
.tech-info-modal .delete-modal-title { color: #111827; }
.tech-info-modal .tech-info-row {
    background: #f8fafc;
    border-color: #e5e7eb;
}
.tech-info-modal .tech-info-label { color: #6b7280; }
.tech-info-modal .tech-info-value { color: #111827; }
.tech-info-modal .tech-info-details { color: #374151; }
.tech-info-modal .tech-info-details summary { color: #6b7280; }
.tech-info-modal .tech-info-details summary:hover { color: #111827; }
.tech-info-modal .tech-info-breakdown-list li { color: #374151; border-bottom-color: #e5e7eb; }
.tech-info-modal .tech-info-breakdown-list .section-name { color: #6b7280; }
.tech-info-modal .delete-modal-actions .btn-outline {
    border-color: #d1d5db;
    color: #374151;
}
.tech-info-modal .delete-modal-actions .btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #111827;
}
.tech-info-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 18px;
}
.tech-info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 10px 12px;
    background: #1f1d1b;
    border: 1px solid #3d3a37;
    border-radius: 8px;
}
.tech-info-label {
    font-size: 13px;
    color: #a8a29e;
    flex: 1;
}
.tech-info-value {
    font-size: 14px;
    font-weight: 600;
    color: #f5f5f4;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.tech-info-mono {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    font-weight: 400;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tech-info-details {
    margin-bottom: 18px;
    color: #d6d3d1;
    font-size: 13px;
}
.tech-info-details summary {
    cursor: pointer;
    padding: 6px 0;
    color: #a8a29e;
    transition: color 120ms ease;
}
.tech-info-details summary:hover {
    color: #f5f5f4;
}
.tech-info-breakdown-list {
    list-style: none;
    padding: 8px 0 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.tech-info-breakdown-list li {
    display: flex;
    justify-content: space-between;
    padding: 4px 4px;
    font-size: 12.5px;
    color: #d6d3d1;
    border-bottom: 1px dashed #3d3a37;
}
.tech-info-breakdown-list li:last-child { border-bottom: none; }
.tech-info-breakdown-list .section-name { color: #a8a29e; }
.tech-info-breakdown-list .section-pct {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.tech-info-kpi-ok { color: #4ade80; }
.tech-info-kpi-warn { color: #fbbf24; }

/* ── Recording card intro hint ── */
.card-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px;
    line-height: 1.6;
    text-align: center;
}

/* ── Idle state: center heading + intro under icon ── */
.recording-card.idle-state .card-heading {
    text-align: center;
    margin-bottom: 10px;
}

/* ── Session date group label (Сегодня / Вчера / …) ── */
.session-date-label {
    padding: 10px 14px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    list-style: none;
}
.session-date-label:first-child {
    padding-top: 2px;
}

/* ── Transcript / protocol section entrance ── */
.transcript-section,
.protocol-section {
    animation: cardFadeIn 300ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .transcript-section,
    .protocol-section { animation: none; }
}

/* ── Session menu button: refine SVG variant ── */
.session-item-menu-btn svg { display: block; }

/* ── Skeleton loaders (v1.3) ── */
.skeleton-block {
    padding: 8px 4px 4px;
}
.skeleton-line {
    height: 14px;
    background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 50%, #f3f4f6 100%);
    background-size: 200% 100%;
    border-radius: 4px;
    margin-bottom: 12px;
    animation: skeletonShimmer 1.4s ease-in-out infinite;
}
.skeleton-title {
    height: 18px;
    width: 40%;
    background: linear-gradient(90deg, #e5e7eb 0%, #d1d5db 50%, #e5e7eb 100%);
    background-size: 200% 100%;
    border-radius: 5px;
    margin-bottom: 14px;
    animation: skeletonShimmer 1.4s ease-in-out infinite;
}
.skeleton-section {
    padding: 14px 8px;
    border-bottom: 1px solid #f3f4f6;
}
.skeleton-section:last-child { border-bottom: none; }
@keyframes skeletonShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
    .skeleton-line, .skeleton-title { animation: none; background: #e5e7eb; }
}

/* ── Login page ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: #ffffff;
    padding: 40px 36px;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(17, 24, 39, 0.08),
                0 2px 6px rgba(17, 24, 39, 0.04);
    border: 1px solid var(--color-border);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.login-brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, #0891B2, #0E7490);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(8, 145, 178, 0.4);
}

.login-brand-text {
    font-family: 'Figtree', -apple-system, sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.02em;
}

.login-title {
    font-family: 'Figtree', -apple-system, sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 28px;
    letter-spacing: -0.02em;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-field-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #4b5563;
}

.login-input {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #111827;
    background: #ffffff;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.login-input::placeholder { color: #9ca3af; }
.login-input:focus {
    outline: none;
    border-color: #0891B2;
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.18);
}

.login-error {
    color: #dc2626;
    font-size: 0.875rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 8px 12px;
}

.login-btn {
    width: 100%;
    background: #0891B2;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin-top: 4px;
    transition: background 150ms ease, transform 150ms ease;
}
.login-btn:hover:not(:disabled) { background: #0E7490; }
.login-btn:active:not(:disabled) { transform: translateY(1px); }
.login-btn:disabled { opacity: 0.65; cursor: not-allowed; }
.login-btn:focus-visible {
    outline: 2px solid #0891B2;
    outline-offset: 2px;
}

/* ── Logout button (Phase 07-03 sidebar footer) ── */
.logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    padding: 10px 14px;
    min-height: 44px;
    cursor: pointer;
    width: 100%;
    margin-top: 8px;
    transition: background 150ms, color 150ms;
}
.logout-btn:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
}
.logout-btn:focus-visible {
    outline: 2px solid #67E8F9;
    outline-offset: 2px;
}

/* ── User quota display ── */
.user-quota {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
    display: block;
    margin-top: 1px;
}

.user-quota-warning {
    color: #fbbf24;
    font-weight: 500;
}

/* ── Admin dashboard (Phase 07-04) ── */
.admin-page {
    background: #f9fafb;
    min-height: 100vh;
}

.admin-header {
    background: #111827;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    border-bottom: 1px solid #1f2937;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-family: 'Figtree', -apple-system, sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user-name {
    color: rgba(255,255,255,0.7);
    font-size: 0.875rem;
}

.logout-btn-inline {
    background: none;
    border: 1px solid rgba(255,255,255,0.25);
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8125rem;
    transition: background 150ms ease, border-color 150ms ease;
}
.logout-btn-inline:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.45);
}
.logout-btn-inline:focus-visible {
    outline: 2px solid #67E8F9;
    outline-offset: 2px;
}

.admin-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

.admin-section-title {
    font-family: 'Figtree', -apple-system, sans-serif;
    font-size: 1.375rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 18px;
    letter-spacing: -0.01em;
}

.admin-stats-section,
.admin-sessions-section {
    margin-bottom: 48px;
}

/* Sessions filter — text input with datalist (typeahead by doctor name) */
.admin-doctor-input {
    min-width: 220px;
}
.admin-doctor-input::placeholder {
    color: #9ca3af;
}

/* Subscription warnings banner — populated when ≥1 doctor is expiring/expired */
.subscription-banner {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.subscription-banner-row {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.9rem;
    line-height: 1.4;
    border: 1px solid;
}

.subscription-banner-expired {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
    font-weight: 500;
}

.subscription-banner-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #92400e;
}

/* Per-row subscription state pill + renew button */
.doctor-sub-cell {
    white-space: nowrap;
    font-size: 0.875rem;
}

.sub-state {
    color: var(--color-text-muted);
}

.sub-state-warning {
    color: #b45309;
    font-weight: 500;
}

.sub-state-expired {
    color: var(--color-danger);
    font-weight: 600;
}

.admin-btn-renew {
    background: var(--color-primary);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: background 150ms ease;
}

.admin-btn-renew:hover {
    background: var(--color-primary-hover);
}

.doctors-table .admin-num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.doctor-orgs-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.org-chip {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    line-height: 1.4;
    background: rgba(8, 145, 178, 0.08);
    color: var(--color-primary-active);
    border: 1px solid rgba(8, 145, 178, 0.18);
    white-space: nowrap;
}

.org-chip-empty {
    background: transparent;
    color: var(--color-text-muted);
    border-color: var(--color-border);
}

.doctor-row {
    cursor: pointer;
    transition: background 120ms ease;
}

.doctors-table tbody tr:nth-child(even) {
    background: var(--color-bg-zebra);
}

.doctor-row:hover {
    background: rgba(8, 145, 178, 0.06);
}

.doctor-row-name {
    font-weight: 600;
    color: #111827;
}

.doctor-usage-cell {
    min-width: 180px;
    width: 220px;
}

.doctor-usage-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.doctor-usage-pct {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
    min-width: 32px;
    text-align: right;
}

.doctor-usage-pct.full {
    color: var(--color-danger);
    font-weight: 600;
}

.doctor-usage-bar {
    flex: 1;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.doctor-usage-fill {
    height: 100%;
    background: #0891B2;
    border-radius: 3px;
    transition: width 300ms ease;
}

.doctor-usage-fill.full {
    background: #dc2626;
}

.admin-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 16px;
    padding: 14px 16px;
    background: #ffffff;
    border: 1px solid var(--color-border);
    border-radius: 10px;
}

.admin-filter-label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-weight: 500;
    margin-left: 4px;
}
.admin-filter-label + .admin-date-input {
    margin-left: -4px;
}

.admin-select,
.admin-date-input {
    border: 1px solid var(--color-border);
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 0.875rem;
    background: #ffffff;
    font-family: inherit;
    color: var(--color-text);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.admin-select:focus,
.admin-date-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-ring);
}

.admin-btn-primary {
    background: #0891B2;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 7px 16px;
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
    font-size: 0.875rem;
    transition: background 150ms ease;
}
.admin-btn-primary:hover {
    background: #0E7490;
}

.admin-btn-secondary {
    background: #ffffff;
    color: #374151;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 7px 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    transition: background 150ms ease, border-color 150ms ease;
}
.admin-btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.admin-btn-view {
    background: none;
    border: 1px solid #0891B2;
    color: #0891B2;
    border-radius: 4px;
    padding: 3px 10px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
    transition: background 150ms ease;
}
.admin-btn-view:hover {
    background: rgba(8, 145, 178, 0.08);
}
.admin-btn-primary:focus-visible,
.admin-btn-secondary:focus-visible,
.admin-btn-view:focus-visible,
.admin-btn-renew:focus-visible {
    outline: 2px solid #0891B2;
    outline-offset: 2px;
}

.admin-table-wrap {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #475569;
    border-bottom: 1px solid var(--color-border);
}

.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: var(--color-text);
    line-height: 1.4;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-empty {
    text-align: center;
    color: #9ca3af;
    padding: 24px;
}

.admin-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.admin-modal-content {
    background: #ffffff;
    border-radius: 12px;
    padding: 28px;
    max-width: 900px;
    width: 95%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.admin-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
}
.admin-modal-close:hover {
    color: #111827;
}

.admin-modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: #111827;
}

.admin-modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 720px) {
    .admin-modal-body {
        grid-template-columns: 1fr;
    }
}

.admin-modal-col h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 6px;
}

.admin-transcript p {
    font-size: 0.85rem;
    color: #374151;
    margin-bottom: 4px;
    line-height: 1.5;
}

.admin-protocol-section {
    margin-bottom: 14px;
}

.admin-protocol-section strong {
    font-size: 0.8rem;
    color: #6b7280;
    display: block;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
}

.admin-protocol-section p {
    font-size: 0.875rem;
    color: #111827;
    line-height: 1.5;
}
