/* ===== RESET & BASE ===== */
*{box-sizing:border-box;margin:0;padding:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;-webkit-tap-highlight-color:transparent}
body{background:#141518;color:#fff;min-height:100vh;overflow:hidden;display:flex;flex-direction:column}

/* ===== LAYOUT ===== */
.screen-single{width:100%;min-height:100vh;overflow-y:auto!important;-webkit-overflow-scrolling:touch;padding:15px;padding-top:42px!important;background:#141518}
.screen-single.driver-page{padding-top:46px!important}
.viewport{display:flex;width:200%;flex:1;transition:transform .3s cubic-bezier(.4,0,.2,1)}
.screen{width:50%;padding:15px;display:flex;flex-direction:column;overflow-y:auto;background:#141518}

/* ===== HEADER (MASTER) ===== */
.header{position:fixed;top:0;left:0;right:0;height:48px;background:#0a0a0a;border-bottom:1px solid #1a1a1a;display:flex;align-items:center;justify-content:space-between;padding:0 15px;z-index:1000}
.header-title{font-size:15px;font-weight:700;color:#39FF14}
.header-time{font-size:12px;color:#8a8d93}
.report-btn{padding:8px 16px;background:#39FF14;color:#000;border:none;border-radius:6px;font-size:12px;font-weight:700;cursor:pointer}
.report-btn:active{opacity:.8}
.content{padding:58px 15px 20px}

/* ===== STATS ROW ===== */
.stats-row{display:flex;gap:10px;margin-bottom:15px}
.stat-box{flex:1;background:#1e222a;border:1px solid #2d3139;border-radius:8px;padding:12px;text-align:center}
.stat-num{font-size:24px;font-weight:700;color:#39FF14}
.stat-label{font-size:11px;color:#8a8d93;margin-top:4px}
.empty{text-align:center;color:#666;padding:40px;font-size:14px}

/* ===== TABS ===== */
.tab-header{display:flex;background:#1a1c22;border-bottom:2px solid #22252d;z-index:10}
.tab-btn{flex:1;text-align:center;padding:16px 10px;font-size:15px;font-weight:700;color:#8a8d93;cursor:pointer;transition:all .2s ease}
.tab-btn.active{color:#39FF14;background:#141518;border-bottom:3px solid #39FF14}

/* ===== CAMERA ===== */
#camera-container{position:relative;width:100%;height:240px;background:#000;border-radius:10px;overflow:hidden;border:1px solid #22252d;margin-bottom:12px}
#video{width:100%;height:100%;object-fit:cover}
.scanner-overlay{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}
.target-box{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:200px;height:200px;border:1px dashed rgba(57,255,20,.25)}
.target-box::before,.target-box::after,.target-box span::before,.target-box span::after{content:'';position:absolute;width:16px;height:16px;border-color:#39FF14;border-style:solid}
.target-box::before{top:-2px;left:-2px;border-width:3px 0 0 3px}
.target-box::after{top:-2px;right:-2px;border-width:3px 3px 0 0}
.target-box span::before{bottom:-2px;left:-2px;border-width:0 0 3px 3px}
.target-box span::after{bottom:-2px;right:-2px;border-width:0 3px 3px 0}

/* ===== STATUS BAR (GPS) ===== */
#gps-status{margin-bottom:12px;text-align:center;font-size:13.5px;font-weight:500;color:#8a8d93;padding:6px;background:rgba(34,37,45,.4);border-radius:6px}

/* ===== DRIVER STATUS BAR (TOP) ===== */
.driver-status-bar{position:fixed;top:0;left:0;right:0;height:36px;background:#0a0a0a;border-bottom:1px solid #1a1a1a;display:flex;align-items:center;justify-content:space-between;padding:0 15px;z-index:1000;font-size:12px}
.status-bar-left{display:flex;align-items:center;gap:12px}
.status-indicator{display:flex;align-items:center;gap:6px;color:#8a8d93;font-weight:500}
.status-indicator.online{color:#39FF14}
.status-dot{width:6px;height:6px;border-radius:50%;background:#333;animation:pulse 2s infinite}
.status-indicator.online .status-dot{background:#39FF14;box-shadow:0 0 6px #39FF14}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.4}}

.status-bar-right{display:flex;align-items:center;gap:6px;overflow-x:auto;max-width:60%;scrollbar-width:none}
.status-bar-right::-webkit-scrollbar{display:none}
.driver-chip{padding:3px 10px;border-radius:12px;font-size:11px;font-weight:600;cursor:pointer;transition:all .2s;border:1px solid transparent;white-space:nowrap;flex-shrink:0}
.driver-chip.online{background:rgba(57,255,20,.1);color:#39FF14;border-color:rgba(57,255,20,.3)}
.driver-chip.busy{background:rgba(100,100,100,.1);color:#666;border-color:rgba(100,100,100,.3)}
.driver-chip:hover{opacity:.8}

/* ===== BUTTONS ===== */
.btn-action{width:100%;border:none;padding:16px;font-size:15px;font-weight:700;border-radius:8px;cursor:pointer;transition:background-color .15s,transform .1s;text-transform:uppercase}
.btn-action:active{transform:scale(.98)}
#snap-btn{background:#39FF14;color:#000;box-shadow:0 4px 15px rgba(57,255,20,.2);margin-bottom:15px}
#snap-btn:disabled,.btn-tara:disabled{background:#22252d!important;color:#555860!important;box-shadow:none!important;cursor:not-allowed}

.btn-navigator{width:100%;padding:14px;margin-bottom:12px;background:#1e222a;border:1px solid #2d3139;border-radius:8px;color:#39FF14;font-size:14px;font-weight:600;cursor:pointer;transition:all .2s;text-align:center}
.btn-navigator:hover{background:rgba(57,255,20,.05);border-color:rgba(57,255,20,.3)}
.btn-navigator:active{transform:scale(.98)}

.btn-tara{background:#1e222a;border:1px solid #2d3139;font-size:14px}
.btn-bunker{color:#2ecc71}.btn-boxes{color:#3498db}.btn-pallets{color:#e67e22}

.btn-done{width:100%;padding:12px;font-size:14px;font-weight:700;color:#fff;background:#218c4e;border:none;border-radius:6px;cursor:pointer;text-transform:uppercase}
.btn-done:active{background:#1a6d3d}

/* ===== TARA MODAL ===== */
.tara-modal{display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.85);z-index:2000;align-items:center;justify-content:center;padding:20px}
.tara-modal.active{display:flex}
.tara-modal-content{background:#1e222a;border-radius:12px;width:100%;max-width:320px;border:1px solid #2d3139;overflow:hidden}
.tara-modal-header{padding:15px;border-bottom:1px solid #2d3139;font-size:16px;font-weight:700;color:#fff;display:flex;justify-content:space-between;align-items:center}
.tara-modal-close{color:#8a8d93;font-size:22px;cursor:pointer}
.tara-list{display:flex;flex-direction:column;padding:10px;gap:8px}
.tara-btn{padding:14px;background:#141518;border:1px solid #2d3139;border-radius:8px;color:#fff;font-size:14px;font-weight:600;cursor:pointer;transition:all .2s;text-align:left}
.tara-btn:hover{background:rgba(57,255,20,.05);border-color:rgba(57,255,20,.3)}
.tara-sub{flex-direction:column;padding:10px;gap:8px}
.tara-sub-title{color:#8a8d93;font-size:13px;padding:5px 5px 0}
.tara-sub-buttons{display:flex;flex-direction:column;gap:8px}
.tara-back{padding:10px;background:transparent;border:1px solid #444;border-radius:6px;color:#8a8d93;font-size:13px;cursor:pointer;margin-top:5px}

/* ===== DRIVER CONTROL MODAL ===== */
.driver-modal{display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.85);z-index:2000;align-items:center;justify-content:center;padding:20px}
.driver-modal.active{display:flex}
.driver-modal-content{background:#1e222a;border-radius:12px;width:100%;max-width:400px;max-height:80vh;overflow-y:auto;border:1px solid #2d3139}
.driver-modal-header{padding:15px;border-bottom:1px solid #2d3139;font-size:16px;font-weight:700;color:#fff;display:flex;justify-content:space-between;align-items:center}
.driver-modal-close{color:#8a8d93;font-size:20px;cursor:pointer}
.driver-list{padding:10px}
.driver-item{display:flex;align-items:center;justify-content:space-between;padding:12px;background:#141518;border-radius:8px;margin-bottom:8px}
.driver-info{display:flex;align-items:center;gap:10px}
.driver-avatar{width:36px;height:36px;border-radius:50%;background:#2d3139;display:flex;align-items:center;justify-content:center;font-size:16px}
.driver-name{font-size:14px;font-weight:600;color:#fff}
.driver-status-text{font-size:11px;margin-top:2px}
.driver-status-text.online{color:#39FF14}
.driver-status-text.busy{color:#888}
.driver-toggle{padding:6px 14px;border-radius:6px;border:none;font-size:12px;font-weight:600;cursor:pointer;transition:all .2s}
.driver-toggle.to-busy{background:rgba(255,51,51,.15);color:#FF3333}
.driver-toggle.to-online{background:rgba(57,255,20,.15);color:#39FF14}

/* ===== REPORT MODAL ===== */
.report-modal{display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.9);z-index:2000;align-items:center;justify-content:center;padding:20px}
.report-modal.active{display:flex}
.report-content{background:#1e222a;border-radius:12px;width:100%;max-width:400px;max-height:85vh;overflow-y:auto;border:1px solid #2d3139}
.report-header{padding:15px;border-bottom:1px solid #2d3139;font-size:16px;font-weight:700;color:#39FF14;display:flex;justify-content:space-between;align-items:center}
.report-close{color:#8a8d93;font-size:22px;cursor:pointer}
.report-body{padding:15px}
.report-shift{font-size:13px;color:#8a8d93;margin-bottom:15px;text-align:center;padding-bottom:10px;border-bottom:1px solid #2d3139}
.report-item{display:flex;justify-content:space-between;align-items:center;padding:10px 0;border-bottom:1px solid #2d3139}
.report-item:last-child{border-bottom:none}
.report-name{font-size:14px;color:#fff}
.report-qty{font-size:14px;font-weight:700;color:#39FF14}
.report-total{display:flex;justify-content:space-between;padding:12px 0;margin-top:10px;border-top:2px solid #39FF14;font-size:16px;font-weight:700}
.report-total-name{color:#fff}
.report-total-val{color:#39FF14}
.report-empty{text-align:center;color:#666;padding:30px;font-size:13px}

/* ===== INCLUDE MODAL (MASTER & MONITOR) ===== */
.include-modal{display:none;position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.9);z-index:3000;align-items:center;justify-content:center;padding:20px}
.include-modal.active{display:flex}
.include-content, .include-modal-content{background:#1e222a;border-radius:12px;width:100%;max-width:360px;border:1px solid #2d3139;overflow:hidden}
.include-header, .include-modal-header{padding:15px;border-bottom:1px solid #2d3139;font-size:16px;font-weight:700;color:#fff;display:flex;justify-content:space-between;align-items:center}
.include-close, .include-modal-close{color:#8a8d93;font-size:22px;cursor:pointer}
.include-list{padding:15px}
.include-item{display:flex;justify-content:space-between;padding:10px 0;border-bottom:1px solid #2d3139;font-size:14px}
.include-item:last-child{border-bottom:none}
.include-name{color:#fff}
.include-qty{color:#39FF14;font-weight:600}
.include-empty{color:#8a8d93;text-align:center;padding:20px}

/* ===== PRODUCTS SECTIONS ===== */
.products-section{background:#1e222a;border:1px solid #2d3139;border-radius:8px;padding:12px;margin:12px 0}
.products-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;font-size:13px;color:#8a8d93}
.products-count{color:#39FF14;font-weight:600}
.products-list{display:flex;flex-direction:column;gap:8px}

.product-row{display:flex;align-items:center;gap:6px;position:relative}
.product-row[data-locked="true"]{opacity:.9}

.product-input-wrap{flex:1;position:relative;text-transform:uppercase}
.product-input{width:100%;padding:10px 12px;background:#141518;border:1px solid #2d3139;border-radius:6px;color:#fff;font-size:14px;outline:none;transition:border-color .2s}
.product-input:focus{border-color:#39FF14}
.product-input.locked{background:#1a1f2a;border-color:#39FF14;color:#39FF14;cursor:default}

.product-qty{width:75px;padding:10px 6px;background:#141518;border:1px solid #2d3139;border-radius:6px;color:#fff;font-size:13px;outline:none;cursor:pointer}
.product-qty:focus{border-color:#39FF14}
.product-qty.locked{background:#1a1f2a;border-color:#39FF14;color:#39FF14;opacity:.8}
.product-qty option{background:#1e222a;color:#fff;padding:8px}

.product-lock,.product-remove{width:32px;height:36px;border:none;border-radius:6px;font-size:16px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s;flex-shrink:0}
.product-lock{background:rgba(57,255,20,.1);color:#39FF14;border:1px solid rgba(57,255,20,.3)}
.product-lock:hover{background:rgba(57,255,20,.2)}
.product-lock.locked{background:rgba(255,51,51,.1);color:#ff3333;border-color:rgba(255,51,51,.3)}
.product-lock.locked:hover{background:rgba(255,51,51,.2)}
.product-remove{background:transparent;color:#555;font-size:20px}
.product-remove:hover{background:rgba(255,51,51,.1);color:#ff3333}

/* ===== SUGGESTIONS ===== */
.suggestions{display:none;position:absolute;bottom:calc(100% + 2px);left:0;right:0;background:#1e222a;border:1px solid #2d3139;border-radius:6px;max-height:220px;overflow-y:auto;z-index:1000;box-shadow:0 -8px 24px rgba(0,0,0,.6)}
.suggestion-item{padding:12px 14px;color:#ccc;font-size:14px;cursor:pointer;border-bottom:1px solid #222;transition:background .15s}
.suggestion-item:hover{background:rgba(57,255,20,.08);color:#39FF14}
.suggestion-item b{color:#39FF14;font-weight:700}

/* ===== TASK CARDS ===== */
#tasks-list, #tasksList{display:flex;flex-direction:column;gap:12px;padding-bottom:30px}
.task-card{padding:14px;border-radius:8px;box-shadow:0 4px 10px rgba(0,0,0,.4);display:flex;flex-direction:column;cursor:pointer;transition:opacity .15s}
.task-card:active{opacity:.9}

.card-active{background:#1e222a;border-left:4px solid #39FF14}
.card-working{background:#1e222a;border-left:4px solid #f1c40f}
.card-done{background:#16181d;border-left:4px solid #444852;opacity:.75}

.card-meta{display:flex;justify-content:space-between;font-size:12px;margin-bottom:10px;border-bottom:1px solid #2d3139;padding-bottom:6px}
.card-meta span:last-child {margin-right:30px}
.card-id{color:#626670}
.card-location{font-size:16px;font-weight:700;color:#fff}
.card-info{font-size:12px;color:#8a8d93;margin-top:4px}
.card-products{font-size:11px;color:#f1c40f;margin-top:6px;padding:6px;background:rgba(241,196,15,.05);border-radius:4px;border:1px dashed rgba(241,196,15,.2)}

.status-txt-active{color:#39FF14;font-weight:700}
.status-txt-working{color:#f1c40f;font-weight:700}
.status-txt-done{color:#626670;font-weight:700}

.card-main-content{display:flex;align-items:center;gap:14px}
.card-text-block{flex:1}
.task-location-title{font-size:18px;font-weight:700;color:#fff;line-height:1.2}
.task-tara-alert{color:#f1c40f;font-size:14px;display:block;margin-top:3px;font-weight:700}
.task-time-row{font-size:13px;color:#3498db;margin-top:6px}
.done-times{color:#626670;display:flex;flex-direction:column;gap:2px}
.done-times span{color:#999}
.time-green{color:#2ecc71;font-weight:700}
.card-actions-wrapper{width:100%;margin-top:12px}

/* ===== MEDIA ===== */
.task-img-thumb{width:68px;height:68px;object-fit:cover;border-radius:6px;border:1px solid #2d3139;cursor:pointer}
.task-tara-icon{width:68px;height:68px;background:#141518;display:flex;align-items:center;justify-content:center;font-size:28px;border-radius:6px;border:1px dashed #2d3139}

/* ===== MODALS ===== */
.modal{display:none;position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.9);justify-content:center;align-items:center;z-index:100}
.modal img{max-width:95%;max-height:85%;border-radius:6px;border:2px solid #333}
#modalImg{max-width:95%;max-height:85%;border-radius:6px;box-shadow:0 0 20px rgba(0,0,0,.8)}

/* ===== OLD COMPATIBILITY ===== */
html,body{margin:0;padding:0;width:100%;height:auto;background:#121212;color:#e0e0e0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;overflow:auto}
.task-meta{display:flex;justify-content:space-between;margin-bottom:12px;font-size:13px;color:#aaa;border-bottom:1px solid #2d2d2d;padding-bottom:6px}
.task-location{font-size:18px;font-weight:700;color:#fff}
@keyframes pulseGlow{0%{box-shadow:0 4px 6px rgba(0,0,0,.3)}50%{box-shadow:0 0 12px rgba(0,255,102,.2)}100%{box-shadow:0 4px 6px rgba(0,0,0,.3)}}

/* ===== CARD EDIT ===== */
.task-card{position:relative;}
.btn-menu-dots{position:absolute;top:4px;right:15px;background:none;border:none;color:#8a8d93;font-size:20px;cursor:pointer;padding:5px;line-height:1;z-index:10;}
.btn-menu-dots:hover{color:#fff}
.task-urgent{border-left:5px solid #ff3333 !important;background:linear-gradient(90deg, rgba(255,51,51,0.05) 0%, rgba(20,21,24,0) 100%)}
.task-urgent-badge{background:#ff3333;color:#fff;font-size:11px;font-weight:bold;padding:2px 6px;border-radius:4px;text-transform:uppercase;margin-left:8px;animation:blink 1.5s infinite}
.edit-modal-body{display:flex;flex-direction:column;gap:12px;max-height:70vh;overflow-y:auto;padding:10px 0}
.status-select-btn{width:100%;padding: 12px;margin-bottom:8px;border:1px solid #2d3139;background:#141518;color:#fff;border-radius:6px;cursor:pointer;text-align:left;font-size:15px}
.status-select-btn:hover{background:#1c1e22;border-color:#3498db}
.urgent-checkbox-wrap{display:flex;align-items:center;justify-content:center;gap:8px;color:#ff3333;font-weight:bold;margin-bottom:15px;font-size:15px}
.urgent-checkbox-wrap input{width:18px;height:18px;cursor:pointer}
@keyframes blink { 0% {opacity:1;} 50% {opacity:0.4;} 100% {opacity:1;}}
