:root {
    color-scheme: light;
}

@media screen {
    .online-presence-bar {
        position: relative;
        z-index: 30;
    }

    .online-dot {
        width: 10px;
        height: 10px;
        border-radius: 999px;
        background: rgb(16 185 129);
        box-shadow: 0 0 0 4px rgb(16 185 129 / 14%);
        flex: 0 0 auto;
    }

    .online-presence-list {
        display: flex;
        align-items: center;
        gap: 8px;
        overflow-x: auto;
        padding-bottom: 2px;
        scrollbar-width: thin;
    }

    .online-user-chip {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        max-width: 190px;
        flex: 0 0 auto;
        border: 1px solid rgb(226 232 240);
        border-radius: 999px;
        background: rgb(248 250 252);
        color: rgb(51 65 85);
        font-size: 12px;
        font-weight: 700;
        padding: 4px 9px 4px 4px;
    }

    .online-user-name {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .theme-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        border: 1px solid rgb(203 213 225);
        border-radius: 12px;
        background: rgb(255 255 255);
        color: rgb(71 85 105);
        font-size: 13px;
        font-weight: 700;
        padding: 10px 14px;
        transition: background-color .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
    }

    .theme-toggle::before {
        content: "";
        width: 14px;
        height: 14px;
        border-radius: 999px;
        background: linear-gradient(135deg, rgb(16 185 129), rgb(14 165 233));
        box-shadow: 0 0 0 3px rgb(209 250 229);
    }

    .theme-toggle:hover {
        background: rgb(248 250 252);
        border-color: rgb(148 163 184);
        color: rgb(15 23 42);
    }

    .theme-toggle[aria-pressed="true"] {
        background: linear-gradient(135deg, rgb(15 118 110), rgb(37 99 235));
        border-color: rgb(45 212 191);
        color: white;
        box-shadow: 0 10px 26px rgb(15 23 42 / 18%);
    }

    .theme-toggle[aria-pressed="true"]::before {
        background: white;
        box-shadow: 0 0 0 3px rgb(20 184 166 / 35%);
    }

    .theme-toggle[aria-pressed="true"]::after {
        content: "Ativo";
        border-radius: 999px;
        background: rgb(255 255 255 / 18%);
        color: white;
        font-size: 10px;
        font-weight: 800;
        letter-spacing: .04em;
        padding: 2px 6px;
        text-transform: uppercase;
    }

    .theme-toggle-mobile {
        padding: 8px 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    .theme-dark {
        color-scheme: dark;
    }

    .theme-dark body,
    .theme-dark .bg-slate-100 {
        background: rgb(15 23 42) !important;
        color: rgb(226 232 240) !important;
    }

    .theme-dark .bg-white,
    .theme-dark .online-presence-bar,
    .theme-dark [data-sidebar],
    .theme-dark .card,
    .theme-dark .rounded-2xl.bg-white,
    .theme-dark .rounded-xl.bg-white {
        background: rgb(17 24 39) !important;
        color: rgb(226 232 240) !important;
    }

    .theme-dark .bg-slate-50,
    .theme-dark .bg-slate-100\/70 {
        background: rgb(30 41 59) !important;
    }

    .theme-dark .border-slate-100,
    .theme-dark .border-slate-200,
    .theme-dark .border-slate-300,
    .theme-dark [class*="ring-slate-"] {
        border-color: rgb(51 65 85) !important;
        --tw-ring-color: rgb(51 65 85) !important;
    }

    .theme-dark .text-slate-950,
    .theme-dark .text-slate-900,
    .theme-dark .text-slate-800 {
        color: rgb(248 250 252) !important;
    }

    .theme-dark .text-slate-700,
    .theme-dark .text-slate-600 {
        color: rgb(203 213 225) !important;
    }

    .theme-dark .text-slate-500,
    .theme-dark .text-slate-400 {
        color: rgb(148 163 184) !important;
    }

    .theme-dark .hover\:bg-slate-100:hover,
    .theme-dark .hover\:bg-slate-50:hover {
        background: rgb(30 41 59) !important;
    }

    .theme-dark input,
    .theme-dark select,
    .theme-dark textarea,
    .theme-dark .field,
    .theme-dark .tag-input {
        background: rgb(15 23 42) !important;
        border-color: rgb(71 85 105) !important;
        color: rgb(248 250 252) !important;
    }

    .theme-dark input::placeholder,
    .theme-dark textarea::placeholder,
    .theme-dark .tag-entry::placeholder {
        color: rgb(100 116 139) !important;
    }

    .theme-dark .tag-entry {
        background: transparent !important;
        color: rgb(248 250 252) !important;
    }

    .theme-dark .online-user-chip {
        background: rgb(30 41 59);
        border-color: rgb(51 65 85);
        color: rgb(226 232 240);
    }

    .theme-dark .tag-chip,
    .theme-dark .badge {
        background: rgb(6 78 59) !important;
        border-color: rgb(5 150 105) !important;
        color: rgb(209 250 229) !important;
    }

    .theme-dark .bg-emerald-50 {
        background: rgb(6 78 59) !important;
    }

    .theme-dark .route-list-item {
        background: rgb(15 23 42);
        border-color: rgb(51 65 85);
    }

    .theme-dark .route-list-item.active {
        background: linear-gradient(180deg, rgb(6 78 59 / 0.55), rgb(15 23 42));
        border-color: rgb(16 185 129);
    }

    .theme-dark .route-meta-pill {
        background: rgb(30 41 59);
        color: rgb(203 213 225);
    }

    .theme-dark .dashboard-popup-action {
        background: rgb(30 41 59);
        color: rgb(226 232 240);
    }

    .theme-dark .dashboard-popup-action.primary {
        background: rgb(5 150 105);
        color: white;
    }

    .theme-dark .dashboard-map-note {
        background: rgb(23 37 84);
        color: rgb(191 219 254);
    }

    .theme-dark .route-loading {
        background: rgb(15 23 42 / 0.94);
        color: rgb(248 250 252);
    }

    .theme-dark .route-loading span {
        color: rgb(203 213 225);
    }

    .theme-dark .origin-bar-row .bg-slate-100 {
        background: rgb(30 41 59) !important;
    }

    .theme-dark .origin-dashboard-row {
        background: rgb(15 23 42);
        border-color: rgb(51 65 85);
    }

    .theme-dark .top-user-pill {
        background: rgb(15 23 42);
        border-color: rgb(51 65 85);
        color: rgb(226 232 240);
    }

    .theme-dark .top-user-pill:hover {
        background: rgb(30 41 59);
        border-color: rgb(16 185 129);
    }

    .theme-dark .user-avatar,
    .theme-dark .user-avatar-placeholder {
        border-color: rgb(30 41 59);
    }

    .theme-dark .text-emerald-700,
    .theme-dark .text-emerald-800 {
        color: rgb(110 231 183) !important;
    }

    .theme-dark .bg-blue-50 {
        background: rgb(23 37 84) !important;
    }

    .theme-dark .text-blue-700,
    .theme-dark .text-blue-800 {
        color: rgb(147 197 253) !important;
    }

    .theme-dark .bg-amber-50 {
        background: rgb(69 26 3) !important;
    }

    .theme-dark .text-amber-700,
    .theme-dark .text-amber-800 {
        color: rgb(252 211 77) !important;
    }

    .theme-dark .bg-red-50 {
        background: rgb(69 10 10) !important;
    }

    .theme-dark .text-red-700,
    .theme-dark .text-red-800 {
        color: rgb(252 165 165) !important;
    }

    .theme-dark table,
    .theme-dark thead,
    .theme-dark tbody,
    .theme-dark tr {
        border-color: rgb(51 65 85) !important;
    }

    .theme-dark thead,
    .theme-dark .bg-slate-900 {
        background: rgb(2 6 23) !important;
    }

    .theme-dark .leaflet-popup-content-wrapper,
    .theme-dark .leaflet-popup-tip {
        background: rgb(15 23 42) !important;
        color: rgb(226 232 240) !important;
    }

    .theme-dark .leaflet-control,
    .theme-dark .leaflet-control a {
        background: rgb(15 23 42) !important;
        color: rgb(226 232 240) !important;
        border-color: rgb(51 65 85) !important;
    }

    .theme-dark .theme-toggle {
        background: rgb(15 23 42);
        border-color: rgb(51 65 85);
        color: rgb(226 232 240);
    }

    .theme-dark .theme-toggle[aria-pressed="true"] {
        background: linear-gradient(135deg, rgb(13 148 136), rgb(37 99 235));
        border-color: rgb(94 234 212);
        color: white;
        box-shadow: 0 12px 28px rgb(0 0 0 / 32%);
    }

    .theme-dark .theme-toggle::before {
        background: linear-gradient(135deg, rgb(14 165 233), rgb(168 85 247));
        box-shadow: 0 0 0 3px rgb(30 41 59);
    }

    .theme-dark .theme-toggle:hover {
        background: rgb(30 41 59);
        border-color: rgb(71 85 105);
        color: rgb(248 250 252);
    }
}

body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.card {
    border: 1px solid rgb(226 232 240);
    border-radius: 1rem;
    background: white;
    box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}

.field {
    width: 100%;
    border-radius: 0.75rem;
    border: 1px solid rgb(203 213 225);
    background: white;
    padding: 0.7rem 0.9rem;
    outline: none;
}

.field:focus {
    border-color: rgb(16 185 129);
    box-shadow: 0 0 0 4px rgb(209 250 229);
}

.tag-input {
    display: flex;
    min-height: 3rem;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    border-radius: 0.75rem;
    border: 1px solid rgb(203 213 225);
    background: white;
    padding: 0.45rem 0.55rem;
}

.tag-input:focus-within {
    border-color: rgb(16 185 129);
    box-shadow: 0 0 0 4px rgb(209 250 229);
}

.tag-list {
    display: contents;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border-radius: 999px;
    background: rgb(236 253 245);
    border: 1px solid rgb(167 243 208);
    color: rgb(6 95 70);
    padding: 0.35rem 0.55rem;
    font-size: 0.78rem;
    font-weight: 800;
}

.tag-chip button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    color: rgb(6 95 70);
    font-size: 0.95rem;
    line-height: 1;
}

