:root {
    --primary: #6B4226;
    --primary-light: #8B5E3C;
    --primary-dark: #3E2413;
    --secondary: #A8D5A2;
    --secondary-light: #C8E6C5;
    --accent: #D4A574;
    --background: #F9F6F2;
    --surface: #FFFFFF;
    --text: #2C2C2C;
    --text-light: #888888;
    --border: #E8E0D8;
    --danger: #E74C3C;
    --warning: #F39C12;
    --success: #27AE60;
    --info: #3498DB;
    --cal-green: #27AE60;
    --cal-orange: #F39C12;
    --cal-red: #E74C3C;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 8px rgba(0,0,0,0.04), 0 2px 16px rgba(0,0,0,0.03);
    --shadow-lg: 0 4px 24px rgba(0,0,0,0.08);
    --transition: all 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-light); }

/* =========== LAYOUT =========== */
.app-container { display: flex; min-height: 100vh; }

/* =========== SIDEBAR =========== */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #FFFBF7 0%, #FFF5EC 100%);
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--border);
}

.sidebar-header {
    padding: 28px 24px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary-dark);
    letter-spacing: -1px;
}
.sidebar-logo span {
    font-weight: 400;
    color: var(--primary-light);
}

.sidebar-user {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 4px;
}

.sidebar-nav { padding: 16px 0; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 24px;
    color: var(--text-light);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.sidebar-nav a:hover {
    background: var(--background);
    color: var(--text);
}

.sidebar-nav a.active {
    background: rgba(107, 66, 38, 0.1);
    color: var(--primary-dark);
    font-weight: 600;
    border-left-color: var(--accent);
}

.sidebar-nav .nav-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: inherit;
    opacity: 0.65;
}
.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon {
    opacity: 1;
}

.sidebar-nav .nav-section {
    padding: 18px 24px 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-light);
    opacity: 0.6;
    margin-top: 4px;
}

.sidebar-nav .nav-logout {
    color: var(--danger);
    opacity: 0.7;
}
.sidebar-nav .nav-logout:hover {
    opacity: 1;
    background: rgba(231, 76, 60, 0.05);
}

.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 36px;
    max-width: 1200px;
    width: 100%;
}

/* =========== TOPBAR MOBILE =========== */
.topbar {
    display: none;
    background: var(--surface);
    color: var(--primary-dark);
    padding: 14px 20px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 99;
    border-bottom: 1px solid var(--border);
}

.topbar h1 { font-size: 1.3rem; font-weight: 800; }
.topbar a { color: var(--primary-dark); }

.menu-toggle {
    background: var(--background);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.menu-toggle:hover { background: var(--border); }

/* =========== CARDS =========== */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 24px;
    border: 1px solid rgba(212, 165, 116, 0.12);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 1.2rem;
    color: var(--primary-dark);
    font-weight: 700;
}

/* =========== BUTTONS =========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    min-height: 44px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 2px 8px rgba(107, 66, 38, 0.25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    color: white;
    box-shadow: 0 4px 14px rgba(107, 66, 38, 0.3);
    transform: translateY(-1px);
}

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

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c0392b; color: white; }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
    min-height: 36px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 1.05rem;
    min-height: 52px;
    border-radius: var(--radius);
}

.btn-block { width: 100%; }

/* =========== FORMS =========== */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: var(--transition);
    background: var(--surface);
    min-height: 46px;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(107, 66, 38, 0.08);
}

textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { appearance: auto; }

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
    font-weight: 500;
    user-select: none;
    min-height: 46px;
}

.checkbox-label:hover { border-color: var(--primary); }
.checkbox-label input:checked + span { color: var(--primary); font-weight: 700; }
.checkbox-label:has(input:checked) {
    border-color: var(--primary);
    background: rgba(107, 66, 38, 0.04);
}
.checkbox-label input[type="checkbox"],
.checkbox-label input[type="radio"] { width: 18px; height: 18px; accent-color: var(--primary); }

/* =========== TABLES =========== */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; }

table th, table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
}

table th {
    background: var(--background);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
}

table tr:hover { background: rgba(107, 66, 38, 0.02); }

