:root {
    --bg: #eaeae5;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #ffffff;
    --ink: #111827;
    --muted: #6b7280;
    --line: #e5e7eb;
    --accent: #ff4938;
    --flash: rgba(255, 73, 56, 0.16);
    --grid: rgba(17, 24, 39, 0.04);
}

html.dark {
    --bg: #0b0d0f;
    --surface: rgba(18, 22, 28, 0.8);
    --surface-strong: #151a22;
    --ink: #f0f3f6;
    --muted: #8b949e;
    --line: #21262d;
    --accent: #ff5a4a;
    --flash: rgba(255, 90, 74, 0.22);
    --grid: rgba(255, 255, 255, 0.02);
}

.state-map-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.36fr);
    gap: 1rem;
    align-items: start;
}

.state-map-help-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto minmax(260px, 0.8fr);
    gap: 1rem;
    align-items: center;
}

.state-map-palette {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.state-map-palette-item {
    border: 1px dashed #cbd5e1;
    background: #fff;
    border-radius: 999px;
    padding: 0.45rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #374151;
    cursor: grab;
}

.state-map-canvas {
    min-height: 640px;
    height: calc(100vh - 215px);
    position: sticky;
    top: 1rem;
    overflow: hidden;
}

.state-map-canvas .card-body {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.state-map-board {
    min-height: 0;
    height: 100%;
    overflow: auto;
    padding: 1.25rem;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(17, 24, 39, 0.08) 1px, transparent 0);
    background-size: 24px 24px;
}

.state-map-empty {
    min-height: 420px;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.35rem;
    color: #6b7280;
    text-align: center;
}

.state-map-empty iconify-icon {
    font-size: 2.3rem;
    color: #9ca3af;
}

.state-map-empty.is-visible {
    display: flex;
}

.state-map-alert {
    margin: 1rem;
}

.state-map-panel {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 32px);
    overflow: auto;
}

.state-map-tree,
.state-map-children {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.state-map-tree {
    min-width: max-content;
}

.state-map-row {
    display: flex;
    align-items: flex-start;
    gap: 1.35rem;
    position: relative;
}

.state-map-row::after {
    content: "";
    position: absolute;
    left: 220px;
    top: 24px;
    width: 1.15rem;
    border-top: 1px solid #cbd5e1;
}

.state-map-row:not(:has(.state-map-children > .state-map-row))::after {
    display: none;
}

.state-map-node {
    width: 220px;
    min-height: 52px;
    border: 1px solid #e5e7eb;
    border-left-width: 5px;
    background: rgba(255, 255, 255, 0.94);
    border-radius: 1rem;
    padding: 0.7rem 0.78rem;
    box-shadow: 0 10px 24px rgba(17, 24, 39, 0.06);
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.state-map-node:hover,
.state-map-node.is-selected {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(17, 24, 39, 0.1);
}

.state-map-node.is-selected {
    border-color: #ff4938;
}

.state-map-node.is-drop-target {
    outline: 3px solid rgba(255, 73, 56, 0.22);
}

.state-map-node-type_estado {
    border-left-color: #2563eb;
}

.state-map-node-grupo_estado {
    border-left-color: #7c3aed;
}

.state-map-node-agrupador {
    border-left-color: #f59e0b;
}

.state-map-node-status {
    border-left-color: #16a34a;
}

.state-map-node-title {
    display: block;
    font-weight: 700;
    color: #111827;
    line-height: 1.2;
}

.state-map-node-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.45rem;
    color: #6b7280;
    font-size: 0.69rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.state-map-node-meta span {
    border-radius: 999px;
    background: #f3f4f6;
    padding: 0.12rem 0.45rem;
}

.state-map-children {
    position: relative;
    padding-left: 1.15rem;
}

.state-map-children::before {
    content: "";
    position: absolute;
    left: 0;
    top: 24px;
    bottom: 24px;
    border-left: 1px solid #cbd5e1;
}

.state-map-legend {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.82rem;
    color: #4b5563;
}

.state-map-legend-inline {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    min-width: 320px;
}

.state-map-dot {
    width: 0.65rem;
    height: 0.65rem;
    display: inline-block;
    border-radius: 999px;
    margin-right: 0.45rem;
}

.state-map-dot-type {
    background: #2563eb;
}

.state-map-dot-group {
    background: #7c3aed;
}

.state-map-dot-folder {
    background: #f59e0b;
}

.state-map-dot-status {
    background: #16a34a;
}

.state-status-flags {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4rem 0.8rem;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background: #f9fafb;
}

.state-status-flags .form-check {
    margin-bottom: 0;
}

@media (max-width: 1199px) {
    .state-map-shell {
        grid-template-columns: 1fr;
    }

    .state-map-canvas,
    .state-map-panel {
        position: static;
        height: auto;
        max-height: none;
    }

    .state-map-board {
        min-height: 640px;
        height: auto;
    }

    .state-map-help-grid {
        grid-template-columns: 1fr;
    }

    .state-map-legend-inline {
        justify-content: flex-start;
        min-width: 0;
    }

    .state-map-panel {
        order: -1;
    }
}

@media (max-width: 767px) {
    .state-status-flags {
        grid-template-columns: 1fr;
    }
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #ecece7;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #bcc3cc;
}

.home-view::before,
.layout-view::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.home-view::before {
    background: transparent;
}

.layout-view::before {
    background-image:
        linear-gradient(to right, var(--grid) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
    background-size: 46px 46px;
    opacity: 0.44;
}

.noise-layer {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.62' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.top-shell {
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid var(--line);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 14px 38px rgba(17, 24, 39, 0.06);
}

.logo-badge {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.7rem;
    background: linear-gradient(145deg, #fff8f7, #ffffff);
    border: 1px solid #ffd9d4;
    color: var(--accent);
    font-size: 1.05rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 2rem;
    padding: 0 0.8rem;
    border-radius: 999px;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.67rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #374151;
    border: 1px solid var(--line);
    background: linear-gradient(145deg, #ffffff, #f8fafc);
}

.section-dot {
    width: 0.46rem;
    height: 0.46rem;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(255, 73, 56, 0.12);
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 0.85rem;
}

@media (min-width: 640px) {
    .module-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .module-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 1rem;
    }
}

.module-card,
.flashlight-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

.flashlight-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
    background: radial-gradient(320px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255, 255, 255, 0.84), transparent 42%);
}

.flashlight-card::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    z-index: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 240ms ease;
    background: radial-gradient(220px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), var(--flash), transparent 60%);
}

.flashlight-card:hover::before,
.flashlight-card:hover::after,
.flashlight-card:focus-visible::before,
.flashlight-card:focus-visible::after {
    opacity: 1;
}

.module-card {
    min-height: 96px;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.05rem;
    border-radius: 1.2rem;
    border: 1px solid var(--line);
    background: linear-gradient(158deg, var(--surface), var(--surface-strong));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.045);
    cursor: pointer;
    transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1), border-color 220ms ease, box-shadow 220ms ease;
}

.module-card:hover,
.module-card:focus-visible {
    transform: translateY(-4px);
    border-color: #fec2bb;
    box-shadow: 0 18px 45px rgba(17, 24, 39, 0.08);
    outline: none;
}

.module-icon,
.module-title {
    position: relative;
    z-index: 2;
}

