/* ============================================
   PREMIUM MOBILE APP DESIGN SYSTEM
   ============================================ */

:root {
    /* Refined HSL Color System */
    --brand-h: 245;
    --primary: hsl(var(--brand-h), 75%, 60%);
    --primary-light: hsl(var(--brand-h), 80%, 70%);
    --primary-dark: hsl(var(--brand-h), 70%, 45%);
    
    --accent-h: 160;
    --accent: hsl(var(--accent-h), 70%, 45%); /* Success/In */
    --danger: hsl(0, 75%, 60%); /* Danger/Out */
    --warning: hsl(35, 90%, 55%);
    
    --bg: hsl(220, 30%, 97%);
    --surface: hsl(0, 0%, 100%);
    --surface-glass: hsla(0, 0%, 100%, 0.85);
    
    --text-main: hsl(220, 45%, 15%);
    --text-muted: hsl(220, 15%, 45%);
    --text-on-brand: hsl(0, 0%, 100%);
    
    --border: hsl(220, 20%, 90%);
    --border-light: hsl(220, 20%, 94%);
    
    /* Premium Effects */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 28px;
    
    --shadow-soft: 0 4px 14px -2px rgba(0,0,0,0.06), 0 2px 6px -2px rgba(0,0,0,0.03);
    --shadow-premium: 0 10px 30px -5px rgba(0,0,0,0.1), 0 4px 12px -3px rgba(0,0,0,0.05);
    --shadow-button: 0 6px 16px -4px rgba(79, 70, 229, 0.4);
    
    --glass-blur: blur(12px);
}

/* ======= BASE RESET ======= */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0; padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg);
    color: var(--text-main);
    font-family: 'Inter', 'Kanit', sans-serif;
    line-height: 1.5;
    font-size: 16px;
    padding-bottom: 90px; /* Space for bottom nav */
    overflow-x: hidden;
}

/* ======= APP HEADER ======= */
.app-header {
    background: var(--surface);
    padding: 24px 20px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--shadow-button);
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.greeting-text h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}

.greeting-text p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.date-chip {
    padding: 6px 12px;
    background: var(--bg);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-dark);
}

/* ======= CONTAINER ======= */
.app-content {
    padding: 20px 16px;
    max-width: 600px;
    margin: 0 auto;
}

/* ======= DASHBOARD CARDS ======= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.premium-card {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-premium);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.premium-card.full { grid-column: span 2; }

.premium-card.brand {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.card-icon {
    width: 38px;
    height: 38px;
    background: rgba(0,0,0,0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.brand .card-icon { background: rgba(255,255,255,0.2); }

.card-val {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.card-lbl {
    font-size: 0.8rem;
    font-weight: 600;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 4px;
}

/* ======= BOTTOM NAVIGATION ======= */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 80px;
    background: var(--surface-glass);
    backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
    z-index: 1000;
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.3s;
    width: 64px;
}

.nav-link .nav-icon {
    font-size: 1.5rem;
    transition: transform 0.2s;
}

.nav-link .nav-text {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-link.active { color: var(--primary); }
.nav-link.active .nav-icon { transform: translateY(-4px); }

/* ======= CHARTS & TABLES ======= */
.section-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-wrap {
    background: var(--surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border);
}

.app-table {
    width: 100%;
    border-collapse: collapse;
}

.app-table th {
    background: var(--bg);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
}

.app-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.9rem;
}

/* ======= FORMS & BUTTONS ======= */
.input-field {
    width: 100%;
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: var(--surface-glass);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.2s;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px hsla(var(--brand-h), 75%, 60%, 0.1);
    outline: none;
}

.primary-btn {
    background: var(--primary);
    color: white;
    padding: 18px;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 800;
    font-size: 1rem;
    width: 100%;
    box-shadow: var(--shadow-button);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.primary-btn:active { transform: scale(0.96); }

/* ======= ANIMATIONS ======= */
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.animate-up { animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* Responsive adjustments */
@media (max-width: 480px) {
    .card-val { font-size: 1.6rem; }
    .nav-text { font-size: 0.6rem; }
}