/* =========== ALERTS =========== */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: #E8F5E9; color: #1B5E20; border-left: 4px solid var(--success); }
.alert-danger { background: #FFEBEE; color: #B71C1C; border-left: 4px solid var(--danger); }
.alert-warning { background: #FFF8E1; color: #E65100; border-left: 4px solid var(--warning); }
.alert-info { background: #E3F2FD; color: #0D47A1; border-left: 4px solid var(--info); }

/* =========== BADGES =========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    min-height: 24px;
}

.badge-success { background: #E8F5E9; color: #1B5E20; }
.badge-danger { background: #FFEBEE; color: #B71C1C; }
.badge-warning { background: #FFF8E1; color: #E65100; }
.badge-info { background: #E3F2FD; color: #0D47A1; }
.badge-neutral { background: #F0EBE5; color: #5D4E37; }

/* =========== GRID =========== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* =========== AUTH =========== */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: linear-gradient(135deg, #FDF8F3 0%, #E8DDD4 50%, #D4C4B0 100%);
}

.auth-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 48px;
    width: 100%;
    max-width: 480px;
}

.auth-card h1 {
    text-align: center;
    color: var(--primary-dark);
    margin-bottom: 8px;
    font-size: 2.2rem;
    font-weight: 800;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 36px;
    font-size: 1.1rem;
}

.auth-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 1rem;
    color: var(--text-light);
}

/* =========== CALENDAR TABLE =========== */
.calendar-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    table-layout: fixed;
}

.calendar-table thead th {
    background: var(--background);
    padding: 10px 4px;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
}
.calendar-table thead th:last-child { border-right: none; }

.calendar-table thead th.cal-week-header {
    width: 36px;
    font-size: 0.7rem;
    color: var(--text-light);
    opacity: 0.7;
}

.calendar-table td {
    padding: 0;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    vertical-align: top;
    height: 62px;
}
.calendar-table td:last-child { border-right: none; }
.calendar-table tbody tr:last-child td { border-bottom: none; }

.cal-week-cell {
    width: 36px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    background: var(--background);
    vertical-align: middle !important;
    opacity: 0.7;
}

.cal-empty {
    background: var(--background);
    opacity: 0.3;
}

.cal-day {
    background: var(--surface);
    cursor: default;
    padding: 6px 4px !important;
    text-align: center;
    transition: var(--transition);
    position: relative;
}

.cal-day.cal-clickable { cursor: pointer; }
.cal-day.cal-clickable:hover {
    background: rgba(107, 66, 38, 0.04);
}

.cal-day.cal-today {
    background: rgba(107, 66, 38, 0.06);
}
.cal-day.cal-today .cal-num {
    background: var(--primary);
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cal-num {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    display: inline-block;
}

.cal-day.cal-green { background: rgba(39, 174, 96, 0.08); }
.cal-day.cal-green .cal-num { color: #1B5E20; }
.cal-day.cal-orange { background: rgba(243, 156, 18, 0.08); }
.cal-day.cal-orange .cal-num { color: #E65100; }
.cal-day.cal-red { background: rgba(231, 76, 60, 0.08); }
.cal-day.cal-red .cal-num { color: #B71C1C; }

.cal-dots {
    display: flex;
    gap: 3px;
    justify-content: center;
    margin-top: 4px;
}

.cal-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}
.cal-dot.dot-green { background: var(--cal-green); }
.cal-dot.dot-orange { background: var(--cal-orange); }
.cal-dot.dot-red { background: var(--cal-red); }

.calendar-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    padding: 12px;
    flex-wrap: wrap;
}

.calendar-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-light);
}

.calendar-legend .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-green { background: var(--cal-green); }
.dot-orange { background: var(--cal-orange); }
.dot-red { background: var(--cal-red); }

/* =========== SERVICE CARDS =========== */
.service-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    border-left: 4px solid var(--primary);
    margin-bottom: 12px;
    transition: var(--transition);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
}
.service-card:hover { box-shadow: var(--shadow-lg); }

.service-card.status-green { border-left-color: var(--cal-green); }
.service-card.status-orange { border-left-color: var(--cal-orange); }
.service-card.status-red { border-left-color: var(--cal-red); }
.service-card.annule { border-left-color: var(--danger); opacity: 0.6; }

