/* ── Hermes Ops Portal — Design System ──────────────────────── */
:root {
    --bg-primary: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #273449;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-card: rgba(255, 255, 255, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Reconciliação: período, cobertura e origem ficam visíveis no ponto de decisão. */
.reconciliation-panel { margin: 18px 0 24px; padding: 18px 20px; background: var(--bg-card); border: 1px solid var(--border-card); border-radius: var(--radius-md); }
.section-heading-row { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; }
.section-heading-row h2 { font-size:15px; font-weight:700; color:var(--text-primary); }
.data-status { display:inline-flex; align-items:center; min-height:26px; padding:4px 9px; border-radius:999px; font-size:11px; font-weight:700; }
.status-confirmed { color:#86efac; background:rgba(34,197,94,.13); border:1px solid rgba(34,197,94,.3); }
.status-pending { color:#fcd34d; background:rgba(245,158,11,.13); border:1px solid rgba(245,158,11,.3); }
.reconciliation-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; }
.reconciliation-grid > div { padding:12px; border:1px solid var(--border-subtle); border-radius:var(--radius-sm); }
.reconciliation-grid span { display:block; color:var(--text-muted); font-size:11px; text-transform:uppercase; letter-spacing:.05em; }
.reconciliation-grid strong { display:block; margin-top:5px; color:var(--text-primary); font:700 22px/1 var(--font-mono); }
.source-strip { margin-top:13px; color:var(--text-secondary); font-size:11px; }

/* ── Header ─────────────────────────────────────────────────── */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid rgba(139, 92, 246, 0.35);
    box-shadow: 0 0 6px rgba(139, 92, 246, 0.2);
    flex-shrink: 0;
    vertical-align: middle;
}

.header-left h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.header-left span {
    color: var(--accent-blue);
}

.header-meta {
    text-align: right;
    font-size: 13px;
    color: var(--text-secondary);
}

.header-meta .live-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    margin-right: 6px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Navigation tabs ──────────────────────────────────────── */
.nav-tabs {
    display: flex;
    gap: 4px;
    padding: 12px 24px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
}

.nav-tab {
    padding: 8px 20px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--accent-blue);
    color: white;
}

