/* =====================================================================
   PRIMEDS - Chamados | Design tokens
   Paleta: navy institucional + teal de execução (contraste com os
   status "que contam tempo"). Tipografia Inter para toda a interface,
   com uma face monoespaçada para números de chamado e métricas.
   Assinatura visual: "trilho" de 4px colorido pelo status, presente em
   cards, linhas de tabela e badges — permite escanear o andamento de
   uma fila inteira só pela cor, sem ler texto.
===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
    /* cores base */
    --color-bg: #F3F5F9;
    --color-surface: #FFFFFF;
    --color-primary: #1B2A4A;
    --color-primary-light: #2C4270;
    --color-primary-dark: #101B32;
    --color-accent: #14B8A6;
    --color-accent-dark: #0F766E;

    --color-text: #1E293B;
    --color-text-muted: #64748B;
    --color-text-inverse: #F8FAFC;
    --color-border: #E2E8F0;

    /* cores de status (mesmas do banco: status_chamado.cor) */
    --status-backlog: #94A3B8;
    --status-sla: #F59E0B;
    --status-execucao: #3B82F6;
    --status-pendente-usuario: #EAB308;
    --status-pendente-gmud: #A855F7;
    --status-pendente-externo: #EC4899;
    --status-homologacao: #6366F1;
    --status-finalizado: #22C55E;
    --status-sprint: #14B8A6;
    --status-pausado: #EF4444;

    /* layout */
    --sidebar-width: 264px;
    --topbar-height: 68px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(16, 27, 50, 0.06);
    --shadow-md: 0 8px 24px rgba(16, 27, 50, 0.08);
    --font-display: 'Inter', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }

:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* =====================================================================
   LOGIN
===================================================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

.login-brand {
    flex: 1.1;
    background: radial-gradient(circle at 20% 20%, var(--color-primary-light) 0%, var(--color-primary) 45%, var(--color-primary-dark) 100%);
    color: var(--color-text-inverse);
    padding: 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.login-brand::after {
    content: "";
    position: absolute;
    right: -120px;
    bottom: -120px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: rgba(20, 184, 166, 0.18);
}

.login-brand .logo {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 28px;
    letter-spacing: 0.5px;
}
.login-brand .logo span { color: var(--color-accent); }

.login-brand .tagline {
    font-size: 15px;
    color: rgba(248, 250, 252, 0.75);
    margin-top: 8px;
}

.login-brand .status-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-brand .status-chip {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    border-left: 3px solid var(--chip-color, var(--color-accent));
    color: rgba(248, 250, 252, 0.9);
}

.login-form-side {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.login-card {
    width: 100%;
    max-width: 360px;
}

.login-card h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px;
}

.login-card p.subtitle {
    color: var(--color-text-muted);
    font-size: 14px;
    margin: 0 0 28px;
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--color-text);
}

.field input {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    font-size: 14px;
    background: var(--color-surface);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.field input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
    outline: none;
}

.btn-primary {
    width: 100%;
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    transition: background .15s ease, transform .1s ease;
}
.btn-primary:hover { background: var(--color-primary-light); }
.btn-primary:active { transform: translateY(1px); }

.login-footnote {
    margin-top: 20px;
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
}

@media (max-width: 860px) {
    .login-page { flex-direction: column; }
    .login-brand { flex: none; padding: 36px 28px; }
    .login-brand .status-preview { display: none; }
}

/* =====================================================================
   APP SHELL (dashboard)
===================================================================== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-primary);
    color: var(--color-text-inverse);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    transition: transform .25s ease;
}

.sidebar-brand {
    padding: 22px 24px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 20px;
    letter-spacing: 0.4px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand span { color: var(--color-accent); }
.sidebar-brand small {
    display: block;
    font-weight: 500;
    font-size: 11px;
    color: rgba(248,250,252,0.55);
    letter-spacing: 0.6px;
    margin-top: 2px;
}

.sidebar-search {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-search form { position: relative; }
.sidebar-search input {
    width: 100%;
    padding: 9px 12px 9px 30px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 13px;
}
.sidebar-search input::placeholder { color: rgba(248,250,252,0.45); }
.sidebar-search input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: rgba(255,255,255,0.14);
}
.sidebar-search form::before {
    content: "🔎";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    opacity: 0.6;
    pointer-events: none;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.sidebar-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(248,250,252,0.4);
    padding: 14px 12px 6px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: rgba(248,250,252,0.75);
    margin-bottom: 2px;
    border-left: 3px solid transparent;
}

.sidebar-nav a .icon {
    width: 18px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 12px;
    opacity: 0.85;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.sidebar-nav a.active {
    background: rgba(20, 184, 166, 0.14);
    border-left-color: var(--color-accent);
    color: #fff;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 12px;
    color: rgba(248,250,252,0.5);
}

/* ---- Overlay para mobile ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 35;
}

/* ---- Área principal ---- */
.main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: var(--topbar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 20;
    gap: 16px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--color-text);
    padding: 4px;
}

