/* DentalFlow — estilos globais */

:root {
    --verde: #1D9E75;
    --verde-escuro: #0F6E56;
    --verde-claro: #E1F5EE;
    --verde-borda-clara: #9FE1CB;
    --fundo: #F4F6F5;
    --superficie: #FFFFFF;
    --borda: #E2E8E6;
    --texto: #1C2B27;
    --texto-secundario: #5A7268;
    --alerta-fundo: #FCEBEB;
    --alerta-texto: #791F1F;
    --alerta-forte: #A32D2D;
    --vermelho: #E24B4A;
    --ambar-fundo: #FAEEDA;
    --ambar-texto: #633806;
    --azul-fundo: #E7F0FA;
    --azul-texto: #1E4E85;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 14px;
    line-height: 1.6;
    color: var(--texto);
    background: var(--fundo);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
textarea, input, select { font-family: inherit; }

/* ---------- Botões ---------- */
.btn-primario {
    background: var(--verde);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-primario:hover { background: var(--verde-escuro); }

.btn-secundario {
    background: #fff;
    border: 0.5px solid var(--borda);
    color: var(--texto);
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-secundario:hover { background: var(--fundo); }

.btn-full { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Cards ---------- */
.card {
    background: var(--superficie);
    border: 0.5px solid var(--borda);
    border-radius: 12px;
    padding: 20px 24px;
}

.card-titulo {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 16px;
}

/* ---------- Inputs ---------- */
input[type="text"], input[type="password"], textarea {
    width: 100%;
    background: var(--fundo);
    border: 1px solid var(--borda);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 15px;
    color: var(--texto);
}
input:focus, textarea:focus {
    border-color: var(--verde);
    outline: none;
}

label { font-size: 15px; font-weight: 500; display: block; margin-bottom: 6px; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 20px;
}
.badge-verde { background: var(--verde-claro); color: var(--verde-escuro); }
.badge-vermelho { background: var(--alerta-fundo); color: var(--alerta-texto); }
.badge-ambar { background: var(--ambar-fundo); color: var(--ambar-texto); }
.badge-azul { background: var(--azul-fundo); color: var(--azul-texto); }
.badge-cinza { background: var(--fundo); color: var(--texto-secundario); border: 0.5px solid var(--borda); }

/* ---------- Login ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}
.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--superficie);
    border: 0.5px solid var(--borda);
    border-radius: 12px;
    overflow: hidden;
}
.login-topo {
    background: var(--verde);
    color: #fff;
    text-align: center;
    padding: 32px 24px;
}
.login-logo {
    width: 56px;
    height: 56px;
    background: #fff;
    color: var(--verde);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 20px;
    margin: 0 auto 12px;
}
.login-topo h1 { margin: 0; font-size: 22px; font-weight: 600; }
.login-topo p { margin: 4px 0 0; font-size: 13px; opacity: 0.9; }
.login-form { padding: 24px; display: flex; flex-direction: column; gap: 4px; }
.login-form label { margin-top: 12px; }
.input-icone { position: relative; }
.input-icone i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--texto-secundario);
    font-size: 16px;
}
.input-icone input { padding-left: 38px; }
.login-form .btn-primario { margin-top: 20px; padding: 12px; }
.login-erro {
    background: var(--alerta-fundo);
    color: var(--alerta-texto);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---------- Layout painel ---------- */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--superficie);
    border-right: 0.5px solid var(--borda);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 20px;
}
.sidebar-logo .icone {
    width: 36px;
    height: 36px;
    background: var(--verde);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}
.sidebar-logo .nome { font-weight: 600; font-size: 15px; }
.sidebar-logo .sub { font-size: 12px; color: var(--texto-secundario); }

.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--texto-secundario);
    font-weight: 500;
    font-size: 14px;
}
.sidebar-nav a .esq { display: flex; align-items: center; gap: 10px; }
.sidebar-nav a:hover { background: var(--fundo); }
.sidebar-nav a.ativo { background: var(--verde-claro); color: var(--verde-escuro); }
.sidebar-nav a .badge-nav {
    background: var(--verde);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 20px;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 8px 0;
    border-top: 0.5px solid var(--borda);
}
.sidebar-footer .avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--verde-claro);
    color: var(--verde-escuro);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}
.sidebar-footer .info b { display: block; font-size: 13px; }
.sidebar-footer .info span { font-size: 12px; color: var(--texto-secundario); }