/* ── Main content ─────────────────────────────────────────── */
.main-content {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ── Page containers (for rotation) ───────────────────────── */
.page {
    display: none;
    animation: fadeSlideIn 0.4s ease;
}

.page.active {
    display: block;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── KPI Cards ────────────────────────────────────────────── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.kpi-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
}

.kpi-value.accent-blue { color: var(--accent-blue); }
.kpi-value.accent-green { color: var(--accent-green); }
.kpi-value.accent-amber { color: var(--accent-amber); }
.kpi-value.accent-red { color: var(--accent-red); }
.kpi-value.accent-purple { color: var(--accent-purple); }

.kpi-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* ── Progress Bar ─────────────────────────────────────────── */
.progress-section {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.progress-title {
    font-size: 16px;
    font-weight: 600;
}

.progress-pct {
    font-size: 24px;
    font-weight: 800;
    font-family: var(--font-mono);
}

.progress-bar-outer {
    height: 14px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-inner {
    height: 100%;
    border-radius: 9999px;
    transition: transform 0.6s ease;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Transportadoras Table ────────────────────────────────── */
.transportadoras-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.transp-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 20px;
}

.transp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.transp-name {
    font-weight: 700;
    font-size: 15px;
}

.transp-status {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 9999px;
    font-weight: 600;
    text-transform: uppercase;
}

.transp-status.meta-atingida { background: #064e3b; color: #6ee7b7; }
.transp-status.no-ritmo { background: #1e3a5f; color: #93c5fd; }
.transp-status.atencao { background: #78350f; color: #fcd34d; }
.transp-status.critico { background: #7f1d1d; color: #fca5a5; }

.transp-metric {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.transp-metric strong {
    color: var(--text-primary);
}

.transp-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 9999px;
    overflow: hidden;
    margin: 8px 0;
}

.transp-bar-fill {
    height: 100%;
    border-radius: 9999px;
    transition: transform 0.5s ease;
}

/* ── Timeline ─────────────────────────────────────────────── */
.timeline {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 20px;
}

.timeline-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.timeline-item {
    display: flex;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
    gap: 12px;
    font-size: 13px;
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-time {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
    min-width: 50px;
}

.timeline-placa {
    font-weight: 700;
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    min-width: 80px;
    text-align: center;
}

.timeline-transp {
    color: var(--accent-blue);
    font-weight: 500;
    min-width: 90px;
}

.timeline-peso {
    font-weight: 700;
    font-family: var(--font-mono);
    margin-left: auto;
}

/* ── Documents Grid (Page 2) ──────────────────────────────── */
.docs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.doc-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
}

.doc-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.doc-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.doc-value {
    font-size: 48px;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
}

.doc-sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* ── Donut Chart (MTR) ────────────────────────────────────── */
.donut-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
}

.donut-ring {
    position: relative;
    width: 120px;
    height: 120px;
}

.donut-ring svg {
    transform: rotate(-90deg);
}

.donut-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-center .big {
    font-size: 28px;
    font-weight: 800;
}

.donut-center .label {
    font-size: 11px;
    color: var(--text-muted);
}

.donut-legend {
    text-align: left;
    font-size: 13px;
}

.donut-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.donut-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ── Monthly Chart (Page 3) ───────────────────────────────── */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 24px;
}

.chart-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-legend {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
    display: flex;
    gap: 12px;
    align-items: center;
}

.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 200px;
    padding-top: 10px;
}

.legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.bar {
    width: 100%;
    max-width: 40px;
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease;
    position: relative;
    cursor: pointer;
}

.bar:hover {
    filter: brightness(1.3);
}

.bar-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
    font-family: var(--font-mono);
}

.bar-value {
    font-size: 10px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    margin-bottom: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.bar:hover + .bar-value,
.bar-col:hover .bar-value {
    opacity: 1;
}

/* ── Heatmap ──────────────────────────────────────────────── */
.heatmap {
    display: grid;
    grid-template-columns: repeat(24, 1fr);
    gap: 3px;
    margin-top: 12px;
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    transition: transform 0.2s;
    cursor: pointer;
}

.heatmap-cell:hover {
    transform: scale(1.3);
}

.heatmap-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
    font-family: var(--font-mono);
}

/* ── Footer ───────────────────────────────────────────────── */
.footer {
    text-align: center;
    padding: 16px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    margin-top: 24px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
    .reconciliation-grid { grid-template-columns: repeat(2, 1fr); }
    .section-heading-row { align-items: flex-start; flex-direction: column; }
    .header { padding: 12px 16px; }
    .header-left h1 { font-size: 16px; }
    .main-content { padding: 16px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .kpi-value { font-size: 24px; }
    .transportadoras-grid { grid-template-columns: 1fr; }
    .docs-grid { grid-template-columns: 1fr; }
    .bar-chart { height: 140px; }
}

/* ── Page transition ──────────────────────────────────────── */
.page-transition {
    animation: crossfade 0.5s ease;
}

@keyframes crossfade {
    0% { opacity: 0; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1); }
}

/* ════════════════════════════════════════════════════════════ */
/* KANBAN — Esteira CT-e                                       */
/* ════════════════════════════════════════════════════════════ */

/* ── Fluxograma Didático (barra horizontal no topo) ─────── */
.kanban-flow {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    overflow-x: auto;
}

.kanban-flow-stage {
    flex: 1;
    min-width: 140px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
    cursor: default;
    position: relative;
}

.kanban-flow-stage:hover {
    background: rgba(255,255,255,0.04);
}

.kanban-flow-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.kanban-flow-info {
    flex: 1;
    min-width: 0;
}

.kanban-flow-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.kanban-flow-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.kanban-flow-count {
    font-size: 18px;
    font-weight: 800;
    font-family: var(--font-mono);
    line-height: 1;
    margin-top: 4px;
}

.kanban-flow-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 20px;
    padding: 0 4px;
    animation: arrowPulse 2s ease infinite;
}

@keyframes arrowPulse {
    0%, 100% { opacity: 0.4; transform: translateX(0); }
    50% { opacity: 1; transform: translateX(4px); }
}

/* Tooltip explicativo no fluxo */
.kanban-flow-tip {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    z-index: 50;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.kanban-flow-stage:hover .kanban-flow-tip {
    display: block;
}

/* ── Quadro Kanban ───────────────────────────────────────── */
.kanban-board {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 24px;
    min-height: 400px;
}

.kanban-col {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    min-width: 300px;
    max-width: 340px;
    width: 320px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 280px);
    flex-shrink: 0;
}

.kanban-col-header {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.kanban-col-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kanban-col-count {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-subtle);
    border-radius: 9999px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.kanban-col-body {
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
}

.kanban-col-body::-webkit-scrollbar {
    width: 4px;
}
.kanban-col-body::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
}

/* ── Cards Kanban ────────────────────────────────────────── */
.kanban-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-standard);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    transition: all 0.2s ease;
    cursor: default;
    position: relative;
}

.kanban-card:hover {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.12);
    transform: translateY(-1px);
}