.topbar h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.icon-btn {
    position: relative;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--color-text-muted);
}

.icon-btn .dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-sla);
    border: 2px solid var(--color-surface);
}

.icon-btn:hover {
    border-color: var(--color-primary, #1B2A4A);
    color: var(--color-primary, #1B2A4A);
}

.icon-btn .icon-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--status-sla, #F59E0B);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    border: 2px solid var(--color-surface);
}

.icon-btn .icon-badge.icon-badge-danger {
    background: #EF4444;
}

.icon-btn.logout:hover {
    color: var(--status-pausado);
    border-color: var(--status-pausado);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.user-chip .who { line-height: 1.2; }
.user-chip .who strong { display: block; font-size: 13px; }
.user-chip .who small { color: var(--color-text-muted); font-size: 11px; }

/* ---- Conteúdo ---- */
.content {
    padding: 24px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

.page-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.page-heading h1 {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 4px;
}
.page-heading p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 13px;
}

/* ---- Alerta de SLA (atrasados / vencendo hoje) ---- */
.attention-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    text-decoration: none;
    color: var(--color-text);
    border: 1px solid transparent;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.attention-banner:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.attention-banner.tone-danger {
    background: color-mix(in srgb, var(--status-pausado) 10%, white);
    border-color: color-mix(in srgb, var(--status-pausado) 30%, white);
}
.attention-banner.tone-warning {
    background: color-mix(in srgb, var(--status-sla) 12%, white);
    border-color: color-mix(in srgb, var(--status-sla) 32%, white);
}
.attention-icon { font-size: 18px; line-height: 1; flex-shrink: 0; }
.attention-banner.tone-danger .attention-icon { color: var(--status-pausado); }
.attention-banner.tone-warning .attention-icon { color: var(--status-sla); }
.attention-text { flex: 1; font-size: 13px; }
.attention-cta {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    color: var(--color-primary);
}

/* ---- Tag de SLA na tabela ---- */
.sla-tag {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: 999px;
    white-space: nowrap;
}
.sla-tag-danger  { background: color-mix(in srgb, var(--status-pausado) 14%, white); color: var(--status-pausado); }
.sla-tag-warning { background: color-mix(in srgb, var(--status-sla) 16%, white); color: var(--status-sla); }
.sla-tag-ok      { background: color-mix(in srgb, var(--status-finalizado) 14%, white); color: var(--status-finalizado); }

/* ---- Cards de resumo (KPIs por status) ---- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.kpi-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--kpi-color, var(--color-accent));
    display: block;
    text-decoration: none;
    color: var(--color-text);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

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

.kpi-card .kpi-label {
    font-size: 12px;
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.kpi-card .kpi-value {
    font-family: var(--font-mono);
    font-size: 28px;
    font-weight: 600;
    margin-top: 6px;
}

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

/* ---- Painel / tabela de chamados ---- */
.panel {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
    gap: 10px;
}

.panel-header h3 { margin: 0; font-size: 15px; font-weight: 700; }

.btn-outline {
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
}
.btn-outline:hover { border-color: var(--color-accent); color: var(--color-accent-dark); }

.btn-accent {
    border: none;
    background: var(--color-accent);
    color: #fff;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
}
.btn-accent:hover { background: var(--color-accent-dark); }

/* tabela responsiva */
.table-wrap {
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.table-wrap::-webkit-scrollbar { height: 9px; }
.table-wrap::-webkit-scrollbar-track { background: var(--color-bg); border-radius: 999px; }
.table-wrap::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 999px;
}
.table-wrap::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

/* =====================================================================
   Chamados | Página inteira mais compacta/fina (esquema "planilha"),
   do título até a tabela. Escopado em .chamados-compact para não afetar
   .page-heading/.kpi-grid/.tabs/.toolbar/.panel-header/.btn-accent etc.
   usados por outras telas do sistema.
===================================================================== */
.chamados-compact.content { padding-top: 14px; }

/* ---- Layout "planilha": título, KPIs, abas e filtros ficam fixos no
   alto da tela; só a grade de chamados rola (para baixo e para o lado),
   com o cabeçalho da tabela sempre visível — igual ao Excel com painéis
   congelados. Escopado em .chamados-compact para não mexer em outras
   telas que reutilizam .panel/.table-wrap num layout de página normal
   (ex.: Dashboard, onde a tabela é só uma prévia de 8 linhas). */
.chamados-compact.content {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--topbar-height));
    overflow: hidden;
}
.chamados-compact .page-heading,
.chamados-compact .alert,
.chamados-compact .kpi-grid,
.chamados-compact .tabs,
.chamados-compact .search-notice {
    flex-shrink: 0;
}
.chamados-compact .panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}
.chamados-compact .panel-header { flex-shrink: 0; }
.chamados-compact .table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.chamados-compact .page-heading { margin-bottom: 12px; align-items: center; }
.chamados-compact .page-heading h1 { font-size: 19px; }
.chamados-compact .page-heading p { font-size: 12px; }
.chamados-compact .btn-accent { padding: 7px 14px; font-size: 12.5px; }

