/* ── Header nav: ghost buttons ──────────────────────────────────── */
.kb-header .kb-header-actions .app-btn-action:not(.app-btn-action-primary) {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}
.kb-header .kb-header-actions .app-btn-action:not(.app-btn-action-primary):hover,
.kb-header .kb-header-actions .app-btn-action:not(.app-btn-action-primary):focus-visible {
    border-color: transparent;
    background: rgb(from var(--app-accent) r g b / 0.08);
    box-shadow: none;
}

/* ── App bar: marca + navegação principal + usuário ──────────────── */
.kb-brand-suffix {
    margin-left: 6px;
    color: var(--app-accent);
    font-size: 18px;
    font-weight: 700;
}

/* No dark, o wordmark "communy" (SVG de cor fixa) fica branco; o ícone fica intacto */
[data-theme-version="dark"] .kb-brand-logotype {
    filter: brightness(0) invert(1);
}

[data-theme-version="dark"] .login-card-brand .kb-brand-logotype,
[data-theme-version="dark"] .login-card-brand .kb-auth-logotype {
    filter: brightness(0) invert(1);
    opacity: 0.9;
}

/* Bloco de identidade no topo do drawer (mobile) */
.kb-drawer-account {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--app-border-default);
}

/* alinha o avatar com a coluna dos ícones da navegação */
.kb-drawer-account .tickets-user-avatar {
    margin-left: 14px;
}

/* drawer com altura do conteúdo (ancorado no topo), sem vão vazio */
#kbDrawer {
    bottom: auto;
    max-height: 100vh;
    overflow-y: auto;
    border-bottom-right-radius: var(--app-radius-sm);
}

.kb-drawer-account-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.kb-drawer-account-meta strong {
    color: var(--app-text-primary);
    font-size: 14px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kb-drawer-account-meta span {
    color: var(--app-text-muted);
    font-size: 12px;
}

.tickets-appnav {
    border-top: 1px solid var(--app-border-default);
    background: var(--app-surface-card);
}

.tickets-appnav-inner {
    display: flex;
    align-items: stretch;
    gap: 20px;
    flex-wrap: wrap;
    padding: 8px 0;
}

.tickets-navlink {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 84px;
    padding: 8px 14px;
    border-radius: var(--app-radius-sm);
    color: var(--app-text-primary);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
}

.tickets-navlink .kb-icon {
    font-size: 22px;
    color: var(--app-accent);
}

.tickets-appnav .tickets-navlink:hover,
.tickets-appnav .tickets-navlink:focus-visible {
    background: var(--app-accent-hover);
    color: var(--app-accent);
    outline: none;
}

.tickets-appnav .tickets-navlink.is-active,
.tickets-appnav .tickets-navlink.is-active:hover,
.tickets-appnav .tickets-navlink.is-active:focus-visible {
    background: var(--app-accent);
    color: var(--app-text-on-accent, #fff);
}

.tickets-appnav .tickets-navlink.is-active .kb-icon {
    color: var(--app-text-on-accent, #fff);
}

.tickets-user-menu {
    position: relative;
}

.tickets-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-card);
    cursor: pointer;
    font: inherit;
}

.tickets-user-trigger:hover {
    border-color: var(--app-border-strong);
}

.tickets-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--app-accent);
    color: var(--app-text-on-accent, #fff);
    font-weight: 700;
    font-size: 14px;
    flex: none;
}

.tickets-user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    text-align: left;
}

.tickets-user-name {
    color: var(--app-text-primary);
    font-size: 13px;
    font-weight: 700;
}

.tickets-user-role {
    color: var(--app-text-muted);
    font-size: 11px;
}

.tickets-user-caret {
    font-size: 18px;
    color: var(--app-text-muted);
}

.tickets-user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 210px;
    padding: 6px;
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-card);
    box-shadow: var(--app-shadow-pop);
    z-index: 120;
}

.tickets-user-menu:not(.is-open) .tickets-user-dropdown {
    display: none;
}

.tickets-user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--app-radius-sm);
    color: var(--app-text-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.tickets-user-item:hover,
.tickets-user-item:focus-visible {
    background: var(--app-surface-soft);
    outline: none;
}

.tickets-user-item .kb-icon {
    font-size: 20px;
    color: var(--app-text-muted);
}

.tickets-login-form .field-error {
    display: block;
    margin-top: 4px;
    color: var(--app-color-danger);
    font-size: 12px;
    font-weight: 600;
}

.tickets-login-back {
    margin-top: 16px;
}

@media (max-width: 768px) {
    .tickets-appnav,
    .tickets-user-meta,
    .kb-brand-suffix {
        display: none;
    }
}

/* ── Listas (empresas / contatos): tabela densa sem scroll ───────── */
body.tickets-companies .kb-stats-table,
body.tickets-contacts .kb-stats-table {
    min-width: 0 !important;
    table-layout: fixed !important;
    width: 100% !important;
    font-size: 13px;
}
body.tickets-companies .kb-stats-table th,
body.tickets-contacts .kb-stats-table th { font-size: 11px; padding: 10px 12px; }
body.tickets-companies .kb-stats-table td,
body.tickets-contacts .kb-stats-table td { padding: 10px 12px; width: auto !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.tickets-companies .kb-stats-article-link,
body.tickets-contacts .kb-stats-article-link { max-width: 100%; }

.tickets-list-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--app-text-primary);
    margin: 0;
    line-height: 1.2;
}

