:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #a5b4fc;
    --primary-bg: #eef2ff;
    --success: #22c55e;
    --success-bg: #dcfce7;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --reward: #8b5cf6;
    --reward-bg: #f3f0ff;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,.1);
    --shadow-lg: 0 12px 24px rgba(0,0,0,.12);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --sidebar-w: 260px;
    --transition: .2s ease;
}

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

html { overflow-x: hidden; -webkit-text-size-adjust: 100%; }

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

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

input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ===== AUTH PAGES ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 32px 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
}

.auth-card .logo { text-align: center; font-size: 48px; margin-bottom: 8px; }
.auth-card h1 { text-align: center; font-size: 24px; margin-bottom: 4px; color: var(--primary); }
.auth-card .subtitle { text-align: center; color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--text); }
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: border-color var(--transition);
    background: var(--card);
    color: var(--text);
    -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ===== CUSTOM CHECKBOX ===== */
input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    flex-shrink: 0;
}
input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}
input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}
input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary { background: var(--primary); color: #fff; width: 100%; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: var(--radius-xs); }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
    word-break: break-word;
}
.alert-error { background: var(--danger-bg); color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: #16a34a; border: 1px solid #bbf7d0; }

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

.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #1e1b4b, #312e81);
    color: #fff;
    position: fixed;
    top: 0; left: 0; height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-header h2 { font-size: 18px; font-weight: 700; }
.sidebar-header .role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 6px;
    background: rgba(255,255,255,.15);
}

.sidebar-nav { flex: 1; padding: 8px 0; }
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,.65);
    font-size: 14px;
    transition: all var(--transition);
    text-decoration: none;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: rgba(255,255,255,.1);
    color: #fff;
}
.sidebar-nav a .icon { font-size: 18px; width: 22px; text-align: center; flex-shrink: 0; }

.menu-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
}
.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    color: rgba(255,255,255,.65);
    font-size: 13px;
}
.sidebar-footer a:hover { color: #fff; }

.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 28px;
    min-height: 100vh;
    max-width: 100%;
    overflow-x: hidden;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 12px;
    flex-wrap: wrap;
}
.page-header h1 { font-size: 24px; font-weight: 700; }

/* ===== HAMBURGER ===== */
.hamburger {
    display: none;
    position: fixed;
    top: 14px; left: 14px;
    z-index: 200;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 18px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    line-height: 1;
}
.hamburger-badge {
    position: absolute;
    top: -5px; right: -5px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ===== CARDS ===== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 8px;
    flex-wrap: wrap;
}
.card-header h2 { font-size: 16px; font-weight: 600; }

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.stats-grid.single {
    grid-template-columns: 1fr !important;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    text-align: center;
}
.stat-card .stat-icon { font-size: 28px; margin-bottom: 4px; }
.stat-card .stat-value { font-size: 32px; font-weight: 700; word-break: break-all; }
.stat-card .stat-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.stat-card.positive .stat-value { color: var(--success); }
.stat-card.negative .stat-value { color: var(--danger); }
.stat-card.primary .stat-value { color: var(--primary); }

