:root {
    --primary: #E3262A;      /* Circle K Primary Red */
    --primary-hover: #C2191D;
    --secondary: #F58220;    /* Circle K Orange */
    --bg-base: #F8F9FA;
    --card-bg: #ffffff;
    --text-main: #212529;
    --text-muted: #6C757D;
    --border-color: #DEE2E6;
    --danger: #E3262A;
    --danger-light: #FADBDC;
    --warning: #F58220;
    --warning-light: #FDE6D2;
    --success: #28A745;
    --success-light: #D4EDDA;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
    position: fixed;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* =========================================
   LOGIN PAGE (Professional Corporate)
   ========================================= */
.login-page {
    background-color: #f1f3f5;
    background-image: radial-gradient(#e2e8f0 1px, transparent 1px);
    background-size: 20px 20px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: 'Outfit', sans-serif;
}

.login-container { width: 100%; max-width: 420px; z-index: 1; perspective: 1000px; }

.brand-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0,0,0,0.05);
    border-top: 5px solid var(--primary);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.brand-logo-large {
    width: 140px;
    height: auto;
    margin: 0 auto 20px auto;
    display: block;
    filter: drop-shadow(0 4px 15px rgba(227, 38, 42, 0.2));
}

.brand-card h1 { font-weight: 700; font-size: 1.6rem; color: #1a1e23; margin-bottom: 5px; }
.brand-card .subtitle { font-weight: 400; color: #6C757D; margin-bottom: 30px; font-size: 0.95rem; }

.input-group { position: relative; margin-bottom: 25px; }
.input-group input {
    width: 100%; padding: 15px 15px 15px 45px; border-radius: 10px; border: 1px solid #ced4da;
    outline: none; font-size: 1rem; color: #212529; background: #f8f9fa; transition: all 0.2s ease;
}
.input-group i { position: absolute; left: 16px; top: 16px; color: #adb5bd; font-size: 1.3rem; transition: color 0.2s ease; }
.input-group input:focus { border-color: var(--primary); background: #ffffff; box-shadow: 0 0 0 3px rgba(227, 38, 42, 0.1); }
.input-group input:focus ~ i { color: var(--primary); }

.login-form .primary-btn {
    width: 100%; padding: 16px; border-radius: 10px; border: none; background: var(--primary);
    color: white; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease;
    display: flex; justify-content: center; align-items: center; gap: 8px;
}
.login-form .primary-btn:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(227, 38, 42, 0.3); }

.error-msg { background: #FADBDC; color: #B21B1D; padding: 12px; border-radius: 8px; margin-bottom: 20px; font-size: 0.85rem; font-weight: 500; display: flex; align-items: center; gap: 6px; }

.corporate-footer { margin-top: 30px; font-size: 0.75rem; color: #adb5bd; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }


/* =========================================
   APP PAGE (Mobile Layout Simulation)
   ========================================= */
.app-mode { 
    display: flex; justify-content: center; background: #e2e8f0; 
    height: 100vh; height: 100dvh; overflow: hidden;
}

.app-container {
    width: 100%; max-width: 480px; height: 100vh; height: 100dvh; 
    background: var(--bg-base); position: relative;
    box-shadow: 0 0 20px rgba(0,0,0,0.1); display: flex; flex-direction: column; overflow: hidden;
}

.app-header {
    background: #ffffff; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--border-color); position: sticky; top: 0; z-index: 10;
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { 
    width: 65px; 
    height: auto; 
    object-fit: contain;
}
.user-intro h1 { font-size: 1.2rem; font-weight: 700; color: var(--text-main); }
.user-intro p { font-size: 0.8rem; color: var(--text-muted); }

.role-switcher {
    padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-color); background: var(--bg-base);
    font-family: inherit; font-size: 0.8rem; font-weight: 600; color: var(--text-main); outline: none; cursor: pointer;
}

.app-content { padding: 20px; flex: 1; overflow-y: auto; padding-bottom: 90px; }

/* Quick Actions */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.action-card {
    background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px; padding: 15px 10px;
    text-align: center; cursor: pointer; transition: all 0.2s; display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.action-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.primary-action { background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%); color: white; border: none; }
.action-icon { font-size: 2rem; margin-bottom: 4px; }
.action-title { font-weight: 600; font-size: 0.95rem; }
.action-desc { font-size: 0.7rem; opacity: 0.8; }
.primary-action .action-desc { opacity: 0.9; }

/* Dashboard Sections */
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 24px; }
.mt-5 { margin-top: 32px; }
.mb-3 { margin-bottom: 12px; }
.w-full { width: 100%; }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-header h2 { font-size: 1.05rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-main); }
.badge { background: var(--warning-light); color: var(--warning); padding: 4px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; }
.badge-small { padding: 2px 6px; border-radius: 4px; font-size: 0.6rem; font-weight: bold; color: white; margin-left: auto; }
.bg-danger { background: var(--danger); }
.bg-danger-light { background: var(--danger-light); }
.bg-warning-light { background: var(--warning-light); }

.risk-list { display: flex; flex-direction: column; gap: 10px; }
.risk-item {
    background: #ffffff; border-radius: 12px; padding: 15px; display: flex; justify-content: space-between; align-items: center;
    border-left: 4px solid transparent; box-shadow: 0 2px 4px rgba(0,0,0,0.02); gap: 10px;
}
.risk-item.critical { border-left-color: var(--danger); border-right: 1px solid var(--danger-light); border-top: 1px solid var(--danger-light); border-bottom: 1px solid var(--danger-light); }
.risk-item.warning { border-left-color: var(--warning); border-right: 1px solid var(--border-color); border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
.risk-item.order-item { border: 1px solid var(--border-color); border-left: 4px solid var(--secondary); flex-direction: column; align-items: flex-start; }

.item-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; justify-content: center; align-items: center; font-size: 1.4rem; flex-shrink: 0; }
.item-info { display: flex; flex-direction: column; flex: 1; }
.item-info strong { font-size: 0.95rem; margin-bottom: 2px; }
.item-info .meta { font-size: 0.75rem; color: var(--text-muted); }
.item-date { font-weight: 700; font-size: 0.85rem; color: var(--text-main); }
.critical .item-date { color: var(--danger); }

/* Buttons inside items */
.action-icon-btn {
    background: #f1f5f9; border: none; width: 36px; height: 36px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center; color: var(--text-main); cursor: pointer; transition: 0.2s;
}
.action-icon-btn:hover { background: var(--danger-light); color: var(--danger); }
.small-btn {
    background: var(--bg-base); border: 1px solid var(--border-color); padding: 6px 12px; border-radius: 6px;
    font-size: 0.75rem; font-weight: 600; color: var(--text-main); cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.small-btn:hover { background: var(--border-color); }

.btn { padding: 12px; border-radius: 10px; font-weight: 600; font-size: 0.95rem; cursor: pointer; border: none; display: flex; justify-content: center; align-items: center; gap: 6px; }
.btn-primary { background: var(--primary); color: white; }

/* Tabs & Pills */
.search-bar { position: relative; width: 100%; margin-bottom: 15px; }
.search-bar i { position: absolute; left: 12px; top: 12px; color: var(--text-muted); font-size: 1.2rem; }
.search-bar input {
    width: 100%; padding: 12px 12px 12px 38px; border-radius: 10px; border: 1px solid var(--border-color); outline: none; font-family: inherit;
}

.filter-pills { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; }
.filter-pills::-webkit-scrollbar { display: none; }
.pill {
    padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; border: 1px solid var(--border-color);
    background: var(--card-bg); color: var(--text-muted); cursor: pointer; white-space: nowrap;
}
.pill.active { background: var(--text-main); color: white; border-color: var(--text-main); }
.pill.border-danger { border-color: var(--danger-light); color: var(--danger); }
.pill.border-warning { border-color: var(--warning-light); color: var(--warning); }

/* Timeline list */
.timeline-header { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 10px; padding-left: 5px; }

/* Deputy View elements */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 15px 10px; text-align: center; display: flex; flex-direction: column; }
.stat-card.risk .stat-num { color: var(--danger); }
.stat-card.warning .stat-num { color: var(--warning); }
.stat-card.good .stat-num { color: var(--success); }
.stat-num { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: 0.65rem; color: var(--text-muted); margin-top: 4px; font-weight: 600; text-transform: uppercase; }

.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item { background: var(--card-bg); padding: 12px 15px; border-radius: 10px; display: flex; align-items: center; gap: 10px; border: 1px solid var(--border-color); cursor: pointer; }
.task-item input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--primary); }
.task-item .task-text { font-size: 0.95rem; font-weight: 500; }
.task-item input:checked ~ .task-text { text-decoration: line-through; color: var(--text-muted); }

.info-banner { background: #FEF3C7; border-left: 4px solid var(--warning); padding: 12px 15px; border-radius: 0 8px 8px 0; font-size: 0.85rem; font-weight: 500; color: #92400E; }

/* Settings structures */
.profile-card { background: var(--card-bg); display: flex; align-items: center; gap: 15px; padding: 20px; border-radius: 16px; border: 1px solid var(--border-color); box-shadow: 0 4px 6px rgba(0,0,0,0.02); }
.profile-avatar { width: 60px; height: 60px; background: var(--primary); color: white; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 1.8rem; font-weight: 700; }
.profile-info h2 { font-size: 1.2rem; font-weight: 700; }

.settings-group { display: flex; flex-direction: column; }
.settings-title { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 10px; padding-left: 5px; }
.settings-item { display: flex; justify-content: space-between; align-items: center; background: var(--card-bg); padding: 15px; border-bottom: 1px solid var(--border-color); }
.settings-item:first-of-type { border-radius: 12px 12px 0 0; }
.settings-item:last-of-type { border-radius: 0 0 12px 12px; border-bottom: none; }
.settings-text { display: flex; flex-direction: column; }
.settings-text strong { font-size: 0.95rem; font-weight: 500; }
.settings-text span { font-size: 0.75rem; color: var(--text-muted); }

.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--success); }
input:checked + .slider:before { transform: translateX(20px); }

.settings-select { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-color); background: var(--bg-base); font-family: inherit; font-size: 0.85rem; font-weight: 500; }

