*{box-sizing:border-box}
body{margin:0;font-family:Arial,Helvetica,sans-serif;background:#f4f7fb;color:#1f2937}
a{color:#0f766e;text-decoration:none}
.public-wrap{max-width:980px;margin:0 auto;padding:24px}
.hero{text-align:center;margin:20px 0}.hero h1{margin:0;color:#0f172a}.hero p{color:#475569}
.chat-shell,.card{background:#fff;border:1px solid #e2e8f0;border-radius:16px;box-shadow:0 8px 22px rgba(15,23,42,.08);overflow:hidden}
.chat-header{background:#0f172a;color:#fff;padding:16px 20px;display:flex;justify-content:space-between}.chat-header span{background:#16a34a;border-radius:999px;padding:3px 10px;font-size:12px}
.start-form{padding:22px;display:grid;gap:12px}.start-form input,.start-form textarea,.composer input,select,textarea{width:100%;border:1px solid #cbd5e1;border-radius:10px;padding:12px;font-size:15px}
.start-form textarea{min-height:100px}.choice-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}.choice{border:1px solid #0f766e;background:#fff;color:#0f766e;padding:12px;border-radius:10px;cursor:pointer;font-weight:bold}.choice.active{background:#0f766e;color:#fff}
.btn{border:0;border-radius:10px;background:#0f766e;color:#fff;padding:12px 16px;cursor:pointer;font-weight:bold}.btn.secondary{background:#334155}.btn.danger{background:#b91c1c}
.check{font-size:14px;color:#334155}.disclaimer{font-size:13px;color:#64748b}.hidden{display:none!important}.chat-area{padding:16px}.messages{height:420px;overflow:auto;background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:16px}
.msg{display:flex;margin:8px 0}.msg.patient{justify-content:flex-end}.msg.ai,.msg.admin,.msg.system{justify-content:flex-start}.bubble{max-width:78%;padding:10px 12px;border-radius:14px;background:#e2e8f0;line-height:1.35}.msg.patient .bubble{background:#d1fae5}.msg.ai .bubble{background:#e0f2fe}
.composer{display:flex;gap:8px;margin-top:10px}.composer input{flex:1}.attach-row{margin-top:10px;display:flex;gap:8px;align-items:center}.whatsapp-link{display:block;text-align:center;margin-top:12px;background:#22c55e;color:#fff;border-radius:10px;padding:10px}
.admin-bg{padding:24px}.card{max-width:1120px;margin:20px auto;padding:22px}.card.small{max-width:420px}.admin-nav{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:16px}.admin-nav a{background:#0f172a;color:#fff;padding:9px 12px;border-radius:8px}
.table{width:100%;border-collapse:collapse;background:#fff}.table th,.table td{border-bottom:1px solid #e2e8f0;padding:10px;text-align:left;vertical-align:top}.badge{display:inline-block;border-radius:999px;padding:3px 8px;background:#e2e8f0;font-size:12px}.badge.urgent{background:#fee2e2;color:#991b1b}.badge.high{background:#ffedd5;color:#9a3412}.alert{padding:10px 12px;background:#fef9c3;border:1px solid #fde68a;border-radius:10px;margin-bottom:12px}.grid{display:grid;grid-template-columns:340px 1fr;gap:16px}.sidebar-list{max-height:680px;overflow:auto;border:1px solid #e2e8f0;border-radius:12px}.case-item{display:block;padding:12px;border-bottom:1px solid #e2e8f0;color:#1f2937}.case-item:hover{background:#f8fafc}.case-item.active{background:#e0f2fe}.admin-messages{height:520px;overflow:auto;border:1px solid #e2e8f0;border-radius:12px;padding:12px;background:#f8fafc}.form-row{display:flex;gap:8px;margin-top:10px}.form-row input,.form-row textarea,.form-row select{flex:1}
@media(max-width:760px){.grid{grid-template-columns:1fr}.choice-row{grid-template-columns:1fr}.bubble{max-width:92%}}

#errorBox{margin-bottom:10px}.alert.hidden{display:none!important}#newChatBtn{margin-top:10px;width:100%}


/* ===== Admin Dashboard v3.7 ===== */
.admin-bg{
    padding:24px;
    background:#eef3f9;
}
.admin-container{
    max-width:1180px;
    margin:0 auto;
    background:#fff;
    border:1px solid #dbe4ef;
    border-radius:18px;
    box-shadow:0 10px 28px rgba(15,23,42,.08);
    padding:26px;
}
.admin-header{
    display:flex;
    justify-content:space-between;
    align-items:flex-start;
    gap:16px;
    margin-bottom:22px;
}
.admin-header h1{
    margin:0 0 8px;
    color:#0f172a;
    font-size:32px;
}
.admin-header p{
    margin:0;
    color:#334155;
}
.admin-actions{
    display:flex;
    gap:8px;
}
.stats-grid{
    display:grid;
    grid-template-columns:repeat(4, minmax(0, 1fr));
    gap:18px;
    margin:24px 0 30px;
}
.stat-card{
    display:block;
    background:#ffffff;
    border:1px solid #dbe4ef;
    border-radius:16px;
    padding:22px;
    color:#0f172a;
    box-shadow:0 8px 20px rgba(15,23,42,.06);
    transition:.15s ease;
    min-height:135px;
}
.stat-card:hover{
    transform:translateY(-2px);
    box-shadow:0 12px 26px rgba(15,23,42,.10);
}
.stat-number{
    font-size:34px;
    font-weight:800;
    margin-bottom:10px;
}
.stat-label{
    font-size:17px;
    font-weight:700;
    margin-bottom:4px;
}
.stat-help{
    font-size:13px;
    color:#64748b;
}
.alert-card{
    border-color:#fecaca;
    background:#fff7f7;
}
.alert-card .stat-number{
    color:#b91c1c;
}
.section-card{
    background:#fff;
    border:1px solid #e2e8f0;
    border-radius:16px;
    padding:20px;
}
.section-title{
    display:flex;
    justify-content:space-between;
    align-items:center;
    margin-bottom:14px;
}
.section-title h2{
    margin:0;
    color:#0f172a;
}
.section-title span{
    color:#64748b;
    font-size:14px;
}
.empty-state{
    text-align:center;
    padding:40px 20px;
    background:#f8fafc;
    border:1px dashed #cbd5e1;
    border-radius:14px;
    color:#475569;
}
.empty-state h3{
    margin-top:0;
    color:#0f172a;
}
.table-wrap{
    overflow-x:auto;
}
.small-btn{
    padding:8px 12px;
    display:inline-block;
}
@media(max-width:900px){
    .stats-grid{
        grid-template-columns:repeat(2, minmax(0, 1fr));
    }
    .admin-header{
        flex-direction:column;
    }
}
@media(max-width:560px){
    .stats-grid{
        grid-template-columns:1fr;
    }
    .admin-container{
        padding:18px;
    }
}


/* ===== v3.8 Identificação do paciente no chat ===== */
.contact-box{
    margin-top:12px;
    padding:14px;
    background:#f8fafc;
    border:1px solid #dbe4ef;
    border-radius:14px;
}
.contact-title{
    font-weight:700;
    color:#0f172a;
    margin-bottom:10px;
}
.contact-grid{
    display:grid;
    grid-template-columns:1.4fr 1fr 1.2fr 1fr auto;
    gap:8px;
    align-items:center;
}
.contact-grid input,
.contact-grid select{
    border:1px solid #cbd5e1;
    border-radius:10px;
    padding:11px;
    font-size:14px;
    width:100%;
}
.contact-saved{
    background:#ecfdf5;
    border-color:#bbf7d0;
}
@media(max-width:900px){
    .contact-grid{
        grid-template-columns:1fr;
    }
}


/* ===== v3.9 Alertas no painel admin ===== */
.nav-button{
    background:#0f172a;
    color:#fff;
    border:0;
    padding:9px 12px;
    border-radius:8px;
    cursor:pointer;
    font:inherit;
}
.new-message-flash .admin-container{
    box-shadow:0 0 0 4px rgba(34,197,94,.25), 0 10px 28px rgba(15,23,42,.08);
}
.row-urgent{
    background:#fff7f7;
}
.row-urgent td:first-child{
    border-left:4px solid #dc2626;
}
.last-message{
    color:#64748b;
    display:block;
    margin-top:4px;
    max-width:420px;
}


/* ===== v4.0 Conversa admin em tempo quase real ===== */
.live-status{
    margin:8px 0 12px;
    color:#64748b;
    font-size:13px;
}
.admin-messages{
    scroll-behavior:smooth;
}
.msg.system .bubble{
    background:#fef9c3;
}


/* ===== v4.3 Motor local de respostas ===== */
.local-ai-form label{
    display:block;
    font-weight:700;
    margin-top:12px;
}
.local-ai-form input,
.local-ai-form select,
.local-ai-form textarea{
    width:100%;
    border:1px solid #cbd5e1;
    border-radius:10px;
    padding:10px;
    font-size:14px;
    box-sizing:border-box;
}
.local-ai-form small{
    color:#64748b;
}
.form-grid{
    display:grid;
    grid-template-columns:repeat(4, minmax(0, 1fr));
    gap:12px;
}
.btn.danger{
    background:#b91c1c;
    color:#fff;
}
@media(max-width:900px){
    .form-grid{
        grid-template-columns:1fr;
    }
}


/* ===== v4.4 Interface PT-BR ===== */
.info-alert{
    background:#e0f2fe;
    border-color:#7dd3fc;
    color:#0f172a;
}
.local-ai-form select{
    background:#fff;
}


/* ===== v4.5 Dropdowns em português ===== */
.custom-field{
    display:none;
    margin-top:8px;
}
.local-ai-form select{
    color:#0f172a;
}


/* ===== v4.6 Fluxo por etapa ===== */
#stageTriggerBox,
#keywordsBox{
    margin-top:12px;
    padding:12px;
    border:1px solid #dbe4ef;
    border-radius:12px;
    background:#f8fafc;
}


/* ===== v4.8 Início por tipo de paciente ===== */
.patient-type-choice{
    margin:12px 0;
    padding:14px;
    background:#f8fafc;
    border:1px solid #dbe4ef;
    border-radius:14px;
}
.choice-title{
    font-weight:700;
    margin-bottom:10px;
    color:#0f172a;
}
.choice-buttons{
    display:flex;
    gap:10px;
    flex-wrap:wrap;
}
.patient-type-btn{
    min-width:170px;
}
.choice-saved{
    opacity:.65;
}


/* ===== v4.9 Layout público limpo: informações pelo chat ===== */
.public-chat-page{
    background:#eef3f9;
    margin:0;
    min-height:100vh;
    font-family:Arial, sans-serif;
    color:#0f172a;
}
.clean-chat-shell{
    max-width:780px;
    margin:0 auto;
    padding:24px 16px;
}
.clean-chat-title{
    text-align:center;
    margin-bottom:16px;
}
.clean-chat-title h1{
    margin:0 0 8px;
    font-size:28px;
    color:#0f172a;
}
.clean-chat-title p{
    margin:0;
    color:#334155;
}
.clean-chat-card{
    background:#fff;
    border:1px solid #dbe4ef;
    border-radius:16px;
    box-shadow:0 10px 28px rgba(15,23,42,.08);
    overflow:hidden;
}
.clean-chat-top{
    background:#0f172a;
    color:#fff;
    padding:14px 18px;
    display:flex;
    align-items:center;
    justify-content:space-between;
}
.clean-chat-top span{
    display:block;
    font-size:12px;
    opacity:.8;
    margin-top:2px;
}
.online-pill{
    background:#22c55e;
    color:#fff;
    padding:5px 10px;
    border-radius:999px;
    font-size:12px;
    font-weight:700;
}
.clean-messages{
    height:440px;
    overflow-y:auto;
    padding:18px;
    background:#f8fafc;
}
.clean-msg{
    display:flex;
    margin-bottom:12px;
}
.clean-msg.patient{
    justify-content:flex-end;
}
.clean-msg.ai,
.clean-msg.system{
    justify-content:flex-start;
}
.clean-bubble{
    max-width:78%;
    padding:13px 14px;
    border-radius:14px;
    line-height:1.42;
    font-size:15px;
    white-space:normal;
}
.clean-msg.ai .clean-bubble{
    background:#e2e8f0;
    color:#0f172a;
    border-top-left-radius:5px;
}
.clean-msg.patient .clean-bubble{
    background:#bbf7d0;
    color:#0f172a;
    border-top-right-radius:5px;
}
.clean-msg.system .clean-bubble{
    background:#fef3c7;
    color:#0f172a;
}
.chat-options{
    margin-top:12px;
    display:flex;
    gap:10px;
    flex-wrap:wrap;
}
.chat-option-btn{
    border:1px solid #0f766e;
    background:#fff;
    color:#0f766e;
    border-radius:999px;
    padding:9px 13px;
    cursor:pointer;
    font-weight:700;
}
.chat-option-btn:hover{
    background:#ccfbf1;
}
.clean-input-row{
    display:flex;
    gap:10px;
    align-items:center;
    padding:14px;
    border-top:1px solid #e2e8f0;
}
.clean-input-row input{
    flex:1;
    min-width:0;
    border:1px solid #cbd5e1;
    border-radius:10px;
    padding:13px;
    font-size:15px;
}
.send-btn{
    min-width:90px;
}
.new-chat-btn{
    display:block;
    width:calc(100% - 28px);
    margin:0 14px 12px;
}
.medical-note{
    margin:0;
    padding:0 16px 18px;
    color:#64748b;
    font-size:12px;
    line-height:1.4;
}
.error-box{
    margin:12px 14px 0;
    background:#fee2e2;
    border:1px solid #fca5a5;
    color:#7f1d1d;
    padding:10px;
    border-radius:10px;
}

/* esconde blocos antigos caso algum cache/template antigo permaneça */
.quick-row,
.contact-box,
.attach-row,
.patient-type-choice,
.whatsapp-row{
    display:none !important;
}

@media(max-width:640px){
    .clean-chat-shell{
        padding:12px;
    }
    .clean-messages{
        height:calc(100vh - 260px);
        min-height:360px;
    }
    .clean-bubble{
        max-width:90%;
    }
    .clean-input-row{
        gap:8px;
    }
    .send-btn{
        min-width:84px;
        padding-left:14px;
        padding-right:14px;
    }
}

/* ===== v5.0 Botões nas respostas do treinamento local ===== */
.chat-options{
    margin-top:14px;
    display:flex;
    gap:9px;
    flex-wrap:wrap;
}
.chat-option-btn{
    border:1px solid #0f766e;
    background:#ffffff;
    color:#0f766e;
    border-radius:999px;
    padding:9px 14px;
    cursor:pointer;
    font-weight:700;
    font-size:14px;
}
.chat-option-btn:hover{
    background:#ccfbf1;
}


/* ===== v5.3 Botões de unidades com referência ===== */
.chat-option-btn-location{
    border-radius:18px;
    padding:10px 16px;
    min-width:180px;
    text-align:left;
    line-height:1.15;
}
.chat-option-btn-location .option-main{
    display:block;
    font-weight:800;
    font-size:15px;
    letter-spacing:.02em;
}
.chat-option-btn-location .option-sub{
    display:block;
    font-size:11px;
    font-weight:500;
    opacity:.78;
    margin-top:3px;
    white-space:normal;
}


/* ===== v5.4 Fluxo de agendamento corrigido ===== */
.chat-option-btn-location{
    border-radius:18px;
    padding:10px 16px;
    min-width:190px;
    text-align:left;
    line-height:1.15;
}
.chat-option-btn-location .option-main{
    display:block;
    font-weight:800;
    font-size:15px;
    letter-spacing:.02em;
}
.chat-option-btn-location .option-sub{
    display:block;
    font-size:11px;
    font-weight:500;
    opacity:.78;
    margin-top:3px;
    white-space:normal;
}

/* ===== v20 Formulário de dados no chat ===== */
.chat-data-form{
    margin-top:14px;
    background:#f8fafc;
    border:1px solid #cbd5e1;
    border-radius:14px;
    padding:14px;
    display:grid;
    gap:12px;
}
.chat-field label{
    display:block;
    font-weight:800;
    margin-bottom:6px;
    color:#0f172a;
}
.chat-field label span{
    font-weight:600;
    color:#64748b;
    font-size:13px;
}
.chat-field input{
    width:100%;
    border:1px solid #cbd5e1;
    border-radius:10px;
    padding:12px 13px;
    font-size:15px;
    background:#fff;
}
.chat-field input:focus{
    outline:2px solid rgba(15,118,110,.22);
    border-color:#0f766e;
}
.chat-data-submit{
    width:100%;
    border:0;
    border-radius:10px;
    background:#0f766e;
    color:#fff;
    padding:12px 14px;
    font-weight:800;
    cursor:pointer;
    font-size:15px;
}
.chat-data-submit:disabled,
.chat-field input:disabled{
    opacity:.65;
    cursor:not-allowed;
}

/* ===== v27 Botão WhatsApp na lista da secretaria ===== */
.sec-contact{cursor:pointer;}
.sec-contact-name-row{display:flex;align-items:center;gap:8px;min-width:0;}
.sec-contact-name-row strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.sec-whatsapp-mini{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
    background:#22c55e;
    color:#fff!important;
    border-radius:999px;
    padding:3px 8px;
    font-size:11px;
    font-weight:800;
    line-height:1.2;
    text-decoration:none!important;
}
.sec-whatsapp-mini:hover{background:#16a34a;}
.sec-chat-title-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}
.sec-chat-title-row h2{margin:0;}
.sec-whatsapp-header{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    background:#22c55e;
    color:#fff!important;
    border-radius:999px;
    padding:6px 11px;
    font-size:12px;
    font-weight:800;
    text-decoration:none!important;
}
.sec-whatsapp-header:hover{background:#16a34a;}


/* v28: CSS da Secretaria também no arquivo externo. O bloco crítico fica inline em admin/secretaria.php. */


/* ===== v28 CSS crítico da Secretaria: restaura layout tipo WhatsApp ===== */
body.secretaria-page{margin:0;background:#e5ddd5;font-family:Arial,sans-serif;color:#111827;overflow-y:auto;overflow-x:hidden;}
.secretaria-app{min-height:100vh;display:grid;grid-template-columns:390px minmax(0,1fr);align-items:stretch;background:#e5ddd5;}
.secretaria-sidebar{background:#f8fafc;border-right:1px solid #cbd5e1;display:flex;flex-direction:column;min-width:0;max-height:100vh;overflow:hidden;}
.sec-header{background:#075e54;color:white;padding:16px;display:flex;justify-content:space-between;align-items:center;gap:12px;}
.sec-header h1{margin:0;font-size:22px;line-height:1.1;}.sec-header p{margin:3px 0 0;font-size:12px;opacity:.85;}
.sec-admin-link{color:#fff!important;border:1px solid rgba(255,255,255,.55);padding:8px 12px;border-radius:999px;text-decoration:none!important;font-size:12px;white-space:nowrap;}
.sec-type-tabs{display:flex;gap:6px;padding:10px;background:#eef2f7;}.sec-type-tabs a{flex:1;text-align:center;text-decoration:none!important;color:#334155;background:#fff;border:1px solid #dbe4ef;border-radius:999px;padding:9px 6px;font-size:12px;font-weight:800;}.sec-type-tabs a.active{background:#0f766e;color:#fff;border-color:#0f766e;}
.sec-search{display:flex;gap:6px;padding:10px;border-bottom:1px solid #e2e8f0;}.sec-search input{flex:1;min-width:0;border:1px solid #cbd5e1;border-radius:10px;padding:10px;font-size:13px;}.sec-search button{border:0;background:#0f766e;color:#fff;border-radius:10px;padding:0 12px;font-weight:800;cursor:pointer;}
.sec-tag-filter{display:flex;gap:6px;overflow-x:auto;padding:8px 10px;border-bottom:1px solid #e2e8f0;}.tag-filter{white-space:nowrap;text-decoration:none!important;border:1px solid #cbd5e1;background:#fff;color:#334155;border-radius:999px;padding:6px 9px;font-size:12px;}.tag-filter span{display:inline-block;width:8px;height:8px;border-radius:999px;margin-right:5px;}.tag-filter.active{background:#0f172a;color:#fff;border-color:#0f172a;}
.sec-contact-list{overflow-y:auto;flex:1;min-height:0;}.sec-contact{display:flex;gap:12px;padding:12px;border-bottom:1px solid #e2e8f0;color:#111827;text-decoration:none!important;background:#fff;cursor:pointer;}.sec-contact:hover,.sec-contact.active{background:#dcfce7;}
.sec-avatar{width:42px;height:42px;border-radius:999px;background:#0f766e;color:#fff;display:flex;align-items:center;justify-content:center;font-weight:800;flex:0 0 42px;}.sec-avatar.big{width:54px;height:54px;flex-basis:54px;font-size:18px;}
.sec-contact-main{min-width:0;flex:1;}.sec-contact-top{display:flex;justify-content:space-between;gap:8px;align-items:flex-start;}.sec-contact-top strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.sec-contact-top small{color:#64748b;font-size:11px;white-space:nowrap;}.sec-contact-name-row{display:flex;align-items:center;gap:8px;min-width:0;}.sec-contact-name-row strong{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.sec-whatsapp-mini{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;background:#22c55e;color:#fff!important;border-radius:999px;padding:3px 8px;font-size:11px;font-weight:800;line-height:1.2;text-decoration:none!important;}.sec-whatsapp-mini:hover{background:#16a34a;}
.sec-contact-stage{margin:4px 0;}.stage-badge{display:inline-block;border-radius:999px;padding:4px 8px;font-size:11px;font-weight:800;background:#e2e8f0;color:#334155;}.stage-badge.success{background:#dcfce7;color:#166534}.stage-badge.danger{background:#fee2e2;color:#991b1b}.stage-badge.purple{background:#ede9fe;color:#5b21b6}.stage-badge.money{background:#ccfbf1;color:#115e59}.stage-badge.info{background:#dbeafe;color:#1d4ed8}.stage-badge.neutral{background:#e2e8f0;color:#334155}
.sec-contact p{margin:0;color:#475569;font-size:13px;line-height:1.25;}.sec-mini-tags{display:flex;gap:4px;flex-wrap:wrap;margin-top:6px;}.sec-mini-tags span{border:1px solid;border-radius:999px;padding:2px 6px;font-size:10px;background:#fff;}.sec-empty{padding:18px;color:#64748b;}
.secretaria-chat{min-width:0;display:flex;flex-direction:column;background:#efeae2;max-height:100vh;overflow:hidden;}.sec-chat-header{min-height:72px;background:#f8fafc;border-bottom:1px solid #cbd5e1;display:flex;align-items:center;gap:12px;padding:10px 18px;box-sizing:border-box;}.sec-chat-header h2{margin:0;font-size:18px;}.sec-chat-header p{margin:2px 0 5px;color:#64748b;font-size:13px;}.sec-chat-title-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;}.sec-whatsapp-header{display:inline-flex;align-items:center;justify-content:center;background:#22c55e;color:#fff!important;border-radius:999px;padding:6px 11px;font-size:12px;font-weight:800;text-decoration:none!important;}.sec-whatsapp-header:hover{background:#16a34a;}
.sec-conversation-wrap{flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,1fr) 320px;overflow:hidden;}.sec-messages{padding:18px;overflow-y:auto;background:linear-gradient(rgba(239,234,226,.86),rgba(239,234,226,.86)),repeating-linear-gradient(45deg,transparent,transparent 10px,rgba(255,255,255,.25) 10px,rgba(255,255,255,.25) 20px);}.sec-msg{display:flex;margin-bottom:10px;}.sec-msg.patient{justify-content:flex-start}.sec-msg.ai{justify-content:flex-end}.sec-msg.admin{justify-content:flex-end}.sec-msg-bubble{max-width:68%;background:#fff;border-radius:12px;padding:10px 12px;box-shadow:0 1px 2px rgba(15,23,42,.08);line-height:1.35;}.sec-msg.ai .sec-msg-bubble{background:#dcf8c6;}.sec-msg.admin .sec-msg-bubble{background:#dbeafe;}.sec-msg-bubble strong{display:block;font-size:11px;color:#64748b;margin-bottom:4px;}.sec-msg-bubble small{display:block;text-align:right;color:#94a3b8;font-size:10px;margin-top:4px;}
.sec-side-panel{background:#f8fafc;border-left:1px solid #cbd5e1;overflow-y:auto;padding:12px;}.sec-panel-card{background:#fff;border:1px solid #e2e8f0;border-radius:14px;padding:12px;margin-bottom:12px;}.sec-panel-card h3{margin:0 0 10px;font-size:15px;}.sec-panel-card p{margin:6px 0;font-size:13px;}.sec-quick-actions{display:grid;grid-template-columns:1fr;gap:7px;}.sec-quick-actions button,.sec-send-form button{border:0;background:#0f766e;color:#fff;border-radius:10px;padding:9px 10px;font-weight:700;cursor:pointer;}
.sec-selected-tags{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px;}.sec-selected-tags span:not(.muted){color:#fff;border-radius:999px;padding:5px 8px;font-size:12px;font-weight:700;}.sec-selected-tags .muted{color:#64748b;font-size:13px;}.sec-tag-buttons{display:flex;flex-wrap:wrap;gap:6px;}.sec-tag-buttons form{display:inline;}.sec-tag-buttons button{border:1px solid var(--tag-color);color:var(--tag-color);background:#fff;border-radius:999px;padding:6px 8px;font-size:12px;cursor:pointer;}.sec-tag-buttons button.on{background:var(--tag-color);color:#fff;}.sec-send-form textarea{width:100%;box-sizing:border-box;border:1px solid #cbd5e1;border-radius:10px;padding:9px;resize:vertical;margin-bottom:8px;}.sec-no-chat{margin:auto;text-align:center;color:#64748b;}
@media(max-width:900px){.secretaria-app{grid-template-columns:1fr}.secretaria-sidebar{height:45vh;max-height:45vh}.secretaria-chat{height:55vh;max-height:55vh}.sec-conversation-wrap{grid-template-columns:1fr}.sec-side-panel{display:none}.sec-msg-bubble{max-width:86%;}}


/* ===== v29 Paciente antigo: envio de exames/fotos pelo chat ===== */
.chat-upload-form{
    margin-top:14px;
    background:#f8fafc;
    border:1px solid #cbd5e1;
    border-radius:14px;
    padding:14px;
    display:grid;
    gap:10px;
}
.chat-upload-form small{
    color:#64748b;
    font-size:12px;
}
.chat-upload-form input[type="file"]{
    width:100%;
    border:1px dashed #94a3b8;
    border-radius:10px;
    padding:12px;
    background:#fff;
}


/* ===== v4.4 Login e formulários administrativos ===== */
.auth-shell{
    min-height:calc(100vh - 48px);
    display:flex;
    align-items:center;
    justify-content:center;
}
.auth-card{
    width:100%;
    max-width:480px;
    background:#fff;
    border:1px solid #dbe4ef;
    border-radius:22px;
    box-shadow:0 18px 42px rgba(15,23,42,.12);
    padding:34px 30px;
}
.auth-brand{
    display:inline-flex;
    align-items:center;
    gap:8px;
    background:#ecfeff;
    color:#0f766e;
    border:1px solid #bae6fd;
    border-radius:999px;
    padding:8px 14px;
    font-size:13px;
    font-weight:700;
    margin-bottom:16px;
}
.auth-card h1{
    margin:0 0 10px;
    color:#0f172a;
    font-size:36px;
    line-height:1.08;
}
.auth-subtitle{
    margin:0 0 22px;
    color:#475569;
    font-size:15px;
}
.admin-form{
    display:grid;
    gap:16px;
}
.field-group label{
    display:block;
    margin-bottom:7px;
    font-weight:700;
    color:#0f172a;
}
.field-group input,
.field-group select,
.field-group textarea{
    width:100%;
    border:1px solid #cbd5e1;
    border-radius:12px;
    padding:12px 14px;
    font-size:15px;
    background:#fff;
    transition:border-color .15s ease, box-shadow .15s ease;
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus{
    outline:none;
    border-color:#0f766e;
    box-shadow:0 0 0 4px rgba(15,118,110,.12);
}
.btn-block{
    width:100%;
}
.page-intro{
    margin-bottom:20px;
}
.page-intro h1{
    margin:0 0 8px;
    color:#0f172a;
    font-size:32px;
}
.page-intro p{
    margin:0;
    color:#475569;
}
.settings-card{
    background:#fff;
    border:1px solid #e2e8f0;
    border-radius:18px;
    padding:24px;
    box-shadow:0 8px 22px rgba(15,23,42,.05);
}
.settings-card.narrow{
    max-width:680px;
}
.btn-row{
    display:flex;
    justify-content:flex-start;
    gap:10px;
    flex-wrap:wrap;
}
.alert-success{
    background:#ecfdf5;
    border-color:#86efac;
    color:#166534;
}
.alert-error{
    background:#fef2f2;
    border-color:#fecaca;
    color:#991b1b;
}
@media(max-width:760px){
    .auth-shell{
        min-height:auto;
        align-items:flex-start;
    }
    .auth-card{
        padding:26px 20px;
        border-radius:18px;
    }
    .auth-card h1,
    .page-intro h1{
        font-size:28px;
    }
    .settings-card{
        padding:18px;
    }
}


/* ===== v4.5 Respostas rápidas ===== */
.quick-reply-card,
.quick-reply-list-card{
    margin-bottom:22px;
}
.quick-reply-form-grid{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px;
}
.quick-reply-table td,
.quick-reply-table th{
    padding:14px 12px;
}
.quick-reply-table tbody tr:hover{
    background:#f8fafc;
}
.reply-text{
    color:#1f2937;
    line-height:1.45;
}
.actions-cell{
    text-align:center;
    white-space:nowrap;
}
.icon-actions{
    display:flex;
    gap:8px;
    justify-content:center;
    align-items:center;
}
.icon-btn{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width:38px;
    height:38px;
    border-radius:10px;
    border:1px solid #cbd5e1;
    background:#fff;
    cursor:pointer;
    text-decoration:none;
    transition:.15s ease;
    font-size:16px;
}
.icon-btn:hover{
    transform:translateY(-1px);
    box-shadow:0 8px 18px rgba(15,23,42,.08);
}
.icon-btn.edit:hover{
    border-color:#67e8f9;
    background:#ecfeff;
}
.icon-btn.delete:hover{
    border-color:#fecaca;
    background:#fef2f2;
}
.muted{
    color:#94a3b8;
}
@media(max-width:760px){
    .quick-reply-form-grid{
        grid-template-columns:1fr;
    }
    .icon-actions{
        gap:6px;
    }
}


/* ===== v4.6 Categorias em português nas respostas rápidas ===== */
.field-group small{
    display:block;
    margin-top:6px;
    color:#64748b;
    font-size:12px;
}
.quick-reply-form-grid select{
    width:100%;
    border:1px solid #cbd5e1;
    border-radius:12px;
    padding:12px 14px;
    font-size:15px;
    background:#fff;
}
.quick-reply-form-grid select:focus{
    outline:none;
    border-color:#0f766e;
    box-shadow:0 0 0 4px rgba(15,118,110,.12);
}


/* v44: link clicável para anexos no chat do site */
.chat-attachment{margin-top:8px}
.chat-attachment a{display:inline-flex;align-items:center;gap:6px;background:#f1f5f9;color:#0f766e!important;border-radius:10px;padding:7px 10px;font-size:13px;font-weight:700;text-decoration:none!important;border:1px solid rgba(15,118,110,.16)}
.chat-attachment a:hover{background:#e6fffb}


/* ===== v4.9 Site com botão + para anexar arquivo ===== */
.clean-file-input{position:absolute;left:-9999px;width:1px;height:1px;opacity:0}
.clean-attach-btn{appearance:none;-webkit-appearance:none;display:inline-flex;align-items:center;justify-content:center;width:44px;min-width:44px;height:44px;border:1px solid #cbd5e1;border-radius:50%;background:#ffffff;color:#0f766e;cursor:pointer;font-size:30px;font-weight:900;line-height:1;box-shadow:0 4px 10px rgba(15,23,42,.08)}
.clean-attach-btn span{display:block;transform:translateY(-1px)}
.clean-attach-btn:hover{background:#ccfbf1}
.send-btn{height:44px}
.clean-input-row #messageInput{height:44px;padding-top:10px;padding-bottom:10px}
@media(max-width:640px){
    .clean-attach-btn{width:42px;min-width:42px;height:42px;font-size:28px}
    .send-btn{height:42px}
    .clean-input-row #messageInput{height:42px;padding-left:12px;padding-right:12px}
}