/* ===== POINTS BADGE ===== */
.points-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}
.points-badge.positive { background: var(--success-bg); color: #16a34a; }
.points-badge.negative { background: var(--danger-bg); color: #dc2626; }
.points-badge.reward { background: var(--danger-bg); color: #dc2626; }
.points-badge.neutral { background: #f1f5f9; color: var(--text-secondary); }

/* ===== EVENT LIST ===== */
.event-list { display: flex; flex-direction: column; gap: 8px; }

.event-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    transition: transform var(--transition);
}
.event-item:hover { transform: translateX(2px); }

.event-icon {
    font-size: 22px;
    width: 42px; height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card);
    border-radius: 50%;
    box-shadow: var(--shadow);
    flex-shrink: 0;
}

.event-info { flex: 1; min-width: 0; }
.event-info .title { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-info .meta { font-size: 11px; color: var(--text-secondary); }
.event-info .comment { font-size: 11px; color: var(--text-secondary); font-style: italic; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-actions { flex-shrink: 0; display: flex; gap: 4px; }

/* ===== REWARD CARDS ===== */
.reward-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.reward-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 8px;
    text-align: center;
    transition: all var(--transition);
}
.reward-card:hover { border-color: var(--primary-light); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.reward-card .r-icon { font-size: 28px; margin-bottom: 4px; }
.reward-card .r-title { font-weight: 600; font-size: 12px; margin-bottom: 2px; }
.reward-card .r-desc { font-size: 10px; color: var(--text-secondary); margin-bottom: 4px; min-height: 0; }
.reward-card .r-cost { font-size: 14px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.reward-card.unaffordable { opacity: .6; }

/* ===== PROGRESS BAR ===== */
.progress-section { margin-bottom: 16px; }
.progress-bar-wrap {
    height: 12px;
    background: var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #8b5cf6);
    border-radius: 6px;
    transition: width .6s ease;
}
.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== TIMELINE ===== */
.timeline {
    position: relative;
    padding-left: 32px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--border);
    border-radius: 2px;
}

.timeline-date {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 16px 0 8px;
    letter-spacing: 0.5px;
}
.timeline-date:first-child {
    padding-top: 0;
}

.timeline-item {
    position: relative;
    padding: 6px 0;
}

.timeline-dot {
    position: absolute;
    left: -26px;
    top: 14px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid var(--card);
    box-shadow: 0 0 0 2px var(--primary);
    z-index: 1;
}
.timeline-dot.negative {
    background: var(--danger);
    box-shadow: 0 0 0 2px var(--danger);
}
.timeline-dot.positive {
    background: var(--success);
    box-shadow: 0 0 0 2px var(--success);
}
.timeline-dot.reward {
    background: var(--reward);
    box-shadow: 0 0 0 2px var(--reward);
}
.timeline-dot.streak-bonus {
    background: var(--warning);
    box-shadow: 0 0 0 2px var(--warning);
}

.timeline-card {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    border-left: 3px solid var(--primary);
    transition: transform var(--transition);
}
.timeline-card:hover {
    transform: translateX(3px);
}
.timeline-card.negative {
    border-left-color: var(--danger);
    background: #fef8f8;
}
.timeline-card.positive {
    border-left-color: var(--success);
    background: #f5fef8;
}
.timeline-card.reward {
    border-left-color: var(--reward);
    background: #faf8ff;
}
.timeline-card.streak-bonus {
    border-left-color: var(--warning);
    background: #fffdf5;
}
.timeline-card .desc {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}
.timeline-card .meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 3px;
}
.timeline-card .amount {
    margin-top: 6px;
}
.timeline-card .amount .timeline-actions {
    display: inline;
    margin-left: 6px;
}
.timeline-card .amount .timeline-actions a {
    display: inline-block;
    font-size: 14px;
    color: #1e293b;
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 4px;
    vertical-align: middle;
    line-height: 1;
}
.timeline-card .amount .timeline-actions a:hover {
    background: #e2e8f0;
}
.timeline-card .amount .timeline-actions a.action-delete:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}
.empty-icon {
    font-size: 48px;
    margin-bottom: 8px;
    opacity: 0.5;
}
.empty-text {
    font-size: 14px;
}

/* ===== REWARD ACTIONS ===== */
.reward-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.reward-cost {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}
.reward-name {
    font-size: 15px;
    font-weight: 600;
    margin: 4px 0 2px;
}
.reward-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}
.reward-card.not-available {
    opacity: 0.5;
    filter: grayscale(0.3);
}

/* ===== TEMPLATE ITEM ===== */
.template-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.template-item:last-child {
    border-bottom: none;
}
.template-item.inactive {
    opacity: 0.5;
}
.template-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #fff;
    flex-shrink: 0;
}
.template-item-body {
    flex: 1;
    min-width: 0;
}
.template-item-name {
    font-weight: 600;
    font-size: 13px;
}
.template-item-desc {
    font-size: 11px;
    color: var(--text-secondary);
}
.template-item-points {
    font-weight: 700;
    font-size: 14px;
    color: var(--success);
    white-space: nowrap;
}
.template-item-points.minus {
    color: var(--danger);
}
.template-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

/* ===== FAMILY CODE DISPLAY ===== */
.family-code-display {
    text-align: center;
    padding: 16px;
    background: var(--primary-bg);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

/* ===== TABLE ===== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--bg); font-weight: 600; color: var(--text-secondary); text-transform: uppercase; font-size: 11px; letter-spacing: .5px; }

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}
.modal h2 { margin-bottom: 20px; font-size: 18px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

/* ===== TAB BAR ===== */
.tab-bar { display: flex; gap: 4px; margin-bottom: 16px; }
.tab-bar button {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.tab-bar button.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== CATEGORY SECTION ===== */
.cat-section { margin-bottom: 8px; }
.cat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.cat-header:hover { background: #e2e8f0; }
.cat-header .arrow { transition: transform var(--transition); font-size: 12px; }
.cat-header.open .arrow { transform: rotate(90deg); }
.cat-header h3 { font-size: 15px; flex: 1; }
.cat-body { display: none; padding: 10px 0 0; }
.cat-body.open { display: block; }

.event-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
@media (min-width: 480px) {
    .event-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .reward-grid { grid-template-columns: repeat(2, 1fr); }
}

.ach-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}
.ach-btn:hover { border-color: var(--primary); background: var(--primary-bg); }
.ach-btn.selected { border-color: var(--primary); background: var(--primary-bg); box-shadow: 0 0 0 3px rgba(99,102,241,.2); }
.ach-btn .pts { font-size: 18px; font-weight: 700; }
.ach-btn .pts.positive { color: var(--success); }
.ach-btn .pts.negative { color: var(--danger); }
.ach-btn .desc { font-size: 12px; color: var(--text-secondary); }

/* ===== CHILD SELECTOR ===== */
.child-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.child-grid.single { grid-template-columns: 1fr !important; }
.child-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 10px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--card);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}
.child-card:hover { border-color: var(--primary-light); background: var(--primary-bg); }
.child-card.selected { border-color: var(--primary); background: var(--primary-bg); box-shadow: 0 0 0 3px rgba(99,102,241,.2); }
.child-card .c-icon { font-size: 28px; }
.child-card .c-name { font-weight: 600; font-size: 14px; }