.module-icon {
    width: 2.4rem;
    height: 2.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.88rem;
    border: 1px solid #ffd8d3;
    color: var(--accent);
    background: linear-gradient(155deg, #fff9f8, #ffffff);
    font-size: 1.25rem;
    flex-shrink: 0;
}

.module-title {
    font-size: 0.96rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.app-sidebar {
    transform: translateX(-102%);
    transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.layout-view .app-sidebar,
.layout-view .lg\:pl-72 {
    transition: width 220ms ease, padding-left 220ms ease, transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
}

.app-sidebar.is-open {
    transform: translateX(0%);
}

.sidebar-shell {
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-right: 1px solid rgba(229, 231, 235, 0.9);
    box-shadow: 12px 0 34px rgba(17, 24, 39, 0.05);
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
}

.sidebar-footer {
    flex-shrink: 0;
    border-top: 1px solid rgba(229, 231, 235, 0.8);
    padding-top: 0.85rem;
}

.sidebar-collapse-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.62rem;
    min-height: 2.8rem;
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 0.82rem;
    background: rgba(255, 255, 255, 0.92);
    color: #475569;
    transition: all 180ms ease;
}

.sidebar-collapse-btn iconify-icon {
    font-size: 1rem;
}

.sidebar-collapse-btn:hover {
    border-color: rgba(255, 73, 56, 0.28);
    color: var(--accent);
    background: rgba(255, 249, 248, 0.98);
}

.sidebar-collapse-text {
    transition: opacity 160ms ease;
}

.sidebar-group {
    border: 1px solid transparent;
    border-radius: 0.86rem;
    background: rgba(255, 255, 255, 0.42);
    transition: border-color 180ms ease, background-color 180ms ease;
}

.sidebar-group.has-active {
    border-color: transparent;
    background: rgba(255, 255, 255, 0.42);
}

.sidebar-group-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border: 0;
    background: transparent;
    padding: 0.66rem 0.68rem;
    border-radius: 0.74rem;
    color: #374151;
    transition: background-color 180ms ease;
}

.sidebar-group-trigger:hover {
    background: rgba(255, 255, 255, 0.8);
}

.sidebar-group-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.sidebar-group-title-wrap iconify-icon {
    font-size: 1.05rem;
    color: #9ca3af;
}

.sidebar-group-title {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.67rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
}

.sidebar-group-chevron {
    font-size: 1rem;
    color: #9ca3af;
    transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-group.is-open .sidebar-group-chevron {
    transform: rotate(180deg);
}

.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 260ms cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-submenu-inner {
    padding: 0 0.35rem 0.42rem;
}

.sidebar-group.is-open .sidebar-submenu {
    max-height: 520px;
}

.sidebar-brand-text,
.sidebar-item-text {
    transition: opacity 160ms ease;
}

.menu-item,
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.62rem;
    width: 100%;
    padding: 0.58rem 0.65rem;
    border-radius: 0.72rem;
    border: 1px solid transparent;
    color: #374151;
    font-size: 0.88rem;
    transition: all 180ms ease;
}

.menu-item iconify-icon,
.sidebar-item iconify-icon {
    font-size: 1.04rem;
    color: #9ca3af;
    transition: color 180ms ease;
}

.menu-item:hover,
.sidebar-item:hover {
    background: rgba(255, 255, 255, 0.82);
    border-color: #f3f4f6;
    color: var(--ink);
}

.menu-item:hover iconify-icon,
.menu-item.is-active iconify-icon,
.sidebar-item:hover iconify-icon,
.sidebar-item.is-active iconify-icon {
    color: var(--accent);
}

.menu-item.is-active,
.sidebar-item.is-active,
.sidebar-item-active {
    background: rgba(17, 24, 39, 0.05);
    border-color: rgba(17, 24, 39, 0.08);
    color: var(--accent);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(17, 24, 39, 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
}

.sidebar-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.app-topbar {
    background: rgba(255, 255, 255, 0.78);
    border-bottom: 1px solid rgba(229, 231, 235, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.04);
}

.nav-icon-btn {
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.7rem;
    border: 1px solid var(--line);
    background: #ffffff;
    color: #374151;
    font-size: 1.2rem;
}

.search-shell {
    height: 2.45rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid var(--line);
    background: #ffffff;
    border-radius: 0.76rem;
    padding: 0 0.7rem;
    color: #9ca3af;
}

.search-shell input {
    width: 100%;
    border: 0;
    background: transparent;
    color: #4b5563;
    font-size: 0.87rem;
    outline: none;
    cursor: default;
}

.badge-mvp {
    height: 1.8rem;
    align-items: center;
    padding: 0 0.66rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: #ffffff;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.63rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #4b5563;
}

.btn-premium {
    height: 2.2rem;
    border-radius: 0.72rem;
    border: 1px solid rgba(255, 73, 56, 0.32);
    background: linear-gradient(150deg, #ff5d4c, #ff4938);
    color: #ffffff;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.015em;
    padding: 0 0.84rem;
    box-shadow: 0 8px 20px rgba(255, 73, 56, 0.22);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

.btn-premium:hover {
    transform: translateY(-1px);
    box-shadow: 0 11px 24px rgba(255, 73, 56, 0.28);
}

.user-avatar {
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.72rem;
    color: #ffffff;
    background: #111827;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 0.86rem;
}

.status-card {
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: rgba(255, 255, 255, 0.82);
    padding: 1rem 1rem 0.9rem;
    box-shadow: 0 10px 28px rgba(17, 24, 39, 0.04);
    transition: transform 190ms ease, box-shadow 190ms ease;
}

.status-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 32px rgba(17, 24, 39, 0.08);
}

.status-card.is-critical {
    border-color: rgba(255, 73, 56, 0.28);
}

.status-label {
    font-family: "JetBrains Mono", monospace;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.64rem;
    color: #6b7280;
}

.status-value {
    margin-top: 0.45rem;
    font-size: 1.62rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #111827;
}

.status-sub {
    margin-top: 0.16rem;
    font-size: 0.78rem;
    color: #6b7280;
}

.content-placeholder {
    min-height: 300px;
    border-radius: 1.1rem;
    border: 1px dashed #d4d8df;
    background: rgba(255, 255, 255, 0.74);
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-inner {
    text-align: center;
    padding: 1.2rem;
}

.placeholder-icon {
    width: 2.7rem;
    height: 2.7rem;
    border-radius: 0.9rem;
    margin: 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent);
    border: 1px solid #ffd9d4;
    background: #fff8f7;
}

.placeholder-title {
    margin-top: 0.72rem;
    font-size: 1rem;
    font-weight: 600;
}

.placeholder-sub {
    margin-top: 0.34rem;
    font-size: 0.84rem;
    color: #6b7280;
}

.tabs-container {
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.2rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.tabs-list {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: max-content;
}

.tab-item {
    height: 2rem;
    border: 0;
    background: transparent;
    border-bottom: 2px solid transparent;
    color: #6b7280;
    font-size: 0.79rem;
    font-weight: 500;
    padding: 0 0.6rem;
    transition: color 180ms ease, border-color 180ms ease;
    white-space: nowrap;
}

.tab-item:hover {
    color: #374151;
}

.tab-item-active {
    color: var(--accent);
    border-color: var(--accent);
}

.tab-panels .content-placeholder {
    min-height: 220px;
}

/*
 * Padrao global para conteudo em abas:
 * evita cards estreitos com vazio lateral em telas largas.
 */
.layout-view .tab-panels .container-xl {
    max-width: none;
    width: 100%;
    padding-left: 0;
    padding-right: 0;
}

.layout-view .tab-panels .container-xl > .card,
.layout-view .tab-panels .card {
    width: 100%;
}

.mapa-tempo-real-card {
    overflow: hidden;
}

.mapa-tempo-real-hint {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border: 1px solid #dbeafe;
    border-radius: 0.9rem;
    background: #f8fbff;
    color: #4b5563;
    font-size: 0.86rem;
}

.mapa-tempo-real-shell {
    display: grid;
    gap: 1rem;
}

.mapa-tempo-real-bounds textarea {
    min-height: 148px;
    resize: vertical;
}

.mapa-tempo-real-canvas {
    width: 100%;
    min-height: 420px;
    height: clamp(420px, 62vh, 720px);
    overflow: hidden;
    background: #dbeafe;
}

.mapa-tempo-real-page {
    width: 100%;
}

body[data-active-page="mapa_tempo_real"] .app-topbar {
    display: none;
}

body[data-active-page="mapa_tempo_real"] main {
    padding: 0.75rem;
}

.mapa-tempo-real-canvas-standalone {
    min-height: calc(100vh - 1.5rem);
    height: calc(100vh - 1.5rem);
}

.mapa-tempo-real-empty-state {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem 0.75rem;
    color: #6b7280;
    font-size: 0.84rem;
}

.mapa-tempo-real-empty-state iconify-icon {
    font-size: 1.1rem;
    color: #9ca3af;
}

@media (max-width: 640px) {
    .mapa-tempo-real-canvas {
        min-height: 360px;
        height: 52vh;
    }

    .mapa-tempo-real-canvas-standalone {
        min-height: calc(100vh - 1rem);
        height: calc(100vh - 1rem);
    }
}

.mapa-tempo-real-canvas .leaflet-control-attribution {
    font-size: 0.68rem;
}

.mapa-tempo-real-canvas .leaflet-tile {
    filter: brightness(0.84) contrast(1.04);
}

.mapa-equipamento-marker-wrap {
    background: transparent;
    border: 0;
}

.mapa-dispatch-marker-wrap {
    background: transparent;
    border: 0;
}

.mapa-dispatch-marker-item {
    width: 106px;
    pointer-events: none;
    gap: 0.22rem;
    filter: drop-shadow(0 8px 18px rgba(15, 23, 42, 0.22));
}

.mapa-dispatch-machine-icon {
    width: 82px;
    height: 48px;
}

.mapa-dispatch-equip-alert {
    top: -0.2rem;
    right: 0.7rem;
    width: 1rem;
    height: 1rem;
}

.mapa-dispatch-marker-item .dispatch-equip-code,
.mapa-dispatch-marker-item .dispatch-equip-code.code-ok,
.mapa-dispatch-marker-item .dispatch-equip-code.code-warn,
.mapa-dispatch-marker-item .dispatch-equip-code.code-danger {
    color: #ffffff;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.95),
        0 0 6px rgba(0, 0, 0, 0.75);
}

.mapa-equipamento-marker {
    width: 18px;
    height: 18px;
    display: block;
    border-radius: 999px;
    border: 3px solid #ffffff;
    background: #ff4938;
    box-shadow: 0 4px 14px rgba(17, 24, 39, 0.35);
}

.mapa-equipamento-marker-simulado {
    background: #2563eb;
}

.mapa-popup {
    min-width: 180px;
    font-size: 0.82rem;
    color: #374151;
}

.mapa-popup strong {
    display: block;
    margin-bottom: 0.3rem;
    color: #111827;
}

.mapa-map-control {
    display: flex;
    flex-direction: column;
}

.mapa-map-control-button {
    min-width: 92px;
    padding: 0.5rem 0.7rem;
    border: 0;
    background: #ffffff;
    color: #374151;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.mapa-map-control-button + .mapa-map-control-button {
    border-top: 1px solid #e5e7eb;
}

.mapa-map-control-button.is-active {
    background: #ff4938;
    color: #ffffff;
}

.mapa-tempo-real-canvas .leaflet-popup-content-wrapper,
.mapa-tempo-real-canvas .leaflet-popup-tip {
    box-shadow: 0 10px 30px rgba(17, 24, 39, 0.14);
}

.component-card {
    border: 1px solid var(--line);
    border-radius: 0.95rem;
    background: #ffffff;
    padding: 0.85rem;
}

.component-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.65rem;
}

.component-title {
    font-size: 0.84rem;
    font-weight: 600;
}

.component-badge,
.badge-status {
    height: 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.62rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #4b5563;
    background: #f9fafb;
}

.badge-status.is-warning {
    border-color: #fcd9a9;
    background: #fff7ed;
    color: #b45309;
}

.badge-status.is-critical {
    border-color: #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-chip {
    height: 1.9rem;
    border-radius: 0.6rem;
    border: 1px solid var(--line);
    background: #ffffff;
    color: #6b7280;
    font-size: 0.76rem;
    padding: 0 0.7rem;
}

.filter-chip.is-active {
    color: var(--ink);
    border-color: rgba(255, 73, 56, 0.34);
    background: rgba(255, 73, 56, 0.1);
}

.table-shell {
    border: 1px solid var(--line);
    border-radius: 0.7rem;
    overflow: hidden;
}

.table-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0.6rem 0.7rem;
    font-size: 0.77rem;
    color: #4b5563;
    border-top: 1px solid #f3f4f6;
}

.table-row-head {
    border-top: 0;
    background: #f9fafb;
    font-weight: 600;
    color: #111827;
}

.table.card-table > :not(caption) > * > * {
    padding: 0.52rem 0.68rem;
    font-size: 0.88rem;
    vertical-align: middle;
}

.table.card-table tbody tr {
    height: 44px;
}

.table.card-table .btn.btn-icon {
    width: 1.95rem;
    height: 1.95rem;
}

.modal-shell {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: none;
    overflow-y: auto;
}

.modal {
    z-index: 2000;
}

.modal-backdrop {
    z-index: 1990;
}

.modal-shell.is-open {
    display: block;
}

.modal-shell-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(3px);
}

.btn iconify-icon {
    font-size: 1rem;
    line-height: 1;
    vertical-align: -0.12em;
}

.btn-icon iconify-icon {
    font-size: 1.12rem;
}

.modal-panel {
    position: relative;
    margin: 10vh auto 4vh;
    width: min(720px, calc(100vw - 2rem));
    max-width: 720px;
    border-radius: 0.8rem;
    border: 1px solid var(--line);
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.modal-panel-wide {
    width: min(980px, calc(100vw - 2rem));
    max-width: 980px;
}

.modal-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.125rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-panel-title {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
}

.modal-panel-helper {
    margin: 0.3rem 0 0;
    color: #64748b;
    font-size: 0.84rem;
}

.modal-panel-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    color: #94a3b8;
    text-decoration: none;
    transition: background-color 160ms ease, color 160ms ease;
}

.modal-panel-close:hover {
    background: #f8fafc;
    color: #475569;
}

.modal-panel-close iconify-icon {
    font-size: 1.15rem;
}

.cadastro-form-modal {
    display: flex;
    flex-direction: column;
}

.cadastro-form-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 0.95rem 0.8rem;
    padding: 1rem 1.125rem 1.125rem;
}

