:root {
    --bg-main: #141414;
    --bg-sidebar: #1e1e1e;
    --bg-header: #2a2a2a;
    --text-main: #e0e0e0;
    --text-muted: #888888;
    --accent-blue: #4a90e2;
    --accent-blue-glow: #4a90e280;
    --border-color: #333333;
    --btn-bg: #222222;
    --btn-hover: #3a3a3a;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body, html {
    width: 100%;
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header / Top Navigation */
.top-nav {
    display: flex;
    align-items: center;
    background-color: var(--bg-header);
    height: 58px;
    border-bottom: 1px solid var(--border-color);
    padding-right: 15px;
}

.top-center-area {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 0;
    padding: 0 20px;
    gap: 14px;
}

/* Varios controles (opacidad + brillo + contraste) comparten la barra: */
.top-center-area .opacity-ruler-wrapper {
    max-width: 220px;
    flex: 1 1 0;
    min-width: 70px;
}

.filter-toggle-btn {
    flex: 0 0 auto;
}

.filter-toggle-btn.filter-active {
    background: #4a90e2;
    color: #fff;
}

@media (max-width: 1200px) {
    /* Hasta 1200px solo queda la opacidad; los filtros se ocultan para no romper la barra. */
    .top-center-area .filter-control {
        display: none;
    }
}

/* Anchos medios (laptops): la topbar completa no cabe y .top-center-area
   (flex:1, min-width:0) se colapsaba, montando los sliders sobre .top-actions. */
@media (max-width: 1600px) {
    .top-center-area {
        gap: 8px;
        padding: 0 10px;
    }

    .top-center-area .opacity-ruler-wrapper {
        min-width: 56px;
        padding: 4px 10px;
    }

    .top-center-area .ruler-label {
        display: none;
    }

    .top-actions {
        gap: 6px;
        padding-right: 10px;
    }

    .session-badge strong {
        display: none;
    }
}

@media (max-width: 1400px) {
    .top-actions .icon-btn {
        width: 32px;
    }

    .top-center-area .opacity-ruler-wrapper {
        min-width: 52px;
    }
}

.opacity-ruler-wrapper {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 6px 15px;
    background: rgba(0,0,0,0.15);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.03);
}

.ruler-ticks {
    width: 100%;
    height: 5px;
    background-image: 
        linear-gradient(to right, rgba(255,255,255,0.2) 1px, transparent 1px),
        linear-gradient(to right, rgba(255,255,255,0.08) 1px, transparent 1px);
    background-size: 10% 100%, 2% 60%;
    background-position: 0 0, 0 100%;
    background-repeat: repeat-x;
    margin-bottom: 5px;
}

.opacity-ruler-wrapper input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    cursor: pointer;
    margin: 0;
}

.opacity-ruler-wrapper input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 2px;
    background: rgba(255,255,255,0.1);
    border-radius: 1px;
}

.opacity-ruler-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 12px;
    width: 12px;
    border-radius: 50%;
    background: #4a90e2;
    cursor: pointer;
    margin-top: -5px; /* Centers thumb on the 2px track */
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.4);
    border: 2px solid #1a1a1a;
    transition: transform 0.15s ease;
}

.opacity-ruler-wrapper input[type="range"]:hover::-webkit-slider-thumb {
    transform: scale(1.2);
    background: #5fa8ff;
}

.ruler-label {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: rgba(255,255,255,0.25);
    margin-top: 6px;
    text-transform: uppercase;
}

.logo {
    width: var(--sidebar-width, 280px);
    height: 100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    font-size: 19px;
    background-color: #0c0c0c;
    flex-shrink: 0;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Vuelta a la landing publica desde el logo y el nombre del producto. */
.logo-home-link,
.brand-text-link {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    border-radius: 8px;
}
.logo-home-link:hover,
.brand-text-link:hover { opacity: 0.85; }
.logo-home-link:focus-visible,
.brand-text-link:focus-visible {
    outline: 2px solid #5aa2ff;
    outline-offset: 3px;
}
.brand-text-link { flex-direction: column; align-items: flex-start; }

.brand-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: #f4f7fb;
}

.brand-subtitle {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #7e8ca0;
}

.tabs {
    display: flex;
    height: 100%;
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0 30px;
    height: 100%;
    font-size: 14px;
    cursor: pointer;
    position: relative;
    border-right: 1px solid var(--border-color);
    transition: all 0.2s;
}

.tab:hover {
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.05);
}

.tab.active {
    color: var(--accent-blue);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-blue);
    box-shadow: 0 -2px 10px var(--accent-blue-glow);
}

.top-actions {
    margin-left: auto;
    display: flex;
    padding-right: 18px;
    gap: 10px;
    align-items: center;
}

.session-badge {
    min-height: 34px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
    color: #dce7f5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    line-height: 1;
}

.session-badge strong {
    font-size: 11px;
    color: #ffffff;
}

.session-badge .badge-role {
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8fbfff;
}

.icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    color: #aeb8c5;
    font-size: 16px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.2s;
}

.icon-btn:hover {
    color: var(--text-main);
    background: rgba(74, 144, 226, 0.12);
    border-color: rgba(74, 144, 226, 0.35);
    transform: translateY(-1px);
}

.icon-btn.active {
    color: #d9ecff;
    background: rgba(74, 144, 226, 0.18);
    border-color: rgba(74, 144, 226, 0.58);
    box-shadow: 0 0 0 1px rgba(74, 144, 226, 0.18) inset;
}

/* Main Content Area */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Sidebar */
.left-sidebar {
    width: 220px;
    flex: 0 0 220px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

.planner-sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 10px 12px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0)),
        #1b1b1b;
    min-height: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    min-height: 132px;
    position: relative;
    background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.sidebar-section-layers {
    min-height: 190px;
}

.sidebar-section-primary {
    min-height: 148px;
    max-height: 29vh;
}

.sidebar-section-secondary,
.sidebar-section-tertiary {
    min-height: 126px;
    max-height: 17vh;
}

/* Paso 3 (Planes) oculto por completo hasta nuevo aviso (pedido del usuario):
   la caja vacia ocupaba espacio del sidebar. La logica de planes sigue intacta;
   para restaurarlo basta quitar esta regla. */
#plansDashboard {
    display: none;
}

.sidebar-section-templates {
    min-height: 220px;
    max-height: 38vh;
    flex: 0 0 auto;
    overflow: hidden;
}

.sidebar-section-header {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 12px 14px 11px;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-section-header-action {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.sidebar-section-header-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}







.sidebar-collapse-btn {
    width: 28px;
    height: 28px;
    border-radius: 9px;
    border: 1px solid rgba(255,255,255,0.1);
    background: rgba(255,255,255,0.03);
    color: #b9c7d8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease, color 0.16s ease;
}

.sidebar-collapse-btn:hover {
    background: rgba(74, 144, 226, 0.12);
    border-color: rgba(74, 144, 226, 0.38);
    color: #ecf5ff;
    transform: translateY(-1px);
}

.sidebar-section.collapsed {
    min-height: auto !important;
    max-height: none !important;
    flex: 0 0 auto !important;
}

.sidebar-section.collapsed .sidebar-section-list,
.sidebar-section.collapsed .sidebar-templates-list,
.sidebar-section.collapsed .sidebar-section-resize-handle {
    display: none;
}

.sidebar-section.collapsed .sidebar-section-header {
    border-bottom: none;
}

.sidebar-section.collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

.left-sidebar-resize-handle {
    width: 8px;
    flex: 0 0 8px;
    cursor: col-resize;
    position: relative;
    background: transparent;
}

.left-sidebar-resize-handle::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 3px;
    width: 2px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
}

.left-sidebar-resize-handle:hover::before,
.left-sidebar-resize-handle.is-dragging::before {
    background: rgba(74, 144, 226, 0.45);
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.24);
}

.sidebar-section-resize-handle {
    height: 18px;
    flex: 0 0 18px;
    border: none;
    background: transparent;
    cursor: ns-resize;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    touch-action: none;
    pointer-events: auto;
    user-select: none;
    -webkit-user-select: none;
}

.sidebar-section-resize-handle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 7px;
    transform: translateX(-50%);
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
}

.sidebar-section-resize-handle:hover::before,
.sidebar-section-resize-handle.is-dragging::before {
    background: rgba(74, 144, 226, 0.52);
    box-shadow: 0 0 12px rgba(74, 144, 226, 0.22);
}