.tag-chip button:hover {
    background: rgb(167 243 208);
}

.tag-entry {
    min-width: 12rem;
    flex: 1;
    border: 0;
    outline: none;
    padding: 0.35rem;
    font-size: 0.95rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    padding: 0.68rem 1rem;
    font-size: 0.875rem;
    font-weight: 700;
    transition: 150ms ease;
}

.btn-primary { background: rgb(5 150 105); color: white; }
.btn-primary:hover { background: rgb(4 120 87); }
.btn-soft { background: rgb(241 245 249); color: rgb(15 23 42); }
.btn-soft:hover { background: rgb(226 232 240); }
.btn-danger { background: rgb(220 38 38); color: white; }
.btn-danger:hover { background: rgb(185 28 28); }

.user-avatar {
    border: 2px solid rgb(255 255 255);
    background: rgb(241 245 249);
    box-shadow: 0 6px 18px rgb(15 23 42 / 12%);
}

.user-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgb(255 255 255);
    background: linear-gradient(135deg, rgb(5 150 105), rgb(14 165 233));
    color: white;
    font-weight: 900;
    letter-spacing: .02em;
    box-shadow: 0 6px 18px rgb(15 23 42 / 12%);
}

.top-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgb(226 232 240);
    border-radius: 999px;
    background: rgb(248 250 252);
    color: rgb(15 23 42);
    padding: 0.2rem 0.55rem 0.2rem 0.2rem;
    max-width: 10rem;
}