.service-card .service-date { font-weight: 700; color: var(--primary); font-size: 1.05rem; }
.service-card .service-time { color: var(--text-light); font-size: 0.95rem; }
.service-card .service-spots { margin-top: 8px; font-size: 0.95rem; }

/* =========== SUGGESTIONS =========== */
.suggestion-card {
    background: rgba(39,174,96,0.03);
    border: 1px solid rgba(39,174,96,0.15);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}
.suggestion-card:hover { border-color: var(--success); }
.suggestion-card.urgent {
    background: rgba(231,76,60,0.03);
    border-color: rgba(231,76,60,0.15);
}
.suggestion-card.urgent:hover { border-color: var(--danger); }

/* =========== MENU ITEMS =========== */
.menu-item-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.04);
}
.menu-item-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.menu-item-card img { width: 100%; height: 180px; object-fit: cover; }
.menu-item-card .menu-item-body { padding: 20px; }
.menu-item-card .menu-item-price { font-weight: 800; color: var(--primary); font-size: 1.2rem; }
.menu-item-card .unavailable { opacity: 0.5; }

/* =========== STOCK =========== */
.stock-alert {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: #FFF8E1;
    border-radius: var(--radius-sm);
    border: 1px solid #FFECB3;
    margin-bottom: 10px;
    font-size: 1rem;
}

/* =========== STAT CARDS =========== */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    text-align: center;
}
.stat-card .stat-value { font-size: 2.4rem; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { font-size: 0.95rem; color: var(--text-light); margin-top: 6px; }

/* =========== NOTIFICATIONS BADGE =========== */
.notif-badge {
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

/* =========== RECURRENCE PICKER =========== */
.recurrence-option {
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
}
.recurrence-option:hover { border-color: var(--primary); }
.recurrence-option.selected {
    border-color: var(--primary);
    background: rgba(107, 66, 38, 0.05);
    font-weight: 700;
}

/* =========== PAGINATION =========== */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 28px; }
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    font-size: 0.95rem;
    font-weight: 600;
    min-height: 40px;
    display: flex;
    align-items: center;
}
.pagination a:hover { background: var(--primary); color: white; border-color: var(--primary); }
.pagination .active { background: var(--primary); color: white; border-color: var(--primary); }

/* =========== SIDEBAR OVERLAY =========== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: 99;
    backdrop-filter: blur(4px);
}
.sidebar-overlay.active { display: block; }

/* =========== RESPONSIVE MOBILE =========== */
@media (max-width: 768px) {
    body { font-size: 16px; }

    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
    .topbar { display: flex; }
    .main-content { margin-left: 0; padding: 20px 16px; }

    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

    .auth-card { padding: 28px 20px; }
    .auth-card h1 { font-size: 1.8rem; }

    .card { padding: 18px 14px; }

    table th, table td { padding: 10px 8px; font-size: 0.9rem; }

    .btn { min-height: 48px; font-size: 1rem; }
    .btn-sm { min-height: 40px; }

    .form-control { min-height: 48px; font-size: 1rem; padding: 12px; }

    .calendar-table td { height: 50px; }
    .cal-num { font-size: 0.85rem; }
    .cal-week-cell { width: 28px; font-size: 0.65rem; }
    .calendar-table thead th { padding: 8px 2px; font-size: 0.65rem; }
    .calendar-table thead th.cal-week-header { width: 28px; }
    .cal-dot { width: 5px; height: 5px; }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.15rem; }

    .flex-between { flex-direction: column; gap: 12px; align-items: stretch; }
    .flex-between .btn { width: 100%; }

    .checkbox-group { flex-direction: column; }
}

@media (max-width: 1024px) and (min-width: 769px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .main-content { padding: 28px; }
}

/* =========== UTILITIES =========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.hidden { display: none; }

/* Page title */
.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 24px;
}