.sidebar-section-kicker {
    font-size: 10px;
    line-height: 1;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #7f8a98;
}

.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    font-size: 15px;
    font-weight: 700;
    color: #f2f5f8;
}

.sidebar-section-title i {
    color: #86b8ff;
    font-size: 13px;
}

.sidebar-add-btn {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    border: 1px solid rgba(113, 178, 255, 0.4);
    background: linear-gradient(180deg, rgba(74, 144, 226, 0.95), rgba(53, 103, 176, 0.95));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    box-shadow: 0 8px 18px rgba(44, 112, 194, 0.22);
}

.sidebar-add-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(160, 210, 255, 0.65);
    box-shadow: 0 10px 22px rgba(44, 112, 194, 0.28);
}

.sidebar-section-list,
.sidebar-templates-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-bottom: 16px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sidebar-search-wrap {
    padding: 10px 12px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.012);
}

.sidebar-search-field {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(12, 14, 18, 0.72);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.sidebar-search-field > i {
    color: #7f8ea0;
    font-size: 12px;
    flex-shrink: 0;
}

.sidebar-search-field input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: #eef5ff;
    font-size: 12px;
}

.sidebar-search-field input::placeholder {
    color: #758294;
}

.sidebar-search-clear {
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #7f8ea0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.sidebar-search-clear:hover {
    background: rgba(255,255,255,0.06);
    color: #eef5ff;
}

.sidebar-empty-state {
    padding: 14px;
    color: #7e8794;
    font-style: italic;
    font-size: 11px;
    line-height: 1.45;
}

.help-modal-box {
    max-width: 520px;
}

.login-brand {
    margin-bottom: 10px;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #86b8ff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.login-brand::before {
    content: '';
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    background: url('favicon.svg') center / contain no-repeat;
    border-radius: 7px;
}

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex-shrink: 0;
}

.calib-modal-sub {
    margin: 0 0 14px;
    font-size: 12px;
    line-height: 1.5;
    color: #aeb8c5;
}

.onboarding-box {
    max-width: 620px;
}

.onboarding-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.onboarding-card {
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    border-radius: 12px;
    padding: 14px;
    min-height: 118px;
}

.onboarding-card strong {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: #f4f7fb;
}

.onboarding-card span {
    display: block;
    font-size: 12px;
    line-height: 1.55;
    color: #aeb8c5;
}

.onboarding-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}


.admin-section-card {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
    margin-bottom: 12px;
}

.admin-section-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.admin-section-head strong {
    color: #f5f8ff;
    font-size: 15px;
}

.admin-section-head span {
    color: #9ba8ba;
    font-size: 12px;
    line-height: 1.45;
}

.admin-users-section .users-admin-list {
    max-height: 34vh;
}

.admin-summary-section .admin-summary-grid {
    margin-bottom: 0;
}

.admin-users-toolbar {
    margin-bottom: 12px;
}

.calib-modal-box.users-admin-box {
    width: min(98vw, 1400px);
    max-width: min(98vw, 1400px);
    max-height: min(94vh, 980px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.users-admin-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

/* Redact (censura OCR) Modal */
.redact-box {
    width: min(94vw, 1080px);
    max-width: min(94vw, 1080px);
    max-height: 92vh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.redact-status {
    font-size: 13px;
    color: #9fc4ff;
    min-height: 18px;
}

.redact-status.redact-status-warn {
    color: #f4a261;
}

.redact-mode-row {
    display: flex;
    gap: 18px;
    align-items: center;
    font-size: 13px;
    color: #ccc;
}

.redact-mode-option {
    display: flex;
    gap: 6px;
    align-items: center;
    cursor: pointer;
}

.redact-mode-option input {
    accent-color: #4a90e2;
    margin: 0;
}

.redact-canvas-wrap {
    display: flex;
    justify-content: center;
    background: #111;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 8px;
    overflow: auto;
    max-height: 62vh;
}

#redactCanvas {
    display: block;
    cursor: crosshair;
    touch-action: none;
}

.redact-actions {
    flex-wrap: wrap;
}

.calib-btn.is-active {
    border: 1px solid #4a90e2;
    color: #fff;
    background: #2b3a55;
}

.users-admin-list {
    max-height: 42vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.templates-admin-list {
    max-height: 26vh;
    margin-top: 10px;
    margin-bottom: 0;
}

.admin-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.admin-summary-card {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 10px 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
}

.admin-summary-label {
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #7f8fa3;
    margin-bottom: 6px;
}

.admin-summary-value {
    font-size: 20px;
    font-weight: 700;
    color: #f4f8fc;
}

.admin-ops-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.admin-ops-card {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
}

.admin-ops-card strong {
    display: block;
    margin-bottom: 8px;
    color: #eef6ff;
    font-size: 13px;
}

.admin-ops-meta {
    font-size: 12px;
    line-height: 1.55;
    color: #aeb8c5;
    white-space: pre-line;
}

.user-admin-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
}

.user-admin-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.user-admin-name {
    font-size: 14px;
    font-weight: 700;
    color: #f5f8fb;
}

.user-admin-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
    color: #9aa7b8;
}

.user-role-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    background: rgba(74, 144, 226, 0.14);
    color: #8fc0ff;
    border: 1px solid rgba(74, 144, 226, 0.24);
}

.user-role-pill.user-role-admin {
    background: rgba(43, 183, 123, 0.14);
    color: #89e5bf;
    border-color: rgba(43, 183, 123, 0.24);
}

.user-admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.user-admin-btn {
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: #dde7f4;
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.user-admin-btn:hover {
    background: rgba(74, 144, 226, 0.14);
    border-color: rgba(74, 144, 226, 0.25);
}

.user-admin-btn.danger:hover {
    background: rgba(230, 57, 70, 0.14);
    border-color: rgba(230, 57, 70, 0.26);
}

.calib-modal-box.template-admin-box {
    width: min(920px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
}

.template-admin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

@media (max-width: 640px) {
    .calib-modal-box.users-admin-box {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        padding: 16px;
    }
    .template-admin-grid {
        grid-template-columns: 1fr;
    }
}

.template-upload-label {
    font-size: 12px;
    font-weight: 700;
    color: #dce7f5;
}

.template-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #b7c4d4;
}

.template-toggle input {
    accent-color: #4a90e2;
}

.help-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.help-item {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}

.help-item strong {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #f3f6fb;
}

.help-item span {
    display: block;
    font-size: 12px;
    line-height: 1.45;
    color: #a9b4c2;
}

.patient-info {
    padding: 15px 20px;
    font-size: 13px;
    color: #bbb;
    border-bottom: 1px solid var(--border-color);
    letter-spacing: 1px;
}

.patient-info i {
    margin-right: 8px;
}

.search-container {
    padding: 15px;
    position: relative;
}

.search-container input {
    width: 100%;
    background-color: var(--bg-main);
    border: 1px solid var(--accent-blue);
    border-radius: 20px;
    padding: 8px 15px 8px 35px;
    color: var(--text-main);
    outline: none;
    box-shadow: 0 0 5px var(--accent-blue-glow);
}

.search-icon {
    position: absolute;
    left: 25px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-blue);
    font-size: 14px;
}

.template-list {
    flex: 1;
    overflow-y: auto;
}

.template-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.template-actions-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}

.template-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.template-item.active {
    background-color: rgba(255, 255, 255, 0.05);
}

.template-item.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--accent-blue);
}

.template-icon {
    font-size: 20px;
    color: var(--text-muted);
    margin-right: 15px;
}

.template-details {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.template-name {
    font-size: 13px;
    margin-bottom: 4px;
}

.template-brand {
    font-size: 11px;
    color: var(--accent-blue);
}

.expand-icon {
    color: var(--text-muted);
    font-size: 12px;
}

/* Canvas Area */
.canvas-container {
    flex: 1;
    position: relative;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    touch-action: none;
    -ms-touch-action: none;
    gap: 1px;
}

.canvas-container.dual-view-active {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background-color: var(--border-color);
}

.canvas-container.dual-view-active .canvas-pane {
    border: 1px solid rgba(255,255,255,0.08);
    transition: box-shadow 0.18s ease, border-color 0.18s ease, filter 0.18s ease;
    cursor: default;
}

.canvas-container.dual-view-active .canvas-pane.is-workspace-active {
    border-color: rgba(74, 144, 226, 0.8);
    box-shadow: inset 0 0 0 1px rgba(74, 144, 226, 0.9), 0 0 24px rgba(74, 144, 226, 0.18);
    z-index: 2;
}

.canvas-container.dual-view-active .canvas-pane:not(.is-workspace-active) {
    filter: saturate(0.92);
}

.canvas-pane {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.compare-iframe-shell {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0)),
        #000;
    z-index: 18;
}