.chamados-compact .kpi-grid { gap: 10px; margin-bottom: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.chamados-compact .kpi-card { padding: 9px 12px; border-left-width: 3px; }
.chamados-compact .kpi-card .kpi-label { font-size: 10.5px; }
.chamados-compact .kpi-card .kpi-value { font-size: 19px; margin-top: 2px; }
.chamados-compact .kpi-card .kpi-sub { font-size: 10px; margin-top: 1px; }

.chamados-compact .tabs { margin-bottom: 6px !important; gap: 6px !important; }
.chamados-compact .tabs a {
    padding: 3px 10px !important;
    font-size: 11px !important;
    border-radius: 5px !important;
}

.chamados-compact .panel-header { padding: 6px 10px; }
.chamados-compact .toolbar { gap: 6px; margin-bottom: 0; }
.chamados-compact .search-box { min-width: 160px; }
.chamados-compact .search-box input {
    padding: 4px 10px 4px 26px;
    font-size: 11.5px;
}
.chamados-compact .search-box::before {
    font-size: 10px;
    left: 9px;
}
.chamados-compact .filter-select {
    padding: 4px 22px 4px 8px;
    font-size: 11.5px;
    background-size: 13px;
}
.chamados-compact .filter-toggle {
    font-size: 11.5px;
    gap: 5px;
}
.chamados-compact .filter-toggle .switch-track {
    width: 26px;
    height: 15px;
}
.chamados-compact .filter-toggle .switch-track::before {
    width: 11px;
    height: 11px;
}
.chamados-compact .filter-toggle input:checked + .switch-track::before {
    transform: translateX(11px);
}
.chamados-compact .count-pill {
    font-size: 10.5px;
    padding: 2px 7px;
}
.chamados-compact .chip-clear {
    font-size: 10.5px;
    padding: 3px 9px;
}

table.chamados, table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}
table.chamados { min-width: 1550px; }
table.data-table { min-width: 760px; }

/* ---- Estilo "planilha" (Excel): linhas finas e grade vertical completa.
   As células ficam em uma linha só (exceto a de "Chamado", ver abaixo) —
   texto comprido não quebra a linha, o que faria a tabela crescer em
   altura; em vez disso ela cresce para o lado, ativando o scroll
   horizontal do .table-wrap quando não cabe tudo na tela. */
table.chamados th, table.data-table th {
    text-align: left;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
    padding: 5px 10px;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    white-space: nowrap;
}
table.chamados th:last-child, table.data-table th:last-child { border-right: none; }

table.chamados td, table.data-table td {
    padding: 4px 10px;
    border-bottom: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    vertical-align: middle;
    white-space: nowrap;
}
table.chamados td:last-child, table.data-table td:last-child { border-right: none; }

/* A célula "Chamado" também fica em uma linha só, igual às demais —
   badge, título e as notas de "dividido de/em" ficam lado a lado; se o
   conteúdo não couber, é a tabela inteira que cresce para o lado,
   ativando o scroll horizontal do .table-wrap, exatamente como numa
   planilha (mesmo comportamento da tabela "Chamados recentes" do
   Dashboard). Nada de wrap: altura de linha sempre fixa. */
table.chamados td.cell-chamado { white-space: nowrap; }

table.chamados tr.row-status {
    border-left: 4px solid var(--row-color, var(--color-border));
}

table.chamados tr:hover, table.data-table tr:hover { background: #FAFBFD; }

table.chamados .status-badge { padding: 2px 8px; font-size: 10.5px; }
table.chamados .ordem-input { width: 34px; height: 22px; font-size: 12px; }
table.chamados .unassigned-chip { padding: 2px 8px; font-size: 11px; }
table.chamados .sla-tag { padding: 1px 6px; font-size: 10px; }

.cell-numero { font-family: var(--font-mono); color: var(--color-text-muted); }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--badge-color) 14%, white);
    color: var(--badge-color);
    white-space: nowrap;
}
.status-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--badge-color);
}

.priority-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.analyst-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.analyst-mini .avatar { width: 20px; height: 20px; font-size: 10px; }

/* ---- Grid dupla (painel lateral com lembretes) ---- */
.two-col {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: start;
}

.reminder-item {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--color-border);
}
.reminder-item:last-child { border-bottom: none; }
.reminder-item .rdot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--color-accent); margin-top: 6px; flex-shrink: 0;
}
.reminder-item strong { font-size: 13px; display: block; }
.reminder-item span { font-size: 12px; color: var(--color-text-muted); }