.cadastro-form-grid.is-modal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cadastro-field {
    min-width: 0;
}

.cadastro-field-full {
    grid-column: 1 / -1;
}

.cadastro-field-label {
    display: inline-block;
    margin-bottom: 0.42rem;
    color: #0f172a;
    font-size: 0.84rem;
    font-weight: 500;
}

.cadastro-field-control {
    min-height: 2.5rem;
    border-radius: 0.4rem;
    border-color: #d7dee7;
    box-shadow: none;
    font-size: 0.88rem;
}

.cadastro-field-control:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.cadastro-field-textarea {
    min-height: 5.5rem;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    resize: vertical;
}

.cadastro-form-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 0.95rem 1.125rem 1rem;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.cadastro-permissions-head {
    padding: 1rem 1.125rem 0;
}

.cadastro-permissions-profile {
    color: #0f172a;
    font-size: 0.98rem;
    font-weight: 600;
}

.cadastro-permissions-code {
    margin-top: 0.2rem;
    color: #64748b;
    font-size: 0.8rem;
}

.cadastro-permissions-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding: 1rem 1.125rem 1.125rem;
    max-height: min(62vh, 720px);
    overflow: auto;
}

.cadastro-permissions-module {
    border: 1px solid #e7edf5;
    border-radius: 0.7rem;
    overflow: hidden;
    background: #ffffff;
}

.cadastro-permissions-module-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid #eef2f7;
    background: #f8fafc;
}

.cadastro-permissions-module-head h3 {
    margin: 0;
    color: #0f172a;
    font-size: 0.88rem;
    font-weight: 600;
}

.cadastro-permissions-module-head span {
    color: #64748b;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.cadastro-permissions-list {
    display: flex;
    flex-direction: column;
}

.cadastro-permission-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.8rem 0.85rem;
    border-top: 1px solid #f8fafc;
    cursor: pointer;
}

.cadastro-permission-item:first-child {
    border-top: 0;
}

.cadastro-permission-item input {
    margin-top: 0.15rem;
}

.cadastro-permission-copy {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
}