.settings-btn {
    display: flex; align-items: center; gap: 10px; background: var(--card-bg); padding: 15px; border-radius: 12px; text-decoration: none; font-weight: 600; font-size: 1rem;
}
.sys-version { text-align: center; font-size: 0.75rem; color: var(--text-muted); margin-top: 30px; font-weight: 500; }

/* Bottom Nav */
.bottom-nav {
    position: absolute; bottom: 0; width: 100%; background: #ffffff; display: flex; justify-content: space-around;
    padding: 10px 0 20px 0; border-top: 1px solid var(--border-color); z-index: 50; box-shadow: 0 -4px 15px rgba(0,0,0,0.03);
}
.nav-item {
    text-decoration: none; color: var(--text-muted); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: color 0.2s;
}
.nav-item i { font-size: 1.6rem; }
.nav-item span { font-size: 0.7rem; font-weight: 500; }
.nav-item.active { color: var(--primary); }

/* Modals */
.modal-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 100;
    display: flex; align-items: flex-end; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-content {
    background: var(--bg-base); width: 100%; max-height: 90vh; border-radius: 24px 24px 0 0; padding: 20px;
    transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); display: flex; flex-direction: column;
}
.modal-overlay.active .modal-content { transform: translateY(0); }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { font-size: 1.2rem; font-weight: 700; }
.close-btn { background: #f1f5f9; border: none; width: 32px; height: 32px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 1.2rem; cursor: pointer; }

/* Camera Viewport Simulation */
.camera-viewport {
    width: 100%; height: 250px; background: #000; border-radius: 16px; position: relative; display: flex; justify-content: center; align-items: center; color: rgba(255,255,255,0.7); font-size: 0.9rem; overflow: hidden;
}
.scan-line {
    position: absolute; width: 100%; height: 2px; background: var(--danger); box-shadow: 0 0 10px var(--danger); animation: scan 2s infinite alternate;
}
@keyframes scan { 0% { top: 10%; } 100% { top: 90%; } }

/* Forms inside modal */
.flex-row { display: flex; gap: 15px; }
.flex-col { display: flex; flex-direction: column; flex: 1; }
.p-form label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; display: block; margin-top: 12px; }
.p-form input { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--border-color); outline: none; font-family: inherit; font-size: 0.95rem; }
.p-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(227, 38, 42, 0.1); }
