/*
 * SCMS command-layout palettes.
 * Clinical Command keeps its original dark styling. Clinical Light and
 * Medical Emerald only replace colours, so all three themes share one layout.
 */

.theme-clinical-light {
    --scms-page: #eaf5f8;
    --scms-panel: #ffffff;
    --scms-panel-soft: #f3f9fb;
    --scms-panel-strong: #dceff4;
    --scms-heading: #073b5c;
    --scms-accent: #0097a7;
    --scms-bright: #00b8d4;
    --scms-success: #0a9b6a;
    --scms-warning: #e59a13;
    --scms-danger: #c93c55;
    --scms-text: #18323f;
    --scms-muted: #607d89;
    --scms-border: #b8d9e3;
    --scms-shadow: rgba(7, 59, 92, .12);
}

.theme-medical-emerald {
    --scms-page: #ecf4ef;
    --scms-panel: #fffef7;
    --scms-panel-soft: #f4f8f1;
    --scms-panel-strong: #deeee6;
    --scms-heading: #073d32;
    --scms-accent: #078c6b;
    --scms-bright: #2dd4a8;
    --scms-success: #16845b;
    --scms-warning: #d99a22;
    --scms-danger: #c94c5d;
    --scms-text: #173b32;
    --scms-muted: #617b72;
    --scms-border: #b9d8cb;
    --scms-shadow: rgba(7, 61, 50, .12);
}

.theme-clinical-light.clinical-command-shell,
.theme-medical-emerald.clinical-command-shell {
    background: var(--scms-page);
    color: var(--scms-text);
}

.theme-clinical-light.clinical-command-shell .navbar,
.theme-medical-emerald.clinical-command-shell .navbar {
    background: linear-gradient(90deg, var(--scms-heading), var(--scms-accent)) !important;
    border-bottom-color: var(--scms-bright);
}

.theme-clinical-light.clinical-command-shell .navbar .navbar-brand,
.theme-medical-emerald.clinical-command-shell .navbar .navbar-brand {
    text-shadow: 0 0 10px rgba(45, 212, 168, .45);
}

.theme-clinical-light.clinical-command-shell .navbar .dropdown-menu,
.theme-medical-emerald.clinical-command-shell .navbar .dropdown-menu {
    border-color: var(--scms-accent);
}

.theme-clinical-light .clinical-command,
.theme-clinical-light .cc-page,
.theme-clinical-light .cc-clinical-data,
.theme-medical-emerald .clinical-command,
.theme-medical-emerald .cc-page,
.theme-medical-emerald .cc-clinical-data {
    --cc-bg: var(--scms-page);
    --cc-panel: var(--scms-panel);
    --cc-panel2: var(--scms-panel-soft);
    --cc-line: var(--scms-border);
    --cc-cyan: var(--scms-accent);
    --cc-blue: var(--scms-bright);
    --cc-green: var(--scms-success);
    --cc-pink: var(--scms-danger);
    --cc-yellow: var(--scms-warning);
    --cc-text: var(--scms-text);
    --cc-muted: var(--scms-muted);
    background: linear-gradient(145deg, var(--scms-page), var(--scms-panel-soft));
    color: var(--scms-text);
    box-shadow: 0 8px 26px var(--scms-shadow);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-panel, .card),
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-panel, .card) {
    background: var(--scms-panel);
    border-color: var(--scms-border);
    color: var(--scms-text);
    box-shadow: 0 5px 18px var(--scms-shadow);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-panel-head, .card-header),
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-panel-head, .card-header) {
    background: var(--scms-panel-soft);
    border-color: var(--scms-border);
    color: var(--scms-heading);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-title, .card-header h3, .card-header h4, .card-header h5),
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-title, .card-header h3, .card-header h4, .card-header h5) {
    color: var(--scms-accent);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-stat, .ccd-stat, .cc-vital, .cc-metric, .ccd-alert, .ccd-quick a, .cc-latest-summary),
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-stat, .ccd-stat, .cc-vital, .cc-metric, .ccd-alert, .ccd-quick a, .cc-latest-summary) {
    background: var(--scms-panel-soft);
    border-color: var(--scms-border);
    color: var(--scms-text);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-patient-name, .cc-disease, .cc-summary-primary, .ccd-number),
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-patient-name, .cc-disease, .cc-summary-primary, .ccd-number) {
    color: var(--scms-heading);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-description, .cc-summary-treatment, label),
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-description, .cc-summary-treatment, label) {
    color: var(--scms-text);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-detail, .cc-info, .cc-diagnosis, .cc-table th, .cc-table td, .table th, .table td),
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-detail, .cc-info, .cc-diagnosis, .cc-table th, .cc-table td, .table th, .table td) {
    border-color: var(--scms-border);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-table th, .table th),
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-table th, .table th) {
    background: var(--scms-panel-strong);
    color: var(--scms-heading);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-table tbody tr:hover, .table tbody tr:hover),
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.cc-table tbody tr:hover, .table tbody tr:hover) {
    background: var(--scms-panel-strong);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) .cc-treatment,
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) .cc-treatment {
    background: var(--scms-panel-soft);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.form-control, .select2-selection),
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) :is(.form-control, .select2-selection) {
    background: #fff;
    border-color: var(--scms-border);
    color: var(--scms-text);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) .modal-content,
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) .modal-content {
    background: var(--scms-panel);
    border-color: var(--scms-border);
    color: var(--scms-text);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) .close,
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) .close {
    color: var(--scms-heading);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) .page-link,
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) .page-link {
    background: var(--scms-panel);
    border-color: var(--scms-border);
    color: var(--scms-accent);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) .page-item.active .page-link,
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) .page-item.active .page-link {
    background: var(--scms-accent);
    border-color: var(--scms-accent);
    color: #fff;
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) .btn-success,
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) .btn-success {
    background: var(--scms-success);
    border-color: var(--scms-success);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) .btn-warning,
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) .btn-warning {
    background: var(--scms-warning);
    border-color: var(--scms-warning);
}

.theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data) .btn-danger,
.theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) .btn-danger {
    background: var(--scms-danger);
    border-color: var(--scms-danger);
}

/* Non-patient command modules inherit the selected light palette too. */
.theme-clinical-light :is(.fa-card, .fa-rules-page, .fa-rules-page .card, .ic-card),
.theme-medical-emerald :is(.fa-card, .fa-rules-page, .fa-rules-page .card, .ic-card) {
    background: var(--scms-panel);
    border-color: var(--scms-border);
    color: var(--scms-text);
}

.theme-clinical-light :is(.fa-card h2, .fa-rules-page .fa-head h1, .fa-rules-page label, .ic-list a),
.theme-medical-emerald :is(.fa-card h2, .fa-rules-page .fa-head h1, .fa-rules-page label, .ic-list a) {
    color: var(--scms-heading);
}

.theme-clinical-light :is(.fa-card p, .fa-rules-page .fa-head p),
.theme-medical-emerald :is(.fa-card p, .fa-rules-page .fa-head p) {
    color: var(--scms-muted);
}

.theme-clinical-light .ic-list a:hover,
.theme-clinical-light .ic-msg,
.theme-medical-emerald .ic-list a:hover,
.theme-medical-emerald .ic-msg {
    background: var(--scms-panel-strong);
    color: var(--scms-text);
}

.theme-clinical-light .ic-msg.mine,
.theme-medical-emerald .ic-msg.mine {
    background: var(--scms-accent);
    color: #fff;
}

@media print {
    .theme-clinical-light.clinical-command-shell,
    .theme-medical-emerald.clinical-command-shell,
    .theme-clinical-light :is(.clinical-command, .cc-page, .cc-clinical-data),
    .theme-medical-emerald :is(.clinical-command, .cc-page, .cc-clinical-data) {
        background: #fff !important;
        color: #000 !important;
        box-shadow: none !important;
    }
}

/* Stable Bootstrap-compatible patient pagination for every theme. */
.scms-patient-pagination {
    width: 100%;
    padding: 16px 8px 4px;
    text-align: center;
}

.scms-pagination-summary {
    color: #617b89;
    font-size: .82rem;
    margin-bottom: 10px;
}

.scms-patient-pagination .pagination {
    display: flex !important;
    gap: 3px;
}

.scms-patient-pagination .page-link {
    min-width: 38px;
    color: #087da5;
    background: #fff;
    border: 1px solid #b8d4dc;
    border-radius: 6px;
}

.scms-patient-pagination .page-item.active .page-link {
    background: #087da5;
    border-color: #087da5;
    color: #fff;
}

.scms-patient-pagination .page-item.disabled .page-link {
    color: #8ca0aa;
    background: #eef3f5;
}