/* =====================================================================
   CRUD: busca, badges, formulários em painel e modal
===================================================================== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 340px;
    min-width: 200px;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    font-size: 13px;
    background: var(--color-surface);
}

.search-box::before {
    content: "🔎";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    opacity: 0.5;
}

.badge-ativo, .badge-inativo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 999px;
    white-space: nowrap;
}
.badge-ativo { background: #DCFCE7; color: #15803D; }
.badge-inativo { background: #F1F5F9; color: #64748B; }
.badge-ativo::before, .badge-inativo::before {
    content: "";
    width: 6px; height: 6px; border-radius: 50%;
}
.badge-ativo::before { background: #22C55E; }
.badge-inativo::before { background: #94A3B8; }

.count-pill {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-radius: 999px;
    padding: 3px 10px;
}

a.count-pill {
    text-decoration: none;
    display: inline-block;
    transition: background-color .15s ease, color .15s ease;
}

a.count-pill:hover {
    background: var(--color-accent, #0F766E);
    color: #fff;
}

.row-actions { display: flex; gap: 8px; }
.row-actions a, .row-actions button {
    font-size: 12px;
    font-weight: 600;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}
.row-actions a:hover { border-color: var(--color-accent); color: var(--color-accent-dark); }
.row-actions .danger { color: var(--status-pausado); }
.row-actions .danger:hover { border-color: var(--status-pausado); }

.empty-state {
    padding: 48px 20px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 13px;
}

/* ---- Modal ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 60;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-overlay.open { display: flex; }

.modal-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--color-border);
}
.modal-header h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--color-text-muted);
    padding: 4px;
}

.modal-body { padding: 20px 22px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 22px;
    border-top: 1px solid var(--color-border);
}

.field textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    font-size: 14px;
    font-family: var(--font-body);
    resize: vertical;
    min-height: 70px;
}

/* O editor de conteúdo do artigo (#kbEditor) vem logo abaixo da barra de
   ferramentas (.kb-toolbar) — remove a borda superior pra formar um bloco
   único e contínuo com a barra. */
#kbEditor {
    border-top: none;
}

.field small.hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--color-text-muted);
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert-sucesso { background: #F0FDF4; border-color: #BBF7D0; color: #15803D; }
.alert-erro { background: #FEF2F2; border-color: #FCA5A5; color: #B91C1C; }
.alert-info { background: #EFF6FF; border-color: #BFDBFE; color: #1D4ED8; }
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .main-area { margin-left: 0; }
    .hamburger { display: inline-flex; }
    .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 576px) {
    .content { padding: 16px; }
    .topbar { padding: 0 16px; }
    .user-chip .who { display: none; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .page-heading h1 { font-size: 19px; }
}

/* =====================================================================
   REUNIÃO DIÁRIA
===================================================================== */
.meeting-toolbar-panel {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.meeting-toolbar {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
}

.field-inline {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-inline label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.field-inline input[type="date"],
.field-inline select {
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    font-size: 13px;
    font-family: var(--font-body);
    background: var(--color-surface);
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text);
    flex-direction: row;
}
.checkbox-inline input[type="checkbox"] { width: auto; margin: 0; }

.meeting-status {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ---- Reuniões (módulo avulso) ---- */
.participant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px 14px;
    max-height: 260px;
    overflow-y: auto;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg);
}
.participant-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    padding: 3px 0;
}
.participant-grid input[type="checkbox"] { width: auto; margin: 0; flex-shrink: 0; }
.participant-grid .avatar-mini {
    width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; color: #fff;
}

.meeting-card {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--color-surface);
}
.meeting-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    flex-wrap: wrap;
}
.meeting-card-header h3 { font-size: 15px; margin: 0; }
.meeting-card-meta {
    font-size: 12px;
    color: var(--color-text-muted);
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.meeting-card-obs {
    font-size: 13px;
    color: var(--color-text);
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}
.meeting-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.meeting-chip {
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}
.meeting-chip.paused { color: #B45309; border-color: #F59E0B; background: #FFFBEB; }
.meeting-chip.resumed { color: #15803D; border-color: #22C55E; background: #F0FDF4; }

/* ---- Cards de participante (quadro da reunião diária) ----
   Observação: este bloco usava a classe .participant-grid, a mesma da
   lista de checkboxes de participantes em reunioes.php (ver acima). Como
   os dois compartilhavam o nome, o max-height/overflow-y daquele outro
   componente "vazava" para cá (o navegador transforma overflow-y:visible
   em auto sempre que overflow-x não é visible), cortando os cards e
   forçando um scroll vertical indesejado além do horizontal já existente.
   Por isso o quadro agora tem sua própria classe (.board-grid): os
   analistas continuam lado a lado com scroll horizontal, mas sem nenhum
   corte/scroll vertical no conteúdo de cada card. */
.board-grid {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 18px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 14px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}
.board-grid::-webkit-scrollbar { height: 8px; }
.board-grid::-webkit-scrollbar-track { background: transparent; }
.board-grid::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 999px;
}
.board-grid::-webkit-scrollbar-thumb:hover { background: var(--color-text-muted); }

.participant-card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    flex: 0 0 360px;
    min-width: 360px;
    max-width: 360px;
}

.link-results-list {
    display: flex;
    flex-direction: column;
    max-height: 320px;
    overflow-y: auto;
}

.participant-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--color-border);
}