/* =========== GAMIFICATION =========== */
.xp-card {
    background: linear-gradient(135deg, #FFFBF7, #FFF5EC);
    border: 1.5px solid var(--accent);
}

.grade-icon-lg {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--grade-color, var(--primary)), rgba(255,255,255,0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    flex-shrink: 0;
}

.grade-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, rgba(0,0,0,0.04), rgba(0,0,0,0.08));
    border: 1.5px solid var(--grade-color, #8B7355);
    color: var(--grade-color, #8B7355);
}

.grade-badge-sm {
    padding: 1px 8px;
    font-size: 0.7rem;
}

.xp-bar-container {
    width: 100%;
    height: 10px;
    background: rgba(0,0,0,0.06);
    border-radius: 5px;
    overflow: hidden;
}

.xp-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.8s ease;
    background: var(--primary);
}

/* Grades legend */
.grades-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.grade-legend-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    min-width: 90px;
    text-align: center;
    transition: var(--transition);
}
.grade-legend-item:hover {
    border-color: var(--grade-color);
    background: rgba(0,0,0,0.02);
}

.grade-legend-emoji { font-size: 1.5rem; }
.grade-legend-item strong { font-size: 0.85rem; color: var(--grade-color); }
.grade-legend-item small { font-size: 0.75rem; color: var(--text-light); }

/* Ranking cards */
.ranking-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.ranking-card:last-child { border-bottom: none; }
.ranking-card:hover { background: rgba(107, 66, 38, 0.02); }

.ranking-card.ranking-me {
    background: linear-gradient(135deg, rgba(212, 165, 116, 0.08), rgba(212, 165, 116, 0.04));
    border-radius: var(--radius-sm);
    padding: 14px 12px;
    margin: 4px -12px;
}

.ranking-position {
    width: 36px;
    text-align: center;
    flex-shrink: 0;
}

.ranking-medal { font-size: 1.5rem; }
.ranking-num { font-size: 1rem; font-weight: 700; color: var(--text-light); }

.ranking-info { flex: 1; }

/* My services cards */
.my-service-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.my-service-card:last-child { border-bottom: none; }

.my-service-info { flex: 1; }
.my-service-date { font-weight: 700; color: var(--primary); font-size: 1rem; }
.my-service-time { color: var(--text-light); font-size: 0.9rem; }

.my-service-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .my-service-card { flex-direction: column; align-items: stretch; }
    .my-service-actions { justify-content: stretch; }
    .my-service-actions .btn { flex: 1; }
    .grades-legend { justify-content: center; }
    .week-picker { grid-template-columns: repeat(2, 1fr); }
}

/* =========== AVATAR =========== */
.avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* =========== RECURRENCE PANEL =========== */
.recurrence-panel {
    background: linear-gradient(135deg, #FFFBF7, #FFF5EC);
    border: 1.5px solid var(--accent);
    border-radius: var(--radius);
    overflow: hidden;
}

.recurrence-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    transition: var(--transition);
}
.recurrence-panel-header:hover { background: rgba(212, 165, 116, 0.1); }

.recurrence-chevron {
    color: var(--primary);
    font-size: 0.85rem;
    transition: var(--transition);
}

#recurrenceBody {
    padding: 0 20px 20px;
}

.recurrence-info {
    background: rgba(107, 66, 38, 0.06);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 1rem;
    color: var(--primary-dark);
    border-left: 3px solid var(--accent);
}

/* =========== WEEK PICKER =========== */
.week-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.week-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 14px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    user-select: none;
    background: var(--surface);
}

.week-chip:hover {
    border-color: var(--accent);
    background: rgba(212, 165, 116, 0.05);
}

.week-chip.pre-selected,
.week-chip:has(input:checked) {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(107, 66, 38, 0.08), rgba(212, 165, 116, 0.1));
}

.week-chip input { display: none; }

.week-chip span {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.week-chip small {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 3px;
}

.week-chip.pre-selected span,
.week-chip:has(input:checked) span {
    color: var(--primary);
}

/* =========== TOGGLE SWITCH =========== */
.toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    gap: 12px;
    background: var(--surface);
}
.toggle-label:hover { border-color: var(--accent); }

.toggle-input { display: none; }

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    transition: var(--transition);
    flex-shrink: 0;
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-input:checked + .toggle-switch {
    background: var(--primary);
}
.toggle-input:checked + .toggle-switch::after {
    left: 25px;
}

