/**
 * ==============================================================================
 * StudioPro Multi-Tenant Enterprise - Design System CSS3
 * Motor: CSS Custom Properties + Dual Theme Engine (Light / Dark)
 * Mobile-First, Zero Frameworks, Alvos de Toque Mínimos de 48px
 * ==============================================================================
 */

:root {
    /* Paleta Padrão: Modo Claro */
    --bg-color: #f8fafc;
    --surface-color: #ffffff;
    --surface-hover: #f1f5f9;
    --text-color: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;

    /* Cores de Destaque da Marca StudioPro */
    --primary-color: #6f42c1;
    --primary-hover: #5a32a3;
    --primary-light: #f3e8ff;
    --secondary-color: #8b5cf6;
    --accent-color: #10b981;
    --accent-hover: #059669;

    /* Semântica de Alertas */
    --success-bg: #ecfdf5;
    --success-text: #065f46;
    --warning-bg: #fffbeb;
    --warning-text: #92400e;
    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
    --info-bg: #eff6ff;
    --info-text: #1e40af;

    /* Sombras e Bordas */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    /* Acessibilidade & Mobile */
    --min-touch-target: 48px;
    --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modo Escuro Automático via Sistema Operacional */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #090d16;
        --surface-color: #111827;
        --surface-hover: #1e293b;
        --text-color: #f8fafc;
        --text-muted: #94a3b8;
        --border-color: #1f2937;
        --primary-color: #8b5cf6;
        --primary-hover: #a78bfa;
        --primary-light: rgba(139, 92, 246, 0.15);
        --secondary-color: #a78bfa;
        --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    }
}

/* Modo Escuro Manual (Classe Forçada) */
html.dark-theme {
    --bg-color: #090d16;
    --surface-color: #111827;
    --surface-hover: #1e293b;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #1f2937;
    --primary-color: #8b5cf6;
    --primary-hover: #a78bfa;
    --primary-light: rgba(139, 92, 246, 0.15);
    --secondary-color: #a78bfa;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

/* Reset Global e Tipografia */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ------------------------------------------------------------------------------
   Header & Barra Superior
------------------------------------------------------------------------------ */
.app-header {
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.header-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-color);
}

.logo-badge {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #ffffff;
    font-weight: 800;
    font-size: 16px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(111, 66, 193, 0.3);
}

.brand-name {
    display: block;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.tenant-subtitle {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.icon-btn {
    min-width: var(--min-touch-target);
    min-height: var(--min-touch-target);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.icon-btn:hover {
    background-color: var(--surface-hover);
}

.moon-icon { display: none; }
.sun-icon { display: block; }
html.dark-theme .moon-icon { display: block; }
html.dark-theme .sun-icon { display: none; }

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    background-color: var(--surface-hover);
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
}

.user-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--accent-color);
}

.logout-link {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    transition: var(--transition-fast);
}

.logout-link:hover {
    color: #ef4444;
}

/* Desktop Nav */
.desktop-nav {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1.25rem;
    display: none;
    gap: 0.5rem;
    border-top: 1px solid var(--border-color);
}

@media (min-width: 768px) {
    .desktop-nav {
        display: flex;
    }
}

