﻿/* ========================================
   Sistema de Balanceo Territorial - CSS
   ======================================== */

/* ========== Variables CSS ========== */
:root {
    /* Brand Colors - Sophisticated HSL Palettes */
    --color-primary: hsl(221, 83%, 53%);
    --color-primary-hover: hsl(221, 83%, 43%);
    --color-primary-dark: hsl(221, 83%, 33%);
    --color-primary-soft: hsla(221, 83%, 53%, 0.1);
    --color-secondary: hsl(215, 16%, 47%);
    --color-success: hsl(142, 71%, 45%);
    --color-warning: hsl(48, 96%, 53%);
    --color-error: hsl(0, 72%, 51%);
    --color-info: hsl(199, 89%, 48%);

    /* Premium Surfaces & Glass */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-blur: blur(12px);

    /* Neutral Scale */
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    /* Spacing & Borders */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;

    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-full: 9999px;

    /* Depth & Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-premium: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Reset y Base ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-100);
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ========== Layout Principal ========== */
.main-container {
    display: flex;
    height: 100%;
}

.sidebar {
    width: 400px;
    height: 100%;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--glass-border);
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-content {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

.main-content {
    flex: 1;
    position: relative;
}

/* ========== Header ========== */
.header {
    margin-bottom: var(--spacing-lg);
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: var(--spacing-xs);
}

.header-subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* ========== Tabs ========== */
.tabs-container {
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: var(--spacing-lg);
}

.tabs {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: -1px;
}

.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xs) var(--spacing-xs);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--gray-500);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    min-width: 60px;
}

.tab-btn:hover {
    color: var(--gray-700);
    border-bottom-color: var(--gray-300);
}

.tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-btn svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-bottom: 2px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
}

.btn-secondary {
    background-color: var(--gray-200);
    color: var(--gray-800);
}

.btn-secondary:hover:not(:disabled) {
    background-color: var(--gray-300);
}

.btn-success {
    background-color: var(--color-success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #15803d;
}

.btn-danger {
    background-color: var(--color-error);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #b91c1c;
}

.btn-full {
    width: 100%;
}

.btn svg {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: var(--spacing-sm);
}

.btn-link {
    background: none;
    padding: 0;
    font-size: 0.875rem;
    color: var(--color-primary);
    cursor: pointer;
    border: none;
}

.btn-link:hover {
    text-decoration: underline;
}

/* ========== Balanceo Cards ========== */
.balanceo-card {
    background-color: white;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.balanceo-card:hover {
    transform: translateY(-2px);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-premium);
}

.balanceo-card.active {
    border-color: var(--color-primary);
    border-width: 2px;
    background: linear-gradient(to right, var(--color-primary-soft), white);
}

.balanceo-card.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--color-primary);
}

.balanceo-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

.balanceo-card-title {
    font-weight: 600;
    color: var(--gray-800);
    flex: 1;
}

.balanceo-card-description {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: var(--spacing-md);
}

.balanceo-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
    font-size: 0.75rem;
    color: var(--gray-600);
    margin-bottom: var(--spacing-md);
}

.balanceo-card-info {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-bottom: var(--spacing-md);
}

.balanceo-card-actions {
    display: flex;
    gap: var(--spacing-md);
    margin-top: var(--spacing-sm);
}