/* =========== RECURRENCE PREVIEW =========== */
.recurrence-preview {
    background: rgba(107, 66, 38, 0.04);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--text);
    border: 1px dashed var(--border);
    min-height: 20px;
}

/* =========== WARM CARD ACCENTS =========== */
.card-header h2 {
    position: relative;
    padding-left: 12px;
}
.card-header h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 2px;
    bottom: 2px;
    width: 3px;
    background: var(--accent);
    border-radius: 2px;
}

/* Smooth animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.card, .service-card, .menu-item-card { animation: fadeIn 0.25s ease; }

/* =========== CAISSE BADGES =========== */
.caisse-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #7B68EE, #9B8AFF);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.caisse-badge-sm {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: linear-gradient(135deg, #7B68EE, #9B8AFF);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 12px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* =========== CAISSE WIDGET (DASHBOARD) =========== */
.caisse-widget .card-header h2 {
    display: flex;
    align-items: center;
    gap: 8px;
}

.caisse-status-card {
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-bottom: 12px;
}

.caisse-status-card.caisse-active {
    background: rgba(123, 104, 238, 0.06);
    border: 1px solid rgba(123, 104, 238, 0.2);
    display: flex;
    align-items: center;
    gap: 16px;
}

.caisse-status-card.caisse-pending {
    background: rgba(218, 165, 32, 0.06);
    border: 1px solid rgba(218, 165, 32, 0.2);
    display: flex;
    align-items: center;
    gap: 16px;
}

.caisse-status-card.caisse-available {
    background: rgba(39, 174, 96, 0.04);
    border: 1px solid rgba(39, 174, 96, 0.2);
}

.caisse-status-card.caisse-locked {
    background: var(--background);
    border: 1px dashed var(--border);
}

.caisse-icon-lg {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
}

.caisse-benefits {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.caisse-benefit {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 8px;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--text-light);
    gap: 4px;
}

.caisse-benefit-icon {
    font-size: 1.3rem;
    font-weight: 800;
    color: #7B68EE;
}

@media (max-width: 600px) {
    .caisse-benefits {
        grid-template-columns: 1fr;
    }
}

/* =========== SLOT PICKER (CALENDAR) =========== */
.slot-picker-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
}

.slot-picker-option:hover {
    background: white;
    border-color: var(--accent);
    box-shadow: 0 2px 12px rgba(212, 165, 116, 0.15);
    color: var(--text);
    transform: translateY(-1px);
}

.slot-picker-time {
    font-weight: 700;
    font-size: 1.1rem;
}

.slot-picker-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slot-picker-count {
    font-weight: 700;
    font-size: 1.05rem;
}

/* =========== CAISSE OUI/NON TOGGLE =========== */
.caisse-toggle-group {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}

.caisse-toggle-option {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.caisse-toggle-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.caisse-toggle-label {
    display: block;
    text-align: center;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
    transition: var(--transition);
    background: white;
}

.caisse-toggle-option input:checked + .caisse-toggle-label {
    border-color: #7B68EE;
    background: rgba(123, 104, 238, 0.06);
    color: #7B68EE;
}

.caisse-toggle-option.active-yes input:checked + .caisse-toggle-label {
    border-color: var(--success);
    background: rgba(39, 174, 96, 0.06);
    color: var(--success);
}

.caisse-toggle-option.active-no input:checked + .caisse-toggle-label {
    border-color: var(--text-light);
    background: var(--background);
    color: var(--text-light);
}

/* =========== PROFILE PHOTO SECTION =========== */
.profile-photo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.profile-photo-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 16px;
    overflow: hidden;
    border: 3px solid var(--border);
    background: var(--background);
}

.profile-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-photo-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--background);
}

.profile-photo-btn {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: var(--transition);
}

.profile-photo-btn:hover {
    background: var(--primary-light);
    transform: scale(1.1);
}

.profile-photo-info {
    margin-top: 8px;
    text-align: center;
}

/* =========== AVATAR CHOICE (GENRE) =========== */
.avatar-choice-group {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    justify-content: center;
}

.avatar-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    background: white;
}

.avatar-choice input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.avatar-choice.selected {
    border-color: var(--accent);
    background: rgba(212, 165, 116, 0.06);
    box-shadow: 0 2px 12px rgba(212, 165, 116, 0.2);
}

