/* ══════════════════════════════════════════════════════════════════
   VITALINK - DESIGN SYSTEM
   ══════════════════════════════════════════════════════════════════ */

:root {
    --primary: #4F8CF7;
    --primary-dark: #3A6FD8;
    --primary-light: #E8F0FE;
    --primary-glow: rgba(79, 140, 247, 0.3);
    --success: #34C759;
    --success-light: #E5F9ED;
    --warning: #FF9F0A;
    --warning-light: #FFF3E0;
    --danger: #FF3B30;
    --danger-light: #FFE5E3;
    --info: #5AC8FA;
    --info-light: #E3F6FD;

    --bg: #F5F7FA;
    --bg-card: #FFFFFF;
    --bg-sidebar: #1A1D2E;
    --bg-sidebar-hover: #252840;
    --bg-sidebar-active: #2D3154;

    --text: #1A1D2E;
    --text-secondary: #5A6178;
    --text-muted: #9CA3B8;
    --text-sidebar: #B8BDD0;
    --text-sidebar-active: #FFFFFF;

    --border: #E2E6EF;
    --border-light: #F0F2F7;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
}

/* ═══ RESET & BASE ═══ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

input, select, button, textarea {
    font-family: inherit;
    font-size: inherit;
}

.hidden { display: none !important; }

/* ═══ SCREEN MANAGEMENT ═══ */
.screen {
    display: none;
    min-height: 100vh;
}
.screen.active {
    display: flex;
}

/* ══════════════════════════════════════════════════════════════════
   LOGIN SCREEN
   ══════════════════════════════════════════════════════════════════ */

.login-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

.login-left {
    flex: 1;
    background: linear-gradient(135deg, #1A1D2E 0%, #2D3154 50%, #4F8CF7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(79, 140, 247, 0.15) 0%, transparent 50%);
    animation: floatBg 15s ease-in-out infinite;
}

@keyframes floatBg {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -20px); }
}

.brand-hero {
    text-align: center;
    color: white;
    position: relative;
    z-index: 1;
}

.logo-pulse {
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
}

.logo-svg {
    width: 100%;
    height: 100%;
}

.pulse-ring {
    animation: pulse 2s ease-in-out infinite;
    transform-origin: center;
}

@keyframes pulse {
    0% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.05); }
    100% { opacity: 0.3; transform: scale(1); }
}

.brand-name {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 0.75rem;
}

.brand-name span {
    color: var(--primary);
}

.brand-tagline {
    font-size: 1.1rem;
    opacity: 0.8;
    max-width: 360px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.feature-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.pill {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.15);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    backdrop-filter: blur(4px);
}

.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: var(--bg);
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-card h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-group label small {
    font-weight: 400;
    color: var(--text-muted);
}

.input-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon > svg {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
}

.input-icon input {
    width: 100%;
    padding: 0.8rem 3.1rem 0.8rem 2.75rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--bg-card);
}

.input-icon input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.toggle-pass {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-muted);
    z-index: 2;
}
.toggle-pass svg {
    position: static;
    width: 18px;
    height: 18px;
    color: inherit;
    pointer-events: none;
}
.toggle-pass:hover { color: var(--primary); }
.toggle-pass:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.error-msg {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--danger-light);
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.demo-hint {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--primary-light);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
}

/* ═══ BUTTONS ═══ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}
.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border);
}
.btn-outline:hover {
    border-color: var(--text-secondary);
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 0.9rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-danger {
    background: var(--danger-light);
    color: var(--danger);
}
.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover {
    background: #2AA84A;
}

/* ══════════════════════════════════════════════════════════════════
   SIDEBAR
   ══════════════════════════════════════════════════════════════════ */

#screen-dashboard {
    display: none;
}
#screen-dashboard.active {
    display: flex;
}

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand {
    color: white;
    font-size: 1.2rem;
    letter-spacing: -0.5px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-sidebar);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
}
.sidebar-toggle:hover {
    background: var(--bg-sidebar-hover);
}

.sidebar-menu {
    list-style: none;
    padding: 0.75rem 0.5rem;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    margin: 2px 0;
    color: var(--text-sidebar);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.9rem;
}

