﻿﻿/* --- CONFIGURAÇÕES GERAIS --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.data-nascimento-container {
    display: flex;
    gap: 10px;
    margin-top: 0;
}

body {
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

/* --- NAVEGAÇÃO --- */
nav {
    background-color: #2c3e50;
    color: white;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo-area {
    text-align: center;
    width: 100%;
}

nav h1 {
    font-size: 1.4rem;
    letter-spacing: 1px;
}

nav ul {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    list-style: none;
    gap: 8px;
    width: min(360px, 100%);
}

nav a {
    display: block;
    color: #ecf0f1;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    transition: 0.3s;
}

nav a:hover {
    background: #27ae60;
    color: white;
}

.menu-group-toggle {
    width: 100%;
    padding: 12px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    text-align: left;
}

/* Ajuste para o menu principal recolhível */
.menu-group-toggle:hover,
.menu-group-toggle[aria-expanded="true"] {
    background: #27ae60;
}

.submenu-principal {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
    padding-left: 14px;
    list-style: none;
}

.submenu-principal[hidden] {
    display: none !important;
}

.submenu-principal a {
    background: rgba(255, 255, 255, 0.08);
}

/* Botão que abre o menu principal */
.menu-toggle {
    width: min(360px, 100%);
    max-width: 360px;
    background: #ffffff;
    color: #263238;
    border: 1px solid rgba(255, 255, 255, 0.22);
    letter-spacing: 0.08em;
}

/* Ajuste para o menu principal recolhível */
.menu-toggle:hover {
    background: #eef7f1;
    color: #176f3d;
}

.menu-principal[hidden] {
    display: none !important;
}

/* Ajuste para o menu principal recolhível */
.menu-principal.is-open {
    display: flex !important;
}

/* --- CONTAINERS E SEÇÕES --- */
.form-section {
    width: 95%;
    max-width: 900px;
    margin: 20px auto;
    background: rgba(255, 255, 255, 0.98);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

h2 {
    margin-bottom: 20px;
    font-size: 1.2rem;
    color: #2c3e50;
    border-left: 5px solid #27ae60;
    padding-left: 10px;
}

/* --- FORMULÁRIOS --- */
form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cadastro-hint {
    margin: -8px 0 16px;
    color: #65727d;
}

.cadastro-form {
    padding: 16px;
    background: #f7faf8;
    border: 1px solid #dce3e8;
    border-radius: 8px;
}

.cadastro-field-group {
    display: grid;
    /* ADICIONADO: Cria colunas de no mínimo 250px, impedindo que um input ocupe a tela toda no PC */
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    align-items: end;
    /* Alinha labels e botões na mesma base */
}

.cadastro-field-group label {
    margin-bottom: 6px;
    color: #2c3e50;
    display: block;
}

.professional-services-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 8px;
    padding: 10px;
    border: 1px solid #dce3e8;
    border-radius: 8px;
    background: #fff;
}

.professional-service-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px;
    border: 1px solid #edf1f4;
    border-radius: 8px;
    color: #2c3e50;
    font-size: 0.92rem;
    cursor: pointer;
}

.professional-service-option input {
    width: auto;
    margin: 0;
}

.cadastro-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.cadastro-actions button {
    flex: 1;
    min-width: 140px;
}

.cadastro-list-title {
    padding: 14px 14px 0;
    color: #2c3e50;
    font-size: 1rem;
}

label {
    font-weight: bold;
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-bottom: 6px;
    display: block;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background-color: #fff;
    transition: border 0.3s;
}

input:focus,
select:focus {
    border-color: #27ae60;
    outline: none;
}

input:disabled,
select:disabled,
textarea:disabled {
    background-color: #f0f3f5 !important;
    color: #7f8c8d !important;
    cursor: not-allowed;
}

button {
    background-color: #27ae60;
    color: white;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.3s;
}

.btn-icone {
    background: transparent !important;
    color: inherit !important;
    padding: 5px 8px !important;
    min-width: auto !important;
    width: auto !important;
    font-size: 1.2rem !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer;
}

.btn-icone:hover {
    transform: scale(1.15) !important;
    background: rgba(0, 0, 0, 0.05) !important;
    border-radius: 4px;
}

button:hover {
    background-color: #219150;
    transform: translateY(-1px);
}