.cadastro-permission-copy strong {
    color: #0f172a;
    font-size: 0.84rem;
    font-weight: 600;
    text-transform: capitalize;
}

.cadastro-permission-copy small {
    color: #64748b;
    font-size: 0.76rem;
    line-height: 1.4;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
}

.modal-sub {
    margin-top: 0.55rem;
    color: #6b7280;
    font-size: 0.86rem;
}

.document-filters-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 0.72rem;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.34rem;
}

.filter-label {
    font-family: "JetBrains Mono", monospace;
    font-size: 0.63rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6b7280;
}

.filter-field input,
.filter-field select {
    height: 2.35rem;
    border: 1px solid var(--line);
    border-radius: 0.72rem;
    background: #ffffff;
    color: #111827;
    font-size: 0.84rem;
    padding: 0 0.7rem;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.filter-field input:focus,
.filter-field select:focus {
    border-color: #f9a59c;
    box-shadow: 0 0 0 3px rgba(255, 73, 56, 0.12);
}

.filter-actions-row {
    display: flex;
    gap: 0.5rem;
    align-items: end;
    flex-wrap: wrap;
}

.btn-secondary {
    height: 2.2rem;
    border-radius: 0.72rem;
    border: 1px solid var(--line);
    background: #ffffff;
    color: #374151;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0 0.84rem;
}

.table-responsive-shell {
    width: 100%;
    overflow-x: auto;
    border-top: 1px solid #eef2f7;
}

.doc-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    background: #ffffff;
}

.doc-table thead th {
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    color: #374151;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-align: left;
    padding: 0.72rem 0.75rem;
    white-space: nowrap;
}

.doc-table tbody td {
    border-bottom: 1px solid #f1f5f9;
    color: #111827;
    font-size: 0.82rem;
    padding: 0.72rem 0.75rem;
    vertical-align: middle;
}

.cadastro-panel {
    border: 1px solid #e7edf5;
    border-radius: 0.85rem;
    background: #ffffff;
    overflow: hidden;
}

.cadastro-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1rem 0.95rem;
}

.cadastro-panel-title {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
    font-weight: 500;
}

.cadastro-panel-filters {
    border-top: 1px solid #eef2f7;
    border-bottom: 1px solid #eef2f7;
    padding: 0.9rem 1rem;
}

.cadastro-filter-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px 160px;
    gap: 0.75rem;
    align-items: center;
}

.cadastro-filter-control {
    min-height: 2.45rem;
    border-radius: 0.35rem;
    border-color: #d9e2ec;
    box-shadow: none;
    font-size: 0.85rem;
}

.cadastro-filter-control:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.cadastro-filter-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.cadastro-action-btn,
.cadastro-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.45rem;
    padding: 0 0.95rem;
    border: 1px solid #165eb8;
    border-radius: 0.35rem;
    background: #165eb8;
    color: #ffffff;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: none;
}

.cadastro-action-btn:hover,
.cadastro-filter-btn:hover {
    background: #124f9b;
    border-color: #124f9b;
    color: #ffffff;
}

.cadastro-clear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.45rem;
    padding: 0 0.95rem;
    border: 1px solid #d9e2ec;
    border-radius: 0.35rem;
    background: #ffffff;
    color: #475569;
    font-size: 0.84rem;
    font-weight: 500;
    text-decoration: none;
}

.cadastro-clear-btn:hover {
    color: #0f172a;
    background: #f8fafc;
}

.cadastro-panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1rem;
    color: #64748b;
    font-size: 0.84rem;
    border-top: 1px solid #eef2f7;
    background: #ffffff;
}

@media (max-width: 767.98px) {
    .modal-panel {
        width: calc(100vw - 1rem);
        margin-top: 4vh;
    }

    .cadastro-form-grid.is-modal {
        grid-template-columns: minmax(0, 1fr);
    }

    .cadastro-form-footer {
        flex-wrap: wrap;
    }

    .cadastro-form-footer .btn,
    .cadastro-form-footer .cadastro-action-btn,
    .cadastro-form-footer .cadastro-clear-btn {
        width: 100%;
        justify-content: center;
    }

    .cadastro-panel-header {
        flex-direction: column;
        align-items: stretch;
    }

    .cadastro-filter-form {
        grid-template-columns: minmax(0, 1fr);
    }

    .cadastro-filter-actions {
        justify-content: stretch;
    }

    .cadastro-permissions-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .cadastro-action-btn,
    .cadastro-filter-btn,
    .cadastro-clear-btn {
        width: 100%;
    }
}

.doc-table tbody tr:hover {
    background: #fcfcfd;
}

.table-empty {
    text-align: center;
    color: #6b7280;
    padding: 1.4rem 0.8rem;
}

.table-feedback {
    margin-top: 0.65rem;
    min-height: 1rem;
    font-size: 0.76rem;
    color: #6b7280;
}

.table-pagination {
    margin-top: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.36rem;
}

.page-btn {
    min-width: 2rem;
    height: 2rem;
    border-radius: 0.62rem;
    border: 1px solid var(--line);
    background: #ffffff;
    color: #4b5563;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 0 0.55rem;
}

.page-btn:hover {
    border-color: #fbc7c1;
    color: #ff4938;
}

.page-btn.is-active {
    background: rgba(255, 73, 56, 0.1);
    border-color: rgba(255, 73, 56, 0.35);
    color: #ff4938;
}

.page-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.status-badge,
.block-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1.46rem;
    padding: 0 0.52rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    font-family: "JetBrains Mono", monospace;
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-badge.is-success {
    background: #ecfdf3;
    border-color: #bbf7d0;
    color: #15803d;
}

.status-badge.is-info {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.status-badge.is-warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #b45309;
}

.status-badge.is-danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.status-badge.is-accent {
    background: #fff7ed;
    border-color: #fdba74;
    color: #c2410c;
}

.status-badge.is-neutral {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #4b5563;
}

.block-badge.is-block {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.block-badge.is-clear {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #4b5563;
}

.table-actions {
    display: inline-flex;
    gap: 0.3rem;
}

.table-action-btn {
    height: 1.8rem;
    border: 1px solid var(--line);
    background: #ffffff;
    color: #4b5563;
    border-radius: 0.55rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0 0.55rem;
    white-space: nowrap;
}

.table-action-btn:hover {
    border-color: #fbc7c1;
    color: #ff4938;
}

.table-contract {
    color: #6b7280;
    font-size: 0.74rem;
    margin-top: 0.1rem;
}

.dispatch-board {
    border: 1px solid #d7dde4;
    border-radius: 0.95rem;
    background: #f8fafc;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 92px);
    min-height: 680px;
    position: relative;
}

.dispatch-toolbar {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0;
    color: #f8fafc;
}

.dispatch-header-board {
    height: auto;
    min-height: 56px;
    padding: 0;
    border-bottom: 1px solid #dd3f2f;
}

.dispatch-toolbar-main {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    min-width: 0;
}

.dispatch-toolbar-title-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
    flex-wrap: wrap;
}

.dispatch-toolbar-title-wrap h1 {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.1;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dispatch-toolbar-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.92);
}

.dispatch-toolbar-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.6rem;
    padding: 0 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
    font-size: 0.72rem;
    font-weight: 600;
}

.dispatch-toolbar-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(92px, 1fr));
    min-width: min(100%, 420px);
    margin-left: auto;
}

.dispatch-toolbar-stats article {
    padding: 0.55rem 0.8rem;
    border-left: 1px solid rgba(255, 255, 255, 0.16);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.dispatch-toolbar-stats span {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.88);
}

.dispatch-toolbar-stats strong {
    margin-top: 0.2rem;
    font-size: 1.3rem;
    line-height: 1;
    font-weight: 800;
    color: #ffffff;
}

.dispatch-grid {
    display: grid;
    grid-template-columns: 430px minmax(0, 1fr);
    gap: 0;
    min-height: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    align-items: start;
}

.dispatch-col {
    border-right: 1px solid #d7dde4;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.dispatch-col:last-child {
    border-right: 0;
}

.dispatch-sidepanel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.24);
    opacity: 0;
    transition: opacity 180ms ease;
    z-index: 18;
}