.menu-item:hover {
    background: var(--bg-sidebar-hover);
    color: white;
}

.menu-item.active {
    background: var(--bg-sidebar-active);
    color: var(--text-sidebar-active);
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    width: 3px;
    height: 28px;
    background: var(--primary);
    border-radius: 0 4px 4px 0;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
}

.user-role {
    color: var(--text-sidebar);
    font-size: 0.75rem;
}

.btn-logout {
    background: none;
    border: none;
    color: var(--text-sidebar);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: var(--transition);
}
.btn-logout:hover {
    background: rgba(255,59,48,0.2);
    color: var(--danger);
}

/* ══════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════════════════════════════════ */

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    transition: var(--transition);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    padding: 4px;
}

.page-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.device-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.connected {
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.current-time {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ═══ CONTENT SECTIONS ═══ */
.content-section {
    display: none;
    padding: 2rem;
    animation: fadeIn 0.3s ease;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* ═══ STATS GRID ═══ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-patients .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-meds .stat-icon { background: var(--info-light); color: var(--info); }
.stat-reminders .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-confirmed .stat-icon { background: var(--success-light); color: var(--success); }

.stat-number {
    font-size: 1.75rem;
    font-weight: 800;
    display: block;
    line-height: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ═══ DASHBOARD GRID ═══ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

/* ═══ CARDS ═══ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
    max-height: 400px;
    overflow-y: auto;
}

/* ═══ EMPTY STATE ═══ */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 0.95rem;
    margin-top: 0.75rem;
    font-weight: 500;
}

.empty-state small {
    font-size: 0.8rem;
    display: block;
    margin-top: 0.25rem;
}

/* ═══ DATA TABLE ═══ */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg);
}

.data-table th {
    padding: 0.85rem 1rem;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}

.data-table td {
    padding: 0.85rem 1rem;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: var(--primary-light);
}

.data-table .actions {
    display: flex;
    gap: 0.5rem;
}

/* ═══ BADGES ═══ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-waiting { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.badge-primary { background: var(--primary-light); color: var(--primary); }

/* ═══ TIMELINE ═══ */
.timeline {
    position: relative;
}

.timeline-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 19px;
    top: 44px;
    bottom: -8px;
    width: 2px;
    background: var(--border);
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    border: 3px solid var(--bg);
    position: relative;
    z-index: 1;
}

.timeline-dot.pending { background: var(--warning-light); }
.timeline-dot.active { background: var(--primary-light); animation: pulseTimeline 1.5s infinite; }
.timeline-dot.done { background: var(--success-light); }

@keyframes pulseTimeline {
    0%, 100% { box-shadow: 0 0 0 0 var(--primary-glow); }
    50% { box-shadow: 0 0 0 8px transparent; }
}

.timeline-content {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 1rem;
    border: 1px solid var(--border-light);
}

.timeline-content h4 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.timeline-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.timeline-meta {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.timeline-meta span {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ═══ DEVICE PANEL ═══ */
.device-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.device-visual {
    display: flex;
    justify-content: center;
}

.device-box {
    background: linear-gradient(145deg, #1A1D2E, #2D3154);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.device-screen {
    background: #0D1117;
    border-radius: var(--radius-sm);
    padding: 1rem 1.5rem;
    text-align: center;
    width: 100%;
    border: 1px solid rgba(79, 140, 247, 0.3);
}

.device-time {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    font-family: 'Courier New', monospace;
}

.device-status-text {
    color: var(--text-sidebar);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.compartments {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    width: 100%;
}

.compartment {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    padding: 1rem 0.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.compartment span {
    color: var(--text-sidebar);
    font-size: 0.75rem;
    font-weight: 600;
}

.led {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #333;
    border: 2px solid #444;
    transition: var(--transition);
}

.led.active {
    background: var(--success);
    box-shadow: 0 0 12px var(--success), 0 0 24px rgba(52, 199, 89, 0.3);
    animation: ledPulse 0.8s infinite;
}

@keyframes ledPulse {
    0%, 100% { box-shadow: 0 0 12px var(--success); }
    50% { box-shadow: 0 0 24px var(--success), 0 0 36px rgba(52, 199, 89, 0.3); }
}

.device-buzzer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-sidebar);
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    transition: var(--transition);
}

.device-buzzer.active {
    background: rgba(255, 159, 10, 0.2);
    border-color: var(--warning);
    color: var(--warning);
    animation: buzzerAnim 0.5s infinite alternate;
}

@keyframes buzzerAnim {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

.confirm-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.15);
    color: var(--text-sidebar);
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
}

.confirm-btn:not(:disabled):hover {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.confirm-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.confirm-btn.ready {
    background: var(--success);
    border-color: var(--success);
    color: white;
    animation: pulseBtn 1.5s infinite;
}

@keyframes pulseBtn {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.5); }
    50% { box-shadow: 0 0 0 10px transparent; }
}

.device-info-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow);
}

