*{margin:0;padding:0;box-sizing:border-box}
body{font-family:'Segoe UI',sans-serif;height:100vh;overflow:hidden}
#admin-layout{display:flex;height:100vh}
#sidebar{width:340px;min-width:340px;background:#1a1a2e;color:white;display:flex;flex-direction:column;overflow-y:auto;z-index:10;box-shadow:4px 0 20px rgba(0,0,0,.3)}
#sidebar-header{padding:16px;background:#0f0f1e;border-bottom:1px solid #333;display:flex;align-items:center;justify-content:space-between;flex-shrink:0}
#sidebar-header h2{font-size:1rem}
.btn-back{color:#aaa;text-decoration:none;font-size:.8rem;padding:4px 10px;border:1px solid #444;border-radius:12px}
.btn-back:hover{color:white;border-color:#888}
#global-actions{display:flex;gap:6px;padding:12px;flex-wrap:wrap;border-bottom:1px solid #333;flex-shrink:0}
#global-actions button,.btn-import{flex:1;min-width:80px;padding:8px 6px;border:none;border-radius:8px;cursor:pointer;font-size:.75rem;font-weight:600;background:#2a2a4a;color:white;text-align:center;display:inline-block}
#btn-save-all{background:#1565C0!important;flex:2!important}
#global-actions button:hover,.btn-import:hover{background:#3a3a6a!important}
#instructions{padding:10px 14px;font-size:.8rem;color:#aaa;background:#111;border-bottom:1px solid #333;flex-shrink:0}
#routes-sidebar{padding:10px;display:flex;flex-direction:column;gap:10px}
.route-card{border:2px solid;border-radius:10px;overflow:hidden;background:#1e1e3a}
.route-card.active{box-shadow:0 0 0 2px white}
.rc-header{padding:10px 12px;color:white;display:flex;justify-content:space-between;align-items:center;font-weight:bold;font-size:.9rem}
.rc-count{font-size:.72rem;opacity:.85}
.rc-body{padding:10px 12px}
.rc-devices label{display:block;font-size:.72rem;color:#aaa;margin-bottom:4px}
.rc-devices input{width:100%;padding:6px 8px;border-radius:6px;border:1px solid #444;background:#111;color:white;font-size:.8rem}
.rc-actions{display:flex;gap:6px;margin-top:8px}
.rc-actions button{flex:1;padding:6px 4px;border:none;border-radius:6px;cursor:pointer;font-size:.72rem;font-weight:600}
.btn-edit{background:#1565C0;color:white}
.btn-clear{background:#c62828;color:white}
.btn-fit{background:#2e7d32;color:white}
.rc-actions button:hover{opacity:.8}
#edit-panel{margin:10px;background:#1e1e3a;border-radius:10px;overflow:hidden;border:1px solid #444}
#edit-panel.hidden{display:none}
#edit-panel-header{padding:10px 12px;background:#111;display:flex;justify-content:space-between;align-items:center;font-weight:bold}
.coord-count{font-size:.72rem;color:#aaa;font-weight:normal}
#draw-tools{display:grid;grid-template-columns:1fr 1fr;gap:6px;padding:10px;border-bottom:1px solid #333}
#draw-tools button{padding:8px 6px;border:2px solid #444;border-radius:8px;background:#111;color:#ccc;cursor:pointer;font-size:.75rem;font-weight:600;transition:all .2s}
#draw-tools button:hover{background:#2a2a4a;color:white}
#draw-tools button.active{background:#1565C0;border-color:#42a5f5;color:white}
.btn-save-edit{grid-column:span 2;background:#2e7d32!important;color:white!important;border-color:#4CAF50!important}
#edit-stops-section{padding:10px}
.section-title{font-size:.78rem;color:#aaa;margin-bottom:8px}
.section-title small{display:block;color:#666;margin-top:2px}
#edit-stops-list{max-height:200px;overflow-y:auto}
.empty-list{color:#555;font-size:.8rem;text-align:center;padding:20px}
.edit-stop-item{display:flex;align-items:center;gap:8px;padding:8px;border-radius:6px;background:#111;margin-bottom:4px;font-size:.8rem;cursor:grab}
.edit-stop-item:hover{background:#1a1a3a}
.esi-handle{color:#555;font-size:14px}
.esi-num{background:#333;color:#aaa;width:20px;height:20px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:.7rem;flex-shrink:0}
.esi-name{flex:1;color:white;font-weight:600}
.esi-coords{color:#555;font-size:.7rem}
.esi-del{background:#c62828;color:white;border:none;width:20px;height:20px;border-radius:50%;cursor:pointer;font-size:.7rem;flex-shrink:0}
#admin-map{flex:1}
#stop-dialog{position:fixed;inset:0;background:rgba(0,0,0,.6);display:flex;align-items:center;justify-content:center;z-index:9999}
#stop-dialog.hidden{display:none}
#stop-dialog-box{background:white;border-radius:14px;padding:24px;width:320px;box-shadow:0 10px 40px rgba(0,0,0,.3)}
#stop-dialog-box h3{margin-bottom:16px;color:#333}
.dialog-field label{display:block;font-size:.85rem;color:#666;margin-bottom:6px}
.dialog-field input{width:100%;padding:10px;border:2px solid #ddd;border-radius:8px;font-size:.95rem;outline:none}
.dialog-field input:focus{border-color:#1565C0}
.dialog-actions{display:flex;gap:10px;margin-top:16px;justify-content:flex-end}
.dialog-actions button{padding:8px 20px;border:none;border-radius:8px;cursor:pointer;font-weight:600}
#stop-dialog-cancel{background:#f5f5f5;color:#666}
.btn-primary{background:#1565C0;color:white}

/* Botão importar KMZ por rota */
#import-kmz-section {
    padding: 10px 14px;
    border-top: 1px solid #eee;
    margin-bottom: 8px;
}

.btn-import-kmz {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: #1565C0;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    box-sizing: border-box;
    transition: background 0.2s;
}

.btn-import-kmz:hover {
    background: #0d47a1;
}

.esi-name {
    cursor: pointer;
    flex: 1;
}
.esi-name:hover {
    color: #1565C0;
    text-decoration: underline;
}

/* Drag and drop */
.sortable-ghost {
    opacity: 0.3;
    background: rgba(255,255,255,0.05) !important;
    border: 1px dashed #555 !important;
}

/* Drag and drop */
.sortable-ghost {
    opacity: 0.3;
    background: rgba(255,255,255,0.05) !important;
    border: 1px dashed #555 !important;
}