.dispatch-sidepanel-backdrop.is-visible {
    opacity: 1;
}

.dispatch-sidepanel {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(620px, calc(100% - 1rem));
    border-left: 1px solid #d7dde4;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    min-height: 0;
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 180ms ease, opacity 180ms ease;
    z-index: 19;
    box-shadow: -24px 0 48px rgba(15, 23, 42, 0.18);
}

.dispatch-sidepanel.is-open {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
}

.dispatch-sidepanel-head {
    min-height: 44px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.8rem 0.9rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.dispatch-sidepanel-head h3 {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    color: #0f172a;
}

.dispatch-sidepanel-head p {
    margin: 0.2rem 0 0;
    font-size: 0.71rem;
    color: #64748b;
    line-height: 1.35;
}

.dispatch-sidepanel-close {
    color: #475569;
    border-color: #dbe2ea;
    background: #f8fafc;
    flex-shrink: 0;
}

.dispatch-sidepanel-body {
    padding: 1rem;
    overflow-y: auto;
    min-height: 0;
}

.dispatch-sidepanel-empty {
    min-height: 220px;
    border: 1px dashed #cbd5e1;
    border-radius: 0.9rem;
    background: #f8fafc;
    color: #64748b;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.45rem;
    padding: 1rem;
}

.dispatch-sidepanel-empty iconify-icon {
    font-size: 1.4rem;
}

.dispatch-sidepanel-section + .dispatch-sidepanel-section {
    margin-top: 0.9rem;
}

.dispatch-sidepanel-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.55rem;
}

.dispatch-sidepanel-kpis-wide {
    gap: 0.75rem;
}

.dispatch-sidepanel-kpis article,
.dispatch-sidepanel-facts div,
.dispatch-history-item {
    border: 1px solid #e2e8f0;
    border-radius: 0.8rem;
    background: #f8fafc;
}

.dispatch-sidepanel-kpis article {
    padding: 0.7rem;
}

.dispatch-sidepanel-kpis span,
.dispatch-sidepanel-section-head span,
.dispatch-sidepanel-facts dt,
.dispatch-history-meta {
    font-size: 0.68rem;
    color: #64748b;
}

.dispatch-sidepanel-kpis strong {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.82rem;
    color: #0f172a;
}

