/* ============================================================
   Catalogs Chamados — design system
   Aplica os tokens e componentes do mockup "Catalogs Chamados"
   sobre as classes já usadas pelo app (sem mudar a marcação).
   ============================================================ */
:root {
    --cat-orange: #f58634;
    --cat-orange-600: #e47628;
    --cat-orange-700: #c65e18;
    --cat-orange-100: #fde3cf;
    --cat-orange-50: #fff4ea;
    --cat-ink: #606062;
    --cat-ink-900: #2c2c2e;
    --cat-ink-700: #4a4a4c;
    --cat-paper: #fafafa;
    --cat-surface-alt: #f4f4f5;
    --cat-border: #e4e4e7;
    --cat-border-strong: #c9c9cf;
    --cat-muted: #8a8a8e;
    --cat-muted-2: #a3a3a8;
    --cat-success: #3fae6a;
    --cat-warning: #f5b634;
    --cat-danger: #d84848;
    --cat-info: #3a7bd5;
    --font: 'Nunito Sans', system-ui, -apple-system, sans-serif;
    --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --sh1: 0 1px 2px rgba(44,44,46,.06), 0 1px 1px rgba(44,44,46,.04);
    --sh2: 0 4px 12px rgba(44,44,46,.08), 0 2px 4px rgba(44,44,46,.04);
    --sh3: 0 24px 60px rgba(31,31,33,.28), 0 8px 20px rgba(31,31,33,.14);

    /* aliases legados usados no app */
    --brand: var(--cat-orange);
    --brand-dark: var(--cat-orange-700);
    --ink: var(--cat-ink-900);
    --muted: var(--cat-muted);
    --border: var(--cat-border);
    --bg: #eef0f4;
    --card: #ffffff;
}

html, body { font-family: var(--font); }
body { background: var(--cat-paper); color: var(--cat-ink); }

