/* Identidade visual ISPCode sobre o Tabler */
:root {
    --tblr-font-sans-serif: 'Inter Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --tblr-primary: #0b5ed7;
    --tblr-primary-rgb: 11, 94, 215;
    --isp-sidebar: #0f1b2d;
}
body { font-feature-settings: "cv03", "cv04", "cv11"; }

.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: .5rem;
    background: linear-gradient(135deg, #0b5ed7, #22b8cf); color: #fff; font-size: 1.15rem;
}
.brand-text { font-size: 1.15rem; letter-spacing: -.01em; font-weight: 500; color: inherit; }
.navbar-vertical { background: var(--isp-sidebar) !important; }
.navbar-vertical .nav-item.active > .nav-link { background: rgba(255,255,255,.07); border-radius: .375rem; }
.topbar { background: var(--tblr-bg-surface); border-bottom: 1px solid var(--tblr-border-color); }
.topbar-search { min-width: 320px; }
.portal-navbar { background: var(--isp-sidebar) !important; }
.auth-page { background: radial-gradient(1200px 600px at 10% -10%, rgba(11,94,215,.18), transparent), var(--tblr-bg-surface-secondary); }

/* Tema: ícones do botão */
[data-bs-theme="dark"] .theme-icon-light, [data-bs-theme="light"] .theme-icon-dark { display: none; }

/* KPIs */
.kpi .kpi-icon { width: 2.75rem; height: 2.75rem; border-radius: .6rem; display:flex; align-items:center; justify-content:center; font-size: 1.35rem; }

/* Kanban */
/* 6 colunas de mesma largura (1/6 ≈ 16,66% cada), sem rolagem horizontal */
.kanban { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .75rem; width: 100%; }
@media (max-width: 1399.98px) { .kanban { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767.98px)  { .kanban { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px)  { .kanban { grid-template-columns: minmax(0, 1fr); } }
.kanban-column { min-width: 0; background: var(--tblr-bg-surface-secondary); border: 1px solid var(--tblr-border-color); border-radius: .6rem; display: flex; flex-direction: column; min-height: calc(100vh - 290px); }
@media (max-width: 1399.98px) { .kanban-column { min-height: 240px; } }
.kanban-column-header { padding: .75rem .85rem; display: flex; align-items: center; gap: .5rem; border-bottom: 1px solid var(--tblr-border-color); position: sticky; top: 0; }
.kanban-column-header .dot { width: .6rem; height: .6rem; border-radius: 50%; }
.kanban-column-header strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kanban-list { padding: .6rem; display: flex; flex-direction: column; gap: .6rem; flex: 1; min-height: 120px; }
.kanban-card { min-width: 0; overflow-wrap: anywhere; cursor: grab; border-left: 3px solid transparent; transition: box-shadow .15s, transform .15s; }
.kanban-card:hover { box-shadow: var(--tblr-box-shadow-card-hover, 0 2px 8px rgba(0,0,0,.08)); transform: translateY(-1px); }
.kanban-card.prio-urgente { border-left-color: var(--tblr-red); }
.kanban-card.prio-alta { border-left-color: var(--tblr-orange); }
.kanban-card.prio-normal { border-left-color: var(--tblr-blue); }
.kanban-card.prio-baixa { border-left-color: var(--tblr-gray-400); }
.kanban-ghost { opacity: .4; }
.kanban-chosen { cursor: grabbing; }

/* Timeline da OS */
.timeline-event.internal .card { border-style: dashed; background: var(--tblr-yellow-lt); }

/* Acessos do equipamento */
.access-row { border: 1px solid var(--tblr-border-color); border-radius: .5rem; padding: 1rem; position: relative; }
.access-row + .access-row { margin-top: .75rem; }
.secret-value { font-family: var(--tblr-font-monospace); }
.htmx-request .htmx-hide-on-request { display: none; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-block; }
.table-row-link { cursor: pointer; }

/* Cabeçalho do cartão quebra linha em colunas estreitas */
.kanban-card .card-body { padding: .65rem .75rem; }
.kanban-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; }
.kanban-card-head .badge { margin-left: auto; }
.kanban-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; }
.kanban-card-foot .kanban-when { margin-left: auto; white-space: nowrap; }

/* Tom Select: ao digitar, esconde o item selecionado para não misturar com a busca */
.ts-wrapper.single.input-active .ts-control .item { display: none; }
.ts-wrapper .clear-button { opacity: .6; }
.ts-dropdown .no-results { padding: .5rem .75rem; color: var(--tblr-secondary); }

/* Kanban do portal: cartões são links, sem arrastar */
.kanban-readonly .kanban-card { cursor: pointer; }
.kanban-readonly .kanban-card:focus-visible { outline: 2px solid var(--tblr-primary); outline-offset: 2px; }

/* =====================================================================
   Gráficos (dataviz) — cores validadas por validate_palette.js:
   claro: #257de0 / #f47230 sobre #ffffff · escuro: #338ced / #e76624 sobre o card escuro
   ===================================================================== */
