html, body {
    background-color: #020617 !important;
    color: #f8fafc;
    min-height: 100%;
    width: 100%;
    max-width: 100vw;
    margin: 0;
    padding: 0;
    overflow-x: hidden !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

input, textarea, select {
    -webkit-user-select: text;
    user-select: text;
}

@media screen and (max-width: 768px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}

.safe-top { padding-top: env(safe-area-inset-top); }
.safe-bottom { padding-bottom: env(safe-area-inset-bottom); }

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #475569; border-radius: 4px; }

.tab-btn.active { color: #60a5fa; border-bottom: 3px solid #3b82f6; font-weight: 700; background-color: rgba(30, 58, 138, 0.25); }
canvas.sig-pad { touch-action: none; cursor: crosshair; }

.modal-backdrop {
    overflow-x: hidden !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}
.modal-card {
    overflow-x: hidden !important;
}

button, a, input, select, label {
    touch-action: manipulation;
}
button:active, a:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
}

input[type="date"], input[type="time"] {
    color-scheme: dark;
}
body.theme-light input[type="date"], body.theme-light input[type="time"] {
    color-scheme: light;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: brightness(0) invert(1) !important;
    opacity: 0.95;
}
body.theme-light input[type="date"]::-webkit-calendar-picker-indicator,
body.theme-light input[type="time"]::-webkit-calendar-picker-indicator {
    filter: none !important;
    opacity: 0.85;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(59, 130, 246, 0.4); }
    50% { transform: scale(1.08); box-shadow: 0 0 45px rgba(59, 130, 246, 0.8); }
}
.animate-pulse-glow { animation: pulseGlow 2s infinite ease-in-out; }

@keyframes alertPulse {
    0%, 100% { border-color: rgba(225, 29, 72, 1); box-shadow: 0 0 25px rgba(225, 29, 72, 0.6); }
    50% { border-color: rgba(225, 29, 72, 0.4); box-shadow: 0 0 8px rgba(225, 29, 72, 0.2); }
}
.animate-alert-pulse { animation: alertPulse 1.2s infinite ease-in-out; }

@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 0.7s linear infinite; }

body.theme-light { background-color: #f8fafc !important; color: #020617 !important; }
body.theme-light header, body.theme-light nav { background-color: #ffffff !important; border-color: #cbd5e1 !important; }
body.theme-light .bg-slate-800, body.theme-light .bg-slate-900, body.theme-light .bg-slate-950 {
    background-color: #ffffff !important; border-color: #cbd5e1 !important; color: #0f172a !important; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.06);
}
body.theme-light input, body.theme-light select, body.theme-light textarea {
    background-color: #ffffff !important; color: #0f172a !important; border-color: #64748b !important;
}
body.theme-light .text-white { color: #0f172a !important; }
body.theme-light .text-slate-300, body.theme-light .text-slate-400 { color: #1e293b !important; }
body.theme-light .tab-btn.active { color: #2563eb !important; border-bottom-color: #2563eb !important; background-color: rgba(219, 234, 254, 0.6); }
@media print { .no-print { display: none !important; } }