/* ---------- Shell / nav ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
    display: flex; align-items: center; gap: 1.4rem;
    padding: 0 1.75rem; height: 62px;
    background: #fff; border-bottom: 1px solid var(--cat-border);
    position: sticky; top: 0; z-index: 10;
}
.app-header .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.app-header .brand img { height: 30px; display: block; }
.app-header .brand .logo-light { display: none; }
.app-header .brand .logo-dark { display: block; }
:root[data-theme="light"] .app-header .brand .logo-light { display: block; }
:root[data-theme="light"] .app-header .brand .logo-dark { display: none; }
.brand-tag { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--cat-muted); border-left: 1px solid var(--cat-border); padding-left: 10px; }

.app-nav { display: flex; gap: 4px; margin-right: auto; }
.app-nav .nav-item {
    padding: 8px 15px; border-radius: 8px; color: var(--cat-ink);
    text-decoration: none; font-weight: 700; font-size: 13.5px;
}
.app-nav .nav-item:hover { background: var(--cat-surface-alt); }
.app-nav .nav-item.active { background: var(--cat-orange-50); color: var(--cat-orange-700); }

.user-box { position: relative; display: flex; align-items: center; }
.user-trigger { display: flex; align-items: center; gap: 10px; background: none; border: 1px solid transparent; cursor: pointer; padding: 5px 8px; border-radius: 9px; font-family: var(--font); }
.user-trigger:hover { background: var(--cat-surface-alt); }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; text-align: right; }
.user-name { font-weight: 800; font-size: 13.5px; color: var(--cat-ink-900); }
.user-role { font-size: 11px; color: var(--cat-muted); }
.user-caret { font-size: 8px; color: var(--cat-muted); }
.user-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 50; background: #fff; border: 1px solid var(--cat-border); border-radius: 10px; box-shadow: var(--sh3); padding: 5px; min-width: 190px; }
.user-menu-item { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; padding: 9px 12px; border-radius: 7px; cursor: pointer; font-family: var(--font); font-size: 13px; font-weight: 700; color: var(--cat-ink-700); text-align: left; text-decoration: none; }
.user-menu-item:hover { background: var(--cat-orange-50); color: var(--cat-ink-900); }
.user-menu-item.danger:hover { background: #fbe0e0; color: #9c2a2a; }
.user-menu-sep { height: 1px; background: var(--cat-border); margin: 5px 6px; }
.btn-logout {
    border: 1px solid var(--cat-border); background: #fff; color: var(--cat-ink-700);
    padding: 8px 14px; border-radius: 8px; font-weight: 800; font-size: 12.5px;
    font-family: var(--font); cursor: pointer;
}
.btn-logout:hover { background: #fbe0e0; border-color: #f0b4b4; color: #9c2a2a; }

.app-main { padding: 26px 40px 60px; width: 100%; }
.redirecting { padding: 3rem; text-align: center; color: var(--cat-muted); }

/* ---------- Headings / breadcrumbs ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 1rem; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; color: var(--cat-ink-900); margin: 0; letter-spacing: .01em; }
.crumbs { font-size: 12.5px; color: var(--cat-muted); margin-bottom: 12px; font-weight: 600; }
.crumbs a { color: var(--cat-orange); text-decoration: none; font-weight: 700; }

/* ---------- Cards / tiles ---------- */
.card { background: #fff; border: 1px solid var(--cat-border); border-radius: 12px; padding: 22px 24px; box-shadow: var(--sh1); color: var(--cat-ink); }
/* visão somente-leitura da tarefa: valores dos campos (label .user-role + valor sem classe) */
.card .form-grid > div > div { color: var(--cat-ink-900); font-weight: 700; font-size: 14px; }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.tile { background: #fff; border: 1px solid var(--cat-border); border-radius: 12px; padding: 22px; box-shadow: var(--sh1); transition: .15s; display: block; }
.tile:hover { border-color: var(--cat-orange); box-shadow: var(--sh2); transform: translateY(-1px); }
.tile-link { text-decoration: none; color: inherit; display: block; }
.tile h3 { margin: 0 0 4px; font-size: 16.5px; font-weight: 800; color: var(--cat-ink-900); }
.tile .sub { color: var(--cat-orange); font-size: 13px; font-weight: 700; }
.tile-actions { display: flex; gap: 8px; margin-top: 14px; border-top: 1px solid var(--cat-surface-alt); padding-top: 14px; }
/* avatar de iniciais + subtítulo + estatísticas nos cards de cliente/lista */
.tile-head { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 14px; }
.tile-head h3 { margin: 0; }
.mono-av { width: 44px; height: 44px; border-radius: 10px; background: var(--cat-orange-50); color: var(--cat-orange-700); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; flex-shrink: 0; }
.tile-sub { font-size: 12.5px; color: var(--cat-muted); margin-top: 3px; }
.tile-stats { display: flex; gap: 20px; margin-bottom: 14px; }
.tstat b { font-size: 20px; font-weight: 800; color: var(--cat-ink-900); display: block; line-height: 1; }
.tstat span { font-size: 10.5px; color: var(--cat-muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }

/* ---------- Buttons ---------- */
.btn { font-family: var(--font); font-weight: 800; font-size: 12.5px; letter-spacing: .03em; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.btn-primary { background: var(--cat-orange); color: #fff; box-shadow: var(--sh1); }
.btn-primary:hover { background: var(--cat-orange-600); }
.btn-ghost { background: #fff; color: var(--cat-ink-700); border-color: var(--cat-border); }
.btn-ghost:hover { background: var(--cat-surface-alt); }
.btn-danger { background: var(--cat-danger); color: #fff; }
.btn-danger:hover { background: #c23c3c; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ---------- Forms ---------- */
.form-row { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.form-row label { font-weight: 800; font-size: 12px; color: var(--cat-ink-700); letter-spacing: .02em; }
.form-row input, .form-row select, .form-row textarea {
    border: 1px solid var(--cat-border); border-radius: 9px; padding: 11px 13px;
    font-size: 14px; font-family: var(--font); color: var(--cat-ink-900); background: #fff;
}
.form-row input::placeholder, .form-row textarea::placeholder { color: var(--cat-muted-2); }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
    outline: none; border-color: var(--cat-orange); box-shadow: 0 0 0 3px rgba(245,134,52,.18);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 28px; }

/* busca */
.search-bar { display: flex; gap: 10px; align-items: center; }
.search-input, .search-client {
    border: 1px solid var(--cat-border); border-radius: 9px; padding: 10px 13px;
    font-size: 14px; font-family: var(--font); color: var(--cat-ink-900); background: #fff;
}
.search-input { flex: 1; min-width: 0; }
.search-input::placeholder { color: var(--cat-muted-2); }
.search-input:focus, .search-client:focus {
    outline: none; border-color: var(--cat-orange); box-shadow: 0 0 0 3px rgba(245,134,52,.18);
}
.search-inline { flex: 0 0 auto; width: 230px; padding: 8px 12px; font-size: 13px; }

/* formulários de tarefa (criar/editar) mais compactos — escopo em .card p/ não mexer no login */
.card .form-grid { gap: 0 24px; }
.card .form-row { margin-bottom: 10px; gap: 4px; }
.card .form-row label { font-size: 11.5px; }
.card .form-row input, .card .form-row select, .card .form-row textarea { padding: 8px 11px; font-size: 13.5px; }
.card .form-row textarea { height: auto; }

/* ---------- Alerts ---------- */
.alert { padding: 11px 14px; border-radius: 9px; font-size: 13px; margin-bottom: 14px; font-weight: 600; }
.alert-error { background: #fbe0e0; color: #9c2a2a; border: 1px solid #f0b4b4; }
.alert-ok { background: #e3f5ea; color: #1f7a44; border: 1px solid #a7dcbc; }

/* ---------- Tags / badges ---------- */
.badge { display: inline-flex; align-items: center; justify-content: center; padding: 4px 10px; border-radius: 999px; font-size: 10.5px; font-weight: 800; line-height: 1; letter-spacing: .03em; text-transform: uppercase; }
/* tipo */
.badge-type-feature { background: #eef3fc; color: #2b5aa8; }
.badge-type-bug { background: #fbe0e0; color: #9c2a2a; }
/* prioridade: 0 baixa · 1 média · 2 alta · 3 crítica */
.badge-prio-0 { background: var(--cat-surface-alt); color: var(--cat-ink); }
.badge-prio-1 { background: var(--cat-orange-50); color: var(--cat-orange-700); }
.badge-prio-2 { background: #fbe0e0; color: #9c2a2a; }
.badge-prio-3 { background: #d84848; color: #fff; }
/* status pill (spill) */
.badge-status { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; background: var(--cat-surface-alt); color: var(--cat-ink-900); font-size: 10.5px; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
/* badge de status clicável (detalhe da tarefa): abre o popover de troca de status */
.status-badge-btn { border: 0; cursor: pointer; font-family: var(--font); line-height: 1; }
.status-badge-btn:hover { filter: brightness(.96); }
.status-badge-btn:disabled { cursor: default; opacity: .7; }
.status-badge-btn .status-badge-caret { font-size: 9px; color: var(--cat-muted); margin-left: 1px; }
.badge-mine { background: #e3f5ea; color: #1f7a44; margin-left: .4rem; }
.badge-unassigned { background: #fdecd2; color: #9a5b00; margin-left: .4rem; }
.pill-count { font-size: 11px; color: var(--cat-muted); margin-left: .4rem; font-family: var(--mono); font-weight: 700; }
.cell-sub { font-weight: 800; font-size: 13px; color: var(--cat-ink-900); }
.cell-sub2 { font-size: 12px; color: var(--cat-muted); }

/* status dots (usados no cabeçalho dos grupos e no kanban) */
.status-dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; display: inline-block; }
.sd-0 { background: #94a3b8; } .sd-1 { background: #ea580c; } .sd-2 { background: #fbbf24; }
.sd-3 { background: #2563eb; } .sd-4 { background: #0ea5e9; } .sd-5 { background: #eab308; }
.sd-6 { background: #ef4444; } .sd-7 { background: #06b6d4; } .sd-8 { background: #14b8a6; }
.sd-9 { background: #22c55e; } .sd-10 { background: #15803d; } .sd-11 { background: #dc2626; }

/* ---------- Tables ---------- */
.tbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
.tbl th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--cat-muted); padding: 11px 18px; font-weight: 800; background: var(--cat-paper); border-bottom: 1px solid var(--cat-border); }
.tbl td { padding: 14px 18px; border-bottom: 1px solid var(--cat-surface-alt); font-size: 13.5px; vertical-align: middle; color: var(--cat-ink-700); }
.tbl tbody tr:nth-child(even) td { background: var(--cat-paper); }
.tbl tr:last-child td { border-bottom: none; }
.tbl td strong { color: var(--cat-ink-900); font-weight: 700; }
.tbl tr.clickable:hover td { background: var(--cat-orange-50); cursor: pointer; }
.tbl .num { text-align: right; font-family: var(--mono); white-space: nowrap; }
.tbl tfoot td { background: var(--cat-paper); border-top: 1px solid var(--cat-border); border-bottom: none; font-weight: 800; color: var(--cat-ink-900); font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Relatório de horas ---------- */
.report-total { display: flex; gap: 40px; flex-wrap: wrap; }
.report-total-value { font-family: var(--mono); font-size: 26px; font-weight: 800; color: var(--cat-ink-900); line-height: 1.2; }
.report-month { margin-bottom: 1rem; padding: 0; overflow: hidden; }
.report-month-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 24px; }
.report-month-head h3 { margin: 0; font-size: 15px; letter-spacing: .02em; }
.report-subtotal { font-size: 12.5px; color: var(--cat-muted); font-weight: 700; }
.report-subtotal strong { font-family: var(--mono); color: var(--cat-ink-900); }
.report-month .tbl { border-radius: 0; border-top: 1px solid var(--cat-border); }

/* ---------- Quick status (bolinha clicável na tabela) ---------- */
.task-cell { display: flex; align-items: center; gap: 10px; }
.status-dot-btn { border: 0; background: none; padding: 5px; margin: -5px; cursor: pointer; display: inline-flex; align-items: center; border-radius: 6px; line-height: 0; }
.status-dot-btn:hover { background: var(--cat-surface-alt); }
.status-dot-btn .status-dot { width: 12px; height: 12px; }
.menu-backdrop { position: fixed; inset: 0; z-index: 40; }
.status-menu { position: fixed; z-index: 50; background: #fff; border: 1px solid var(--cat-border); border-radius: 10px; box-shadow: var(--sh3); padding: 5px; min-width: 230px; max-height: 340px; overflow-y: auto; }
.status-menu-item { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-family: var(--font); font-size: 13px; font-weight: 700; color: var(--cat-ink-700); text-align: left; }
.status-menu-item:hover { background: var(--cat-orange-50); color: var(--cat-ink-900); }
.status-menu-item.current { color: var(--cat-ink-900); }
.status-menu-item .lbl { flex: 1; }
.status-menu-item .check { color: var(--cat-orange-700); font-weight: 800; }

/* ---------- Status groups ---------- */
.status-groups { display: flex; flex-direction: column; gap: 16px; }
.status-group { background: #fff; border: 1px solid var(--cat-border); border-radius: 12px; box-shadow: var(--sh1); overflow: hidden; }
.status-group-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; user-select: none; }
.status-group-head:hover { background: var(--cat-paper); }
.status-group-head.static { cursor: default; }
.status-group-head.static:hover { background: transparent; }
.status-group-head .group-client { font-weight: 800; font-size: 14.5px; color: var(--cat-ink-900); }
.status-group-head .chevron { color: var(--cat-muted); font-size: 11px; width: 12px; }
.status-group-head .group-count { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--cat-muted); background: var(--cat-surface-alt); border-radius: 999px; padding: 2px 10px; font-weight: 700; }

/* Cabeçalho dos grupos por status (visão Tabela): faixa tingida pela cor do
   status + contador em pílula escura destacada. Escopo por :has(.badge-status)
   p/ não afetar o cabeçalho de cliente do Painel. */
.status-group-head:has(.badge-status) { background-color: var(--cat-surface-alt); }
.status-group-head:has(.badge-status):hover { background-color: var(--cat-border); }
.status-group-head:has(.sd-0)  { background-image: linear-gradient(90deg, #94a3b822, transparent 70%); }
.status-group-head:has(.sd-1)  { background-image: linear-gradient(90deg, #ea580c22, transparent 70%); }
.status-group-head:has(.sd-2)  { background-image: linear-gradient(90deg, #fbbf2422, transparent 70%); }
.status-group-head:has(.sd-3)  { background-image: linear-gradient(90deg, #2563eb22, transparent 70%); }
.status-group-head:has(.sd-4)  { background-image: linear-gradient(90deg, #0ea5e922, transparent 70%); }
.status-group-head:has(.sd-5)  { background-image: linear-gradient(90deg, #eab30822, transparent 70%); }
.status-group-head:has(.sd-6)  { background-image: linear-gradient(90deg, #ef444422, transparent 70%); }
.status-group-head:has(.sd-7)  { background-image: linear-gradient(90deg, #06b6d422, transparent 70%); }
.status-group-head:has(.sd-8)  { background-image: linear-gradient(90deg, #14b8a622, transparent 70%); }
.status-group-head:has(.sd-9)  { background-image: linear-gradient(90deg, #22c55e22, transparent 70%); }
.status-group-head:has(.sd-10) { background-image: linear-gradient(90deg, #15803d22, transparent 70%); }
.status-group-head:has(.sd-11) { background-image: linear-gradient(90deg, #dc262622, transparent 70%); }
.status-group-head:has(.badge-status) .group-count {
    font-family: var(--mono); font-size: 13px; color: #fff; background: var(--cat-ink-900);
    padding: 4px 13px; font-weight: 800; letter-spacing: .02em; box-shadow: var(--sh1);
}

.status-group .tbl { border-radius: 0; border-top: 1px solid var(--cat-border); }
.group-empty { padding: 14px 18px; color: var(--cat-muted-2); font-size: 12.5px; border-top: 1px solid var(--cat-border); }

/* ---------- View toggle (seg) ---------- */
.view-toggle { display: inline-flex; background: #fff; border: 1px solid var(--cat-border); border-radius: 9px; overflow: hidden; }
.toggle-btn { border: 0; background: #fff; color: var(--cat-ink); padding: 9px 16px; font-weight: 800; font-size: 12.5px; font-family: var(--font); cursor: pointer; }
.toggle-btn.active { background: var(--cat-orange); color: #fff; }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.kanban-col { flex: 0 0 250px; width: 250px; background: var(--cat-surface-alt); border: 0; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; max-height: calc(100vh - 240px); }
.kanban-col.drag-over { background: var(--cat-orange-50); outline: 2px dashed var(--cat-orange); }
.kanban-col-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 8px; font-weight: 800; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--cat-ink-900); border-bottom: 0; }
.kanban-col-head .count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--cat-muted); font-weight: 700; background: transparent; border: 0; padding: 0; }
.kanban-col-body { padding: 6px 0 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 40px; }
.kanban-card { background: #fff; border: 1px solid var(--cat-border); border-radius: 10px; padding: 13px; box-shadow: var(--sh1); transition: .12s; }
.kanban-card.draggable { cursor: grab; }
.kanban-card.draggable:active { cursor: grabbing; }
.kanban-card:hover { border-color: var(--cat-orange); box-shadow: var(--sh2); }
.kanban-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kanban-card-head .kanban-card-title { margin-bottom: 8px; }
.kanban-open { flex-shrink: 0; padding: 3px 9px; font-size: 11px; font-weight: 800; }
.kanban-card-title { font-weight: 800; font-size: 13px; color: var(--cat-ink-900); margin-bottom: 8px; line-height: 1.3; }
.kanban-card-badges { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.kanban-card-meta { display: flex; justify-content: space-between; gap: .5rem; font-size: 11px; color: var(--cat-muted); border-top: 1px solid var(--cat-surface-alt); padding-top: 8px; }

/* ---------- Task detail / description ---------- */
.description :first-child { margin-top: 0; }
.description h1, .description h2, .description h3, .description h4 { color: var(--cat-ink-900); }
.description p, .description li { color: var(--cat-ink-700); line-height: 1.6; }
/* imagens embutidas (ex.: prints colados do ClickUp) — nunca estouram o card */
.description img { max-width: 100%; height: auto; border-radius: 10px; margin: 8px 0; }
/* mesma regra dentro do editor Toast UI (edição/preview): imagens coladas não vazam da área */
.toastui-editor-contents img { max-width: 100%; height: auto; }
/* tabelas na descrição (GFM) — container rolável + estilo alinhado às tabelas do app */
.description .table-scroll { overflow-x: auto; margin: 14px 0; border: 1px solid var(--cat-border); border-radius: 10px; }
.description table { border-collapse: collapse; width: 100%; font-size: 13.5px; margin: 0; }
.description th, .description td { border: 1px solid var(--cat-border); padding: 9px 13px; text-align: left; vertical-align: top; }
.description th { background: var(--cat-paper); color: var(--cat-ink-900); font-weight: 800; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.description td { color: var(--cat-ink-700); }
.description tbody tr:nth-child(even) td { background: rgba(128,128,140,.06); }
/* listas de tarefa (checkboxes) */
.description ul.contains-task-list { list-style: none; padding-left: 4px; }
.description li.task-list-item { display: flex; align-items: baseline; gap: 8px; }
.description li.task-list-item input { margin: 0; position: relative; top: 1px; }
/* código inline / blocos */
.description code { background: var(--cat-surface-alt); border-radius: 5px; padding: 1px 6px; font-family: var(--mono); font-size: .9em; }
.description pre { background: var(--cat-surface-alt); border: 1px solid var(--cat-border); border-radius: 10px; padding: 14px 16px; overflow-x: auto; }
.description pre code { background: none; padding: 0; }

/* ---------- Detalhe: tarefa + comentários lado a lado ---------- */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
/* O painel cresce conforme os comentários até encostar no rodapé da tela; daí em diante a lista rola. */
.detail-comments { position: sticky; top: 78px; display: flex; flex-direction: column; max-height: calc(100vh - 96px); }
.detail-comments > .comment-panel { flex: 0 1 auto; min-height: 0; }
@media (max-width: 1100px) {
    .detail-layout { grid-template-columns: 1fr; }
    .detail-comments { position: static; max-height: none; }
    .comment-list { max-height: 70vh; }
}

/* ---------- Comments (chat) ---------- */
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 900px) { .two-cols, .form-grid { grid-template-columns: 1fr; } }
/* abas de canal (Interno / Cliente) */
.comment-tabs { display: flex; flex: 0 0 auto; gap: 2px; margin: -4px 0 14px; border-bottom: 1px solid var(--cat-border); }
.comment-tab { border: 0; background: none; padding: 9px 13px; font-family: var(--font); font-weight: 800; font-size: 13px; color: var(--cat-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.comment-tab:hover { color: var(--cat-ink); }
.comment-tab.active { color: var(--cat-orange-700); border-bottom-color: var(--cat-orange); }
.comment-panel { background: #fff; border: 1px solid var(--cat-border); border-radius: 12px; box-shadow: var(--sh1); padding: 20px; display: flex; flex-direction: column; }
.comment-panel h3 { font-size: 15px; font-weight: 800; color: var(--cat-ink-900); margin: 0 0 4px; }
.comment-panel .desc { font-size: 12px; color: var(--cat-muted); margin: 0 0 14px; line-height: 1.4; }
/* Sem altura fixa: ocupa o espaço que sobra no painel e só ganha barra de rolagem quando estoura. */
.comment-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin-bottom: 12px; }
.comment { border: 1px solid var(--cat-border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; background: var(--cat-paper); }
.comment .head { display: flex; justify-content: space-between; font-size: 11px; color: var(--cat-muted); margin-bottom: 4px; }
.comment .author { font-weight: 800; color: var(--cat-ink-900); }
.comment-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.comment-img { display: block; max-width: 100%; border-radius: 8px; border: 1px solid var(--cat-border); }
.comment-imgs .comment-img { max-width: 160px; max-height: 130px; object-fit: cover; cursor: zoom-in; }

/* ---------- Complementos (adendos) da descrição ---------- */
.addenda-list { display: flex; flex-direction: column; gap: 12px; margin: 12px 0 18px; }
.addendum { border: 1px solid var(--cat-border); border-radius: 10px; padding: 12px 14px; background: var(--cat-paper); }
.addendum-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.addendum-author { font-weight: 800; font-size: 12.5px; color: var(--cat-ink-900); }
.addendum-when { font-size: 11px; color: var(--cat-muted); }
.addendum-del { margin-left: auto; border: 0; background: none; color: var(--cat-muted-2); cursor: pointer; font-size: 13px; line-height: 1; padding: 3px 7px; border-radius: 6px; }
.addendum-del:hover { background: rgba(216,72,72,.14); color: var(--cat-danger); }
.addendum-confirm { margin-left: auto; display: flex; gap: 6px; }
.addendum-body { font-size: 14px; }
.addendum-composer { border-top: 1px solid var(--cat-surface-alt); padding-top: 14px; }
.addendum-composer > .form-row > label { font-size: 12px; font-weight: 800; color: var(--cat-ink-700); margin-bottom: 6px; display: block; }
.addendum-composer .btn { margin-top: 10px; }
.comment-composer { display: flex; flex: 0 0 auto; flex-direction: column; gap: 8px; }
.comment-pending-imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.comment-pending-img { position: relative; }
.comment-pending-img img { width: 96px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--cat-border); display: block; }
.pending-remove { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 999px; border: 1px solid var(--cat-border); background: #fff; color: var(--cat-ink-700); font-size: 11px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: var(--sh1); }
.pending-remove:hover { background: #fbe0e0; border-color: #f0b4b4; color: #9c2a2a; }
.read-only-note { background: var(--cat-surface-alt); border: 1px dashed var(--cat-border); border-radius: 9px; padding: 11px 13px; margin: 0; color: var(--cat-muted); font-style: italic; font-size: 12.5px; }

/* ---------- Attachments ---------- */
.attach-head { display: flex; align-items: center; justify-content: space-between; }
.attach-head h3 { margin: 0; font-size: 15px; font-weight: 800; color: var(--cat-ink-900); }
.attach-head label.btn { cursor: pointer; }
kbd { background: var(--cat-surface-alt); border: 1px solid var(--cat-border); border-radius: 5px; padding: 1px 6px; font-size: 11px; font-family: var(--mono); font-weight: 700; }
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 14px; }
.attach-item { border: 1px solid var(--cat-border); border-radius: 9px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.attach-thumb { width: 100%; height: 120px; object-fit: cover; cursor: zoom-in; display: block; background: var(--cat-surface-alt); }

/* Lightbox de imagem (anexos) */
.lightbox-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.78); display: flex; align-items: center; justify-content: center; padding: 40px; cursor: zoom-out; }
.lightbox-img { max-width: 92vw; max-height: 92vh; border-radius: 10px; box-shadow: var(--sh3); cursor: default; }
.lightbox-close { position: fixed; top: 18px; right: 22px; width: 40px; height: 40px; border-radius: 999px; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 17px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lightbox-close:hover { background: rgba(255,255,255,.26); }
.attach-file { height: 120px; display: flex; align-items: center; justify-content: center; font-size: 2.5rem; background: linear-gradient(135deg, #f4f4f5, #e4e4e7); color: var(--cat-muted-2); cursor: pointer; }
.attach-meta { padding: .5rem .6rem .2rem; display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.attach-name { font-weight: 700; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--cat-ink-900); }
.attach-sub { font-size: .72rem; color: var(--cat-muted); }
.attach-actions { display: flex; gap: .3rem; padding: .4rem .6rem .6rem; }

/* ---------- Auditoria ---------- */
.audit-panel { margin-top: 18px; }
.audit-panel .attach-head .desc { font-size: 12px; color: var(--cat-muted); }
.audit-list { display: flex; flex-direction: column; margin-top: 12px; }
.audit-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--cat-surface-alt); }
.audit-item:last-child { border-bottom: 0; }
.audit-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--cat-orange); margin-top: 6px; flex-shrink: 0; }
.audit-body { flex: 1; min-width: 0; }
.audit-what { font-size: 13.5px; color: var(--cat-ink-700); line-height: 1.5; }
.audit-what b { color: var(--cat-ink-900); font-weight: 800; }
.audit-meta { display: flex; gap: 10px; margin-top: 2px; font-size: 11.5px; color: var(--cat-muted); }
.audit-who { font-weight: 700; color: var(--cat-ink); }
.audit-old { color: var(--cat-muted); text-decoration: line-through; }
.audit-new { color: var(--cat-ink-900); font-weight: 700; }

/* ---------- Login ---------- */
.login-card { background: #fff; border-radius: 16px; padding: 0; overflow: hidden; width: 100%; max-width: 440px; box-shadow: 0 30px 70px rgba(0,0,0,.4); }
.login-logo { padding: 28px 32px 24px; }
.login-logo img { width: 100%; height: auto; }
.login-logo .logo-light { display: none; }
.login-logo .logo-dark { display: block; }
:root[data-theme="light"] .login-logo .logo-light { display: block; }
:root[data-theme="light"] .login-logo .logo-dark { display: none; }
.login-banner { background: var(--cat-orange); color: #2c2c2e; font-weight: 800; font-size: 17px; letter-spacing: .01em; padding: 14px 32px; text-align: center; }
.login-body { padding: 26px 32px 30px; }
.login-card .btn-primary { width: 100%; padding: 13px; justify-content: center; margin-top: 6px; font-size: 14px; }
.hint { font-size: 12.5px; color: var(--cat-ink); margin-top: 24px; line-height: 1.7; border-top: 1px solid var(--cat-surface-alt); padding-top: 18px; }
.hint code { background: var(--cat-orange-50); color: var(--cat-orange-700); padding: 2px 7px; border-radius: 5px; font-family: var(--mono); font-size: 11.5px; font-weight: 700; }

/* ============================================================
   TEMA ESCURO — Catalogs Chamados (versão escura)
   Escuro é o padrão. As regras abaixo valem sempre, EXCETO quando
   <html data-theme="light"> — aí o tema claro (topo do arquivo) volta.
   O alternador no cabeçalho grava a escolha em localStorage.
   ============================================================ */
:root:not([data-theme="light"]) {
    color-scheme: dark;
    --cat-paper: #1c1c1f;
    --cat-surface-alt: #303036;
    --cat-border: #37373d;
    --cat-border-strong: #4a4a52;
    --cat-ink: #c4c4c8;
    --cat-ink-900: #f4f4f6;
    --cat-ink-700: #d6d6da;
    --cat-muted: #8f8f95;
    --cat-muted-2: #75757b;
    --cat-orange-50: rgba(245,134,52,.14);
    --cat-orange-100: rgba(245,134,52,.24);
    --sh1: 0 1px 2px rgba(0,0,0,.4);
    --sh2: 0 4px 14px rgba(0,0,0,.5);
    --sh3: 0 24px 60px rgba(0,0,0,.6);
    /* aliases legados */
    --bg: #141416;
    --card: #2a2a2f;
}

:root:not([data-theme="light"]) body { background: #141416; color: var(--cat-ink); }

/* nav / header */
:root:not([data-theme="light"]) .app-header { background: #26262a; border-bottom-color: var(--cat-border); }
:root:not([data-theme="light"]) .app-nav .nav-item:hover { background: #303036; }
:root:not([data-theme="light"]) .app-nav .nav-item.active { background: rgba(245,134,52,.16); color: #f5a869; }

/* botões neutros */
:root:not([data-theme="light"]) .btn-logout,
:root:not([data-theme="light"]) .btn-ghost { background: #2e2e33; border-color: #42424c; color: var(--cat-ink); }
:root:not([data-theme="light"]) .btn-ghost:hover { background: #37373d; }
:root:not([data-theme="light"]) .btn-logout:hover { background: rgba(216,72,72,.22); border-color: rgba(216,72,72,.5); color: #f0a0a0; }

/* seg / view toggle */
:root:not([data-theme="light"]) .view-toggle { background: #26262a; border-color: #42424c; }
:root:not([data-theme="light"]) .toggle-btn { background: #26262a; color: var(--cat-ink); }
:root:not([data-theme="light"]) .toggle-btn.active { background: var(--cat-orange); color: #fff; }

/* superfícies de card */
:root:not([data-theme="light"]) .card,
:root:not([data-theme="light"]) .tile,
:root:not([data-theme="light"]) .status-group,
:root:not([data-theme="light"]) .kanban-card,
:root:not([data-theme="light"]) .comment-panel,
:root:not([data-theme="light"]) .attach-item,
:root:not([data-theme="light"]) .login-card,
:root:not([data-theme="light"]) .user-menu { background: #2a2a2f; border-color: var(--cat-border); }
:root:not([data-theme="light"]) .user-menu-item.danger:hover { background: rgba(214,69,69,.2); color: #f0a3a3; }

/* avatar de iniciais no escuro */
:root:not([data-theme="light"]) .mono-av { background: rgba(245,134,52,.16); color: #f5a869; }

/* status pill / contadores */
:root:not([data-theme="light"]) .badge-status { background: #303036; color: var(--cat-ink-900); }
:root:not([data-theme="light"]) .status-group-head .group-count { background: #303036; }
:root:not([data-theme="light"]) .status-group-head:has(.badge-status) { background-color: #34343b; }
:root:not([data-theme="light"]) .status-group-head:has(.badge-status):hover { background-color: #3a3a42; }
:root:not([data-theme="light"]) .status-group-head:has(.badge-status) .group-count { background: #303036; color: #fff; }

/* tabelas */
:root:not([data-theme="light"]) .tbl { background: #2a2a2f; }
:root:not([data-theme="light"]) .tbl th { background: #212124; border-bottom-color: var(--cat-border); }
:root:not([data-theme="light"]) .tbl td { border-bottom-color: #303036; }
:root:not([data-theme="light"]) .tbl tbody tr:nth-child(even) td { background: #232327; }
:root:not([data-theme="light"]) .tbl tr.clickable:hover td { background: rgba(245,134,52,.12); }
:root:not([data-theme="light"]) .status-group .tbl { border-top-color: var(--cat-border); }
:root:not([data-theme="light"]) .group-empty { border-top-color: var(--cat-border); }

/* menu rápido de troca de status (popover) */
:root:not([data-theme="light"]) .status-menu { background: #2a2a2f; border-color: var(--cat-border); }
:root:not([data-theme="light"]) .status-menu-item { color: var(--cat-ink); }
:root:not([data-theme="light"]) .status-menu-item:hover { background: rgba(245,134,52,.14); color: var(--cat-ink-900); }
:root:not([data-theme="light"]) .status-dot-btn:hover { background: #303036; }

/* kanban */
:root:not([data-theme="light"]) .kanban-col { background: #1f1f23; }
:root:not([data-theme="light"]) .kanban-col.drag-over { background: rgba(245,134,52,.14); outline-color: var(--cat-orange); }

/* inputs / textarea */
:root:not([data-theme="light"]) .form-row input,
:root:not([data-theme="light"]) .form-row select,
:root:not([data-theme="light"]) .form-row textarea,
:root:not([data-theme="light"]) .comment-panel textarea,
:root:not([data-theme="light"]) .search-input,
:root:not([data-theme="light"]) .search-client { background: #1f1f23; border-color: #42424c; color: var(--cat-ink-900); }

/* comentários */
:root:not([data-theme="light"]) .comment { background: #1f1f23; border-color: var(--cat-border); }

/* anexos */
:root:not([data-theme="light"]) .attach-item { border-color: #42424c; }
:root:not([data-theme="light"]) .attach-thumb { background: #303036; }
:root:not([data-theme="light"]) .attach-file { background: linear-gradient(135deg, #303036, #26262a); }

/* badges de tipo / prioridade — variantes escuras */
:root:not([data-theme="light"]) .badge-type-feature { background: rgba(58,123,213,.2); color: #8fb4e8; }
:root:not([data-theme="light"]) .badge-type-bug { background: rgba(216,72,72,.2); color: #f0a0a0; }
:root:not([data-theme="light"]) .badge-prio-0 { background: #303036; color: var(--cat-ink); }
:root:not([data-theme="light"]) .badge-prio-1 { background: rgba(245,134,52,.2); color: #f5a869; }
:root:not([data-theme="light"]) .badge-prio-2 { background: rgba(216,72,72,.2); color: #f0a0a0; }
:root:not([data-theme="light"]) .badge-prio-3 { background: var(--cat-danger); color: #fff; }
:root:not([data-theme="light"]) .badge-mine { background: rgba(63,174,106,.2); color: #7ed6a1; }

/* alertas */
:root:not([data-theme="light"]) .alert-error { background: rgba(216,72,72,.18); color: #f0a0a0; border-color: rgba(216,72,72,.4); }
:root:not([data-theme="light"]) .alert-ok { background: rgba(63,174,106,.18); color: #7ed6a1; border-color: rgba(63,174,106,.4); }

/* código inline (login / dicas) */
:root:not([data-theme="light"]) .hint code,
:root:not([data-theme="light"]) .login-card code { background: rgba(245,134,52,.16); color: #f5a869; }

/* kbd */
:root:not([data-theme="light"]) kbd { background: #303036; border-color: #42424c; }

/* relatório de horas */
:root:not([data-theme="light"]) .tbl tfoot td { background: #212124; border-top-color: var(--cat-border); }
:root:not([data-theme="light"]) .report-month .tbl { border-top-color: var(--cat-border); }

/* alternador de tema no cabeçalho */
.theme-toggle { padding: 8px 12px; font-size: 15px; line-height: 1; }

/* ---------- Impressão ---------- */
.print-only { display: none; }

@media print {
    /* O tema escuro desperdiça tinta e some com o texto no papel: o impresso é sempre claro. */
    :root, :root:not([data-theme="light"]) { background: #fff !important; }
    :root:not([data-theme="light"]) .tbl,
    :root:not([data-theme="light"]) .tbl th,
    :root:not([data-theme="light"]) .tbl td,
    :root:not([data-theme="light"]) .tbl tbody tr:nth-child(even) td,
    :root:not([data-theme="light"]) .tbl tfoot td,
    :root:not([data-theme="light"]) .card { background: #fff !important; }

    @page { margin: 14mm; }

    body, .app-shell, .app-main { background: #fff !important; display: block !important; }
    .app-header, .no-print, .app-nav, .user-box { display: none !important; }
    .app-main { padding: 0 !important; margin: 0 !important; max-width: none !important; }

    .print-only { display: block; }

    /* Sem sombra/borda arredondada: no papel viram artefatos cinzas. */
    .card { box-shadow: none !important; border: none !important; border-radius: 0 !important; padding: 0 !important; }

    .report-print-head { margin-bottom: 10mm; border-bottom: 2px solid #000; padding-bottom: 4mm; }
    .report-print-head h2 { margin: 0 0 2mm; font-size: 16pt; color: #000; }
    .report-print-sub { font-size: 10pt; color: #333; }

    /* Um mês não pode ser partido no meio de uma página. */
    .report-month { break-inside: avoid; page-break-inside: avoid; margin-bottom: 8mm !important; }
    .report-month-head { padding: 0 0 2mm !important; }
    .report-month-head h3 { font-size: 12pt; color: #000; }
    .report-summary { margin-bottom: 8mm !important; }
    .report-total-value { font-size: 14pt; color: #000; }

    .tbl { font-size: 9pt; border: 1px solid #999; }
    .tbl th { background: #eee !important; color: #000; border-bottom: 1px solid #999; padding: 2mm 3mm; }
    .tbl td { color: #000; padding: 2mm 3mm; border-bottom: 1px solid #ddd; }
    .tbl tfoot td { background: #eee !important; border-top: 1px solid #999; }
    .tbl thead { display: table-header-group; }

    .report-print-total { margin-top: 6mm; padding-top: 3mm; border-top: 2px solid #000; font-size: 12pt; text-align: right; }

    a { text-decoration: none; color: #000; }
}
