/* ============================================
   TURBINE LOGSHEET PRO - MASTER CSS
   Version: 2.0.0 (Modern & Elegant)
   ============================================ */

/* ============================================
   1. VARIABLES & THEME
   ============================================ */
:root {
    /* Primary Colors - Modern Blue Gradient */
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-dark: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.3);
    
    /* Secondary Colors */
    --secondary: #64748b;
    --secondary-light: #94a3b8;
    
    /* Accent Colors */
    --success: #10b981;
    --success-light: #34d399;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --danger: #ef4444;
    --danger-light: #f87171;
    --info: #06b6d4;
    --info-light: #22d3ee;
    
    /* Background Colors - Deep Navy */
    --bg: #0a0f1c;
    --bg-secondary: #111827;
    --bg-tertiary: #1e293b;
    --surface: rgba(30, 41, 59, 0.6);
    --surface-hover: rgba(30, 41, 59, 0.8);
    --border: rgba(148, 163, 184, 0.15);
    --border-hover: rgba(148, 163, 184, 0.3);
    
    /* Text Colors */
    --text: #f8fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    
    /* Spacing */
    --xs: 4px;
    --sm: 8px;
    --md: 12px;
    --lg: 16px;
    --xl: 24px;
    --xxl: 32px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px var(--primary-glow);
    --shadow-success: 0 4px 16px rgba(16, 185, 129, 0.3);
    --shadow-warning: 0 4px 16px rgba(245, 158, 11, 0.3);
    
    /* Safe Areas */
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
}

/* ============================================
   2. RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -ms-overflow-style: none; /* Scrollbar */
    scrollbar-width: none;
}

::-webkit-scrollbar {
    width: 0;
    height: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    height: 100%;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    background-image: 
        radial-gradient(ellipse at 0% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 100%, rgba(16, 185, 129, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.03) 0%, transparent 70%);
    background-attachment: fixed;
}

/* Selection Restrictions */
.btn, .menu-card, .list-item, .area-item, .status-btn {
    -webkit-user-select: none;
    user-select: none;
}

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

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ============================================
   3. LAYOUT & SCREENS
   ============================================ */
.app-container {
    max-width: 100%;
    min-height: 100vh;
    position: relative;
}

.screen {
    display: none;
    min-height: 100vh;
    padding-bottom: calc(var(--lg) + var(--safe-bottom));
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen.active {
    display: block;
}

#loginScreen.active {
    display: flex !important;
    flex-direction: column;
}

#balancingScreen.active,
#ctAreaListScreen.active,
#ctParamScreen.active,
#logsheetSelectScreen.active {
    display: block;
}

.screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(var(--md) + var(--safe-top)) var(--lg) var(--md);
    position: sticky;
    top: 0;
    z-index: 50;
}

/* ============================================
   4. UTILITIES & GLASS EFFECT
   ============================================ */
.glass {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
}

.glass-header {
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.95) 0%, rgba(17, 24, 39, 0.8) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

/* ============================================
   5. ANIMATIONS
   ============================================ */
@keyframes fadeIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.8; transform: scale(1.02); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes scaleIn { from { transform: scale(0.9) translateY(20px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

/* ============================================
   6. COMPONENTS
   ============================================ */
   
/* ============================================
   PREMIUM LOADER STYLES - REPLACE EXISTING LOADER SECTION
   ============================================ */

.loader-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0a0f1c 0%, #0f172a 50%, #1e293b 100%);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s;
}

.loader-content {
    text-align: center;
    padding: 40px;
    position: relative;
    max-width: 400px;
    width: 100%;
}

/* Animated Logo */
.loader-logo {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-logo-inner {
    width: 85px;
    height: 85px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.3);
    animation: logoFloat 3s ease-in-out infinite;
    z-index: 3;
}

.loader-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 5px;
}

.loader-pulse-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 50%;
    animation: pulseRing 2s ease-out infinite;
    z-index: 1;
}

.loader-pulse-ring.delay {
    animation-delay: 1s;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
}