.participant-who {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}
.participant-who strong { font-size: 14px; }

.origin-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
}
.origin-tag.origin-lider { color: var(--color-accent-dark); }
.origin-tag.origin-emprestado { color: #A855F7; }

.presence-form { flex-shrink: 0; }

.participant-body {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.participant-footer {
    padding: 12px 18px;
    border-top: 1px solid var(--color-border);
}
.participant-footer a {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-accent-dark);
}
.participant-footer a:hover { text-decoration: underline; }

.empty-mini {
    font-size: 12px;
    color: var(--color-text-muted);
    padding: 6px 0;
}

/* ---- Linha de chamado dentro do card ---- */
.ticket-row {
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--row-color, var(--color-border));
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pause-banner {
    font-size: 11px;
    font-weight: 600;
    color: #475569;
    background: #F1F5F9;
    border: 1px dashed #94A3B8;
    border-radius: var(--radius-sm);
    padding: 5px 9px;
}

.ticket-row-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.ticket-row-title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}
.ticket-row-title a:hover { text-decoration: underline; }

.ticket-priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dot-color, var(--color-border));
    flex-shrink: 0;
}

.lineage-tag {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-radius: 999px;
    padding: 2px 8px;
}
.lineage-tag a { color: var(--color-accent-dark); }

.ticket-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.inline-form { display: inline-flex; }

.mini-select {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    font-size: 12px;
    background: var(--color-surface);
    font-family: var(--font-body);
}

.quick-comment-form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}
.quick-comment-form textarea {
    flex: 1;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    font-size: 12px;
    font-family: var(--font-body);
    resize: vertical;
}
.quick-comment-form button { white-space: nowrap; padding: 8px 12px; font-size: 12px; }

/* ---- Histórico (details/summary nativo, sem JS) ---- */
.history-details summary {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-accent-dark);
    cursor: pointer;
    list-style: none;
}
.history-details summary::-webkit-details-marker { display: none; }
.history-details summary::before { content: "▸ "; }
.history-details[open] summary::before { content: "▾ "; }

.history-body {
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-timeline {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 140px;
    overflow-y: auto;
}
.history-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.history-meta {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.history-item-comments {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 2px solid var(--color-border);
}
.history-item-comments .history-comment {
    border-top: none;
    padding-top: 0;
}

.history-lineage {
    font-size: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.history-lineage a { color: var(--color-accent-dark); }

.history-comments {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 160px;
    overflow-y: auto;
}
.history-comment {
    font-size: 12px;
    border-top: 1px solid var(--color-border);
    padding-top: 6px;
}
.history-comment strong { font-size: 12px; }

@media (max-width: 992px) {
    .participant-card {
        flex-basis: 300px;
        min-width: 300px;
        max-width: 300px;
    }
}

/* ===================================================================
   Base de Conhecimento (módulo tipo Notion: informações, dicas, links)
   Assinatura visual: cada card tem um "trilho" de 4px na cor da sua
   categoria (mesma ideia do trilho de status usado no resto do app),
   o que permite reconhecer/escanear categorias na lista só pela cor.
   =================================================================== */
.kb-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px 22px;
}
.kb-card {
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--kb-cor-fg, var(--color-accent));
    border-radius: var(--radius-md);
    background: #fff;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.kb-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.kb-card.kb-pinned {
    background: linear-gradient(180deg, #FFFBEB 0%, #fff 90px);
}
.kb-card.kb-inativo { opacity: 0.6; }
.kb-card summary {
    list-style: none;
    cursor: pointer;
    position: relative;
    padding: 16px 44px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.kb-card summary::-webkit-details-marker { display: none; }
.kb-card summary::before {
    content: '▸';
    position: absolute;
    top: 18px;
    right: 20px;
    color: var(--color-text-muted);
    transition: transform 0.15s ease;
}
.kb-card[open] summary::before { transform: rotate(90deg); }
.kb-summary-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.kb-cat-badge {
    background: var(--kb-cor-bg, #EFF6FF);
    color: var(--kb-cor-fg, #1D4ED8);
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.kb-pin-icon {
    font-size: 11.5px;
    font-weight: 600;
    color: #B45309;
}
.kb-summary-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.kb-titulo {
    font-size: 16.5px;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: -0.01em;
}
.kb-summary-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--color-text-muted);
}
.kb-tag {
    background: #F1F5F9;
    color: #475569;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 11.5px;
    font-weight: 600;
}
.kb-autor { margin-left: auto; white-space: nowrap; }
.kb-body {
    padding: 18px 22px 20px 22px;
    border-top: 1px solid var(--color-border);
}
.kb-conteudo {
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--color-text);
}

/* Títulos de seção dentro do artigo (## Texto) — mesmo espírito do
   "trilho colorido" dos cards, aplicado em miniatura ao lado do texto. */
.kb-conteudo .kb-heading,
.kb-editor .kb-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--color-primary);
    margin: 18px 0 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--color-border);
}
.kb-conteudo .kb-heading::before,
.kb-editor .kb-heading::before {
    content: '';
    width: 4px;
    height: 14px;
    border-radius: 2px;
    background: var(--kb-cor-fg, var(--color-accent));
    flex: none;
}
.kb-conteudo .kb-heading:first-child,
.kb-editor .kb-heading:first-child { margin-top: 0; }