.compare-iframe-bar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(74, 144, 226, 0.2);
    background: rgba(10, 15, 24, 0.82);
    backdrop-filter: blur(8px);
    cursor: pointer;
}

.compare-iframe-kicker {
    font-size: 10px;
    line-height: 1;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #7f8da0;
}

.compare-iframe-title {
    font-size: 15px;
    font-weight: 700;
    color: #f5f8fd;
}

.compare-iframe-actions {
    position: absolute;
    top: 22px;
    right: 24px;
    z-index: 4;
    display: flex;
    gap: 8px;
}

.compare-pane-window-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(20, 24, 30, 0.88);
    color: #f4f7fb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.compare-pane-window-btn:hover {
    background: rgba(34, 43, 56, 0.96);
    border-color: rgba(74, 144, 226, 0.46);
    transform: translateY(-1px);
}

.compare-pane-window-btn.is-close:hover {
    border-color: rgba(230, 57, 70, 0.55);
    background: rgba(56, 22, 28, 0.95);
}

.compare-iframe {
    flex: 1;
    width: 100%;
    min-height: 0;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    background: #0a0a0a;
}

body.embedded-mode .left-sidebar,
body.embedded-mode .left-sidebar-resize-handle {
    display: none !important;
}

body.embedded-mode .logo {
    width: auto;
    min-width: 0;
    padding: 0 12px;
    background: transparent;
}

body.embedded-mode .brand-copy {
    display: none;
}

body.embedded-mode .top-nav,
body.embedded-mode .right-sidebar {
    display: none !important;
}

body.embedded-mode #btnDualView,
body.embedded-mode #btnOnboarding,
body.embedded-mode #btnAddUser,
body.embedded-mode #btnLogout {
    display: none !important;
}

body.embedded-mode #legalNotice {
    display: none;
}

body.embedded-mode .main-content {
    height: 100vh;
}

body.embedded-mode .canvas-container,
body.embedded-mode .canvas-pane {
    width: 100vw;
    height: 100vh;
}

.canvas-container canvas,
.canvas-container .canvas-container,
.canvas-container .upper-canvas,
.canvas-container .lower-canvas {
    touch-action: none !important;
    -ms-touch-action: none !important;
}

.upload-btn {
    position: absolute;
    z-index: 10;
    padding: 12px 24px;
    background-color: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: background 0.2s;
}

.upload-btn:hover {
    background-color: #357ebd;
}

/* Right Sidebar (Toolbar) */
.right-sidebar {
    width: 150px;
    background:
        radial-gradient(circle at 70% 8%, rgba(74, 144, 226, 0.09), transparent 34%),
        linear-gradient(180deg, #171b22 0%, #12151a 100%);
    border-left: 1px solid rgba(151, 180, 216, 0.16);
    display: flex;
    padding-top: 10px;
    box-shadow: -12px 0 34px rgba(0, 0, 0, 0.22);
}

.sidebar-tabs {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    display: flex;
    align-items: center;
    border-right: 1px solid var(--border-color);
    width: 30px;
}

.sidebar-tab {
    padding: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    letter-spacing: 2px;
}

.sidebar-tab.active {
    color: #e4a834; /* Gold color from screenshot */
}

.toolbar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 8px 18px;
    gap: 13px;
    overflow-y: auto;
}

.tool-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background-color: var(--btn-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
}

.tool-btn:hover, .tool-btn.active {
    background-color: var(--btn-hover);
    color: white;
    box-shadow: 0 0 10px rgba(255,255,255,0.1);
}

.tool-btn.text-btn,
.tool-btn-alias {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    border-radius: 14px;
    height: 32px;
    min-width: 58px;
    width: auto;
    padding: 0 10px;
    background: rgba(255,255,255,0.025);
}

/* ============================================================
   Jerarquia visual "clinico tecnologico" (ref. TraumaCad):
   - Todos los botones comparten el mismo fondo oscuro.
   - El color de categoria va solo en el icono y un borde tenue.
   - La intensidad maxima se reserva para la herramienta activa.
   Paleta por categoria:
     principal    #38bdf8  acciones generales
     archivos     #60a5fa  subir, descargar, informes, nube
     mediciones   #f59e0b  regla, angulos, calibracion
     trazado      #a78bfa  trazar, marcar, editar
     compartir    #34d399  usuarios, compartir
     salida       #fb7185  salir, eliminar
   ============================================================ */

/* Categorias: toolbar de herramientas */
#btn-calibrate, #btn-distance, #btn-angle { --accent: #f59e0b; }       /* mediciones */
#btn-trace, #btn-cut, #btnPivot, #btn-circle, #btn-text { --accent: #a78bfa; } /* trazado/anotacion */

/* Categorias: barra superior */
#btnOnboarding, #btnMyPlan, #btnProfile, #btnTips, #btnHelp,
#btnFitImage, #btnDualView { --accent: #38bdf8; }                      /* principal */
#btnSaveCloud, #btnSaveImage, #btnExportReport { --accent: #60a5fa; }                   /* archivos e imagenes */
#btnSharePlan, #btnAddUser { --accent: #34d399; }                      /* compartir/pacientes */
#btnCropImage, #btn-redact { --accent: #a78bfa; }                      /* edicion de imagen */
#btnDeleteImage, #btnLogout { --accent: #fb7185; }                     /* eliminacion/salida */

/* Estado reposo: fondo oscuro uniforme, icono suave, borde tenue */
#btn-calibrate, #btn-distance, #btn-angle, #btn-trace, #btn-cut,
#btnPivot, #btn-circle, #btn-text,
#btnOnboarding, #btnMyPlan, #btnProfile, #btnAddUser, #btnSaveCloud,
#btnSharePlan, #btnSaveImage, #btnDeleteImage, #btnFitImage, #btnDualView,
#btnTips, #btnHelp, #btnLogout, #btnExportReport,
#btnCropImage, #btn-redact {
    color: color-mix(in srgb, var(--accent) 78%, #cbd5e1);
    background-color: var(--btn-bg);
    border-color: color-mix(in srgb, var(--accent) 28%, #334155);
}

/* Hover: el acento se hace visible sin encender todo el boton */
#btn-calibrate:hover, #btn-distance:hover, #btn-angle:hover, #btn-trace:hover,
#btn-cut:hover, #btnPivot:hover, #btn-circle:hover, #btn-text:hover,
#btnOnboarding:hover, #btnMyPlan:hover, #btnProfile:hover, #btnAddUser:hover,
#btnSaveCloud:hover, #btnSharePlan:hover, #btnSaveImage:hover, #btnDeleteImage:hover,
#btnFitImage:hover, #btnDualView:hover, #btnTips:hover, #btnHelp:hover, #btnLogout:hover,
#btnExportReport:hover, #btnCropImage:hover, #btn-redact:hover {
    color: var(--accent);
    background-color: color-mix(in srgb, var(--accent) 16%, #172033);
    border-color: color-mix(in srgb, var(--accent) 65%, #334155);
    box-shadow: none;
}

/* Activo: unico estado con acento intenso */
#btn-calibrate.active, #btn-distance.active, #btn-angle.active, #btn-trace.active,
#btn-cut.active, #btnPivot.active, #btn-circle.active, #btn-text.active,
#btnOnboarding.active, #btnMyPlan.active, #btnProfile.active, #btnAddUser.active,
#btnSaveCloud.active, #btnSharePlan.active, #btnSaveImage.active, #btnDeleteImage.active,
#btnFitImage.active, #btnDualView.active, #btnTips.active, #btnHelp.active, #btnLogout.active,
#btnExportReport.active, #btnCropImage.active, #btn-redact.active {
    color: var(--accent);
    background-color: color-mix(in srgb, var(--accent) 24%, #172033);
    border-color: var(--accent);
    box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 30%, transparent);
}

.tool-btn.text-icon {
    font-size: 16px;
    font-weight: bold;
}

.spacer {
    flex: 1;
}

.delete-btn {
    background-color: #2a1111;
    color: #ff4444;
    border-color: #441111;
}

.delete-btn:hover {
    background-color: #ff4444;
    color: white;
}

/* Scale display badge */
.scale-display {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(8px);
    color: #4a90e2;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid rgba(74, 144, 226, 0.4);
    opacity: 0.4;
    transition: opacity 0.3s;
    z-index: 100;
    pointer-events: none;
}

.legal-notice {
    position: fixed;
    left: 240px;
    bottom: 18px;
    max-width: 320px;
    padding: 7px 11px;
    border-radius: 12px;
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.58);
    font-size: 10px;
    line-height: 1.35;
    backdrop-filter: blur(10px);
    z-index: 25;
    pointer-events: none;
}