/* cards de métricas das listas (garante o ícone 44×44) */
body.tickets-companies .kb-stats-metric-card,
body.tickets-contacts .kb-stats-metric-card {
    display: flex !important;
    align-items: center !important;
    gap: 16px;
    padding: 22px;
}
body.tickets-companies .kb-stats-metric-icon,
body.tickets-contacts .kb-stats-metric-icon {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
    flex-shrink: 0;
    border-radius: var(--app-radius-sm);
}

/* badge de tickets abertos */
.tkt-badge {
    display: inline-block;
    min-width: 24px;
    padding: 2px 8px;
    border-radius: var(--app-radius-pill);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0;
}
.tkt-badge--none   { background: var(--app-border-soft); color: var(--app-text-muted); }
.tkt-badge--warn   { background: var(--app-warning-soft-bg); color: var(--app-warning-soft-text); }
.tkt-badge--danger { background: var(--app-danger-soft-bg); color: var(--app-danger-soft-text); }

.tickets-public {
    background:
        radial-gradient(circle at top, rgb(from var(--app-accent) r g b / 0.06), transparent 18%),
        var(--app-bg-light, #f5f8fa);
}

.tickets-public .kb-footer {
    margin-top: 56px;
}

.tickets-main {
    min-height: 60vh;
    padding: 10px 0 48px;
}

.tickets-page-head {
    padding-top: 8px;
    padding-bottom: 24px;
}

.tickets-page-kicker {
    color: var(--app-accent);
}

/* Kicker no papel de breadcrumb (trilha navegável) */
.tickets-page-crumbs {
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.tickets-page-crumbs a {
    color: inherit;
    text-decoration: none;
}

.tickets-page-crumbs a:hover,
.tickets-page-crumbs a:focus-visible {
    text-decoration: underline;
    outline: none;
}

.tickets-crumb-sep {
    opacity: 0.5;
}

.tickets-page-heading {
    align-items: flex-end;
}

/* ── Stats de status no subtítulo da página ────────────────────────── */
.tickets-heading-stats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 20px;
    margin-top: 6px;
    font-size: 13px;
    color: var(--app-text-muted);
}

.tickets-heading-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tickets-heading-stat strong {
    color: var(--app-text-primary);
    font-weight: 700;
}

.tickets-heading-stat + .tickets-heading-stat::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--app-border-strong);
    margin-right: 16px;
}

.tickets-stat-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tickets-stat-dot--novo             { background: var(--app-tone-blue); }
.tickets-stat-dot--fechado          { background: var(--app-tone-green); }
.tickets-stat-dot--aguardandocliente { background: var(--app-tone-amber); }
.tickets-stat-dot--tratativainterna { background: var(--app-tone-violet); }

.tickets-page-heading h1 {
    color: var(--app-text-primary);
}

.tickets-page-heading p {
    max-width: 62ch;
    margin-top: 12px;
    color: var(--app-text-muted);
    font-size: 0.98rem;
    line-height: 1.6;
}

.tickets-section {
    margin-bottom: 48px;
}

.tickets-card {
    box-shadow: var(--app-shadow-card);
}

.tickets-card--padded {
    padding: 22px;
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-card);
}

.tickets-table-card {
    overflow: hidden;
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-card);
    box-shadow: var(--app-shadow-card);
}

.tickets-chart-card {
    padding: 20px 24px 24px;
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-card);
    box-shadow: var(--app-shadow-card);
}

.tickets-chart-card {
    height: 280px;
}

.tickets-chart-card--tall {
    height: 340px;
}

.tickets-chart-card canvas {
    height: 100% !important;
    max-width: 100%;
}

/* Permite os cards de gráfico encolherem na grade (sem overflow no mobile) */
.content-grid > *,
.tickets-chart-card {
    min-width: 0;
}

.tickets-card h2,
.tickets-card-header h2 {
    margin: 0;
    color: var(--app-text-primary);
    font-size: clamp(1.1rem, 1rem + 0.3vw, 1.3rem);
    font-weight: 700;
    line-height: 1.2;
}

/* Respiro entre o título do card e o conteúdo (forms de detalhe) */
.tickets-card--padded > h2 {
    margin-bottom: 18px;
}

/* Cabecalho de painel transparente (fora do card), espelhando .kb-stats-table-header do kb */
.tickets-card-header {
    padding: 0;
    margin-bottom: 12px;
}

