* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f5f6f8;
    color: #222;
}

a {
    text-decoration: none;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: #111827;
    color: #fff;
    padding: 18px 16px;
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.logo-box {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #2563eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

.logo-text {
    line-height: 1.1;
}

.logo-title {
    font-weight: bold;
    font-size: 15px;
}

.logo-subtitle {
    font-size: 12px;
    color: #9ca3af;
}

.sidebar-section {
    margin-bottom: 18px;
}

.sidebar-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #9ca3af;
    margin-bottom: 8px;
    padding: 0 10px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar-link {
    display: block;
    color: #e5e7eb;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background .2s ease;
}

.sidebar-link:hover {
    background: rgba(255,255,255,.08);
}

.sidebar-link.active {
    background: #2563eb;
    color: #fff;
}

.main {
    flex: 1;
    min-width: 0;
}

.header {
    height: 70px;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.header-title {
    font-size: 22px;
    font-weight: bold;
}

.header-right {
    color: #6b7280;
    font-size: 14px;
}

.content {
    padding: 24px;
}

.page-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

@media (max-width: 960px) {
    .sidebar {
        width: 220px;
    }

    .header-title {
        font-size: 18px;
    }
}
.btn {
    display:inline-block;
    padding:10px 14px;
    border-radius:6px;
    text-decoration:none;
    color:#fff;
    border:none;
    cursor:pointer;
    margin-right:8px;
    background: #FD7E14;
}

.btn-dark { background:#212529; }
.btn-primary { background:#0d6efd; }
.btn-success { background:#198754; }
.btn-info { background:#0dcaf0; color:#111; }
.btn-warning { background:#fd7e14; }
.btn-danger { background:#dc3545; }
.btn-sm { padding:6px 10px; font-size:12px; }

.badge {
    display:inline-block;
    padding:4px 8px;
    border-radius:6px;
    font-size:12px;
    font-weight:bold;
}

.badge-secondary { background:#e9ecef; color:#333; }
.badge-success { background:#d1e7dd; color:#0f5132; }
.badge-info { background:#cff4fc; color:#055160; }
.badge-primary { background:#cfe2ff; color:#084298; }
.badge-danger { background:#f8d7da; color:#842029; }

.filters {
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap:14px;
}

input, select, textarea {
    width:100%;
    padding:10px 12px;
    border:1px solid #ced4da;
    border-radius:8px;
    box-sizing:border-box;
    background:#fff;
}

table {
    width:100%;
    border-collapse: collapse;
    font-size:14px;
}

th, td {
    padding:10px;
    border-bottom:1px solid #e9ecef;
    text-align:left;
    vertical-align:middle;
}

th {
    background:#f8f9fa;
    position:sticky;
    top:0;
}

.table-wrap {
    overflow:auto;
    max-height:75vh;
}

.row-cancelada {
    background:#fff5f5;
}

.muted {
    color:#6c757d;
}

.actions {
    display:flex;
    flex-wrap:wrap;
    gap:6px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-box {
    width: min(520px, 92vw);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
    padding: 20px;
}

.modal-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
}

.modal-text {
    color:#444;
    margin-bottom: 18px;
}

.modal-actions {
    display:flex;
    justify-content:flex-end;
    gap:10px;
}
.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.kpi {
    background: #fff;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.kpi-label {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 28px;
    font-weight: bold;
}

#cardsContainer {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 16px;
}

.route-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
    padding: 16px;
}

.route-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 4px;
}

.route-sub {
    color: #6c757d;
    margin-bottom: 12px;
}

.metric {
    margin-bottom: 6px;
    font-size: 14px;
}

.progress {
    height: 12px;
    background: #e9ecef;
    border-radius: 999px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-bar {
    height: 100%;
    background: #198754;
}

.error-box {
    background: #f8d7da;
    color: #842029;
    padding: 12px 14px;
    border-radius: 8px;
    margin-top: 16px;
    display: none;
    white-space: pre-wrap;
}

#map {
    width: 100%;
    height: 520px;
    border-radius: 10px;
    border: 1px solid #dee2e6;
}
.btn-secondary {
    background: #6b7280;
}
.sidebar {
    width: 280px;
    transition: width .25s ease;
    overflow: hidden;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 10px;
}

.sidebar-toggle {
    border: none;
    background: rgba(255,255,255,.08);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 18px;
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,.14);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-icon {
    min-width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-label {
    white-space: nowrap;
}

.sidebar.collapsed {
    width: 86px;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .sidebar-section-title,
.sidebar.collapsed .sidebar-label {
    display: none;
}

.sidebar.collapsed .sidebar-top {
    justify-content: center;
    flex-direction: column;
}

.sidebar.collapsed .sidebar-logo {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: none;
}

.sidebar.collapsed .sidebar-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar.collapsed .sidebar-nav {
    align-items: center;
}