:root {
    --bg-main: #FDF8F3;
    --bg-card: #FFFFFF;
    --primary: #3D1B0B; /* Deep Cocoa/Espresso */
    --success: #2D5A27; /* Forest Green (Mockup style) */
    --warning: #D35400; /* Terracotta Orange */
    --danger: #C0392B;
    --accent: #D35400;
    --secondary: #5D4037;
    --text-main: #3D1B0B;
    --white: #FFFFFF;
    --gray: #F5F1EB;
    --shadow: 0 10px 30px rgba(61, 27, 11, 0.08);
    --border-radius: 20px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

button, .card, .nav-item, .user-badge, [onclick] {
    cursor: pointer;
}

.hidden { display: none !important; }

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.4;
    overflow-x: hidden;
    height: 100vh;
    font-size: 0.9rem;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 500px;
    margin: 0 auto;
    background: var(--bg-main);
}

.app-header {
    background: var(--bg-main);
    color: var(--primary);
    padding: 1rem 1.5rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    z-index: 100;
}

.logo-icon-box {
    width: 36px;
    height: 36px;
    background-color: var(--primary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: 1.2rem;
    font-family: var(--font-heading);
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    text-transform: none;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--primary);
}

.logo-tagline {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    color: var(--secondary);
}

.status-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 6px 14px;
    border-radius: 100px;
    background: rgba(45, 90, 27, 0.1);
    color: var(--success);
    border: 1px solid rgba(45, 90, 27, 0.2);
}

.status-badge::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
    background: var(--success);
    margin-top: -2px;
}

.status-badge.online::before {
    background: var(--success);
}

main {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    padding-bottom: 6.5rem;
}

.screen {
    width: 100%;
}

/* Demo Mode Styles */
#demo-float-btn {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: var(--accent);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 100px;
    font-weight: 900;
    font-family: var(--font-heading);
    box-shadow: 0 10px 30px rgba(211, 84, 0, 0.4);
    z-index: 9999;
    cursor: pointer;
    animation: pulse 2s infinite;
    border: 3px solid white;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

#demo-control-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--primary);
    color: white;
    padding: 1rem;
    z-index: 100000;
    border-top: 2px solid var(--accent);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.demo-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-family: var(--font-heading);
}

.demo-controls button {
    background: rgba(255,255,255,0.1);
    border: 1px solid white;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
}

.demo-progress {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.3s;
}

.demo-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 9998;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.demo-msg {
    background: white;
    color: var(--primary);
    padding: 1.5rem 2rem;
    border-radius: 16px;
    font-weight: 800;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    border-left: 8px solid var(--accent);
    max-width: 80%;
    text-align: center;
}

.demo-highlight {
    box-shadow: 0 0 0 4px var(--accent) !important;
    transform: scale(1.05);
    transition: all 0.3s;
    z-index: 10001;
    position: relative;
    background: #FFFBEB !important;
}

.demo-summary {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2.5rem;
    border-radius: 32px;
    z-index: 10002;
    text-align: center;
    box-shadow: 0 30px 100px rgba(0,0,0,0.5);
    max-width: 90%;
    border: 4px solid var(--accent);
}

.demo-summary h2 { margin-bottom: 1rem; color: var(--primary); }
.demo-summary button {
    margin-top: 1.5rem;
    background: var(--primary);
    color: white;
    padding: 1rem 2rem;
    border-radius: 100px;
    border: none;
    font-weight: 800;
}

/* Install Button Style */
#install-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    display: none;
    margin-left: 8px;
}

.user-badge {
    background: var(--bg-main);
    padding: 8px 16px;
    border-radius: 100px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary);
    border: 1px solid var(--gray);
    cursor: pointer;
}

.user-badge i {
    width: 14px;
    height: 14px;
}