/* --- DASHBOARD E CARDS --- */
.card {
    transition: 0.3s;
    background: white;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* --- CORES DO FINANCEIRO (AJUSTADO PARA CONSISTÊNCIA) --- */
.valor-positivo {
    color: var(--hp-primary-strong, #176f3d) !important;
    font-weight: bold;
}

.valor-negativo {
    color: var(--hp-danger, #c0392b) !important;
    font-weight: bold;
}

/* --- TABELAS --- */
.table-container {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 10px;
    border: 1px solid #eee;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

th,
td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

th {
    background-color: #f8f9fa;
    color: #7f8c8d;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

th:last-child,
td:last-child {
    text-align: right;
}

tbody tr:nth-child(even) td {
    background-color: #fafafa !important;
}

tbody tr:nth-child(odd) td {
    background-color: #ffffff !important;
}

tbody tr:hover td {
    background-color: #f1f9f5 !important;
}

/* --- ESTILO PARA LINHAS INATIVAS (SOFT DELETE) --- */
.row-inativo td {
    opacity: 0.55;
    background-color: #fafafa !important;
}

.row-inativo td[data-label="Nome"],
.row-inativo td[data-label="Descrição"] {
    text-decoration: line-through;
}

.row-inativo.is-expanded td {
    background-color: #f8f9fa !important;
}

.selectable-row {
    cursor: pointer;
}

.selectable-row td {
    transition: background-color 0.2s ease;
}

/* --- RESUMO FINANCEIRO FINAL --- */
#resumo-financeiro-final {
    background: #fdfdfd !important;
    border: 2px solid #eee !important;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
}

#resumo-financeiro-final strong {
    font-family: 'Courier New', Courier, monospace;
}

/* --- MODAL DE LOGIN (Autenticação) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 62, 80, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
    border-left: none;
    margin-bottom: 10px;
    text-align: center;
}

.modal-content input {
    margin-top: 20px;
    text-align: center;
    font-size: 1.2rem;
}

.modal-data-pagamento p {
    margin-top: 8px;
    margin-bottom: 14px;
    color: #576574;
}

.modal-aviso-overlay {
    background: rgba(12, 20, 24, 0.72);
}

.modal-aviso {
    max-width: 460px;
    text-align: left;
    border-top: 5px solid #d68910;
}

.modal-aviso .aviso-tipo {
    display: inline-flex;
    margin-bottom: 10px;
    padding: 5px 9px;
    border-radius: 8px;
    background: #fff3cd;
    color: #8a5a00;
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.modal-aviso h2 {
    margin-bottom: 8px;
    color: #263238;
    text-align: left;
}

.modal-aviso p {
    margin-bottom: 18px;
    color: #4b5a67;
    font-size: 1rem;
    line-height: 1.5;
}

.modal-aviso button {
    width: 100%;
}

.modal-data-pagamento input {
    width: 100%;
    max-width: 280px;
    margin: 12px auto 0;
    cursor: pointer;
}

.modal-acoes {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.modal-acoes button {
    flex: 1;
}

.modal-confirmacao-pagamento {
    max-width: 560px;
    text-align: left;
}

.modal-confirmacao-pagamento h2,
.modal-confirmacao-pagamento>p {
    text-align: center;
}

.modal-confirmacao-pagamento>p {
    color: #576574;
    margin-bottom: 14px;
}

.detalhes-confirmacao-pagamento {
    margin-top: 14px;
    padding: 14px;
    background: #f7faf8;
    border: 1px solid #dce3e8;
    border-radius: 8px;
}

.detalhes-confirmacao-pagamento dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
}

.detalhes-confirmacao-pagamento div {
    min-width: 0;
}

.detalhes-confirmacao-pagamento dt {
    color: #65727d;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.detalhes-confirmacao-pagamento dd {
    margin: 2px 0 0;
    color: #263238;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.detalhes-confirmacao-pagamento .valor-confirmacao {
    padding: 10px;
    background: #eef6fb;
    border: 1px solid #cfe3ef;
    border-radius: 8px;
}

.detalhes-confirmacao-pagamento .valor-confirmacao dd {
    color: #125d7a;
    font-size: 1.15rem;
}

/* --- AJUSTES DE COLUNAS E CAMPOS --- */
#corpo-tabela-clientes td:nth-child(4) {
    text-align: center !important;
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    color: #2c3e50;
    width: 100px;
}

#corpo-tabela-servicos td:last-child,
#tabela-detalhes td:last-child {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    min-width: 110px;
    text-align: right;
}

table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 12px 15px;
}

.check-cumprido {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: #27ae60;
}

#corpo-tabela-agendamentos td:first-child {
    white-space: nowrap;
    width: 180px;
    font-weight: bold;
    color: #2c3e50;
}

.professional-hours-card {
    margin-top: 22px;
    padding: 16px;
    background: #f7faf8;
    border: 1px solid #dce3e8;
    border-radius: 8px;
}

.professional-hours-card h3 {
    color: #263238;
    margin-bottom: 4px;
}

.professional-hours-card p {
    color: #65727d;
    margin-bottom: 14px;
}

