* {
    margin: 0;
    padding: 0;
    box-sizing: border-box
}

body {
    font-family: 'DM Sans', sans-serif;
    background: #0b0d13;
    color: #e4e7ef;
    overflow: hidden;
    height: 100vh
}

::-webkit-scrollbar {
    width: 6px
}

::-webkit-scrollbar-track {
    background: #111422
}

::-webkit-scrollbar-thumb {
    background: #2a3050;
    border-radius: 3px
}

::-webkit-scrollbar-thumb:hover {
    background: #353b58
}

/* Sidebar */
#sidebar {
    width: 260px;
    min-width: 260px;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
    background: #111422;
    border-right: 1px solid #1f243a;
    display: flex;
    flex-direction: column;
    z-index: 40
}

#sidebar.collapsed {
    width: 72px;
    min-width: 72px
}

#sidebar.collapsed .nav-label,
#sidebar.collapsed .sidebar-header-text,
#sidebar.collapsed .sidebar-footer-info {
    display: none
}

#sidebar.collapsed .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0
}

#sidebar.collapsed .nav-icon {
    margin-right: 0
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    cursor: pointer;
    transition: all .2s;
    border-radius: 8px;
    margin: 2px 10px;
    position: relative;
    color: #9499b0;
    font-size: 14px;
    font-weight: 500
}

.nav-item:hover {
    background: #181c2e;
    color: #e4e7ef
}

.nav-item.active {
    background: rgba(232, 163, 8, 0.1);
    color: #e8a308
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #e8a308;
    border-radius: 0 3px 3px 0
}

.nav-icon {
    width: 20px;
    text-align: center;
    margin-right: 12px;
    font-size: 15px;
    flex-shrink: 0
}

/* KPI Cards */
.kpi-card {
    background: linear-gradient(135deg, #181c2e 0%, #1f243a 100%);
    border: 1px solid #2a3050;
    border-radius: 12px;
    padding: 20px 24px;
    position: relative;
    overflow: hidden;
    transition: all .3s
}

.kpi-card:hover {
    border-color: #e8a308;
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(232, 163, 8, 0.08)
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle at top right, rgba(232, 163, 8, 0.06), transparent 70%);
    pointer-events: none
}

/* Status badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px
}

.badge-ok {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e
}

.badge-err {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444
}

.badge-warn {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b
}

.badge-inf {
    background: rgba(14, 165, 233, 0.12);
    color: #0ea5e9
}

.badge-dk {
    background: rgba(90, 97, 120, 0.2);
    color: #9499b0
}

/* Priority badges */
.prio-alta {
    color: #ef4444
}

.prio-media {
    color: #f59e0b
}

.prio-baja {
    color: #22c55e
}

/* Alert item */
.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    background: #181c2e;
    border-left: 3px solid transparent;
    transition: all .2s;
    cursor: pointer
}

.alert-item:hover {
    background: #1f243a
}

.alert-item.critica {
    border-left-color: #ef4444
}

.alert-item.advertencia {
    border-left-color: #f59e0b
}

.alert-item.info {
    border-left-color: #0ea5e9
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0
}

.data-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #5a6178;
    font-weight: 600;
    border-bottom: 1px solid #2a3050;
    background: #111422;
    position: sticky;
    top: 0;
    z-index: 5
}

.data-table tbody tr {
    transition: background .15s;
    cursor: pointer
}

.data-table tbody tr:hover {
    background: #181c2e
}

.data-table tbody td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid rgba(42, 48, 80, 0.5);
    color: #9499b0
}

.data-table tbody td:first-child {
    color: #e4e7ef;
    font-weight: 500
}

/* Modal */
#modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s
}

#modal-overlay.show {
    opacity: 1;
    pointer-events: auto
}

#modal-box {
    background: #181c2e;
    border: 1px solid #2a3050;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(20px) scale(.97);
    transition: transform .3s cubic-bezier(.4, 0, .2, 1)
}

#modal-overlay.show #modal-box {
    transform: translateY(0) scale(1)
}

/* Toast */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px
}

.toast {
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastIn .35s ease-out;
    min-width: 280px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3)
}

.toast-ok {
    background: #14532d;
    border: 1px solid #166534;
    color: #86efac
}

.toast-err {
    background: #7f1d1d;
    border: 1px solid #991b1b;
    color: #fca5a5
}

.toast-warn {
    background: #78350f;
    border: 1px solid #92400e;
    color: #fde68a
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px)
    }

    to {
        opacity: 1;
        transform: translateX(0)
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0)
    }

    to {
        opacity: 0;
        transform: translateX(40px)
    }
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.fade-up {
    animation: fadeUp .4s ease-out both
}

.fade-up-1 {
    animation-delay: .05s
}

.fade-up-2 {
    animation-delay: .1s
}

.fade-up-3 {
    animation-delay: .15s
}

.fade-up-4 {
    animation-delay: .2s
}

.fade-up-5 {
    animation-delay: .25s
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: .6
    }

    100% {
        transform: scale(2.2);
        opacity: 0
    }
}

.pulse-dot {
    position: relative
}

.pulse-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: inherit;
    animation: pulse-ring 1.5s ease-out infinite
}

/* Dot grid background */
.dot-grid {
    background-image: radial-gradient(circle, #1f243a 1px, transparent 1px);
    background-size: 24px 24px
}

/* Form inputs */
.form-input {
    background: #111422;
    border: 1px solid #2a3050;
    border-radius: 8px;
    padding: 10px 14px;
    color: #e4e7ef;
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    transition: border-color .2s;
    width: 100%
}

.form-input:focus {
    outline: none;
    border-color: #e8a308;
    box-shadow: 0 0 0 3px rgba(232, 163, 8, 0.1)
}

.form-input::placeholder {
    color: #4a506a
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%235a6178' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px
}

label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #9499b0;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .5px
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    border: none;
    transition: all .2s
}

