/*
 * PORT - Camada visual corporativa adicional
 * Objetivo: refinamento estético sem alteração estrutural/funcional.
 * Tokens definidos em base.css (--app-*).
 */

/* Tipografia e hierarquia */
h1, h2, h3, .h1, .h2, .h3 {
    letter-spacing: -0.03em;
}

h4, h5, h6, .h4, .h5, .h6 {
    letter-spacing: -0.02em;
}

.page-header {
    padding-bottom: 0.8rem;
    margin-bottom: 1.35rem !important;
}

.page-subtitle {
    font-size: .92rem;
    color: var(--app-text-muted);
}

/* Navegação */
#sidebar-wrapper {
    background: linear-gradient(180deg, #0b1220 0%, #0f172a 44%, #111c34 100%);
    border-right: 1px solid rgba(148, 163, 184, 0.2) !important;
}

#sidebar-wrapper .sidebar-heading {
    border-bottom-color: rgba(148, 163, 184, 0.22) !important;
}

#sidebar-wrapper .list-group-item {
    margin: 0.18rem 0.5rem;
    border-radius: 0.75rem;
    border-left: 0 !important;
    padding: 0.72rem 0.95rem;
    transition: var(--app-transition);
}

#sidebar-wrapper .list-group-item:hover {
    transform: translateX(4px);
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.18), rgba(37, 99, 235, 0.04));
}

#sidebar-wrapper .list-group-item.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.34), rgba(30, 64, 175, 0.14));
    box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.4);
}

.sidebar-nav-groups {
    padding-bottom: 0.5rem;
}

