:root { 
    --primary: #0f766e; 
    --primary-light: #ccfbf1; 
    --primary-hover: #115e59; 
    --bg: #f8fafc; 
    --card: #ffffff; 
    --text: #0f172a; 
    --text-light: #64748b; 
    --border: #e2e8f0; 
    --success: #10b981; 
    --error: #ef4444; 
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Plus Jakarta Sans', sans-serif; }
body { background-color: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }

header { background: var(--card); border-bottom: 1px solid var(--border); padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 3px rgba(0,0,0,0.02); }
.logo { font-size: 18px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; cursor: pointer; }

.btn { background: var(--primary); color: white; padding: 8px 16px; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; transition: 0.2s; }
.btn:hover { background: var(--primary-hover); } 
.btn-alt { background: transparent; border: 1px solid var(--border); color: #334155; } 
.btn-alt:hover { background: #f1f5f9; } 
.btn-danger { background: #fef2f2; color: #ef4444; border: 1px solid #fecaca; } 
.btn-danger:hover { background: #fee2e2; } 
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }

.hero-banner { background: linear-gradient(135deg, #0f766e 0%, #115e59 100%); color: white; padding: 40px 32px; border-radius: 20px; margin-bottom: 32px; text-align: center; box-shadow: 0 10px 25px -5px rgba(15,118,110,0.2); }
.hero-banner h1 { font-size: 28px; font-weight: 800; margin-bottom: 12px; letter-spacing: -0.5px; }
.hero-banner p { color: var(--primary-light); font-size: 15px; max-width: 600px; margin: 0 auto; line-height: 1.6; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 24px; margin-bottom: 24px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02); }
.card-header-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }

.metric-summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.metric-pill-card { background: var(--card); border: 1px solid var(--border); padding: 16px 20px; border-radius: 16px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.01); }
.metric-pill-card .data-num { font-size: 24px; font-weight: 800; color: var(--primary); }
.metric-pill-card .label-txt { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-light); letter-spacing: 0.5px; }

.gateway-title { text-align: center; font-size: 18px; font-weight: 700; margin-bottom: 20px; color: var(--text); }
.patient-selection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
.profile-select-card { background: var(--card); border: 2px solid var(--border); padding: 20px; border-radius: 16px; text-align: center; cursor: pointer; transition: all 0.2s; outline: none; width: 100%; }
.profile-select-card:hover { border-color: var(--primary); background: #f0fdfa; transform: translateY(-2px); }
.profile-select-card.active { border-color: var(--primary); background: #e6f4f1; box-shadow: 0 10px 15px -3px rgba(15,118,110,0.1); }
.avatar { margin: 0 auto 12px auto; width: 48px; height: 48px; font-size: 20px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.avatar-male { background: #e0f2fe; color: #0284c7; } .avatar-female { background: #fce7f3; color: #db2777; }

.main-container { display: flex; flex-direction: column; max-width: 1200px; width: 100%; margin: 0 auto; padding: 24px; gap: 16px; }
.content-view { display: none; } .content-view.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Critical: overflow must be visible to allow absolute popovers to render outside the table */
.table-responsive-container { width: 100%; overflow: visible; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 20px; background: var(--card); }
.v-table { width: 100%; border-collapse: collapse; min-width: 850px; font-size: 13px; text-align: left; }
.v-table th { padding: 14px 16px; color: var(--text-light); text-transform: uppercase; background: #f8fafc; border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 700; letter-spacing: 0.5px; }
.v-table td { padding: 16px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.v-table tr:hover { background: #f8fafc; }
.check-container { display: flex; align-items: center; gap: 12px; font-weight: 600; cursor: pointer; color: var(--text); font-size: 14px; }
.check-container input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }

.status-badge { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 20px; display: inline-block; letter-spacing: 0.3px; }
.status-done { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }
.status-due { background: #fef9c3; color: #713f12; border: 1px solid #fef08a; }
.status-upcoming { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.status-overdue { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; animation: pulseRed 2s infinite ease-in-out; }
@keyframes pulseRed { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.2); } 50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); } }
.timeline-tag { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 6px; background: #f1f5f9; color: #475569; }

/* --- POPOVER ALERTS UI --- */
.row-action-block { display: flex; gap: 8px; align-items: center; position: relative; justify-content: flex-end; }
.popover-box { display: none; position: absolute; right: 0; top: calc(100% + 8px); z-index: 9999; background: #ffffff; border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 8px 10px -6px rgba(0, 0, 0, 0.1); width: 290px; text-align: left; }
.popover-box.active { display: block; animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes popIn { from { opacity: 0; transform: scale(0.95) translateY(-10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.btn-active-alert { background: #10b981; color: white; border: 1px solid #059669; box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2); }
.btn-active-alert:hover { background: #059669; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; background: #fff; transition: 0.2s; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.config-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; align-items: flex-end; }
.form-group { margin-bottom: 12px; text-align: left; } 
.form-group label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.alert { padding: 14px; border-radius: 10px; margin-bottom: 20px; font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; } 
.alert-error { background: #fef2f2; color: #ef4444; border: 1px solid #fee2e2; } 
.alert-success { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }

@media print {
    body { background: #fff; color: #000; font-size: 12px; }
    header, .hero-banner, .metric-summary-strip, .gateway-card, .print-hide, .popover-box { display: none !important; }
    .main-container { padding: 0; margin: 0; width: 100%; }
    .content-view { display: none !important; } .content-view.active { display: block !important; }
    .card { border: none !important; padding: 0 !important; box-shadow: none !important; }
    .table-responsive-container { border: 1px solid #000 !important; border-radius: 0 !important; overflow: visible !important; }
    .v-table { min-width: 100% !important; } .v-table th, .v-table td { padding: 8px !important; border-bottom: 1px solid #000 !important; color: #000 !important; }
    .status-badge { border: none !important; background: none !important; color: #000 !important; font-weight: bold !important; padding: 0 !important; }
    input[type="date"] { border: none !important; background: none !important; padding: 0 !important; font-weight: bold; }
}