﻿/* =========================================================
   OT MODULE (OPERATION THEATRE)
   Every selector is scoped under .otm-module so it cannot
   affect other HMIS modules. Icons: MDI. Base UI: Bootstrap 5.
   Tweak --otm-offset if your app top bar is not 64px tall.
   ========================================================= */
.otm-module {
    --otm-primary: #5b4fe5;
    --otm-primary-dark: #3d33b0;
    --otm-primary-soft: #edebff;
    --otm-ink: #101827;
    --otm-ink-soft: #667085;
    --otm-ink-faint: #94a0b4;
    --otm-border: #e2e6ed;
    --otm-border-soft: #eef0f5;
    --otm-surface: #ffffff;
    --otm-muted: #f8f9fc;
    --otm-bg: #f2f3fa;
    --otm-blue: #2563eb;
    --otm-blue-soft: #e5edff;
    --otm-green: #059669;
    --otm-green-soft: #d1fae5;
    --otm-amber: #d97706;
    --otm-amber-soft: #fef3c7;
    --otm-red: #e11d48;
    --otm-red-soft: #ffe4e9;
    --otm-violet: #7c3aed;
    --otm-violet-soft: #ede9fe;
    --otm-radius: 14px;
    --otm-radius-sm: 9px;
    --otm-shadow: 0 1px 2px rgba(16,24,39,.04), 0 6px 16px rgba(16,24,39,.05);
    --otm-offset: 64px;
    /* dialog stacking order — raise this if your app's own header/nav still
       overlaps the dialog (it must be higher than that element's z-index) */
    --otm-z-overlay: 9999;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    height: calc(100vh - var(--otm-offset));
    padding: 12px;
    overflow: hidden;
    background: var(--otm-bg);
    color: var(--otm-ink);
    font-size: 13px;
    box-sizing: border-box;
}

    .otm-module *, .otm-module *::before, .otm-module *::after {
        box-sizing: border-box;
    }

    .otm-module a {
        text-decoration: none;
    }

    .otm-module h3,
    .otm-module h4,
    .otm-module h5,
    .otm-module h6 {
        margin: 0;
        color: var(--otm-ink);
    }

    .otm-module p {
        margin: 0;
    }

    .otm-module button,
    .otm-module input,
    .otm-module select,
    .otm-module textarea {
        font-family: inherit;
    }

    /* =========================================================
   TOP BAR : brand + tabs + actions  (one row, one card)
   ========================================================= */
    .otm-module .otm-topbar {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 8px 12px;
        background: var(--otm-surface);
        border: 1px solid var(--otm-border);
        border-radius: var(--otm-radius);
        box-shadow: var(--otm-shadow);
    }

    .otm-module .otm-brand {
        display: flex;
        align-items: center;
        gap: 11px;
        min-width: 0;
        flex: 0 0 auto;
    }

    .otm-module .otm-brand-icon {
        width: 40px;
        height: 40px;
        min-width: 40px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 21px;
        background: var(--otm-primary-soft);
        color: var(--otm-primary);
    }

    .otm-module .otm-brand h3 {
        font-size: 18px;
        font-weight: 700;
        letter-spacing: -.01em;
        line-height: 1.2;
    }

    .otm-module .otm-brand p {
        font-size: 12px;
        color: var(--otm-ink-soft);
        white-space: nowrap;
    }

    .otm-module .otm-top-actions {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    /* ---------- tab tones ---------- */
    .otm-module .otm-tone-overview {
        --t-color: #5b4fe5;
        --t-dark: #3d33b0;
        --t-soft: #edebff;
    }

    .otm-module .otm-tone-workqueue {
        --t-color: #d97706;
        --t-dark: #b45309;
        --t-soft: #fef3c7;
    }

    .otm-module .otm-tone-study {
        --t-color: #2563eb;
        --t-dark: #1d4ed8;
        --t-soft: #dbeafe;
    }

    .otm-module .otm-tone-reports {
        --t-color: #059669;
        --t-dark: #047857;
        --t-soft: #d1fae5;
    }
    /* ---------- tab strip ---------- */
    .otm-module .otm-tabs {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        align-items: stretch;
        gap: 4px;
        padding: 3px;
        background: var(--otm-bg);
        border-radius: 12px;
        overflow-x: auto;
        scrollbar-width: none;
    }

        .otm-module .otm-tabs::-webkit-scrollbar {
            display: none;
        }

    .otm-module .otm-tab {
        position: relative;
        flex: 1 1 auto;
        min-width: 0;
        display: inline-flex;
        align-items: center;
        gap: 10px;
        height: 44px;
        padding: 0 12px 5px 8px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: #475467;
        white-space: nowrap;
        text-align: left;
        cursor: pointer;
        transition: background .15s ease, box-shadow .15s ease, color .15s ease;
    }

        .otm-module .otm-tab.no-bar {
            padding-bottom: 0;
        }

        .otm-module .otm-tab:hover:not(.active) {
            background: #fff;
            box-shadow: 0 1px 4px rgba(16,24,39,.10);
        }

        .otm-module .otm-tab:focus-visible {
            outline: 2px solid var(--t-color);
            outline-offset: 1px;
        }

        .otm-module .otm-tab.active {
            background: linear-gradient(160deg, var(--t-color), var(--t-dark));
            color: #fff;
            box-shadow: 0 4px 12px color-mix(in srgb, var(--t-color) 35%, transparent);
        }
        /* share bar : ::before = track, ::after = fill (--share is 0-100) */
        .otm-module .otm-tab:not(.no-bar)::before,
        .otm-module .otm-tab:not(.no-bar)::after {
            content: "";
            position: absolute;
            left: 12px;
            bottom: 6px;
            height: 3px;
            border-radius: 3px;
            pointer-events: none;
        }

        .otm-module .otm-tab:not(.no-bar)::before {
            right: 12px;
            background: rgba(16,24,39,.07);
        }

        .otm-module .otm-tab:not(.no-bar)::after {
            width: calc((100% - 24px) * var(--share, 0) / 100);
            background: var(--t-color);
            opacity: .9;
            transition: width .4s ease;
        }

        .otm-module .otm-tab.active:not(.no-bar)::before {
            background: rgba(255,255,255,.28);
        }

        .otm-module .otm-tab.active:not(.no-bar)::after {
            background: #fff;
            opacity: 1;
        }

    .otm-module .otm-tab-icon {
        width: 28px;
        height: 28px;
        min-width: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 9px;
        background: var(--t-soft);
        color: var(--t-color);
        font-size: 16px;
        transition: background .15s ease, color .15s ease;
    }

    .otm-module .otm-tab.active .otm-tab-icon {
        background: rgba(255,255,255,.22);
        color: #fff;
    }

    .otm-module .otm-tab-label {
        flex: 1 1 auto;
        min-width: 0;
        font-size: 13.5px;
        font-weight: 700;
        color: inherit;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .otm-module .otm-tab-count {
        flex: 0 0 auto;
        min-width: 28px;
        height: 22px;
        padding: 0 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 999px;
        background: var(--t-soft);
        color: var(--t-color);
        font-size: 12.5px;
        font-weight: 800;
        font-variant-numeric: tabular-nums;
        transition: background .15s ease, color .15s ease;
    }

        .otm-module .otm-tab-count.is-zero {
            opacity: .55;
        }

    .otm-module .otm-tab.active .otm-tab-count {
        background: #fff;
        color: var(--t-dark);
        opacity: 1;
    }

    /* =========================================================
   VIEW WRAPPERS (fill remaining height, scroll inside cards)
   ========================================================= */
    .otm-module .otm-view {
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .otm-module .otm-grow {
        flex: 1 1 auto;
        min-height: 0;
    }

    .otm-module .otm-card {
        display: flex;
        flex-direction: column;
        min-height: 0;
        background: var(--otm-surface);
        border: 1px solid var(--otm-border);
        border-radius: var(--otm-radius);
        box-shadow: var(--otm-shadow);
        overflow: hidden;
    }

    .otm-module .otm-card-head {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 11px 16px;
        border-bottom: 1px solid var(--otm-border);
        flex-wrap: wrap;
    }

        .otm-module .otm-card-head h5 {
            font-size: 14.5px;
            font-weight: 700;
        }

        .otm-module .otm-card-head p {
            margin-top: 2px;
            font-size: 12px;
            color: var(--otm-ink-soft);
        }

    .otm-module .otm-card-body {
        padding: 12px 16px;
    }

    .otm-module .otm-card-foot {
        flex: 0 0 auto;
        padding: 8px 16px;
        border-top: 1px solid var(--otm-border);
        background: var(--otm-muted);
        font-size: 12px;
        color: var(--otm-ink-soft);
    }

        .otm-module .otm-card-foot b {
            color: var(--otm-ink);
        }

    .otm-module .otm-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
    }
    /* ---------- toolbar / chips / search ---------- */
    .otm-module .otm-toolbar {
        display: flex;
        align-items: center;
        gap: 9px;
        flex-wrap: wrap;
    }

    .otm-module .otm-chips {
        flex: 1 1 auto;
        display: flex;
        align-items: center;
        gap: 6px;
        flex-wrap: wrap;
    }

    .otm-module .otm-chip {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        padding: 5px 6px 5px 12px;
        border: 1px solid var(--otm-border);
        border-radius: 999px;
        background: #fff;
        color: var(--otm-ink-soft);
        font-size: 12.5px;
        font-weight: 600;
        cursor: pointer;
        transition: all .15s ease;
    }

        .otm-module .otm-chip b {
            min-width: 22px;
            padding: 1px 7px;
            border-radius: 999px;
            background: var(--otm-bg);
            color: var(--otm-ink-soft);
            font-size: 11px;
            font-weight: 700;
            text-align: center;
        }

        .otm-module .otm-chip:hover {
            border-color: var(--otm-primary);
            color: var(--otm-primary);
        }

        .otm-module .otm-chip.active {
            background: var(--otm-primary-soft);
            border-color: var(--otm-primary);
            color: var(--otm-primary);
        }

            .otm-module .otm-chip.active b {
                background: var(--otm-primary);
                color: #fff;
            }

    .otm-module .otm-search {
        position: relative;
        display: flex;
        align-items: center;
        width: 260px;
    }

        .otm-module .otm-search i {
            position: absolute;
            left: 11px;
            font-size: 16px;
            color: var(--otm-ink-faint);
            pointer-events: none;
        }

        .otm-module .otm-search .form-control {
            height: 36px;
            padding-left: 33px;
            font-size: 13px;
        }

    .otm-module .otm-select.form-select {
        width: auto;
        min-width: 150px;
        height: 36px;
        padding: 0 30px 0 11px;
        font-size: 12.5px;
        font-weight: 600;
    }

    /* =========================================================
   OVERVIEW
   ========================================================= */
    .otm-module .otm-stats {
        flex: 0 0 auto;
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }

    .otm-module .otm-stat {
        display: flex;
        align-items: center;
        gap: 11px;
        padding: 11px 14px;
        background: var(--otm-surface);
        border: 1px solid var(--otm-border);
        border-radius: var(--otm-radius);
        box-shadow: var(--otm-shadow);
        text-align: left;
        cursor: pointer;
        transition: transform .15s ease, border-color .15s ease;
    }

        .otm-module .otm-stat:hover {
            transform: translateY(-1px);
            border-color: var(--otm-primary);
        }

    .otm-module .otm-stat-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 19px;
    }

        .otm-module .otm-stat-icon.blue {
            background: var(--otm-blue-soft);
            color: var(--otm-blue);
        }

        .otm-module .otm-stat-icon.amber {
            background: var(--otm-amber-soft);
            color: var(--otm-amber);
        }

        .otm-module .otm-stat-icon.violet {
            background: var(--otm-violet-soft);
            color: var(--otm-violet);
        }

        .otm-module .otm-stat-icon.red {
            background: var(--otm-red-soft);
            color: var(--otm-red);
        }

    .otm-module .otm-stat-text {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

        .otm-module .otm-stat-text strong {
            font-size: 21px;
            font-weight: 800;
            line-height: 1.15;
            color: var(--otm-ink);
        }

        .otm-module .otm-stat-text span {
            font-size: 11.5px;
            font-weight: 600;
            color: var(--otm-ink-soft);
            white-space: nowrap;
        }

    .otm-module .otm-overview-grid {
        flex: 1 1 auto;
        min-height: 0;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 320px;
        gap: 10px;
    }

        .otm-module .otm-overview-grid > * {
            min-height: 0;
        }

    .otm-module .otm-side {
        display: flex;
        flex-direction: column;
        gap: 10px;
        min-height: 0;
    }

        .otm-module .otm-side > .otm-card:first-child {
            flex: 0 0 auto;
        }

    .otm-module .otm-modality {
        padding: 5px 0;
    }

    .otm-module .otm-modality-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 5px;
        font-size: 12.5px;
        font-weight: 600;
    }

        .otm-module .otm-modality-top i {
            color: var(--otm-primary);
            font-size: 16px;
            margin-right: 4px;
            vertical-align: -2px;
        }

        .otm-module .otm-modality-top b {
            font-size: 12px;
            color: var(--otm-ink-soft);
        }

    .otm-module .otm-progress {
        height: 6px;
        background: #e5e8ef;
        border-radius: 10px;
        overflow: hidden;
    }

        .otm-module .otm-progress div {
            height: 100%;
            background: var(--otm-primary);
            border-radius: 10px;
            transition: width .4s ease;
        }

    .otm-module .otm-equip {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 7px 0;
        border-bottom: 1px solid var(--otm-border-soft);
    }

        .otm-module .otm-equip:last-child {
            border-bottom: 0;
        }

    .otm-module .otm-equip-name {
        font-size: 12.5px;
        font-weight: 600;
    }

        .otm-module .otm-equip-name i {
            color: var(--otm-primary);
            font-size: 16px;
            margin-right: 4px;
            vertical-align: -2px;
        }

    /* =========================================================
   TABLE
   ========================================================= */
    .otm-module .otm-table {
        width: 100%;
        margin: 0;
        border-collapse: collapse;
        font-size: 13px;
    }

        .otm-module .otm-table thead th {
            position: sticky;
            top: 0;
            z-index: 1;
            padding: 9px 14px;
            text-align: left;
            background: var(--otm-muted);
            border-bottom: 1px solid var(--otm-border);
            color: var(--otm-ink-soft);
            font-size: 10.5px;
            font-weight: 700;
            letter-spacing: .04em;
            text-transform: uppercase;
            white-space: nowrap;
        }

            .otm-module .otm-table thead th.right, .otm-module .otm-table td.right {
                text-align: right;
            }

        .otm-module .otm-table tbody td {
            padding: 9px 14px;
            border-bottom: 1px solid var(--otm-border-soft);
            vertical-align: middle;
        }

        .otm-module .otm-table tbody tr:last-child td {
            border-bottom: 0;
        }

        .otm-module .otm-table tbody tr:hover td {
            background: var(--otm-muted);
        }

        .otm-module .otm-table tbody tr.is-stat td:first-child {
            box-shadow: inset 3px 0 0 var(--otm-red);
        }

    .otm-module .otm-td-muted {
        color: var(--otm-ink-soft);
        font-size: 12.5px;
        white-space: nowrap;
    }

    .otm-module .otm-strong {
        font-size: 13px;
        font-weight: 600;
    }

    .otm-module .otm-sub {
        margin-top: 1px;
        font-size: 11px;
        color: var(--otm-ink-faint);
    }

    .otm-module .otm-code {
        font-size: 12px;
        font-weight: 700;
        color: var(--otm-primary);
        white-space: nowrap;
    }

    .otm-module .otm-patient {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .otm-module .otm-patient-text {
        min-width: 0;
    }

    .otm-module .otm-avatar {
        width: 34px;
        height: 34px;
        min-width: 34px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: var(--otm-primary-soft);
        color: var(--otm-primary);
        font-size: 12px;
        font-weight: 700;
    }

        .otm-module .otm-avatar.lg {
            width: 44px;
            height: 44px;
            min-width: 44px;
            font-size: 15px;
        }

    .otm-module .otm-study {
        display: flex;
        align-items: center;
        gap: 9px;
    }

        .otm-module .otm-study > i {
            font-size: 19px;
            color: var(--otm-primary);
        }

    .otm-module .otm-actions {
        display: inline-flex;
        align-items: center;
        justify-content: flex-end;
        gap: 6px;
    }

    .otm-module .otm-icon-btn {
        width: 30px;
        height: 30px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--otm-border);
        border-radius: 8px;
        background: #fff;
        color: var(--otm-ink-soft);
        font-size: 15px;
        cursor: pointer;
        transition: all .15s ease;
    }

        .otm-module .otm-icon-btn:hover {
            border-color: var(--otm-primary);
            color: var(--otm-primary);
            background: var(--otm-primary-soft);
        }

        .otm-module .otm-icon-btn.danger:hover {
            border-color: var(--otm-red);
            color: var(--otm-red);
            background: var(--otm-red-soft);
        }

    .otm-module .otm-empty {
        padding: 40px 18px;
        text-align: center;
        color: var(--otm-ink-soft);
    }

        .otm-module .otm-empty i {
            display: block;
            margin-bottom: 8px;
            font-size: 32px;
            color: var(--otm-ink-faint);
        }

        .otm-module .otm-empty strong {
            display: block;
            font-size: 13.5px;
            color: var(--otm-ink);
        }

        .otm-module .otm-empty span {
            font-size: 12.5px;
        }
    /* ---------- status pills ---------- */
    .otm-module .otm-pill {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 4px 10px;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 700;
        white-space: nowrap;
    }

        .otm-module .otm-pill i {
            font-size: 13px;
        }

        .otm-module .otm-pill.blue {
            background: var(--otm-blue-soft);
            color: var(--otm-blue);
        }

        .otm-module .otm-pill.amber {
            background: var(--otm-amber-soft);
            color: var(--otm-amber);
        }

        .otm-module .otm-pill.green {
            background: var(--otm-green-soft);
            color: var(--otm-green);
        }

        .otm-module .otm-pill.red {
            background: var(--otm-red-soft);
            color: var(--otm-red);
        }

        .otm-module .otm-pill.violet {
            background: var(--otm-violet-soft);
            color: var(--otm-violet);
        }

        .otm-module .otm-pill.grey {
            background: var(--otm-bg);
            color: var(--otm-ink-soft);
        }

    /* =========================================================
   BOOTSTRAP TUNING (buttons + form controls inside the module)
   ========================================================= */
    .otm-module .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-size: 13px;
        font-weight: 600;
        border-radius: var(--otm-radius-sm);
    }

        .otm-module .btn i {
            font-size: 16px;
            vertical-align: -2px;
        }

        .otm-module .btn:not(.btn-sm) {
            height: 38px;
            padding: 0 16px;
        }

    .otm-module .btn-sm {
        padding: 5px 11px;
        font-size: 12.5px;
    }

    .otm-module .btn-primary {
        background: var(--otm-primary);
        border-color: var(--otm-primary);
        color: #fff;
    }

        .otm-module .btn-primary:hover,
        .otm-module .btn-primary:focus {
            background: var(--otm-primary-dark);
            border-color: var(--otm-primary-dark);
            color: #fff;
        }

    .otm-module .btn-outline-primary {
        color: var(--otm-primary);
        border-color: #cfcaf8;
        background: #fff;
    }

        .otm-module .btn-outline-primary:hover {
            background: var(--otm-primary);
            border-color: var(--otm-primary);
            color: #fff;
        }

    .otm-module .btn-light {
        background: #fff;
        border: 1px solid var(--otm-border);
        color: var(--otm-ink-soft);
    }

        .otm-module .btn-light:hover {
            background: var(--otm-muted);
            color: var(--otm-ink);
        }

    .otm-module .form-control,
    .otm-module .form-select {
        border: 1px solid var(--otm-border);
        border-radius: var(--otm-radius-sm);
        font-size: 13px;
        color: var(--otm-ink);
    }

        .otm-module .form-control:focus,
        .otm-module .form-select:focus {
            border-color: var(--otm-primary);
            box-shadow: 0 0 0 3px var(--otm-primary-soft);
        }

        .otm-module .form-control:disabled,
        .otm-module .form-select:disabled {
            background-color: var(--otm-muted);
            color: var(--otm-ink-soft);
        }

    .otm-module .form-check-input:checked {
        background-color: var(--otm-primary);
        border-color: var(--otm-primary);
    }

    /* =========================================================
   DIALOG
   ========================================================= */
    .otm-module .otm-overlay {
        /* If your app shell's own header/navbar still shows on top of this dialog,
       raise --otm-z-overlay (e.g. on .otm-module) above its z-index. */
        position: fixed;
        inset: 0;
        z-index: var(--otm-z-overlay, 9999);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 16px;
        background: rgba(16, 24, 39, .55);
        animation: otm-fade .15s ease;
    }
    /* drawer variant: anchored to the right edge, full height, top-to-bottom.
   Stretching (instead of centering) guarantees the header always sits at
   the very top of the dialog and can never be pushed off-screen, even if
   the dialog's content is taller than the browser window. */
    .otm-module .otm-overlay-drawer {
        align-items: stretch;
        justify-content: flex-end;
        padding: 0;
    }

    .otm-module .otm-modal {
        width: 100%;
        max-height: 100%;
        display: flex;
        flex-direction: column;
        background: #fff;
        border-radius: 16px;
        box-shadow: 0 24px 60px rgba(16, 24, 39, .30);
        overflow: hidden;
        animation: otm-pop .18s ease;
    }

    .otm-module .otm-modal-sm {
        max-width: 420px;
    }

    .otm-module .otm-modal-md {
        max-width: 720px;
    }

    .otm-module .otm-modal-lg {
        max-width: 860px;
    }

    .otm-module .otm-modal-xl {
        max-width: 1040px;
    }

    .otm-module .otm-modal-drawer {
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 16px 0 0 16px;
        animation: otm-drawer-in .22s ease;
    }

        .otm-module .otm-modal-drawer.otm-modal-sm {
            width: 400px;
        }

        .otm-module .otm-modal-drawer.otm-modal-md {
            width: 480px;
        }

        .otm-module .otm-modal-drawer.otm-modal-lg {
            width: 640px;
        }

        .otm-module .otm-modal-drawer.otm-modal-xl {
            width: 760px;
        }

    .otm-module .otm-modal-head {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 18px;
        border-bottom: 1px solid var(--otm-border);
    }

    .otm-module .otm-modal-icon {
        width: 38px;
        height: 38px;
        min-width: 38px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 11px;
        font-size: 20px;
    }

        .otm-module .otm-modal-icon.purple {
            background: var(--otm-primary-soft);
            color: var(--otm-primary);
        }

        .otm-module .otm-modal-icon.blue {
            background: var(--otm-blue-soft);
            color: var(--otm-blue);
        }

        .otm-module .otm-modal-icon.green {
            background: var(--otm-green-soft);
            color: var(--otm-green);
        }

        .otm-module .otm-modal-icon.amber {
            background: var(--otm-amber-soft);
            color: var(--otm-amber);
        }

        .otm-module .otm-modal-icon.red {
            background: var(--otm-red-soft);
            color: var(--otm-red);
        }

    .otm-module .otm-modal-title {
        flex: 1 1 auto;
        min-width: 0;
    }

        .otm-module .otm-modal-title h5 {
            font-size: 16px;
            font-weight: 700;
        }

        .otm-module .otm-modal-title p {
            margin-top: 1px;
            font-size: 12px;
            color: var(--otm-ink-soft);
        }

    .otm-module .otm-modal-close {
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--otm-ink-soft);
        font-size: 20px;
        cursor: pointer;
    }

        .otm-module .otm-modal-close:hover {
            background: var(--otm-bg);
            color: var(--otm-ink);
        }

    .otm-module .otm-modal-strip {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        gap: 28px;
        flex-wrap: wrap;
        padding: 10px 18px;
        background: var(--otm-muted);
        border-bottom: 1px solid var(--otm-border);
    }

    .otm-module .otm-strip-patient {
        display: flex;
        align-items: center;
        gap: 11px;
        margin-right: 8px;
    }

    .otm-module .otm-strip-name {
        font-size: 15px;
        font-weight: 700;
    }

    .otm-module .otm-strip-item {
        display: flex;
        flex-direction: column;
        gap: 3px;
        align-items: flex-start;
    }

        .otm-module .otm-strip-item label {
            margin: 0;
            font-size: 9.5px;
            font-weight: 700;
            letter-spacing: .05em;
            text-transform: uppercase;
            color: var(--otm-ink-faint);
        }

        .otm-module .otm-strip-item strong {
            font-size: 13px;
            font-weight: 700;
        }

            .otm-module .otm-strip-item strong i {
                color: var(--otm-primary);
                font-size: 16px;
                vertical-align: -2px;
            }

    .otm-module .otm-modal-body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding: 14px 18px 18px;
    }

    .otm-module .otm-modal-foot {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        padding: 12px 18px;
        border-top: 1px solid var(--otm-border);
        background: var(--otm-muted);
    }

    .otm-module .otm-section {
        display: flex;
        align-items: center;
        gap: 6px;
        margin: 4px 0 10px;
        font-size: 10.5px;
        font-weight: 700;
        letter-spacing: .05em;
        text-transform: uppercase;
        color: var(--otm-ink-faint);
    }

        .otm-module .otm-section i {
            font-size: 15px;
            color: var(--otm-primary);
        }

    .otm-module .otm-grid + .otm-section {
        margin-top: 18px;
    }

    .otm-module .otm-grid {
        display: grid;
        gap: 12px;
    }

        .otm-module .otm-grid.cols-2 {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .otm-module .otm-grid.cols-4 {
            grid-template-columns: repeat(4, minmax(0, 1fr));
        }

        .otm-module .otm-grid .span-2 {
            grid-column: span 2;
        }

        .otm-module .otm-grid .span-4 {
            grid-column: 1 / -1;
        }

    .otm-module .otm-field {
        display: flex;
        flex-direction: column;
        gap: 5px;
        margin-bottom: 0;
    }

        .otm-module .otm-field label {
            margin: 0;
            font-size: 11.5px;
            font-weight: 600;
            color: var(--otm-ink-soft);
        }

            .otm-module .otm-field label em {
                font-style: normal;
                color: var(--otm-red);
            }

        .otm-module .otm-field .form-control, .otm-module .otm-field .form-select {
            min-height: 38px;
        }

        .otm-module .otm-field textarea.form-control {
            resize: vertical;
        }

    .otm-module .otm-stack {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .otm-module .otm-switch {
        display: flex;
        align-items: center;
        gap: 8px;
        min-height: 38px;
        padding-left: 2.5em;
    }

        .otm-module .otm-switch label {
            color: var(--otm-ink);
            font-size: 13px;
        }

    .otm-module .otm-seg {
        display: flex;
        gap: 2px;
        padding: 3px;
        background: var(--otm-bg);
        border-radius: var(--otm-radius-sm);
    }

        .otm-module .otm-seg button {
            flex: 1;
            height: 32px;
            border: 0;
            border-radius: 7px;
            background: transparent;
            color: var(--otm-ink-soft);
            font-size: 12.5px;
            font-weight: 700;
            cursor: pointer;
            transition: all .15s ease;
        }

            .otm-module .otm-seg button.active {
                background: #fff;
                box-shadow: 0 1px 3px rgba(16,24,39,.15);
            }

                .otm-module .otm-seg button.active.tone-grey {
                    color: var(--otm-ink);
                }

                .otm-module .otm-seg button.active.tone-amber {
                    color: var(--otm-amber);
                }

                .otm-module .otm-seg button.active.tone-red {
                    color: var(--otm-red);
                }

    .otm-module .otm-meta-line {
        display: flex;
        align-items: center;
        gap: 6px;
        margin: -4px 0 14px;
        font-size: 12.5px;
        font-weight: 600;
        color: var(--otm-ink-soft);
    }

        .otm-module .otm-meta-line i {
            font-size: 16px;
            color: var(--otm-primary);
        }

    .otm-module .otm-viewer {
        min-height: 120px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 16px;
        border-radius: 12px;
        background: linear-gradient(160deg, #0f172a, #1e293b);
        color: #cbd5e1;
        text-align: center;
    }

        .otm-module .otm-viewer > i {
            font-size: 28px;
            color: #64748b;
        }

        .otm-module .otm-viewer strong {
            color: #fff;
            font-size: 13px;
        }

        .otm-module .otm-viewer span {
            max-width: 320px;
            font-size: 11.5px;
            color: #94a3b8;
        }

        .otm-module .otm-viewer .btn {
            margin-top: 4px;
        }

    .otm-module .otm-details {
        padding: 12px 14px;
        background: var(--otm-muted);
        border: 1px solid var(--otm-border-soft);
        border-radius: 12px;
    }

        .otm-module .otm-details .otm-section {
            margin-top: 0;
        }

    .otm-module .otm-detail-row {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 14px;
        padding: 5px 0;
        font-size: 12.5px;
    }

        .otm-module .otm-detail-row span {
            color: var(--otm-ink-soft);
        }

        .otm-module .otm-detail-row strong {
            font-weight: 600;
            text-align: right;
        }

    .otm-module .otm-clinical {
        display: flex;
        gap: 10px;
        margin-bottom: 12px;
        padding: 10px 12px;
        background: var(--otm-amber-soft);
        border: 1px solid #fde9b0;
        border-radius: var(--otm-radius-sm);
        color: #92400e;
    }

        .otm-module .otm-clinical > i {
            font-size: 18px;
        }

        .otm-module .otm-clinical strong {
            display: block;
            font-size: 12px;
        }

        .otm-module .otm-clinical span {
            display: block;
            margin-top: 1px;
            font-size: 12px;
            opacity: .9;
        }

    .otm-module .otm-confirm-text {
        font-size: 13.5px;
        line-height: 1.55;
        color: var(--otm-ink-soft);
    }

        .otm-module .otm-confirm-text strong {
            color: var(--otm-ink);
        }
    /* ---------- toast ---------- */
    .otm-module .otm-toast {
        position: fixed;
        left: 50%;
        bottom: 24px;
        z-index: 1100;
        transform: translateX(-50%);
        display: inline-flex;
        align-items: center;
        gap: 8px;
        padding: 10px 18px;
        border-radius: 999px;
        background: #101827;
        color: #fff;
        font-size: 13px;
        font-weight: 600;
        box-shadow: 0 10px 30px rgba(16, 24, 39, .35);
        animation: otm-toast .25s ease;
    }

        .otm-module .otm-toast i {
            font-size: 18px;
            color: #34d399;
        }

@keyframes otm-fade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes otm-pop {
    from {
        opacity: 0;
        transform: translateY(8px) scale(.985);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes otm-drawer-in {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes otm-toast {
    from {
        opacity: 0;
        transform: translate(-50%, 10px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1200px) {
    .otm-module .otm-topbar {
        flex-wrap: wrap;
    }

    .otm-module .otm-tabs {
        order: 3;
        flex: 1 1 100%;
    }

    .otm-module .otm-top-actions {
        margin-left: auto;
    }

    .otm-module .otm-brand {
        flex: 1 1 auto;
    }
}

@media (max-width: 992px) {
    .otm-module {
        height: auto;
        min-height: calc(100vh - var(--otm-offset));
        overflow: visible;
    }

        .otm-module .otm-scroll {
            max-height: 70vh;
        }

        .otm-module .otm-stats {
            grid-template-columns: repeat(2, 1fr);
        }

        .otm-module .otm-overview-grid {
            grid-template-columns: 1fr;
        }
}

@media (max-width: 720px) {
    .otm-module {
        padding: 8px;
    }

        .otm-module .otm-search {
            width: 100%;
        }

        .otm-module .otm-toolbar {
            width: 100%;
        }

        .otm-module .otm-select.form-select {
            width: 100%;
        }

        .otm-module .otm-grid.cols-4 {
            grid-template-columns: repeat(2, minmax(0, 1fr));
        }

        .otm-module .otm-grid .span-4 {
            grid-column: 1 / -1;
        }

        .otm-module .otm-strip-patient {
            width: 100%;
        }

        .otm-module .otm-modal-strip {
            gap: 16px;
        }

        .otm-module .otm-modal-drawer {
            width: 100% !important;
            border-radius: 0;
        }
}

@media (max-width: 640px) {
    .otm-module .otm-tab {
        flex: 0 0 auto;
        min-width: 150px;
    }

    .otm-module .otm-stat-text strong {
        font-size: 18px;
    }

    .otm-module .otm-grid.cols-2 {
        grid-template-columns: 1fr;
    }

    .otm-module .otm-grid .span-2 {
        grid-column: 1 / -1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .otm-module .otm-tab,
    .otm-module .otm-tab::after,
    .otm-module .otm-progress div,
    .otm-module .otm-modal,
    .otm-module .otm-overlay,
    .otm-module .otm-toast {
        transition: none;
        animation: none;
    }
}

/* =========================================================
   OT-SPECIFIC ADDITIONS
   Sidebar navigation (10 sections don't fit a single-row tab
   strip the way Radiology's 4 tabs did) + OT room status grid
   + a couple of small OT-only helpers. Same tokens as above.
   ========================================================= */
.otm-module .otm-shell {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    gap: 10px;
}

.otm-module .otm-nav {
    flex: 0 0 216px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px;
    background: var(--otm-surface);
    border: 1px solid var(--otm-border);
    border-radius: var(--otm-radius);
    box-shadow: var(--otm-shadow);
    overflow-y: auto;
}

.otm-module .otm-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #475467;
    text-align: left;
    cursor: pointer;
    width: 100%;
    transition: background .15s ease, color .15s ease;
}

    .otm-module .otm-nav-link:hover:not(.active) {
        background: var(--otm-muted);
    }

    .otm-module .otm-nav-link.active {
        background: linear-gradient(160deg, var(--t-color), var(--t-dark));
        color: #fff;
        box-shadow: 0 4px 12px color-mix(in srgb, var(--t-color) 35%, transparent);
    }

.otm-module .otm-nav-icon {
    width: 28px;
    height: 28px;
    min-width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    background: var(--t-soft);
    color: var(--t-color);
    font-size: 15px;
    transition: background .15s ease, color .15s ease;
}

.otm-module .otm-nav-link.active .otm-nav-icon {
    background: rgba(255,255,255,.22);
    color: #fff;
}

.otm-module .otm-nav-label {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.otm-module .otm-nav-count {
    flex: 0 0 auto;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: var(--t-soft);
    color: var(--t-color);
    font-size: 11.5px;
    font-weight: 800;
}

.otm-module .otm-nav-link.active .otm-nav-count {
    background: #fff;
    color: var(--t-dark);
}

.otm-module .otm-nav-sep {
    margin: 6px 8px 4px;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--otm-ink-faint);
}

/* nav tones (one per module section) */
.otm-module .otm-tone-overview     { --t-color:#5b4fe5; --t-dark:#3d33b0; --t-soft:#edebff; }
.otm-module .otm-tone-schedule     { --t-color:#2563eb; --t-dark:#1d4ed8; --t-soft:#dbeafe; }
.otm-module .otm-tone-preop        { --t-color:#d97706; --t-dark:#b45309; --t-soft:#fef3c7; }
.otm-module .otm-tone-anaesthesia  { --t-color:#0891b2; --t-dark:#0e7490; --t-soft:#cffafe; }
.otm-module .otm-tone-procedure    { --t-color:#e11d48; --t-dark:#be123c; --t-soft:#ffe4e9; }
.otm-module .otm-tone-intraop      { --t-color:#db2777; --t-dark:#be185d; --t-soft:#fce7f3; }
.otm-module .otm-tone-postop       { --t-color:#059669; --t-dark:#047857; --t-soft:#d1fae5; }
.otm-module .otm-tone-notes        { --t-color:#4f46e5; --t-dark:#4338ca; --t-soft:#e0e7ff; }
.otm-module .otm-tone-cssd         { --t-color:#0d9488; --t-dark:#0f766e; --t-soft:#ccfbf1; }
.otm-module .otm-tone-billing      { --t-color:#65a30d; --t-dark:#4d7c0f; --t-soft:#ecfccb; }

/* view wrapper inside the content column of the shell */
.otm-module .otm-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}

/* ---------- OT room status grid (Overview) ---------- */
.otm-module .otm-room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
}

.otm-module .otm-room-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    border: 1px solid var(--otm-border);
    border-radius: var(--otm-radius-sm);
    background: var(--otm-muted);
}

.otm-module .otm-room-card.is-inuse   { border-color: color-mix(in srgb, var(--otm-amber) 45%, var(--otm-border)); background: var(--otm-amber-soft); }
.otm-module .otm-room-card.is-cleaning { border-color: color-mix(in srgb, var(--otm-blue) 45%, var(--otm-border)); background: var(--otm-blue-soft); }
.otm-module .otm-room-card.is-maint   { border-color: color-mix(in srgb, var(--otm-red) 45%, var(--otm-border)); background: var(--otm-red-soft); }

.otm-module .otm-room-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 800;
    font-size: 13px;
}

.otm-module .otm-room-case {
    font-size: 12px;
    color: var(--otm-ink-soft);
    line-height: 1.4;
}

/* ---------- form layout used across every clinical tab ---------- */
.otm-module .otm-form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px 16px;
}

.otm-module .otm-form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

    .otm-module .otm-form-field.full {
        grid-column: 1 / -1;
    }

    .otm-module .otm-form-field label {
        font-size: 12px;
        font-weight: 700;
        color: var(--otm-ink-soft);
    }

@media (max-width: 980px) {
    .otm-module .otm-shell { flex-direction: column; }
    .otm-module .otm-nav { flex-direction: row; flex-wrap: wrap; flex: 0 0 auto; }
    .otm-module .otm-nav-link { flex: 1 1 140px; }
    .otm-module .otm-form-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
    .otm-module .otm-form-grid { grid-template-columns: 1fr; }
    .otm-module .otm-room-grid { grid-template-columns: repeat(2, 1fr); }
}

.otm-module .otm-stat.no-link { cursor: default; }
.otm-module .otm-stat.no-link:hover { transform: none; box-shadow: none; }