.avatar-choice:hover {
    border-color: var(--accent);
}

.avatar-choice-img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
}

.avatar-choice span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-light);
}

.avatar-choice.selected span {
    color: var(--primary);
}

/* =========== DASHBOARD WELCOME =========== */
.dashboard-welcome {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-avatar-img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border);
}

/* =========== RANKING AVATAR =========== */
.ranking-avatar-img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

/* =========== CELEBRATION: FULL-SCREEN CONFETTI =========== */
.confetti-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
    transition: opacity 0.5s ease;
}
.confetti-fs-piece {
    position: absolute;
    top: -20px;
    opacity: 0;
    animation: confettiBurst ease-out forwards;
}
@keyframes confettiBurst {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg) scale(0.3);
        opacity: 0;
    }
    10% { opacity: 1; }
    40% { opacity: 1; }
    100% {
        transform: translateY(100vh) translateX(var(--drift, 0px)) rotate(var(--spin, 720deg)) scale(0.5);
        opacity: 0;
    }
}

/* Celebration banner */
.alert-celebration {
    background: linear-gradient(135deg, #FFF8E1, #FFFDE7, #FFF3E0);
    border: 2px solid #FFD54F;
    border-radius: 16px;
    padding: 18px 24px;
    position: relative;
    overflow: hidden;
    animation: celebBannerIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: opacity 0.6s ease;
    box-shadow: 0 4px 20px rgba(218, 165, 32, 0.2);
}
.celebration-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #6B4226;
}
.celebration-emoji {
    font-size: 1.5rem;
    animation: celebEmojiBounce 0.6s ease infinite alternate;
}
@keyframes celebBannerIn {
    from { transform: scale(0.8) translateY(-30px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
@keyframes celebEmojiBounce {
    from { transform: scale(1) rotate(-5deg); }
    to { transform: scale(1.15) rotate(5deg); }
}

/* =========== GRADE-UP OVERLAY =========== */
.gradeup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: gradeupFadeIn 0.4s ease;
    transition: opacity 0.8s ease;
}
.gradeup-overlay.gradeup-fade {
    opacity: 0;
}
.gradeup-card {
    background: white;
    border-radius: 24px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: gradeupCardPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 380px;
}
.gradeup-emoji {
    font-size: 4rem;
    animation: gradeupEmojiBounce 1s ease infinite;
    margin-bottom: 12px;
}
.gradeup-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--primary-dark);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.gradeup-grade {
    font-size: 2rem;
    font-weight: 900;
    margin-bottom: 12px;
}
.gradeup-msg {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 500;
}
@keyframes gradeupFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes gradeupCardPop {
    0% { transform: scale(0.3) rotate(-5deg); opacity: 0; }
    60% { transform: scale(1.08) rotate(1deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}
@keyframes gradeupEmojiBounce {
    0%, 100% { transform: scale(1) translateY(0); }
    25% { transform: scale(1.15) translateY(-8px); }
    50% { transform: scale(1) translateY(0); }
    75% { transform: scale(1.1) translateY(-4px); }
}

/* =========== STATISTICS PAGE =========== */
.stats-kpi-grid {
    gap: 16px;
}
.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
@media (max-width: 900px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
    .grid-4 { grid-template-columns: 1fr; }
}
.stats-kpi {
    text-align: center;
    padding: 20px 16px;
}
.stats-kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
}
.stats-kpi-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 4px;
}
.stats-kpi-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}
.stats-chart-container {
    padding: 20px 10px 10px;
    overflow-x: auto;
}
.stats-chart {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    min-height: 200px;
    padding-bottom: 10px;
}
.stats-bar-group {
    flex: 1;
    min-width: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.stats-bar-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    white-space: nowrap;
}
.stats-bar-wrapper {
    width: 100%;
    height: 160px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.stats-bar {
    width: 70%;
    max-width: 40px;
    background: linear-gradient(to top, var(--primary), var(--accent));
    border-radius: 6px 6px 2px 2px;
    transition: height 0.6s ease;
    min-height: 4px;
}
.stats-bar-label {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
    white-space: nowrap;
}