.info-card h4 {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-indicator.connected {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ═══ ALGORITHM FLOWCHART ═══ */
.algorithm-container {
    overflow-x: auto;
    padding: 1rem 0;
}

.algorithm-flow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    min-width: 600px;
    padding: 2rem;
}

.algo-node {
    position: relative;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    cursor: default;
    max-width: 420px;
    width: 100%;
}

.algo-node:hover {
    transform: scale(1.03);
}

.algo-node.highlight {
    animation: highlightNode 0.6s ease;
}

@keyframes highlightNode {
    0% { transform: scale(1); }
    50% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.algo-terminal {
    background: linear-gradient(135deg, #1A1D2E, #2D3154);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
}

.algo-process {
    background: var(--bg-card);
    border: 2px solid var(--primary);
    color: var(--text);
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

.algo-decision {
    background: var(--warning-light);
    border: 2px solid var(--warning);
    color: var(--text);
    padding: 1rem 1.5rem;
    transform: none;
    border-radius: var(--radius-sm);
    position: relative;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 260px;
    margin: 0 auto;
}

.algo-decision-text {
    background: var(--warning-light);
    border: 2px solid var(--warning);
    color: var(--text);
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
    position: relative;
}

.algo-decision-text::before {
    content: '◆';
    position: absolute;
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--warning);
    font-size: 1.2rem;
}

.algo-io {
    background: var(--primary-light);
    border: 2px solid var(--primary);
    color: var(--text);
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
    transform: skewX(-5deg);
}

.algo-io > span {
    display: block;
    transform: skewX(5deg);
}

.algo-connector {
    width: 2px;
    height: 24px;
    background: var(--border);
    position: relative;
}

.algo-connector::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: -4px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid var(--border);
}

.algo-branch {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    width: 100%;
    max-width: 640px;
}

.algo-branch-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.algo-branch-yes,
.algo-branch-no {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.algo-group-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 1rem 0 0.5rem;
    padding: 0.4rem 1rem;
    background: var(--primary-light);
    border-radius: 50px;
}

.algo-loop {
    background: var(--info-light);
    border: 2px dashed var(--info);
    color: var(--text);
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-sm);
}

/* ═══ MODALS ═══ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body input,
.modal-body select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    transition: var(--transition);
    background: var(--bg);
}

.modal-body input:focus,
.modal-body select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ═══ TOAST ═══ */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    font-weight: 500;
    font-size: 0.9rem;
    animation: toastIn 0.4s ease;
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══ FILTER ═══ */
.filter-group select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background: var(--bg-card);
    cursor: pointer;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ═══ UPCOMING REMINDER ITEMS ═══ */
.reminder-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    border-bottom: 1px solid var(--border-light);
}

.reminder-item:last-child {
    border-bottom: none;
}

.reminder-item:hover {
    background: var(--bg);
}

.reminder-time {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 55px;
    font-variant-numeric: tabular-nums;
}

.reminder-details {
    flex: 1;
}

.reminder-details .med-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.reminder-details .patient-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.reminder-comp {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    background: var(--primary-light);
    color: var(--primary);
}

/* ═══ ACTIVITY ITEM ═══ */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.activity-text {
    flex: 1;
}

.activity-text p {
    font-size: 0.85rem;
    line-height: 1.4;
}