.viz {
    --viz-series-1: #257de0;
    --viz-series-2: #f47230;
    --viz-ink: #191919;
    --viz-ink-2: #666666;
    --viz-grid: #e7e7e7;
    --viz-axis: #c2c2c2;
    --viz-meter-track: #cce3fd;
    --viz-tip-bg: #ffffff;
}
[data-bs-theme="dark"] .viz {
    --viz-series-1: #338ced;
    --viz-series-2: #e76624;
    --viz-ink: #efefef;
    --viz-ink-2: #9c9c9c;
    --viz-grid: #303030;
    --viz-axis: #474747;
    --viz-meter-track: #0e3d7e;
    --viz-tip-bg: #262626;
}
.viz-tick { fill: var(--viz-ink-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.viz-fill-1 { fill: var(--viz-series-1); background: var(--viz-series-1); }
.viz-fill-2 { fill: var(--viz-series-2); background: var(--viz-series-2); }

/* Colunas agrupadas: eixo Y | área do gráfico; rótulos do eixo X embaixo */
.viz-col-chart { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: 240px auto; column-gap: .5rem; }
.viz-col-axis { grid-row: 1; display: flex; flex-direction: column; justify-content: space-between; text-align: right;
    color: var(--viz-ink-2); font-size: 12px; font-variant-numeric: tabular-nums; line-height: 1; margin: -6px 0; }
.viz-col-plot { grid-row: 1; grid-column: 2; position: relative; display: flex; align-items: stretch; }
.viz-col-grid, .viz-col-baseline { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--viz-grid); }
.viz-col-baseline { border-top-color: var(--viz-axis); }
.viz-col-band { position: relative; flex: 1 1 0; display: flex; justify-content: center; align-items: flex-end; gap: 2px; outline: none; border-radius: 4px; }
.viz-col-band:hover, .viz-col-band:focus-visible { background: color-mix(in srgb, var(--viz-ink) 4%, transparent); }
.viz-col-band:focus-visible { box-shadow: inset 0 0 0 1px var(--viz-axis); }
.viz-col { width: min(24px, 30%); border-radius: 4px 4px 0 0; display: block; }
.viz-col-band:hover .viz-col, .viz-col-band:focus-visible .viz-col { filter: brightness(1.12); }
.viz-col-labels { grid-row: 2; grid-column: 2; display: flex; padding-top: .4rem; }
.viz-col-labels span { flex: 1 1 0; text-align: center; color: var(--viz-ink-2); font-size: 12px; white-space: nowrap; }
.viz-delta .viz-figure { font-size: 1.25rem; }
.viz-legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8125rem; color: var(--viz-ink-2); margin-bottom: .5rem; }
.viz-legend-item { display: inline-flex; align-items: center; gap: .4rem; }
.viz-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.viz-table summary { cursor: pointer; }

/* Barras horizontais: base reta à esquerda, ponta de dados arredondada (4px), espessura 12px */
.viz-hbars { display: grid; gap: .55rem; }
.viz-hbar-row { display: grid; grid-template-columns: minmax(0, 9rem) minmax(0, 1fr); align-items: center; gap: .75rem; border-radius: 4px; outline: none; }
.viz-hbar-row:focus-visible { box-shadow: 0 0 0 2px var(--viz-axis); }
.viz-hbar-label { color: var(--viz-ink-2); font-size: .8125rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viz-hbar-track { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.viz-hbar { height: 12px; border-radius: 0 4px 4px 0; display: block; min-width: 2px; }
.viz-hbar-row:hover .viz-hbar { filter: brightness(1.12); }
.viz-hbar-value { color: var(--viz-ink); font-weight: 600; font-size: .8125rem; font-variant-numeric: tabular-nums; }

/* Medidor: trilho em tom claro da mesma rampa azul */
.viz-figure { font-size: 1.5rem; font-weight: 600; color: var(--viz-ink); }
.viz-meter-track { height: 8px; border-radius: 4px; background: var(--viz-meter-track); margin-top: .35rem; overflow: hidden; }
.viz-meter-fill { display: block; height: 100%; border-radius: 4px; background: var(--viz-series-1); }

/* Tooltip: valor em destaque, nome secundário, chave em linha curta da cor da série */
.viz-tooltip { position: fixed; z-index: 1080; pointer-events: none; background: var(--viz-tip-bg, #fff); color: var(--viz-ink, #191919);
    border: 1px solid rgba(11,11,11,.10); border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.12); padding: .5rem .65rem; font-size: .8125rem; min-width: 9rem; }
[data-bs-theme="dark"] .viz-tooltip { border-color: rgba(255,255,255,.10); }
.viz-tooltip-title { color: var(--viz-ink-2, #666); margin-bottom: .25rem; }
.viz-tooltip-row { display: flex; align-items: center; gap: .5rem; }
.viz-tooltip-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.viz-tooltip-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.viz-tooltip-name { color: var(--viz-ink-2, #666); }