.kb-conteudo .kb-paragrafo,
.kb-editor .kb-paragrafo { margin: 0 0 10px; }
.kb-conteudo .kb-paragrafo:last-child,
.kb-editor .kb-paragrafo:last-child { margin-bottom: 0; }

.kb-conteudo .kb-lista,
.kb-editor .kb-lista {
    margin: 4px 0 12px;
    padding-left: 4px;
    list-style: none;
}
.kb-conteudo .kb-lista li,
.kb-editor .kb-lista li {
    position: relative;
    padding-left: 18px;
    margin-bottom: 6px;
    line-height: 1.55;
}
.kb-conteudo em,
.kb-editor em {
    font-style: italic;
    color: inherit;
}

.kb-conteudo .kb-lista li::before,
.kb-editor .kb-lista li::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 8px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--kb-cor-fg, var(--color-accent));
}

/* Lista numerada (1. item) — mesma estrutura da lista com marcadores,
   mas troca a bolinha por um número via contador CSS. */
.kb-conteudo .kb-lista-numerada,
.kb-editor .kb-lista-numerada {
    counter-reset: kb-contador;
}
.kb-conteudo .kb-lista-numerada li,
.kb-editor .kb-lista-numerada li {
    counter-increment: kb-contador;
    padding-left: 22px;
}
.kb-conteudo .kb-lista-numerada li::before,
.kb-editor .kb-lista-numerada li::before {
    content: counter(kb-contador) '.';
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    border-radius: 0;
    background: none;
    color: var(--kb-cor-fg, var(--color-accent));
    font-weight: 700;
    font-size: 12.5px;
}

.kb-code {
    background: #0F172A;
    color: #E2E8F0;
    border-radius: 8px;
    padding: 12px 14px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    overflow-x: auto;
    margin: 10px 0;
    white-space: pre-wrap;
}
.kb-links {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--color-border);
    font-size: 13px;
}
.kb-links strong {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.kb-links ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.kb-links li::before { content: '🔗 '; }
.kb-links a { color: var(--color-accent-dark); font-weight: 600; text-decoration: none; }
.kb-links a:hover { text-decoration: underline; }

/* Imagens dentro do artigo (coladas/anexadas no editor) */
.kb-img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    margin: 10px 0;
    display: block;
}

/* Barra de ferramentas do editor (negrito, itálico, cor, listas,
   desfazer/refazer, imagem) — barra de ícones no estilo de um editor
   rico, com grupos separados por divisórias finas. */
.kb-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 8px;
    background: #FAFAFA;
    border: 1px solid var(--color-border);
    border-radius: 8px 8px 0 0;
    border-bottom: none;
}
.kb-toolbar-group {
    display: flex;
    align-items: center;
    gap: 2px;
}
.kb-tbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 6px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text);
    font-size: 13px;
    font-family: var(--font-body);
    cursor: pointer;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.kb-tbtn:hover {
    background: #fff;
    border-color: var(--color-border);
}
.kb-tbtn strong { font-size: 13px; }
.kb-tbtn em { font-size: 13px; }
.kb-tbtn-texto { font-size: 12px; font-weight: 600; padding: 0 10px; }
.kb-cor-icone {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.15);
    background: #E11D48;
}
.kb-cor-input-oculto {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}
.kb-tool-sep {
    width: 1px;
    height: 22px;
    background: var(--color-border);
    margin: 0 2px;
}
.kb-toolbar-swatches {
    gap: 5px;
}
.kb-swatch {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1px solid rgba(0,0,0,0.1);
    cursor: pointer;
    padding: 0;
    box-shadow: 0 1px 2px rgba(16,27,50,0.08);
    transition: transform 0.12s ease;
}
.kb-swatch:hover { transform: scale(1.12); }
.kb-upload-status {
    margin-left: auto;
    font-size: 12px;
    color: var(--color-text-muted);
    padding: 0 4px;
}