/* Calibration Modal */
.calib-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.calib-modal.open {
    display: flex;
}

/* Mientras se verifica la sesion (auth-pending) o no hay sesion activa
   (logged-out), la interfaz de la app queda oculta: evita el pantallazo
   de herramientas antes del login. Los modales (login, terminos) siguen
   visibles por encima. */
body.auth-pending .app-container,
body.logged-out .app-container {
    visibility: hidden;
}

/* La barra inferior movil (.right-sidebar) se fuerza con visibility:visible
   !important en el media query; hay que taparla explicitamente. */
body.auth-pending .right-sidebar,
body.logged-out .right-sidebar {
    visibility: hidden !important;
}

body.auth-pending .calib-modal,
body.logged-out .calib-modal {
    visibility: visible;
}

.modal-x-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: #c4cdd9;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    z-index: 5;
}

.modal-x-close:hover {
    background: rgba(230, 57, 70, 0.3);
    color: #fff;
}

.calib-modal-title {
    padding-right: 34px;
}

.calib-modal-box {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 30px;
    width: 360px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: popIn 0.2s ease;
    /* Los modales altos (perfil, compartir, reportes) deben poder hacer scroll */
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
}

.plan-meta-display {
    position: fixed;
    left: 50%;
    top: 84px;
    bottom: auto;
    right: auto;
    transform: translateX(-50%);
    max-width: min(60vw, 760px);
    min-width: 320px;
    padding: 10px 18px;
    border-radius: 16px;
    border: 1px solid rgba(73, 139, 230, 0.35);
    background: rgba(25, 31, 42, 0.86);
    backdrop-filter: blur(8px);
    color: #9fc4ff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0.01em;
    text-align: center;
    white-space: normal;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
    z-index: 1100;
    opacity: 1;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.plan-meta-display.is-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-10px);
}