.top-user-pill:hover {
    border-color: rgb(16 185 129);
    background: rgb(236 253 245);
}

.profile-photo-preview .user-avatar,
.profile-photo-preview .user-avatar-placeholder {
    font-size: 2.2rem;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    background: rgb(240 253 244);
    color: rgb(22 101 52);
}

.ranking-scroll {
    max-height: 10rem;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.ranking-scroll-lg {
    max-height: 24rem;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.ranking-scroll-lg::-webkit-scrollbar,
.ranking-scroll::-webkit-scrollbar {
    width: 0.45rem;
}

.ranking-scroll-lg::-webkit-scrollbar-thumb,
.ranking-scroll::-webkit-scrollbar-thumb {
    background: rgb(203 213 225);
    border-radius: 999px;
}

.route-saved-list {
    display: grid;
    gap: 12px;
    max-height: 28rem;
    overflow-y: auto;
    padding: 16px;
}

.route-map-shell {
    position: relative;
}

.route-loading {
    position: absolute;
    inset: 0;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgb(255 255 255 / 0.94);
    color: rgb(15 23 42);
    text-align: center;
    padding: 24px;
}

.route-loading.hidden {
    display: none;
}

.route-loading span {
    max-width: 420px;
    color: rgb(71 85 105);
    font-size: 14px;
}

.route-loading-spinner {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: 4px solid rgb(209 250 229);
    border-top-color: rgb(5 150 105);
    animation: radar-spin .85s linear infinite;
}

@keyframes radar-spin {
    to { transform: rotate(360deg); }
}

.route-list-item {
    border: 1px solid rgb(226 232 240);
    border-radius: 14px;
    background: rgb(255 255 255);
    padding: 16px;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.route-list-item:hover {
    border-color: rgb(16 185 129);
    box-shadow: 0 14px 34px rgb(15 23 42 / 8%);
    transform: translateY(-1px);
}

.route-list-item.active {
    border-color: rgb(5 150 105);
    background: linear-gradient(180deg, rgb(236 253 245), rgb(255 255 255));
    box-shadow: 0 16px 36px rgb(5 150 105 / 14%);
}

.route-meta-pill,
.route-selected-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
}

.route-meta-pill {
    background: rgb(241 245 249);
    color: rgb(71 85 105);
}

.route-selected-pill {
    background: rgb(5 150 105);
    color: white;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.origin-bar-row {
    break-inside: avoid;
    page-break-inside: avoid;
}

.origin-bar-row .bg-emerald-500 {
    background: linear-gradient(90deg, rgb(16 185 129), rgb(14 165 233));
}

.origin-dashboard-row {
    border: 1px solid rgb(226 232 240);
    border-radius: 12px;
    background: rgb(255 255 255);
    padding: 12px;
}

.dashboard-map-shell {
    height: min(560px, 68vh);
    min-height: 360px;
    max-width: 100%;
    position: relative;
    width: 100%;
}

.dashboard-map-canvas {
    height: 100%;
    min-height: 100%;
    width: 100%;
}

.dashboard-map-mobile-sheet {
    display: none;
}

.agenda-grid {
    display: grid;
    grid-template-columns: 5rem repeat(7, minmax(8rem, 1fr));
}

.agenda-corner,
.agenda-day-head,
.agenda-time,
.agenda-slot {
    border-bottom: 1px solid rgb(226 232 240);
    border-right: 1px solid rgb(226 232 240);
}

.agenda-corner,
.agenda-day-head {
    background: rgb(248 250 252);
    min-height: 4rem;
    padding: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 5;
}

.agenda-corner,
.agenda-time {
    left: 0;
    position: sticky;
    z-index: 6;
}

.agenda-time {
    align-items: flex-start;
    background: rgb(248 250 252);
    color: rgb(100 116 139);
    display: flex;
    font-size: 0.78rem;
    font-weight: 800;
    justify-content: center;
    min-height: 4.5rem;
    padding-top: 0.75rem;
}

.agenda-slot {
    background: white;
    min-height: 4.5rem;
    padding: 0.35rem;
    transition: background-color 150ms ease, box-shadow 150ms ease;
}

.agenda-slot.drag-over {
    background: rgb(236 253 245);
    box-shadow: inset 0 0 0 2px rgb(16 185 129);
}

.agenda-lead {
    cursor: grab;
}

.agenda-lead:active {
    cursor: grabbing;
}

.agenda-lead.selected {
    border-color: rgb(5 150 105);
    box-shadow: 0 0 0 3px rgb(209 250 229);
}

.agenda-item {
    border: 1px solid rgb(16 185 129 / 0.35);
    border-radius: 0.75rem;
    background: rgb(209 250 229);
    color: rgb(6 78 59);
    display: block;
    font-size: 0.78rem;
    line-height: 1.25;
    margin-bottom: 0.25rem;
    padding: 0.45rem 0.5rem;
    text-align: left;
    width: 100%;
}

.agenda-item span {
    color: rgb(71 85 105);
    display: block;
    font-size: 0.7rem;
    margin-top: 0.15rem;
}

.agenda-item.status-confirmado {
    background: rgb(219 234 254);
    border-color: rgb(59 130 246 / 0.4);
    color: rgb(30 64 175);
}

.agenda-item.status-concluido {
    background: rgb(220 252 231);
    border-color: rgb(34 197 94 / 0.45);
    color: rgb(22 101 52);
}

.agenda-item.status-cancelado {
    background: rgb(241 245 249);
    border-color: rgb(148 163 184 / 0.45);
    color: rgb(71 85 105);
    text-decoration: line-through;
}

.agenda-modal {
    align-items: center;
    background: rgb(15 23 42 / 0.55);
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 1rem;
    position: fixed;
    z-index: 80;
}

.agenda-modal.hidden {
    display: none;
}

.agenda-dialog {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 24px 70px rgb(15 23 42 / 0.32);
    max-height: 92vh;
    max-width: 42rem;
    overflow-y: auto;
    padding: 1.25rem;
    width: 100%;
}

.dashboard-map-card,
.dashboard-map-search,
.dashboard-map-actions {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
}

.dashboard-map-card {
    overflow: hidden;
    width: 100%;
}

.dashboard-map-card h3,
.dashboard-map-card p,
.dashboard-map-search label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.dashboard-map-search .field {
    box-sizing: border-box;
    min-width: 0;
}

.map-filter {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgb(203 213 225);
    border-radius: 999px;
    background: white;
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 800;
    color: rgb(51 65 85);
    transition: 150ms ease;
}

.map-filter:hover,
.map-filter.active {
    border-color: rgb(5 150 105);
    background: rgb(236 253 245);
    color: rgb(6 95 70);
}

.map-filter[data-map-filter="1"] {
    border-color: rgb(16 185 129 / 0.45);
}

.map-filter[data-map-filter="1"].active,
.map-filter[data-map-filter="1"]:hover {
    background: rgb(209 250 229);
    color: rgb(4 120 87);
}

.map-filter[data-map-filter="2"] {
    border-color: rgb(250 204 21 / 0.55);
}

.map-filter[data-map-filter="2"].active,
.map-filter[data-map-filter="2"]:hover {
    background: rgb(254 249 195);
    color: rgb(133 77 14);
}

.map-filter[data-map-filter="3"] {
    border-color: rgb(239 68 68 / 0.5);
}

.map-filter[data-map-filter="3"].active,
.map-filter[data-map-filter="3"]:hover {
    background: rgb(254 226 226);
    color: rgb(153 27 27);
}

.map-filter[data-map-filter="approx"] {
    border-color: rgb(168 85 247 / 0.5);
}

.map-filter[data-map-filter="approx"].active,
.map-filter[data-map-filter="approx"]:hover {
    background: rgb(243 232 255);
    color: rgb(109 40 217);
}

.classification-select {
    border-width: 1px;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.classification-select[data-classification=""] {
    border-color: rgb(203 213 225);
    background: rgb(248 250 252);
    color: rgb(71 85 105);
}

.classification-select[data-classification="1"] {
    border-color: rgb(110 231 183);
    background: rgb(209 250 229);
    color: rgb(4 120 87);
}

.classification-select[data-classification="2"] {
    border-color: rgb(253 224 71);
    background: rgb(254 249 195);
    color: rgb(133 77 14);
}

.classification-select[data-classification="3"] {
    border-color: rgb(252 165 165);
    background: rgb(254 226 226);
    color: rgb(153 27 27);
}

.route-number {
    background: transparent;
    border: 0;
    box-shadow: none;
    color: white;
    font-weight: 800;
    text-align: center;
}

.route-popup {
    width: min(72vw, 370px);
    max-height: 68vh;
    overflow-y: auto;
    color: rgb(15 23 42);
    padding-right: 0.15rem;
}

.route-popup strong {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.25;
}

.route-popup dl {
    display: grid;
    grid-template-columns: 5.75rem 1fr;
    gap: 0.22rem 0.55rem;
    margin: 0;
    font-size: 0.78rem;
}

.route-popup dt {
    color: rgb(100 116 139);
    font-weight: 800;
    text-transform: uppercase;
}

.route-popup dd {
    margin: 0;
    white-space: pre-line;
}

.route-popup-form {
    margin-top: 0.75rem;
    display: grid;
    gap: 0.4rem;
    border-top: 1px solid rgb(226 232 240);
    padding-top: 0.7rem;
}

.route-popup-form label {
    font-size: 0.72rem;
    font-weight: 800;
    color: rgb(100 116 139);
    text-transform: uppercase;
}

.route-popup-form select {
    width: 100%;
    min-height: 2.15rem;
    border-radius: 0.5rem;
    border: 1px solid rgb(203 213 225);
    background: white;
    padding: 0.4rem 0.55rem;
    font-size: 0.82rem;
}

.route-popup-form button {
    min-height: 2.25rem;
    border-radius: 0.5rem;
    background: rgb(5 150 105);
    color: white;
    padding: 0.5rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 800;
    transition: 150ms ease;
}

.route-popup-form button:hover {
    background: rgb(4 120 87);
}

.route-popup-form textarea {
    width: 100%;
    min-height: 3.25rem;
    resize: vertical;
    border-radius: 0.5rem;
    border: 1px solid rgb(203 213 225);
    padding: 0.45rem 0.55rem;
    font-size: 0.82rem;
    line-height: 1.3;
}

.route-popup-date {
    margin: 0.55rem 0 0;
    color: rgb(100 116 139);
    font-size: 0.72rem;
    font-weight: 700;
}

.route-map-warning {
    border-radius: 0.5rem;
    background: rgb(243 232 255);
    color: rgb(109 40 217);
    margin: 0.6rem 0 0;
    padding: 0.45rem 0.55rem;
    font-size: 0.72rem;
    font-weight: 800;
}

.dashboard-map-popup dl {
    grid-template-columns: 6.5rem 1fr;
}

.dashboard-map-popup {
    max-height: min(58vh, 440px);
    overflow-y: auto;
    padding-right: 0.25rem;
}

.dashboard-map-popup .route-popup-form {
    border: 1px solid rgb(226 232 240);
    border-radius: 0.65rem;
    background: white;
    margin-top: 0.65rem;
    padding: 0.55rem;
}

.dashboard-map-popup .route-popup-form textarea {
    min-height: 2.6rem;
    max-height: 5.2rem;
}

.dashboard-map-popup .route-popup-form button {
    position: sticky;
    bottom: 0;
    z-index: 2;
    width: 100%;
    box-shadow: 0 -8px 18px rgb(255 255 255 / 92%);
}

.theme-dark .dashboard-map-popup .route-popup-form {
    background: rgb(15 23 42);
    border-color: rgb(51 65 85);
}

.theme-dark .dashboard-map-popup .route-popup-form button {
    box-shadow: 0 -8px 18px rgb(15 23 42 / 92%);
}

.dashboard-map-note {
    border-radius: 0.5rem;
    background: rgb(219 234 254);
    color: rgb(30 64 175);
    font-size: 0.72rem;
    font-weight: 800;
    margin: 0.6rem 0 0;
    padding: 0.45rem 0.55rem;
}

.dashboard-popup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.75rem;
}

.dashboard-popup-action {
    align-items: center;
    background: rgb(241 245 249);
    border-radius: 0.55rem;
    color: rgb(15 23 42);
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 800;
    justify-content: center;
    min-height: 2rem;
    padding: 0.45rem 0.7rem;
}

.dashboard-popup-action.primary {
    background: rgb(5 150 105);
    color: white;
}

.dashboard-popup-action:hover {
    filter: brightness(0.96);
}

@media (max-width: 480px) {
    .dashboard-map-card {
        max-width: calc(100vw - 2rem);
        padding: 0.75rem;
    }

    .dashboard-map-shell {
        height: 62vh;
        min-height: 320px;
    }

    .dashboard-map-actions .btn,
    .dashboard-map-search .btn {
        width: 100%;
    }

    .map-filter {
        flex: 1 1 calc(50% - 0.5rem);
        justify-content: center;
        min-height: 2.45rem;
        padding-left: 0.45rem;
        padding-right: 0.45rem;
    }

    .route-popup {
        max-height: none;
        width: 100%;
    }

    .dashboard-map-popup {
        max-height: none;
        padding-right: 0;
    }

    .route-popup dl {
        grid-template-columns: 1fr;
        gap: 0.1rem;
    }

    .route-popup dt {
        margin-top: 0.3rem;
    }
}

.lead-table-wrap {
    overflow-x: auto;
    overflow-y: visible;
}

.lead-table {
    min-width: 920px;
}

.lead-table th,
.lead-table td {
    vertical-align: top;
    white-space: nowrap;
}

.lead-table td[data-label="Nome"],
.lead-table td[data-label="Endereço"],
.lead-table td[data-label="Referência"],
.lead-table td[data-label="Tags"] {
    max-width: 220px;
    white-space: normal;
}

.lead-actions {
    position: sticky;
    right: 0;
    z-index: 2;
    background: white;
    box-shadow: -8px 0 12px rgb(15 23 42 / 0.06);
}

.lead-table thead th:last-child {
    position: sticky;
    right: 0;
    z-index: 3;
    background: rgb(248 250 252);
    box-shadow: -8px 0 12px rgb(15 23 42 / 0.06);
}

.report-table-wrap {
    overflow-x: auto;
}

.report-column-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.report-column-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgb(203 213 225);
    border-radius: 999px;
    background: white;
    padding: 0.5rem 0.75rem;
    color: rgb(51 65 85);
    cursor: grab;
    user-select: none;
}

.report-column-chip.dragging {
    opacity: 0.55;
    cursor: grabbing;
}

.report-column-chip label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

.report-column-handle {
    color: rgb(100 116 139);
    font-weight: 900;
    letter-spacing: -0.12em;
}

.report-table {
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0;
}

.report-table th,
.report-table td {
    vertical-align: top;
}

.report-row-main td {
    border-top: 4px solid rgb(148 163 184);
}

.report-row-detail td {
    border-bottom: 2px solid rgb(203 213 225);
}

.report-item-even td {
    background: rgb(248 250 252);
}

.report-item-odd td {
    background: rgb(241 245 249);
}

.report-row-detail td {
    font-size: 0.82rem;
}

.report-tags {
    display: inline-block;
    max-width: 10rem;
    color: rgb(71 85 105);
    font-size: 0.72rem;
    line-height: 1.25;
    word-break: break-word;
}

.classification-checks {
    display: grid;
    gap: 0.25rem;
    min-width: 8.5rem;
}

.classification-checks span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: rgb(51 65 85);
    white-space: nowrap;
}

.classification-checks i {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    border: 2px solid rgb(71 85 105);
    background: white;
}

@media (max-width: 767px) {
    .dashboard-map-mobile-sheet {
        background: white;
        border: 1px solid rgb(226 232 240);
        border-radius: 1rem 1rem 0 0;
        bottom: 0;
        box-shadow: 0 -12px 35px rgb(15 23 42 / 0.22);
        box-sizing: border-box;
        display: none;
        left: 0.5rem;
        max-height: min(74vh, 560px);
        overflow: hidden;
        position: absolute;
        right: 0.5rem;
        z-index: 1000;
    }

    .dashboard-map-mobile-sheet.active {
        display: block;
    }

    .dashboard-map-mobile-close {
        align-items: center;
        background: white;
        border: 1px solid rgb(203 213 225);
        border-radius: 999px;
        box-shadow: 0 1px 6px rgb(15 23 42 / 0.14);
        color: rgb(15 23 42);
        display: inline-flex;
        font-size: 1.4rem;
        font-weight: 800;
        height: 2.25rem;
        justify-content: center;
        left: 0.75rem;
        line-height: 1;
        min-height: 2.25rem;
        padding: 0;
        position: absolute;
        right: auto;
        top: 0.75rem;
        width: 2.25rem;
        z-index: 2;
    }

    .dashboard-map-mobile-content {
        max-height: min(74vh, 560px);
        overflow-y: auto;
        padding: 3.5rem 0.85rem 1rem;
    }

    .dashboard-map-mobile-content .route-popup {
        max-height: none;
        width: 100%;
    }

    .dashboard-map-mobile-content .dashboard-map-popup {
        max-height: none;
        padding-right: 0;
    }

    .dashboard-leaflet-popup {
        max-width: calc(100vw - 2rem) !important;
        width: min(300px, calc(100vw - 4.25rem)) !important;
    }

    .dashboard-leaflet-popup .leaflet-popup-content {
        margin: 0;
        max-height: 52vh;
        max-width: 100% !important;
        overflow-y: auto;
        padding: 0.75rem 0.65rem 0.65rem;
        width: 100% !important;
    }

    .dashboard-leaflet-popup .leaflet-popup-content-wrapper {
        box-sizing: border-box;
        max-height: calc(52vh + 1.5rem);
        max-width: 100% !important;
        overflow: hidden;
        padding-right: 1.7rem;
        width: 100%;
    }

    .dashboard-leaflet-popup .leaflet-popup-close-button {
        align-items: center;
        background: rgb(255 255 255 / 94%);
        border-radius: 999px;
        box-shadow: 0 1px 6px rgb(15 23 42 / 0.18);
        display: inline-flex;
        height: 2rem !important;
        justify-content: center;
        line-height: 1;
        right: 0.35rem !important;
        top: 0.35rem !important;
        width: 2rem !important;
        z-index: 10;
    }

    .dashboard-map-shell {
        height: 62vh;
        min-height: 320px;
    }

    .lead-table-wrap {
        overflow-x: visible;
    }

    .lead-table {
        min-width: 0;
    }

    .lead-table th,
    .lead-table td {
        white-space: normal;
    }

    .lead-actions,
    .lead-table thead th:last-child {
        position: static;
        box-shadow: none;
    }

    .responsive-table thead { display: none; }
    .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
    .responsive-table tr {
        margin-bottom: 1rem;
        border: 1px solid rgb(226 232 240);
        border-radius: 1rem;
        background: white;
        padding: 0.75rem;
    }
    .responsive-table td {
        border: 0;
        padding: 0.45rem 0;
    }
    .responsive-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.72rem;
        font-weight: 800;
        color: rgb(100 116 139);
        text-transform: uppercase;
        letter-spacing: 0.06em;
    }
}