.kb-formatacao-ajuda {
    margin-top: 8px;
    padding: 10px 12px;
    background: #FAFAFA;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 11.5px;
    color: var(--color-text-muted);
    line-height: 1.6;
}
.kb-formatacao-ajuda strong { color: var(--color-text); }
.kb-formatacao-ajuda ul {
    margin: 6px 0 4px 18px;
    padding: 0;
}
.kb-formatacao-ajuda li { margin-bottom: 2px; }
.kb-formatacao-ajuda code {
    background: #EEF2F7;
    border-radius: 4px;
    padding: 1px 5px;
    font-family: var(--font-mono);
    font-size: 11px;
}

/* Campo de edição WYSIWYG (contenteditable) — substitui a antiga dupla
   textarea + pré-visualização: o que se vê aqui é o que fica salvo. */
.kb-editor {
    margin-top: 0;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: 0 0 8px 8px;
    background: #fff;
    min-height: 180px;
    max-height: 420px;
    overflow-y: auto;
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--color-text);
}
.kb-editor:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.kb-editor:empty::before,
.kb-editor:has(> p:only-child > br:only-child)::before {
    content: attr(data-placeholder);
    color: var(--color-text-muted);
    font-style: italic;
    pointer-events: none;
}
.kb-editor p { margin: 0 0 10px; }
.kb-editor p:last-child { margin-bottom: 0; }
.kb-editor ul, .kb-editor ol { margin: 4px 0 12px; padding-left: 22px; }
.kb-editor li { margin-bottom: 4px; }

/* Tabelas inseridas pelo editor (botão "Tabela") e exibidas no artigo final. */
.kb-conteudo .kb-table,
.kb-editor .kb-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 13px;
}
.kb-conteudo .kb-table th,
.kb-conteudo .kb-table td,
.kb-editor .kb-table th,
.kb-editor .kb-table td {
    border: 1px solid var(--color-border);
    padding: 7px 10px;
    text-align: left;
    vertical-align: top;
}
.kb-conteudo .kb-table th,
.kb-editor .kb-table th {
    background: #FAFAFA;
    font-weight: 700;
    color: var(--color-primary);
}
.kb-conteudo .kb-table tr:nth-child(even) td,
.kb-editor .kb-table tr:nth-child(even) td {
    background: #FCFCFB;
}
.kb-editor .kb-table td:focus,
.kb-editor .kb-table th:focus { outline: 2px solid var(--color-accent); outline-offset: -2px; }

/* Grupo de botões "+ Linha / − Linha / + Coluna / − Coluna" — só aparece
   na barra de ferramentas quando o cursor está dentro de uma tabela. */
.kb-toolbar-tabela-acoes { gap: 3px; }

/* Seletor de tamanho da tabela (grade estilo Word/Google Docs) */
.kb-toolbar-tabela { position: relative; }
.kb-grid-picker {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 20;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(16, 27, 50, 0.14);
    padding: 10px;
}
.kb-grid-picker-cells {
    display: grid;
    grid-template-columns: repeat(10, 16px);
    grid-template-rows: repeat(8, 16px);
    gap: 3px;
}
.kb-grid-cell {
    width: 16px;
    height: 16px;
    border: 1px solid var(--color-border);
    border-radius: 2px;
    background: #FAFAFA;
}
.kb-grid-cell-ativa {
    background: var(--color-accent);
    border-color: var(--color-accent-dark);
}
.kb-grid-picker-label {
    margin-top: 8px;
    font-size: 12px;
    text-align: center;
    color: var(--color-text-muted);
}

/* =====================================================================
   Chamados | Redesign profissional (listagem + modal)
   Inspirado nos grandes sistemas de chamados (Linear, Jira Service
   Desk, Zendesk): cartões de estatística clicáveis no topo, filtros
   compactos com visual de "chip", linha inteira clicável na tabela,
   chips coloridos consistentes e um modal em duas colunas para o
   formulário de abertura/edição.
===================================================================== */

/* ---- Filtros: selects e toggle ---- */
.filter-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 9px 30px 9px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    font-size: 13px;
    font-weight: 500;
    background-color: var(--color-surface);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2364748B' stroke-width='2'%3E%3Cpath d='M5 8l5 5 5-5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    color: var(--color-text);
    cursor: pointer;
    transition: border-color .12s ease;
}
.filter-select:hover { border-color: var(--color-accent); }
.filter-select:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 18%, transparent); }

.filter-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
}
.filter-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.filter-toggle .switch-track {
    width: 34px;
    height: 20px;
    border-radius: 999px;
    background: var(--color-border);
    position: relative;
    flex-shrink: 0;
    transition: background-color .15s ease;
}
.filter-toggle .switch-track::before {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(16,27,50,.25);
    transition: transform .15s ease;
}
.filter-toggle input:checked + .switch-track { background: var(--color-accent); }
.filter-toggle input:checked + .switch-track::before { transform: translateX(14px); }
.filter-toggle input:focus-visible + .switch-track { outline: 2px solid var(--color-accent); outline-offset: 2px; }