.professional-hours-form {
    display: grid;
    /* CORRIGIDO: Substituído as larguras engessadas por auto-fit flexível */
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    align-items: end;
}

.professional-hours-table {
    margin-top: 16px;
}

.btn-small-danger {
    width: auto;
    min-height: 34px;
    padding: 7px 10px;
    background: #c0392b;
    font-size: 0.86rem;
}

.btn-small-danger:hover {
    background: #a93226;
}

/* --- RESPONSIVIDADE PC (Acima de 768px) --- */
@media (min-width: 768px) {
    nav {
        flex-direction: column;
        justify-content: flex-start;
        padding: 1rem 5%;
    }

    nav ul {
        gap: 15px;
    }

    nav a {
        font-size: 0.95rem;
        padding: 8px 18px;
    }

    .form-section {
        padding: 30px;
        margin-top: 30px;
    }
}

/* --- ESTILO PARA IMPRESSÃO --- */
@media print {

    nav,
    button,
    .filtros-relatorio,
    #alerta-pendencias {
        display: none !important;
    }

    body {
        background-color: white;
    }

    .form-section {
        box-shadow: none;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    table {
        font-size: 10pt;
        width: 100%;
    }

    #resumo-financeiro-final {
        display: block !important;
        border: 1px solid #000 !important;
    }
}

/* --- REGRAS GERAIS MOVIDAS PARA CIMA (Permite Mobile Overrides Naturalmente) --- */
#corpo-grade-profissional tr {
    height: 70px;
    border-bottom: 1px solid #eee;
}

#corpo-grade-profissional td {
    vertical-align: middle;
    padding: 10px 5px;
}

select option:disabled {
    color: #a0a0a0;
    background-color: #f8f8f8;
    font-style: italic;
}

/* ============================================================
   ETAPA 1: RESPONSIVIDADE PARA CELULARES (Até 768px)
   ============================================================ */