.dispatch-sidepanel-section h4 {
    margin: 0 0 0.45rem;
    font-size: 0.76rem;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dispatch-sidepanel-facts {
    margin: 0;
    display: grid;
    gap: 0.45rem;
}

.dispatch-sidepanel-facts-inline {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dispatch-sidepanel-facts div {
    padding: 0.65rem 0.75rem;
}

.dispatch-sidepanel-facts dt {
    margin: 0 0 0.18rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dispatch-sidepanel-facts dd {
    margin: 0;
    font-size: 0.76rem;
    color: #0f172a;
    font-weight: 600;
}

.dispatch-sidepanel-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.dispatch-sidepanel-section-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.dispatch-sidepanel-action-btn {
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: rgba(255, 73, 56, 0.08);
    color: var(--accent);
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.45rem 0.75rem;
}

.dispatch-sidepanel-action-btn:hover {
    background: rgba(255, 73, 56, 0.14);
}

.dispatch-sidepanel-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0.65rem;
}

.dispatch-sidepanel-tab {
    border: 1px solid #dbe2ea;
    border-radius: 999px;
    background: #ffffff;
    color: #475569;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.42rem 0.78rem;
}

.dispatch-sidepanel-tab.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.dispatch-sidepanel-operator-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.dispatch-sidepanel-operator-card > div {
    border: 1px solid #e2e8f0;
    border-radius: 0.9rem;
    background: #f8fafc;
    padding: 0.9rem;
}

.dispatch-sidepanel-operator-card span {
    display: block;
    font-size: 0.7rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dispatch-sidepanel-operator-card strong {
    display: block;
    margin-top: 0.24rem;
    font-size: 0.9rem;
    color: #0f172a;
}

.dispatch-sidepanel-history {
    display: grid;
    gap: 0.5rem;
}

.dispatch-history-item {
    padding: 0.72rem 0.78rem;
}

.dispatch-history-item-head,
.dispatch-history-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.dispatch-history-item-head strong {
    font-size: 0.76rem;
    color: #0f172a;
    text-transform: capitalize;
}

.dispatch-history-item-head span {
    font-size: 0.69rem;
    color: #64748b;
}

.dispatch-history-route {
    margin: 0.4rem 0;
    display: flex;
    align-items: center;
    gap: 0.34rem;
    font-size: 0.75rem;
    color: #334155;
    font-weight: 600;
    flex-wrap: wrap;
}

.dispatch-history-chip {
    display: inline-flex;
    align-items: center;
    min-height: 1.4rem;
    padding: 0 0.5rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 0.68rem;
    font-weight: 700;
}

.dispatch-history-item p {
    margin: 0.45rem 0 0;
    font-size: 0.71rem;
    color: #475569;
    line-height: 1.4;
}

.dispatch-sidepanel-loading,
.dispatch-sidepanel-empty-history {
    border: 1px dashed #cbd5e1;
    border-radius: 0.8rem;
    padding: 0.85rem;
    background: #f8fafc;
    font-size: 0.73rem;
    color: #64748b;
    text-align: center;
}

.dispatch-header {
    height: 44px;
    background: var(--accent);
    color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.75rem;
    border-bottom: 1px solid #dd3f2f;
    position: sticky;
    top: 0;
    z-index: 3;
}

.dispatch-header h2 {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.dispatch-head-actions {
    display: inline-flex;
    gap: 0.3rem;
}

.dispatch-icon-btn {
    width: 1.55rem;
    height: 1.55rem;
    border-radius: 0.42rem;
    border: 1px solid rgba(241, 245, 249, 0.22);
    background: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.86rem;
}

.dispatch-allocation-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.65rem;
}

.dispatch-allocation-card {
    background: #ffffff;
    border: 1px solid #dbe2ea;
    border-radius: 0.72rem;
    padding: 0.58rem;
    min-height: 150px;
}

.dispatch-card-top {
    display: flex;
    justify-content: space-between;
    gap: 0.4rem;
}

.dispatch-card-top h3 {
    margin: 0;
    font-size: 0.74rem;
    font-weight: 700;
    color: #27384a;
}

.dispatch-card-top p {
    margin: 0.16rem 0 0;
    font-size: 0.68rem;
    color: #6b7280;
}

.dispatch-mini-actions {
    position: relative;
}

.dispatch-mini-actions button {
    width: 1.28rem;
    height: 1.28rem;
    border: 1px solid #d7dee6;
    border-radius: 0.34rem;
    background: #f8fafc;
    color: #546376;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    cursor: pointer;
}

.dispatch-mini-actions-menu {
    position: absolute;
    top: calc(100% + 0.3rem);
    right: 0;
    min-width: 8.5rem;
    padding: 0.28rem;
    border: 1px solid #d7dee6;
    border-radius: 0.5rem;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    z-index: 20;
}

.dispatch-mini-actions-menu button {
    width: 100%;
    height: auto;
    min-height: 1.9rem;
    padding: 0.42rem 0.55rem;
    border-radius: 0.4rem;
    justify-content: flex-start;
    font-size: 0.72rem;
    background: transparent;
}

.dispatch-mini-actions-menu button:hover {
    background: #f1f5f9;
}

.dispatch-card-meta {
    margin: 0.45rem 0 0.4rem;
    font-size: 0.69rem;
    color: #5b6777;
}

.dispatch-progress {
    height: 0.42rem;
    border-radius: 999px;
    background: #ebeff4;
    overflow: hidden;
    display: flex;
}

.dispatch-progress-part {
    height: 100%;
}

.part-operando,
.dot-operando {
    background: #27ae60;
}

.part-manutencao,
.dot-manutencao {
    background: #e74c3c;
}

.part-inativo,
.dot-inativo {
    background: #6b7280;
}

.part-parada,
.dot-parada {
    background: #f59e0b;
}

.part-corretiva,
.dot-corretiva {
    background: #e74c3c;
}

.part-auxiliar,
.dot-auxiliar {
    background: #f59e0b;
}

.part-interna,
.dot-interna {
    background: #0ea5e9;
}

.part-externa,
.dot-externa {
    background: #7c3aed;
}

.part-atraso,
.dot-atraso {
    background: #f97316;
}

.part-fora,
.dot-fora {
    background: #6b7280;
}

.part-operacional,
.dot-operacional {
    background: #0f766e;
}

.part-preventiva,
.dot-preventiva {
    background: #2563eb;
}

.dispatch-card-summary {
    margin: 0.42rem 0 0;
    font-size: 0.67rem;
    color: #5f6b7a;
    font-family: "JetBrains Mono", monospace;
}

.dispatch-card-buttons {
    margin-top: 0.52rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
}

.dispatch-card-buttons button {
    height: 1.85rem;
    border-radius: 0.55rem;
    border: 1px solid #d7dee6;
    background: #f8fafc;
    color: #445266;
    font-size: 0.73rem;
    font-weight: 600;
}

.dispatch-equipment-rows {
    padding: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.62rem;
}

.dispatch-equipment-lane {
    border: 1px solid #dbe2ea;
    border-radius: 0.72rem;
    background: #ffffff;
    padding: 0.55rem 0.62rem 0.7rem;
    min-height: 150px;
}

.dispatch-equipment-lane h3 {
    margin: 0 0 0.45rem;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #4b5563;
}

.dispatch-equipment-wrap {
    display: grid;
    grid-template-columns: repeat(auto-fill, 104px);
    gap: 1.2rem 0.95rem;
    align-items: start;
    justify-content: start;
}

.dispatch-dropzone {
    border-radius: 0.64rem;
    min-height: 96px;
    transition: background-color 140ms ease, outline-color 140ms ease;
}

.dispatch-dropzone.is-dragover {
    background: #eef5ff;
    outline: 2px dashed #3b82f6;
    outline-offset: 0;
}

.dispatch-equipment-item {
    width: 100%;
    max-width: 104px;
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    justify-self: start;
}

.dispatch-equipment-item:hover {
    z-index: 12;
}

.dispatch-equipment-item[draggable="true"] {
    cursor: grab;
}

.dispatch-equipment-item.is-dragging {
    opacity: 0.45;
    cursor: grabbing;
}

.dispatch-equip-alert {
    position: absolute;
    top: -0.35rem;
    right: 0.15rem;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
}

.dispatch-machine-icon {
    width: 72px;
    height: 42px;
    object-fit: contain;
    display: block;
    color: #546476;
}

.dispatch-equip-code {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.dispatch-equip-code.code-ok {
    color: #15803d;
}

.dispatch-equip-code.code-warn {
    color: #c2410c;
}

.dispatch-equip-code.code-danger {
    color: #b91c1c;
}

.dispatch-equip-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    color: #64748b;
    font-size: 0.74rem;
}

.dispatch-equip-meta-btn {
    border: 0;
    background: transparent;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.dispatch-equip-meta-btn:hover {
    color: #334155;
}

.dispatch-equip-tooltip {
    position: fixed;
    left: var(--tooltip-left, 0px);
    top: var(--tooltip-top, 0px);
    transform: translateY(6px);
    width: 260px;
    max-width: min(260px, calc(100vw - 24px));
    padding: 0.72rem 0.8rem;
    border-radius: 0.9rem;
    border: 1px solid #dbe2ea;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-align: left;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
    z-index: 120;
}

.dispatch-equipment-item:hover .dispatch-equip-tooltip,
.dispatch-equipment-item.is-tooltip-open .dispatch-equip-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(0) translateY(0);
}

.dispatch-equipment-item[data-tooltip-vertical="top"] .dispatch-equip-tooltip {
}

.dispatch-equipment-item[data-tooltip-vertical="top"] .dispatch-equip-tooltip::before {
    top: auto;
    bottom: -7px;
    border-left: 0;
    border-top: 0;
    border-right: 1px solid #dbe2ea;
    border-bottom: 1px solid #dbe2ea;
}

.dispatch-equip-tooltip::before {
    content: "";
    position: absolute;
    left: var(--tooltip-arrow-left, 50%);
    top: -7px;
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.98);
    border-left: 1px solid #dbe2ea;
    border-top: 1px solid #dbe2ea;
    transform: translateX(-50%) rotate(45deg);
}

.dispatch-equip-tooltip-head {
    display: flex;
    flex-direction: column;
    gap: 0.24rem;
    margin-bottom: 0.55rem;
}

.dispatch-equip-tooltip-head strong {
    font-size: 0.86rem;
    color: #0f172a;
}

.dispatch-equip-tooltip-tone {
    font-size: 0.72rem;
    font-weight: 600;
}

.dispatch-equip-tooltip-tone.tone-ok {
    color: #15803d;
}

.dispatch-equip-tooltip-tone.tone-warn {
    color: #c2410c;
}

.dispatch-equip-tooltip-tone.tone-danger {
    color: #b91c1c;
}

.dispatch-equip-tooltip-grid {
    display: grid;
    gap: 0.28rem;
    font-size: 0.72rem;
    color: #475569;
    line-height: 1.35;
}

.dispatch-equip-tooltip-grid b {
    color: #0f172a;
    font-weight: 600;
}

@media (hover: none) {
    .dispatch-equipment-item:hover .dispatch-equip-tooltip {
        opacity: 0;
        visibility: hidden;
        transform: translateY(6px);
    }

    .dispatch-equipment-item.is-tooltip-open .dispatch-equip-tooltip {
        opacity: 1;
        visibility: visible;
        transform: translateX(0) translateY(0);
    }
}

.dispatch-legend {
    border-top: 1px solid #d7dde4;
    background: #f6f8fb;
    padding: 0.52rem 0.7rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.95rem;
    flex-shrink: 0;
}

.dispatch-pool {
    border-top: 1px solid #d7dde4;
    background: #ffffff;
    padding: 0.62rem 0.7rem;
    flex-shrink: 0;
}

.dispatch-pool-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.dispatch-pool-head h3 {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.dispatch-pool-head span {
    font-size: 0.69rem;
    color: #64748b;
}

.dispatch-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.34rem;
    font-size: 0.67rem;
    color: #4b5563;
}

.dispatch-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 0.16rem;
}

.dispatch-groups {
    border-top: 1px solid #d7dde4;
    background: #f0f4f8;
    padding: 0.62rem 0.7rem;
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    flex-shrink: 0;
}

.dispatch-group-btn {
    border: 1px solid #cfd7e0;
    border-radius: 999px;
    background: #ffffff;
    color: #445265;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    padding: 0.34rem 0.7rem;
    white-space: nowrap;
}

.dispatch-group-btn.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: #f8fafc;
}

@media (max-width: 1260px) {
    .dispatch-toolbar {
        flex-direction: column;
    }

    .dispatch-toolbar-stats {
        width: 100%;
        min-width: 0;
    }

    .dispatch-grid {
        grid-template-columns: 1fr;
    }

    .dispatch-board {
        height: auto;
        min-height: 620px;
    }

    .dispatch-col {
        border-right: 0;
        border-bottom: 1px solid #d7dde4;
    }

    .dispatch-col:last-child {
        border-bottom: 0;
    }

    .dispatch-sidepanel {
        width: min(100%, 100%);
        border-left: 0;
    }

    .dispatch-sidepanel-body {
        max-height: 440px;
    }
}