.sidebar-nav-group-toggle {
    width: calc(100% - 1rem);
    margin: 0.35rem 0.5rem 0.15rem;
    padding: 0.45rem 0.75rem;
    border: 0;
    border-radius: 0.5rem;
    background: rgba(148, 163, 184, 0.12);
    color: rgba(226, 232, 240, 0.85);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.sidebar-nav-group-toggle:hover {
    background: rgba(59, 130, 246, 0.2);
    color: #fff;
}

.sidebar-nav-group .collapse .list-group-item {
    margin-left: 0.25rem;
    margin-right: 0.35rem;
    font-size: 0.92rem;
}

.sidebar-nav-logout {
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    margin-top: 0.5rem !important;
}

.kpi-card--link {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card--link:hover {
    transform: translateY(-2px);
    box-shadow: var(--app-shadow-md);
}

.kpi-card--link .kpi-open-hint {
    font-size: 0.7rem;
    opacity: 0.65;
}

.card-metric--link {
    cursor: pointer;
    transition: transform 0.15s ease;
}

.card-metric--link:hover {
    transform: translateY(-2px);
}

.port-quick-links .btn {
    font-size: 0.85rem;
}

.import-tab-advanced {
    display: none;
}

body.import-show-advanced .import-tab-advanced {
    display: list-item;
}

.navbar {
    border-bottom: 1px solid var(--app-border) !important;
    box-shadow: 0 6px 24px rgba(15, 23, 42, 0.05);
}

/* Cartões e blocos */
.card,
.tabela-container {
    border-radius: var(--app-radius-lg);
    border-color: var(--app-border);
    box-shadow: var(--app-shadow-sm);
}

.card:hover,
.tabela-container:hover {
    box-shadow: var(--app-shadow-md);
}

.card-header {
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.port-main-card {
    border: 1px solid var(--app-border);
}

.kpi-card {
    cursor: pointer;
    border: 1px solid var(--app-border);
    border-left-width: 4px;
}

.kpi-card:hover {
    transform: translateY(-3px);
}

.kpi-card.active {
    box-shadow: var(--app-shadow-md);
}

.kpi-card--pendente { border-left-color: #f59e0b; }
.kpi-card--tratativa { border-left-color: #2563eb; }
.kpi-card--aguardando { border-left-color: #0ea5e9; }
.kpi-card--atraso { border-left-color: #475569; }
.kpi-card--resolvido { border-left-color: #16a34a; }
.kpi-card--recusa { border-left-color: #dc2626; }
.kpi-card--total { border-left-color: #1d4ed8; }

/* Dashboard */
.card-metric {
    border: 1px solid var(--app-border);
    box-shadow: var(--app-shadow-sm);
}

.card-metric::before {
    width: 5px;
    opacity: 0.95;
}

.card-metric:hover {
    transform: translateY(-4px);
    box-shadow: var(--app-shadow-lg);
}

.metric-label {
    font-size: .74rem;
}

.metric-value {
    font-size: clamp(1.65rem, 2vw, 2.1rem);
}

.port-dash-value-sm {
    font-size: clamp(1.1rem, 1.6vw, 1.45rem);
}

.port-dash-mini {
    border: 1px solid var(--app-border);
    box-shadow: var(--app-shadow-sm);
    border-radius: var(--app-radius-lg);
}

.port-dash-occ-tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    padding: 0.75rem 1rem;
    border-radius: var(--app-radius-md, 0.5rem);
    border: 1px solid var(--app-border);
    background: #fff;
    text-decoration: none;
    color: inherit;
    height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.port-dash-occ-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--app-shadow-md);
    color: inherit;
}

.port-dash-occ-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
}

.port-dash-occ-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
}

.port-dash-occ-tile--pendente { border-left: 4px solid #f59e0b; }
.port-dash-occ-tile--tratativa { border-left: 4px solid #2563eb; }
.port-dash-occ-tile--atraso { border-left: 4px solid #dc2626; }
.port-dash-occ-tile--aguardando { border-left: 4px solid #0ea5e9; }
.port-dash-occ-tile--resolvido { border-left: 4px solid #16a34a; background: #f8fafc; }
.port-dash-occ-tile--total { border-left: 4px solid #1d4ed8; background: #f8fafc; }

.port-dash-insight-group {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg, 0.65rem);
    background: #f8fafc;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.port-dash-insight-group-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-bottom: 1px solid var(--app-border);
    font-weight: 700;
    font-size: 0.95rem;
    color: #0f172a;
}

.port-dash-insight-group-head .bi {
    font-size: 1.1rem;
    color: #2563eb;
}

.port-dash-insight-group-body {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.port-dash-insight-group-body .port-dash-topic {
    margin: 0;
}

.port-dash-insight-card .card-header h6 {
    color: #0f172a;
}

.port-dash-insight-topicos-inner {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.port-dash-insight-card--comprovantes .port-dash-insight-topicos-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}

@media (min-width: 768px) {
    .port-dash-insight-card--comprovantes .port-dash-insight-topicos-inner {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 1200px) {
    .port-dash-insight-card--port .port-dash-insight-topicos-inner {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.65rem;
    }
}

.port-dash-topic {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg, 0.65rem);
    background: #fff;
    padding: 1rem 1.1rem 0.85rem;
    height: 100%;
    box-shadow: var(--app-shadow-sm);
    border-top: 4px solid #94a3b8;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.port-dash-topic:hover {
    box-shadow: var(--app-shadow-md);
    transform: translateY(-2px);
}

.port-dash-topic--clickable {
    cursor: pointer;
}

.port-dash-topic--clickable:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.port-dash-topic--clickable:hover .port-dash-topic-foot .text-primary {
    text-decoration: underline;
}

#tabelaInsightPedidos .insight-pedido-row:hover {
    background-color: #f1f5f9;
}

.port-dash-topic-head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.65rem 0.75rem;
    align-items: start;
}

.port-dash-topic-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: #f1f5f9;
    color: #334155;
}

.port-dash-topic-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
}

.port-dash-topic-desc {
    font-size: 0.72rem;
    color: #64748b;
    line-height: 1.35;
    margin-top: 0.15rem;
}

.port-dash-topic-qty {
    text-align: right;
    line-height: 1.1;
}

.port-dash-topic-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
}

.port-dash-topic-pct {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #64748b;
}

.port-dash-topic-chart {
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    margin: 0.75rem 0 0.45rem;
}

.port-dash-topic-bar {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
    min-width: 2px;
    transition: width 0.35s ease;
}

.port-dash-topic-foot {
    font-size: 0.68rem;
}

.port-dash-topic--warn { border-top-color: #f59e0b; }
.port-dash-topic--warn .port-dash-topic-bar { background: linear-gradient(90deg, #fbbf24, #d97706); }
.port-dash-topic--primary { border-top-color: #2563eb; }
.port-dash-topic--success { border-top-color: #16a34a; }
.port-dash-topic--success .port-dash-topic-bar { background: linear-gradient(90deg, #4ade80, #16a34a); }
.port-dash-topic--danger { border-top-color: #dc2626; }
.port-dash-topic--danger .port-dash-topic-bar { background: linear-gradient(90deg, #f87171, #dc2626); }
.port-dash-topic--info { border-top-color: #0ea5e9; }
.port-dash-topic--info .port-dash-topic-bar { background: linear-gradient(90deg, #38bdf8, #0284c7); }
.port-dash-topic--muted { border-top-color: #94a3b8; }
.port-dash-topic--muted .port-dash-topic-bar { background: linear-gradient(90deg, #cbd5e1, #64748b); }

.port-dash-rank-card {
    border: 1px solid var(--app-border);
    border-radius: var(--app-radius-lg, 0.65rem);
    overflow: hidden;
}

.port-dash-rank-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--app-border);
}

.port-dash-rank-card-icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.55rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.port-dash-rank-card--uf .port-dash-rank-card-icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.port-dash-rank-card--proj .port-dash-rank-card-icon {
    background: #fef3c7;
    color: #b45309;
}

.port-dash-rank-card--city .port-dash-rank-card-icon {
    background: #d1fae5;
    color: #047857;
}

.port-dash-rank-list {
    padding: 0.35rem 0;
}

.port-dash-rank-empty {
    padding: 1.25rem 1rem;
    text-align: center;
    font-size: 0.85rem;
}

.port-dash-rank-item {
    padding: 0.65rem 1rem 0.7rem;
    border-bottom: 1px solid #f1f5f9;
}

.port-dash-rank-item:last-child {
    border-bottom: none;
}

.port-dash-rank-item--top1 {
    background: linear-gradient(90deg, rgba(254, 243, 199, 0.35) 0%, transparent 100%);
}

.port-dash-rank-item--top2 {
    background: linear-gradient(90deg, rgba(241, 245, 249, 0.8) 0%, transparent 100%);
}

.port-dash-rank-item-row {
    display: grid;
    grid-template-columns: 2rem 1fr auto;
    gap: 0.5rem 0.65rem;
    align-items: center;
    margin-bottom: 0.4rem;
}

.port-dash-rank-pos {
    display: flex;
    align-items: center;
    justify-content: center;
}

.port-dash-rank-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.65rem;
    height: 1.65rem;
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
}

.port-dash-rank-medal--1 {
    background: linear-gradient(135deg, #fde68a, #f59e0b);
    color: #78350f;
}

.port-dash-rank-medal--2 {
    background: linear-gradient(135deg, #e2e8f0, #94a3b8);
    color: #334155;
}

.port-dash-rank-medal--3 {
    background: linear-gradient(135deg, #fed7aa, #ea580c);
    color: #7c2d12;
}

.port-dash-rank-medal--plain {
    background: #f1f5f9;
    color: #64748b;
    font-weight: 700;
}

.port-dash-rank-label-wrap {
    min-width: 0;
}

.port-dash-rank-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.port-dash-rank-sub {
    display: block;
    font-size: 0.68rem;
    color: #64748b;
    margin-top: 0.1rem;
}

.port-dash-rank-qty {
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
}

.port-dash-rank-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.port-dash-rank-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.35s ease;
}

.port-dash-rank-bar--uf .port-dash-rank-bar-fill {
    background: linear-gradient(90deg, #60a5fa, #1d4ed8);
}

.port-dash-rank-bar--proj .port-dash-rank-bar-fill {
    background: linear-gradient(90deg, #fbbf24, #d97706);
}

.port-dash-rank-bar--city .port-dash-rank-bar-fill {
    background: linear-gradient(90deg, #34d399, #059669);
}

.port-dash-rank-bar--primary .port-dash-rank-bar-fill {
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
}

/* Dashboard — barra de tempo (filtro por meses) */
.port-dash-timeline-card {
    background: #fff;
}

.port-dash-timeline-selected {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    min-height: 1.75rem;
    margin-bottom: 0.65rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
}

.port-dash-timeline-selected .port-dash-timeline-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #e7f1ff;
    color: #1d4ed8;
    border: 1px solid #bfd4f8;
    font-size: 0.78rem;
    font-weight: 600;
}

.port-dash-timeline-track {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 3px;
    padding: 0.75rem 0.65rem 1rem;
    background: #f1f5f9;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

.port-dash-timeline-track::after {
    content: '';
    position: absolute;
    left: 0.65rem;
    right: 0.65rem;
    bottom: 0.5rem;
    height: 2px;
    background: #cbd5e1;
    border-radius: 999px;
    pointer-events: none;
}

.port-dash-timeline-month {
    position: relative;
    z-index: 1;
    flex: 1 0 auto;
    min-width: 54px;
    padding: 0.4rem 0.3rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.port-dash-timeline-month:hover {
    color: #334155;
    background: #e2e8f0;
}

.port-dash-timeline-month:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
}

.port-dash-timeline-month.is-selected {
    color: #1d4ed8;
    background: #fff;
    border-color: #93c5fd;
    box-shadow: 0 1px 3px rgba(29, 78, 216, 0.1);
}

.port-dash-timeline-month.is-selected::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -0.4rem;
    width: 8px;
    height: 8px;
    margin-left: -4px;
    border-radius: 50%;
    background: #1d4ed8;
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px #93c5fd;
}

.port-dash-timeline-loading {
    width: 100%;
    text-align: center;
    padding: 0.5rem 0;
    color: #94a3b8 !important;
}

.port-dash-timeline-hint kbd {
    font-size: 0.7rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: #e2e8f0;
    color: #334155;
}

.port-dash-rank-card--city .port-dash-rank-card-icon {
    background: #d1fae5;
    color: #047857;
}

.port-dash-rank-card--sla .port-dash-rank-card-icon {
    background: #dcfce7;
    color: #15803d;
}

.port-dash-rank-card--transp .port-dash-rank-card-icon,
.port-dash-rank-card--detail .port-dash-rank-card-icon {
    background: #dbeafe;
    color: #1d4ed8;
}

.port-dash-rank-bar--success .port-dash-rank-bar-fill {
    background: linear-gradient(90deg, #4ade80, #16a34a);
}

.port-dash-rank-bar--transp .port-dash-rank-bar-fill {
    background: linear-gradient(90deg, #60a5fa, #2563eb);
}

.port-dash-transp-search {
    max-width: 280px;
}

.port-dash-transp-table thead th {
    background: linear-gradient(180deg, #f8fbff 0%, #f1f5f9 100%);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.port-dash-transp-table tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-color: #f1f5f9;
}

.port-dash-transp-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.04), rgba(37, 99, 235, 0.01));
}

.port-dash-transp-carrier {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.port-dash-transp-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.port-dash-transp-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.port-dash-transp-logo--md {
    width: 44px;
    height: 44px;
    padding: 4px;
}

.port-dash-transp-logo--sm {
    width: 30px;
    height: 30px;
    padding: 3px;
}

.port-dash-rank-label-wrap--logo {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.port-dash-rank-label-wrap--logo .port-dash-rank-label {
    flex: 1;
    min-width: 0;
}

.port-dash-transp-avatar {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.02em;
}

.port-dash-transp-avatar--sm {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 0.58rem;
}

.port-dash-transp-avatar--md {
    width: 44px;
    height: 44px;
}

.port-dash-transp-name {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.88rem;
    line-height: 1.2;
}

.port-dash-transp-sub {
    font-size: 0.72rem;
    color: #94a3b8;
}

.port-dash-transp-metric-main {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.9rem;
}

.port-dash-transp-metric-sub {
    font-size: 0.68rem;
    color: #94a3b8;
    margin-top: 0.1rem;
}

.port-dash-transp-sla-wrap {
    min-width: 180px;
}

.port-dash-transp-sla-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.port-dash-transp-sla-pct {
    font-size: 0.88rem;
    font-weight: 800;
}

.port-dash-transp-sla-pct.is-success { color: #16a34a; }
.port-dash-transp-sla-pct.is-warning { color: #d97706; }
.port-dash-transp-sla-pct.is-danger { color: #dc2626; }

.port-dash-transp-sla-badge {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
}

.port-dash-transp-sla-badge.is-success { background: #dcfce7; color: #15803d; }
.port-dash-transp-sla-badge.is-warning { background: #fef3c7; color: #b45309; }
.port-dash-transp-sla-badge.is-danger { background: #fee2e2; color: #b91c1c; }

.port-dash-transp-sla-bar {
    display: flex;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: #e2e8f0;
}

.port-dash-transp-sla-bar-on {
    background: linear-gradient(90deg, #4ade80, #16a34a);
    transition: width 0.35s ease;
}

.port-dash-transp-sla-bar-off {
    background: linear-gradient(90deg, #f87171, #dc2626);
    transition: width 0.35s ease;
}

.port-dash-transp-sla-foot {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.3rem;
    font-size: 0.68rem;
    color: #94a3b8;
}

.port-dash-transp-sla-foot span strong {
    color: #64748b;
    font-weight: 700;
}

@media (max-width: 767.98px) {
    .port-dash-transp-search {
        max-width: 100%;
        width: 100%;
    }
}

.port-dash-transp-row {
    cursor: pointer;
    transition: background 0.15s ease;
}

.port-dash-transp-row:hover {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.06), rgba(37, 99, 235, 0.02)) !important;
}

.port-dash-transp-chart-click {
    cursor: pointer;
    transition: background 0.15s ease;
}

.port-dash-transp-chart-click:hover {
    background: rgba(37, 99, 235, 0.04);
}

.port-dash-transp-sla-link {
    cursor: pointer;
    text-decoration: underline dotted;
    text-underline-offset: 2px;
}

.port-dash-transp-sla-link:hover {
    color: #2563eb !important;
}

.port-dash-transp-sla-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.port-dash-transp-sla-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.35rem 0.55rem;
    background: #fff;
    cursor: pointer;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
    min-width: 7rem;
}

.port-dash-transp-sla-chip:hover {
    border-color: #93c5fd;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.08);
}

.port-dash-transp-sla-chip--active {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
    background: #f8fbff;
}

.port-dash-transp-sla-chip-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
}

.port-dash-transp-sla-chip-val {
    font-size: 1rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}

.port-dash-transp-sla-chip--success .port-dash-transp-sla-chip-val { color: #15803d; }
.port-dash-transp-sla-chip--danger .port-dash-transp-sla-chip-val { color: #b91c1c; }
.port-dash-transp-sla-chip--primary .port-dash-transp-sla-chip-val { color: #1d4ed8; }
.port-dash-transp-sla-chip--warning .port-dash-transp-sla-chip-val { color: #b45309; }

/* Atrasos de Entrega */
.port-atrasos-page .port-atrasos-rules {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
}

.port-atrasos-kpis {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (max-width: 992px) {
    .port-atrasos-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.port-atrasos-kpi {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.65rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
    border-top: 3px solid #94a3b8;
}

.port-atrasos-kpi:hover {
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.port-atrasos-kpi.is-active {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.port-atrasos-kpi--total { border-top-color: #dc2626; }
.port-atrasos-kpi--light { border-top-color: #64748b; }
.port-atrasos-kpi--warn { border-top-color: #f59e0b; }
.port-atrasos-kpi--orange { border-top-color: #ea580c; }
.port-atrasos-kpi--danger { border-top-color: #b91c1c; }

.port-atrasos-kpi-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.port-atrasos-kpi-val {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.1;
}

.port-atrasos-cobranca-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1rem 1rem;
}

.port-atrasos-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    color: #334155;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.port-atrasos-chip:hover { background: #f8fafc; }
.port-atrasos-chip.active {
    background: #eff6ff;
    border-color: #2563eb;
    color: #1d4ed8;
    font-weight: 600;
}

.port-atrasos-chip-val {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.port-atrasos-chip--warn.active { background: #fffbeb; border-color: #f59e0b; color: #b45309; }
.port-atrasos-chip--ok.active { background: #f0fdf4; border-color: #16a34a; color: #15803d; }
.port-atrasos-chip--info.active { background: #eff6ff; border-color: #2563eb; color: #1d4ed8; }
.port-atrasos-chip--danger.active { background: #fef2f2; border-color: #dc2626; color: #b91c1c; }
.port-atrasos-chip--inden.active { background: #fef2f2; border-color: #991b1b; color: #991b1b; }

.port-atrasos-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.85rem 1rem;
}

.port-atrasos-select { min-width: 200px; max-width: 240px; }
.port-atrasos-range { min-width: 220px; max-width: 280px; }
.port-atrasos-search { min-width: 260px; max-width: 420px; flex: 1 1 260px; }

.port-atrasos-table thead th {
    background: #f8fafc;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    border-bottom-width: 1px;
    white-space: nowrap;
}

.port-atrasos-table tbody td {
    font-size: 0.875rem;
    vertical-align: middle;
}

.port-atrasos-table tbody tr {
    cursor: pointer;
}

.port-atrasos-timeline-col {
    min-width: 170px;
    max-width: 220px;
}

.port-atrasos-timeline {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8125rem;
    line-height: 1.3;
}

.port-atrasos-timeline-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #94a3b8;
    margin-top: 0.35rem;
    flex-shrink: 0;
}

.port-atrasos-timeline-dot--ok { background: #16a34a; }
.port-atrasos-timeline-dot--warn { background: #f59e0b; }
.port-atrasos-timeline-dot--danger { background: #dc2626; }
.port-atrasos-timeline-dot--info { background: #0ea5e9; }

.port-atrasos-chip--agenda-dia.active {
    background: #eff6ff;
    border-color: #2563eb;
    color: #1d4ed8;
}

.port-atrasos-chip--promessa {
    border-color: #0ea5e9;
}

.port-atrasos-chip--promessa.active {
    background: #ecfeff;
    border-color: #0891b2;
    color: #0e7490;
}

.port-atrasos-cobranca-chips .port-atrasos-chip-label {
    margin-right: 0.15rem;
}

.port-atrasos-row--critico {
    background: rgba(254, 226, 226, 0.35) !important;
}

.bg-orange-subtle {
    background-color: #ffedd5 !important;
    color: #9a3412 !important;
}

.metric-icon {
    opacity: 0.2;
    filter: saturate(110%);
}

/* Tabelas / DataTables */
.table thead th {
    background: linear-gradient(180deg, #f8fbff 0%, #f2f6fc 100%);
    border-bottom: 1px solid var(--app-border);
    color: #334155;
    font-size: .73rem;
    padding-top: 0.88rem;
    padding-bottom: 0.88rem;
}

.table tbody td {
    padding-top: 0.88rem;
    padding-bottom: 0.88rem;
    border-color: #eaf0f7;
}

.table-hover tbody tr {
    transition: var(--app-transition);
}

.table-hover tbody tr:hover {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.07), rgba(59, 130, 246, 0.02));
}

.badge,
.badge-status,
.badge-pill {
    border-radius: 999px;
    font-weight: 700;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .2);
}

.status-badge {
    border: 1px solid transparent;
    letter-spacing: .01em;
    padding: .36rem .62rem;
    font-size: .72rem;
}

.status-neutro { background: #e2e8f0; color: #334155; border-color: #cbd5e1; }
.status-pendente { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.status-tratativa { background: #dbeafe; color: #1e3a8a; border-color: #93c5fd; }
.status-aguardando { background: #e0f2fe; color: #075985; border-color: #7dd3fc; }
.status-atraso { background: #e2e8f0; color: #0f172a; border-color: #94a3b8; }
.status-resolvido { background: #dcfce7; color: #166534; border-color: #86efac; }
.status-cancelado,
.status-saldo-recusa { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.status-devolucao { background: #e0e7ff; color: #3730a3; border-color: #a5b4fc; }

.status-prazo-ok { background: #dcfce7; color: #166534; border-color: #86efac; }
.status-prazo-atrasado { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.status-prazo-alerta { background: #fef3c7; color: #92400e; border-color: #fcd34d; }

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border-radius: 0.65rem;
    min-height: 2.15rem;
    border-color: var(--app-border);
    background-color: #fff;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    border-radius: 0.6rem !important;
    min-width: 2rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    color: #1e40af !important;
    background: #eaf1ff !important;
    border-color: #b9cdf7 !important;
}

/* Formulários */
.form-label {
    color: #475569;
    letter-spacing: .01em;
}

.form-control,
.form-select,
.input-group-text {
    border-radius: var(--app-radius-sm);
    border-color: var(--app-border);
    background-color: #fdfefe;
}

.form-control:hover,
.form-select:hover {
    border-color: #bfd0ec;
}

.form-control:focus,
.form-select:focus {
    border-color: #6ea8fe;
    box-shadow: 0 0 0 0.24rem rgba(37, 99, 235, 0.14);
}

.btn {
    border-radius: 0.62rem;
    font-weight: 600;
    transition: var(--app-transition);
}

.btn:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.25);
}

.btn-primary {
    background: linear-gradient(135deg, var(--app-primary-600), var(--app-primary));
    border-color: var(--app-primary);
}

.btn-primary:hover {
    filter: brightness(1.03);
}

.btn-port-primary {
    background: linear-gradient(135deg, var(--app-primary-600), var(--app-primary));
    border-color: var(--app-primary);
    color: #fff;
}

.btn-port-export {
    background: linear-gradient(135deg, #16a34a, #15803d);
    border-color: #15803d;
    color: #fff;
}

.btn-port-neutral {
    border-color: #c7d2e5;
    color: #334155;
    background: #fff;
}

.btn-port-neutral:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

.btn-action-view {
    border: 1px solid #93c5fd;
    background: #eff6ff;
    color: #1d4ed8;
}

.btn-action-view:hover {
    background: #dbeafe;
    color: #1e3a8a;
}

/* Microinterações */
.card,
.btn,
.form-control,
.form-select,
.list-group-item,
.paginate_button,
.dropdown-item {
    transition: var(--app-transition);
}

.dropdown-item:hover {
    background-color: #f1f6ff;
}

/* Dark theme refinado */
body.theme-dark {
    --app-border: #24324a;
    --app-text: #e2e8f0;
    --app-text-muted: #9fb0c8;
    background: radial-gradient(circle at top right, #0c1425 0%, #0b1220 46%, #0a101d 100%);
}

body.theme-dark #sidebar-wrapper {
    background: linear-gradient(180deg, #070d19 0%, #0b1220 46%, #111b32 100%);
}

body.theme-dark .card,
body.theme-dark .tabela-container,
body.theme-dark .navbar,
body.theme-dark .modal-content {
    border-color: #22324a !important;
    box-shadow: 0 8px 24px rgba(2, 8, 23, 0.45);
}

body.theme-dark .table thead th {
    background: linear-gradient(180deg, #101a2f 0%, #0d172a 100%);
    color: #d3deee;
}

body.theme-dark .table-hover tbody tr:hover {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.06));
}

body.theme-dark .form-control,
body.theme-dark .form-select,
body.theme-dark .input-group-text {
    background-color: #0e182b;
    border-color: #273754;
}

body.theme-dark .dropdown-item:hover {
    background: rgba(59, 130, 246, 0.16);
}

body.theme-dark .btn-port-neutral {
    background: #0e182b;
    border-color: #334155;
    color: #cbd5e1;
}

body.theme-dark .btn-action-view {
    background: #10203b;
    border-color: #1d4ed8;
    color: #bfdbfe;
}

/* Responsividade */
@media (max-width: 991.98px) {
    .container-fluid.px-5.py-4 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: .75rem;
    }

    .card-header,
    .card-body {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 767.98px) {
    .metric-value {
        font-size: 1.35rem;
    }

    .metric-icon {
        font-size: 1.6rem;
        opacity: .22;
    }

    .table thead th,
    .table tbody td {
        padding-left: .75rem;
        padding-right: .75rem;
    }

    #sidebar-wrapper .list-group-item {
        margin-left: .35rem;
        margin-right: .35rem;
    }
}

/* Busca global no navbar */
.port-global-search {
    max-width: 32rem;
}

/* Faixa de seleção fixa no viewport (Pedidos / Ocorrências) — fora do #wrapper */
#portSelectionBar.port-selection-bar {
    display: none !important;
    position: fixed !important;
    bottom: 0 !important;
    top: auto !important;
    left: 0;
    width: 100%;
    z-index: 1030 !important;
    margin: 0 !important;
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid var(--bs-border-color);
    box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(8px);
    transform: none !important;
}
#portSelectionBar.port-selection-bar.is-visible {
    display: block !important;
}
body.modal-open #portSelectionBar.port-selection-bar {
    display: none !important;
}
.port-selection-bar-inner {
    padding: 0.7rem 1.25rem;
    max-width: 100%;
}
.port-selection-count {
    font-size: 0.95rem;
    font-weight: 600;
}
body.port-has-selection-bar {
    padding-bottom: 4.25rem;
}
body.port-has-selection-bar #page-content-wrapper .container-fluid:last-of-type {
    padding-bottom: 0.5rem;
}
body.theme-dark .port-selection-bar {
    background: rgba(15, 23, 42, 0.97);
}

.port-table-search-group {
    min-width: min(100%, 22rem);
}

/* Modal pedido: timeline fixa + alterações não salvas */
.modal-pedido-body {
    max-height: min(78vh, 720px);
}
.modal-pedido-timeline-sticky {
    position: sticky;
    top: 0;
    z-index: 2;
}
#pedidoTabs .nav-link.port-tab-has-unsaved::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-left: 6px;
    border-radius: 50%;
    background: #f59e0b;
    vertical-align: middle;
}
#pedidoTabs .nav-link.port-tab-switch-dirty {
    box-shadow: inset 0 -2px 0 #f59e0b;
}