@media (max-width: 768px) {

    /* 1. Ajuste da Navegação */
    /* A navegação agora é controlada pelo botão de menu, não mais por scroll horizontal */
    nav {
        padding: 0.8rem;
        position: relative;
    }

    /* Escondemos a lista de links que antes era rolável */
    nav ul {
        display: none;
        /* Alterado de 'flex' para 'none' */
        flex-wrap: nowrap;
        justify-content: flex-start;
        width: 100%;
        gap: 8px;
        /* overflow-x: auto; -- Removido */
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 4px;
    }

    nav ul::-webkit-scrollbar {
        display: none;
    }

    nav li {
        flex: 0 0 auto;
    }

    nav a {
        display: block;
        text-align: center;
        white-space: nowrap;
        padding: 10px 12px;
        font-size: 0.82rem;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 999px;
    }

    /* 2. Ajuste dos Títulos e Seções */
    nav h1 {
        font-size: 1.2rem;
        margin-bottom: 5px;
    }

    .form-section {
        width: 100%;
        margin: 10px 0;
        padding: 15px;
        border-radius: 0;
    }

    h2 {
        font-size: 1.1rem;
    }

    /* 3. Comportamento das Tabelas no Celular */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-top: 10px;
    }

    table {
        min-width: 600px;
    }

    #tabela-agenda-dia,
    #tabela-profissionais,
    #tabela-clientes,
    #tabela-servicos,
    #tabela-horarios-profissionais,
    #tabela-agendamentos-geral,
    #tabela-grade-profissional,
    #tabela-detalhes,
    #tabela-relatorio-agendamentos,
    #tabela-relatorio-nao-pagos,
    #tabela-usuarios {
        min-width: 0;
        width: 100%;
    }

    #tabela-agenda-dia thead,
    #tabela-profissionais thead,
    #tabela-clientes thead,
    #tabela-servicos thead,
    #tabela-horarios-profissionais thead,
    #tabela-agendamentos-geral thead,
    #tabela-grade-profissional thead,
    #tabela-detalhes thead,
    #tabela-relatorio-agendamentos thead,
    #tabela-relatorio-nao-pagos thead,
    #tabela-usuarios thead {
        display: none;
    }

    #tabela-agenda-dia tr,
    #tabela-profissionais tr,
    #tabela-clientes tr,
    #tabela-servicos tr,
    #tabela-horarios-profissionais tr,
    #tabela-agendamentos-geral tr,
    #tabela-grade-profissional tr,
    #tabela-detalhes tr,
    #tabela-relatorio-agendamentos tr,
    #tabela-relatorio-nao-pagos tr,
    #tabela-usuarios tr {
        display: block;
        margin: 0 0 10px;
        border: 1px solid #e8edf3;
        border-radius: 10px;
        background: #fff;
    }

    #tabela-agenda-dia td,
    #tabela-profissionais td,
    #tabela-clientes td,
    #tabela-servicos td,
    #tabela-horarios-profissionais td,
    #tabela-agendamentos-geral td,
    #tabela-grade-profissional td,
    #tabela-detalhes td,
    #tabela-relatorio-agendamentos td,
    #tabela-relatorio-nao-pagos td,
    #tabela-usuarios td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-bottom: 1px solid #f1f3f5;
        text-align: right;
    }

    #tabela-agenda-dia td:last-child,
    #tabela-profissionais td:last-child,
    #tabela-clientes td:last-child,
    #tabela-servicos td:last-child,
    #tabela-horarios-profissionais td:last-child,
    #tabela-agendamentos-geral td:last-child,
    #tabela-grade-profissional td:last-child,
    #tabela-detalhes td:last-child,
    #tabela-relatorio-agendamentos td:last-child,
    #tabela-relatorio-nao-pagos td:last-child,
    #tabela-usuarios td:last-child {
        border-bottom: none;
    }

    #tabela-agenda-dia td::before,
    #tabela-profissionais td::before,
    #tabela-clientes td::before,
    #tabela-servicos td::before,
    #tabela-horarios-profissionais td::before,
    #tabela-agendamentos-geral td::before,
    #tabela-grade-profissional td::before,
    #tabela-detalhes td::before,
    #tabela-relatorio-agendamentos td::before,
    #tabela-relatorio-nao-pagos td::before,
    #tabela-usuarios td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #5f6f7c;
        text-transform: uppercase;
        font-size: 0.72rem;
        letter-spacing: 0.04em;
        text-align: left;
        flex: 0 0 46%;
    }

    #tabela-detalhes td button,
    #tabela-relatorio-nao-pagos td button {
        width: auto;
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    /* --- ACCORDION LISTS (MOBILE) --- */
    .expandable-row {
        position: relative;
        cursor: pointer;
    }

    .expandable-row td.col-expandable {
        display: none !important;
    }

    .expandable-row.is-expanded td.col-expandable {
        display: flex !important;
    }

    /* Garante que o Cartão inteiro (TR) e todas as suas linhas (TDs) fiquem verdes ao expandir */
    tr.expandable-row.is-expanded,
    tr.expandable-row.is-expanded td,
    tr.expandable-row.is-expanded td[data-label="Ações"] {
        background-color: #f1f9f5 !important;
    }

    tr.expandable-row.is-expanded td:last-child {
        border-bottom-left-radius: 10px;
        border-bottom-right-radius: 10px;
    }

    .expandable-row::after {
        content: '▼';
        position: absolute;
        left: 50%;
        top: 14px;
        font-size: 0.8rem;
        color: #27ae60;
        transition: transform 0.3s ease;
        pointer-events: none;
        transform: translateX(-50%);
    }

    .expandable-row.is-expanded::after {
        transform: translateX(-50%) rotate(180deg);
    }

    .expandable-row td[data-label="Ações"] {
        justify-content: flex-end;
        border-top: 1px solid rgba(39, 174, 96, 0.15);
        /* Separador verde suave */
        gap: 12px;
    }

    .expandable-row td[data-label="Ações"]::before {
        display: none;
    }

    /* Grade: evita corte do nome do profissional em telas menores */
    #tabela-grade-profissional td {
        display: block;
        text-align: left;
    }

    #tabela-grade-profissional td::before {
        display: block;
        margin-bottom: 6px;
        flex-basis: auto;
    }

    #corpo-grade-profissional tr {
        height: auto;
    }

    #tabela-grade-profissional td,
    #tabela-grade-profissional td div {
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.35;
    }

    .btn-pagamento {
        width: auto;
        min-height: 40px;
        padding: 8px 10px;
    }

    .check-cumprido,
    .check-pago,
    input[type="checkbox"],
    input[type="radio"] {
        width: 22px;
        height: 22px;
    }

    .relatorios-tabs {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 14px;
    }

    .relatorios-tabs .rel-tab-btn {
        width: 100%;
        min-height: 48px;
    }

    .detalhes-confirmacao-pagamento dl {
        grid-template-columns: 1fr;
    }

    .filtros-relatorio {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 14px;
    }

    .filtros-relatorio .filtro-item {
        min-width: 0;
    }

    .filtros-relatorio .filtro-btn {
        width: 100%;
        min-width: 0;
        min-height: 46px;
    }

    .fin-tipo-gasto-wrap {
        flex-direction: column;
        gap: 10px;
    }

    .fin-tipo-item {
        display: flex;
        align-items: center;
        gap: 10px;
    }

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

    /* 4. Ajuste dos Inputs (Evita zoom automático no iOS) */
    input,
    select,
    textarea {
        font-size: 16px !important;
        padding: 10px;
    }

    button {
        width: 100%;
        padding: 15px;
    }

    /* 5. Ajuste de espaçamento dos cards do Dashboard */
    .card {
        margin-bottom: 10px;
    }
}