.activity-text small {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .device-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .login-container {
        flex-direction: column;
    }
    .login-left {
        padding: 2rem;
        min-height: auto;
    }
    .brand-name {
        font-size: 2rem;
    }
    .login-right {
        padding: 2rem;
    }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .mobile-menu-btn {
        display: block;
    }
    .content-section {
        padding: 1rem;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .topbar {
        padding: 0.75rem 1rem;
    }
    .section-header {
        flex-direction: column;
    }
    .algo-branch {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .compartments {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ═══ AUTENTICACIÓN REAL: registro y verificación ═══ */
.auth-switch { text-align: center; margin-top: 1.2rem; color: var(--text-secondary); font-size: .88rem; }
.auth-link { background: none; border: none; color: var(--primary-dark); font-weight: 700; cursor: pointer; text-decoration: underline; padding: .15rem; }
.auth-link:hover { color: var(--primary); }
.auth-field { width: 100%; background: var(--bg-card); border: 2px solid var(--border); border-radius: var(--radius-sm); padding: .82rem 1rem; outline: none; }
.auth-field:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }
.auth-message { margin: .8rem 0 1rem; padding: .85rem 1rem; border-radius: var(--radius-sm); font-size: .87rem; line-height: 1.5; background: var(--danger-light); color: #a5211a; }
.auth-message.success { background: var(--success-light); color: #166a33; }
.auth-message.warning { background: var(--warning-light); color: #7a4c00; }
.auth-message.info { background: var(--primary-light); color: #28539a; }

/* ═══ REGISTRO: mostrar contraseña y validación visual ═══ */
.register-password-wrap { position: relative; }
.register-password-wrap .auth-field { padding-right: 3.4rem; }
.register-password-wrap .register-toggle-pass { right: 10px; top: 50%; transform: translateY(-50%); }
.password-match-feedback { margin-top: .45rem; font-size: .82rem; line-height: 1.4; }
.password-match-feedback.is-valid { color: #166a33; }
.password-match-feedback.is-invalid { color: #b42318; }
#register-confirm[aria-invalid="true"] { border-color: var(--danger); }
#register-confirm[aria-invalid="false"]:not(:placeholder-shown) { border-color: var(--success); }

/* ═══ RECUPERACIÓN DE CONTRASEÑA ═══ */
#new-password-confirm[aria-invalid="true"] { border-color: var(--danger); }
#new-password-confirm[aria-invalid="false"]:not(:placeholder-shown) { border-color: var(--success); }
#new-password-submit:disabled { opacity: .55; cursor: not-allowed; }


/* ═══ AYUDA PARA CORREOS: sugerencias y verificación antes de enviarlos ═══ */
.email-help {
    margin-top: .55rem;
    padding: .7rem .85rem;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    line-height: 1.6;
    background: var(--primary-light);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.email-help.email-help-warning { background: var(--warning-light); color: #764300; border-color: #f3d6a6; }
.email-help.email-help-error { background: var(--danger-light); color: #a5211a; border-color: #f4bbb8; }
.email-help-action {
    display: inline-block;
    margin: .25rem .45rem 0 0;
    padding: .18rem .3rem;
    background: none;
    border: 0;
    color: var(--primary-dark);
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}
.email-help-action-muted { color: var(--text-secondary); }
.email-help-action:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.auth-field[aria-invalid="true"], #login-email[aria-invalid="true"] { border-color: var(--danger); }

/* VitaLink V3: estado real de sincronización (no del ESP32) */
.cloud-status-row { display:flex; align-items:center; flex-wrap:wrap; gap:0.75rem; padding:0.8rem 2rem 0; }
.cloud-banner { flex:1; font-size:0.82rem; color:#20588f; padding:0.65rem 1rem; background:#e8f0fe; border:1px solid #bad3fd; border-radius:8px; }
.cloud-banner.cloud-error { background:#ffe5e3; color:#a5221d; border-color:#ffbdb9; }
@media (max-width:768px) { .cloud-status-row {padding:0.75rem 1rem 0;} }

/* ═══ VITALINK WEB v3.1 · TEMA Y CONFIGURACIÓN ═══ */
:root[data-vl-theme="dark"] {
    color-scheme: dark;
    --primary:#6FA9FF;
    --primary-dark:#91BCFF;
    --primary-light:#203C64;
    --primary-glow:rgba(111,169,255,.28);
    --success:#63DFA0;
    --success-light:#193E38;
    --warning:#FFD078;
    --warning-light:#44351D;
    --danger:#FF8A8A;
    --danger-light:#492930;
    --info:#75E2F4;
    --info-light:#183D4A;
    --bg:#0B1424;
    --bg-card:#16243A;
    --bg-sidebar:#070F1F;
    --bg-sidebar-hover:#172841;
    --bg-sidebar-active:#243A5A;
    --text:#F3F7FF;
    --text-secondary:#C2D1E7;
    --text-muted:#9FB1CE;
    --border:#39506E;
    --border-light:#2C4260;
    --shadow:0 1px 8px rgba(0,0,0,.18);
    --shadow-md:0 6px 20px rgba(0,0,0,.24);
    --shadow-lg:0 16px 45px rgba(0,0,0,.3);
}
:root[data-vl-theme="dark"] input,
:root[data-vl-theme="dark"] select,
:root[data-vl-theme="dark"] textarea {color:var(--text);}
:root[data-vl-theme="dark"] input::placeholder {color:var(--text-muted);}
:root[data-vl-theme="dark"] .cloud-banner {background:#203C64;color:#E2EEFF;border-color:#557BAE;}
:root[data-vl-theme="dark"] .cloud-banner.cloud-error {background:var(--danger-light);color:#FFB1B1;border-color:var(--danger);}
:root[data-vl-theme="dark"] .auth-message.info {color:#D0E4FF;}
:root[data-vl-theme="dark"] .auth-message.success {color:#BDFFD6;}
:root[data-vl-theme="dark"] .auth-message.warning {color:#FFE2AD;}
:root[data-vl-theme="dark"] .auth-message,
:root[data-vl-theme="dark"] .email-help.email-help-error {color:#FFC0C0;}
:root[data-vl-theme="dark"] .email-help.email-help-warning {color:#FFE4B3;}
:root[data-vl-theme="dark"] .data-table tbody tr:hover {background:var(--bg-sidebar-active);}
:root[data-vl-theme="dark"] .btn-outline {color:var(--text);}
:root[data-vl-theme="dark"] .badge-danger {color:#FFC0C0;}
:root[data-vl-theme="dark"] .badge-success {color:#B3F9D0;}
:root[data-vl-theme="dark"] .badge-warning {color:#FFE4A8;}
:root[data-vl-theme="dark"] .badge-info {color:#C2F5FF;}
:root[data-vl-theme="dark"] .badge-primary {color:#C5DCFF;}
:root[data-vl-theme="dark"] .algo-group-label {color:#C5DCFF;}
:root[data-vl-theme="dark"] .login-left {background:linear-gradient(135deg,#090F1F 0%,#13294B 57%,#3266B4 100%);}
:root[data-vl-large-text] {font-size:110%;}
.vl-web-version {font-size:.69rem;letter-spacing:.02em;color:#B6D4FF;border:1px solid rgba(134,182,255,.35);border-radius:100px;padding:.18rem .4rem;white-space:nowrap;}
.vl-profile-entry {background:none;border:1px solid transparent;cursor:pointer;text-align:left;border-radius:9px;padding:.15rem .3rem;margin:-.15rem -.3rem;min-width:0;}
.vl-profile-entry:hover,.vl-profile-entry:focus-visible {border-color:rgba(150,190,255,.42);background:rgba(255,255,255,.05);outline:none;}
.vl-profile-entry .user-details {min-width:0;}
.vl-profile-entry .user-name {max-width:140px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.vl-topbar-profile {width:38px;height:38px;border-radius:50%;display:grid;place-items:center;border:1px solid var(--border);background:var(--bg);color:var(--primary);cursor:pointer;}
.vl-topbar-profile:hover,.vl-topbar-profile:focus-visible {outline:2px solid var(--primary);outline-offset:2px;}
.vl-prefs-grid,.vl-about-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:1.15rem;max-width:1100px;align-items:start;}
.vl-prefs-grid .vl-pref-card:nth-child(2) {grid-row:span 2;}
.vl-pref-card {background:var(--bg-card);border:1px solid var(--border-light);box-shadow:var(--shadow);border-radius:var(--radius-lg);padding:1.45rem;min-width:0;}
.vl-pref-card h4 {font-size:1.06rem;font-weight:750;margin-bottom:.9rem;}
.vl-pref-muted {color:var(--text-secondary);font-size:.88rem;margin-bottom:1rem;}
.vl-pref-link {width:100%;background:transparent;border:1px solid var(--border);border-radius:var(--radius);padding:.9rem;display:flex;text-align:left;align-items:center;gap:.9rem;cursor:pointer;color:var(--text);}
.vl-pref-link:hover,.vl-pref-link:focus-visible {border-color:var(--primary);background:var(--primary-light);outline:none;}
.vl-pref-link > span:nth-child(2) {display:flex;flex-direction:column;gap:.15rem;flex:1;}
.vl-pref-link strong,.vl-pref-switch-row strong {font-size:.92rem;}
.vl-pref-link small,.vl-pref-switch-row small {display:block;font-size:.79rem;color:var(--text-secondary);}
.vl-pref-link>span:last-child {font-size:1.5rem;color:var(--text-muted);}
.vl-pref-icon {width:40px;height:40px;display:grid;place-items:center;border-radius:10px;background:var(--primary-light);color:var(--primary);font-size:1.4rem;flex-shrink:0;}
.vl-theme-picker {border:0;display:grid;gap:.7rem;min-width:0;}
.vl-theme-picker legend {font-size:.84rem;font-weight:650;margin-bottom:.7rem;color:var(--text-secondary);}
.vl-theme-option {border:1.5px solid var(--border);border-radius:12px;display:flex;gap:.85rem;align-items:center;padding:.8rem .9rem;cursor:pointer;min-width:0;}
.vl-theme-option:has(input:checked) {border-color:var(--primary);background:var(--primary-light);box-shadow:0 0 0 1px var(--primary);}
.vl-theme-option:focus-within {outline:2px solid var(--primary);outline-offset:2px;}
.vl-theme-option input {order:3;margin-left:auto;accent-color:var(--primary);width:18px;height:18px;flex-shrink:0;}
.vl-theme-option>span:nth-of-type(2) {display:flex;flex-direction:column;min-width:0;}
.vl-theme-option strong {font-size:.94rem;}
.vl-theme-option small {font-size:.77rem;color:var(--text-secondary);}
.vl-theme-symbol {display:grid;place-items:center;width:39px;height:39px;border-radius:11px;background:var(--bg);color:var(--primary);font-size:1.4rem;flex-shrink:0;}
.vl-pref-note {display:block;font-size:.81rem;color:var(--text-secondary);line-height:1.6;margin-top:.75rem;}
.vl-pref-switch-row {display:flex;align-items:center;justify-content:space-between;gap:1rem;cursor:pointer;}
.vl-pref-switch-row > span {display:flex;flex-direction:column;gap:.15rem;}
.vl-pref-switch-row input {width:20px;height:20px;accent-color:var(--primary);flex-shrink:0;}
.vl-pref-static {display:flex;justify-content:space-between;flex-wrap:wrap;gap:.6rem;border-bottom:1px solid var(--border-light);font-size:.85rem;padding:.75rem 0;}
.vl-pref-static span {color:var(--text-secondary);}
.vl-pref-static strong {font-weight:600;text-align:right;}
.vl-pref-static + .vl-pref-link {margin-top:1rem;}
.vl-inline-back {background:none;border:0;color:var(--primary-dark);font-weight:700;cursor:pointer;margin-bottom:1rem;padding:.25rem .2rem;}
.vl-inline-back:hover,.vl-inline-back:focus-visible {text-decoration:underline;outline-offset:4px;}
.vl-profile-card {width:min(100%,650px);}
.vl-profile-head {display:flex;align-items:center;gap:1rem;border-bottom:1px solid var(--border);padding-bottom:1.25rem;margin-bottom:1.25rem;}
.vl-profile-big-avatar {background:var(--primary-light);color:var(--primary);border:1px solid var(--border);border-radius:50%;width:64px;height:64px;display:grid;place-items:center;font-size:1.7rem;font-weight:750;flex-shrink:0;}
.vl-profile-head>span:last-child {display:flex;flex-direction:column;min-width:0;overflow-wrap:anywhere;}
.vl-profile-head strong {font-size:1.12rem;}
.vl-profile-head small {color:var(--text-secondary);}
#vl-web-profile-form input {width:100%;background:var(--bg);color:var(--text);border:1.5px solid var(--border);border-radius:9px;padding:.78rem .9rem;}
#vl-web-profile-form input:focus {outline:2px solid var(--primary);outline-offset:1px;}
#vl-web-profile-email {opacity:.78;cursor:not-allowed;}
.vl-profile-msg {min-height:1.4em;color:var(--success);font-size:.86rem;margin-bottom:1rem;}
.vl-profile-msg.is-error {color:var(--danger);}
.vl-about-grid {grid-template-columns:repeat(2,minmax(0,1fr));}
.vl-web-about-hero {background:linear-gradient(125deg,#0B1424,#203E72,#3C7ADE);color:#F7FBFF;text-align:center;padding:2.4rem 1.5rem;border-radius:16px;display:grid;justify-items:center;gap:.45rem;grid-column:1/-1;}
.vl-web-about-hero svg {color:#83B5FF;}
.vl-web-about-hero h4 {font-size:2rem;letter-spacing:-.04em;}
.vl-web-about-hero h4 span {color:#83B5FF;}
.vl-web-about-hero p {opacity:.93;max-width:470px;}
.vl-web-beta {background:rgba(255,255,255,.1);border:1px solid rgba(255,255,255,.2);padding:.35rem .8rem;border-radius:100px;font-size:.71rem;letter-spacing:.04em;font-weight:700;}
.vl-about-grid .vl-pref-card p {color:var(--text-secondary);font-size:.89rem;line-height:1.8;}
.vl-about-list {padding-left:1.2rem;line-height:1.9;color:var(--text-secondary);font-size:.88rem;}
.vl-about-facts {display:grid;gap:0;}
.vl-about-facts>div {display:flex;gap:1rem;justify-content:space-between;align-items:baseline;padding:.65rem 0;border-bottom:1px solid var(--border-light);}
.vl-about-facts dt {color:var(--text-secondary);font-size:.84rem;}
.vl-about-facts dd {font-weight:650;text-align:right;font-size:.86rem;}
.vl-credit {display:grid;gap:.15rem;padding:.65rem 0;border-bottom:1px solid var(--border-light);}
.vl-credit small {color:var(--text-secondary);font-size:.79rem;}
.vl-credit strong {font-size:.9rem;}
.vl-about-warning {grid-column:1/-1;background:var(--warning-light);color:var(--text);border:1px solid var(--warning);border-radius:var(--radius);padding:1.1rem 1.3rem;font-size:.88rem;}
@media(max-width:1050px) { .vl-prefs-grid,.vl-about-grid {grid-template-columns:1fr;} .vl-prefs-grid .vl-pref-card:nth-child(2){grid-row:auto;} }
@media(max-width:768px) { .vl-prefs-grid,.vl-about-grid {gap:.85rem;} .vl-pref-card{padding:1.1rem;} .vl-topbar-profile{width:35px;height:35px;} .topbar-right{gap:.6rem;} }
@media(max-width:390px) { .vl-theme-option{gap:.55rem;padding:.65rem;} .vl-theme-symbol{width:34px;height:34px;} .vl-topbar-profile{width:32px;height:32px;} }
/* Consistencia de texto y ancho del panel también en oscuro y en móvil. */
#screen-dashboard {color:var(--text);min-width:0;width:100%;max-width:100%;}
.main-content {min-width:0;max-width:100%;}
.content-section {min-width:0;}
.table-container {overflow-x:auto;}
@media(max-width:768px) {
    #screen-dashboard .main-content {width:100%;min-width:0;}
    .topbar-left {min-width:0;}
    .topbar .page-title {font-size:1rem;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
    .topbar .device-status {display:none;}
    .topbar-right {flex-shrink:0;}
}

/* Al cambiar de tema, evitar transiciones de color involuntarias del layout. */
.main-content {transition:margin-left .25s cubic-bezier(.4,0,.2,1);}