/* ===== STATUS BADGE ===== */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.status-pending { background: var(--warning-bg); color: #92400e; }
.status-approved { background: var(--success-bg); color: #16a34a; }
.status-rejected { background: var(--danger-bg); color: #dc2626; }

/* ===== BALANCE BANNER ===== */
.balance-banner {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
}
.balance-banner.positive { background: linear-gradient(135deg, #16a34a, #22c55e); }
.balance-banner.negative { background: linear-gradient(135deg, #dc2626, #ef4444); }
.balance-banner .value { font-size: 36px; font-weight: 700; }
.balance-banner .label { font-size: 13px; opacity: .8; }

/* ===== IMPERSONATION BAR ===== */
.impersonate-bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.impersonate-bar strong { font-size: 14px; }
@media (max-width: 768px) {
    .impersonate-bar { flex-direction: column; text-align: center; padding: 8px 12px; }
    .main { margin-top: 50px; }
}

/* ===== FAMILY CODE BOX ===== */
.family-code {
    background: var(--primary-bg);
    padding: 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
}
.family-code strong { font-size: 16px; color: var(--primary); letter-spacing: 2px; }

/* ===== FAMILY ROW ===== */
.family-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    transition: background var(--transition);
    text-decoration: none;
    color: inherit;
}
.family-row:hover { background: #e2e8f0; }
.family-row-icon {
    font-size: 24px;
    width: 44px; height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-bg);
    border-radius: 50%;
    flex-shrink: 0;
}
.family-row-info { flex: 1; min-width: 0; }
.family-row-name { font-weight: 600; font-size: 14px; }
.family-row-meta { font-size: 12px; color: var(--text-secondary); }
.family-row-date { font-size: 11px; color: var(--text-secondary); flex-shrink: 0; }

/* ===== USERS LIST ===== */
.users-list { display: flex; flex-direction: column; gap: 6px; }

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--card);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    transition: transform var(--transition);
}
.user-item:hover { transform: translateX(2px); }

.user-item-avatar {
    width: 42px; height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
}
.user-item-avatar.admin { background: linear-gradient(135deg, #ef4444, #dc2626); }
.user-item-avatar.parent { background: linear-gradient(135deg, #6366f1, #4f46e5); }
.user-item-avatar.child { background: linear-gradient(135deg, #22c55e, #16a34a); }

.user-item-body { flex: 1; min-width: 0; }
.user-item-name { font-weight: 600; font-size: 14px; }
.user-item-meta { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-active { background: rgba(34, 197, 94, 0.08) !important; }
.user-blocked { background: rgba(239, 68, 68, 0.08) !important; }

.user-item-actions { flex-shrink: 0; display: flex; gap: 4px; align-items: center; }
.user-item-actions .btn,
.user-item-actions a.btn { min-width: 34px; min-height: 34px; padding: 7px 8px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }

/* ===== SCROLL LOADER ===== */
.scroll-loader { text-align: center; padding: 20px; }
.spinner {
    width: 24px; height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.card, .stat-card, .event-item, .reward-card { animation: fadeIn .3s ease; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

/* ===== MOBILE 768px ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: 280px; }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .hamburger { display: block; }
    .main { margin-left: 0; padding: 16px; }
    .page-header { padding-left: 60px; flex-direction: column; align-items: stretch; margin-bottom: 16px; }
    .page-header h1 { font-size: 20px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 12px 8px; cursor: pointer; }
    .stat-card:hover { opacity: 0.85; }
    .stat-card .stat-icon { font-size: 24px; }
    .stat-card .stat-value { font-size: 24px; }
    .card { padding: 16px; border-radius: 12px; }
    .form-row { grid-template-columns: 1fr; }
    th, td { padding: 8px 10px; font-size: 12px; }
    .btn-sm { padding: 6px 10px; font-size: 12px; }
    .balance-banner .value { font-size: 28px; }
    .modal { padding: 20px; border-radius: 12px; }
    .modal-actions { flex-direction: column; }
    .modal-actions .btn { width: 100%; }
}

/* ===== SMALL 480px ===== */
@media (max-width: 480px) {
    .main { padding: 12px; }
    .page-header { padding-left: 52px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 12px 8px; cursor: pointer; }
    .stat-card:hover { opacity: 0.85; }
    .stat-card .stat-icon { font-size: 22px; }
    .stat-card .stat-value { font-size: 20px; }
    .page-header h1 { font-size: 18px; }
    .auth-card { padding: 24px 18px; }
    .auth-card h1 { font-size: 22px; }
    .card-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .card-header .btn { width: 100%; }
    .event-item { padding: 10px 8px; }
}