/* --- TOQUE PROFISSIONAL MOBILE --- */
button,
nav a,
.check-cumprido {
    -webkit-tap-highlight-color: transparent;
    /* Remove o quadro azul ao tocar */
    touch-action: manipulation;
    /* Melhora a resposta ao toque */
}


/* --- MELHORIAS DE USO: NAVEGACAO, DASHBOARD E TOQUE --- */
:root {
    --hp-bg: #f4f6f8;
    --hp-surface: #ffffff;
    --hp-text: #263238;
    --hp-muted: #65727d;
    --hp-line: #dce3e8;
    --hp-primary: #219150;
    --hp-primary-strong: #176f3d;
    --hp-accent: #2f80a7;
    --hp-danger: #c0392b;
    --hp-warning: #d68910;
}

body {
    background:
        linear-gradient(180deg, #eef3f1 0, var(--hp-bg) 260px),
        var(--hp-bg);
    color: var(--hp-text);
}

nav {
    background: #263238;
    border-bottom: 3px solid var(--hp-primary);
}

nav a {
    border: 1px solid rgba(255, 255, 255, 0.12);
}

nav a.active,
nav a[aria-current="page"] {
    background: #ffffff;
    color: #1f3b2d;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.form-section {
    border: 1px solid rgba(38, 50, 56, 0.08);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.section-header h2 {
    margin-bottom: 4px;
}

.section-header p {
    color: var(--hp-muted);
    font-size: 0.95rem;
}

.btn-secondary {
    width: auto;
    min-width: 170px;
    background: #263238;
}

.btn-secondary:hover {
    background: #1b252b;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0 18px;
}

.quick-actions button {
    min-height: 48px;
    padding: 12px 10px;
    background: #eef7f1;
    color: #176f3d;
    border: 1px solid #cfe8d8;
}

.quick-actions button:hover {
    background: #dff0e5;
}

.dashboard-toolbar {
    display: flex;
    flex-wrap: wrap;
    /* ADICIONADO: Permite que os filtros desçam para a próxima linha */
    align-items: center;
    gap: 12px;
    margin: 0 0 14px;
    padding: 12px;
    background: #f7faf8;
    border: 1px solid var(--hp-line);
    border-radius: 8px;
}

.dashboard-toolbar label {
    min-width: 120px;
    margin: 0;
    color: var(--hp-text);
}

.dashboard-toolbar input {
    max-width: 240px;
}

.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 0 0 18px;
}

.metric-card {
    min-height: 92px;
    padding: 14px;
    background: var(--hp-surface);
    border: 1px solid var(--hp-line);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.metric-card span {
    color: var(--hp-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.metric-card strong {
    color: var(--hp-text);
    font-size: 1.55rem;
    line-height: 1;
}

.metric-money {
    background: #eef6fb;
    border-color: #cfe3ef;
}

.metric-money strong {
    color: #125d7a;
    font-size: 1.25rem;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #b8c7cf;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
nav a:focus-visible {
    outline: 3px solid rgba(33, 145, 80, 0.25);
    outline-offset: 2px;
}

.table-container {
    background: #fff;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
}

tbody tr {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.mobile-fab {
    display: none;
}

#toast-sucesso {
    position: fixed;
    right: 18px;
    top: 88px;
    z-index: 1200;
    max-width: min(360px, calc(100vw - 32px));
    padding: 12px 16px;
    background: #176f3d;
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(23, 111, 61, 0.28);
    font-weight: 800;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#toast-sucesso.show {
    opacity: 1;
    transform: translateY(0);
}

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

    .quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        padding-bottom: 78px;
    }

    nav {
        top: 0;
        position: sticky;
    }

    .section-header {
        display: block;
    }

    .section-header .btn-secondary {
        margin-top: 12px;
        width: 100%;
    }

    .dashboard-toolbar {
        display: block;
    }

    .dashboard-toolbar label {
        display: block;
        margin-bottom: 6px;
    }

    .dashboard-toolbar input {
        max-width: none;
    }

    .dashboard-metrics {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .metric-card {
        min-height: 82px;
        padding: 12px;
    }

    .metric-card strong {
        font-size: 1.35rem;
    }

    .metric-money {
        grid-column: 1 / -1;
    }

    .quick-actions {
        grid-template-columns: 1fr 1fr;
    }

    .quick-actions button {
        width: 100%;
    }

    table td,
    #tabela-agenda-dia td,
    #tabela-profissionais td,
    #tabela-clientes td,
    #tabela-servicos td,
    #tabela-agendamentos-geral td,
    #tabela-grade-profissional td,
    #tabela-detalhes td,
    #tabela-relatorio-agendamentos td,
    #tabela-relatorio-nao-pagos td,
    #tabela-usuarios td {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
    }

    #tabela-agenda-dia td[data-label="Cliente Veio"],
    #tabela-agenda-dia td[data-label="Pagou"] {
        align-items: flex-start;
    }

    #tabela-agenda-dia td[data-label="Cliente Veio"]>button,
    #tabela-agenda-dia td[data-label="Pagou"]>button {
        width: auto;
        min-width: 88px;
        margin-bottom: 6px;
    }

    .mobile-fab {
        display: block;
        position: fixed;
        right: 16px;
        bottom: 16px;
        z-index: 900;
        width: auto;
        min-width: 132px;
        padding: 14px 18px;
        border-radius: 8px;
        background: var(--hp-primary);
        box-shadow: 0 12px 28px rgba(23, 111, 61, 0.35);
    }

    #toast-sucesso {
        top: auto;
        right: 12px;
        bottom: 82px;
        left: 12px;
        max-width: none;
        text-align: center;
    }
}