@keyframes pulseRing {
    0% {
        transform: scale(1);
        opacity: 1;
        border-color: rgba(59, 130, 246, 0.5);
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
        border-color: rgba(59, 130, 246, 0);
    }
}

/* Typewriter Animation Styles */
.typewriter-container {
    margin-bottom: 16px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.typewriter-text {
    font-size: 2rem;
    font-weight: 800;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.02em;
}

.typewriter-text .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    filter: blur(10px);
    animation: charReveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: calc(var(--char-index) * 0.08s);
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.typewriter-text .char.highlight {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: charReveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
               highlightPulse 2s ease-in-out infinite;
    animation-delay: calc(var(--char-index) * 0.08s), 1s;
}

.typewriter-text .cursor {
    display: inline-block;
    width: 3px;
    height: 1.2em;
    background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
    margin-left: 4px;
    border-radius: 2px;
    animation: blink 1s step-end infinite, cursorGlow 2s ease-in-out infinite;
    opacity: 0;
    animation-delay: 0.88s, 0.88s;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.8);
}

@keyframes charReveal {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
        filter: blur(10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes highlightPulse {
    0%, 100% { 
        filter: brightness(1) drop-shadow(0 0 0 rgba(59, 130, 246, 0));
    }
    50% { 
        filter: brightness(1.2) drop-shadow(0 0 10px rgba(59, 130, 246, 0.5));
    }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes cursorGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(59, 130, 246, 0.8); }
    50% { box-shadow: 0 0 20px rgba(59, 130, 246, 1), 0 0 30px rgba(59, 130, 246, 0.5); }
}

/* Subtitle */
.loader-subtitle {
    color: #64748b;
    font-size: 0.9375rem;
    margin-bottom: 32px;
    font-weight: 500;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 1s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Premium Progress Bar */
.premium-progress-container {
    width: 320px;
    max-width: 90vw;
    margin: 0 auto;
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
    animation-delay: 1.2s;
}

.premium-progress-track {
    height: 8px;
    background: rgba(148, 163, 184, 0.1);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.3),
        0 1px 2px rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.premium-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, 
        #3b82f6 0%, 
        #60a5fa 25%, 
        #3b82f6 50%, 
        #2563eb 75%, 
        #3b82f6 100%
    );
    background-size: 200% 100%;
    border-radius: 9999px;
    position: relative;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: gradientShift 2s linear infinite;
    box-shadow: 
        0 0 20px rgba(59, 130, 246, 0.5),
        0 0 40px rgba(59, 130, 246, 0.3);
}

@keyframes gradientShift {
    0% { background-position: 100% 0%; }
    100% { background-position: -100% 0%; }
}

.progress-shimmer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255, 255, 255, 0.4) 50%, 
        transparent 100%
    );
    animation: shimmer 2s infinite;
    border-radius: 9999px;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(200%); }
}