/* Botão Hambúrguer Mobile */
.mobile-nav-toggle {
    min-width: var(--min-touch-target);
    min-height: var(--min-touch-target);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    color: var(--text-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
}

.mobile-nav-toggle:hover {
    background-color: var(--surface-hover);
}

@media (min-width: 768px) {
    .mobile-nav-toggle {
        display: none !important;
    }
}

/* Estado Aberto da Navegação no Mobile */
.desktop-nav.is-open {
    display: flex !important;
    flex-direction: column;
    padding: 0.75rem 1.25rem;
    gap: 0.25rem;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
}

.nav-item:hover, .nav-item.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.nav-item.external-link {
    margin-left: auto;
    color: var(--secondary-color);
}

/* ------------------------------------------------------------------------------
   Conteúdo Principal & Layout Geral
------------------------------------------------------------------------------ */
.main-content {
    flex: 1;
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 5rem 1.25rem; /* Margem inferior para dock mobile */
}

@media (min-width: 768px) {
    .main-content {
        padding-bottom: 2rem;
    }
}

/* ------------------------------------------------------------------------------
   Mobile Bottom Navigation Dock (Alvos de Toque > 48px)
------------------------------------------------------------------------------ */
.mobile-bottom-dock {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.25rem 0;
    z-index: 99;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

@media (min-width: 768px) {
    .mobile-bottom-dock {
        display: none;
    }
}

.dock-item {
    min-width: var(--min-touch-target);
    min-height: var(--min-touch-target);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    gap: 0.2rem;
    flex: 1;
}

.dock-item.active {
    color: var(--primary-color);
}

/* ------------------------------------------------------------------------------
   Botões & Controles Interativos
------------------------------------------------------------------------------ */
.btn {
    min-height: var(--min-touch-target);
    padding: 0.65rem 1.25rem;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: var(--transition-fast);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-accent {
    background-color: var(--accent-color);
    color: #ffffff;
}

.btn-accent:hover {
    background-color: var(--accent-hover);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    background-color: var(--surface-hover);
}

.btn-sm {
    min-height: 38px;
    padding: 0.4rem 0.85rem;
    font-size: 0.82rem;
}

.btn-lg {
    min-height: 52px;
    font-size: 1rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ------------------------------------------------------------------------------
   Formulários & Campos de Entrada
------------------------------------------------------------------------------ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    min-height: var(--min-touch-target);
    padding: 0.65rem 0.95rem;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-helper {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    display: block;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.col-half {
    flex: 1 1 240px;
}

/* ------------------------------------------------------------------------------
   Wizard de Agendamento Público (booking.php)
------------------------------------------------------------------------------ */
.booking-page-container {
    max-width: 860px;
    margin: 1rem auto;
}

.booking-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.booking-header {
    padding: 2rem 1.5rem 1.5rem 1.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--primary-light) 0%, transparent 100%);
}

.studio-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background-color: var(--primary-color);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    margin-bottom: 0.75rem;
}

.booking-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.booking-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Indicador de Etapas */
.wizard-steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
    gap: 0.5rem;
}

.step-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    user-select: none;
}

.dot-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--border-color);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.step-dot.active .dot-num {
    background-color: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.step-dot.completed .dot-num {
    background-color: var(--accent-color);
    color: #ffffff;
}

.dot-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    display: none;
}

@media (min-width: 600px) {
    .dot-label { display: block; }
}

.step-line {
    flex: 1;
    max-width: 40px;
    height: 2px;
    background-color: var(--border-color);
}

/* Painéis do Wizard */
.wizard-pane {
    display: none;
    padding: 1.75rem 1.5rem;
}

.wizard-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.pane-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.pane-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.wizard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

/* Seleção de Serviços (Cards Interativos) */
.services-selection-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 640px) {
    .services-selection-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.service-card-item {
    padding: 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: var(--surface-color);
    cursor: pointer;
    min-height: var(--min-touch-target);
    transition: var(--transition-fast);
}

.service-card-item:hover {
    border-color: var(--secondary-color);
    background-color: var(--surface-hover);
}

.service-card-item.selected {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.service-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.service-name {
    font-size: 1.05rem;
    font-weight: 700;
}

.badge-duration {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    background-color: var(--surface-hover);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.service-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    min-height: 2.4em;
}

.service-pricing-row {
    display: flex;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px dashed var(--border-color);
    font-size: 0.85rem;
}

.price-val {
    font-weight: 600;
}

.deposit-val {
    font-weight: 800;
    color: var(--primary-color);
}

/* Layout de Horários e Matriz */
.date-time-picker-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .date-time-picker-layout {
        grid-template-columns: 280px 1fr;
    }
}

.slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.slot-btn {
    min-height: var(--min-touch-target);
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.slot-btn:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
}

.slot-btn.selected {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 4px 10px rgba(111, 66, 193, 0.3);
}

/* Resumo do Agendamento */
.booking-summary-box {
    margin-top: 1.5rem;
    padding: 1rem 1.25rem;
    background-color: var(--surface-hover);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-color);
}

.summary-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    padding: 0.25rem 0;
}

.summary-line.highlight {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    font-size: 1rem;
}

/* ------------------------------------------------------------------------------
   Checkout Pix (Etapa 4)
------------------------------------------------------------------------------ */
.pix-checkout-wrapper {
    text-align: center;
}

.pix-success-header {
    margin-bottom: 1.5rem;
}