.btn-primary {
    background: #e8a308;
    color: #0b0d13
}

.btn-primary:hover {
    background: #fbbf24;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(232, 163, 8, 0.25)
}

.btn-secondary {
    background: #1f243a;
    color: #e4e7ef;
    border: 1px solid #2a3050
}

.btn-secondary:hover {
    background: #2a3050;
    border-color: #353b58
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2)
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25)
}

/* Kanban */
.kanban-col {
    background: #111422;
    border: 1px solid #2a3050;
    border-radius: 12px;
    min-height: 300px;
    flex: 1
}

.kanban-header {
    padding: 14px 16px;
    border-bottom: 1px solid #2a3050;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between
}

.kanban-card {
    background: #181c2e;
    border: 1px solid #2a3050;
    border-radius: 8px;
    padding: 14px;
    margin: 8px 12px;
    cursor: pointer;
    transition: all .2s
}

.kanban-card:hover {
    border-color: #e8a308;
    transform: translateY(-1px)
}

/* Technician card */
.tech-card {
    background: linear-gradient(135deg, #181c2e, #1f243a);
    border: 1px solid #2a3050;
    border-radius: 14px;
    padding: 24px;
    transition: all .3s;
    position: relative;
    overflow: hidden
}

.tech-card:hover {
    border-color: #e8a308;
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3)
}

.tech-card .avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    font-family: 'Space Grotesk', sans-serif
}

/* Leaflet overrides */
.leaflet-container {
    background: #111422 !important;
    border-radius: 12px
}

.leaflet-control-zoom a {
    background: #181c2e !important;
    color: #e4e7ef !important;
    border-color: #2a3050 !important
}

.leaflet-control-attribution {
    background: rgba(17, 20, 34, 0.8) !important;
    color: #5a6178 !important;
    font-size: 9px !important
}

.leaflet-control-attribution a {
    color: #9499b0 !important
}

/* Custom leaflet marker */
.custom-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4)
}

.custom-marker i {
    transform: rotate(45deg);
    font-size: 13px
}

.marker-sucursal {
    background: #e8a308
}

.marker-sucursal i {
    color: #0b0d13
}

.marker-elevador {
    background: #0ea5e9;
    width: 22px;
    height: 22px
}

.marker-elevador i {
    color: #fff;
    font-size: 9px
}

.marker-alerta {
    background: #ef4444;
    width: 26px;
    height: 26px;
    animation: pulse-ring 2s ease-out infinite
}

.marker-alerta i {
    color: #fff;
    font-size: 10px
}

.marker-tecnico {
    background: #22c55e;
    width: 26px;
    height: 26px
}

.marker-tecnico i {
    color: #fff;
    font-size: 10px
}

/* Form validation */
.form-input.border-err,
.form-input.error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15)
}

/* Accessibility: focus-visible */
.nav-item:focus-visible,
.btn:focus-visible,
.form-input:focus-visible {
    outline: 2px solid #e8a308;
    outline-offset: 2px
}

.data-table tbody tr:focus-visible {
    outline: 2px solid #e8a308;
    outline-offset: -2px
}

.kpi-card:focus-visible,
.tech-card:focus-visible,
.kanban-card:focus-visible {
    outline: 2px solid #e8a308;
    outline-offset: 2px
}

/* Pagination */
#asc-pagination,
#ot-pagination {
    padding: 12px 0
}

/* Responsive */
@media(max-width:1024px) {
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 50;
        transform: translateX(0)
    }

    #sidebar.collapsed {
        transform: translateX(-100%);
        width: 260px;
        min-width: 260px
    }

    #sidebar.mobile-overlay {
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5)
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 45
    }

    .sidebar-overlay.active {
        display: block
    }
}

@media(max-width:768px) {
    #sidebar {
        position: fixed;
        transform: translateX(-100%);
        width: 260px;
        min-width: 260px;
        z-index: 50
    }

    #sidebar.open {
        transform: translateX(0)
    }

    #main-wrapper {
        margin-left: 0
    }

    header {
        padding-left: 12px !important;
        padding-right: 12px !important
    }

    header .h-8,
    header .flex.items-center.gap-2 {
        display: none
    }

    #content {
        padding: 12px !important
    }

    .kpi-card {
        padding: 14px 16px
    }

    .data-table thead th,
    .data-table tbody td {
        padding: 8px 10px;
        font-size: 11px
    }

    .form-input {
        font-size: 14px
    }

    .btn {
        padding: 8px 14px;
        font-size: 12px
    }
}

@media(max-width:640px) {
    .grid.grid-cols-2,
    .grid.grid-cols-3,
    .grid.grid-cols-4,
    .grid.grid-cols-5 {
        grid-template-columns: 1fr !important
    }

    .grid.lg\:grid-cols-5,
    .grid.md\:grid-cols-2,
    .grid.xl\:grid-cols-3 {
        grid-template-columns: 1fr !important
    }

    .lg\:col-span-2,
    .lg\:col-span-3 {
        grid-column: span 1 !important
    }

    .data-table thead th:nth-child(n+4),
    .data-table tbody td:nth-child(n+4) {
        display: none
    }

    #modal-box {
        width: 95%;
        max-height: 90vh
    }

    .tech-card {
        padding: 16px
    }

    .kanban-col {
        min-width: 100%
    }
}

@media(prefers-reduced-motion:reduce) {
    * {
        animation-duration: 0s !important;
        transition-duration: 0s !important
    }
}