/**
 * Organization visual identity — CSS variables only.
 * Apply via body class: org-theme-lab | org-theme-imaging | org-theme-default
 */

:root,
.org-theme-default {
    --org-primary: #0e7f8f;
    --org-primary-dark: #0a6a78;
    --org-accent: #22c1d6;
    --org-accent-soft: #e8f7f9;
    --org-surface: #f4f6f9;
    --org-topbar-bg: linear-gradient(135deg, #0e7f8f 0%, #0a6a78 100%);
    --org-chip-bg: linear-gradient(135deg, rgba(14, 127, 143, .55), rgba(34, 193, 214, .35));
    --org-chip-border: rgba(34, 193, 214, .45);
    --org-chip-dot: #22c1d6;
    --org-card-accent: rgba(14, 127, 143, .12);
    --org-report-accent: #0e7f8f;
    --org-btn-shadow: rgba(14, 127, 143, .22);
}

.org-theme-lab {
    --org-primary: #0e7f8f;
    --org-primary-dark: #0a6a78;
    --org-accent: #22c1d6;
    --org-accent-soft: #e8f7f9;
    --org-surface: #eef7f9;
    --org-topbar-bg: linear-gradient(135deg, #0e7f8f 0%, #119aad 48%, #22c1d6 100%);
    --org-chip-bg: linear-gradient(135deg, rgba(14, 127, 143, .62), rgba(34, 193, 214, .4));
    --org-chip-border: rgba(34, 193, 214, .5);
    --org-chip-dot: #22c1d6;
    --org-card-accent: rgba(14, 127, 143, .14);
    --org-report-accent: #0e7f8f;
    --org-btn-shadow: rgba(14, 127, 143, .24);
}

.org-theme-imaging {
    --org-primary: #4338ca;
    --org-primary-dark: #3730a3;
    --org-accent: #818cf8;
    --org-accent-soft: #eef2ff;
    --org-surface: #f5f3ff;
    --org-topbar-bg: linear-gradient(135deg, #4338ca 0%, #4f46e5 50%, #6366f1 100%);
    --org-chip-bg: linear-gradient(135deg, rgba(67, 56, 202, .62), rgba(99, 102, 241, .42));
    --org-chip-border: rgba(129, 140, 248, .5);
    --org-chip-dot: #a5b4fc;
    --org-card-accent: rgba(67, 56, 202, .12);
    --org-report-accent: #4338ca;
    --org-btn-shadow: rgba(67, 56, 202, .24);
}

/* Topbar & navigation */
body[class*="org-theme-"] .topbar {
    background: var(--org-topbar-bg);
}

body[class*="org-theme-"] .sidebar .nav-link.active {
    background: var(--org-primary);
    color: #fff;
}

body[class*="org-theme-"] .sidebar .nav-link:hover {
    background: var(--org-accent-soft);
    color: var(--org-primary-dark);
}

body[class*="org-theme-"] {
    background: var(--org-surface);
}

/* Buttons */
body[class*="org-theme-"] .btn-primary,
body[class*="org-theme-"] .org-btn-primary {
    background-color: var(--org-primary);
    border-color: var(--org-primary);
}

body[class*="org-theme-"] .btn-primary:hover,
body[class*="org-theme-"] .btn-primary:focus,
body[class*="org-theme-"] .org-btn-primary:hover {
    background-color: var(--org-primary-dark);
    border-color: var(--org-primary-dark);
}

body[class*="org-theme-"] .btn-outline-primary {
    color: var(--org-primary);
    border-color: var(--org-primary);
}

body[class*="org-theme-"] .btn-outline-primary:hover {
    background: var(--org-primary);
    border-color: var(--org-primary);
}

/* Cards & highlights */
body[class*="org-theme-"] .desktop-card,
body[class*="org-theme-"] .org-highlight-card {
    border-color: color-mix(in srgb, var(--org-primary) 18%, #d8dde3);
}

body[class*="org-theme-"] .org-highlight-card {
    background: linear-gradient(180deg, #fff 0%, var(--org-accent-soft) 100%);
}

body[class*="org-theme-"] .summary-value {
    color: var(--org-primary-dark);
}

/* Org chip (topbar) */
body[class*="org-theme-"] .org-context-chip {
    background: var(--org-chip-bg);
    border-color: var(--org-chip-border);
}

body[class*="org-theme-"] .org-context-chip__dot {
    background: var(--org-chip-dot);
}

/* Identity strip under topbar */
.org-identity-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--org-primary-dark);
    background: var(--org-accent-soft);
    border-bottom: 1px solid color-mix(in srgb, var(--org-primary) 20%, transparent);
}

.org-identity-strip__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--org-accent);
    flex-shrink: 0;
}

/* Report / receipt accents */
.org-document-label {
    font-size: 11px;
    color: var(--org-primary-dark);
    margin-bottom: 6px;
    padding: 4px 10px;
    border-left: 3px solid var(--org-report-accent);
    background: var(--org-accent-soft);
    border-radius: 0 6px 6px 0;
}

.org-document-label strong {
    color: var(--org-primary);
}

.scan-shell .scan-head {
    border-left: 4px solid var(--org-report-accent);
}

.bill-header {
    border-bottom-color: var(--org-report-accent) !important;
}

/* Badges */
body[class*="org-theme-"] .badge.bg-org {
    background: var(--org-primary) !important;
}

body[class*="org-theme-"] .badge.bg-org-soft {
    background: var(--org-accent-soft) !important;
    color: var(--org-primary-dark) !important;
}

/* Organization select screen */
body[class*="org-theme-"] .org-select-submit {
    background: linear-gradient(135deg, var(--org-primary), var(--org-primary-dark));
    box-shadow: 0 12px 28px var(--org-btn-shadow);
}

/* Status pills / badges in operational UI */
body[class*="org-theme-"] .badge-org-pill,
body[class*="org-theme-"] .org-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    background: var(--org-accent-soft);
    color: var(--org-primary-dark);
    border: 1px solid color-mix(in srgb, var(--org-primary) 22%, transparent);
}

