/* ============================================================================
   WHISTLE — Canal confidencial de denúncia
   Identidade visual: calma, credível, discreta. Nada chamativo — o
   objetivo é transmitir segurança a alguém que pode estar em situação
   de estresse ao usar este formulário.
   ============================================================================ */

:root {
    /* Paleta */
    --bg: #F2F4F3;
    --surface: #FFFFFF;
    --surface-muted: #E9EDEB;
    --ink: #1B2A2E;
    --ink-soft: #41525A;
    --border: #DCE3E1;
    --primary: #1F5D52;
    --primary-dark: #163F38;
    --primary-soft: #E4EEEC;
    --accent-brass: #A9792C;
    --accent-brass-soft: #F3E9D6;
    --danger: #A3372F;
    --danger-soft: #F6E6E4;
    --focus-ring: #2E6E83;

    /* Tipografia */
    --font-display: "Fraunces", "Iowan Old Style", serif;
    --font-body: "Public Sans", -apple-system, "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;

    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 1px 2px rgba(27, 42, 46, 0.06), 0 8px 24px rgba(27, 42, 46, 0.06);
}

* {
    box-sizing: border-box;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px 40px;
}

.brand-eyebrow {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink-soft);
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 28px;
}

.logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
    min-height: 1px; /* evita "pulo" de layout antes do logo carregar */
}

.empresa-logo {
    height: 84px;
    max-width: 380px;
    object-fit: contain;
    /* Mascara fundos brancos sólidos vindos do arquivo original (PNG/JPEG
       sem transparência real) — funciona bem quando a página tem fundo
       claro, como é o nosso caso. Não substitui um logo com transparência
       de verdade, mas resolve a maioria dos casos sem precisar reenviar o arquivo. */
    mix-blend-mode: multiply;
}

.brand-eyebrow .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

.card {
    width: 100%;
    max-width: 680px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 20px;
}

.divisor {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

@media (max-width: 480px) {
    .card { padding: 18px 16px; }
    .page { padding: 18px 12px 32px; }
}

h1.title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 30px;
    line-height: 1.2;
    margin: 0 0 10px;
    color: var(--primary-dark);
}

.titulo-canal {
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 22px;
    line-height: 1.3;
    margin: 0 0 10px;
    color: var(--primary-dark);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

p.subtitle {
    color: var(--ink-soft);
    margin: 0 0 18px;
    font-size: 15px;
}

label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin: 14px 0 6px;
    color: var(--ink);
}

label .opcional {
    font-weight: 400;
    color: var(--ink-soft);
    text-transform: none;
}

input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    font-family: var(--font-body);
    font-size: 15px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--ink);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

textarea {
    min-height: 110px;
    resize: vertical;
    line-height: 1.5;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.hint {
    font-size: 13px;
    color: var(--ink-soft);
    margin-top: 6px;
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 0;
    padding: 14px 16px;
    background: var(--surface-muted);
    border-radius: var(--radius);
}

.checkbox-row--sem-fundo {
    background: none;
    padding: 14px 0;
}

.checkbox-row input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.checkbox-row .checkbox-text {
    font-size: 14px;
    color: var(--ink);
}

.checkbox-row .checkbox-text strong {
    display: block;
    margin-bottom: 2px;
}

.link-termo {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}
.link-termo:hover { color: var(--primary-dark); }

.envolvidos-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.envolvido-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 8px;
}

@media (max-width: 480px) {
    .envolvido-row { grid-template-columns: 1fr; }
}

.btn {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15px;
    border: none;
    border-radius: var(--radius);
    padding: 13px 22px;
    cursor: pointer;
    transition: background 120ms ease, transform 60ms ease;
}

.btn:active { transform: scale(0.99); }

.btn-primary {
    background: var(--primary);
    color: #fff;
    width: 100%;
    margin-top: 28px;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled {
    background: var(--surface-muted);
    color: var(--ink-soft);
    cursor: not-allowed;
}

.btn-ghost {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
    padding: 9px 16px;
    font-size: 14px;
}
.btn-ghost:hover { background: var(--primary-soft); }

.btn-small-add {
    background: var(--primary-soft);
    color: var(--primary-dark);
    border: none;
    border-radius: var(--radius);
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    align-self: flex-start;
    margin-top: 4px;
}

.btn-remove {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--danger);
    border-radius: var(--radius);
    width: 40px;
    cursor: pointer;
    font-size: 16px;
}

.error-box {
    background: var(--danger-soft);
    color: var(--danger);
    border-radius: var(--radius);
    padding: 12px 14px;
    font-size: 14px;
    margin-top: 18px;
    display: none;
}
.error-box.visible { display: block; }

/* ---- Ticket de protocolo (elemento de assinatura visual) ---- */

.ticket {
    position: relative;
    background: var(--primary-dark);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 28px 28px 24px;
    overflow: hidden;
}

.ticket::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 132px;
    height: 0;
    border-top: 2px dashed rgba(255, 255, 255, 0.25);
}

.ticket::after {
    content: "";
    position: absolute;
    left: -10px;
    top: 122px;
    width: 20px;
    height: 20px;
    background: var(--bg);
    border-radius: 50%;
    box-shadow: 540px 0 0 var(--bg);
}