.pulse-indicator {
    width: 14px;
    height: 14px;
    background-color: var(--accent-color);
    border-radius: 50%;
    margin: 0 auto 0.5rem auto;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 10px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.pix-card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

@media (min-width: 640px) {
    .pix-card-content {
        flex-direction: row;
        text-align: left;
        align-items: flex-start;
    }
}

.qr-code-frame {
    width: 220px;
    height: 220px;
    padding: 0.75rem;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pix-qr-image {
    max-width: 100%;
    height: auto;
}

.pix-details-column {
    flex: 1;
}

.pix-amount-badge {
    padding: 0.75rem 1rem;
    background-color: var(--primary-light);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.copy-paste-group {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
}

.copy-input {
    font-family: monospace;
    font-size: 0.85rem;
    background-color: var(--surface-hover);
}

.btn-copy-pix {
    white-space: nowrap;
}

.pix-polling-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0.5rem 0;
}

.polling-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------------------
   Painel Gerencial / Dashboard (dashboard.php, finances.php, courses.php)
------------------------------------------------------------------------------ */
.dashboard-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.dashboard-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.page-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* KPIs Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
}

.kpi-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
}

.kpi-card.highlight {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, var(--surface-color), var(--primary-light));
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-revenue { background-color: rgba(16, 185, 129, 0.15); color: #10b981; }
.icon-month { background-color: rgba(111, 66, 193, 0.15); color: var(--primary-color); }
.icon-pending { background-color: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.icon-today { background-color: rgba(59, 130, 246, 0.15); color: #3b82f6; }

.kpi-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.kpi-value {
    font-size: 1.4rem;
    font-weight: 800;
}

/* Content Card & Tabelas */
.content-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.card-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.card-heading {
    font-size: 1.15rem;
    font-weight: 700;
}

.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.filter-pill {
    padding: 0.35rem 0.75rem;
    background-color: var(--surface-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    min-height: 34px;
}

.filter-pill.active {
    background-color: var(--primary-color);
    color: #ffffff;
    border-color: var(--primary-color);
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    text-align: left;
}

.data-table th {
    padding: 0.75rem 0.85rem;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    font-weight: 700;
}

.data-table td {
    padding: 0.85rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tr:hover {
    background-color: var(--surface-hover);
}

.cell-subtext {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-warning { background-color: var(--warning-bg); color: var(--warning-text); }
.badge-info { background-color: var(--info-bg); color: var(--info-text); }
.badge-success { background-color: var(--success-bg); color: var(--success-text); }
.badge-danger { background-color: var(--danger-bg); color: var(--danger-text); }
.badge-primary { background-color: var(--primary-light); color: var(--primary-color); }
.badge-secondary { background-color: var(--surface-hover); color: var(--text-muted); }

/* Botão de Alternância de Aprovação em 1 Clique (Toggle Switch Button) */
.btn-toggle-approval {
    min-height: 38px;
    padding: 0.35rem 0.75rem;
    background-color: var(--surface-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: var(--transition-fast);
}

.switch-ball {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #94a3b8;
    transition: var(--transition-fast);
}

.btn-toggle-approval.approved {
    background-color: var(--success-bg);
    border-color: #10b981;
    color: var(--success-text);
}

.btn-toggle-approval.approved .switch-ball {
    background-color: #10b981;
}

/* ------------------------------------------------------------------------------
   Módulo Academy & Cursos (courses.php)
------------------------------------------------------------------------------ */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}

.course-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.course-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.course-price {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.course-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.course-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.course-dates {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.capacity-meter {
    background-color: var(--surface-hover);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
}

.capacity-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.4s ease;
}

.progress-bar-fill.full {
    background-color: #ef4444;
}

/* ------------------------------------------------------------------------------
   Módulos SaaS Feature Toggles (modules.php)
------------------------------------------------------------------------------ */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}

.module-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.module-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.module-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-academy { background-color: rgba(111, 66, 193, 0.15); color: var(--primary-color); }
.icon-staff { background-color: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.icon-inventory { background-color: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.icon-whatsapp { background-color: rgba(16, 185, 129, 0.15); color: #10b981; }

.module-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.module-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    flex: 1;
    margin-bottom: 1.25rem;
}

.module-status-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
}

.module-status-badge.active { background-color: var(--success-bg); color: var(--success-text); }
.module-status-badge.inactive { background-color: var(--surface-hover); color: var(--text-muted); }

/* Switch Toggle CSS */
.switch-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border-color);
    transition: .3s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* ------------------------------------------------------------------------------
   Modais & Toast Notifications
------------------------------------------------------------------------------ */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 540px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    animation: modalScale 0.25s ease;
}

@keyframes modalScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast-item {
    min-height: 48px;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 600;
    color: #ffffff;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideInRight 0.3s ease;
}

.toast-item.success { background-color: #10b981; }
.toast-item.error { background-color: #ef4444; }
.toast-item.info { background-color: var(--primary-color); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ------------------------------------------------------------------------------
   DRE & SVG Chart Styling
------------------------------------------------------------------------------ */
.dre-layout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 840px) {
    .dre-layout-grid {
        grid-template-columns: 1.2fr 1fr;
    }
}

.dre-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dre-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.dre-header-row {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
}

.dre-subtotal-row {
    border-top: 2px solid var(--border-color);
    padding-top: 0.75rem;
    font-size: 0.95rem;
}

.dre-total-row {
    margin-top: 0.5rem;
    padding: 0.85rem;
    background-color: var(--surface-hover);
    border-radius: var(--radius-sm);
    font-size: 1.05rem;
    border-bottom: none;
}

/* Login Page Styling */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    padding: 1.5rem;
}

.login-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    width: 100%;
    max-width: 420px;
}

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.logo-badge-lg {
    width: 54px;
    height: 54px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #ffffff;
    font-weight: 800;
    font-size: 22px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(111, 66, 193, 0.35);
}

.login-title {
    font-size: 1.45rem;
    font-weight: 800;
    margin-bottom: 0.3rem;
}

.login-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.login-footer-info {
    margin-top: 1.5rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.credentials-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Helpers Visuais */
.text-accent { color: var(--accent-color) !important; }
.text-primary { color: var(--primary-color) !important; }
.text-success { color: #10b981 !important; }
.text-warning { color: #f59e0b !important; }
.text-danger { color: #ef4444 !important; }
.text-muted { color: var(--text-muted) !important; }
.font-mono { font-family: monospace; }
.font-bold { font-weight: 700; }
.mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.text-center { text-align: center; }
.text-uppercase { text-transform: uppercase; }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ===== RESPONSIVIDADE MOBILE DEFINITIVA: CARDS DE ATENDIMENTO ===== */
@media (max-width: 768px) {
.dashboard-table-container table,
.dashboard-table-container thead,
.dashboard-table-container tbody,
.dashboard-table-container th,
.dashboard-table-container td,
.dashboard-table-container tr {
display: block !important;
width: 100% !important;
}

.dashboard-table-container thead {
display: none !important;
}

.dashboard-table-container tr {
margin-bottom: 1.25rem !important;
border: 1px solid var(--border-color, #334155) !important;
border-radius: 12px !important;
padding: 1rem !important;
background: var(--card-bg, #1e293b) !important;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
}

.dashboard-table-container td {
padding: 0.5rem 0 !important;
border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
text-align: left !important;
}

.dashboard-table-container td:last-child {
border-bottom: none !important;
padding-top: 0.75rem !important;
display: flex !important;
flex-wrap: wrap !important;
gap: 0.5rem !important;
justify-content: flex-start !important;
}

.dashboard-table-container td:last-child button,
.dashboard-table-container td:last-child a {
flex: 1 1 auto !important;
min-height: 42px !important;
display: inline-flex !important;
align-items: center !important;
justify-content: center !important;
padding: 0.5rem 1rem !important;
font-size: 0.9rem !important;
}
}

/* ===== DESTAQUE PARA AÇÕES DE GESTÃO NO CELULAR ===== */
@media (max-width: 768px) {
  /* Mantém o menu recolhido */
  .desktop-nav {
    display: none !important;
  }

  /* Garante que o contêiner da tabela não corte os botões */
  .dashboard-table-container {
    overflow-x: visible !important;
  }

  /* Transforma a linha em card com foco nas ações */
  .dashboard-table-container tbody tr {
    display: flex !important;
    flex-direction: column !important;
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 12px !important;
    margin-bottom: 1rem !important;
    padding: 12px !important;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15) !important;
  }

  .dashboard-table-container tbody td {
    display: block !important;
    padding: 6px 0 !important;
    border: none !important;
  }

  /* A última coluna (AÇÕES DE GESTÃO) ganha destaque no rodapé do card */
  .dashboard-table-container tbody td:last-child {
    margin-top: 10px !important;
    padding-top: 10px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  /* Botões de Aprovar, Liquidar, WhatsApp em largura cheia e fáceis de tocar */
  .dashboard-table-container tbody td:last-child button,
  .dashboard-table-container tbody td:last-child a,
  .dashboard-table-container tbody td:last-child form {
    flex: 1 1 45% !important;
    min-height: 44px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }
}

/* FORÇAR CARDS EM QUALQUER TABELA NO MOBILE */
@media (max-width: 850px) {
  table, thead, tbody, th, td, tr {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  thead {
    display: none !important;
  }

  tbody tr {
    margin-bottom: 1.2rem !important;
    border: 1px solid #334155 !important;
    border-radius: 12px !important;
    padding: 14px !important;
    background: #1e293b !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25) !important;
  }

  tbody td {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 8px 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
    text-align: right !important;
  }

  /* Coluna de ações com botões grandes */
  tbody td:last-child {
    border-bottom: none !important;
    margin-top: 10px !important;
    padding-top: 10px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }

  tbody td:last-child button,
  tbody td:last-child a,
  tbody td:last-child form {
    width: 100% !important;
    min-height: 46px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
  }
}

/* AJUSTE FORÇADO PARA #table-appointments EM DISPOSITIVOS MÓVEIS */
@media (max-width: 850px) {
.table-responsive {
overflow-x: visible !important;
}

#table-appointments,
#table-appointments tbody,
#table-appointments tr,
#table-appointments td {
display: block !important;
width: 100% !important;
box-sizing: border-box !important;
}

#table-appointments thead {
display: none !important;
}

#table-appointments tbody tr {
margin-bottom: 1.25rem !important;
border: 1px solid #334155 !important;
border-radius: 12px !important;
padding: 1rem !important;
background: #1e293b !important;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2) !important;
}

#table-appointments tbody td {
padding: 0.5rem 0 !important;
border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
text-align: left !important;
}

/* Última coluna: Ações de Gestão */
#table-appointments tbody td:last-child {
border-bottom: none !important;
margin-top: 0.75rem !important;
padding-top: 0.75rem !important;
border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
display: flex !important;
flex-direction: column !important;
gap: 0.5rem !important;
}

#table-appointments tbody td:last-child button,
#table-appointments tbody td:last-child a,
#table-appointments tbody td:last-child form {
width: 100% !important;
min-height: 44px !important;
display: flex !important;
align-items: center !important;
justify-content: center !important;
font-size: 0.95rem !important;
font-weight: 700 !important;
border-radius: 8px !important;
}
}

/* CORREÇÃO DO TEMA (CLARO/ESCURO) PARA OS CARTÕES MÓVEIS */
@media (max-width: 850px) {
#table-appointments tbody tr {
background: var(--surface-card, #ffffff) !important;
color: var(--text-color, #1e293b) !important;
border: 1px solid var(--border-color, #e2e8f0) !important;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="dark"] #table-appointments tbody tr,
body.dark #table-appointments tbody tr {
background: #1e293b !important;
color: #f8fafc !important;
border: 1px solid #334155 !important;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25) !important;
}

#table-appointments tbody td {
color: inherit !important;
border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.06)) !important;
}

[data-theme="dark"] #table-appointments tbody td,
body.dark #table-appointments tbody td {
border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
}

#table-appointments tbody td:last-child {
border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.08)) !important;
}

[data-theme="dark"] #table-appointments tbody td:last-child,
body.dark #table-appointments tbody td:last-child {
border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
}
}