.clinical-command-shell .scms-pagination-summary { color: var(--cc-muted, #9bc8d8); }
.clinical-command-shell .scms-patient-pagination .page-link {
    color: var(--cc-cyan, #22e7ff);
    background: var(--cc-panel, #05233d);
    border-color: var(--cc-line, #087da5);
}
.clinical-command-shell .scms-patient-pagination .page-item.active .page-link {
    color: #fff;
    background: var(--cc-cyan, #087da5);
    border-color: var(--cc-cyan, #087da5);
}
.clinical-command-shell .scms-patient-pagination .page-item.disabled .page-link {
    color: var(--cc-muted, #9bc8d8);
    background: var(--cc-panel2, #073252);
}

/* HR shares one layout; these layers replace only its colours. */
body:not(.clinical-command-shell) .hr-command,
.theme-clinical-light .hr-command,
.theme-medical-emerald .hr-command {
    --hr-page: #f4f7f9;
    --hr-panel: #ffffff;
    --hr-soft: #edf4f7;
    --hr-line: #c7dce4;
    --hr-accent: #087da5;
    --hr-heading: #073f65;
    --hr-text: #173446;
    --hr-muted: #617b89;
    background: var(--hr-page) !important;
    color: var(--hr-text) !important;
}

.theme-clinical-light .hr-command {
    --hr-page: #eaf5f8;
    --hr-panel: #ffffff;
    --hr-soft: #f3f9fb;
    --hr-line: #b8d9e3;
    --hr-accent: #0097a7;
    --hr-heading: #073b5c;
    --hr-text: #18323f;
    --hr-muted: #607d89;
}

.theme-medical-emerald .hr-command {
    --hr-page: #ecf4ef;
    --hr-panel: #fffef7;
    --hr-soft: #f4f8f1;
    --hr-line: #b9d8cb;
    --hr-accent: #078c6b;
    --hr-heading: #073d32;
    --hr-text: #173b32;
    --hr-muted: #617b72;
}

body:not(.clinical-command-shell) .hr-command .card,
.theme-clinical-light .hr-command .card,
.theme-medical-emerald .hr-command .card,
body:not(.clinical-command-shell) .hr-command .hr-action-panel,
.theme-clinical-light .hr-command .hr-action-panel,
.theme-medical-emerald .hr-command .hr-action-panel {
    background: var(--hr-panel) !important;
    border-color: var(--hr-line) !important;
    color: var(--hr-text) !important;
}

body:not(.clinical-command-shell) .hr-command .card-header,
.theme-clinical-light .hr-command .card-header,
.theme-medical-emerald .hr-command .card-header,
body:not(.clinical-command-shell) .hr-command .card-footer,
.theme-clinical-light .hr-command .card-footer,
.theme-medical-emerald .hr-command .card-footer {
    background: var(--hr-soft) !important;
    border-color: var(--hr-line) !important;
    color: var(--hr-heading) !important;
}

body:not(.clinical-command-shell) .hr-command :is(.hr-title, .hr-section-title, .hr-stat-number),
.theme-clinical-light .hr-command :is(.hr-title, .hr-section-title, .hr-stat-number),
.theme-medical-emerald .hr-command :is(.hr-title, .hr-section-title, .hr-stat-number) {
    color: var(--hr-heading) !important;
}

body:not(.clinical-command-shell) .hr-command :is(.hr-kicker, .hr-stat-icon, .btn-outline-info),
.theme-clinical-light .hr-command :is(.hr-kicker, .hr-stat-icon, .btn-outline-info),
.theme-medical-emerald .hr-command :is(.hr-kicker, .hr-stat-icon, .btn-outline-info) {
    color: var(--hr-accent) !important;
    border-color: var(--hr-accent) !important;
}

body:not(.clinical-command-shell) .hr-command :is(.text-muted, .hr-stat-label),
.theme-clinical-light .hr-command :is(.text-muted, .hr-stat-label),
.theme-medical-emerald .hr-command :is(.text-muted, .hr-stat-label) {
    color: var(--hr-muted) !important;
}

body:not(.clinical-command-shell) .hr-command .table,
.theme-clinical-light .hr-command .table,
.theme-medical-emerald .hr-command .table {
    background: var(--hr-panel) !important;
    color: var(--hr-text) !important;
}

body:not(.clinical-command-shell) .hr-command .table th,
.theme-clinical-light .hr-command .table th,
.theme-medical-emerald .hr-command .table th {
    background: var(--hr-soft) !important;
    border-color: var(--hr-line) !important;
    color: var(--hr-heading) !important;
}

body:not(.clinical-command-shell) .hr-command .table td,
.theme-clinical-light .hr-command .table td,
.theme-medical-emerald .hr-command .table td {
    background: var(--hr-panel) !important;
    border-color: var(--hr-line) !important;
    color: var(--hr-text) !important;
}

body:not(.clinical-command-shell) .hr-command :is(.form-control, .custom-select),
.theme-clinical-light .hr-command :is(.form-control, .custom-select),
.theme-medical-emerald .hr-command :is(.form-control, .custom-select) {
    background: #fff !important;
    border-color: var(--hr-line) !important;
    color: var(--hr-text) !important;
}

@media print {
    .hr-command { background:#fff!important; color:#000!important; }
}