.tickets-card-header a {
    color: var(--app-accent);
    font-weight: 700;
    text-decoration: none;
}

.tickets-card-header a:hover,
.tickets-card-header a:focus-visible {
    color: var(--app-accent-dark);
    text-decoration: underline;
}

.tickets-metrics-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tickets-metric-card {
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-card);
    box-shadow: var(--app-shadow-card);
}

/* Sobrescreve o background fixo do kb-stats-metric-icon para usar o tom correto */
.kb-stats-metric-icon.app-tone-cyan   { background: rgb(from var(--app-tone-cyan) r g b / 0.12);   color: var(--app-tone-cyan); }
.kb-stats-metric-icon.app-tone-blue   { background: rgb(from var(--app-tone-blue) r g b / 0.14);   color: var(--app-tone-blue); }
.kb-stats-metric-icon.app-tone-coral  { background: rgb(from var(--app-tone-coral) r g b / 0.14);  color: var(--app-tone-coral); }
.kb-stats-metric-icon.app-tone-amber  { background: rgb(from var(--app-tone-amber) r g b / 0.18);  color: var(--app-tone-amber); }
.kb-stats-metric-icon.app-tone-green  { background: rgb(from var(--app-tone-green) r g b / 0.14);  color: var(--app-tone-green); }
.kb-stats-metric-icon.app-tone-violet { background: rgb(from var(--app-tone-violet) r g b / 0.14);  color: var(--app-tone-violet); }

.tickets-metric-card strong {
    font-size: 30px;
}

.tickets-filter-form {
    position: relative;
}

.tickets-filter-form .kb-search {
    flex: 2;
    min-width: 0;
    max-width: 320px;
}

/* Busca (compacta) no dark: mesmos tokens do input do form (.ticket-form-field),
   sobrepondo o fundo branco que o portal público aplica em .kb-search. */
[data-theme-version="dark"] .kb-search.kb-search--compact {
    background: var(--app-surface-card);
    border-color: var(--app-border-strong);
}

[data-theme-version="dark"] .kb-search.kb-search--compact input[type="search"] {
    color: var(--app-text-primary);
    background: transparent;
}

[data-theme-version="dark"] .kb-search.kb-search--compact input[type="search"]::placeholder {
    color: var(--app-text-subtle);
}

[data-theme-version="dark"] .kb-search.kb-search--compact .kb-search-icon,
[data-theme-version="dark"] .kb-search.kb-search--compact button {
    color: var(--app-text-muted);
}

/* Wrapper com chevron azul sobreposto */
.tickets-select-wrap {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.tickets-select-wrap::after {
    content: 'expand_more';
    font-family: 'Material Symbols Rounded';
    font-size: 18px;
    line-height: 1;
    color: var(--app-accent);
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

/* Selects de filtro inline */
.tickets-toolbar-select {
    height: var(--app-btn-height-sm);
    padding: 0 32px 0 14px;
    border: 1px solid var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-card);
    color: var(--app-text-primary);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.12s, background 0.12s;
    appearance: none;
    -webkit-appearance: none;
    white-space: nowrap;
}

.tickets-toolbar-select:hover {
    background: var(--app-surface-soft);
}

.tickets-toolbar-select:focus {
    border-color: var(--app-accent);
    outline: none;
    box-shadow: 0 0 0 3px rgb(from var(--app-accent) r g b / 0.16);
}

/* ── Painel de filtros (abre pelo botão de filtro) ───────────────── */
.tickets-filter-toggle {
    position: relative;
}

.tickets-filter-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: var(--app-radius-pill);
    background: var(--app-accent);
    color: var(--app-text-on-accent, #fff);
    font-size: 11px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
}

.tickets-filter-panel {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 60;
    width: min(640px, 100%);
    padding: 24px;
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-card);
    box-shadow: var(--app-shadow-pop);
}

.tickets-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 28px;
}

.tickets-filter-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.tickets-filter-group--wide {
    grid-column: 1 / -1;
}

.tickets-filter-group-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--app-text-muted);
}

.tickets-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tickets-filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 9px 16px;
    border: 1px solid var(--app-border-strong);
    border-radius: var(--app-radius-pill);
    background: var(--app-surface-card);
    color: var(--app-text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.12s, background 0.12s, color 0.12s;
}

.tickets-filter-chip input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.tickets-filter-chip:hover {
    border-color: var(--app-accent);
}

.tickets-filter-chip.is-active {
    border-color: var(--app-accent);
    background: rgb(from var(--app-accent) r g b / 0.10);
    color: var(--app-accent-dark);
}

.tickets-filter-select-wrap {
    display: block;
}

.tickets-filter-select-wrap .tickets-toolbar-select {
    width: 100%;
    height: var(--app-btn-height-md, 42px);
    padding-right: 38px;
}

.tickets-filter-panel-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--app-border-default);
}

