/* SAC / Chamados — botão fixo e modais na Central de Ajuda */
/* SweetAlert2 acima dos modais SAC (overlay z-index 99995) */
body > .swal2-container {
    z-index: 100050 !important;
}

.sac-ajuda-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99990;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.sac-ajuda-fab__main {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #0068ff 0%, #0050cc 100%);
    box-shadow: 0 8px 28px rgba(0, 104, 255, 0.45);
    transition: transform 0.15s, box-shadow 0.15s;
}

.sac-ajuda-fab__main:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 104, 255, 0.5);
}

.sac-ajuda-fab__menu {
    display: none;
    flex-direction: column;
    gap: 6px;
    min-width: 220px;
    padding: 10px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
    border: 1px solid #e2e8f0;
}

.sac-ajuda-fab.open .sac-ajuda-fab__menu {
    display: flex;
}

.sac-ajuda-fab__menu button {
    text-align: left;
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    background: #f8fafc;
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
    cursor: pointer;
    transition: background 0.12s;
}

.sac-ajuda-fab__menu button:hover {
    background: #e0f2fe;
    color: #0068ff;
}

.sac-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 99995;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
}

.sac-modal-overlay.open {
    display: flex;
}

.sac-modal {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 720px;
    max-height: min(90vh, 880px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.sac-modal--wide {
    max-width: 920px;
}

.sac-modal__head {
    padding: 14px 18px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.sac-modal__head h2 {
    margin: 0;
    font-size: 1.05rem;
    color: #0f172a;
}

.sac-modal__close {
    border: none;
    background: #f1f5f9;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    color: #64748b;
    font-size: 1.1rem;
}

.sac-modal__close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.sac-modal__body {
    padding: 14px 18px;
    overflow-y: auto;
    flex: 1;
}

.sac-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}

.sac-toolbar input[type="search"],
.sac-toolbar select {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
}

.sac-toolbar input[type="search"] {
    flex: 1;
    min-width: 160px;
}

.sac-btn {
    padding: 8px 14px;
    border-radius: 10px;
    border: none;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.sac-btn--primary {
    background: #0068ff;
    color: #fff;
}

.sac-btn--ghost {
    background: #f1f5f9;
    color: #334155;
}

.sac-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sac-list-item {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    text-align: left;
    background: #fff;
    transition: border-color 0.12s, box-shadow 0.12s;
}

.sac-list-item:hover {
    border-color: #0068ff;
    box-shadow: 0 4px 14px rgba(0, 104, 255, 0.1);
}

.sac-list-item__title {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.92rem;
}

.sac-list-item__meta {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 4px;
}

.sac-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    margin-top: 6px;
}

.sac-empty {
    text-align: center;
    color: #94a3b8;
    padding: 2rem;
    font-size: 0.9rem;
}

.sac-msg-feed {
    max-height: 340px;
    overflow-y: auto;
    padding: 8px;
    background: #f1f5f9;
    border-radius: 12px;
    margin-bottom: 12px;
}

.sac-msg {
    max-width: 92%;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.45;
}

.sac-msg--me {
    margin-left: auto;
    background: linear-gradient(135deg, #0068ff, #0050cc);
    color: #fff;
}

.sac-msg--them {
    margin-right: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
}

.sac-msg__head {
    font-size: 0.72rem;
    opacity: 0.9;
    margin-bottom: 4px;
    font-weight: 600;
}

.sac-msg__body {
    word-break: break-word;
}

.sac-msg__body p {
    margin: 0 0 0.4em;
}

.sac-msg__body p:last-child {
    margin-bottom: 0;
}

.sac-msg__body ul,
.sac-msg__body ol {
    margin: 0.35em 0 0.45em;
    padding-left: 1.35em;
    list-style-position: outside;
}

.sac-msg__body ul {
    list-style-type: disc !important;
}

.sac-msg__body ol {
    list-style-type: decimal !important;
}

.sac-msg__body li {
    margin: 0.2em 0;
    display: list-item;
}

.sac-msg__body strong,
.sac-msg__body b {
    font-weight: 800;
}

.sac-msg__body em,
.sac-msg__body i {
    font-style: italic;
}

.sac-msg--sistema {
    margin-left: auto;
    margin-right: auto;
    max-width: 96%;
    text-align: center;
    background: #fff;
    border: 1px dashed #cbd5e1;
    color: #475569;
}

.sac-msg-status-change {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.45rem 0.65rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.sac-msg-status-old {
    color: #64748b;
}

.sac-msg-status-arrow {
    color: #94a3b8;
    font-size: 0.72rem;
}

.sac-msg-status-new {
    color: #0068ff;
}

/* Cabeçalho do chamado (detalhes) */
.sac-chamado-hero {
    margin-bottom: 16px;
    padding: 16px 18px;
    border-radius: 14px;
    background: linear-gradient(135deg, #f0f7ff 0%, #f8fafc 48%, #fff 100%);
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 20px rgba(0, 104, 255, 0.06);
}

.sac-chamado-hero__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.sac-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.sac-status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.85;
}

.sac-status-pill--aguardando {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.sac-status-pill--em_atendimento {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.sac-status-pill--agendado {
    background: #f5f3ff;
    color: #5b21b6;
    border: 1px solid #ddd6fe;
}

.sac-status-pill--reprovado_internamente {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

.sac-status-pill--fechado_solucionado {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.sac-status-pill--fechado_reprovado,
.sac-status-pill--fechado_paliativo {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.sac-status-pill--default {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.sac-chamado-hero__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px 20px;
}

.sac-chamado-hero__item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.sac-chamado-hero__item--wide {
    grid-column: 1 / -1;
}

.sac-chamado-hero__label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}

.sac-chamado-hero__value {
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f172a;
    line-height: 1.4;
    word-break: break-word;
}

.sac-chamado-hero__value--muted {
    font-weight: 500;
    color: #475569;
    font-size: 0.84rem;
}


.sac-compose textarea {
    width: 100%;
    min-height: 72px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font-size: 0.88rem;
    resize: vertical;
    margin-bottom: 8px;
}

.sac-compose-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    justify-content: space-between;
}

.sac-compose-row .sac-file-field {
    flex: 1;
    min-width: 200px;
}

/* Upload de arquivos (novo chamado e mensagem) */
.sac-file-field {
    position: relative;
}

.sac-file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.sac-file-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 2px dashed #cbd5e1;
    background: #f8fafc;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.sac-file-label:hover {
    border-color: #0068ff;
    background: #eff6ff;
    color: #0068ff;
}

.sac-file-label:focus-within,
.sac-file-field:focus-within .sac-file-label {
    outline: 2px solid rgba(0, 104, 255, 0.35);
    outline-offset: 2px;
}

.sac-file-label__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #fff;
    color: #0068ff;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 104, 255, 0.12);
}

.sac-file-label__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    text-align: left;
}

.sac-file-label__text strong {
    font-size: 0.86rem;
    color: #0f172a;
}

.sac-file-label__hint {
    font-size: 0.72rem;
    font-weight: 500;
    color: #94a3b8;
}

.sac-file-names {
    margin-top: 8px;
    font-size: 0.76rem;
    color: #64748b;
    line-height: 1.45;
}

.sac-file-names:empty {
    display: none;
}

.sac-file-names ul {
    margin: 0;
    padding-left: 1.1rem;
}

.sac-btn--loading {
    position: relative;
    pointer-events: none;
    opacity: 0.85;
}

.sac-btn--loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: middle;
    animation: sac-spin 0.65s linear infinite;
}

.sac-btn--ghost.sac-btn--loading::after {
    border-color: rgba(51, 65, 85, 0.25);
    border-top-color: #334155;
}

@keyframes sac-spin {
    to {
        transform: rotate(360deg);
    }
}

.sac-form-row {
    margin-bottom: 12px;
}

.sac-form-row label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 4px;
}

.sac-form-row input,
.sac-form-row select,
.sac-form-row textarea {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    font-size: 0.88rem;
}

.sac-form-row textarea {
    min-height: 100px;
    resize: vertical;
}

.sac-urgencia-hint {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 8px;
    padding: 8px 10px;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 3px solid #0068ff;
    line-height: 1.45;
}

.sac-locked {
    padding: 12px;
    background: #fffbeb;
    border-radius: 10px;
    font-size: 0.88rem;
    color: #92400e;
    margin-bottom: 10px;
}

.sac-reabrir-box {
    padding: 14px 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    margin-bottom: 10px;
}

.sac-reabrir-box__text {
    margin: 0 0 12px;
    font-size: 0.88rem;
    color: #1e40af;
    line-height: 1.45;
}

/* Mensagens não lidas — brilho azul no SAC e badges */
@keyframes sacUnreadPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0, 104, 255, 0.55), 0 0 12px rgba(0, 104, 255, 0.35);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(0, 104, 255, 0), 0 0 22px rgba(0, 104, 255, 0.55);
    }
}

.sac-ajuda-fab__main.sac-unread-glow,
button.btn-sac-sidebar.sac-unread-glow {
    animation: sacUnreadPulse 2s ease-in-out infinite;
    border-color: #0068ff !important;
}

.sac-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 5px;
    margin-left: 8px;
    border-radius: 999px;
    background: #0068ff;
    color: #fff;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.sac-ajuda-fab__menu button,
.sidebar-sac-submenu button {
    position: relative;
}

.sac-ajuda-fab__menu button .sac-unread-badge,
.sidebar-sac-submenu button .sac-unread-badge {
    margin-left: auto;
}

.sac-list-item {
    position: relative;
}

.sac-list-item--unread {
    border-color: #93c5fd !important;
    background: #f0f7ff !important;
}

.sac-list-item__title .sac-unread-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    margin-left: 0;
}