@media (max-width: 420px) {

    .dashboard-metrics,
    .quick-actions {
        grid-template-columns: 1fr;
    }
}

/* --- NOVA GRADE VISUAL DE HORÁRIOS --- */
#grade-visual-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--hp-line);
    border-radius: 8px;
    background: #fff;
}

.loading-grade {
    padding: 40px 20px;
    text-align: center;
    color: var(--hp-muted);
    font-weight: 700;
}

.grade-timeline {
    display: flex;
    flex-direction: column;
    min-width: 700px;
    /* Largura mínima para evitar quebra */
}

.grade-header {
    display: grid;
    grid-template-columns: 60px repeat(auto-fit, minmax(120px, 1fr));
    position: sticky;
    top: 0;
    background: #f8f9fa;
    z-index: 2;
    border-bottom: 2px solid #e9ecef;
}

.grade-corner-cell {
    border-right: 1px solid #e9ecef;
}

.grade-header-cell {
    padding: 12px 8px;
    text-align: center;
    font-weight: 700;
    color: var(--hp-text);
    border-right: 1px solid #e9ecef;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.grade-body {
    display: grid;
    grid-template-columns: 60px repeat(auto-fit, minmax(120px, 1fr));
    position: relative;
}

.grade-hours-col {
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
}

.grade-hour-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 4px;
    font-size: 0.75rem;
    color: var(--hp-muted);
    border-bottom: 1px dashed #e9ecef;
    position: relative;
}

.grade-hour-row::after {
    /* Linha de 30 minutos */
    content: '';
    position: absolute;
    left: 10px;
    right: 0;
    top: 50%;
    height: 1px;
    background-color: #f1f3f5;
}

.grade-col {
    position: relative;
    border-right: 1px solid #e9ecef;
}

.grade-appointment-block {
    position: absolute;
    left: 4px;
    right: 4px;
    background-color: var(--hp-accent);
    color: white;
    border-radius: 6px;
    padding: 5px;
    font-size: 0.8rem;
    overflow: hidden;
    cursor: pointer;
    border-left: 4px solid rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.grade-appointment-block:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 5;
}

.grade-appointment-block.status-confirmado {
    background-color: #27ae60;
    border-left-color: #1e8449;
}

.grade-appointment-block.status-pendente-de-confirmação {
    background-color: #f39c12;
    border-left-color: #c27c0e;
}

.grade-appointment-block.status-cancelado {
    background-color: #c0392b;
    border-left-color: #962d22;
}

.block-time {
    font-weight: 700;
    display: block;
}

.block-client {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

#grade-tooltip {
    position: absolute;
    display: none;
    background: #263238;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    z-index: 10000;
    pointer-events: none;
}

/* --- MENU PRINCIPAL RECOLHIDO --- */
nav #menu-principal.menu-principal[hidden] {
    display: none !important;
}

nav #menu-principal.menu-principal.is-open {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
    width: min(360px, 100%) !important;
    gap: 8px !important;
    padding: 0 !important;
}

nav #menu-principal.menu-principal li {
    width: 100%;
    flex: 0 0 auto;
}

nav #menu-principal.menu-principal a,
nav #menu-principal.menu-principal .menu-group-toggle {
    width: 100%;
    text-align: left;
    border-radius: 8px;
    padding: 15px 16px;
    font-size: 1.05rem;
    white-space: normal;
}

nav #menu-principal.menu-principal .submenu-principal {
    width: 100%;
    padding-left: 14px;
}

nav #menu-principal.menu-principal .submenu-principal[hidden] {
    display: none !important;
}

