:root {
    --primary: #9d4edd;
    --primary-dark: #7b2cbf;
    --primary-light: #e0aaff;
    --accent: #ff6b9d;
    --bg: #faf8fc;
    --sidebar-bg: #1a1225;
    --sidebar-text: #c4b5d0;
    --card-shadow: 0 4px 24px rgba(123, 44, 191, 0.08);
    --radius: 12px;
    --font: 'DM Sans', sans-serif;
    --font-display: 'Playfair Display', serif;
}

* { box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: #2d2640;
    margin: 0;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 0.75rem 0.45rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
    min-height: 124px;
}

.sidebar-brand-logo {
    width: 100%;
    max-width: 240px;
    height: 112px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--primary-light);
}

.logo-salao {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.logo-salao--login {
    width: min(100%, 280px);
    max-height: 88px;
    margin: 0 auto;
}

.logo-salao--sidebar {
    width: 100%;
    height: 100%;
    max-height: none;
    min-height: 0;
    object-fit: cover;
    object-position: center center;
}

.logo-salao--cliente {
    max-height: 38px;
    width: auto;
    max-width: min(100%, 220px);
}

.logo-salao--install {
    width: min(100%, 260px);
    margin: 0 auto;
}

.logo-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-light);
}

.logo-fallback--login {
    width: 64px;
    height: 64px;
    margin: 0 auto 0.75rem;
    color: #c9a227;
}

.logo-fallback--login i { font-size: 2.75rem; }

.logo-fallback--sidebar i { font-size: 1.75rem; }

.logo-fallback--cliente i { font-size: 1.5rem; color: var(--primary); }

.logo-fallback--install {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    color: var(--primary);
}

.logo-fallback--install i { font-size: 3rem; }

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav li.nav-section {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.925rem;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(157, 78, 221, 0.2);
    color: #fff;
}