/* Status uses a subtle inset accent, preserving the card silhouette. */
.kanban-card[data-status="triage"]    { box-shadow: inset 2px 0 0 #3b82f6; }
.kanban-card[data-status="ready"]     { box-shadow: inset 2px 0 0 #8b5cf6; }
.kanban-card[data-status="blocked"]   { box-shadow: inset 2px 0 0 #f59e0b; }
.kanban-card[data-status="done"]      { box-shadow: inset 2px 0 0 #22c55e; }
.kanban-card[data-status="rejeitada"] { box-shadow: inset 2px 0 0 #ef4444; }
.kanban-card[data-status="duplicada"] { box-shadow: inset 2px 0 0 #6366f1; }

.kanban-card-title {
    font-size: 13px;
    font-weight: 500;
    margin: 0 0 6px 0;
    line-height: 1.4;
    color: var(--text-primary);
    word-break: break-word;
}

.kanban-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}

.kanban-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    font-family: var(--font-mono);
    letter-spacing: 0.02em;
}

/* Subcontratado badges */
.kanban-badge-tazay    { background: rgba(59,130,246,0.15); color: #93c5fd; border: 1px solid rgba(59,130,246,0.3); }
.kanban-badge-fjx      { background: rgba(139,92,246,0.15); color: #c4b5fd; border: 1px solid rgba(139,92,246,0.3); }
.kanban-badge-fertran  { background: rgba(34,197,94,0.15); color: #6ee7b7; border: 1px solid rgba(34,197,94,0.3); }
.kanban-badge-depaula  { background: rgba(245,158,11,0.15); color: #fcd34d; border: 1px solid rgba(245,158,11,0.3); }
.kanban-badge-outros   { background: rgba(156,163,175,0.15); color: #9ca3af; border: 1px solid rgba(156,163,175,0.3); }

.kanban-badge-placa {
    background: rgba(255,255,255,0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.kanban-card-details {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-subtle);
    line-height: 1.5;
    display: none;
}

.kanban-card:hover .kanban-card-details {
    display: block;
}

.kanban-card-meta {
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-family: var(--font-mono);
}

.kanban-card-timeago {
    font-weight: 600;
}

/* Card vazio (placeholder) */
.kanban-col-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.kanban-col-empty-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}

/* ── Resumo da Esteira ───────────────────────────────────── */
.kanban-metrics {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.kanban-metric-item {
    text-align: center;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border-subtle);
    transition: background 0.2s;
}

.kanban-metric-item:hover {
    background: rgba(255,255,255,0.04);
}

.kanban-metric-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.kanban-metric-value {
    font-size: 24px;
    font-weight: 800;
    font-family: var(--font-mono);
    line-height: 1;
}

.kanban-metric-value.accent-blue   { color: var(--accent-blue); }
.kanban-metric-value.accent-purple { color: var(--accent-purple); }
.kanban-metric-value.accent-green  { color: var(--accent-green); }
.kanban-metric-value.accent-amber  { color: var(--accent-amber); }
.kanban-metric-value.accent-red    { color: var(--accent-red); }

.kanban-metric-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Loading spinner ─────────────────────────────────────── */
.kanban-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 0;
    color: var(--text-muted);
    font-size: 14px;
}

.kanban-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Responsive Kanban ───────────────────────────────────── */
@media (max-width: 768px) {
    .kanban-flow {
        flex-wrap: wrap;
        gap: 8px;
        padding: 16px;
    }
    .kanban-flow-stage {
        min-width: calc(50% - 8px);
    }
    .kanban-flow-arrow {
        display: none;
    }
    .kanban-col {
        min-width: 280px;
        width: 290px;
    }
    .kanban-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Diagnóstico de Gargalos ──────────────────────────────── */
.kanban-diagnosis {
    margin-bottom: 24px;
}

.kanban-diagnosis-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.kanban-diagnosis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.kanban-diagnosis-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: default;
}

.kanban-diagnosis-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.kanban-diagnosis-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.kanban-diagnosis-icon {
    font-size: 22px;
    line-height: 1;
}

.kanban-diagnosis-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.kanban-diagnosis-count {
    font-size: 26px;
    font-weight: 800;
    font-family: var(--font-mono);
    line-height: 1;
    margin-bottom: 4px;
}

.kanban-diagnosis-help {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.kanban-diagnosis-sample {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.kanban-diagnosis-sample-item {
    padding: 2px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Health status bar */
.kanban-health {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.kanban-health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}

.kanban-health-dot.red { background: #ef4444; }
.kanban-health-dot.amber { background: #f59e0b; }
.kanban-health-dot.green { background: #22c55e; }

.kanban-health-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