/* AJUSTE DEFINITIVO DE TEMA PARA CARDS MOBILE */
@media (max-width: 850px) {
#table-appointments tbody tr {
background-color: var(--bg-card, var(--card-bg, var(--surface, #1e293b))) !important;
color: var(--text-color, var(--text-primary, #f8fafc)) !important;
border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1)) !important;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

#table-appointments tbody td {
color: var(--text-color, var(--text-primary, inherit)) !important;
border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08)) !important;
}

#table-appointments tbody td span,
#table-appointments tbody td div,
#table-appointments tbody td p {
color: inherit !important;
}

#table-appointments tbody td:last-child {
border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.1)) !important;
}
}

/* ===== RESPONSIVIDADE CARDS COM VARIÁVEIS OFICIAIS DO SISTEMA ===== */
@media (max-width: 850px) {
#table-appointments tbody tr {
background-color: var(--surface-color) !important;
color: var(--text-color) !important;
border: 1px solid var(--border-color) !important;
box-shadow: var(--shadow-md) !important;
}

#table-appointments tbody td {
color: var(--text-color) !important;
border-bottom: 1px solid var(--border-color) !important;
}

#table-appointments tbody td span,
#table-appointments tbody td div,
#table-appointments tbody td p,
#table-appointments tbody td strong {
color: var(--text-color) !important;
}

/* Ajusta cores atenuadas e complementares */
#table-appointments tbody td .text-muted,
#table-appointments tbody td small {
color: var(--text-muted) !important;
}

#table-appointments tbody td:last-child {
border-top: 1px solid var(--border-color) !important;
}
}