.sidebar-nav a.active {
    border-left: 3px solid var(--primary-light);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.user-info-link {
    text-decoration: none;
    border-radius: 10px;
    padding: 0.35rem;
    transition: background 0.2s;
}

.user-info-link:hover {
    background: rgba(255, 255, 255, 0.08);
}

.user-info i { font-size: 1.75rem; color: var(--primary-light); }
.user-info strong { display: block; color: #fff; }
.user-info small { color: var(--sidebar-text); }

.avatar-img,
.avatar-iniciais {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.avatar-iniciais {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
}

.avatar-sm { width: 36px; height: 36px; font-size: 0.75rem; }
.avatar-md { width: 40px; height: 40px; }
.avatar-xl { width: 112px; height: 112px; font-size: 2rem; }

.cliente-user-link:hover .text-muted strong {
    color: var(--primary) !important;
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    padding: 0.5rem 0;
}

.btn-logout:hover { color: #fff; }

/* Main content */
.main-content {
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
}

.main-content-full {
    padding: 0;
    min-height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    margin: 0;
    color: #1a1225;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    background: #fff;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f0ebf5;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* Stats */
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--card-shadow);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-primary .stat-icon { background: #f3e8ff; color: var(--primary); }
.stat-success .stat-icon { background: #dcfce7; color: #16a34a; }
.stat-info .stat-icon { background: #dbeafe; color: #2563eb; }
.stat-warning .stat-icon { background: #fef3c7; color: #d97706; }

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: #6b7280;
}

/* Badges */
.badge-agendado { background: #e0aaff; color: #5a189a; }
.badge-concluido { background: #bbf7d0; color: #166534; }
.badge-cancelado { background: #e2e8f0; color: #475569; }
.badge-ausente { background: #fecaca; color: #991b1b; }
.badge-default { background: #f3e8ff; color: #6b21a8; }

/* Buttons */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-whatsapp {
    background: #25d366;
    border-color: #25d366;
    color: #fff;
}

.btn-whatsapp:hover,
.btn-whatsapp:focus {
    background: #1da851;
    border-color: #1da851;
    color: #fff;
}

.btn-outline-whatsapp {
    color: #128c7e;
    border-color: #25d366;
}

.btn-outline-whatsapp:hover,
.btn-outline-whatsapp:focus {
    background: #25d366;
    border-color: #25d366;
    color: #fff;
}

/* Table */
.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    font-weight: 600;
    border-bottom-width: 1px;
}

.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn { margin-right: 0.25rem; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #9ca3af;
}

.empty-state i {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.listagem-toolbar .card-body {
    padding-bottom: 0.75rem;
}

.import-export-panel {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0ebf5;
}

.import-export-panel summary {
    cursor: pointer;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    user-select: none;
}

.import-export-panel summary::-webkit-details-marker {
    display: none;
}

.import-export-panel summary::before {
    content: '▸';
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.import-export-panel[open] summary::before {
    transform: rotate(90deg);
}

.import-export-panel summary:hover {
    color: var(--primary-dark);
}

.import-export-body {
    margin-top: 0.85rem;
    padding: 0.85rem 1rem 0.25rem;
    background: #faf8fc;
    border: 1px solid #f0ebf5;
    border-radius: 10px;
}

/* Login — tema escuro premium */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
    font-family: 'Montserrat', 'DM Sans', sans-serif;
    padding: 1.5rem;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: #141414;
    border: 1px solid rgba(201, 162, 39, 0.15);
    border-radius: 14px;
    padding: 2.25rem 2rem 2rem;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.login-brand {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-headings {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-subtitle {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #c9a227;
    margin-bottom: 0.35rem;
}

.login-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #c9a227;
    margin: 0;
    line-height: 1.2;
}

.login-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 1.75rem;
}

.login-tab {
    flex: 1;
    text-align: center;
    padding: 0.65rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    text-decoration: none;
    display: block;
}

.login-tab.active {
    color: #c9a227;
    border-bottom-color: #c9a227;
}

.login-alert {
    background: rgba(220, 53, 69, 0.12);
    border: 1px solid rgba(220, 53, 69, 0.35);
    color: #ff8a8a;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.login-hint {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.58);
    line-height: 1.45;
    margin: -0.25rem 0 1rem;
    text-align: left;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.login-field label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 0.45rem;
}

.login-input {
    width: 100%;
    background: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: #1a1a1a;
    outline: none;
    transition: box-shadow 0.2s;
}

.login-input::placeholder {
    color: #aaa;
}

.login-input:focus {
    box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.35);
}

.login-btn {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.95rem 1rem;
    background: #c9a227;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    color: #0a0a0a;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.login-btn:hover {
    background: #dbb42e;
}

.login-btn:active {
    transform: scale(0.98);
}

.login-footer {
    text-align: center;
    margin-top: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.login-footer-note {
    margin: 0;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.35);
    line-height: 1.5;
}

.login-footer-note i {
    color: #c9a227;
    margin-right: 0.25rem;
}

.login-link {
    color: #c9a227;
    text-decoration: none;
    font-weight: 600;
}

.login-link:hover {
    color: #dbb42e;
    text-decoration: underline;
}

.login-container-wide {
    max-width: 520px;
}

.login-container-wide .login-card {
    max-height: 92vh;
    overflow-y: auto;
}

.login-form-cadastro {
    gap: 0.85rem;
}

.login-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

.login-grid-3 {
    grid-template-columns: 1fr 1fr 80px;
}

.login-section-title {
    margin: 0.5rem 0 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #c9a227;
}

.login-check {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.45;
    cursor: pointer;
}

.login-check input {
    margin-top: 0.2rem;
    accent-color: #c9a227;
    flex-shrink: 0;
}

.login-alert-success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.35);
    color: #86efac;
}

.login-btn-link {
    display: block;
    text-align: center;
    text-decoration: none;
}

.login-honeypot {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
    pointer-events: none;
}

@media (max-width: 480px) {
    .login-card {
        padding: 1.75rem 1.25rem 1.5rem;
    }

    .login-title {
        font-size: 1.15rem;
    }

    .login-grid,
    .login-grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Cliente portal */
.cliente-portal { background: var(--bg); }

.cliente-header {
    background: #fff;
    padding: 1rem 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 0;
}

.cliente-brand {
    display: flex;
    align-items: center;
}

.historico-card {
    transition: transform 0.2s;
}

.historico-card:hover {
    transform: translateY(-2px);
}

.historico-preco {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
}

/* Aniversariantes */
.aniversario-card {
    transition: transform 0.2s;
}

.aniversario-card:hover { transform: translateY(-2px); }

.aniversario-hoje {
    border: 2px solid var(--accent);
    background: linear-gradient(135deg, #fff5f8, #fff);
}

.aniversario-dia {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.aniversario-dia span {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
}

.aniversario-dia small {
    font-size: 0.65rem;
    text-transform: uppercase;
}

/* FullCalendar overrides */
#calendario .fc-toolbar-title {
    font-family: var(--font-display);
    font-size: 1.25rem !important;
}

#calendario .fc-button-primary {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}

#calendario .fc-button-primary:hover {
    background: var(--primary-dark) !important;
}

#calendario .fc-button-primary:not(:disabled).fc-button-active {
    background: var(--primary-dark) !important;
}

#calendario .fc-timegrid-slot {
    height: 2.1rem;
}

#calendario .fc-timegrid-event {
    border-radius: 6px;
    padding: 2px 6px;
    font-size: 0.78rem;
    line-height: 1.25;
    overflow: hidden;
}

#calendario .fc-event-custom {
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
}

#calendario .fc-event-custom strong {
    font-size: 0.72rem;
    opacity: 0.95;
}

#calendario .fc-event-cliente {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#calendario .fc-event-servico {
    opacity: 0.9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#calendario .fc-timegrid-col-events {
    margin: 0 2px;
}

.chart-card canvas {
    max-height: 320px;
}

.chart-card .card-body {
    min-height: 280px;
}

/* Install page */
.install-page {
    min-height: 100vh;
    background: var(--bg);
    padding: 2rem;
}

.install-card {
    max-width: 600px;
    margin: 0 auto;
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
}

/* Responsive */
@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}

@media print {
    .sidebar, .page-header .btn, .actions-cell { display: none !important; }
    .main-content { margin-left: 0; }
}

/* Controle de acessos */
.access-tabs .nav-link {
    color: #6b7280;
    font-weight: 600;
}

.access-tabs .nav-link.active {
    color: var(--primary-dark);
    border-bottom: 2px solid var(--primary);
}

.admin-subtabs .nav-link {
    color: #6b7280;
    font-weight: 500;
    font-size: 0.9rem;
}

.admin-subtabs .nav-link.active {
    background: var(--primary);
    color: #fff;
}

.perm-table input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary);
}