body[class*="org-theme-"] .table .table-active,
body[class*="org-theme-"] .list-group-item.active {
    background-color: var(--org-primary);
    border-color: var(--org-primary);
}

/* Super Admin — MRI / imaging center only (violet); lab keeps default teal console */
body.ceo-console.org-theme-imaging {
    background: #f5f3ff;
}

body.ceo-console.org-theme-imaging .ceo-sidebar {
    background: linear-gradient(180deg, #1e1b4b, #3730a3 48%, #4f46e5 100%);
}

body.ceo-console.org-theme-imaging .ceo-top {
    background: linear-gradient(135deg, #312e81, #4338ca 50%, #6366f1 100%);
    box-shadow: 0 14px 38px rgba(67, 56, 202, .28);
}

body.ceo-console.org-theme-imaging .ceo-nav a:hover,
body.ceo-console.org-theme-imaging .ceo-nav a.active {
    background: rgba(165, 180, 252, .2);
    color: #fff;
}

body.ceo-console.org-theme-imaging .org-context-chip {
    background: linear-gradient(135deg, rgba(67, 56, 202, .55), rgba(99, 102, 241, .4));
    border-color: rgba(129, 140, 248, .45);
}

body.ceo-console.org-theme-imaging .org-context-chip__dot {
    background: #a5b4fc;
}

body.ceo-console.org-theme-imaging .g1 {
    background: linear-gradient(135deg, #4338ca, #818cf8);
}

body.ceo-console.org-theme-imaging .g2 {
    background: linear-gradient(135deg, #3730a3, #6366f1);
}

body.ceo-console.org-theme-imaging .pill {
    background: #eef2ff;
    color: #3730a3;
}

body.ceo-console.org-theme-imaging .activity-item {
    border-left-color: #4338ca;
}

/* “Organization set to …” flash after switching to MRI center */
body.ceo-console.org-theme-imaging .alert-success {
    background-color: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
}

/* Mobile */
@media (max-width: 767.98px) {
    body[class*="org-theme-"] {
        background: var(--org-surface);
    }

    .org-identity-strip {
        font-size: 10px;
        padding: 5px 12px;
    }
}

/* Print — hide app chrome (org strip was printing "MRI • CT • X-Ray" on reports) */
@media print {
    .org-identity-strip,
    nav.topbar,
    .navbar.topbar,
    .app-sidebar,
    .sidebar-backdrop,
    .app-menu-toggle,
    .sidebar-mobile-head {
        display: none !important;
        height: 0 !important;
        visibility: hidden !important;
    }
}