@media (max-width: 480px) {
    .dashboard-map-shell {
        height: 62vh;
        min-height: 320px;
    }
}

@media print {
    @page {
        size: A4;
        margin: 10mm;
    }

    body {
        background: white;
        font-size: 11px;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    aside,
    .no-print,
    [data-sidebar],
    [data-sidebar-overlay] {
        display: none !important;
    }

    main {
        padding-left: 0 !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid rgb(148 163 184);
        border-radius: 0;
    }

    .print-area {
        color: black;
    }

    .report-lead {
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 8px;
        overflow: visible !important;
    }

    .report-lead * {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .report-lead .bg-slate-50,
    .report-lead .rounded-lg {
        background: white !important;
        border-radius: 0 !important;
    }

    .report-lead .p-4 {
        padding: 8px !important;
    }

    .report-lead .p-3 {
        padding: 6px !important;
    }

    .report-lead .space-y-3 > :not([hidden]) ~ :not([hidden]) {
        margin-top: 6px !important;
    }

    .report-checks {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .report-checks label {
        min-height: 28px !important;
        padding: 4px 6px !important;
    }

    .report-text-block {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .report-table-wrap {
        overflow: visible !important;
    }

    .report-table {
        width: 100% !important;
        min-width: 0 !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
        font-size: 8.2px !important;
    }

    .report-table th,
    .report-table td {
        border: 1px solid rgb(148 163 184) !important;
        padding: 2px 3px !important;
        line-height: 1.12 !important;
    }

    .report-table thead th {
        background: rgb(226 232 240) !important;
    }

    .report-row-main,
    .report-row-detail {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .report-row-main {
        break-after: avoid;
        page-break-after: avoid;
    }

    .report-row-detail {
        break-before: avoid;
        page-break-before: avoid;
    }

    .report-row-detail td {
        font-size: 7.8px !important;
    }

    .report-row-main td {
        border-top: 2.5px solid rgb(71 85 105) !important;
    }

    .report-row-detail td {
        border-bottom: 1.5px solid rgb(100 116 139) !important;
    }

    .report-item-even td {
        background-color: rgb(248 250 252) !important;
        background-image: linear-gradient(rgb(248 250 252), rgb(248 250 252)) !important;
    }

    .report-item-odd td {
        background-color: rgb(229 231 235) !important;
        background-image: linear-gradient(rgb(229 231 235), rgb(229 231 235)) !important;
    }

    .classification-checks {
        gap: 1px !important;
        min-width: 0 !important;
    }

    .classification-checks span {
        font-size: 7px !important;
        gap: 2px !important;
    }

    .classification-checks i {
        width: 7px !important;
        height: 7px !important;
        border-width: 1px !important;
    }

    .report-tags {
        max-width: 70px !important;
        font-size: 6.8px !important;
        line-height: 1.1 !important;
    }

    .origin-bar-row {
        margin-bottom: 5px !important;
    }

    .origin-bar-row .h-3 {
        height: 7px !important;
    }
}