.btn-action {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action-edit {
    color: var(--color-primary);
}

.btn-action-edit:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.btn-action-clone {
    color: var(--color-success);
}

.btn-action-clone:hover {
    color: #15803d;
    text-decoration: underline;
}

.btn-action-delete {
    color: var(--color-error);
}

.btn-action-delete:hover {
    color: #b91c1c;
    text-decoration: underline;
}

/* ========== Badges ========== */
.badge {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge.pending {
    background-color: #fef3c7;
    color: #92400e;
}

.badge.processing {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge.completed {
    background-color: #d1fae5;
    color: #065f46;
}

.badge.failed {
    background-color: #fee2e2;
    color: #991b1b;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--spacing-xs);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    transition: var(--transition);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input:disabled,
.form-textarea:disabled {
    background-color: var(--gray-100);
    cursor: not-allowed;
}

.form-textarea {
    resize: vertical;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
}

.form-error {
    font-size: 0.75rem;
    color: var(--color-error);
    margin-top: var(--spacing-xs);
}

/* ========== Modal ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-content {
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 42rem;
    width: 100%;
    margin: 0 var(--spacing-md);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
}

.modal-close {
    background: none;
    border: none;
    color: var(--gray-500);
    cursor: pointer;
    padding: var(--spacing-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--gray-700);
}

.modal-close svg {
    width: 1.5rem;
    height: 1.5rem;
}

.modal-body {
    padding: var(--spacing-lg);
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300) transparent;
}

.modal-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-md);
}

/* ========== Alerts ========== */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    border: 1px solid;
}

.alert svg {
    width: 1.25rem;
    height: 1.25rem;
    display: inline;
    margin-right: var(--spacing-sm);
    vertical-align: middle;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-color: #6ee7b7;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-color: #fca5a5;
}

/* ========== Stats Card ========== */
.stat-card {
    background-color: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--gray-200);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-top: var(--spacing-xs);
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

/* Grid Utilities */
.grid {
    display: grid;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

/* Compact Stats */
.stat-card.compact {
    padding: var(--spacing-sm) var(--spacing-xs);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 70px;
}

.stat-card.compact .stat-label {
    font-size: 0.625rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-card.compact .stat-value {
    font-size: 1.125rem;
    margin-top: 2px;
}

/* ========== Upload Area ========== */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.upload-area:hover {
    border-color: #60a5fa;
}

.upload-area.dragover {
    border-color: var(--color-primary);
    background-color: #dbeafe;
}

.upload-area input[type="file"] {
    display: none;
}

.upload-area svg {
    width: 3rem;
    height: 3rem;
    margin: 0 auto var(--spacing-md);
    color: var(--gray-400);
}

.upload-area-title {
    color: var(--gray-600);
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
}

.upload-area-subtitle {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* ========== Map Controls ========== */
.map-controls {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.map-control-btn {
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    border-radius: var(--radius-md);
    background-color: white;
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-size: 0.8125rem;
    font-weight: 500;
}

.map-control-btn:hover {
    background-color: var(--gray-100);
    box-shadow: var(--shadow-md);
}

.map-control-btn.active {
    background-color: var(--color-primary);
    color: white;
}

.map-control-switch {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.map-control-switch input {
    display: none;
}

.map-control-switch .slider {
    width: 36px;
    height: 20px;
    background-color: var(--gray-300);
    border-radius: 20px;
    position: relative;
    transition: var(--transition);
}

.map-control-switch .slider:before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition);
}

.map-control-switch input:checked+.slider {
    background-color: var(--color-primary);
}

.map-control-switch input:checked+.slider:before {
    transform: translateX(16px);
}

.map-control-switch .switch-label {
    font-weight: 500;
}

.map-control-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Solver Selector */
.solver-selector-container {
    margin-bottom: var(--spacing-sm);
}

.map-control-select {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-700);
    background-color: white;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    max-width: 150px;
}

.map-control-select:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

.map-control-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.map-control-divider {
    height: 1px;
    background-color: var(--gray-200);
    margin: var(--spacing-sm) 0;
}

.visual-styles-container {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.visual-control-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.visual-control-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    padding-left: 2px;
}

.visual-styles-container .map-control-select {
    width: 100%;
    max-width: 100%;
    font-size: 0.8125rem;
    padding: 0.4rem;
    border-color: var(--color-primary-soft);
    background-color: var(--gray-50);
}

/* Route visualization styles */
.route-layer {
    pointer-events: none;
}

/* ========== Loading Overlay ========== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.loading-overlay.hidden {
    display: none;
}

.loading-content {
    background-color: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-align: center;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 3px solid var(--gray-200);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto var(--spacing-md);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-title {
    color: var(--gray-700);
    font-weight: 500;
}

.loading-message {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-top: var(--spacing-sm);
}

/* ========== Toast Notifications ========== */
.toast {
    position: fixed;
    bottom: var(--spacing-md);
    right: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    color: white;
    z-index: 10000;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.info {
    background-color: var(--color-info);
}

.toast.success {
    background-color: var(--color-success);
}

.toast.warning {
    background-color: var(--color-warning);
}

.toast.error {
    background-color: var(--color-error);
}

/* ========== Employee Legend ========== */
.employee-legend {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.employee-color {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
}

/* ========== Distribution Bar ========== */
.distribution-bar {
    width: 100%;
    height: 0.5rem;
    background-color: var(--gray-200);
    border-radius: 9999px;
    overflow: hidden;
}

.distribution-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* ========== Utility Classes ========== */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.font-bold {
    font-weight: 700;
}

.font-semibold {
    font-weight: 600;
}

.font-medium {
    font-weight: 500;
}

.text-sm {
    font-size: 0.875rem;
}

.text-xs {
    font-size: 0.75rem;
}

/* Colors */
.text-gray-400 {
    color: var(--gray-400);
}

.text-gray-500 {
    color: var(--gray-500);
}

.text-gray-600 {
    color: var(--gray-600);
}

.text-gray-700 {
    color: var(--gray-700);
}

.text-gray-800 {
    color: var(--gray-800);
}

.text-primary {
    color: var(--color-primary);
}

/* Spacing */
.mb-1 {
    margin-bottom: var(--spacing-xs);
}

.mb-2 {
    margin-bottom: var(--spacing-sm);
}

.mb-3 {
    margin-bottom: var(--spacing-md);
}

.mb-4 {
    margin-bottom: var(--spacing-lg);
}

.mb-6 {
    margin-bottom: var(--spacing-xl);
}

.mt-1 {
    margin-top: var(--spacing-xs);
}

.mt-2 {
    margin-top: var(--spacing-sm);
}

.mt-4 {
    margin-top: var(--spacing-md);
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.mr-2 {
    margin-right: var(--spacing-sm);
}

/* Layout */
.hidden {
    display: none;
}

.flex {
    display: flex;
}

.flex-1 {
    flex: 1;
}

.inline {
    display: inline;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.w-full {
    width: 100%;
}

.mx-auto {
    margin-left: auto;
    margin-right: auto;
}

/* Grid */
.grid {
    display: grid;
}

.grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gap-2 {
    gap: var(--spacing-sm);
}

.gap-3 {
    gap: var(--spacing-md);
}

.gap-4 {
    gap: var(--spacing-lg);
}

/* Icons */
.w-5 {
    width: 1.25rem;
}

.h-5 {
    height: 1.25rem;
}

.w-16 {
    width: 4rem;
}

.h-16 {
    height: 4rem;
}

/* Spacing Helpers */
.space-y-1>*+* {
    margin-top: var(--spacing-xs);
}

.space-y-2>*+* {
    margin-top: var(--spacing-sm);
}

.space-y-3>*+* {
    margin-top: var(--spacing-md);
}

/* ========== Scrollbar ========== */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--gray-100);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* ========== Gestion Dashboard ========== */
.mgmt-card {
    background-color: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    border: 1px solid var(--gray-200);
    margin-bottom: var(--spacing-md);
}

.mgmt-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.progress-container {
    width: 100%;
    background-color: var(--gray-200);
    border-radius: var(--radius-full);
    height: 0.5rem;
    overflow: hidden;
    margin: var(--spacing-xs) 0;
}

.progress-bar {
    height: 100%;
    background-color: var(--color-primary);
    transition: width 0.3s ease;
}

.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    display: inline-block;
}

.status-online {
    background-color: var(--color-success);
}

.status-offline {
    background-color: var(--gray-400);
}

.activity-item {
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.8125rem;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-time {
    color: var(--gray-400);
    font-size: 0.75rem;
}

.incident-tag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    margin-right: 0.25rem;
}

.battery-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--gray-500);
}

.battery-level {
    width: 1.5rem;
    height: 0.75rem;
    border: 1px solid var(--gray-400);
    border-radius: 2px;
    padding: 1px;
    position: relative;
}

.battery-level::after {
    content: '';
    position: absolute;
    right: -3px;
    top: 2px;
    width: 2px;
    height: 3px;
    background-color: var(--gray-400);
    border-radius: 0 1px 1px 0;
}

.battery-fill {
    height: 100%;
    background-color: var(--color-success);
}

.battery-low {
    background-color: var(--color-error);
}

.battery-warning {
    background-color: var(--color-warning);
}

/* ========== Login Screen ========== */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-card {
    background: white;
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 64px;
    height: 64px;
    background-color: var(--color-primary);
    color: white;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* App Layout Toggle */
#app-layout {
    height: 100%;
}

#app-layout.hidden {
    display: none;
}

/* ========== Map ========== */
#map {
    width: 100%;
    height: 100%;
}

/* MapLibre Popup Customization */
.maplibregl-popup-content {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.maplibregl-popup-close-button {
    color: var(--gray-400);
    padding: 8px;
    font-size: 1.2rem;
    z-index: 10;
}

.maplibregl-popup-close-button:hover {
    color: var(--gray-700);
    background: transparent;
}

/* Compact Popup Design */
.popup-compact {
    display: flex;
    flex-direction: column;
    min-width: 240px;
    max-width: 280px;
}

.popup-header {
    padding: 1rem;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-100);
}

.popup-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.popup-subtitle {
    font-size: 0.65rem;
    font-family: monospace;
    color: var(--gray-400);
}

.popup-body {
    padding: 0.75rem 1rem;
}

.popup-section {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-50);
}

.popup-section:last-child {
    border-bottom: none;
}

.popup-section-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-400);
    margin-bottom: 0.4rem;
    display: block;
}