nav #menu-principal.menu-principal .submenu-principal.is-open {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
}

nav #menu-principal.menu-principal .submenu-principal a {
    padding: 10px 14px;
    font-size: 0.9rem;
}

nav .menu-toggle {
    display: block;
}

/* Mostra o botão de menu apenas em telas mobile */
nav .menu-toggle {
    display: block;
}

/* --- TELA DE AGENDAMENTO --- */
.appointment-form {
    gap: 18px;
}

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

.field-block {
    display: block;
    margin: 0;
}

.step-field {
    position: relative;
    padding: 14px;
    background: #f8fbfa;
    border: 1px solid var(--hp-line);
    border-radius: 8px;
}

.step-number {
    display: inline-flex;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
    margin-right: 7px;
    border-radius: 8px;
    background: var(--hp-primary);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 800;
}

.field-title {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    color: var(--hp-text);
    font-size: 0.86rem;
    font-weight: 800;
    text-transform: uppercase;
}

.step-field input,
.step-field select {
    margin-top: 0;
    background: #fff;
}

.step-field:focus-within {
    border-color: rgba(33, 145, 80, 0.55);
    box-shadow: 0 0 0 3px rgba(33, 145, 80, 0.12);
}

.appointment-summary {
    padding: 16px;
    background: #eef6fb;
    border: 1px solid #cfe3ef;
    border-radius: 8px;
}

.appointment-summary strong {
    display: block;
    margin-bottom: 8px;
    color: #125d7a;
}

.appointment-summary p {
    color: var(--hp-muted);
}

.appointment-summary dl {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    margin: 0;
}

.appointment-summary div {
    min-width: 0;
}

