* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
    color: #0f172a;
}

.dash-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.dash-sidebar {
    width: 260px;
    background-color: #0f172a;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 24px;
    border-bottom: 1px solid #1e293b;
}

.sidebar-logo h2 {
    font-size: 1.2rem;
    color: #38bdf8;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.sidebar-nav a {
    padding: 14px 24px;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.sidebar-nav a:hover, .sidebar-nav a.ativo {
    background-color: #1e293b;
    color: #ffffff;
    border-left: 4px solid #38bdf8;
}

/* Main Content */
.dash-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.dash-header {
    height: 70px;
    background-color: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.busca-header input {
    padding: 10px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    width: 300px;
    font-family: inherit;
    outline: none;
}

.busca-header input:focus {
    border-color: #0284c7;
}

.perfil-header {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.avatar {
    width: 40px;
    height: 40px;
    background-color: #0284c7;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Content Area */
.dash-content {
    padding: 30px;
}

.titulo-pagina {
    font-size: 1.6rem;
    margin-bottom: 24px;
    color: #1e293b;
}

/* Cards */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card-stat {
    background: #ffffff;
    padding: 24px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.card-stat h3 {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 12px;
}

.card-stat .valor {
    font-size: 2rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 12px;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge.alerta { background: #fee2e2; color: #ef4444; }
.badge.sucesso { background: #dcfce3; color: #22c55e; }
.badge.neutro { background: #f1f5f9; color: #64748b; }

/* Table */
.sessao-tabela {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 24px;
}

.sessao-tabela h2 {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.tabela-wrapper {
    overflow-x: auto;
}

.tabela-admin {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.tabela-admin th, .tabela-admin td {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
}

.tabela-admin th {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
}

.tabela-admin td {
    font-size: 0.9rem;
    color: #334155;
}

.status {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status.pendente { background: #fef3c7; color: #d97706; }
.status.andamento { background: #e0f2fe; color: #0284c7; }
.status.concluido { background: #dcfce3; color: #16a34a; }

.btn-acao {
    background: none;
    border: 1px solid #cbd5e1;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    color: #475569;
    transition: all 0.2s;
}

.btn-acao:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}

/* Cabeçalho com Botão */
.header-acoes {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.btn-primario {
    background: #0284c7;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primario:hover { background: #0369a1; }

.btn-secundario {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* Dados da Tabela */
.sub-texto {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 4px;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}
.status-dot.online { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }
.status-dot.offline { background: #94a3b8; }

/* Modal de Permissões */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-fechar {
    background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #64748b;
}

.modal-body { padding: 24px; }

.user-info-modal {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px dashed #e2e8f0;
}

.permissoes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Checkboxes Customizados (Toggle Cards) */
.toggle-permissao input { display: none; }

.toggle-card {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.85rem;
    font-weight: 600;
}

.toggle-permissao input:checked + .toggle-card {
    border-color: #0284c7;
    background: #f0f9ff;
    color: #0369a1;
}

.toggle-permissao input:disabled + .toggle-card {
    opacity: 0.6;
    cursor: not-allowed;
}

.modal-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* --- ESTILIZAÇÃO DO MODAL E SELEÇÃO DE SERVIÇOS --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-content {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  padding: 1.5rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
}

.campo-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.campo-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

.campo-form input, .campo-form select {
  padding: 0.75rem 1rem;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.925rem;
  outline: none;
  transition: all 0.2s ease;
}

.campo-form input:focus, .campo-form select:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.campo-form input[readonly] {
  background-color: #f8fafc;
  color: #64748b;
  cursor: not-allowed;
}

/* CARDS DE SELEÇÃO DE PERMISSÕES */
.grid-permissoes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
  max-height: 280px;
  overflow-y: auto;
  padding: 0.25rem;
}

.card-checkbox {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.card-checkbox:hover {
  border-color: #38bdf8;
  background: #f0f9ff;
}

.card-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 0.75rem;
  accent-color: #0284c7;
  cursor: pointer;
}

.card-checkbox .info-servico {
  display: flex;
  flex-direction: column;
}

.card-checkbox .nome-servico {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1e293b;
}

.card-checkbox .cat-servico {
  font-size: 0.75rem;
  color: #64748b;
}

/* Estado selecionado */
.card-checkbox.selecionado {
  border-color: #0284c7;
  background: #f0f9ff;
}

/* --- ESTILOS DE RESPONSIVIDADE E MOBILE --- */

/* Botão do menu hambúrguer (inicialmente oculto no desktop) */
.btn-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #0f172a;
    cursor: pointer;
    padding: 5px;
}

/* Overlay escuro para quando o menu estiver aberto no mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    z-index: 98;
}

/* Ajustes responsivos para tablets e celulares (abaixo de 992px) */
@media (max-width: 992px) {
    .dash-container {
        position: relative;
    }

    /* Transforma a sidebar em uma gaveta lateral (off-canvas) */
    .dash-sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        height: 100vh;
        z-index: 99;
        transition: left 0.3s ease-in-out;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.2);
    }

    /* Classe ativada via JavaScript para mostrar o menu */
    .dash-sidebar.ativo {
        left: 0;
    }

    .sidebar-overlay.ativo {
        display: block;
    }

    /* Exibe o botão de menu no header */
    .btn-menu-toggle {
        display: block;
    }

    /* Ajuste do espaçamento do conteúdo principal */
    .dash-main {
        width: 100%;
    }

    .dash-header {
        padding: 0 15px;
    }

    .dash-content {
        padding: 15px;
    }

    .busca-header input {
        width: 200px;
    }
}

/* Ajustes para telas muito pequenas (celulares abaixo de 576px) */
@media (max-width: 576px) {
    .dash-header {
        height: auto;
        padding: 12px 15px;
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .busca-header {
        width: 100%;
    }

    .busca-header input {
        width: 100%;
    }

    .perfil-header {
        justify-content: flex-end;
    }

    .header-acoes {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .grid-permissoes {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
        padding: 1rem;
    }
}