/* Leaflet z-index fix */
#map{z-index:1}
/* DominaRoute — Styles v2 */
*{margin:0;padding:0;box-sizing:border-box}
body{background:#f5f5f5;color:#1a1a1a;font-family:'Inter',system-ui,-apple-system,sans-serif;font-size:13px;overflow:hidden;height:100vh}
#root{height:100vh;display:flex;flex-direction:column}

/* === TOPBAR === */
.topbar{height:48px;background:#F7F7F5;border-bottom:1px solid #E5E5E0;display:flex;align-items:center;padding:0 20px;position:relative;z-index:250;box-shadow:0 1px 2px rgba(0,0,0,.06);flex-shrink:0}
.topbar-logo{height:32px;margin-right:16px}
.topbar-nav{display:flex;gap:0;flex:1}
.nav-menu{position:relative}
.nav-trigger{padding:8px 16px;font-size:12px;font-weight:600;color:#555;cursor:pointer;border-radius:6px;transition:.15s}
.nav-trigger:hover{background:rgba(0,0,0,.05);color:#1a1a1a}
.nav-drop{display:none;position:absolute;top:100%;left:0;background:#fff;border:1px solid #e5e5e5;border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.1);min-width:220px;padding:6px;z-index:260}
.nav-menu:hover .nav-drop{display:block}
.nav-drop-item{display:flex;align-items:center;gap:10px;padding:8px 12px;border-radius:6px;cursor:pointer;font-size:12px;color:#333}
.nav-drop-item:hover{background:#f5f5f3}
.nav-drop-item svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.5}

/* Seletor de unidade */
.unit-select{display:flex;align-items:center;gap:8px;margin-left:auto;margin-right:16px}
.unit-select label{font-size:11px;color:#888}
.unit-select select{height:30px;border:1px solid #d0d0cc;border-radius:6px;padding:0 28px 0 10px;font-size:12px;font-weight:600;background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E") no-repeat right 10px center;-webkit-appearance:none;appearance:none;cursor:pointer;min-width:120px}
.unit-select select:focus{border-color:#E87B35;outline:none}

/* Status unidade */
.unit-status{font-size:10px;padding:2px 8px;border-radius:10px;font-weight:600;margin-left:4px}
.unit-status.geo{background:#E6F1FB;color:#0C447C}
.unit-status.rev{background:#FFF3E0;color:#E65100}
.unit-status.ativa{background:#E8F5E9;color:#2E7D32}
.unit-status.rot{background:#EEEDFE;color:#534AB7}

.topbar-right{display:flex;align-items:center;gap:12px;color:#9CA3AF;font-size:11px}
.topbar-dot{width:8px;height:8px;border-radius:50%;background:#22c55e;display:inline-block;margin-right:4px}

/* === MAIN AREA === */
.main-area{flex:1;position:relative;overflow:hidden}
#map{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%}

/* === FAB BUTTON === */
.fab{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#E87B35;color:#fff;border:none;padding:12px 28px;border-radius:12px;font-size:14px;font-weight:600;font-family:inherit;cursor:pointer;display:flex;align-items:center;gap:8px;box-shadow:0 4px 16px rgba(232,123,53,.35);z-index:80;transition:.15s}
.fab:hover{background:#d06a28;transform:translateX(-50%) translateY(-1px)}
.fab svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2}

/* === MODAL === */
.modal-bg{position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:200;display:flex;align-items:center;justify-content:center;backdrop-filter:blur(2px)}
.modal{background:#fff;border-radius:12px;width:560px;max-width:92vw;max-height:85vh;overflow:hidden;box-shadow:0 20px 60px rgba(0,0,0,.2);display:flex;flex-direction:column}
.modal-head{padding:16px 20px;border-bottom:1px solid #eee;display:flex;align-items:center;justify-content:space-between}
.modal-head h2{font-size:16px;font-weight:600;color:#1a1a1a}
.modal-close{border:none;background:none;font-size:20px;color:#D94040;cursor:pointer;width:28px;height:28px;display:flex;align-items:center;justify-content:center;border-radius:6px}
.modal-close:hover{background:#f0f0ec}
.modal-body{padding:20px;overflow-y:auto;flex:1}

/* Drop zone */
.drop-zone{border:2px dashed #d0d0cc;border-radius:12px;padding:32px;text-align:center;cursor:pointer;transition:.2s;margin-bottom:16px}
.drop-zone:hover,.drop-zone.over{border-color:#E87B35;background:#FFF8F3}
.drop-zone.has-file{border-color:#22c55e;background:#f0fdf4}
.drop-zone svg{width:36px;height:36px;stroke:#bbb;fill:none;stroke-width:1.5;margin:0 auto 8px;display:block}
.drop-zone p{font-size:12px;color:#888;margin:2px 0}
.drop-zone .fname{font-size:13px;font-weight:600;color:#1a1a1a}

/* File list (multi-arquivo) */
.file-list{margin:12px 0}
.file-item{display:flex;align-items:center;gap:10px;padding:8px 12px;border:1px solid #f0f0ec;border-radius:8px;margin-bottom:6px;font-size:12px}
.file-item .fi-icon{width:32px;height:32px;border-radius:8px;background:#f5f5f3;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:700;color:#E87B35;flex-shrink:0}
.file-item .fi-info{flex:1}
.file-item .fi-name{font-weight:600;color:#1a1a1a}
.file-item .fi-meta{font-size:10px;color:#888}
.file-item .fi-status{font-size:10px;padding:2px 8px;border-radius:8px;font-weight:600}
.file-item .fi-remove{border:none;background:none;color:#ccc;cursor:pointer;font-size:16px;padding:4px}
.file-item .fi-remove:hover{color:#D94040}

/* Progress bar */
.m-prog{margin:12px 0}
.m-prog-track{height:6px;background:#f0f0ec;border-radius:3px;overflow:hidden}
.m-prog-fill{height:100%;border-radius:3px;transition:width .3s}
.m-prog-info{display:flex;justify-content:space-between;margin-top:6px;font-size:11px;color:#888}

/* Stats summary */
.m-stats{display:flex;gap:8px;flex-wrap:wrap;margin:16px 0}
.m-stat{flex:1;min-width:80px;background:#fafaf8;border:1px solid #f0f0ec;border-radius:8px;padding:10px;text-align:center}
.m-stat-v{font-size:18px;font-weight:700;color:#1a1a1a}
.m-stat-l{font-size:9px;color:#888;text-transform:uppercase;letter-spacing:.3px;margin-top:2px}
.m-stat.red .m-stat-v{color:#D94040}
.m-stat.org .m-stat-v{color:#E87B35}
.m-stat.grn .m-stat-v{color:#2D8A56}

/* Buttons */
.m-btn{padding:8px 16px;border-radius:8px;font-size:12px;font-weight:600;font-family:inherit;cursor:pointer;border:none;transition:.15s}
.m-btn-org{background:#E87B35;color:#fff}
.m-btn-org:hover{background:#d06a28}
.m-btn-org:disabled{opacity:.5;cursor:not-allowed}
.m-btn-grn{background:#2D8A56;color:#fff}
.m-btn-grn:hover{background:#246e47}
.m-btn-gho{background:#fff;color:#555;border:1px solid #ddd}
.m-btn-gho:hover{background:#f5f5f3}
.m-btn-red{background:#D94040;color:#fff}
.m-btn-red:hover{background:#c33}
.m-btn-row{display:flex;gap:8px;justify-content:flex-end;margin-top:16px;padding-top:16px;border-top:1px solid #eee}

/* === SIDE PANEL === */
.side-panel{position:fixed;top:48px;left:0;bottom:0;width:420px;background:#fff;border-right:1px solid #e5e5e5;z-index:80;box-shadow:4px 0 16px rgba(0,0,0,.06);display:flex;flex-direction:column;transform:translateX(-100%);transition:transform .25s}
.side-panel.open{transform:translateX(0)}
.sp-head{padding:14px 16px;border-bottom:1px solid #eee;display:flex;align-items:center;justify-content:space-between;flex-shrink:0}
.sp-head h3{font-size:14px;font-weight:600}
.sp-body{flex:1;overflow-y:auto;padding:0}
.sp-tabs{display:flex;border-bottom:1px solid #eee}
.sp-tab{flex:1;padding:8px;text-align:center;font-size:11px;font-weight:600;cursor:pointer;color:#888;border-bottom:2px solid transparent;transition:.15s;background:none;border-left:none;border-right:none;border-top:none}
.sp-tab.active{color:#E87B35;border-bottom-color:#E87B35}

/* CRUD tables */
.crud-toolbar{padding:10px 16px;display:flex;gap:8px;align-items:center;border-bottom:1px solid #f0f0ec}
.crud-search{flex:1;height:32px;border:1px solid #ddd;border-radius:6px;padding:0 10px;font-size:12px;font-family:inherit;outline:none}
.crud-search:focus{border-color:#E87B35}
.crud-btn-new{height:32px;padding:0 14px;background:#E87B35;color:#fff;border:none;border-radius:6px;font-size:11px;font-weight:600;cursor:pointer;font-family:inherit;white-space:nowrap}
.crud-table{width:100%;border-collapse:collapse}
.crud-table th{font-size:10px;text-transform:uppercase;letter-spacing:.3px;color:#888;font-weight:500;text-align:left;padding:6px 8px;background:#fafaf8;border-bottom:1px solid #f0f0ec;position:sticky;top:0;white-space:nowrap}
.crud-table td{padding:4px 8px;font-size:11px;color:#333;border-bottom:1px solid #f8f8f5;white-space:nowrap}
.crud-table td.wrap{white-space:normal;word-break:break-word;overflow-wrap:break-word}
.crud-table td.wrap .tag{margin:1px 0}
.crud-table tr:hover td{background:#fafaf8}
.crud-table .n{text-align:right;font-variant-numeric:tabular-nums}
.crud-actions{display:flex;gap:2px}
.crud-actions button{border:none;background:none;cursor:pointer;padding:3px;border-radius:4px;color:#888}
.crud-actions button:hover{background:#f0f0ec;color:#333}

/* CRUD form */
.crud-form{padding:16px}
.cf-row{margin-bottom:12px}
.cf-label{display:block;font-size:11px;font-weight:600;color:#888;margin-bottom:4px;text-transform:uppercase;letter-spacing:.3px}
.cf-input{width:100%;height:34px;border:1px solid #ddd;border-radius:6px;padding:0 10px;font-size:12px;font-family:inherit;outline:none}
.cf-input:focus{border-color:#E87B35}
.cf-select{width:100%;height:34px;border:1px solid #ddd;border-radius:6px;padding:0 10px;font-size:12px;font-family:inherit;outline:none;background:#fff;-webkit-appearance:none}
.cf-toggle-row{display:flex;align-items:center;justify-content:space-between;padding:8px 0}

/* Toggle */
.toggle{position:relative;width:36px;height:20px;border-radius:10px;cursor:pointer;border:none;padding:0;transition:background .2s}
.toggle.on{background:#2D8A56}
.toggle.off{background:#ccc}
.toggle .knob{position:absolute;top:2px;width:16px;height:16px;background:#fff;border-radius:50%;transition:left .15s}
.toggle.on .knob{left:18px}
.toggle.off .knob{left:2px}
.toggle.disabled{opacity:.35;pointer-events:none}

/* === GEO POPUP (left) === */
/* Setor selecionado no modo Grupo do editor de poligonos */
.setor-grupo-sel{stroke:#7c3aed !important;stroke-width:5 !important;stroke-dasharray:none !important;filter:drop-shadow(0 0 4px rgba(124,58,237,.4))}

/* Pendente prio: pulso suave (visual diferente de pin de entrega em rota) */
@keyframes pendPrioPulse{0%,100%{filter:drop-shadow(0 0 0 rgba(220,38,38,.0))}50%{filter:drop-shadow(0 0 6px rgba(220,38,38,.85))}}
.pend-prio-pulse{animation:pendPrioPulse 1.6s ease-in-out infinite}

.geo-popup{position:fixed;top:58px;left:12px;background:#fff;border-radius:10px;box-shadow:0 2px 16px rgba(0,0,0,.1);border:1px solid #e5e5e0;z-index:85;font-size:11px;max-height:calc(100vh - 70px);overflow-y:auto;display:flex;flex-direction:column}
.geo-popup.has-rotas{max-height:calc(67vh - 70px)}
.gp-head{padding:10px 14px;border-bottom:1px solid #f0f0ec;display:flex;align-items:center;justify-content:space-between;flex-shrink:0}
.gp-title{font-size:13px;font-weight:600;color:#1a1a1a;display:flex;align-items:center;gap:6px}
.gp-total{font-size:11px;color:#888}
.gp-close{border:none;background:none;cursor:pointer;color:#999;font-size:16px;padding:2px 6px;border-radius:4px}
.gp-close:hover{background:#f0f0ec}
.gp-block{border-bottom:1px solid #f0f0ec;padding:10px 14px;flex-shrink:0}
.gp-block-label{font-size:9px;font-weight:600;color:#999;text-transform:uppercase;letter-spacing:.5px;margin-bottom:8px}
.gp-cards{display:flex;gap:6px}
.gp-card{flex:1;border:1px solid #f0f0ec;border-radius:8px;padding:8px 6px;text-align:center;background:#fafaf8}
.gp-card-dot{width:10px;height:10px;border-radius:50%;margin:0 auto 4px}
.gp-card-val{font-size:16px;font-weight:600;line-height:1.1}
.gp-card-pct{font-size:9px;color:#aaa;font-weight:400}
.gp-card-lbl{font-size:8px;color:#888;text-transform:uppercase;letter-spacing:.3px;margin:2px 0 4px}
.gp-card-tog{display:flex;justify-content:center}
.gp-bar{padding:8px 14px;border-bottom:1px solid #f0f0ec;flex-shrink:0}
.gp-bar-track{height:4px;background:#f0f0ec;border-radius:2px;overflow:hidden}
.gp-bar-fill{height:100%;background:#E87B35;border-radius:2px;transition:width .3s}
.gp-bar-info{display:flex;justify-content:space-between;margin-top:4px;font-size:10px;color:#888}
.gp-bar-info b{color:#1a1a1a}
.gp-tabs{display:flex;border-bottom:1px solid #f0f0ec;flex-shrink:0}
.gp-tab{flex:1;padding:6px;text-align:center;font-size:10px;font-weight:600;cursor:pointer;color:#888;border-bottom:2px solid transparent;background:none;border-left:none;border-right:none;border-top:none}
.gp-tab.active{color:#E87B35;border-bottom-color:#E87B35}
.gp-body{flex:1;overflow-y:auto}
.gp-tbl{width:100%;border-collapse:collapse}
.gp-tbl th{font-size:9px;text-transform:uppercase;letter-spacing:.3px;color:#888;font-weight:500;text-align:left;padding:4px 8px;background:#fafaf8;border-bottom:1px solid #f0f0ec;position:sticky;top:0}
.gp-tbl td{padding:3px 8px;font-size:10px;color:#333;border-bottom:1px solid #f8f8f5}
.gp-tbl .n{text-align:right;font-variant-numeric:tabular-nums}

/* === CORRECTION POPUP (right) === */
.corr-popup{position:fixed;top:58px;left:460px;width:320px;background:#fff;border-radius:10px;box-shadow:0 4px 20px rgba(0,0,0,.12);border:1px solid #e5e5e0;z-index:85;font-size:12px}
.cp-head{padding:10px 14px;border-bottom:1px solid #f0f0ec;display:flex;align-items:center;gap:8px}
.cp-pin{width:28px;height:28px;border-radius:50%;background:#fff;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.cp-pin .inn{width:13px;height:13px;border-radius:50%}
.cp-body{padding:12px 14px}
.cp-row{display:flex;justify-content:space-between;padding:2px 0;font-size:11px}
.cp-row .k{color:#888}
.cp-row .v{color:#333;text-align:right;max-width:170px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cp-div{border-top:1px solid #f0f0ec;margin:8px 0}
.cp-corr-link{font-size:11px;color:#E87B35;cursor:pointer;font-weight:600}
.cp-corr-link:hover{text-decoration:underline}
.cp-excl-link{font-size:11px;color:#D94040;cursor:pointer;font-weight:600}
.cp-excl-link:hover{text-decoration:underline}
.cp-input-row{display:flex;gap:6px;margin-top:6px}
.cp-input{flex:1;height:28px;border:1px solid #ddd;border-radius:6px;padding:0 8px;font-size:11px;font-family:inherit;outline:none}
.cp-input:focus{border-color:#E87B35}
.cp-btn{height:28px;padding:0 12px;border:none;border-radius:6px;font-size:11px;font-weight:600;font-family:inherit;cursor:pointer}
.cp-btn-org{background:#E87B35;color:#fff}
.cp-btn-grn{background:#2D8A56;color:#fff}
.cp-btn-gho{background:#fff;color:#666;border:1px solid #ddd}
.cp-step2{background:#fffbf5;border:1px dashed #E87B35;border-radius:8px;padding:10px;margin-top:8px}
.cp-step2-title{font-size:10px;font-weight:600;color:#E87B35;margin-bottom:4px}
.cp-step2-txt{font-size:10px;color:#666;line-height:1.4}
.cp-coord{font-family:monospace;font-size:11px;color:#1a1a1a;background:#fff;border:1px solid #e5e5e0;border-radius:4px;padding:3px 8px;margin:4px 0;display:inline-block}
.cp-btn-row{display:flex;gap:6px;margin-top:6px}

/* === LOCK BANNER === */
.lock-banner{position:fixed;top:48px;left:0;right:0;background:#EEEDFE;border-bottom:1px solid #CECBF6;padding:6px 20px;font-size:12px;color:#534AB7;font-weight:600;z-index:95;display:flex;align-items:center;gap:8px}

/* === ANIMATION === */
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.4}}
.pulse{animation:pulse 1.5s infinite}

.leaflet-control-zoom{display:none!important}

/* CRUD table normalization */
.crud-table td, .crud-table th{text-align:left;text-transform:uppercase}
.crud-table td.n, .crud-table th.n{text-align:right}

/* CRUD form normalization */
.cf-input,.cf-select,.modal-body input,.modal-body select,.modal input,.modal select{text-transform:uppercase;text-align:left}
.modal-body textarea,.modal textarea{text-transform:uppercase}

/* Close button icon */
.btn-close{border:none;background:none;cursor:pointer;width:28px;height:28px;border-radius:6px;display:flex;align-items:center;justify-content:center;transition:background .15s;padding:0;position:relative}
.btn-close:hover{background:rgba(220,60,60,.08)}
.btn-close::before,.btn-close::after{content:'';position:absolute;width:14px;height:2px;background:#D94040;border-radius:1px}
.btn-close::before{transform:rotate(45deg)}
.btn-close::after{transform:rotate(-45deg)}

/* RotasPanel pin labels */
.rp-pin-label{background:transparent !important;border:none !important;box-shadow:none !important;color:white !important;font-weight:bold;font-size:14px;padding:0 !important;margin:0 !important;pointer-events:none !important}
.rp-pin-label div{display:flex !important;align-items:center !important;justify-content:center !important;font-size:14px !important;color:white !important;font-weight:bold !important;border-radius:50% !important;text-shadow:0 0 3px #222 !important;background:none !important;padding:0 !important;margin:0 !important}
.rp-pin-label .leaflet-tooltip-tip{display:none !important}
.rp-popup-leaflet .leaflet-popup-content-wrapper{border-radius:12px;box-shadow:0 4px 20px rgba(0,0,0,.15)}
.rp-popup-leaflet .leaflet-popup-tip{border-top-color:white}