.ticket-stamp {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-brass-soft);
    border: 1px solid rgba(243, 233, 214, 0.4);
    border-radius: 999px;
    padding: 4px 10px;
    display: inline-block;
    margin-bottom: 16px;
}

.ticket-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 4px;
}

.ticket-field {
    flex: 1;
}

.ticket-field .ticket-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.55);
    margin-bottom: 4px;
}

.ticket-field .ticket-value {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--accent-brass-soft);
}

.ticket-bottom {
    margin-top: 26px;
    padding-top: 18px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.5;
}

.ticket-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
}

.ticket-actions .btn {
    flex: 1;
}

.btn-on-dark {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 13px;
    padding: 9px 14px;
}
.btn-on-dark:hover { background: rgba(255, 255, 255, 0.2); }

.copy-feedback {
    font-size: 12px;
    color: var(--accent-brass-soft);
    margin-top: 8px;
    height: 16px;
    opacity: 0;
    transition: opacity 150ms ease;
}
.copy-feedback.visible { opacity: 1; }

/* ---- Cabeçalho da denúncia (página de acompanhamento) ---- */

.status-header {
    padding-bottom: 20px;
    margin-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

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

.protocolo-mono {
    font-family: var(--font-mono);
    font-size: 19px;
    font-weight: 600;
    color: var(--primary-dark);
    letter-spacing: 0.01em;
}

.status-descricao {
    font-size: 14.5px;
    color: var(--ink);
    line-height: 1.55;
    margin: 0 0 14px;
}

.meta-line {
    font-size: 14.5px;
    color: var(--ink);
    margin: 0 0 4px;
}
.meta-line-label {
    color: var(--ink-soft);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.envolvido-linha {
    font-size: 14px;
    color: var(--ink);
    margin: 0 0 4px;
}

/* ---- Moldura da conversa: estilo transcrição (não chat de bolhas) ----
   Consistente com o resto do produto: fundo branco, bordas finas,
   tipografia fazendo o trabalho — sem blocos coloridos ou cinza sobre
   cinza, que destoavam da identidade visual do restante das telas. */

.thread-frame {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.btn-scroll-bottom {
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(27, 42, 46, 0.78);
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms ease, transform 150ms ease;
    z-index: 5;
}
.btn-scroll-bottom.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}
.btn-scroll-bottom:hover { background: rgba(27, 42, 46, 0.92); }

.thread-scroll {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    min-height: 160px;
    max-height: 60vh;
    overflow-y: auto;
}

.composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 10px 16px;
    flex-shrink: 0;
}

.composer-attach {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--primary);
    font-size: 17px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.composer-attach:hover { background: var(--primary-soft); }

.composer-textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-family: var(--font-body);
    font-size: 14.5px;
    line-height: 1.45;
    padding: 7px 4px;
    /* Altura para aproximadamente 3 linhas de texto */
    min-height: 64px;
    max-height: 64px;
    color: var(--ink);
}
.composer-textarea:focus-visible { outline: none; }

.composer-send {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.composer-send:hover { background: var(--primary-dark); }
.composer-send:disabled { background: var(--border); cursor: not-allowed; }

.composer-filename {
    font-size: 12px;
    color: var(--ink-soft);
    padding: 0 16px 10px;
    background: var(--surface);
}

/* ---- Bolhas de mensagem, estilo app de conversa (WhatsApp) ----
   Mensagens do denunciante à direita, do responsável à esquerda —
   referência visual familiar para reconhecer rapidamente quem disse o quê. */

.msg-row {
    display: flex;
}
.msg-row.origem-denunciante { justify-content: flex-end; }
.msg-row.origem-responsavel { justify-content: flex-start; }

.bolha {
    max-width: 78%;
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 14.5px;
    line-height: 1.5;
}

.bolha.origem-denunciante {
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-bottom-right-radius: 4px;
}

.bolha.origem-responsavel {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.bolha-meta {
    font-size: 11px;
    color: var(--ink-soft);
    opacity: 0.8;
    margin-top: 4px;
}

.bolha-removida {
    font-style: italic;
    color: var(--ink-soft);
}

.bolha-anexo {
    display: flex;
    align-items: center;
    gap: 7px;
}
.bolha-anexo-icone { font-size: 13px; }
.bolha-anexo-nome { font-weight: 600; }
.bolha-anexo-abrir {
    background: none;
    border: none;
    color: var(--primary-dark);
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    margin-left: 2px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    text-transform: capitalize;
}

.empty-state {
    text-align: center;
    color: var(--ink-soft);
    font-size: 14px;
    padding: 20px 0;
}

.field-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    margin-bottom: 4px;
}
.field-value { font-size: 14.5px; margin-bottom: 4px; }

.anexo-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
}
.anexo-item:last-child { border-bottom: none; }
.anexo-nome { font-weight: 600; }
.anexo-meta { color: var(--ink-soft); font-size: 12px; }

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 700ms linear infinite;
    vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.footer-note {
    margin-top: 28px;
    text-align: center;
    font-size: 12.5px;
    color: var(--ink-soft);
    max-width: 480px;
}

.link-quiet {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}
.link-quiet:hover { text-decoration: underline; }