.popup-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.popup-row:last-child {
    margin-bottom: 0;
}

.popup-label {
    color: var(--gray-500);
}

.popup-value {
    font-weight: 600;
    color: var(--gray-800);
}

.popup-badge-small {
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
}

.popup-accent-blue {
    border-left: 3px solid var(--color-primary);
}

.popup-accent-indigo {
    border-left: 3px solid #6366f1;
}

.popup-accent-gray {
    border-left: 3px solid var(--gray-300);
}

.popup-meta-grid {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.popup-footer {
    padding: 0.5rem 1rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    font-size: 0.7rem;
    color: var(--gray-500);
}

/* Selection Bar */
.selection-bar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-sm) var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    z-index: 10;
    min-width: 280px;
}

.selection-bar.hidden {
    display: none;
}

.selection-info {
    font-weight: 500;
    color: var(--gray-700);
}

.selection-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.875rem;
}

/* ========== Utility Extensions (Tailwind-like for Wizard/Stats) ========== */
.p-2 {
    padding: 0.5rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.p-8 {
    padding: 2rem;
}

.px-8 {
    padding-left: 2rem;
    padding-right: 2rem;
}

.py-2 {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.bg-gray-50 {
    background-color: var(--gray-50);
}

.bg-white {
    background-color: #ffffff;
}

.bg-blue-600 {
    background-color: var(--color-primary);
}

.border-b {
    border-bottom: 1px solid var(--gray-200);
}

.border-t {
    border-top: 1px solid var(--gray-200);
}

.text-xl {
    font-size: 1.25rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-blue-600 {
    color: var(--color-primary);
}

.tracking-wider {
    letter-spacing: 0.05em;
}

.uppercase {
    text-transform: uppercase;
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-full {
    border-radius: 9999px;
}

.h-1 {
    height: 0.25rem;
}

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
}

.transition-colors {
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.hover\:bg-gray-200:hover {
    background-color: var(--gray-200);
}

.text-gray-400 {
    color: var(--gray-400);
}

.text-gray-500 {
    color: var(--gray-500);
}

.text-gray-700 {
    color: var(--gray-700);
}

.text-white {
    color: #ffffff;
}

[class*="animate-"] {
    animation-fill-mode: both;
}