.tickets-filter-clear-link {
    margin-right: auto;
    border: 0;
    background: transparent;
    color: var(--app-text-muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 4px;
}

.tickets-filter-clear-link:hover,
.tickets-filter-clear-link:focus-visible {
    color: var(--app-color-danger);
    outline: none;
}

@media (max-width: 720px) {
    .tickets-filter-grid {
        grid-template-columns: 1fr;
    }
}

/* Ponto indicador no botão Filtrar quando há filtros ativos */
.tickets-btn-has-filter {
    position: relative;
}

.tickets-btn-has-filter::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--app-accent);
    border: 1.5px solid var(--app-surface-card);
}

/* ── Campo de formulário (input/select/textarea) — base única ─────────
   Consolida o estilo de campo usado em todos os forms do módulo:
   edição inline, detalhe, criar ticket, anexos/observações e login. */
.inline-editor :is(input, select, textarea),
.autocomplete-editor input[type="text"],
.form-control-host :is(input, select, textarea),
.ticket-form-field :is(input, select, textarea),
.ticket-inline-form :is(input, textarea),
.tickets-login-form input {
    width: 100%;
    min-height: var(--app-btn-height-sm);
    border: 1px solid var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    padding: 10px 12px;
    color: var(--app-text-primary);
    background: var(--app-surface-card);
    font: inherit;
}

.inline-editor :is(input, select, textarea):focus,
.autocomplete-editor input[type="text"]:focus,
.form-control-host :is(input, select, textarea):focus,
.ticket-form-field :is(input, select, textarea):focus,
.ticket-inline-form :is(input, textarea):focus,
.tickets-login-form input:focus {
    border-color: var(--app-accent);
    outline: none;
    box-shadow: 0 0 0 3px rgb(from var(--app-accent) r g b / 0.16);
}


.kb-stats-table.tickets-summary-table {
    min-width: 0;
}

.tickets-summary-table th,
.tickets-summary-table td {
    padding: 14px 22px;
}

.tickets-summary-table th:not(:first-child),
.tickets-summary-table td:not(:first-child) {
    width: auto;
    text-align: right;
}

.kb-stats-table.tickets-data-table th,
.kb-stats-table.tickets-data-table td {
    text-align: left;
    vertical-align: top;
}

.kb-stats-table.tickets-data-table th:not(:first-child),
.kb-stats-table.tickets-data-table td:not(:first-child) {
    width: auto;
    text-align: left;
}

.tickets-data-table td {
    color: var(--app-text-muted);
}

.tickets-data-table td:first-child,
.tickets-data-table td:nth-child(2) {
    color: var(--app-text-primary);
}

.tickets-data-table td.number,
.tickets-summary-table td.number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.tickets-history-table {
    min-width: 1100px;
}

/* Card list */
.ticket-card-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.ticket-card-item[hidden] {
    display: none !important;
}

.ticket-card-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 18px 22px;
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-card);
    box-shadow: var(--app-shadow-card);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ticket-card-item:hover {
    border-color: var(--app-accent);
    box-shadow: var(--app-shadow-pop);
}

/* Link sobreposto: toda a area do card e clicavel */
.ticket-card-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: var(--app-radius-sm);
}

.ticket-card-item:hover .ticket-card-title {
    color: var(--app-accent);
}

.ticket-card-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 64px 24px;
    color: var(--app-text-muted);
    font-size: 14px;
    list-style: none;
}

.ticket-card-empty-icon {
    font-size: 40px;
    opacity: 0.4;
}