.btn-scan-main {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 1.2rem;
    border-radius: 100px;
    font-weight: 800;
    font-family: var(--font-heading);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 2rem;
    box-shadow: 0 10px 20px rgba(61, 27, 11, 0.2);
}

.proc-step {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.proc-step i.pending { color: var(--gray); }
.proc-step i.done { color: var(--success); }

.section-title {
    margin: 1.5rem 0 0.75rem;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.card-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--secondary);
    font-weight: 600;
}

.dot {
    opacity: 0.4;
}

.placeholder-box {
    height: 80px;
    background: var(--bg-main);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
}

.placeholder-box i {
    width: 24px;
    height: 24px;
}

.eudr-icon-box {
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--success);
    margin-right: 12px;
}

.small-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--secondary);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.timeline-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: var(--secondary);
    font-weight: 600;
}

.timeline-meta i {
    width: 10px;
    height: 10px;
}

/* Nav */
.app-nav {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    right: 1.5rem;
    height: 72px;
    background: var(--primary);
    display: flex;
    justify-content: space-around;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(61, 27, 11, 0.3);
    z-index: 100;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0 0.5rem;
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.4);
    flex: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-item .icon {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

.nav-item .label {
    font-family: var(--font-heading);
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nav-item.active {
    color: var(--white);
    transform: translateY(-2px);
}

.nav-item.active .icon {
    transform: scale(1.1);
}

/* UI Elements */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(61, 27, 11, 0.05);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:active {
    transform: scale(0.98);
    background: #FDFBF8;
}

.section-label {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(61, 27, 11, 0.05);
    color: var(--primary);
    display: inline-block;
    margin-bottom: 1.25rem;
}

.search-box {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.search-box input {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 100px;
    border: 1.5px solid rgba(61, 27, 11, 0.1);
    background: var(--white);
    color: var(--primary);
    font-weight: 600;
    font-family: var(--font-body);
    font-size: 0.8rem;
}

.search-box button {
    padding: 0 1.2rem;
    background: var(--primary);
    color: white;
    border-radius: 100px;
    border: none;
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.05em;
    min-width: 80px;
    height: 44px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(61, 27, 11, 0.15);
    transition: all 0.2s;
}

.btn {
    font-family: var(--font-heading);
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 100px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    font-size: 0.8rem;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:active {
    transform: scale(0.97);
    filter: brightness(1.2);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.badge {
    font-family: var(--font-heading);
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
}

.badge-warning { background: rgba(200, 64, 26, 0.1); color: #C8401A; }
.badge-success { background: rgba(45, 90, 27, 0.1); color: var(--success); }
.badge-danger { background: rgba(200, 64, 26, 0.15); color: #C8401A; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 1000;
}

.modal-content {
    background: var(--white);
    border-radius: 28px;
    width: 100%;
    max-width: 440px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    padding: 1.5rem;
    box-shadow: 0 30px 60px -12px rgba(61, 27, 11, 0.25);
    border: none;
}

.close-modal {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    font-size: 1.2rem;
    background: var(--bg-main);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

/* Offline Banner */
#offline-banner {
    position: fixed;
    top: 1rem;
    left: 1.5rem;
    right: 1.5rem;
    background: var(--accent);
    color: white;
    padding: 0.75rem 1rem;
    text-align: center;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 1000;
    box-shadow: 0 10px 20px rgba(200, 64, 26, 0.2);
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Map Mode */
.leaflet-tile-pane {
    filter: sepia(30%) saturate(120%) brightness(95%);
}

.grade-toggles {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.grade-btn {
    flex: 1;
    padding: 0.75rem;
    border-radius: 12px;
    border: 1.5px solid var(--gray);
    background: var(--white);
    color: var(--secondary);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.grade-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.weight-comparison {
    background: var(--bg-main);
    padding: 1rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.weight-diff {
    font-weight: 800;
}

.gap-ok { color: var(--success); }
.gap-warning { color: var(--warning); }
.gap-danger { color: var(--danger); }
