:root {
    /* Integración con Variables Nativas de Telegram WebApp */
    --bg-color: var(--tg-theme-bg-color, #0f172a);
    --card-bg: var(--tg-theme-secondary-bg-color, #1e293b);
    --text-color: var(--tg-theme-text-color, #f8fafc);
    --hint-color: var(--tg-theme-hint-color, #94a3b8);
    --accent-color: var(--tg-theme-button-color, #38bdf8);

    /* Estados de Ticket */
    --status-espera-bg: #fef3c7;
    --status-espera-text: #92400e;

    --status-aprobado-bg: #dcfce7;
    --status-aprobado-text: #166534;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    padding: 1rem;
}

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

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

.logo-icon {
    font-size: 2rem;
}

.brand h1 {
    font-size: 1.3rem;
    font-weight: 700;
}

.subtitle {
    font-size: 0.8rem;
    color: var(--hint-color);
}

/* Indicador de Estado de Conexión */
.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.connecting {
    background-color: rgba(234, 179, 8, 0.2);
    color: #eab308;
}

.status-badge.connected {
    background-color: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.status-badge.disconnected {
    background-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
}

/* Dashboard Grid */
.dashboard-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
}

@media (max-width: 850px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }
}

.card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
    color: var(--text-color);
}

/* Gráfico Tanque de Combustible */
.tank-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.tank-container {
    position: relative;
    width: 120px;
    height: 220px;
    border: 4px solid var(--accent-color);
    border-radius: 16px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
}

.fuel-level {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
    transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.wave {
    position: absolute;
    top: -10px;
    left: 0;
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

.tank-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stat-box {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 0.85rem;
}

.stat-label {
    color: var(--hint-color);
}

.stat-value {
    font-weight: 700;
}

.stat-value.highlight {
    color: #38bdf8;
}

.stat-value.percentage {
    color: #22c55e;
}

/* Tabla de Tickets */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.badge-count {
    background-color: var(--accent-color);
    color: #0f172a;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

.table-responsive {
    overflow-x: auto;
}

.tickets-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.tickets-table th {
    padding: 0.75rem 1rem;
    color: var(--hint-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

.tickets-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Estilos dinámicos para filas de estado */
tr.row-espera {
    background-color: var(--status-espera-bg) !important;
    color: var(--status-espera-text) !important;
    font-weight: 600;
    animation: fadeIn 0.4s ease-in;
}

tr.row-aprobado {
    background-color: var(--status-aprobado-bg) !important;
    color: var(--status-aprobado-text) !important;
    font-weight: 600;
    transition: background-color 0.6s ease, color 0.6s ease;
}

.badge-status {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}

.badge-espera {
    background-color: #f59e0b;
    color: #ffffff;
}

.badge-aprobado {
    background-color: #22c55e;
    color: #ffffff;
}

.empty-state {
    text-align: center;
    padding: 2.5rem !important;
    color: var(--hint-color);
}

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