.ticket-card-left {
    flex: 0 0 44%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ticket-card-right {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    min-width: 0;
}

.ticket-card-id {
    font-size: 12px;
    font-weight: 700;
    color: var(--app-accent);
    letter-spacing: 0.02em;
}

.ticket-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--app-text-primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.ticket-card-meta {
    margin: 0;
    font-size: 13px;
    color: var(--app-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-card-dates {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 2px;
}

.ticket-card-date {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--app-text-subtle);
}

.ticket-card-date .kb-icon {
    font-size: 15px;
}

.ticket-card-field {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

/* Status precisa de mais largura (pill "Aguardando Cliente"); Prioridade um pouco mais.
   min-width auto impede que a coluna encolha abaixo da pill e invada a vizinha. */
.ticket-card-field:nth-child(2) {
    flex-grow: 1.7;
    min-width: auto;
}

.ticket-card-field:nth-child(3) {
    flex-grow: 1.2;
    min-width: auto;
}

/* Status, Prioridade, SLA, Resp e Fonte centralizados na coluna (label + valor) */
.ticket-card-field:nth-child(n+2) {
    align-items: center;
    text-align: center;
}

.ticket-card-field-label {
    display: block;
    font-size: 11px;
    font-weight: 800;
    color: var(--app-text-subtle);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ticket-card-field-value {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--app-text-primary);
}

.ticket-card-field-value .status-pill,
.ticket-card-field-value .priority-pill {
    min-width: 0;
    white-space: nowrap;
}

@media (max-width: 1100px) {
    .ticket-card-item {
        flex-wrap: wrap;
        gap: 16px;
    }

    .ticket-card-left {
        flex: 1 1 100%;
    }

    .ticket-card-right {
        flex: 1 1 100%;
        flex-wrap: wrap;
        gap: 16px;
    }

    .ticket-card-field {
        flex: 0 0 calc(33% - 16px);
    }
}

.ticket-link {
    color: var(--app-text-primary);
    font-weight: 700;
    text-decoration: none;
}

.ticket-link:hover,
.ticket-link:focus-visible {
    color: var(--app-accent);
    text-decoration: underline;
}

.status-pill,
.priority-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    padding: 4px 10px;
    border-radius: var(--app-radius-pill);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

/* Status */
.status-pill--novo {
    background: rgb(from var(--app-tone-blue) r g b / 0.14);
    color: var(--app-tone-blue);
}

.status-pill--fechado {
    background: rgb(from var(--app-tone-green) r g b / 0.14);
    color: var(--app-tone-green);
}

.status-pill--aguardandocliente {
    background: rgb(from var(--app-tone-amber) r g b / 0.18);
    color: var(--app-tone-amber);
}

.status-pill--tratativainterna {
    background: rgb(from var(--app-tone-violet) r g b / 0.14);
    color: var(--app-tone-violet);
}

/* Prioridade — escala de calor (baixo → alto = calmo → alarme).
   Urgente usa fill sólido; as demais, tint. Só a prioridade usa sólido,
   para nunca confundir com a coluna de status (sempre tint suave). */
.priority-pill--baixa {
    background: rgb(from var(--app-tone-green) r g b / 0.16);
    color: var(--app-tone-green);
}

.priority-pill--média {
    background: rgb(from var(--app-tone-amber) r g b / 0.20);
    color: var(--app-tone-amber);
}

.priority-pill--alta {
    background: rgb(from var(--app-tone-coral) r g b / 0.18);
    color: var(--app-tone-coral);
}

.priority-pill--urgente {
    /* #f5365c fixado (não usa a var de tema) para garantir contraste do
       texto branco em light e dark. */
    background: #f5365c;
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.03em;
}

/* Prioridade "Sem prioridade": chip vazado (outline) — lê como "não definido". */
.priority-pill--none {
    background: transparent;
    border: 1px solid rgb(from var(--app-tone-slate) r g b / 0.45);
    color: var(--app-text-muted);
}

.text-danger {
    color: var(--app-color-danger);
    font-weight: 700;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.content-grid--6040 {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
}

.content-grid--3col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-grid {
    display: grid;
    gap: 14px;
    margin: 0;
}

.detail-grid-six {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-grid-one {
    grid-template-columns: 1fr;
}

.detail-grid div {
    min-width: 0;
}

.detail-grid dt {
    color: var(--app-text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.detail-grid dd {
    margin: 0;
    color: var(--app-text-primary);
    overflow-wrap: anywhere;
}

.editable-title,
.editable-field dt {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Blocos de detalhe do ticket como formulário ─────────────────── */
/* Nome próprio (tkt-edit-*) para não colidir com .ticket-form-grid da
   tela de criação de ticket, que define 2 colunas. */
.tkt-edit-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px 20px;
    margin-bottom: 18px;
}

.tkt-edit-grid--main {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tkt-edit-grid--main .form-field--span-2 {
    grid-column: span 2;
}

.tkt-edit-grid--single {
    grid-template-columns: 1fr;
}

.ticket-form .form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.ticket-form .form-label {
    color: var(--app-text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.form-control-host textarea {
    min-height: 120px;
    resize: vertical;
}

/* Selects no padrão do filtro: chevron azul + respiro interno */
.form-control-host select {
    appearance: none;
    -webkit-appearance: none;
    padding: 10px 38px 10px 14px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23009ec5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
}

[data-theme-version="dark"] .form-control-host select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2317a6c5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* Campos somente leitura: aparência "desabilitada" */
.form-control-static {
    display: flex;
    align-items: center;
    min-height: var(--app-btn-height-sm);
    padding: 10px 12px;
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-soft);
    color: var(--app-text-muted);
}

.tkt-edit-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1px solid var(--app-border-default);
}

.tkt-edit-actions {
    display: flex;
    gap: 10px;
    margin-left: auto;
}

.tkt-edit-footer .form-error {
    color: var(--app-color-danger);
    font-size: 13px;
    font-weight: 700;
}

.app-btn-action[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ── Toast (notificação no topo-centro) ──────────────────────────── */
.toast-stack {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 240px;
    max-width: 90vw;
    padding: 12px 18px;
    border-radius: var(--app-radius-sm);
    box-shadow: var(--app-shadow-pop);
    font-size: 14px;
    font-weight: 600;
    color: var(--app-text-on-accent);
    opacity: 0;
    transform: translateY(-12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast .kb-icon {
    flex: none;
    font-size: 20px;
}

.toast--success {
    background: var(--app-color-success);
}

.toast--error {
    background: var(--app-color-danger);
}

/* Cards de detalhe lado a lado: o form preenche a altura do card e o
   footer (Cancelar/Salvar) fica no rodapé → botões alinhados entre cards */
.tickets-card--padded:has(> [data-ticket-form]) {
    display: flex;
    flex-direction: column;
}

.ticket-form[data-ticket-form] {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ticket-form[data-ticket-form] .tkt-edit-grid {
    flex: 1 1 auto;
    min-height: 0;
}

.ticket-form[data-ticket-form] .tkt-edit-footer {
    margin-top: auto;
}

/* Descrição cresce para acompanhar a altura do card vizinho (Resolução) */
.tkt-edit-grid--fill {
    grid-template-rows: 1fr;
}

.tkt-edit-grid--fill .form-field,
.tkt-edit-grid--fill .form-control-host {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.tkt-edit-grid--fill .form-control-host textarea {
    flex: 1 1 auto;
    height: 100%;
}

/* ── Lista compacta de anexos (sem tabela / sem scroll lateral) ──── */
.attachment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-card);
}

.attachment-item .kb-icon {
    flex: none;
    font-size: 18px;
    color: var(--app-text-muted);
}

.attachment-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--app-accent);
    font-size: 13px;
}

.attachment-date {
    flex: none;
    color: var(--app-text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.attachment-empty {
    color: var(--app-text-muted);
    font-size: 13px;
    padding: 6px 2px;
}

.editable-title {
    justify-content: space-between;
    margin-bottom: 14px;
}

.editable-display {
    white-space: pre-line;
}

.rich-text-box,
.timeline-item p,
.empty-state {
    color: var(--app-text-primary);
    font-size: 14px;
    line-height: 1.6;
}

.rich-text-box {
    min-height: 88px;
    overflow-wrap: anywhere;
}

.timeline-list {
    display: grid;
    gap: 12px;
}

.timeline-item {
    padding: 14px;
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-soft);
}

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

.timeline-item header strong {
    color: var(--app-text-primary);
}

.timeline-item header span {
    color: var(--app-text-muted);
    font-size: 12px;
    white-space: nowrap;
}

.timeline-item p,
.empty-state {
    margin: 0;
}

.icon-edit-button {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    border-radius: 10px;
}

.icon-edit-button .kb-icon {
    font-size: 18px;
    font-variation-settings: "FILL" 0, "wght" 350, "GRAD" 0, "opsz" 20;
}

.inline-editor {
    display: grid;
    gap: 8px;
}

.inline-editor textarea {
    min-height: 120px;
    resize: vertical;
}

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

.inline-editor-actions button {
    min-height: var(--app-btn-height-sm);
    padding: 0 14px;
    border: 1px solid var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-card);
    color: var(--app-text-primary);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.inline-editor-actions button:hover,
.inline-editor-actions button:focus-visible {
    border-color: var(--app-accent);
    background: var(--app-accent-hover);
    outline: none;
}

.inline-editor-actions [data-save-edit] {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: var(--app-text-on-accent);
}

.inline-editor-actions [data-save-edit]:hover,
.inline-editor-actions [data-save-edit]:focus-visible {
    background: var(--app-accent-dark);
    border-color: var(--app-accent-dark);
}

.inline-editor-actions [data-edit-error] {
    color: var(--app-color-danger);
    font-size: 12px;
    font-weight: 700;
}

.autocomplete-editor {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--app-border-strong);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-card);
    box-shadow: var(--app-shadow-pop);
}

.autocomplete-results button {
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--app-border-default);
    padding: 10px 12px;
    color: var(--app-text-primary);
    background: var(--app-surface-card);
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.autocomplete-results button:last-child {
    border-bottom: 0;
}

.autocomplete-results button:hover,
.autocomplete-results button:focus-visible {
    background: var(--app-accent-hover);
    color: var(--app-accent-dark);
    outline: none;
}

@media (max-width: 1100px) {
    .tickets-metrics-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .tickets-page-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .content-grid,
    .content-grid--6040,
	    .content-grid--3col,
	    .detail-grid-six,
	    .tkt-edit-grid {
	        grid-template-columns: 1fr;
	    }

	    .tkt-edit-grid--main .form-field--span-2 {
	        grid-column: auto;
	    }

	    .timeline-item header {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 640px) {
    .tickets-metrics-grid {
        grid-template-columns: 1fr;
    }

    .tickets-card--padded {
        padding: 18px;
    }

    .tickets-card-header {
        padding: 0;
    }
}

.autocomplete-form-field {
    position: relative;
}

.autocomplete-form-field .autocomplete-results {
    top: calc(100% - 2px);
}

.autocomplete-empty {
    padding: 9px 10px;
    color: var(--app-text-muted);
    background: var(--app-surface-card);
    font-size: 13px;
    font-weight: 400;
}



.tickets-auth-hero {
    min-height: 340px;
    align-items: center;
}

.tickets-public-copy {
    margin: 0;
    color: var(--app-text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.tickets-login-section {
    display: flex;
    justify-content: center;
    padding-top: 46px;
}

.tickets-login-card {
    width: min(100%, 440px);
}

/* ── Login: tela cheia (form + painel da marca) ──────────────────── */
body.tickets-login .tickets-main {
    padding: 0;
    min-height: 0;
}

.login-full {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

.login-full-form {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    /* mesmo gradient do hero da landing (communy-leads --lp-hero-bg) */
    background: linear-gradient(to bottom right, rgba(203, 235, 243, 1), rgba(235, 248, 247, 1), rgba(252, 235, 185, 1));
}

[data-theme-version="dark"] .login-full-form {
    background: linear-gradient(to bottom right, rgba(0, 158, 197, 0.12), rgba(23, 166, 197, 0.06), rgba(30, 40, 50, 0)), var(--app-surface-card);
}

.login-card-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    text-decoration: none;
}

.login-card-hint {
    margin: 0 0 22px;
    color: var(--app-text-muted);
    font-size: 14px;
    line-height: 1.5;
}

.login-full-inner {
    width: min(100%, 460px);
    padding: 40px 38px;
    border: 1px solid var(--app-border-default);
    border-radius: 20px;
    background: var(--app-surface-card);
}

.login-full-inner h1 {
    margin: 8px 0 8px;
    font-size: 28px;
    color: var(--app-text-primary);
}

.login-full-inner > p {
    margin: 0 0 22px;
    color: var(--app-text-muted);
}

.login-full-visual {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 56px 64px;
    background: linear-gradient(150deg, var(--app-accent), var(--app-accent-dark));
    color: var(--app-text-on-accent, #fff);
}

.login-visual-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 32px;
}

.login-visual-links {
    position: relative;
    z-index: 1;
    list-style: none;
    margin: 24px 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px 22px;
    font-size: 12px;
}

.login-visual-links a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.82);
    text-decoration: none;
}

.login-visual-links a:hover,
.login-visual-links a:focus-visible {
    color: var(--app-text-on-accent, #fff);
    outline: none;
}

.login-visual-links .kb-icon {
    font-size: 16px;
}

.login-full-visual::after {
    content: '';
    position: absolute;
    right: -140px;
    bottom: -140px;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.16), transparent 70%);
    pointer-events: none;
}

.login-visual-icons {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 14px;
}

.login-visual-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: var(--app-radius-md);
    background: rgba(255, 255, 255, 0.16);
    color: var(--app-text-on-accent, #fff);
}

.login-visual-icon .kb-icon {
    font-size: 30px;
}

.login-visual-copy {
    position: relative;
    z-index: 1;
}

.login-visual-copy h2 {
    margin: 0 0 16px;
    font-size: clamp(2.1rem, 1.5rem + 2.2vw, 3.1rem);
    font-weight: 400;
    line-height: 1.12;
    letter-spacing: -0.01em;
}

.login-visual-copy p {
    margin: 0;
    line-height: 1.6;
    opacity: 0.92;
}

.login-visual-points {
    position: relative;
    z-index: 1;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.login-visual-points li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.login-visual-points .kb-icon {
    font-size: 20px;
}

@media (max-width: 820px) {
    .login-full {
        grid-template-columns: 1fr;
    }

    .login-full-visual {
        display: none;
    }
}

.tickets-login-card h1 {
    margin: 0 0 8px;
    font-size: 28px;
}

.tickets-login-card p {
    margin: 0 0 18px;
    color: var(--app-text-muted);
}

.tickets-login-form {
    display: grid;
    gap: 14px;
}

.tickets-login-form label {
    display: grid;
    gap: 6px;
    color: var(--app-text-muted);
    font-size: 13px;
    font-weight: 700;
}

.tickets-login-help {
    justify-self: start;
    color: var(--app-accent);
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.tickets-login-help:hover,
.tickets-login-help:focus-visible {
    text-decoration: underline;
}

.password-rules {
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-soft);
}

.password-rules-title {
    color: var(--app-text-muted);
    font-size: 12px;
    font-weight: 700;
}

.password-rules ul {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.password-rules li {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--app-text-muted);
    font-size: 12px;
    line-height: 1.35;
}

.password-rules li .kb-icon {
    flex: none;
    font-size: 17px;
}

.password-rules li.is-valid {
    color: var(--app-color-success);
}

.password-rules li.is-invalid {
    color: var(--app-color-danger);
}

.tickets-login-form button {
    min-height: 42px;
    border: 1px solid var(--app-accent);
    border-radius: var(--app-radius-sm);
    color: var(--app-text-on-accent, #fff);
    background: var(--app-accent);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}

.tickets-login-form button:hover,
.tickets-login-form button:focus-visible {
    background: var(--app-accent-dark);
    border-color: var(--app-accent-dark);
    outline: none;
}

.login-alert {
    margin-bottom: 14px;
    border: 1px solid rgba(220, 38, 38, .25);
    border-radius: 6px;
    padding: 10px 12px;
    color: #b91c1c;
    background: rgba(254, 226, 226, .8);
    font-size: 13px;
}


.tickets-hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.ticket-form {
    display: grid;
    gap: 18px;
}

.ticket-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

.ticket-form-field {
    display: grid;
    gap: 6px;
    color: var(--app-text-muted);
    font-size: 13px;
    font-weight: 700;
}

.ticket-form-field-full {
    grid-column: 1 / -1;
}

.ticket-form-field select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23009ec5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 18px;
}
[data-theme-version="dark"] .ticket-form-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2317a6c5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

.ticket-form-field textarea {
    min-height: 140px;
    resize: vertical;
}

.ticket-form-field .errorlist {
    margin: 0;
    padding: 0;
    color: #dc2626;
    font-size: 12px;
    font-weight: 600;
    list-style: none;
}

.ticket-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.ticket-field-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ticket-field-label label {
    font: inherit;
    color: inherit;
}

.field-info-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--app-text-muted);
    cursor: pointer;
    line-height: 0;
    /* none garante o ligature do ícone mesmo herdando uppercase (label do card) */
    text-transform: none;
    transition: color 0.15s ease, background 0.15s ease;
}

.field-info-trigger:hover,
.field-info-trigger[aria-expanded="true"] {
    color: var(--app-accent);
    background: var(--app-accent-hover);
}

.field-info-trigger .kb-icon {
    font-size: 16px;
}

.field-info-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 20;
    width: max-content;
    max-width: 260px;
    padding: 12px 14px;
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-card);
    box-shadow: var(--app-shadow-pop);
    color: var(--app-text-primary);
    /* auto-contido: reseta heranças do label (uppercase/centralizado do card) */
    font-size: 13px;
    font-weight: 600;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    white-space: normal;
}

/* Reuso no card: label em maiúsculas e centralizado, e acima do link do card */
.ticket-card-field-label:has(.field-info-trigger) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: relative;
    z-index: 2;
}

/* Com o popover aberto, eleva o label ativo acima dos labels dos outros cards
   (que também têm z-index:2 e, por virem depois no DOM, cobririam o popover). */
.ticket-card-field-label:has([data-priority-popover]:not([hidden])) {
    z-index: 30;
}

/* O ícone (16px) não pode esticar o line-box do label, senão o cabeçalho
   "Prioridade" desalinha dos demais. Margem vertical negativa neutraliza a altura. */
.ticket-card-field-label .field-info-trigger {
    width: 16px;
    height: 16px;
    margin-block: -4px;
}

.ticket-card-field-label .field-info-trigger .kb-icon {
    font-size: 15px;
}

.ticket-card-field-label .field-info-popover {
    left: 50%;
    transform: translateX(-50%);
}

.field-info-popover-title {
    margin: 0 0 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--app-text-muted);
}

.field-info-popover ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.field-info-popover li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 13px;
    font-weight: 600;
}

.field-info-popover li .priority-pill {
    min-width: 96px;
}

.field-info-popover li span:last-child {
    color: var(--app-text-muted);
    white-space: nowrap;
}

.form-alert {
    border: 1px solid rgb(from var(--app-color-danger) r g b / 0.3);
    border-radius: var(--app-radius-sm);
    padding: 10px 12px;
    color: var(--app-danger-soft-text);
    background: var(--app-danger-soft-bg);
    font-size: 13px;
}

@media (max-width: 900px) {
    .tickets-hero-actions,
    .ticket-form-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .ticket-form-grid {
        grid-template-columns: 1fr;
    }
}


.ticket-inline-form {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    padding: 16px;
    background: var(--app-surface-soft);
}

.ticket-inline-form label {
    display: grid;
    gap: 6px;
    color: var(--app-text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ticket-inline-form textarea {
    min-height: 110px;
    resize: vertical;
}

.ticket-inline-form button {
    justify-self: end;
}

.ticket-email-recipient {
    margin: 0;
    color: var(--app-text-muted);
    font-size: 13px;
}

.ticket-email-recipient strong {
    color: var(--app-text-primary);
}

.ticket-email-recipient span {
    display: block;
    margin-top: 2px;
}

.ticket-email-attachments {
    display: grid;
    gap: 8px;
}

.ticket-email-attachments-title {
    color: var(--app-text-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.ticket-email-attachment-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--app-border-default);
    border-radius: var(--app-radius-sm);
    background: var(--app-surface-card);
    color: var(--app-text-primary);
    font-size: 13px;
    letter-spacing: 0;
    text-transform: none;
}

.ticket-email-attachment-option input[type="checkbox"] {
    flex: none;
    width: 16px;
    height: 16px;
    min-height: 0;
    padding: 0;
    margin: 0;
}