.main {
    flex: 1;
    padding: 24px 32px 48px;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.topbar h1 { font-size: 22px; margin: 0 0 4px; }
.topbar .data { color: var(--texto-secundario); font-size: 13px; text-transform: capitalize; }

/* ---------- Grids ---------- */
.grid-metricas {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}
.metrica .valor { font-size: 22px; font-weight: 600; margin: 4px 0; }
.metrica .label { font-size: 13px; color: var(--texto-secundario); }
.metrica .meta { font-size: 13px; color: var(--texto-secundario); }
.metrica.negativo .valor { color: var(--alerta-forte); }

.banner-ia {
    background: var(--verde-claro);
    border: 1px solid var(--verde-borda-clara);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.banner-ia .icone {
    width: 40px;
    height: 40px;
    background: var(--verde);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.banner-ia .texto { flex: 1; min-width: 200px; }
.banner-ia .texto b { display: block; font-size: 14px; margin-bottom: 2px; }
.banner-ia .texto span { font-size: 13px; color: var(--texto-secundario); }

.grid-principal {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.coluna { display: flex; flex-direction: column; gap: 20px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.tabs button {
    background: none;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--texto-secundario);
}
.tabs button.ativo { background: var(--verde-claro); color: var(--verde-escuro); }

/* ---------- Agenda ---------- */
.lista-agenda { display: flex; flex-direction: column; gap: 4px; }
.item-agenda {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 10px;
    border-radius: 8px;
    border-bottom: 0.5px solid var(--borda);
}
.item-agenda:last-child { border-bottom: none; }
.item-agenda:hover { background: var(--fundo); }
.item-agenda .hora { font-weight: 600; width: 48px; flex-shrink: 0; }
.item-agenda .info { flex: 1; min-width: 0; }
.item-agenda .info b { display: block; font-size: 14px; }
.item-agenda .info span { font-size: 13px; color: var(--texto-secundario); }

/* ---------- WhatsApp mock ---------- */
.whatsapp-mock { border-radius: 12px; overflow: hidden; border: 0.5px solid var(--borda); }
.whatsapp-header {
    background: var(--verde);
    color: #fff;
    padding: 10px 16px;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.whatsapp-body { background: #EFF4F2; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 85%; padding: 8px 12px; border-radius: 10px; font-size: 13px; line-height: 1.4; }
.msg-paciente { background: #fff; align-self: flex-start; border: 0.5px solid var(--borda); }
.msg-ia { background: var(--verde-claro); align-self: flex-end; color: var(--verde-escuro); }
.msg-ia .badge-digitando {
    display: inline-block;
    font-size: 11px;
    color: var(--texto-secundario);
    margin-bottom: 4px;
}

/* ---------- Alertas ---------- */
.lista-alertas { display: flex; flex-direction: column; gap: 10px; }
.alerta {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
}
.alerta-vermelho { background: var(--alerta-fundo); color: var(--alerta-texto); }
.alerta-ambar { background: var(--ambar-fundo); color: var(--ambar-texto); }
.alerta-azul { background: var(--azul-fundo); color: var(--azul-texto); }

/* ---------- Metas / barras de progresso ---------- */
.meta-item { margin-bottom: 14px; }
.meta-item:last-child { margin-bottom: 0; }
.meta-item .topo { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.barra { background: var(--fundo); border-radius: 20px; height: 8px; overflow: hidden; }
.barra .preenchido { height: 100%; border-radius: 20px; }
.preenchido.verde { background: var(--verde); }
.preenchido.azul { background: #3D7DC9; }
.preenchido.vermelho { background: var(--vermelho); }

/* ---------- Financeiro ---------- */
.financeiro-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 0.5px solid var(--borda);
    font-size: 13px;
}
.financeiro-item:last-of-type { border-bottom: none; }
.financeiro-item .valor.positivo { color: var(--verde-escuro); font-weight: 600; }
.financeiro-item .valor.negativo { color: var(--alerta-forte); font-weight: 600; }
.financeiro-item .valor.pendente { color: var(--ambar-texto); font-weight: 600; }
.financeiro-saldo {
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--borda);
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 15px;
    color: var(--verde-escuro);
}

/* ---------- Prontuário rápido ---------- */
.prontuario-rapido-box {
    background: var(--fundo);
    border-radius: 8px;
    padding: 14px;
    margin: 10px 0 14px;
}
.prontuario-rapido-box p { margin: 4px 0; font-size: 13px; color: var(--texto-secundario); }
.prontuario-rapido-acoes { display: flex; gap: 8px; }

/* ---------- Waveform ---------- */
.waveform { display: flex; align-items: center; gap: 2px; height: 32px; }
.waveform .bar {
    width: 3px;
    height: 4px;
    border-radius: 2px;
    background: #9FE1CB;
    transition: height .1s;
}
.waveform.active .bar { background: #1D9E75; animation: wave 0.8s ease-in-out infinite; }
.waveform.active .bar:nth-child(1) { animation-delay: 0s; }
.waveform.active .bar:nth-child(2) { animation-delay: .1s; }
.waveform.active .bar:nth-child(3) { animation-delay: .2s; }
.waveform.active .bar:nth-child(4) { animation-delay: .3s; }
.waveform.active .bar:nth-child(5) { animation-delay: .4s; }
.waveform.active .bar:nth-child(6) { animation-delay: .5s; }
.waveform.active .bar:nth-child(7) { animation-delay: .6s; }
.waveform.active .bar:nth-child(8) { animation-delay: .7s; }
.waveform.active .bar:nth-child(9) { animation-delay: .1s; }
.waveform.active .bar:nth-child(10) { animation-delay: .2s; }
.waveform.active .bar:nth-child(11) { animation-delay: .3s; }
.waveform.active .bar:nth-child(12) { animation-delay: .4s; }
.waveform.active .bar:nth-child(13) { animation-delay: .5s; }
.waveform.active .bar:nth-child(14) { animation-delay: .6s; }
.waveform.active .bar:nth-child(15) { animation-delay: .7s; }
@keyframes wave {
  0%, 100% { height: 4px; }
  50% { height: 24px; }
}

.ponto-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--vermelho);
    display: inline-block;
}
.ponto-status.gravando { animation: pulsar 1s ease-in-out infinite; }
@keyframes pulsar {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ---------- Prontuário — página ---------- */
.prontuario-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.prontuario-header .paciente-info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.prontuario-header h1 { font-size: 22px; margin: 0; }
.prontuario-header .acoes { display: flex; gap: 8px; }

.stepper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    font-size: 13px;
}
.stepper .etapa { display: flex; align-items: center; gap: 6px; color: var(--texto-secundario); }
.stepper .etapa .circulo {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    background: var(--borda);
    color: #fff;
}
.stepper .etapa.concluida .circulo { background: var(--verde); }
.stepper .etapa.concluida { color: var(--texto); }
.stepper .etapa.atual .circulo { background: var(--verde); }
.stepper .etapa.atual { color: var(--verde-escuro); font-weight: 600; }
.stepper .linha { width: 24px; height: 1px; background: var(--borda); }

.grid-prontuario {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 20px;
}

.historico-item { padding: 10px 0; border-bottom: 0.5px solid var(--borda); }
.historico-item:last-child { border-bottom: none; }
.historico-item .data { font-size: 13px; font-weight: 600; color: var(--verde-escuro); display: block; margin-bottom: 2px; }
.historico-item p { margin: 0; font-size: 13px; color: var(--texto-secundario); }

/* ---------- Odontograma ---------- */
.odontograma { display: flex; flex-direction: column; gap: 6px; margin: 16px 0; }
.odontograma .fileira { display: flex; gap: 4px; justify-content: center; flex-wrap: wrap; }
.dente {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--verde-claro);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: var(--texto-secundario);
    border: 1px solid transparent;
}
.dente.foco { border: 2px solid var(--verde); background: var(--verde-claro); color: var(--verde-escuro); font-weight: 600; }
.dente.extracao { background: var(--alerta-fundo); color: var(--alerta-texto); }

.legenda-odontograma { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--texto-secundario); margin-top: 8px; }
.legenda-odontograma .item-legenda { display: flex; align-items: center; gap: 6px; }
.legenda-odontograma .quadro { width: 12px; height: 12px; border-radius: 3px; }

/* ---------- Evolução por voz ---------- */
.card-evolucao .card-header {
    background: var(--verde);
    color: #fff;
    margin: -20px -24px 16px;
    padding: 14px 24px;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-evolucao .card-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.status-gravacao { display: flex; align-items: center; gap: 6px; font-size: 13px; }

.transcricao-box {
    background: var(--fundo);
    border-radius: 8px;
    padding: 14px;
    font-size: 13px;
    color: var(--texto-secundario);
    margin-bottom: 16px;
}

.campos-extraidos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.campo-extraido {
    border: 1.5px solid var(--verde);
    background: var(--verde-claro);
    border-radius: 8px;
    padding: 10px 12px;
}
.campo-extraido .rotulo { font-size: 12px; color: var(--verde-escuro); font-weight: 500; display: block; margin-bottom: 2px; }
.campo-extraido .valor { font-size: 13px; font-weight: 600; }

.gravacao-controles {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--fundo);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.sugestoes-ia { display: flex; flex-direction: column; gap: 10px; }
.sugestao {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    flex-wrap: wrap;
}
.sugestao.verde { background: var(--verde-claro); color: var(--verde-escuro); }
.sugestao.ambar { background: var(--ambar-fundo); color: var(--ambar-texto); }
.sugestao.azul { background: var(--azul-fundo); color: var(--azul-texto); }

/* ---------- Responsivo ---------- */
@media (max-width: 768px) {
    .app { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        padding: 12px 16px;
    }
    .sidebar-logo { padding: 0 12px 0 0; }
    .sidebar-nav { flex-direction: row; flex: none; }
    .sidebar-nav a span.texto-nav { display: none; }
    .sidebar-footer { display: none; }
    .main { padding: 16px; }
    .grid-metricas { grid-template-columns: repeat(2, 1fr); }
    .grid-principal { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .grid-prontuario { grid-template-columns: 1fr; }
    .campos-extraidos { grid-template-columns: 1fr; }
}