.chip-clear {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 6px 12px;
    text-decoration: none;
    white-space: nowrap;
}
.chip-clear:hover { border-color: var(--status-pausado); color: var(--status-pausado); }

/* ---- Tabela: cabeçalho fixo e linha inteira clicável ---- */
table.chamados thead th {
    position: sticky;
    top: 0;
    background: var(--color-surface);
    z-index: 2;
}
table.chamados tr.row-clickable { cursor: pointer; }
table.chamados tr.row-status td { transition: background-color .1s ease; }

.ticket-id-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-radius: 5px;
    padding: 2px 6px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}
.ticket-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--color-text);
    display: inline;
    vertical-align: middle;
}
tr.row-clickable:hover .ticket-title { color: var(--color-accent-dark); }

/* Notas curtas ao lado do título (chamado pai/filhos) — ícone discreto
   com o detalhe completo em tooltip (title=""), em vez de uma linha
   extra abaixo do título (o que quebrava o padrão de linha única). */
.ticket-flag {
    display: inline-block;
    margin-left: 8px;
    font-size: 11px;
    color: var(--color-text-muted);
    vertical-align: middle;
    white-space: nowrap;
    cursor: help;
}
.ticket-flag:hover { color: var(--color-accent-dark); }

.unassigned-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #B45309;
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    border-radius: 999px;
    padding: 4px 10px;
    white-space: nowrap;
}

.sla-inline {
    display: inline-flex;
    margin-left: 6px;
    vertical-align: middle;
}

/* ---- Toast de confirmação para os salvamentos via AJAX (Reunião
   Diária): substitui a faixa de flash da página, já que essas ações
   não recarregam mais a tela. ---- */
.ajax-toast-container {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.ajax-toast {
    min-width: 220px;
    max-width: 360px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    box-shadow: var(--shadow-md);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity .18s ease, transform .18s ease;
}
.ajax-toast.show { opacity: 1; transform: translateY(0); }
.ajax-toast-sucesso { background: #16A34A; }
.ajax-toast-erro { background: #DC2626; }

/* ---- Ações da linha: ícones que só aparecem no hover (padrão Linear/GitHub) ---- */
.row-actions-icon { display: flex; gap: 6px; opacity: 0; transition: opacity .1s ease; }
tr:hover .row-actions-icon, tr:focus-within .row-actions-icon { opacity: 1; }
.row-actions-icon a, .row-actions-icon button {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 13px;
    line-height: 1;
}
.row-actions-icon a:hover { border-color: var(--color-accent); color: var(--color-accent-dark); background: color-mix(in srgb, var(--color-accent) 8%, white); }
.row-actions-icon .danger:hover { border-color: var(--status-pausado); color: var(--status-pausado); background: color-mix(in srgb, var(--status-pausado) 8%, white); }

/* ---- Estado vazio "pro": ícone + texto + call-to-action ---- */
.empty-state-pro {
    padding: 56px 24px;
    text-align: center;
}
.empty-state-pro .empty-icon {
    font-size: 32px;
    margin-bottom: 10px;
    opacity: .5;
}
.empty-state-pro strong {
    display: block;
    font-size: 14px;
    color: var(--color-text);
    margin-bottom: 4px;
}
.empty-state-pro span {
    display: block;
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

/* ---- Modal do chamado: duas colunas em telas largas ---- */
.modal-card-chamado { max-width: 640px; }
@media (min-width: 860px) {
    #modalChamado .modal-card.modal-card-chamado {
        max-width: 860px;
    }
    .form-grid-2 {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 20px;
    }
    .form-grid-2 .field-span-2 { grid-column: 1 / -1; }
}

.section-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--color-text-muted);
    margin: 22px 0 10px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}
.section-heading:first-child { margin-top: 0; padding-top: 0; border-top: none; }

/* ---- Seletor de prioridade em pílulas (substitui o <select>) ---- */
.priority-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.priority-picker label { position: relative; display: inline-flex; }
.priority-picker input { position: absolute; opacity: 0; width: 0; height: 0; }
.priority-picker .pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1.5px solid var(--color-border);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all .12s ease;
}
.priority-picker .pill::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--pill-color, var(--color-text-muted));
}
.priority-picker input:checked + .pill {
    border-color: var(--pill-color, var(--color-accent));
    color: var(--pill-color, var(--color-accent));
    background: color-mix(in srgb, var(--pill-color, var(--color-accent)) 10%, white);
}
.priority-picker input:focus-visible + .pill { outline: 2px solid var(--color-accent); outline-offset: 2px; }