@keyframes popIn {
    from { transform: scale(0.9); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.calib-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #4a90e2;
}

.calib-modal-sub {
    font-size: 13px;
    color: #aaa;
    margin: 0;
}

.calib-modal-box input[type="number"] {
    width: 100%;
    background: #111;
    border: 1px solid #4a90e2;
    border-radius: 6px;
    padding: 10px 14px;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.calib-modal-box input[type="number"]:focus {
    border-color: #80b8ff;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.2);
}

.calib-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.calib-btn {
    padding: 9px 22px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    font-weight: 600;
    transition: all 0.2s;
}

.calib-cancel {
    background: #2a2a2a;
    color: #aaa;
    border: 1px solid #444;
}

.calib-cancel:hover {
    background: #333;
    color: #fff;
}

.calib-confirm {
    background: #4a90e2;
    color: #fff;
}

.calib-confirm:hover {
    background: #357ebd;
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

/* Active tool highlight */
.tool-btn.active {
    background: rgba(74, 144, 226, 0.25);
    border-color: #4a90e2;
    color: #4a90e2;
    box-shadow: 0 0 12px rgba(74, 144, 226, 0.3);
}

/* Canvas cursor crosshair via data attribute */
.canvas-container.drawing-mode canvas {
    cursor: crosshair !important;
}

/* Layer List Styling */
.layers-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.layer-item {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr) auto;
    grid-template-areas:
        "color name actions"
        "color picker stroke";
    align-items: center;
    column-gap: 7px;
    row-gap: 6px;
    padding: 10px 12px;
    background: rgba(10, 10, 10, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}
.layer-item .layer-color-box { grid-area: color; }
.layer-item .layer-name { grid-area: name; }
.layer-item .layer-actions { grid-area: actions; }
.layer-item .layer-color-picker { grid-area: picker; justify-self: start; }
.layer-item .layer-stroke-input { grid-area: stroke; justify-self: end; }
.layer-item:hover {
    background: rgba(255, 255, 255, 0.05);
}
.layer-item.selected,
.layer-item.active {
    background: linear-gradient(90deg, rgba(74, 144, 226, 0.18), rgba(74, 144, 226, 0.03));
    border-color: rgba(74, 144, 226, 0.28);
}

.sidebar-record-item {
    display: block;
    padding: 12px 14px;
    background: rgba(10, 10, 10, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 12px;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.sidebar-record-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-record-item.selected,
.sidebar-record-item.active {
    background: linear-gradient(90deg, rgba(74, 144, 226, 0.18), rgba(74, 144, 226, 0.03));
    border-color: rgba(74, 144, 226, 0.28);
}
.layer-color-box {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.45);
    box-shadow: 0 0 0 1px rgba(0,0,0,0.35) inset;
}
.layer-name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.layer-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-self: end;
    flex-shrink: 0;
}
.layer-action-btn {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 11px;
    padding: 0;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.layer-action-btn:hover {
    color: #fff;
}
.layer-action-btn.active {
    color: #4a90e2;
}

.sidebar-item-stack {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1 1 auto;
}

.sidebar-item-title {
    font-weight: 700;
    color: #f2f5f8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-item-order {
    color: #7faef2;
    font-weight: 800;
    margin-right: 4px;
}

.sidebar-item-subtitle {
    font-size: 11px;
    color: #8d97a6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.duplicate-plan-btn {
    background: rgba(43, 57, 73, 0.78) !important;
    color: #8ec5ff !important;
    border: 1px solid rgba(74, 144, 226, 0.55) !important;
    width: 32px;
    height: 32px;
    padding: 0 !important;
    border-radius: 9px !important;
    cursor: pointer;
    font-size: 11px !important;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.duplicate-plan-btn:hover {
    background: rgba(54, 74, 95, 0.92) !important;
    border-color: rgba(120, 188, 255, 0.85) !important;
    transform: translateY(-1px);
}

.sidebar-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.sidebar-item-actions {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Pacientes: nombre/HC en la primera fila y acciones en la segunda,
   asi los iconos no tapan el nombre en el ancho del sidebar. */
#patientsList .sidebar-record-item .sidebar-item-row {
    flex-wrap: wrap;
}

#patientsList .sidebar-record-item .sidebar-item-stack {
    flex: 1 1 100%;
}

#patientsList .sidebar-record-item .sidebar-item-actions {
    margin-left: auto;
}

.sidebar-mini-btn {
    background: rgba(43, 57, 73, 0.78) !important;
    color: #d7e4f5 !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    width: 32px;
    height: 32px;
    padding: 0 !important;
    border-radius: 9px !important;
    cursor: pointer;
    font-size: 11px !important;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, color 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sidebar-mini-btn:hover {
    background: rgba(54, 74, 95, 0.92) !important;
    border-color: rgba(160, 188, 220, 0.42) !important;
    transform: translateY(-1px);
}

.sidebar-mini-btn-compare {
    color: #9fd0ff !important;
    border-color: rgba(108, 174, 255, 0.4) !important;
}

.sidebar-mini-btn-compare:hover {
    background: rgba(36, 62, 91, 0.92) !important;
    border-color: rgba(125, 194, 255, 0.7) !important;
}

.sidebar-mini-btn-main {
    background-color: rgba(52, 152, 219, 0.2);
    color: #3498db;
}
.sidebar-mini-btn-main:hover {
    background-color: #3498db;
    color: white;
}

.sidebar-mini-btn-ref {
    background-color: rgba(46, 204, 113, 0.2);
    color: #2ecc71;
    border-color: #2ecc71 !important;
}

.sidebar-mini-btn-ref:hover {
    background: rgba(46, 204, 113, 0.1) !important;
    border-color: #2ecc71 !important;
}

.sidebar-mini-btn-danger {
    color: #ffb3b3 !important;
    border-color: rgba(255, 107, 107, 0.35) !important;
}

.sidebar-mini-btn-danger:hover {
    background: rgba(87, 34, 34, 0.92) !important;
    border-color: rgba(255, 120, 120, 0.65) !important;
}

.plan-list-item .sidebar-item-actions {
    opacity: 0;
    transform: translateX(6px);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

/* Badge de mensajes no leidos del chat del plan (siempre visible,
   las acciones del item solo aparecen al hover). */
.plan-list-item {
    position: relative;
}

.plan-chat-badge {
    position: absolute;
    top: 6px;
    right: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 9px;
    background: #e63946;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 0 8px rgba(230, 57, 70, 0.55);
    pointer-events: none;
}

.plan-list-item:hover .sidebar-item-actions,
.plan-list-item.selected .sidebar-item-actions,
.plan-list-item:focus-within .sidebar-item-actions {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .main-content {
        position: relative;
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    }
    
    .left-sidebar {
        position: absolute; top: 0; left: 0; bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        width: 85%; max-width: 320px; z-index: 1000;
        transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none; border-right: 1px solid var(--border-color);
        overflow-y: auto;
    }

    .planner-sidebar {
        min-height: max-content;
        overflow: visible;
        gap: 8px;
        padding: 8px;
    }

    .sidebar-section-primary,
    .sidebar-section-secondary,
    .sidebar-section-tertiary {
        max-height: none;
    }

    /* En movil la lista de pacientes se limita a ~2 items con scroll interno,
       para no tener que recorrer toda la lista hasta llegar a Estudios. */
    #patientsList {
        flex: 0 0 auto;
        max-height: 118px;
    }

    .sidebar-section-templates {
        min-height: 220px;
        flex: 0 0 auto;
    }

    .left-sidebar-resize-handle {
        display: none;
    }

    .plan-list-item .sidebar-item-actions {
        opacity: 1;
        transform: none;
        pointer-events: auto;
    }

    .sidebar-section {
        border-radius: 12px;
    }

    .sidebar-section-header {
        padding: 11px 12px 10px;
    }

    .sidebar-section-title {
        font-size: 14px;
    }
    
    .left-sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0,0,0,0.8);
    }
    
    .right-sidebar {
        width: 100%; height: calc(72px + env(safe-area-inset-bottom, 0px)); position: fixed; bottom: 0; left: 0; right: 0;
        background: rgba(25, 25, 25, 0.95); backdrop-filter: blur(10px);
        border-left: none; border-top: 1px solid rgba(255, 255, 255, 0.1);
        padding: 0 10px env(safe-area-inset-bottom, 0px) 10px; flex-direction: row; align-items: center; z-index: 1200; overflow-x: auto;
        box-shadow: 0 -5px 15px rgba(0,0,0,0.5);
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    .sidebar-tabs { display: none; }
    
    .toolbar {
        flex-direction: row; flex: 1; padding: 0; gap: 8px; align-items: center; justify-content: flex-start; overflow-x: auto;
        -webkit-overflow-scrolling: touch; height: 100%;
    }
    
    /* Disable spacer so items stay together and scroll properly */
    .toolbar .spacer { display: none; }
    
    .tool-btn {
        width: 42px; height: 42px; font-size: 16px; flex-shrink: 0;
    }
    
    .tool-btn.text-btn {
        width: auto; padding: 0 12px; height: 34px; font-size: 11px; flex-shrink: 0;
    }

    .template-admin-grid {
        grid-template-columns: 1fr;
    }
    
    .canvas-container {
        height: calc(100dvh - 50px - 72px - env(safe-area-inset-bottom, 0px)); width: 100%;
        min-height: calc(100vh - 50px - 72px);
    }
    
    /* Move scale display above the bottom toolbar */
    .scale-display {
        bottom: calc(84px + env(safe-area-inset-bottom, 0px));
        font-size: 11px;
        padding: 4px 12px;
    }

    .plan-meta-display {
        left: 50%;
        top: 72px;
        right: auto;
        bottom: auto;
        transform: translateX(-50%);
        min-width: 0;
        max-width: min(88vw, 420px);
        font-size: 10px;
        padding: 8px 12px;
    }
    
    .legal-notice {
        display: none;
    }
    
    .top-actions { padding-right: 8px; gap: 8px; }
    
    .top-actions .icon-btn { font-size: 17px; }
    
    .tab { padding: 0 12px; font-size: 12px; }
    
    #desktopLogo { display: none; }
    #btnMenuToggle { display: inline-flex !important; align-items: center; justify-content: center; font-size: 20px; width: 100%; height: 100%; }
    .upload-btn {
        z-index: 120;
        max-width: calc(100vw - 32px);
        text-align: center;
    }

    /* Modales en pantallas pequenas: ancho fluido y padding compacto */
    .calib-modal-box {
        width: min(360px, calc(100vw - 24px));
        padding: 20px;
    }
}


.sidebar-section-height-controls,
.sidebar-height-controls,
.sidebar-resize-controls {
    display: none !important;
}

.sidebar-section-header-controls > *:not(.sidebar-collapse-btn) {
    display: none !important;
}

/* Pricing / Mi plan */
.pricing-box {
    max-width: 560px;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.pricing-card {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pricing-card-name {
    font-size: 15px;
    font-weight: 600;
    color: #4a90e2;
}

.pricing-card-price {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}

.pricing-card-price span {
    font-size: 12px;
    font-weight: 400;
    color: #9ba8ba;
}

.pricing-card-list {
    margin: 0;
    padding-left: 18px;
    font-size: 12px;
    color: #c4cdd9;
    line-height: 1.6;
    flex: 1;
}

.pricing-subscribe-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ------------------------------------------------------------------ */
/* Grupos de herramientas (acordeon), wizard guiado y menu movil       */
/* ------------------------------------------------------------------ */

.tool-essentials {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.tool-group {
    --group-accent: 96, 165, 250;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.tool-group-deformity { --group-accent: 77, 201, 193; }
.tool-group-hip { --group-accent: 151, 126, 255; }
.tool-group-knee { --group-accent: 96, 165, 250; }

.tool-group-toggle {
    width: 100%;
    min-height: 48px;
    padding: 8px 10px 8px 14px;
    text-align: center;
    gap: 7px;
    border-radius: 13px;
    border: 1px solid rgba(var(--group-accent), 0.3);
    background:
        linear-gradient(145deg, rgba(var(--group-accent), 0.17), rgba(var(--group-accent), 0.045) 58%),
        rgba(255, 255, 255, 0.025);
    color: #f2f7ff;
    cursor: pointer;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18px;
    align-items: center;
    overflow: hidden;
    position: relative;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.07),
        0 7px 18px rgba(0, 0, 0, 0.18);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.tool-group-toggle::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 2px;
    background: rgb(var(--group-accent));
    opacity: 0.76;
    box-shadow: 0 0 14px rgba(var(--group-accent), 0.66);
}

.tool-group-toggle:hover {
    transform: translateY(-1px);
    border-color: rgba(var(--group-accent), 0.58);
    background:
        linear-gradient(145deg, rgba(var(--group-accent), 0.24), rgba(var(--group-accent), 0.07) 62%),
        rgba(255, 255, 255, 0.035);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 10px 24px rgba(0, 0, 0, 0.24);
}

.tool-group.open .tool-group-toggle {
    border-color: rgba(var(--group-accent), 0.72);
    background: linear-gradient(145deg, rgba(var(--group-accent), 0.28), rgba(var(--group-accent), 0.09));
}

.tool-group-title {
    min-width: 0;
    font-size: 10px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: 0.11em;
    color: #f4f8ff;
    white-space: nowrap;
}

.tool-group-chevron {
    width: 18px;
    height: 18px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: rgba(221, 232, 248, 0.8);
    background: rgba(255, 255, 255, 0.055);
}

.tool-group-chevron .fa-chevron-down {
    transition: transform 0.24s ease;
    font-size: 8px;
}

.tool-group.open .tool-group-chevron .fa-chevron-down {
    transform: rotate(180deg);
}

.tool-group-body {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 7px 3px;
    border-radius: 0 0 14px 14px;
    border-left: 1px solid rgba(var(--group-accent), 0.18);
    border-right: 1px solid rgba(var(--group-accent), 0.18);
    border-bottom: 1px solid rgba(var(--group-accent), 0.18);
    background: linear-gradient(180deg, rgba(var(--group-accent), 0.075), rgba(255, 255, 255, 0.01));
    margin-top: -11px;
    animation: toolGroupReveal 0.18s ease-out;
}

.tool-group.open .tool-group-body {
    display: flex;
}

@keyframes toolGroupReveal {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.tool-wizard-btn {
    width: 84%;
    padding: 8px 6px;
    border-radius: 10px;
    border: 1px solid rgba(42, 157, 143, 0.55);
    background: rgba(42, 157, 143, 0.16);
    color: #8fe0d4;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.tool-wizard-btn:hover {
    background: rgba(42, 157, 143, 0.3);
}

.tool-btn-alias {
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    transition: all 0.2s;
}

.tool-btn-alias:hover {
    background-color: var(--btn-hover);
    color: white;
}

/* Barra de flujo guiado */
.wizard-bar {
    display: none;
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    background: #1d3557;
    border: 1px solid rgba(158, 197, 245, 0.35);
    color: #fff;
    padding: 12px 16px;
    border-radius: 12px;
    z-index: 1300;
    width: min(92vw, 560px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
    flex-direction: column;
    gap: 8px;
}

.wizard-bar.show {
    display: flex;
}

.wizard-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #9ec5f5;
}

.wizard-hint {
    font-size: 13px;
    line-height: 1.45;
}

.wizard-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Menu de acciones extra (movil) */
.mobile-more-menu {
    display: none;
    position: fixed;
    top: 62px;
    right: 8px;
    background: #1c1c1c;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    z-index: 1400;
    min-width: 220px;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6);
    flex-direction: column;
    padding: 6px;
}

.mobile-more-menu.show {
    display: flex;
}

.mobile-more-menu button {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background: transparent;
    border: none;
    color: #dce7f5;
    font-size: 13px;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
}

.mobile-more-menu button:hover {
    background: rgba(74, 144, 226, 0.18);
}

#btnMoreActions {
    display: none;
}

@media (max-width: 768px) {
    /* Barra superior: iconos esenciales + menu ⋮; la regla de opacidad queda,
       pero compacta (sin etiqueta y con thumb tactil mas grande). */
    .top-center-area {
        padding: 0 6px;
    }

    .opacity-ruler-wrapper {
        padding: 4px 8px;
    }

    .ruler-label {
        display: none;
    }

    .opacity-ruler-wrapper input[type="range"] {
        height: 20px;
    }

    .opacity-ruler-wrapper input[type="range"]::-webkit-slider-thumb {
        height: 18px;
        width: 18px;
        margin-top: -8px;
    }

    .logo {
        width: auto;
        padding: 0 6px;
    }

    .brand-copy {
        display: none;
    }

    .session-badge {
        display: none !important;
    }

    .top-actions .icon-btn {
        display: none !important;
    }

    .top-actions #btnSaveCloud,
    .top-actions #btnSharePlan,
    .top-actions #btnFitImage,
    .top-actions #btnLogout,
    .top-actions #btnMoreActions {
        display: inline-flex !important;
    }

    /* Toolbar inferior: esenciales en fila; grupos abren un popover sobre la barra */
    .tool-essentials {
        flex-direction: row;
        gap: 8px;
    }

    .tool-group {
        width: auto;
        flex-direction: row;
    }

    .tool-group-toggle {
        width: auto;
        min-height: 42px;
        height: 42px;
        grid-template-columns: auto 17px;
        gap: 7px;
        padding: 0 9px 0 12px;
        border-radius: 12px;
        flex-shrink: 0;
        white-space: nowrap;
    }

    .tool-group-title {
        font-size: 9px;
        white-space: nowrap;
    }

    .tool-group-chevron {
        width: 17px;
        height: 17px;
        border-radius: 6px;
    }

    /* backdrop-filter en .right-sidebar crea un containing block que recorta
       cualquier position:fixed interno: por eso el grupo abierto NO flota,
       sino que la barra crece a dos filas (:has). */
    .right-sidebar:has(.tool-group.open) {
        height: auto;
    }

    .right-sidebar:has(.tool-group.open) .toolbar {
        height: auto;
        flex-wrap: wrap;
    }

    .tool-group-body {
        width: 100%;
        flex: 1 1 100%;
        order: 99;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        margin-top: 0;
        border: 1px solid rgba(var(--group-accent), 0.18);
        border-radius: 12px;
        padding: 8px 4px 2px;
        gap: 8px;
    }

    .tool-group-body .tool-btn,
    .tool-group-body .tool-btn-alias,
    .tool-group-body .tool-wizard-btn {
        flex-shrink: 0;
        width: auto;
    }

    .tool-wizard-btn {
        width: auto;
        white-space: nowrap;
    }

    .wizard-bar {
        bottom: calc(132px + env(safe-area-inset-bottom, 0px));
    }
}

/* ------------------------------------------------------------------ */
/* Mi cuenta (perfil premium) y panel admin con tabs                   */
/* ------------------------------------------------------------------ */

.account-box {
    max-width: 640px;
}

.account-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 4px;
}

.account-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    font-size: 12.5px;
    font-weight: 600;
    color: #9ba8ba;
    background: transparent;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.account-tab:hover {
    color: #e8edf4;
}

.account-tab.active {
    background: linear-gradient(135deg, #2f6fce, #4a90e2);
    color: #fff;
    box-shadow: 0 4px 14px rgba(74,144,226,0.35);
}

.account-pane {
    min-height: 120px;
}

.account-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(74,144,226,0.22), rgba(29,53,87,0.55));
    border: 1px solid rgba(74,144,226,0.35);
    margin-bottom: 12px;
}

.account-avatar {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #4a90e2, #1d3557);
    border: 2px solid rgba(255,255,255,0.25);
    text-transform: uppercase;
}

.account-header-info {
    flex: 1;
    min-width: 0;
}

.account-name {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-meta {
    font-size: 12px;
    color: #b9c4d3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.plan-badge {
    flex: 0 0 auto;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.plan-badge-trial {
    background: rgba(155,168,186,0.18);
    color: #c4cdd9;
    border: 1px solid rgba(155,168,186,0.4);
}

.plan-badge-pro {
    background: linear-gradient(135deg, #2f6fce, #4a90e2);
    color: #fff;
    box-shadow: 0 4px 14px rgba(74,144,226,0.4);
}

.plan-badge-team {
    background: linear-gradient(135deg, #b8860b, #e9c46a);
    color: #1a1a1a;
    box-shadow: 0 4px 14px rgba(233,196,106,0.35);
}

.account-plan-card {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
    margin-bottom: 12px;
}

.account-plan-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.plan-status-pill {
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: rgba(46,204,113,0.15);
    color: #2ecc71;
    border: 1px solid rgba(46,204,113,0.35);
}

.plan-status-pill.is-warning {
    background: rgba(233,196,106,0.15);
    color: #e9c46a;
    border-color: rgba(233,196,106,0.35);
}

.plan-status-pill.is-danger {
    background: rgba(230,57,70,0.15);
    color: #e63946;
    border-color: rgba(230,57,70,0.35);
}

.account-plan-date {
    font-size: 12px;
    color: #9ba8ba;
}

.account-usage {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.account-usage-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #c4cdd9;
    margin-bottom: 4px;
}

.account-progress {
    height: 8px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    overflow: hidden;
}

.account-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #2f6fce, #4a90e2);
    transition: width 0.3s ease;
}

.account-progress-fill.is-warning {
    background: linear-gradient(90deg, #b8860b, #e9c46a);
}

.account-progress-fill.is-danger {
    background: linear-gradient(90deg, #b02636, #e63946);
}

.account-features {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 6px 14px;
}

.account-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #dfe6ee;
}

.account-feature i {
    color: #2ecc71;
    font-size: 11px;
}

.account-feature.is-off {
    color: #66707f;
}

.account-feature.is-off i {
    color: #66707f;
}

.account-billing {
    margin-top: 14px;
    border-top: 1px solid #333;
    padding-top: 10px;
}

.account-billing-title {
    font-size: 12.5px;
    font-weight: 600;
    color: #c4cdd9;
    margin-bottom: 8px;
}

.account-billing-list {
    max-height: 160px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.account-billing-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    color: #c4cdd9;
    padding: 7px 10px;
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}

.account-billing-item .provider-tag {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.4px;
}

.account-billing-item .provider-tag.paddle {
    color: #e9c46a;
}

.account-billing-item .provider-tag.mp {
    color: #4a90e2;
}

.account-billing-empty {
    font-size: 12px;
    color: #66707f;
    text-align: center;
    padding: 8px;
}

/* Panel admin con tabs */

.admin-tabs {
    flex-wrap: wrap;
}

.admin-tabs .account-tab {
    flex: 1 1 30%;
}

.admin-pane {
    min-height: 160px;
}

.admin-search {
    width: 100%;
    box-sizing: border-box;
    margin: 10px 0 4px;
    padding: 8px 10px;
    background: #111;
    color: #fff;
    border: 1px solid #444;
    border-radius: 8px;
    font-size: 13px;
}

.admin-search:focus {
    outline: none;
    border-color: #4a90e2;
}

.admin-table-wrap {
    overflow-x: auto;
    font-size: 12px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #9ba8ba;
    padding: 6px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    white-space: nowrap;
}

.admin-table td {
    padding: 7px 8px;
    color: #dfe6ee;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    white-space: nowrap;
}

.admin-table tr:hover td {
    background: rgba(255,255,255,0.03);
}

.admin-table-empty {
    font-size: 12px;
    color: #66707f;
    text-align: center;
    padding: 12px;
}

.admin-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    background: rgba(155,168,186,0.15);
    color: #c4cdd9;
}

.admin-tag.status-active {
    background: rgba(46,204,113,0.15);
    color: #2ecc71;
}

.admin-tag.status-cancelled,
.admin-tag.status-past_due {
    background: rgba(230,57,70,0.15);
    color: #e63946;
}

.admin-tag.status-pending,
.admin-tag.status-trialing {
    background: rgba(233,196,106,0.15);
    color: #e9c46a;
}


/* Panel admin y modal de plantilla admin en movil (<= 768px) */
@media (max-width: 768px) {
    #usersAdminModal .calib-modal-box {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px));
    }

    #usersAdminModal .admin-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #usersAdminModal .admin-tabs .account-tab {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    #usersAdminModal .admin-ops-grid {
        grid-template-columns: 1fr;
    }

    #usersAdminModal .admin-summary-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    #templateAdminModal .calib-modal-box {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
        padding: 16px 14px;
    }
}

/* Barra de reemplazo de plantilla en el panel de planificacion */
.template-replace-bar {
    margin: 0 10px 8px;
    padding: 8px 10px;
    border: 1px solid rgba(127, 180, 255, 0.45);
    border-radius: 8px;
    background: rgba(127, 180, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-replace-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #c9d6ea;
    min-width: 0;
}

.template-replace-label i {
    color: #7fb4ff;
    flex: 0 0 auto;
}

.template-replace-label span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-replace-label strong {
    color: #f4f8fc;
}

.template-replace-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.template-replace-row input {
    flex: 1;
    min-width: 0;
    padding: 7px 10px;
    background: #111;
    color: #fff;
    border: 1px solid #444;
    border-radius: 6px;
    font-size: 12px;
}

.template-replace-row input:focus {
    outline: none;
    border-color: #7fb4ff;
}

.template-replace-cancel {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid #444;
    background: #111;
    color: #c4cdd9;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-replace-cancel:hover {
    background: rgba(230, 57, 70, 0.3);
    color: #fff;
}

.template-replace-bar.template-replace-done {
    border-color: rgba(46, 204, 113, 0.6);
    background: rgba(46, 204, 113, 0.12);
}

/* Panel de tallas anclado a la cabecera: por defecto solo existe el boton
   pequeno #btnTemplateSizes en la barra superior; al abrirlo despliega -/+,
   duplicar, espejo y la lista completa de tallas de la familia. */
.template-size-panel {
    position: fixed;
    top: 72px;
    left: 50%;
    width: min(92vw, 340px);
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(73, 139, 230, 0.35);
    background: rgba(25, 31, 42, 0.22);
    backdrop-filter: blur(6px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-size-panel-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.template-size-panel-current {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #d8e9ff;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95), 0 0 2px rgba(0, 0, 0, 0.8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-size-pill-sep {
    width: 1px;
    height: 20px;
    background: #3a4358;
    flex: 0 0 auto;
}

.template-size-menu {
    overflow-y: auto;
    padding: 4px;
    border-radius: 10px;
    border: 1px solid rgba(73, 139, 230, 0.2);
    background: rgba(17, 21, 30, 0.1);
    max-height: min(45vh, 360px);
}

.template-size-menu-item {
    display: block;
    width: 100%;
    padding: 7px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #f0f5fc;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95), 0 0 2px rgba(0, 0, 0, 0.8);
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}

.template-size-menu-item:hover {
    background: rgba(127, 180, 255, 0.15);
    color: #fff;
}

.template-size-menu-item.is-current {
    background: rgba(127, 180, 255, 0.28);
    color: #cfe3ff;
    font-weight: 700;
}

.template-size-stepper {
    justify-content: space-between;
}

.template-size-btn {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid rgba(120, 130, 150, 0.5);
    background: rgba(17, 17, 17, 0.25);
    color: #e8eef7;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-size-btn:hover:not(:disabled) {
    background: rgba(127, 180, 255, 0.2);
    color: #fff;
}

.template-size-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

.template-size-label {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #7fb4ff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-templates-list.replace-mode .template-item {
    cursor: pointer;
}

.sidebar-templates-list.replace-mode .template-item:hover {
    background-color: rgba(127, 180, 255, 0.1);
}

/* Modal para elegir vista AP/LAT al insertar una plantilla con par */
.template-view-box {
    width: min(380px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
}

.template-view-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.template-view-actions .calib-btn {
    width: 100%;
    padding: 12px;
    font-size: 14px;
}


/* Gestor de plantillas del panel admin (sub-pestanas dentro de Sistema) */
.admin-subtabs {
    padding: 3px;
    gap: 4px;
    margin-bottom: 12px;
}

.admin-subtabs .account-tab {
    flex: 0 0 auto;
    padding: 6px 14px;
    font-size: 12px;
}

.tpl-admin-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.tpl-admin-head-main > strong {
    display: block;
    font-size: 16px;
    color: #eef6ff;
    margin-bottom: 10px;
    letter-spacing: 0.02em;
}

.tpl-admin-new-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 6px 18px rgba(74, 144, 226, 0.35);
}

.tpl-admin-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tpl-admin-stat {
    min-width: 92px;
    padding: 9px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tpl-admin-stat-value {
    font-size: 21px;
    font-weight: 800;
    color: #f4f8fc;
    line-height: 1.1;
}

.tpl-admin-stat-label {
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7f8fa3;
}

.tpl-admin-toolbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.tpl-admin-search {
    margin: 0;
}

.tpl-admin-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tpl-admin-filter {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #9ba8ba;
    border-radius: 999px;
    padding: 6px 13px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.tpl-admin-filter:hover {
    color: #e8edf4;
    border-color: rgba(127, 180, 255, 0.4);
}

.tpl-admin-filter.active {
    background: linear-gradient(135deg, #2f6fce, #4a90e2);
    border-color: transparent;
    color: #fff;
}

.tpl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 12px;
    max-height: none;
    margin-top: 0;
    margin-bottom: 0;
}

.tpl-grid .sidebar-empty-state {
    grid-column: 1 / -1;
}

.tpl-card {
    --tpl-accent: #7fb4ff;
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 3px solid var(--tpl-accent);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.tpl-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.16);
    border-top-color: var(--tpl-accent);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.5);
}

.tpl-thumbs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1px;
    background: rgba(255, 255, 255, 0.06);
}

.tpl-thumbs.is-pair {
    grid-template-columns: 1fr 1fr;
}

.tpl-thumb {
    position: relative;
    height: 118px;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(127, 180, 255, 0.12), transparent 70%),
        #10131c;
    padding: 10px;
}

.tpl-thumb img {
    /* Caja definida (no max-width/max-height): sin ella el <img> mide 0x0
       hasta cargar y la carga diferida no dispara nunca. object-fit:contain
       mantiene la proporcion igual que antes. */
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
}

.tpl-thumb-tag {
    position: absolute;
    top: 6px;
    left: 6px;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #c9d6ea;
}

.tpl-card-body {
    padding: 11px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.tpl-card-name {
    font-size: 13px;
    font-weight: 700;
    color: #f4f8fc;
    line-height: 1.3;
}

.tpl-card-meta {
    font-size: 11px;
    color: #8d99ab;
    line-height: 1.45;
}

.tpl-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 2px;
}

.tpl-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: #c4cdd9;
}

.tpl-badge-view {
    background: rgba(127, 180, 255, 0.08);
}

.tpl-badge-size {
    color: #9fc4ff;
    border-color: rgba(127, 180, 255, 0.28);
    background: rgba(127, 180, 255, 0.07);
}

.tpl-badge-shared {
    color: #2ecc71;
    border-color: rgba(46, 204, 113, 0.3);
    background: rgba(46, 204, 113, 0.1);
}

.tpl-badge-private {
    color: #9ba8ba;
    border-color: rgba(155, 168, 186, 0.25);
    background: rgba(155, 168, 186, 0.08);
}

.tpl-badge-owner {
    color: #e9c46a;
    border-color: rgba(233, 196, 106, 0.3);
    background: rgba(233, 196, 106, 0.08);
}

.tpl-card-actions {
    display: flex;
    gap: 8px;
    padding: 10px 12px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.tpl-card-actions .user-admin-btn {
    flex: 1;
}

@media (max-width: 768px) {
    .admin-subtabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-subtabs .account-tab {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .tpl-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .tpl-thumb {
        height: 96px;
    }

    .tpl-admin-head {
        flex-direction: column;
        align-items: stretch;
    }

    .tpl-admin-new-btn {
        justify-content: center;
    }
}


/* Boton "Insertar plantilla" en la topbar */
.template-picker-btn {
    width: auto;
    padding: 0 12px;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    color: #c9d6ea;
    border-color: rgba(127, 180, 255, 0.28);
    background: rgba(127, 180, 255, 0.08);
    flex: 0 0 auto;
}

.template-picker-btn:hover {
    color: #fff;
    background: rgba(74, 144, 226, 0.2);
    border-color: rgba(74, 144, 226, 0.45);
}

.template-picker-btn i {
    color: #7fb4ff;
}

@media (max-width: 1400px) {
    .template-picker-btn {
        width: 34px;
        padding: 0;
    }

    .template-picker-btn-label {
        display: none;
    }
}

/* En movil la topbar oculta casi todos los iconos: este queda visible. */
@media (max-width: 768px) {
    .top-actions #btnOpenTemplatePicker {
        display: inline-flex !important;
    }
}

/* Modal flotante del picker de plantillas */
.template-picker-box {
    width: min(860px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    max-height: min(86dvh, 760px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.template-picker-toolbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-picker-toolbar .tpl-admin-search {
    margin: 0;
}

.template-picker-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    max-height: 56dvh;
    overflow-y: auto;
    padding-right: 4px;
}

.tpl-picker-card {
    cursor: pointer;
}

.tpl-picker-card:hover {
    border-color: var(--tpl-accent);
}

@media (max-width: 768px) {
    .template-picker-box {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        max-height: calc(100dvh - 16px);
        padding: 16px 14px;
    }

    .template-picker-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        /* NO usar max-height:none aqui: el modal queda con altura fija
           (100dvh) y el grid, estirado por flex, recibe altura definida;
           con ella Chrome "ajusta" las filas auto al contenedor y las
           tarjetas colapsan a lineas. Con max-height el grid se dimensiona
           por contenido (con tope) y hace scroll interno como en desktop. */
        max-height: 56dvh;
    }
}


/* Calibracion por referencia anatomica estandar */
.std-calib-box {
    width: min(480px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
}

.std-calib-refs {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.std-calib-ref {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.std-calib-ref:hover {
    border-color: rgba(127, 180, 255, 0.4);
}

.std-calib-ref:has(input[type="radio"]:checked) {
    border-color: #4a90e2;
    background: rgba(74, 144, 226, 0.12);
}

.std-calib-ref input[type="radio"] {
    accent-color: #4a90e2;
    margin: 0;
    flex: 0 0 auto;
}

.std-calib-ref-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: #e8edf4;
}

.std-calib-ref-mm {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #9ba8ba;
}

.std-calib-mm {
    width: 72px;
    padding: 6px 8px;
    background: #111;
    color: #fff;
    border: 1px solid #444;
    border-radius: 6px;
    font-size: 13px;
    text-align: right;
}

.std-calib-mm:focus {
    outline: none;
    border-color: #4a90e2;
}

.std-calib-note {
    font-size: 11.5px;
    line-height: 1.5;
    color: #e9c46a;
    background: rgba(233, 196, 106, 0.08);
    border: 1px solid rgba(233, 196, 106, 0.25);
    border-radius: 8px;
    padding: 8px 10px;
    margin: 0;
}

.std-calib-actions {
    display: flex;
    gap: 10px;
}

.std-calib-actions .calib-btn {
    flex: 1;
    padding: 12px;
    font-size: 13px;
}

.calib-std-ref-select {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 10px;
    background: #111;
    color: #fff;
    border: 1px solid #444;
    border-radius: 8px;
    font-size: 13px;
}

.calib-std-ref-select:focus {
    outline: none;
    border-color: #4a90e2;
}

@media (max-width: 768px) {
    .std-calib-box {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        padding: 16px 14px;
    }

    .std-calib-actions {
        flex-direction: column-reverse;
    }
}

.tool-btn:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* ============================================================
   Plan quirurgico (ventana flotante sobre el canvas)
   ============================================================ */
.surgical-plan-window {
    --surgical-font-size: 12px;
    position: fixed;
    top: 80px;
    right: 170px;
    width: 340px;
    max-width: 90vw;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
    z-index: 500;
    overflow: hidden;
}

.surgical-plan-window[hidden] {
    display: none;
}

.surgical-plan-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    cursor: grab;
    user-select: none;
    touch-action: none;
    flex-shrink: 0;
}

.surgical-plan-window-header.is-dragging {
    cursor: grabbing;
}

.surgical-plan-window-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.surgical-plan-window-title i {
    color: var(--accent-blue);
    margin-right: 4px;
}

.surgical-plan-window-controls {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.surgical-font-sizes {
    display: flex;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    overflow: hidden;
}

.surgical-font-size-btn {
    border: none;
    background: var(--btn-bg);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    cursor: pointer;
}

.surgical-font-size-btn + .surgical-font-size-btn {
    border-left: 1px solid var(--border-color);
}

.surgical-font-size-btn:hover {
    background: var(--btn-hover);
    color: #fff;
}

.surgical-font-size-btn.is-active {
    background: var(--accent-blue);
    color: #fff;
}

.surgical-plan-window-btn {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--btn-bg);
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.surgical-plan-window-btn:hover {
    background: var(--btn-hover);
    color: #fff;
}

.surgical-plan-window-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    overflow-y: auto;
    min-height: 0;
}

.surgical-plan-window.is-minimized .surgical-plan-window-body {
    display: none;
}

.surgical-steps-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.surgical-step {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 5px 7px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.surgical-step-main {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.surgical-step-num {
    font-size: calc(var(--surgical-font-size) * 0.8);
    font-weight: 700;
    color: var(--text-muted);
    min-width: 16px;
    text-align: right;
    flex-shrink: 0;
}

.surgical-step-done {
    accent-color: #34d399;
    margin: 0;
    flex-shrink: 0;
}

.surgical-step-text {
    flex: 1;
    min-width: 0;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--text-main);
    font-size: var(--surgical-font-size);
    padding: 4px 6px;
}

.surgical-step-text:focus {
    outline: none;
    border-color: #4a90e2;
}

.surgical-step.is-done .surgical-step-text {
    text-decoration: line-through;
    opacity: 0.65;
}

.surgical-step-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.surgical-step-btn {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--btn-bg);
    color: var(--text-muted);
    font-size: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.surgical-step-btn:hover {
    background: var(--btn-hover);
    color: #fff;
}

.surgical-step-btn:disabled {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.surgical-plan-add-btn {
    width: 100%;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-muted);
    font-size: 11px;
    padding: 6px 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.surgical-plan-add-btn:hover {
    background: var(--btn-hover);
    color: #fff;
}

.surgical-plan-export-btn {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--btn-bg);
    color: var(--text-main);
    font-size: 11px;
    padding: 7px 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.surgical-plan-export-btn i {
    color: #f87171;
}

.surgical-plan-export-btn:hover {
    background: var(--btn-hover);
    color: #fff;
}