.appointment-summary dt {
    color: var(--hp-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.appointment-summary dd {
    margin: 2px 0 0;
    color: var(--hp-text);
    font-weight: 700;
    overflow-wrap: anywhere;
}

.appointment-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 12px;
}

.appointment-actions .btn-secondary,
.appointment-actions button {
    width: 100%;
}

.professional-availability-panel {
    padding: 16px;
    background: #f7faf8;
    border: 1px solid var(--hp-line);
    border-radius: 8px;
}

.availability-header {
    display: flex;
    flex-wrap: wrap;
    /* CORRIGIDO: Trocado de grid rígido para flex adaptável */
    justify-content: space-between;
    gap: 14px;
    align-items: end;
}

.availability-header strong {
    display: block;
    color: var(--hp-text);
    font-size: 1rem;
}

.availability-header p {
    color: var(--hp-muted);
    margin-top: 2px;
}

.availability-header label {
    margin: 0;
    color: var(--hp-text);
}

.availability-header input {
    margin-top: 0;
    background: #fff;
}

.available-times {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
    min-height: 44px;
    align-items: center;
    color: var(--hp-muted);
}

.available-times button {
    width: auto;
    min-width: 78px;
    padding: 10px 12px;
    background: #fff;
    color: var(--hp-primary-strong);
    border: 1px solid #cfe8d8;
}

.available-times button:hover {
    background: #e8f6ee;
}

.empty-times {
    color: var(--hp-muted);
    font-weight: 700;
}

.schedule-list-panel {
    margin-top: 22px;
    padding: 16px;
    background: #f7faf8;
    border: 1px solid var(--hp-line);
    border-radius: 8px;
}

.schedule-list-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.schedule-list-header h3 {
    color: var(--hp-text);
    font-size: 1.05rem;
}

.schedule-list-header p {
    color: var(--hp-muted);
    font-size: 0.92rem;
}

.period-shortcuts {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.period-shortcuts button {
    width: auto;
    min-height: 38px;
    padding: 9px 12px;
    background: #fff;
    color: var(--hp-primary-strong);
    border: 1px solid #cfe8d8;
}

.period-shortcuts button:hover {
    background: #e8f6ee;
}

.schedule-filters {
    padding-top: 12px;
    border-top: 1px solid var(--hp-line);
}

.schedule-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.schedule-stats div {
    padding: 10px;
    background: #fff;
    border: 1px solid var(--hp-line);
    border-radius: 8px;
}

.schedule-stats span {
    display: block;
    color: var(--hp-muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.schedule-stats strong {
    color: var(--hp-text);
    font-size: 1.35rem;
}

.schedule-row td:first-child strong,
.schedule-row td:first-child span {
    display: block;
}

.schedule-row td:first-child span {
    color: var(--hp-muted);
    font-size: 0.86rem;
    font-weight: 700;
}

.schedule-row.status-confirmado td:first-child {
    border-left: 4px solid var(--hp-primary);
}

.schedule-row.status-pendente-de-confirmação td:first-child,
.schedule-row.status-agendado td:first-child {
    border-left: 4px solid var(--hp-warning);
}

.schedule-row.status-cancelado td:first-child {
    border-left: 4px solid var(--hp-danger);
}

@media (max-width: 768px) {
    .appointment-grid {
        grid-template-columns: 1fr;
    }

    .appointment-summary dl {
        grid-template-columns: 1fr;
    }

    .appointment-actions {
        grid-template-columns: 1fr;
    }

    .availability-header {
        grid-template-columns: 1fr;
    }

    .available-times button {
        flex: 1 1 86px;
    }

    .schedule-list-header {
        display: block;
    }

    .period-shortcuts {
        justify-content: stretch;
        margin-top: 12px;
    }

    .period-shortcuts button {
        flex: 1 1 120px;
    }

    .schedule-stats {
        grid-template-columns: 1fr 1fr;
    }

    .schedule-row td:first-child {
        border-left: 0;
    }
}

#corpo-grade-profissional td {
    padding: 15px 10px;
    border-bottom: 1px solid #edf2f7;
}

/* Badge de Duração no Agendamento */
.duracao-badge {
    font-size: 0.75rem;
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    color: #4a5568;
    margin-left: 5px;
}

/* --- MELHORIA NA TABELA DE AGENDA DO DIA (DASHBOARD) --- */
#lista-agenda-dia tr td:last-child {
    text-align: center;
    /* Centraliza o checkbox do 'Cliente Veio' */
}

/* Estilo para opções ocupadas no select */
select option:disabled {
    color: #e74c3c !important;
    /* Vermelho suave para indicar ocupado */
    background-color: #fdf2f2;
}

/* --- RESPONSIVIDADE EXTRA --- */
@media (max-width: 480px) {
    nav h1 {
        font-size: 1.1rem !important;
    }

    /* Faz os cards de faturamento no dashboard ocuparem 100% no celular pequeno */
    .form-section>div[style*="grid"] {
        grid-template-columns: 1fr !important;
    }

    .data-nascimento-container {
        flex-direction: column;
    }

    #tabela-agenda-dia td::before,
    #tabela-profissionais td::before,
    #tabela-clientes td::before,
    #tabela-servicos td::before,
    #tabela-horarios-profissionais td::before,
    #tabela-agendamentos-geral td::before,
    #tabela-grade-profissional td::before,
    #tabela-detalhes td::before,
    #tabela-relatorio-agendamentos td::before,
    #tabela-relatorio-nao-pagos td::before,
    #tabela-usuarios td::before {
        flex-basis: 44%;
        font-size: 0.68rem;
    }

    #tabela-agenda-dia td,
    #tabela-profissionais td,
    #tabela-clientes td,
    #tabela-servicos td,
    #tabela-horarios-profissionais td,
    #tabela-agendamentos-geral td,
    #tabela-grade-profissional td,
    #tabela-detalhes td,
    #tabela-relatorio-agendamentos td,
    #tabela-relatorio-nao-pagos td,
    #tabela-usuarios td {
        padding: 9px 10px;
    }
}

#agen_prof:not(:placeholder-shown) {
    border: 2px solid #27ae60;
    transition: 0.5s;
}

/* Altera a regra que você tinha para esta mais específica */
#agen_prof:enabled:not([value=""]) {
    border: 2px solid #27ae60;
    transition: 0.5s;
}

#agen_prof:disabled {
    background-color: #f9f9f9;
    color: #999;
    border: 1px solid #ddd;
}


/* --- SPINNER PARA BOTÕES DE CARREGAMENTO --- */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* --- STATUS TEXT PARA LOADING DE SLOTS --- */
.status-text {
    display: block;
    padding: 12px;
    text-align: center;
    color: var(--hp-muted);
    font-weight: 600;
    background: #f8f9fa;
    border-radius: 6px;
    margin-top: 8px;
}

/* --- VOICE COMMAND (IA) --- */
#btn-voice-command {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2f80a7, #125d7a);
    color: white;
    font-size: 28px;
    border: none;
    box-shadow: 0 6px 20px rgba(18, 93, 122, 0.4);
    cursor: pointer;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#btn-voice-command:hover {
    transform: scale(1.1) translateY(-5px);
    box-shadow: 0 8px 25px rgba(18, 93, 122, 0.6);
}

#btn-voice-command:active {
    transform: scale(0.95);
}

#btn-voice-command.recording {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    animation: pulse-recording 1.5s infinite;
}

@keyframes pulse-recording {
    0% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(231, 76, 60, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
    }
}

@media (max-width: 768px) {
    #btn-voice-command {
        bottom: 85px;
        /* Evita sobrepor a navegação mobile se estiver bottom */
        right: 16px;
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
}