.progress-glow {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background: radial-gradient(circle, rgba(96, 165, 250, 1) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(4px);
    animation: glowPulse 1.5s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
    50% { opacity: 0.6; transform: translateY(-50%) scale(1.2); }
}

/* Progress Stats */
.premium-progress-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.progress-percentage {
    color: #60a5fa;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 10px rgba(96, 165, 250, 0.5);
    font-family: 'Inter', monospace;
}

.progress-stage {
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.6875rem;
}

/* Hide loader */
.loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-overlay.hidden .typewriter-text .char {
    animation: charDisappear 0.3s ease forwards;
    animation-delay: calc(var(--char-index) * 0.03s);
}

@keyframes charDisappear {
    to {
        opacity: 0;
        transform: translateY(-20px) scale(0.8);
        filter: blur(10px);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .typewriter-text {
        font-size: 1.75rem;
    }
    
    .typewriter-container {
        height: 42px;
    }
    
    .premium-progress-container {
        width: 280px;
    }
}

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: var(--sm); padding: var(--md) var(--lg); border-radius: var(--radius-md); font-size: 0.9375rem; font-weight: 600; cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); border: none; outline: none; min-height: 48px; touch-action: manipulation; position: relative; overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; box-shadow: 0 4px 16px var(--primary-glow); }
.btn-primary:hover { box-shadow: 0 6px 24px var(--primary-glow); transform: translateY(-2px); }
.btn-secondary { background: rgba(30, 41, 59, 0.8); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-hover); }
.btn-success { background: linear-gradient(135deg, var(--success) 0%, #059669 100%); color: white; box-shadow: var(--shadow-success); }
.btn-full { width: 100%; }
.btn-flex { flex: 1; }
.btn-sm { padding: var(--sm) var(--md); font-size: 0.875rem; min-height: 40px; }

/* Icon Buttons */
.btn-icon { width: 44px; height: 44px; min-height: 44px; padding: 0; background: rgba(30, 41, 59, 0.6); color: var(--text-secondary); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); transition: all 0.2s ease; }
.btn-icon:hover { background: rgba(30, 41, 59, 0.9); border-color: var(--border-hover); color: var(--text); }
.btn-icon:active { transform: scale(0.95); }

/* Floating Button */
.btn-floating { position: fixed; bottom: calc(var(--xl) + var(--safe-bottom)); left: var(--lg); right: var(--lg); background: linear-gradient(135deg, var(--success) 0%, #059669 100%); color: white; box-shadow: var(--shadow-success); z-index: 100; }
.btn-floating:hover { box-shadow: 0 6px 24px rgba(16, 185, 129, 0.4); }

/* Alerts */
.custom-alert { position: fixed; inset: 0; background: rgba(10, 15, 28, 0.9); backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: center; z-index: 10001; padding: var(--lg); transition: opacity 0.3s ease; }
.custom-alert.hidden { display: none !important; opacity: 0; }
.alert-content { background: linear-gradient(145deg, rgba(30, 41, 59, 0.9) 0%, rgba(17, 24, 39, 0.95) 100%); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: var(--xxl); text-align: center; width: 100%; max-width: 340px; animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); box-shadow: var(--shadow-lg); }

/* ============================================
   7. SCREENS & MODULES
   ============================================ */

/* 7.1. Login Screen */
.login-container { min-height: 100vh; display: flex; flex-direction: column; padding: var(--lg); padding-top: calc(var(--xxl) + var(--safe-top)); position: relative; }
.login-header { text-align: center; margin-bottom: var(--xxl); position: relative; z-index: 1; }
.logo-container { width: 120px; height: 120px; margin: 0 auto var(--lg); position: relative; }
.logo-container::before { content: ''; position: absolute; inset: -8px; border-radius: 28px; background: linear-gradient(135deg, var(--primary), var(--info), var(--success)); opacity: 0.3; filter: blur(15px); animation: pulse 3s ease-in-out infinite; }
.logo-container.small { width: 80px; height: 80px; }
.logo-container img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.3)); }
.logo-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 3.5rem; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); border-radius: var(--radius-xl); color: white; position: relative; z-index: 1; box-shadow: var(--shadow-glow); }
.logo-container.animated { animation: float 4s ease-in-out infinite; }
.app-title { font-size: 1.75rem; font-weight: 800; margin-bottom: var(--xs); background: linear-gradient(135deg, var(--text) 0%, var(--primary-light) 50%, var(--info-light) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.app-subtitle { font-size: 1rem; color: var(--text-muted); font-weight: 500; }
.login-form { padding: var(--xxl); border-radius: var(--radius-xl); margin-bottom: auto; background: linear-gradient(145deg, rgba(30, 41, 59, 0.6) 0%, rgba(17, 24, 39, 0.8) 100%); border: 1px solid var(--border); position: relative; z-index: 1; }
.login-title { font-size: 1.375rem; font-weight: 700; margin-bottom: var(--xs); text-align: center; color: var(--text); }
.login-subtitle { font-size: 0.9375rem; color: var(--text-muted); text-align: center; margin-bottom: var(--xl); }
.input-group { margin-bottom: var(--lg); }
.login-input-wrapper { position: relative; display: flex; align-items: center; }
.login-input-icon { position: absolute; left: var(--md); color: var(--text-muted); pointer-events: none; transition: color 0.2s; }
.login-input { width: 100%; padding: var(--md) var(--lg); padding-left: 48px; background: rgba(15, 23, 42, 0.6); border: 2px solid var(--border); border-radius: var(--radius-md); color: var(--text); font-size: 1rem; outline: none; transition: all 0.2s ease; }
.login-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }
.login-input:focus + .login-input-icon, .login-input-wrapper:focus-within .login-input-icon { color: var(--primary); }
.login-input.error { border-color: var(--danger); }
.login-error { color: var(--danger); font-size: 0.875rem; text-align: center; margin-top: var(--sm); display: none; padding: var(--md); background: rgba(239, 68, 68, 0.1); border-radius: var(--radius-md); border: 1px solid rgba(239, 68, 68, 0.2); }
.login-footer { text-align: center; padding-top: var(--xl); position: relative; z-index: 1; }
.login-footer p { font-size: 0.8125rem; color: var(--text-muted); margin-bottom: var(--sm); }
.version-tag { display: inline-flex; align-items: center; gap: var(--xs); padding: var(--xs) var(--md); background: rgba(59, 130, 246, 0.1); color: var(--primary-light); border-radius: var(--radius-full); font-size: 0.75rem; font-weight: 600; border: 1px solid rgba(59, 130, 246, 0.2); }

/* 7.2. Logsheet Selection Screen */
.logsheet-select-container { padding: 20px var(--lg); display: flex; flex-direction: column; gap: var(--lg); max-width: 480px; margin: 0 auto; }
.logsheet-select-card { display: flex; align-items: center; gap: var(--lg); padding: var(--xl); background: linear-gradient(145deg, rgba(30, 41, 59, 0.6) 0%, rgba(17, 24, 39, 0.8) 100%); border: 1px solid var(--border); border-radius: var(--radius-xl); cursor: pointer; transition: all 0.3s ease; position: relative; overflow: hidden; }
.logsheet-select-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--primary) 0%, var(--info) 100%); opacity: 0; transition: opacity 0.3s; }
.logsheet-select-card:hover { border-color: var(--border-hover); transform: translateX(8px); }
.logsheet-select-card:hover::before { opacity: 1; }
.logsheet-select-card.ct-version::before { background: linear-gradient(180deg, var(--info) 0%, #0891b2 100%); }
.logsheet-icon-large { width: 64px; height: 64px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; font-size: 32px; flex-shrink: 0; transition: transform 0.3s ease; }
.logsheet-select-card:hover .logsheet-icon-large { transform: scale(1.1); }
.logsheet-icon-large.turbin { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); box-shadow: 0 8px 24px var(--primary-glow); }
.logsheet-icon-large.ct { background: linear-gradient(135deg, var(--info) 0%, #0891b2 100%); box-shadow: 0 8px 24px rgba(6, 182, 212, 0.3); }
.logsheet-info { flex: 1; }
.logsheet-info h3 { font-size: 1.125rem; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.logsheet-info p { font-size: 0.875rem; color: var(--text-muted); line-height: 1.5; }
.logsheet-arrow { color: var(--text-muted); transition: all 0.3s ease; }
.logsheet-select-card:hover .logsheet-arrow { transform: translateX(8px); color: var(--primary); }
.logsheet-select-card.ct-version:hover .logsheet-arrow { color: var(--info); }

/* 7.3. Balancing Screen */
.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--md); margin-bottom: var(--md); }
.input-grid.three-col { grid-template-columns: repeat(3, 1fr); }
.input-grid.two-col { grid-template-columns: 1fr 1fr; }
.info-field { display: flex; flex-direction: column; gap: var(--xs); }
.info-field label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.auto-field { background: rgba(59, 130, 246, 0.1) !important; border-color: var(--primary) !important; color: var(--primary-light) !important; font-weight: 700; text-align: center; }
.shift-badge { display: inline-block; padding: var(--xs) var(--lg); background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%); color: white; border-radius: var(--radius-full); font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.1em; box-shadow: var(--shadow-warning); }
.sub-section { background: rgba(15, 23, 42, 0.4); border-radius: var(--radius-md); padding: var(--md); margin: var(--md) 0; border: 1px solid var(--border); }
.nested-inputs { margin-top: var(--md); padding-top: var(--md); border-top: 1px solid var(--border); }
.calculated-field input { background: rgba(16, 185, 129, 0.1) !important; border-color: var(--success) !important; color: var(--success) !important; font-weight: 700; font-size: 1.25rem; }
.calculated-field.highlight-impor input.impor-indicator { background: rgba(245, 158, 11, 0.1) !important; border-color: var(--warning) !important; color: var(--warning) !important; }
.highlight-field input { background: rgba(59, 130, 246, 0.05); border-color: var(--primary); }
.with-select select { width: 100%; padding: var(--md) var(--lg); background: rgba(15, 23, 42, 0.6); border: 2px solid var(--border); border-radius: var(--radius-md); color: var(--text); font-size: 0.9375rem; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 40px; }
.calculation-result { border: 1px dashed var(--primary); margin: var(--md) 0; padding: var(--md); background: rgba(59, 130, 246, 0.05); border-radius: var(--radius-md); display: flex; justify-content: space-between; align-items: center; }
.monitoring-grid { display: flex; flex-direction: column; gap: var(--lg); }
.monitoring-item { display: flex; flex-direction: column; gap: var(--xs); padding-bottom: var(--md); border-bottom: 1px solid var(--border); }
.monitoring-item:last-child { border-bottom: none; padding-bottom: 0; }
.monitoring-item label { font-size: 0.8125rem; color: var(--text-muted); font-weight: 600; }
.limit-input { display: flex; gap: var(--sm); align-items: center; }
.limit-input input { flex: 1; }
.limit-badge { padding: var(--xs) var(--sm); background: rgba(239, 68, 68, 0.1); color: var(--danger); border-radius: var(--radius-sm); font-size: 0.6875rem; font-weight: 700; white-space: nowrap; }

/* Balancing Toolbar Buttons */
.btn-history, .btn-reset { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 12px; border-radius: var(--radius-md); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; }
.btn-history { background: rgba(59, 130, 246, 0.1); color: var(--primary-light); border: 1px solid rgba(59, 130, 246, 0.2); }
.btn-history:hover { background: rgba(59, 130, 246, 0.2); border-color: rgba(59, 130, 246, 0.4); transform: translateY(-2px); }
.btn-reset { background: rgba(239, 68, 68, 0.1); color: var(--danger-light); border: 1px solid rgba(239, 68, 68, 0.2); }
.btn-reset:hover { background: rgba(239, 68, 68, 0.2); border-color: rgba(239, 68, 68, 0.4); transform: translateY(-2px); }

/* Ekspor/Impor Dynamic Styles */
#eksporLabel { transition: color 0.3s ease; }
#eksporMW { transition: all 0.3s ease; }
#eksporMW[data-state="ekspor"] { border-color: var(--success) !important; background: rgba(16, 185, 129, 0.05) !important; }
#eksporMW[data-state="impor"] { border-color: var(--warning) !important; background: rgba(245, 158, 11, 0.05) !important; }

/* 7.4. Lists & Parameters */
.list-container, .areas-list { padding: var(--md) var(--lg); padding-bottom: calc(var(--xl) + 80px); }
.list-item, .area-item { display: flex; align-items: center; gap: var(--md); padding: var(--lg); background: linear-gradient(145deg, rgba(30, 41, 59, 0.6) 0%, rgba(17, 24, 39, 0.8) 100%); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: var(--md); cursor: pointer; transition: all 0.3s ease; }
.list-item:hover, .area-item:hover { border-color: var(--border-hover); transform: translateX(4px); }
.item-icon, .area-icon { width: 48px; height: 48px; min-width: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.item-content, .area-info { flex: 1; min-width: 0; }
.item-content h4, .area-name { font-size: 0.9375rem; font-weight: 600; margin-bottom: 3px; color: var(--text); }
.item-content p, .area-meta { font-size: 0.8125rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Status Abnormal Card */
.status-abnormal-card { margin: var(--lg) 0; padding: var(--lg); background: rgba(239, 68, 68, 0.05); border: 1px solid rgba(239, 68, 68, 0.2); border-radius: var(--radius-lg); animation: slideUp 0.3s ease; }
#ctParamScreen .status-abnormal-card { background: rgba(6, 182, 212, 0.05); border: 1px solid rgba(6, 182, 212, 0.2); }
.status-header { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; font-weight: 700; color: var(--danger-light); margin-bottom: var(--md); }
#ctParamScreen .status-header { color: var(--info); }
.status-options { display: flex; flex-wrap: wrap; gap: 8px; }
.status-chip { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: rgba(30, 41, 59, 0.8); border: 2px solid var(--border); border-radius: 24px; cursor: pointer; font-size: 0.8125rem; color: var(--text-muted); font-weight: 500; transition: all 0.2s ease; }
.status-chip.active { background: rgba(239, 68, 68, 0.2); border-color: var(--danger); color: var(--danger-light); font-weight: 600; }
#ctParamScreen .status-chip.active { background: rgba(6, 182, 212, 0.2); border-color: var(--info); color: var(--info); }
.status-chip input { display: none; }

/* 7.5. Upload Progress Override */
.upload-overlay { position: fixed; inset: 0; background: rgba(10, 15, 28, 0.95); backdrop-filter: blur(10px); display: flex; align-items: center; justify-content: center; z-index: 10002; opacity: 0; visibility: hidden; transition: all 0.3s ease; }
.upload-overlay.hidden { display: none !important; }
.upload-overlay:not(.hidden) { opacity: 1; visibility: visible; }
.upload-content { text-align: center; padding: 32px; max-width: 320px; width: 100%; }
.progress-ring-container { position: relative; width: 120px; height: 120px; margin: 0 auto 24px; }
.progress-percentage { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 1.5rem; font-weight: 700; color: var(--text); }
.upload-steps { display: flex; align-items: center; justify-content: center; gap: var(--sm); margin-top: 16px; }
.step { display: flex; flex-direction: column; align-items: center; gap: var(--xs); opacity: 0.4; transition: opacity 0.3s; }
.step.active { opacity: 1; }
.step-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-tertiary); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; border: 2px solid var(--border); }
.step.active .step-icon { background: var(--primary); border-color: var(--primary); color: white; }

/* ============================================
   8. MEDIA QUERIES & RESPONSIVE
   ============================================ */
@media (max-width: 360px) {
    :root { --lg: 12px; --xl: 20px; }
    .logo-container { width: 100px; height: 100px; }
    .app-title { font-size: 1.5rem; }
    .input-grid.three-col { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 400px) {
    .menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--md); }
    .menu-card { flex-direction: column; text-align: center; padding: var(--xl); }
}

@media (min-width: 480px) {
    .app-container { max-width: 480px; margin: 0 auto; box-shadow: 0 0 60px rgba(0, 0, 0, 0.5); }
}

@media (max-height: 500px) and (orientation: landscape) {
    .login-container { padding-top: var(--lg); }
    .logo-container { width: 80px; height: 80px; }
    .home-hero-content .logo-container { display: none; }
}

/* PWA Standalone Mode */
@media all and (display-mode: standalone) {
    .screen-header { padding-top: calc(var(--md) + max(12px, env(safe-area-inset-top))); }
    #loginScreen .login-container { padding-top: calc(var(--xl) + max(20px, env(safe-area-inset-top))); }
    #installBanner { display: none !important; }
    .form-container { padding-bottom: calc(var(--xl) + max(20px, env(safe-area-inset-bottom))); }
    .action-bar { padding-bottom: max(var(--safe-bottom), 20px); }
}

/* Dark mode enforcement */
@media (prefers-color-scheme: light) {
    :root {
        --bg: #0a0f1c;
        --text: #f8fafc;
    }
}
