:root {
        --primary: #005a9c;
        --secondary: #2a9d8f;
        --accent: #e9c46a;
        --dark: #264653;
        --light: #f8f9fa;
        --text: #495057;
        --danger: #dc3545;
        --warning: #ffc107;
        --success: #28a745;
        --sidebar-w: 264px;
      }
      * {
        box-sizing: border-box;
      }
      body {
        font-family: "Lato", sans-serif;
        background: var(--light);
        color: var(--text);
      }
      h1,
      h2,
      h3,
      h4,
      h5,
      h6 {
        color: var(--dark);
        font-weight: 700;
      }
      a {
        text-decoration: none;
      }

      /* ============ ECG E CORAÇÃO - INTEGRADOS AO FUNDO EXISTENTE ============ */

      /* Container do ECG - posicionado sobre o grid */
      .ecg-overlay {
        position: absolute;
        inset: 0;
        z-index: 1;
        pointer-events: none;
        overflow: hidden;
        opacity: 0.35;
      }

      .ecg-svg {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100%;
      }

      .ecg-path-line {
        stroke-dasharray: 2000;
        stroke-dashoffset: 2000;
        animation: ecgDraw 8s ease-in-out infinite;
      }

      .ecg-path-line:nth-child(1) {
        animation-delay: 0s;
        stroke: rgba(42, 157, 143, 0.35);
        stroke-width: 2;
      }

      .ecg-path-line:nth-child(2) {
        animation-delay: 2.5s;
        stroke: rgba(0, 90, 156, 0.25);
        stroke-width: 1.8;
        transform: translateY(15px) scaleX(0.92);
      }

      .ecg-path-line:nth-child(3) {
        animation-delay: 5s;
        stroke: rgba(233, 196, 106, 0.18);
        stroke-width: 1.5;
        transform: translateY(-15px) scaleX(1.08);
      }

      @keyframes ecgDraw {
        0% {
          stroke-dashoffset: 2000;
          opacity: 0;
        }
        8% {
          opacity: 1;
        }
        92% {
          opacity: 1;
        }
        100% {
          stroke-dashoffset: 0;
          opacity: 0.3;
        }
      }

      /* ===== ECG SOBREPOSTO AO FUNDO ===== */
      .ecg-overlay {
        position: absolute;
        inset: 0;
        z-index: 1;
        pointer-events: none;
        overflow: hidden;
        opacity: 0.4;
      }

      .ecg-svg {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 100%;
      }

      .ecg-path-line {
        stroke-dasharray: 3000;
        stroke-dashoffset: 3000;
        animation: ecgDraw 6s ease-in-out infinite;
      }

      /* ECG Principal - ritmo sinusal (picos nítidos) */
      .ecg-path-line:nth-child(1) {
        animation-delay: 0s;
        stroke: rgba(42, 157, 143, 0.45);
        stroke-width: 2.2;
        stroke-linecap: round;
        stroke-linejoin: round;
      }

      /* ECG Secundário - ritmo com variação */
      .ecg-path-line:nth-child(2) {
        animation-delay: 0.8s;
        stroke: rgba(0, 90, 156, 0.3);
        stroke-width: 1.8;
        stroke-linecap: round;
        stroke-linejoin: round;
        transform: translateY(12px) scaleX(0.95);
      }

      /* ECG Terciário - ondas suaves (P e T) */
      .ecg-path-line:nth-child(3) {
        animation-delay: 1.6s;
        stroke: rgba(233, 196, 106, 0.2);
        stroke-width: 1.5;
        stroke-linecap: round;
        stroke-linejoin: round;
        transform: translateY(-12px) scaleX(1.05);
      }

      @keyframes ecgDraw {
        0% {
          stroke-dashoffset: 3000;
          opacity: 0;
        }
        5% {
          opacity: 1;
        }
        90% {
          opacity: 1;
        }
        100% {
          stroke-dashoffset: 0;
          opacity: 0.4;
        }
      }

      /* Efeito de "brilho" passageiro no pico do ECG */
      .ecg-path-line:nth-child(1)::after {
        content: "";
        position: absolute;
        width: 4px;
        height: 4px;
        background: rgba(42, 157, 143, 0.8);
        border-radius: 50%;
        animation: glowPulse 1.2s ease-in-out infinite;
      }

      /* Efeito de brilho que percorre a linha */
      @keyframes ecgGlow {
        0% {
          filter: drop-shadow(0 0 0px rgba(42, 157, 143, 0)) !important;
        }
        50% {
          filter: drop-shadow(0 0 8px rgba(42, 157, 143, 0.3)) !important;
        }
        100% {
          filter: drop-shadow(0 0 0px rgba(42, 157, 143, 0)) !important;
        }
      }

      .ecg-path-line:nth-child(1) {
        animation:
          ecgDraw 6s ease-in-out infinite,
          ecgGlow 3s ease-in-out infinite;
      }

      /* Efeito de "ponto" que percorre a linha (como monitor hospitalar) */
      .ecg-dot {
        position: absolute;
        width: 6px;
        height: 6px;
        background: rgba(42, 157, 143, 0.8);
        border-radius: 50%;
        box-shadow: 0 0 12px rgba(42, 157, 143, 0.5);
        animation: dotMove 6s linear infinite;
      }

      @keyframes dotMove {
        0% {
          left: 0;
          top: 50%;
        }
        100% {
          left: 100%;
          top: 50%;
        }
      }

      /* Para diminuir a intensidade do ECG */
      .ecg-container {
        opacity: 0.2;
      } /* Valor padrão: 0.3 */

      /* Para diminuir a intensidade do coração */
      .heart-container {
        opacity: 0.05;
      } /* Valor padrão: 0.08 */

      /* Para acelerar ou desacelerar a batida */
      .heart {
        animation: heartbeat 1.5s ease-in-out infinite;
      } /* Padrão: 1.2s */

      /* Para acelerar o ECG */
      .ecg-path {
        animation: ecgDraw 6s ease-in-out infinite;
      } /* Padrão: 8s */

      /* ===== CORAÇÃO PALPITANTE DENTRO DO CARD ===== */
      .heart-beat {
        display: inline-block;
        font-size: 1.1rem;
        color: var(--secondary);
        animation: heartPulse 1.2s ease-in-out infinite;
        margin-right: 4px;
      }

      @keyframes heartPulse {
        0%,
        100% {
          transform: scale(1);
        }
        14% {
          transform: scale(1.25);
          color: #dc3545;
        }
        28% {
          transform: scale(1);
          color: var(--secondary);
        }
        42% {
          transform: scale(1.15);
          color: #dc3545;
        }
        56% {
          transform: scale(1);
          color: var(--secondary);
        }
        70% {
          transform: scale(1.08);
          color: #dc3545;
        }
        84% {
          transform: scale(1);
          color: var(--secondary);
        }
      }

      /* Ondas de pulso ao redor do coração (dentro do card) */
      .heart-ring {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 50px;
        height: 50px;
        border-radius: 50%;
        border: 2px solid rgba(220, 53, 69, 0.08);
        animation: ringPulse 2.5s ease-out infinite;
        pointer-events: none;
        z-index: 0;
      }

      .heart-ring:nth-child(2) {
        animation-delay: 0.5s;
        width: 60px;
        height: 60px;
      }

      .heart-ring:nth-child(3) {
        animation-delay: 1s;
        width: 70px;
        height: 70px;
      }

      @keyframes ringPulse {
        0% {
          transform: translate(-50%, -50%) scale(0.5);
          opacity: 1;
        }
        100% {
          transform: translate(-50%, -50%) scale(2);
          opacity: 0;
        }
      }

      /* Ajuste do card para conter o coração */
      .login-card {
        position: relative;
        overflow: hidden;
      }

      .login-card .heart-ring-container {
        position: absolute;
        top: 50%;
        left: 15%;
        transform: translateY(-50%);
        width: 80px;
        height: 80px;
        z-index: 0;
        pointer-events: none;
        opacity: 0.4;
      }

      /* Ajuste do logo para ficar sobre o coração */
      .login-logo {
        position: relative;
        z-index: 1;
      }
      /* ===== LOGIN CARD (sobreposição com z-index) ===== */
      #loginScreen {
        position: relative;
        z-index: 2;
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
      }

      .login-card {
        position: relative;
        z-index: 3;
        background: linear-gradient(
          165deg,
          #f4f9f8 0%,
          #e7f2f0 55%,
          #dbeeeb 100%
        );
        border: 1px solid rgba(0, 90, 156, 0.1);
        border-radius: 20px;
        padding: 28px 36px 24px;
        width: 100%;
        max-width: 520px;
        box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
        overflow: hidden;
        backdrop-filter: blur(10px);
        background: rgba(244, 249, 248, 0.92);
      }

      /* ===== PONTOS DE BRIlHO NO FUNDO ===== */
      .sparkle {
        position: absolute;
        width: 4px;
        height: 4px;
        background: rgba(255, 255, 255, 0.15);
        border-radius: 50%;
        animation: sparkleFloat 20s linear infinite;
      }

      .sparkle:nth-child(1) {
        top: 10%;
        left: 5%;
        animation-delay: 0s;
      }
      .sparkle:nth-child(2) {
        top: 20%;
        right: 8%;
        animation-delay: 3s;
        width: 6px;
        height: 6px;
      }
      .sparkle:nth-child(3) {
        bottom: 30%;
        left: 10%;
        animation-delay: 6s;
      }
      .sparkle:nth-child(4) {
        bottom: 15%;
        right: 5%;
        animation-delay: 9s;
        width: 5px;
        height: 5px;
      }
      .sparkle:nth-child(5) {
        top: 45%;
        left: 3%;
        animation-delay: 12s;
      }
      .sparkle:nth-child(6) {
        top: 60%;
        right: 3%;
        animation-delay: 15s;
        width: 3px;
        height: 3px;
      }

      @keyframes sparkleFloat {
        0%,
        100% {
          opacity: 0;
          transform: translateY(0) scale(0);
        }
        20% {
          opacity: 1;
          transform: translateY(-30px) scale(1);
        }
        80% {
          opacity: 1;
          transform: translateY(-100px) scale(1);
        }
        100% {
          opacity: 0;
          transform: translateY(-150px) scale(0);
        }
      }

      /* ============ LOGIN (redesenhado — técnico, paleta HYGEIA, gradiente leve) ============ */
      #loginScreen {
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        background: linear-gradient(
          135deg,
          #16303c,
          var(--dark),
          var(--primary)
        );
        position: relative;
        overflow: hidden;
      }
      #loginScreen::before {
        content: "";
        position: absolute;
        inset: 0;
        background-image:
          linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
          linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
        background-size: 46px 46px;
      }
      #loginScreen::after {
        content: "";
        position: absolute;
        width: 520px;
        height: 520px;
        border-radius: 50%;
        background: radial-gradient(
          circle,
          rgba(42, 157, 143, 0.25),
          transparent 70%
        );
        top: -160px;
        right: -120px;
      }
      .login-card {
        position: relative;
        z-index: 1;
        background: linear-gradient(
          165deg,
          #d2f3ec 0%,
          #e7f2f000 55%,
          #dbeeeb 100%
        );
        border: 1px solid rgba(0, 90, 156, 0.1);
        border-radius: 22px;
        padding: 38px 40px 32px;
        width: 100%;
        max-width: 460px;
        box-shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
        max-height: 92vh;
        overflow-y: auto;
      }
      .login-card::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 5px;
        border-radius: 22px 22px 0 0;
        background: linear-gradient(
          90deg,
          var(--primary),
          var(--secondary),
          var(--accent)
        );
      }
      .login-top {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        margin-bottom: 4px;
      }
      .login-logo {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 1.8rem;
        font-weight: 900;
        color: var(--primary);
      }
      .login-logo i {
        color: var(--secondary);
      }
      .login-badge {
        font-size: 0.65rem;
        font-weight: 800;
        letter-spacing: 0.5px;
        background: rgba(0, 90, 156, 0.08);
        color: var(--primary);
        padding: 4px 9px;
        border-radius: 50px;
        border: 1px solid rgba(0, 90, 156, 0.15);
      }
      .login-status {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 0.72rem;
        color: #4b7c73;
        margin: 6px 0 20px;
        font-weight: 600;
      }
      .status-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--success);
        box-shadow: 0 0 0 rgba(40, 167, 69, 0.5);
        animation: statusPulse 2s infinite;
      }
      @keyframes statusPulse {
        0% {
          box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.5);
        }
        70% {
          box-shadow: 0 0 0 7px rgba(40, 167, 69, 0);
        }
        100% {
          box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
        }
      }
      .role-pills {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 10px;
      }
      .role-pill {
        border: 1px solid rgba(0, 90, 156, 0.18);
        background: #fff;
        border-radius: 50px;
        padding: 7px 14px 7px 10px;
        font-size: 0.82rem;
        font-weight: 700;
        cursor: pointer;
        color: var(--text);
        transition: 0.2s;
        display: flex;
        align-items: center;
        gap: 6px;
      }
      .role-pill i {
        font-size: 0.8rem;
        color: var(--secondary);
      }
      .role-pill:hover {
        border-color: var(--secondary);
        box-shadow: 0 4px 12px rgba(42, 157, 143, 0.18);
        transform: translateY(-1px);
      }
      .role-pill.active {
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        color: #fff;
        border-color: transparent;
        box-shadow: 0 6px 16px rgba(0, 90, 156, 0.3);
      }
      .role-pill.active i {
        color: var(--accent);
      }
      .role-desc {
        background: rgba(255, 255, 255, 0.7);
        border: 1px solid rgba(0, 90, 156, 0.08);
        border-radius: 10px;
        padding: 10px 12px;
        font-size: 0.8rem;
        color: var(--text);
        margin-bottom: 16px;
        min-height: 38px;
      }
      .login-cred-hint {
        font-size: 0.72rem;
        color: #6c8b86;
        margin: -6px 0 12px;
      }
      .btn-login {
        background: linear-gradient(135deg, var(--secondary), var(--primary));
        border: none;
        color: #fff;
        font-weight: 700;
        border-radius: 10px;
        padding: 13px;
        width: 100%;
        transition: 0.25s;
        box-shadow: 0 8px 22px rgba(42, 157, 143, 0.25);
      }
      .btn-login:hover {
        filter: brightness(1.08);
        transform: translateY(-1px);
      }

      /* ============ APP SHELL ============ */
      #app {
        display: block;
        min-height: 100vh;
      }
      .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: var(--sidebar-w);
        background: linear-gradient(180deg, var(--dark) 0%, #1c3540 100%);
        color: #fff;
        overflow-y: auto;
        z-index: 1000;
        transition: 0.3s;
      }
      .sidebar .brand {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 22px 20px;
        font-weight: 900;
        font-size: 1.3rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      }
      .sidebar .brand i {
        color: var(--secondary);
      }
      .nav-group-title {
        text-transform: uppercase;
        font-size: 0.68rem;
        letter-spacing: 1.2px;
        color: rgba(255, 255, 255, 0.38);
        padding: 18px 20px 6px;
        font-weight: 700;
      }
      .sidebar .nav-link {
        color: rgba(255, 255, 255, 0.78);
        padding: 10px 18px;
        margin: 2px 10px;
        border-radius: 10px;
        font-size: 0.9rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 12px;
        transition: 0.2s;
        cursor: pointer;
      }
      .sidebar .nav-link i {
        width: 18px;
        text-align: center;
        color: var(--secondary);
      }
      .sidebar .nav-link:hover {
        background: rgba(255, 255, 255, 0.07);
        color: #fff;
        transform: translateX(2px);
      }
      .sidebar .nav-link.active {
        background: rgba(42, 157, 143, 0.22);
        color: #fff;
        box-shadow: inset 3px 0 0 var(--secondary);
      }
      .sidebar .nav-link.tour-glow {
        animation: tourGlow 1.1s ease-in-out infinite;
      }
      @keyframes tourGlow {
        0%,
        100% {
          box-shadow:
            inset 3px 0 0 var(--accent),
            0 0 0 rgba(233, 196, 106, 0);
        }
        50% {
          box-shadow:
            inset 3px 0 0 var(--accent),
            0 0 14px rgba(233, 196, 106, 0.7);
        }
      }

      .main-wrap {
        margin-left: var(--sidebar-w);
        min-height: 100vh;
        transition: 0.3s;
      }
      .topbar {
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(10px);
        box-shadow: 0 2px 12px rgba(38, 70, 83, 0.06);
        padding: 14px 28px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: sticky;
        top: 0;
        z-index: 900;
      }
      .topbar .search-box {
        background: var(--light);
        border-radius: 50px;
        padding: 8px 16px;
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 280px;
        color: #6c757d;
        font-size: 0.9rem;
        transition: 0.2s;
      }
      .topbar .search-box:focus-within {
        box-shadow: 0 0 0 3px rgba(42, 157, 143, 0.18);
      }
      .topbar .search-box input {
        border: none;
        background: transparent;
        outline: none;
        width: 100%;
      }
      .topbar .user-chip {
        display: flex;
        align-items: center;
        gap: 10px;
      }
      .avatar {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 0.9rem;
      }
      #sidebarToggle {
        display: none;
        border: none;
        background: transparent;
        font-size: 1.3rem;
        color: var(--dark);
      }
      .icon-btn {
        border: none;
        background: var(--light);
        width: 40px;
        height: 40px;
        border-radius: 50%;
        color: var(--dark);
        font-size: 1rem;
        transition: 0.2s;
      }
      .icon-btn:hover {
        background: rgba(42, 157, 143, 0.15);
        color: var(--secondary);
        transform: translateY(-1px);
      }

      .bell-btn {
        position: relative;
      }
      .bell-dot {
        position: absolute;
        top: 6px;
        right: 8px;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--danger);
        border: 2px solid #fff;
      }
      .alerts-menu {
        width: 320px;
        max-height: 360px;
        overflow-y: auto;
        padding: 8px;
      }
      .alert-row {
        display: flex;
        gap: 10px;
        padding: 9px 8px;
        border-radius: 8px;
        transition: 0.15s;
      }
      .alert-row:hover {
        background: var(--light);
      }
      .alert-row i {
        margin-top: 3px;
      }

      .content {
        padding: 28px;
      }
      .page {
        display: none;
        animation: fadeIn 0.3s ease;
      }
      .page.active {
        display: block;
      }
      @keyframes fadeIn {
        from {
          opacity: 0;
          transform: translateY(8px);
        }
        to {
          opacity: 1;
          transform: translateY(0);
        }
      }

      .kpi-card {
        background: #fff;
        border-radius: 16px;
        padding: 20px;
        box-shadow: 0 4px 20px rgba(38, 70, 83, 0.06);
        border-left: 4px solid var(--secondary);
        transition: 0.25s;
        height: 100%;
      }
      .kpi-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 30px rgba(38, 70, 83, 0.12);
      }
      .kpi-card .kpi-icon {
        width: 42px;
        height: 42px;
        border-radius: 11px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(42, 157, 143, 0.12);
        color: var(--secondary);
        font-size: 1.1rem;
        margin-bottom: 10px;
      }
      .kpi-value {
        font-size: 1.55rem;
        font-weight: 900;
        color: var(--dark);
      }
      .kpi-label {
        font-size: 0.76rem;
        color: #6c757d;
        text-transform: uppercase;
        letter-spacing: 0.5px;
      }

      .panel {
        background: #fff;
        border-radius: 16px;
        padding: 22px;
        box-shadow: 0 4px 20px rgba(38, 70, 83, 0.06);
        margin-bottom: 24px;
        transition: 0.2s;
      }
      .panel-title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 18px;
        flex-wrap: wrap;
        gap: 8px;
      }
      .panel-title h5 {
        margin: 0;
      }

      .badge-status {
        padding: 5px 12px;
        border-radius: 50px;
        font-size: 0.72rem;
        font-weight: 700;
      }
      .bg-baixo,
      .bg-livre,
      .bg-concluido {
        background: #e6f6f4;
        color: var(--secondary);
      }
      .bg-medio,
      .bg-pendente {
        background: #fff6e0;
        color: #b98900;
      }
      .bg-alto,
      .bg-critico {
        background: #fdecec;
        color: var(--danger);
      }
      .bg-ocupado {
        background: #e7f0fa;
        color: var(--primary);
      }
      .bg-bloqueado {
        background: #f1f1f1;
        color: #6c757d;
      }
      .badge-readonly {
        background: #eef1f4;
        color: #6c757d;
        font-size: 0.7rem;
        font-weight: 700;
        padding: 4px 10px;
        border-radius: 50px;
      }

      table.table {
        font-size: 0.9rem;
      }
      table.table thead {
        background: var(--light);
      }
      .table > :not(caption) > * > * {
        vertical-align: middle;
      }
      table.table tbody tr {
        transition: 0.15s;
      }
      table.table tbody tr:hover {
        background: rgba(42, 157, 143, 0.05);
      }

      .patient-list-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px 14px;
        border-radius: 12px;
        cursor: pointer;
        transition: 0.2s;
      }
      .patient-list-item:hover {
        background: var(--light);
        transform: translateX(2px);
      }
      .patient-list-item.active {
        background: rgba(42, 157, 143, 0.1);
      }
      .patient-list-item .avatar {
        width: 40px;
        height: 40px;
        font-size: 0.85rem;
      }
      .alert-tag {
        display: inline-block;
        background: #fdecec;
        color: var(--danger);
        font-size: 0.72rem;
        font-weight: 700;
        padding: 3px 10px;
        border-radius: 50px;
        margin-right: 6px;
        margin-top: 6px;
      }
      .tab-mini {
        border-bottom: 1px solid #eee;
        margin-bottom: 16px;
      }
      .tab-mini .nav-link {
        color: #6c757d;
        font-weight: 700;
        font-size: 0.88rem;
        border: none;
        border-bottom: 2px solid transparent;
      }
      .tab-mini .nav-link.active {
        color: var(--primary) !important;
        border-bottom-color: var(--primary);
        background: transparent !important;
      }

      .bed-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 12px;
      }
      .bed {
        border-radius: 12px;
        padding: 12px 8px;
        text-align: center;
        cursor: pointer;
        transition: 0.2s;
        font-size: 0.78rem;
        font-weight: 700;
      }
      .bed.readonly {
        cursor: default;
      }
      .bed:hover {
        transform: scale(1.06);
      }
      .bed.readonly:hover {
        transform: none;
      }
      .bed.livre {
        background: #e6f6f4;
        color: var(--secondary);
      }
      .bed.ocupado {
        background: #e7f0fa;
        color: var(--primary);
      }
      .bed.bloqueado {
        background: #f1f1f1;
        color: #6c757d;
      }
      .bed i {
        display: block;
        font-size: 1.3rem;
        margin-bottom: 4px;
      }

      .progress {
        height: 8px;
        border-radius: 50px;
      }

      /* ===== BI HUB ===== */
      .bi-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 22px;
      }
      .bi-pill {
        border: 1px solid #dee2e6;
        background: #fff;
        border-radius: 50px;
        padding: 8px 16px;
        font-size: 0.82rem;
        font-weight: 700;
        color: var(--text);
        cursor: pointer;
        transition: 0.2s;
        display: flex;
        align-items: center;
        gap: 8px;
      }
      .bi-pill i {
        color: var(--secondary);
      }
      .bi-pill:hover {
        border-color: var(--secondary);
        transform: translateY(-1px);
      }
      .bi-pill.active {
        background: var(--primary);
        color: #fff;
        border-color: var(--primary);
      }
      .bi-pill.active i {
        color: var(--accent);
      }
      .bi-board {
        display: none;
      }
      .bi-board.active {
        display: block;
        animation: fadeIn 0.35s ease;
      }
      .bi-board-header {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 18px;
      }
      .bi-board-header .bi-icon {
        width: 46px;
        height: 46px;
        border-radius: 12px;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.15rem;
      }
      .chart-wrap {
        position: relative;
        height: 270px;
      }

      /* ===== TUTORIAL INTERATIVO ===== */
      .tutorial-overlay {
        position: fixed;
        inset: 0;
        background: rgba(38, 70, 83, 0.55);
        z-index: 9999;
        display: none;
      }
      .tutorial-highlight {
        position: fixed;
        z-index: 10000;
        border-radius: 10px;
        box-shadow:
          0 0 0 4px var(--secondary),
          0 0 24px rgba(42, 157, 143, 0.5),
          0 0 0 9999px rgba(38, 70, 83, 0.55);
        pointer-events: none;
        transition:
          top 0.3s ease,
          left 0.3s ease,
          width 0.3s ease,
          height 0.3s ease;
        animation: pulseHighlight 2s infinite;
      }
      @keyframes pulseHighlight {
        0%,
        100% {
          box-shadow:
            0 0 0 4px var(--secondary),
            0 0 20px rgba(42, 157, 143, 0.4),
            0 0 0 9999px rgba(38, 70, 83, 0.55);
        }
        50% {
          box-shadow:
            0 0 0 7px var(--secondary),
            0 0 30px rgba(42, 157, 143, 0.65),
            0 0 0 9999px rgba(38, 70, 83, 0.55);
        }
      }
      .tutorial-tooltip {
        position: fixed;
        z-index: 10001;
        background: #fff;
        border-radius: 14px;
        padding: 18px 20px;
        max-width: 360px;
        box-shadow: 0 20px 55px rgba(0, 0, 0, 0.35);
        animation: slideUp 0.25s ease-out;
      }
      @keyframes slideUp {
        from {
          opacity: 0;
          transform: translateY(14px);
        }
        to {
          opacity: 1;
          transform: translateY(0);
        }
      }
      .tprogress-dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #dee2e6;
        display: inline-block;
        margin-right: 4px;
        transition: 0.2s;
      }
      .tprogress-dot.active {
        background: var(--secondary);
        width: 16px;
        border-radius: 4px;
      }

      /* ===== TEMA ESCURO (aplicado apenas dentro da plataforma) ===== */
      #app[data-theme="dark"] {
        background: #101a21;
      }
      #app[data-theme="dark"] .content,
      #app[data-theme="dark"] .main-wrap {
        background: #101a21;
      }
      #app[data-theme="dark"] .topbar {
        background: rgba(19, 29, 36, 0.9);
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
      }
      #app[data-theme="dark"] .search-box {
        background: #1c2b34;
        color: #a9bcc4;
      }
      #app[data-theme="dark"] .search-box input {
        color: #e7edf0;
      }
      #app[data-theme="dark"] .icon-btn {
        background: #1c2b34;
        color: #c7d1d9;
      }
      #app[data-theme="dark"] .panel,
      #app[data-theme="dark"] .kpi-card,
      #app[data-theme="dark"] .login-card {
        background: #17242c;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
      }
      #app[data-theme="dark"] h1,
      #app[data-theme="dark"] h2,
      #app[data-theme="dark"] h3,
      #app[data-theme="dark"] h4,
      #app[data-theme="dark"] h5,
      #app[data-theme="dark"] h6 {
        color: #e7edf0;
      }
      #app[data-theme="dark"] .kpi-value {
        color: #f2f6f7;
      }
      #app[data-theme="dark"] .text-muted {
        color: #8ea3ab !important;
      }
      #app[data-theme="dark"] table.table {
        color: #dce6ea;
      }
      #app[data-theme="dark"] table.table thead {
        background: #1c2b34;
        color: #c7d1d9;
      }
      #app[data-theme="dark"] table.table tbody tr:hover {
        background: rgba(42, 157, 143, 0.12);
      }
      #app[data-theme="dark"] .bi-pill {
        background: #17242c;
        color: #c7d1d9;
        border-color: #2a3c45;
      }
      #app[data-theme="dark"] .bed.livre {
        background: #123f39;
        color: #7fd9c9;
      }
      #app[data-theme="dark"] .bed.ocupado {
        background: #123350;
        color: #7fb8e6;
      }
      #app[data-theme="dark"] .bed.bloqueado {
        background: #2a3439;
        color: #a9b6bc;
      }
      #app[data-theme="dark"] .patient-list-item:hover,
      #app[data-theme="dark"] .patient-list-item.active {
        background: #1c2b34;
      }
      #app[data-theme="dark"] .form-control {
        background: #101a21;
        border-color: #2a3c45;
        color: #e7edf0;
      }
      #app[data-theme="dark"] .modal-content {
        background: #17242c;
        color: #dce6ea;
      }
      #app[data-theme="dark"] .tutorial-tooltip {
        background: #17242c;
        color: #dce6ea;
      }
      #app[data-theme="dark"] .badge-readonly {
        background: #1c2b34;
        color: #a9bcc4;
      }

      /* ===== RIPPLE / MICROINTERAÇÕES GLOBAIS ===== */
      .btn,
      .role-pill,
      .bi-pill {
        position: relative;
        overflow: hidden;
      }
      .ripple {
        position: absolute;
        width: 16px;
        height: 16px;
        margin: -8px;
        background: rgba(255, 255, 255, 0.55);
        border-radius: 50%;
        transform: scale(0);
        animation: rippleAnim 0.6s ease-out;
        pointer-events: none;
      }
      @keyframes rippleAnim {
        to {
          transform: scale(9);
          opacity: 0;
        }
      }
      .btn:active,
      .role-pill:active,
      .bi-pill:active {
        transform: scale(0.97);
      }

      /* ===== TOASTS ===== */
      #toastStack {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 11000;
        display: flex;
        flex-direction: column;
        gap: 10px;
      }

      /* ===== ALERGIA / DECISION SUPPORT ===== */
      .alergia-warning {
        background: #fdecec;
        border: 1px solid #f5b5bd;
        border-radius: 10px;
        padding: 10px 12px;
        font-size: 0.82rem;
        color: #9c2530;
      }

      @media (max-width: 992px) {
        .sidebar {
          transform: translateX(-100%);
        }
        .sidebar.show {
          transform: translateX(0);
        }
        .main-wrap {
          margin-left: 0;
        }
        #sidebarToggle {
          display: block;
        }
      }