@media (max-width: 720px) {
    .dispatch-equipment-wrap {
        grid-template-columns: repeat(auto-fill, 88px);
        gap: 1rem 0.75rem;
    }

    .dispatch-equipment-item {
        max-width: 88px;
    }

    .dispatch-toolbar-title-wrap {
        gap: 0.5rem;
    }

    .dispatch-toolbar-title-wrap h1 {
        font-size: 0.9rem;
    }

    .dispatch-toolbar-meta {
        width: 100%;
    }

    .dispatch-toolbar-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dispatch-sidepanel-kpis {
        grid-template-columns: 1fr;
    }

    .dispatch-sidepanel-facts-inline,
    .dispatch-sidepanel-operator-card {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 640px) {
    .stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .document-filters-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .app-sidebar {
        transform: translateX(0%);
    }

    .layout-view.sidebar-collapsed .app-sidebar {
        width: 5rem;
    }

    .layout-view.sidebar-collapsed .lg\:pl-72 {
        padding-left: 5rem;
    }

    .layout-view.sidebar-collapsed .sidebar-shell {
        overflow-x: hidden;
    }

    .layout-view.sidebar-collapsed .sidebar-brand-text {
        opacity: 0;
        width: 0;
        overflow: hidden;
    }

    .layout-view.sidebar-collapsed .sidebar-group {
        border-color: transparent;
        background: transparent;
    }

    .layout-view.sidebar-collapsed .sidebar-group-trigger {
        justify-content: center;
        padding: 0.52rem;
    }

    .layout-view.sidebar-collapsed .sidebar-group-title {
        display: none;
    }

    .layout-view.sidebar-collapsed .sidebar-group-chevron {
        display: none;
    }

    .layout-view.sidebar-collapsed .sidebar-group-title-wrap {
        width: 100%;
        justify-content: center;
    }

    .layout-view.sidebar-collapsed .sidebar-submenu {
        max-height: none;
        overflow: visible;
    }

    .layout-view.sidebar-collapsed .sidebar-submenu-inner {
        padding: 0.24rem 0 0.4rem;
    }

    .layout-view.sidebar-collapsed .sidebar-item {
        justify-content: center;
        gap: 0;
        padding: 0.56rem 0.5rem;
    }

    .layout-view.sidebar-collapsed .sidebar-item-text {
        display: none;
    }

    .layout-view.sidebar-collapsed .sidebar-item iconify-icon {
        font-size: 1.1rem;
    }

    .layout-view.sidebar-collapsed .sidebar-footer {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .layout-view.sidebar-collapsed .sidebar-collapse-btn {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .layout-view.sidebar-collapsed .sidebar-collapse-text {
        display: none;
    }

    .sidebar-backdrop {
        display: none;
    }

    .document-filters-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .filter-actions-row {
        grid-column: span 6 / span 6;
    }
}

@media (max-width: 420px) {
    .module-card {
        min-height: 88px;
        border-radius: 1rem;
    }

    .btn-premium {
        font-size: 0.72rem;
        padding: 0 0.64rem;
    }
}

/* ==========================================================================
   Estilos Adicionais do Modo Escuro (Premium Dark Theme Override)
   ========================================================================== */

html.dark ::-webkit-scrollbar-track {
    background: #0b0d0f;
}

html.dark ::-webkit-scrollbar-thumb {
    background: #21262d;
}

html.dark ::-webkit-scrollbar-thumb:hover {
    background: #30363d;
}

html.dark .state-map-palette-item {
    border-color: var(--line);
    background: var(--surface-strong);
    color: var(--ink);
}

html.dark .state-map-row::after {
    border-top: 1px solid var(--line);
}

html.dark .state-map-children::before {
    border-left: 1px solid var(--line);
}

html.dark .state-map-node {
    border-color: var(--line);
    background: rgba(21, 26, 34, 0.94);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
}

html.dark .state-map-node:hover,
html.dark .state-map-node.is-selected {
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.7);
}

html.dark .state-map-node.is-selected {
    border-color: var(--accent);
}

html.dark .state-status-flags {
    border-color: var(--line);
    background: #0b0d0f;
}

html.dark .logo-badge {
    background: linear-gradient(145deg, #2c1a18, #1c1413);
    border-color: #5c2722;
}

html.dark .tag-chip {
    background: linear-gradient(145deg, #151a22, #0b0d0f);
    color: var(--ink);
}

html.dark .sidebar-shell {
    background: rgba(21, 26, 34, 0.9);
    border-right-color: rgba(33, 38, 45, 0.9);
    box-shadow: 12px 0 34px rgba(0, 0, 0, 0.4);
}

html.dark .sidebar-collapse-btn {
    border-color: rgba(48, 54, 61, 0.9);
    background: rgba(21, 26, 34, 0.92);
    color: #8b949e;
}

html.dark .sidebar-collapse-btn:hover {
    border-color: rgba(255, 90, 74, 0.4);
    color: var(--accent);
    background: rgba(255, 90, 74, 0.05);
}

html.dark .sidebar-group {
    background: rgba(255, 255, 255, 0.02);
}

html.dark .sidebar-group-trigger:hover {
    background: rgba(255, 255, 255, 0.04);
}

html.dark .menu-item:hover,
html.dark .sidebar-item:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
}

html.dark .menu-item.is-active,
html.dark .sidebar-item.is-active,
html.dark .sidebar-item-active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
}

html.dark .nav-icon-btn,
html.dark .search-shell {
    background: var(--surface-strong);
}

html.dark .search-shell input {
    color: var(--ink);
}

html.dark .badge-mvp {
    background: var(--surface-strong);
    color: var(--muted);
}

html.dark .status-card {
    background: var(--surface);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

html.dark .status-value {
    color: var(--ink);
}

html.dark .content-placeholder {
    border-color: var(--line);
    background: var(--surface);
}

html.dark .placeholder-icon {
    background: rgba(255, 73, 56, 0.1);
    border-color: rgba(255, 73, 56, 0.3);
}

html.dark .placeholder-sub,
html.dark .status-label,
html.dark .status-sub {
    color: var(--muted);
}

html.dark .tab-item:hover {
    color: var(--ink);
}

html.dark .component-card {
    background: var(--surface-strong);
}

html.dark .component-badge,
html.dark .badge-status {
    background: var(--surface);
    color: var(--muted);
}

html.dark .badge-status.is-warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

html.dark .badge-status.is-critical {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

html.dark .filter-chip {
    background: var(--surface-strong);
    color: var(--muted);
}

html.dark .filter-chip.is-active {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(255, 73, 56, 0.15);
}

html.dark .table-row-head {
    background: var(--surface);
    color: var(--ink);
}

html.dark .table-row {
    color: var(--muted);
    border-top-color: var(--line);
}

html.dark .modal-panel {
    background: var(--surface-strong);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.5);
}

html.dark .modal-sub,
html.dark .filter-label {
    color: var(--muted);
}

html.dark .filter-field input,
html.dark .filter-field select {
    background: var(--surface-strong);
    color: var(--ink);
}

html.dark .btn-secondary {
    background: var(--surface-strong);
    color: var(--ink);
}

html.dark .doc-table {
    background: var(--surface-strong);
}

html.dark .doc-table thead th {
    background: var(--surface);
    color: var(--ink);
}

html.dark .doc-table tbody td {
    border-bottom-color: var(--line);
    color: var(--ink);
}

html.dark .doc-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

html.dark .page-btn,
html.dark .table-action-btn {
    background: var(--surface-strong);
    color: var(--muted);
}

html.dark .status-badge.is-success {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.3);
    color: #34d399;
}

html.dark .status-badge.is-info {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

html.dark .status-badge.is-warning {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

html.dark .status-badge.is-danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

html.dark .status-badge.is-neutral {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--muted);
}

html.dark .dispatch-board {
    border-color: var(--line);
    background: var(--surface-strong);
}

html.dark .top-shell,
html.dark .app-topbar {
    background: var(--surface);
    border-color: var(--line);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Overrides para Componentes do Tabler (Cards, Tabelas e Inputs)
   ========================================================================== */

html.dark .card {
    background-color: var(--surface-strong);
    border-color: var(--line);
    color: var(--ink);
}

html.dark .card-header {
    background-color: transparent;
    border-bottom-color: var(--line);
    color: var(--ink);
}

html.dark .card-title {
    color: var(--ink);
}

html.dark .card-footer {
    background-color: transparent;
    border-top-color: var(--line);
    color: var(--muted);
}

html.dark .form-control,
html.dark .form-select {
    background-color: var(--surface);
    border-color: var(--line);
    color: var(--ink);
}

html.dark .form-control:focus,
html.dark .form-select:focus {
    background-color: var(--surface-strong);
    border-color: var(--accent);
    color: var(--ink);
    box-shadow: 0 0 0 2px rgba(255, 90, 74, 0.18);
}

html.dark .table {
    color: var(--ink) !important;
    border-color: var(--line) !important;
}

html.dark .table > :not(caption) > * > * {
    background-color: transparent !important;
    color: var(--ink) !important;
    border-bottom-color: var(--line) !important;
    --tblr-table-bg-type: transparent !important;
    --tblr-table-bg-state: transparent !important;
    --tblr-table-accent-bg: transparent !important;
}

html.dark .table-striped tbody tr > *,
html.dark .table-striped>tbody>tr>* {
    background-color: transparent !important;
    --tblr-table-accent-bg: transparent !important;
    --tblr-table-striped-bg: transparent !important;
    --tblr-table-bg-type: transparent !important;
    --tblr-table-bg-state: transparent !important;
    color: var(--ink) !important;
}

html.dark .table-hover tbody tr:hover > * {
    background-color: rgba(255, 255, 255, 0.04) !important;
}

html.dark .pagination .page-link {
    background-color: var(--surface);
    border-color: var(--line);
    color: var(--muted);
}

html.dark .pagination .page-item.active .page-link {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

html.dark .pagination .page-item.disabled .page-link {
    background-color: var(--surface-strong);
    border-color: var(--line);
    color: var(--muted);
    opacity: 0.5;
}

html.dark .btn-outline-secondary {
    border-color: var(--line);
    color: var(--muted);
    background-color: transparent;
}

html.dark .btn-outline-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    background-color: rgba(255, 90, 74, 0.05);
}

html.dark .text-secondary,
html.dark .text-muted {
    color: var(--muted) !important;
}

html.dark .btn-close {
    filter: invert(1) grayscale(1) brightness(2);
}

html.dark .modal-content {
    background-color: var(--surface-strong);
    border-color: var(--line);
    color: var(--ink);
}

html.dark .modal-header {
    border-bottom-color: var(--line);
}

html.dark .modal-footer {
    border-top-color: var(--line);
}

html.dark .badge[class*="-lt"] {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: var(--ink) !important;
}

html.dark .badge.bg-success-lt {
    background-color: rgba(16, 185, 129, 0.15) !important;
    color: #34d399 !important;
}

html.dark .badge.bg-azure-lt {
    background-color: rgba(59, 130, 246, 0.15) !important;
    color: #60a5fa !important;
}

html.dark .badge.bg-secondary-lt {
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: var(--muted) !important;
}

/* Gantt (cronograma) — dhtmlx-gantt */
.gantt-view-switch {
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.5rem;
    margin-bottom: 0.75rem;
}

/* Edição em lote de datas — Tabela do cronograma */
.datas-lote-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.75rem;
    background: var(--surface-strong);
    border: 1px solid var(--accent);
    border-radius: 0.5rem;
    font-size: 0.82rem;
    color: var(--ink);
}

.datas-lote-input {
    width: 100%;
    min-width: 118px;
    font: inherit;
    font-size: 0.8rem;
    padding: 0.3rem 0.4rem;
    border: 1px solid var(--line);
    border-radius: 0.35rem;
    background: var(--surface-strong);
    color: var(--ink);
}

.datas-lote-input-num {
    min-width: 70px;
}

.datas-lote-input.is-dirty {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, var(--surface-strong));
}

.gantt-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.gantt-shell-lib {
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    overflow: hidden;
    min-height: 220px;
}

.gantt-kpis {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 0.85rem 1rem;
    margin-bottom: 0.75rem;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-radius: 0.5rem;
}

.gantt-kpi {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    min-width: 90px;
}

.gantt-kpi-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.1;
}

.gantt-kpi-value.is-info { color: #1d4ed8; }
.gantt-kpi-value.is-danger { color: #b91c1c; }
.gantt-kpi-value.is-success { color: #15803d; }

html.dark .gantt-kpi-value.is-info { color: #60a5fa; }
html.dark .gantt-kpi-value.is-danger { color: #fca5a5; }
html.dark .gantt-kpi-value.is-success { color: #34d399; }

.gantt-kpi-label {
    font-size: 0.68rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* % dentro do nome da atividade (grid) — só cor de texto, sem bolha */
.gantt-name-pct {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    margin-right: 0.3rem;
}

.gantt-name-pct.is-nao_iniciada,
.gantt-name-pct.is-cancelada { color: var(--muted); }
.gantt-name-pct.is-em_andamento { color: #1d4ed8; }
.gantt-name-pct.is-atrasada { color: #b91c1c; }
.gantt-name-pct.is-concluida { color: #15803d; }
.gantt-name-pct.is-pausada { color: #b45309; }

html.dark .gantt-name-pct.is-em_andamento { color: #60a5fa; }
html.dark .gantt-name-pct.is-atrasada { color: #fca5a5; }
html.dark .gantt-name-pct.is-concluida { color: #34d399; }
html.dark .gantt-name-pct.is-pausada { color: #fbbf24; }

/* Situação (grid) — texto colorido, sem bolha */
.status-text.is-nao_iniciada,
.status-text.is-cancelada { color: var(--muted); }
.status-text.is-em_andamento { color: #1d4ed8; font-weight: 600; }
.status-text.is-atrasada { color: #b91c1c; font-weight: 700; }
.status-text.is-concluida { color: #15803d; font-weight: 600; }
.status-text.is-pausada { color: #b45309; font-weight: 600; }

html.dark .status-text.is-em_andamento { color: #60a5fa; }
html.dark .status-text.is-atrasada { color: #fca5a5; }
html.dark .status-text.is-concluida { color: #34d399; }
html.dark .status-text.is-pausada { color: #fbbf24; }

.gantt_task_line.is-overdue {
    box-shadow: 0 0 0 2px #b91c1c inset;
}

/* dhtmlx-gantt: cor da barra por status, mesma paleta do .status-badge */
.gantt_task_line.is-nao_iniciada,
.gantt_task_line.is-cancelada {
    background: #9ca3af;
    border-color: #6b7280;
}

.gantt_task_line.is-em_andamento {
    background: #3b82f6;
    border-color: #1d4ed8;
}

.gantt_task_line.is-atrasada {
    background: #ef4444;
    border-color: #b91c1c;
}

.gantt_task_line.is-concluida {
    background: #10b981;
    border-color: #15803d;
}

.gantt_task_line.is-pausada {
    background: #f59e0b;
    border-color: #b45309;
}

/* O Tabler define .d-flex etc. sem !important, mesma especificidade de
   [hidden] do user-agent — quando o elemento oculto tem .d-flex (ex.: linhas
   da arvore "Importar da biblioteca"), o [hidden] perde e a linha continua
   visivel mesmo com o atributo presente. Forca a ocultacao de verdade. */
[hidden] {
    display: none !important;
}

/* Card recolhivel (<details>/<summary>) — ex.: "Cronogramas cadastrados" */
.collapsible-card > summary,
.collapsible-section > summary {
    cursor: pointer;
    list-style: none;
}

.collapsible-card > summary::-webkit-details-marker,
.collapsible-section > summary::-webkit-details-marker {
    display: none;
}

.collapsible-card-chevron {
    flex-shrink: 0;
    font-size: 1.1rem;
    color: var(--muted);
    transition: transform 0.15s ease;
}

details[open] > summary .collapsible-card-chevron {
    transform: rotate(180deg);
}

/* Variante leve, sem fundo/borda de card — usada quando o conteudo de dentro
   (ex.: aux_render_page) ja tem sua propria caixa (.cadastro-panel) e nao
   queremos caixa dentro de caixa. */
.collapsible-section-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
}

/* Importar da biblioteca de Atividades Padrão — arvore com altura limitada */
.tree-scroll-box {
    max-height: 320px;
    overflow-y: auto;
    padding-right: 0.5rem;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    padding: 0.75rem;
}
