/* ============================================================
   UPPDRAGET — Design System & Responsive Styles
   Mobile-first • 3 breakpoints • Zero inline styles
   ============================================================ */

/* --- CSS Custom Properties / Design Tokens --- */
:root {
    /* Colors — Primary palette */
    --color-primary: #4CAF50;
    --color-primary-dark: #388E3C;
    --color-primary-light: #C8E6C9;
    --color-secondary: #2196F3;
    --color-secondary-dark: #1976D2;
    --color-secondary-light: #BBDEFB;
    --color-danger: #f44336;
    --color-danger-dark: #d32f2f;
    --color-danger-light: #FFCDD2;
    --color-warning: #ff9800;
    --color-warning-dark: #f57c00;
    --color-warning-light: #FFE0B2;
    --color-success: #4CAF50;

    /* Neutrals */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #eeeeee;
    --gray-300: #e0e0e0;
    --gray-400: #bdbdbd;
    --gray-500: #9e9e9e;
    --gray-600: #757575;
    --gray-700: #616161;
    --gray-800: #424242;
    --gray-900: #212121;

    /* Semantic surfaces */
    --color-bg: var(--gray-100);
    --color-surface: #ffffff;
    --color-surface-raised: #ffffff;
    --color-surface-overlay: rgba(0, 0, 0, 0.5);
    --color-text: var(--gray-900);
    --color-text-secondary: var(--gray-600);
    --color-text-muted: var(--gray-500);
    --color-border: var(--gray-300);

    /* Spacing scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-lg: 1.125rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --line-height: 1.5;

    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --shadow-xl: 0 8px 32px rgba(0,0,0,0.16);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;

    /* Z-index layers */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-sidebar: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-toast: 600;
    --z-bottom-nav: 250;

    /* Layout */
    --sidebar-width: 240px;
    --sidebar-collapsed: 60px;
    --header-height: 64px;
    --bottom-nav-height: 64px;
    --content-max-width: 960px;
}

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

/* --- Base --- */
html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: var(--line-height);
    min-height: 100dvh;
    overflow-x: hidden;
    padding-bottom: calc(var(--bottom-nav-height) + var(--space-md));
}

a { color: var(--color-secondary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* --- Utility Classes --- */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-muted { color: var(--color-text-muted) !important; }
.text-secondary { color: var(--color-text-secondary) !important; }
.text-bold { font-weight: 600; }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }
.text-2xl { font-size: var(--text-2xl); }
.bg-warning-light { background: var(--color-warning-light) !important; }
.bg-success-light { background: var(--color-primary-light) !important; }
.bg-danger-light { background: var(--color-danger-light) !important; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.ml-3 { margin-left: 1.5rem; }
.w-full { width: 100%; }

/* --- App Layout --- */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

/* --- Page Header (top bar) --- */
.page-header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    background: var(--color-primary);
    color: #fff;
    padding: var(--space-sm) var(--space-md);
    min-height: var(--header-height);
    box-shadow: var(--shadow-md);
}

.page-header__title {
    font-size: var(--text-lg);
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.page-header__logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.page-header__logo img {
    height: 44px;
    width: auto;
}

.page-header__right {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-shrink: 0;
}

.page-header__user {
    font-size: var(--text-sm);
    opacity: 0.9;
}

.page-header__balance {
    font-weight: 700;
    background: rgba(255,255,255,0.2);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    white-space: nowrap;
}

.page-header__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}
.page-header__btn:hover { background: rgba(255,255,255,0.25); text-decoration: none; }

.notification-bell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    cursor: pointer;
    padding: var(--space-xs);
}
.notification-bell__badge {
    position: absolute;
    top: -2px;
    right: -4px;
    background: var(--color-danger);
    color: #fff;
    border-radius: var(--radius-full);
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0 4px;
}

/* --- Sidebar Navigation (desktop/tablet) --- */
.sidebar-nav {
    display: none;
}

/* --- Bottom Tab Bar (mobile — default) --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-bottom-nav);
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    height: var(--bottom-nav-height);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 2px;
    padding: var(--space-xs) 0;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: var(--text-xs);
    transition: color var(--transition-fast);
    cursor: pointer;
    border: none;
    background: none;
    -webkit-tap-highlight-color: transparent;
}
.bottom-nav__item:hover,
.bottom-nav__item.active {
    color: var(--color-primary);
    text-decoration: none;
}
.bottom-nav__icon {
    font-size: 1.35rem;
    line-height: 1;
}
.bottom-nav__label {
    font-size: var(--text-xs);
    line-height: 1;
    font-weight: 500;
}

/* --- Bottom Sheet (mobile "more" menu) --- */
.bottom-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: var(--color-surface-overlay);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}
.bottom-sheet-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: var(--z-modal);
    background: var(--color-surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-md) var(--space-md) calc(var(--space-lg) + env(safe-area-inset-bottom, 0));
    transform: translateY(100%);
    transition: transform var(--transition-normal);
    max-height: 70vh;
    overflow-y: auto;
}
.bottom-sheet.active {
    transform: translateY(0);
}
.bottom-sheet__handle {
    width: 36px;
    height: 4px;
    background: var(--gray-300);
    border-radius: var(--radius-full);
    margin: 0 auto var(--space-md);
}
.bottom-sheet__item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    color: var(--color-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    transition: background var(--transition-fast);
}
.bottom-sheet__item:hover { background: var(--gray-100); text-decoration: none; }
.bottom-sheet__item.active { color: var(--color-primary); font-weight: 600; }
.bottom-sheet__icon { font-size: 1.25rem; width: 1.5rem; text-align: center; }

/* --- Main Content Area --- */
.main-content {
    flex: 1;
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: var(--space-md);
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}
.content-header h2 {
    font-size: var(--text-xl);
    font-weight: 700;
    margin: 0;
}

/* --- Cards --- */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}
.card--bordered { border: 1px solid var(--color-border); box-shadow: none; }
.card--warning { border-left: 4px solid var(--color-warning); background: #fffbf0; }
.card--success { border-left: 4px solid var(--color-success); background: #f0faf0; }
.card--danger { border-left: 4px solid var(--color-danger); background: #fef0ef; }
.card--nested { border: 1px solid var(--color-border); box-shadow: none; padding: var(--space-sm); border-radius: var(--radius-sm); }
.card--edit { background: var(--color-bg); padding: var(--space-md); border-radius: var(--radius-sm); }
.card__title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

/* --- Stat Cards (dashboard) --- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    text-align: center;
}
.stat-card__value {
    font-size: var(--text-2xl);
    font-weight: 800;
    line-height: 1.2;
}
.stat-card__label {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    margin-top: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* --- Action Cards (pending approvals) --- */
.action-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.action-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    border-left: 4px solid var(--color-warning);
}
.action-card--task { border-left-color: var(--color-success); }
.action-card__info { flex: 1; min-width: 0; }
.action-card__title { font-weight: 600; margin-bottom: 2px; }
.action-card__meta { font-size: var(--text-sm); color: var(--color-text-secondary); }
.action-card__amount { font-weight: 700; white-space: nowrap; margin-right: var(--space-sm); }
.action-card__actions {
    display: flex;
    gap: var(--space-xs);
    flex-shrink: 0;
}

/* --- Task Cards (child view) --- */
.tasks-grid { display: flex; flex-direction: column; gap: var(--space-sm); }

.task-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    transition: box-shadow var(--transition-fast);
}
.task-card:hover { box-shadow: var(--shadow-md); }
.task-card--clickable { cursor: pointer; }
.task-card--completed { opacity: 0.55; }
.task-card--overdue { border-left: 4px solid var(--color-danger); }
.task-card--mandatory { border-top: 3px solid var(--color-warning); }

.task-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}
.task-card__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}
.task-card__title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin: 0;
}
.task-card__reward {
    font-weight: 700;
    white-space: nowrap;
    color: var(--color-success);
    font-size: var(--text-lg);
}
.task-card__desc {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    margin-bottom: var(--space-xs);
    margin-top: 0;
}
.task-card__assigned {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-sm) 0;
}
.task-card__type {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    white-space: nowrap;
}
.task-card__deadline {
    font-size: var(--text-sm);
    margin-bottom: var(--space-sm);
}
.task-card__notice {
    font-size: var(--text-sm);
    padding: var(--space-sm);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
}
.task-card__notice--warning { background: var(--color-warning-light); color: var(--color-warning-dark); }
.task-card__notice--danger { background: var(--color-danger-light); color: var(--color-danger-dark); }
.task-card__notice--info { background: var(--color-secondary-light); color: var(--color-secondary-dark); }

.task-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-sm);
}
.task-card__actions {
    display: flex;
    gap: var(--space-xs);
    align-items: center;
    flex-shrink: 0;
}
.task-card__details {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-md);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}
.task-card__detail {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.task-card__detail strong {
    color: var(--color-text);
}

/* --- Chips / Badges --- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px var(--space-sm);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    background: var(--gray-200);
    color: var(--gray-700);
    white-space: nowrap;
}
.chip--recurring { background: var(--color-secondary-light); color: var(--color-secondary-dark); }
.chip--mandatory { background: var(--color-danger-light); color: var(--color-danger-dark); }
.chip--pending { background: var(--color-warning-light); color: var(--color-warning-dark); }
.chip--success { background: var(--color-primary-light); color: var(--color-primary-dark); }
.chip--active { background: var(--color-primary-light); color: var(--color-primary-dark); }

/* --- Amount display --- */
.amount { font-weight: 700; }
.amount--positive { color: var(--color-success); }
.amount--negative { color: var(--color-danger); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
    -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }

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

.btn--secondary { background: var(--color-secondary); color: #fff; }
.btn--secondary:hover { background: var(--color-secondary-dark); }

.btn--danger { background: var(--color-danger); color: #fff; }
.btn--danger:hover { background: var(--color-danger-dark); }

.btn--warning { background: var(--color-warning); color: #fff; }
.btn--warning:hover { background: var(--color-warning-dark); }

.btn--ghost {
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}
.btn--ghost:hover { background: var(--gray-100); }

.btn--sm { padding: var(--space-xs) var(--space-sm); font-size: var(--text-xs); }
.btn--lg { padding: var(--space-md) var(--space-lg); font-size: var(--text-base); }
.btn--block { width: 100%; }
.btn--icon { padding: var(--space-sm); min-width: 36px; }

.btn-group {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

/* --- Forms --- */
.form-group {
    margin-bottom: var(--space-md);
}
.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-xs);
    font-size: var(--text-sm);
}
.form-group .help-text {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: var(--space-xs);
}

.form-input,
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition-fast);
}
.form-input:focus,
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
}
.form-group textarea { resize: vertical; min-height: 80px; }

.form-group.checkbox label,
.form-checkbox {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: normal;
    cursor: pointer;
}
.form-group.checkbox input[type="checkbox"],
.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    flex-shrink: 0;
}

.form-grid {
    display: grid;
    gap: var(--space-md);
}
.form-grid--2col { grid-template-columns: 1fr; }
.form-grid--3col { grid-template-columns: 1fr; }
.form-grid--2 { display: grid; grid-template-columns: 1fr; gap: var(--space-md); }
.form-grid--3 { display: grid; grid-template-columns: 1fr; gap: var(--space-md); }

.checkbox-label { font-weight: normal; display: block; margin-bottom: 0.3rem; }

.inline-edit-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}
.inline-edit-form input { flex: 1; min-width: 120px; }

.edit-row td {
    padding: var(--space-md) !important;
    background: var(--color-bg);
}

.form-section {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    background: var(--gray-50);
}
.form-section__title {
    font-weight: 600;
    margin-bottom: var(--space-sm);
    font-size: var(--text-sm);
}
.form-section--collapsible .form-section__body {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height var(--transition-normal), opacity var(--transition-normal), padding var(--transition-normal);
    padding-top: 0;
}
.form-section--collapsible.open .form-section__body {
    max-height: 600px;
    opacity: 1;
    padding-top: var(--space-md);
}

/* Day-of-week checkboxes */
.day-selector {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
}
.day-selector__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-border);
    background: var(--color-surface);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}
.day-selector__btn:hover { border-color: var(--color-primary); }
.day-selector__btn input { display: none; }
.day-selector__btn.selected {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}

/* --- Data Tables --- */
.data-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}
.data-table thead { background: var(--gray-50); }
.data-table th,
.data-table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.data-table th {
    font-weight: 600;
    white-space: nowrap;
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table tbody tr.row--warning { background: var(--color-warning-light); }
.data-table tbody tr.row--muted { opacity: 0.6; background: var(--gray-50); }

/* --- Rewards Grid (child view) --- */
.rewards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-md);
}
.reward-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--transition-fast);
    overflow: hidden;
}
.reward-card:hover { box-shadow: var(--shadow-md); }
.reward-card--unavailable { opacity: 0.55; }
.reward-card__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-md) 0;
}
.reward-card__title {
    font-size: var(--text-lg);
    font-weight: 600;
    margin: 0;
    min-width: 0;
}
.reward-card__cost {
    font-size: var(--text-lg);
    color: var(--color-primary);
    font-weight: 800;
    white-space: nowrap;
    flex-shrink: 0;
}
.reward-card__desc {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    margin: 0;
    padding: var(--space-xs) var(--space-md) 0;
    line-height: 1.4;
}
.reward-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md) 0;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}
.reward-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md) var(--space-md);
    margin-top: auto;
}
.reward-card__footer-left { flex: 1; min-width: 0; }
.reward-card__footer-right { flex-shrink: 0; }

/* --- Balance Hero (child dashboard) --- */
.balance-hero {
    text-align: center;
    padding: var(--space-lg) var(--space-md);
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
}
.balance-hero__amount {
    font-size: var(--text-3xl);
    font-weight: 800;
    line-height: 1;
    margin-bottom: var(--space-xs);
}
.balance-hero__label {
    font-size: var(--text-sm);
    opacity: 0.85;
}

/* --- Children Summary (parent dashboard) --- */
.children-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}
.child-avatar-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    text-decoration: none;
    color: var(--color-text);
    padding: var(--space-sm);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}
.child-avatar-card:hover { background: var(--gray-100); text-decoration: none; }
.child-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-lg);
    object-fit: cover;
}
.child-avatar-card__name {
    font-size: var(--text-sm);
    font-weight: 500;
}
.child-avatar-card__balance {
    font-size: var(--text-xs);
    font-weight: 700;
}

/* --- Emoji Icon Input --- */
.emoji-input {
    width: 3.5rem;
    font-size: var(--text-xl);
    text-align: center;
    padding: var(--space-sm);
}
.form-row {
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}
.form-row > .form-group { flex: 1; min-width: 0; }
.task-card__icon { font-size: 1.15em; }

/* --- Family Card Icon --- */
.family-card__icon {
    font-size: var(--text-2xl);
    line-height: 1;
    flex-shrink: 0;
}

/* --- User Avatars --- */
.user-card__header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: cover;
    flex-shrink: 0;
}
.user-avatar--initials {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    font-weight: 700;
    font-size: var(--text-lg);
}
.user-avatar--lg {
    width: 64px;
    height: 64px;
    font-size: var(--text-2xl);
}
.avatar-upload-section {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--color-border);
}
.avatar-upload-preview { flex-shrink: 0; }

/* --- Activity Timeline (recent transactions) --- */
.timeline { display: flex; flex-direction: column; gap: var(--space-xs); }
.timeline__item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border-radius: var(--radius-md);
}
.timeline__icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    flex-shrink: 0;
    background: var(--gray-100);
}
.timeline__body { flex: 1; min-width: 0; }
.timeline__desc { font-size: var(--text-sm); }
.timeline__meta { font-size: var(--text-xs); color: var(--color-text-muted); }
.timeline__amount { font-weight: 700; font-size: var(--text-sm); white-space: nowrap; }

/* --- Simple Task List (child overview) --- */
.task-list-simple {
    display: flex;
    flex-direction: column;
}
.task-list-simple__item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-border);
}
.task-list-simple__item:last-child { border-bottom: none; }
.task-list-simple__item--completed { opacity: 0.45; }
.task-list-simple__item--overdue .task-list-simple__title { color: var(--color-danger); }
.task-list-simple__icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}
.task-list-simple__title {
    flex: 1;
    font-size: var(--text-sm);
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.task-list-simple__reward {
    font-size: var(--text-sm);
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    color: var(--color-primary);
}

/* --- Child History Timeline --- */
.child-history {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}
.child-history__day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-xs);
    border-bottom: 2px solid var(--color-border);
    margin-bottom: var(--space-sm);
}
.child-history__day-label {
    font-weight: 700;
    font-size: var(--text-base);
}
.child-history__day-total {
    font-weight: 700;
    font-size: var(--text-sm);
}
.child-history__items {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: var(--space-xs);
}
.child-history__item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    position: relative;
    flex-wrap: nowrap;
}
.child-history__time {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    width: 38px;
    flex-shrink: 0;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.child-history__dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--color-border);
    flex-shrink: 0;
    position: relative;
}
.child-history__item:not(:last-child) .child-history__dot::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: calc(100% + var(--space-sm) + 2px);
    background: var(--color-border);
}
.child-history__item .amount--positive + .child-history__dot,
.child-history__item:has(.amount--positive) .child-history__dot {
    background: var(--color-primary);
}
.child-history__item:has(.amount--negative) .child-history__dot {
    background: var(--color-danger);
}
.child-history__desc {
    flex: 1;
    font-size: var(--text-sm);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.child-history__amount {
    font-weight: 700;
    font-size: var(--text-sm);
    white-space: nowrap;
    flex-shrink: 0;
}
.child-history__actions {
    display: flex;
    gap: 0;
    flex-shrink: 0;
    align-items: center;
}
.child-history__actions form {
    margin: 0;
    padding: 0;
    display: inline-flex;
}
.child-history__action-btn {
    padding: 2px 4px !important;
    font-size: var(--text-xs) !important;
    opacity: 0.5;
    transition: opacity 0.15s;
    min-width: 0;
    line-height: 1;
}
.child-history__action-btn:hover,
.child-history__action-btn:focus {
    opacity: 1;
}
@media (pointer: coarse) {
    .child-history__action-btn {
        opacity: 0.7;
    }
}
/* --- Messages --- */
.alert {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    font-size: var(--text-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.alert--error { background: var(--color-danger-light); color: var(--color-danger-dark); }
.alert--success { background: var(--color-primary-light); color: var(--color-primary-dark); }
.alert--warning { background: var(--color-warning-light); color: var(--color-warning-dark); }
.alert--info { background: var(--color-secondary-light); color: var(--color-secondary-dark); }

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-md);
    color: var(--color-text-muted);
}
.empty-state__icon { font-size: 3rem; margin-bottom: var(--space-sm); }
.empty-state__text { font-size: var(--text-base); }
.empty-state__action { margin-top: var(--space-md); }

/* --- Password Strength --- */
.password-strength { margin-top: var(--space-xs); }
.password-strength__bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.password-strength__fill {
    height: 100%;
    width: 0;
    border-radius: var(--radius-full);
    transition: width 0.3s, background 0.3s;
}
.password-strength__label {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    margin-top: 2px;
    display: block;
}

/* --- Modal --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--color-surface-overlay);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
}
.modal-backdrop.active { opacity: 1; pointer-events: auto; }

.modal {
    position: fixed;
    z-index: var(--z-modal);
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--space-lg);
    transition: transform var(--transition-normal), opacity var(--transition-normal);
    opacity: 0;
    pointer-events: none;
    width: calc(100% - var(--space-lg));
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
}
.modal.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}
.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}
.modal__title { font-size: var(--text-lg); font-weight: 700; }
.modal__close {
    background: none;
    border: none;
    font-size: var(--text-xl);
    cursor: pointer;
    color: var(--color-text-muted);
    padding: var(--space-xs);
}
.modal__close:hover { color: var(--color-text); }
.modal__body { padding: var(--space-sm) 0; }
.modal__footer { display: flex; justify-content: flex-end; gap: var(--space-sm); padding-top: var(--space-md); }

/* --- Toast (notification popup) --- */
.toast {
    position: fixed;
    top: calc(var(--header-height) + var(--space-sm));
    right: var(--space-md);
    z-index: var(--z-toast);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: var(--space-md);
    max-width: 340px;
    transform: translateX(calc(100% + var(--space-md)));
    transition: transform var(--transition-normal);
}
.toast.active { transform: translateX(0); }
.toast--success { border-left: 4px solid var(--color-success); }
.toast--error { border-left: 4px solid var(--color-danger); }
.toast--info { border-left: 4px solid var(--color-primary); }


/* --- Login Page --- */
.login-container {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-bg) 50%);
}
.login-box {
    background: var(--color-surface);
    padding: var(--space-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}
.login-box__logo {
    text-align: center;
    margin-bottom: var(--space-sm);
}
.login-box__logo img {
    width: 100%;
    height: auto;
}
.login-box h2 {
    text-align: center;
    margin-bottom: var(--space-lg);
    color: var(--color-text-secondary);
    font-size: var(--text-base);
    font-weight: 400;
}
.login-box .btn { width: 100%; margin-top: var(--space-sm); }
.login-box__footer {
    text-align: center;
    margin-top: var(--space-lg);
    font-size: var(--text-sm);
}

/* --- Tags --- */
.tags-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.tag-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    overflow: hidden;
}
.tag-link {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}
.tag-link input {
    width: 100%;
    min-width: 0;
    padding: var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-family: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Notifications List --- */
.notification-list { display: flex; flex-direction: column; gap: var(--space-xs); }
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}
.notification-item--unread { background: var(--color-secondary-light); border-color: var(--color-secondary); }

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
    align-items: end;
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }
.filter-bar .form-group select {
    padding: var(--space-sm);
    font-size: var(--text-sm);
}

/* --- Section Divider --- */
.section-title {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
    margin-top: var(--space-lg);
}
.section-title:first-child { margin-top: 0; }

/* ============================================================
   TABLET BREAKPOINT (>=576px)
   ============================================================ */
@media (min-width: 576px) {
    body {
        padding-bottom: var(--space-md);
    }

    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .form-grid--2col { grid-template-columns: 1fr 1fr; }
    .form-grid--3col { grid-template-columns: 1fr 1fr 1fr; }
    .form-grid--2 { grid-template-columns: 1fr 1fr; }
    .form-grid--3 { grid-template-columns: 1fr 1fr 1fr; }

    .rewards-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }

    .data-table th,
    .data-table td {
        padding: var(--space-sm) var(--space-md);
    }

    .action-card__actions {
        flex-direction: row;
    }

    .main-content {
        padding: var(--space-lg);
    }
}

/* ============================================================
   TABLET/SMALL DESKTOP — Sidebar appears (>=768px)
   ============================================================ */
@media (min-width: 768px) {
    body {
        padding-bottom: 0;
    }

    .bottom-nav,
    .bottom-sheet-backdrop,
    .bottom-sheet { display: none; }

    .sidebar-nav {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: var(--header-height);
        left: 0;
        bottom: 0;
        width: var(--sidebar-collapsed);
        background: var(--color-surface);
        border-right: 1px solid var(--color-border);
        z-index: var(--z-sidebar);
        overflow: hidden;
        transition: width var(--transition-normal);
        padding-top: var(--space-sm);
    }
    .sidebar-nav:hover { width: var(--sidebar-width); }

    .sidebar-nav__item {
        display: flex;
        align-items: center;
        gap: var(--space-md);
        padding: var(--space-sm) var(--space-md);
        color: var(--color-text-secondary);
        text-decoration: none;
        white-space: nowrap;
        border-radius: 0 var(--radius-md) var(--radius-md) 0;
        margin-right: var(--space-sm);
        transition: all var(--transition-fast);
        min-height: 44px;
    }
    .sidebar-nav__item:hover {
        background: var(--gray-100);
        color: var(--color-text);
        text-decoration: none;
    }
    .sidebar-nav__item.active {
        background: var(--color-primary-light);
        color: var(--color-primary-dark);
        font-weight: 600;
    }
    .sidebar-nav__icon {
        font-size: 1.25rem;
        width: 28px;
        text-align: center;
        flex-shrink: 0;
    }
    .sidebar-nav__label {
        font-size: var(--text-sm);
        opacity: 0;
        transition: opacity var(--transition-fast);
    }
    .sidebar-nav:hover .sidebar-nav__label {
        opacity: 1;
    }

    .main-content {
        margin-left: var(--sidebar-collapsed);
        transition: margin-left var(--transition-normal);
    }
}

/* ============================================================
   DESKTOP BREAKPOINT (>=992px)
   ============================================================ */
@media (min-width: 992px) {
    .sidebar-nav {
        width: var(--sidebar-width);
    }
    .sidebar-nav__label { opacity: 1; }

    .main-content {
        margin-left: var(--sidebar-width);
        padding: var(--space-xl);
    }

    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .tasks-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
        gap: var(--space-md);
    }
}

/* ============================================================
   MOBILE TABLE -> CARD TRANSFORM (<=575px)
   ============================================================ */
@media (max-width: 575px) {
    .data-table--responsive thead { display: none; }
    .data-table--responsive,
    .data-table--responsive tbody,
    .data-table--responsive tr,
    .data-table--responsive td {
        display: block;
        width: 100%;
    }
    .data-table--responsive tr {
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-md);
        padding: var(--space-sm);
        margin-bottom: var(--space-sm);
    }
    .data-table--responsive td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: var(--space-xs) var(--space-sm);
        border-bottom: none;
    }
    .data-table--responsive td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: var(--text-xs);
        color: var(--color-text-secondary);
        text-transform: uppercase;
        margin-right: var(--space-md);
        flex-shrink: 0;
    }
    .data-table--responsive td:last-child {
        padding-top: var(--space-sm);
        justify-content: flex-end;
    }

    .action-card {
        flex-direction: column;
        align-items: stretch;
    }
    .action-card__actions {
        flex-direction: column;
    }
    .action-card__actions .btn {
        width: 100%;
    }

    .btn-group--responsive {
        flex-direction: column;
    }
    .btn-group--responsive .btn {
        width: 100%;
    }

    .page-header__user { display: none; }

    .filter-bar {
        flex-direction: column;
    }
    .filter-bar .form-group {
        width: 100%;
    }
}

/* --- Export Page --- */
.export-list {
    list-style: none;
    padding: 0;
    margin: var(--space-md) 0;
}
.export-list li {
    padding: var(--space-xs) 0;
    font-size: var(--text-sm);
}

/* --- Backup Page --- */
.backup-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin: var(--space-md) 0;
}
.backup-stat {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}
.backup-stat__label {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.backup-stat__value {
    font-size: var(--text-sm);
    font-weight: 600;
}

/* --- Games Hub --- */
/* --- Game Category Groups (settings page) --- */
.game-category {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.game-category__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.game-category__header:hover { background: var(--gray-100); }
.game-category__title {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}
.game-category__title h3 { margin: 0; font-size: var(--text-lg); }
.game-category__icon { font-size: var(--text-xl); line-height: 1; }
.game-category__arrow { font-size: var(--text-sm); color: var(--gray-500); transition: transform var(--transition-fast); }
.game-category__actions {
    display: flex;
    gap: var(--space-xs);
    padding: 0 var(--space-md) var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}
.game-category__games { padding: var(--space-sm) var(--space-md) var(--space-md); }
.game-category__games .card { box-shadow: none; border: 1px solid var(--color-border); }
.game-category__games .card h4 { margin: 0 0 var(--space-xs); }

.games-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}
.game-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
}
.game-card--disabled {
    opacity: 0.5;
}
.game-card__icon {
    font-size: 2.5rem;
    flex-shrink: 0;
    width: 3.5rem;
    text-align: center;
}
.game-card__info {
    flex: 1;
    min-width: 0;
}
.game-card__title {
    font-size: var(--text-base);
    font-weight: 600;
    margin: 0;
}
.game-card__desc {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin: var(--space-xs) 0;
}
.game-card__meta {
    display: flex;
    gap: var(--space-md);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}
.game-card__plays {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--color-primary);
    margin-top: var(--space-xs);
}

/* --- Highscore Section --- */
.highscore-section {
    margin-top: var(--space-xl);
}
.highscore-section__title {
    font-size: var(--text-lg);
    margin: 0 0 var(--space-md);
}
.highscore-total {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
}
.highscore-total__heading {
    font-size: var(--text-base);
    font-weight: 600;
    margin: 0;
}
.highscore-total__desc {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin: var(--space-xs) 0 var(--space-sm);
}
.highscore-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.highscore-list__item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--text-sm);
}
.highscore-list__item:last-child {
    border-bottom: none;
}
.highscore-list__item--me {
    font-weight: 700;
    color: var(--color-primary);
}
.highscore-list__rank {
    width: 2rem;
    text-align: center;
    flex-shrink: 0;
    font-size: var(--text-base);
}
.highscore-list__avatar {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.highscore-list__name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.highscore-list__score {
    font-weight: 600;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}
.highscore-games__heading {
    font-size: var(--text-base);
    font-weight: 600;
    margin: 0 0 var(--space-sm);
}
.highscore-games__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-md);
}
.highscore-game-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--space-md);
}
.highscore-game-card__header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
    font-weight: 600;
    font-size: var(--text-sm);
}
.highscore-game-card__icon {
    font-size: 1.2rem;
}
.highscore-list--compact .highscore-list__item {
    padding: var(--space-xs) 0;
    font-size: var(--text-xs);
}
.highscore-list--compact .highscore-list__rank {
    width: 1.5rem;
    font-size: var(--text-sm);
}

/* --- Game Container --- */
.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-md) 0;
}

/* Game Over Overlay */
.game-over-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.game-over-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    max-width: 320px;
    width: 90%;
    box-shadow: var(--shadow-xl);
}
.game-over-score {
    font-size: var(--text-xl);
    font-weight: 700;
    margin: var(--space-sm) 0;
}
.game-over-reward {
    font-size: var(--text-lg);
    color: var(--color-primary);
    font-weight: 600;
    margin: var(--space-sm) 0;
}
.game-over-highscore {
    font-size: var(--text-base);
    color: var(--color-warning);
    font-weight: 600;
    margin: var(--space-sm) 0;
}
.game-over-plays {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin: var(--space-sm) 0;
}

/* --- Tic-Tac-Toe --- */
.ttt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}
.ttt__status {
    font-size: var(--text-lg);
    font-weight: 600;
}
.ttt__board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: min(300px, 80vw);
    aspect-ratio: 1;
}
.ttt__cell {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 2.5rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.ttt__cell:hover { background: var(--gray-100); }
.ttt__cell--x { color: var(--color-primary); }
.ttt__cell--o { color: var(--color-danger); }

/* --- Memory --- */
.memory {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
}
.memory__stats {
    display: flex;
    gap: var(--space-lg);
    font-size: var(--text-sm);
    font-weight: 600;
}
.memory__board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    width: min(320px, 85vw);
}
.memory__card {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border);
    background: var(--color-secondary);
    cursor: pointer;
    font-size: 1.8rem;
    position: relative;
    overflow: hidden;
}
.memory__card-back,
.memory__card-front {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s;
}
.memory__card-back {
    opacity: 1;
    color: #fff;
    font-size: 1.4rem;
}
.memory__card-front {
    opacity: 0;
    background: var(--color-surface);
}
.memory__card--flipped .memory__card-back,
.memory__card--matched .memory__card-back { opacity: 0; }
.memory__card--flipped .memory__card-front,
.memory__card--matched .memory__card-front { opacity: 1; }
.memory__card--matched {
    border-color: var(--color-primary);
    cursor: default;
}

/* --- Snake --- */
.snake {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}
.snake__stats {
    display: flex;
    gap: var(--space-lg);
    font-size: var(--text-sm);
    font-weight: 600;
}
.snake canvas {
    border-radius: var(--radius-md);
    display: block;
    touch-action: none;
}
.snake__controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.snake__controls > div {
    display: flex;
    gap: 4px;
}
.snake__btn {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.snake__btn:active { background: var(--gray-200); }
.snake__hint,
.flappy__hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-align: center;
}

/* --- Flappy Bird --- */
.flappy {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}
.flappy__stats {
    display: flex;
    gap: var(--space-lg);
    font-size: var(--text-sm);
    font-weight: 600;
}
.flappy canvas {
    border-radius: var(--radius-md);
    display: block;
    touch-action: none;
    cursor: pointer;
}

/* --- Clock Game --- */
.clock-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}
.clock-game__status {
    font-size: var(--text-sm);
    font-weight: 600;
}
.clock-game__question {
    font-size: var(--text-base);
    font-weight: 600;
}
.clock-game__options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    width: min(280px, 80vw);
}
.clock-game__btn {
    font-size: var(--text-lg) !important;
    padding: var(--space-sm) var(--space-md) !important;
}
.clock-game__feedback {
    font-size: var(--text-base);
    font-weight: 600;
}

/* --- Math Game --- */
.math-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}
.math-game__status {
    font-size: var(--text-sm);
    font-weight: 600;
}
.math-game__timer {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-primary);
}
.math-game__problem {
    font-size: 2rem;
    font-weight: 700;
}
.math-game__options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    width: min(280px, 80vw);
}
.math-game__btn {
    font-size: var(--text-lg) !important;
    padding: var(--space-sm) var(--space-md) !important;
}
.math-game__feedback {
    font-size: var(--text-base);
    font-weight: 600;
}

/* --- Simon Says --- */
.simon-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}
.simon-game__status {
    font-size: var(--text-base);
    font-weight: 600;
}
.simon-game__score {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}
.simon-game__board {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    width: min(240px, 70vw);
}
.simon-game__pad {
    aspect-ratio: 1;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: transform 0.15s, background 0.15s;
}

/* --- Sort Game --- */
.sort-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}
.sort-game__status {
    font-size: var(--text-sm);
    font-weight: 600;
}
.sort-game__instruction {
    font-size: var(--text-base);
    font-weight: 600;
}
.sort-game__direction {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}
.sort-game__picked {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    min-height: 40px;
    justify-content: center;
}
.sort-game__picked-num {
    background: var(--color-primary);
    color: #fff;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: var(--text-sm);
}
.sort-game__numbers {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    justify-content: center;
}
.sort-game__num {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border);
    background: var(--color-surface);
    font-size: var(--text-base);
    font-weight: 700;
    cursor: pointer;
}
.sort-game__num:active { background: var(--gray-200); }
.sort-game__feedback {
    font-size: var(--text-base);
    font-weight: 600;
}

/* --- Word Scramble --- */
.word-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}
.word-game__status {
    font-size: var(--text-sm);
    font-weight: 600;
}
.word-game__instruction {
    font-size: var(--text-base);
    color: var(--color-text-muted);
}
.word-game__answer {
    display: flex;
    gap: 4px;
    min-height: 48px;
    align-items: center;
}
.word-game__answer-letter {
    width: 36px;
    height: 40px;
    background: var(--color-primary);
    color: #fff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-base);
}
.word-game__letters {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    justify-content: center;
}
.word-game__letter {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border);
    background: var(--color-surface);
    font-size: var(--text-lg);
    font-weight: 700;
    cursor: pointer;
}
.word-game__letter:active { background: var(--gray-200); }
.word-game__actions {
    display: flex;
    gap: var(--space-sm);
}
.word-game__feedback {
    font-size: var(--text-base);
    font-weight: 600;
}

/* --- Flag Quiz --- */
.flag-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}
.flag-game__status {
    font-size: var(--text-sm);
    font-weight: 600;
}
.flag-game__flag {
    font-size: 5rem;
}
.flag-game__question {
    font-size: var(--text-base);
    font-weight: 600;
}
.flag-game__options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    width: min(300px, 85vw);
}
.flag-game__btn {
    padding: var(--space-sm) var(--space-md) !important;
}
.flag-game__feedback {
    font-size: var(--text-base);
    font-weight: 600;
}

/* --- 2048 --- */
.game-2048 {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}
.game-2048__score {
    font-size: var(--text-base);
    font-weight: 700;
}
.game-2048__board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    background: #bbada0;
    padding: 6px;
    border-radius: var(--radius-md);
    width: min(300px, 80vw);
}
.game-2048__tile {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.4rem;
    user-select: none;
}
.game-2048__hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}

/* --- Whack-a-Mole --- */
.whack-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}
.whack-game__hud {
    display: flex;
    gap: var(--space-lg);
    font-size: var(--text-sm);
}
.whack-game__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    width: min(280px, 80vw);
}
.whack-game__hole {
    aspect-ratio: 1;
    background: #8B6914;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}
.whack-game__mole {
    font-size: 2.2rem;
    transform: translateY(100%);
    transition: transform 0.15s;
    user-select: none;
}
.whack-game__mole--up {
    transform: translateY(0);
}

/* --- Breakout --- */
.breakout-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}
.breakout-game__score {
    font-size: var(--text-sm);
    font-weight: 600;
}
.breakout-game__hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}
.breakout-game canvas {
    border-radius: var(--radius-md);
    display: block;
    background: #f0f0f0;
    touch-action: none;
}

/* --- Bubble Pop --- */
.bubble-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}
.bubble-game__status {
    font-size: var(--text-sm);
    font-weight: 600;
}
.bubble-game__instruction {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}
.bubble-game__next {
    font-size: var(--text-base);
}
.bubble-game__arena {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    border: 2px solid var(--color-border);
}
.bubble-game__bubble {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    color: #fff;
    font-weight: 700;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: transform 0.3s, opacity 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bubble-game__bubble:active { transform: scale(0.9); }
.bubble-game__feedback {
    font-size: var(--text-base);
    font-weight: 600;
}

/* --- Maze --- */
.maze-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}
.maze-game__status {
    font-size: var(--text-sm);
    font-weight: 600;
}
.maze-game__hint {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}
.maze-game__controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.maze-game__controls > div {
    display: flex;
    gap: 4px;
}

/* --- Reaction Test --- */
.reaction-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
}
.reaction-game__status {
    font-size: var(--text-sm);
    font-weight: 600;
}
.reaction-game__area {
    width: min(300px, 85vw);
    height: 200px;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}
.reaction-game__message {
    font-size: var(--text-lg);
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    text-align: center;
    padding: var(--space-md);
}
.reaction-game__area:not([style*="background"]) .reaction-game__message {
    color: var(--color-text);
    text-shadow: none;
}
.reaction-game__results {
    display: flex;
    gap: var(--space-md);
    font-size: var(--text-sm);
    flex-wrap: wrap;
    justify-content: center;
}
.reaction-game__summary {
    text-align: center;
    font-size: var(--text-base);
    line-height: 1.8;
}

/* --- Color Match --- */
.color-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}
.color-game__status {
    font-size: var(--text-sm);
    font-weight: 600;
}
.color-game__instruction {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    text-align: center;
}
.color-game__word {
    font-size: 3rem;
    font-weight: 900;
}
.color-game__options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    width: min(280px, 80vw);
}
.color-game__btn {
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-sm) var(--space-md);
    color: #fff;
    font-weight: 700;
    font-size: var(--text-base);
    cursor: pointer;
}
.color-game__btn:active { opacity: 0.8; }
.color-game__feedback {
    font-size: var(--text-base);
    font-weight: 600;
}

/* --- Slide Puzzle --- */
.slide-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}
.slide-game__status {
    font-size: var(--text-sm);
    font-weight: 600;
}
.slide-game__tile {
    border: none;
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.slide-game__tile:active { opacity: 0.85; }
.slide-game__tile--empty {
    background: transparent !important;
    cursor: default;
}

/* =============== Achievement Grid & Badges =============== */
.achievement-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}
@media (min-width: 600px) {
    .achievement-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 900px) {
    .achievement-grid { grid-template-columns: repeat(5, 1fr); }
}

.achievement-badge {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    text-align: center;
    transition: opacity var(--transition-fast), filter var(--transition-fast);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.achievement-badge--locked {
    opacity: 0.3;
    filter: grayscale(1);
}
.achievement-badge__icon {
    font-size: var(--text-2xl);
    line-height: 1.2;
}
.achievement-badge__name {
    font-size: var(--text-xs);
    font-weight: 600;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.achievement-badge__stars {
    font-size: var(--text-sm);
    line-height: 1;
    margin-top: 2px;
    min-height: 1.2em;
}
.achievement-badge__meta {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 2px;
}
.achievement-badge__progress {
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    margin-top: var(--space-xs);
    overflow: hidden;
}
.achievement-badge__progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    transition: width var(--transition-normal);
}

/* Achievement detail dialog */
.ach-dialog-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}
.ach-dialog-backdrop.active {
    display: flex;
}
.ach-dialog {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 360px;
    max-height: 80vh;
    overflow-y: auto;
    padding: var(--space-lg);
    position: relative;
}
.ach-dialog__close {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 4px 8px;
}
.ach-dialog__header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}
.ach-dialog__icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}
.ach-dialog__title {
    font-size: var(--text-lg);
    font-weight: 700;
}
.ach-dialog__desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}
.ach-dialog__current {
    font-size: var(--text-sm);
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--color-primary);
}
.ach-dialog__table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}
.ach-dialog__table th {
    text-align: left;
    font-weight: 600;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--color-border);
}
.ach-dialog__table th:last-child {
    text-align: right;
    width: 2em;
}
.ach-dialog__table td {
    padding: 6px 0;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
.ach-dialog__table td:first-child {
    font-variant-numeric: tabular-nums;
}
.ach-dialog__table td:last-child {
    text-align: right;
}
.ach-dialog__table tr:last-child td {
    border-bottom: none;
}
.ach-dialog__row--done {
    color: var(--green-700, #15803d);
}
.ach-dialog__row--done td {
    background: var(--green-50, #f0fdf4);
}
.ach-dialog__row--next {
    font-weight: 600;
    color: var(--blue-700, #1d4ed8);
}
.ach-dialog__row--next td {
    background: var(--blue-50, #eff6ff);
}

/* --- Streak Display --- */
.streak-display {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-warning);
}
.streak-display__label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
}

/* =============== Savings Goal Hero =============== */
.savings-hero {
    background: linear-gradient(135deg, var(--color-secondary), #1976D2);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-md);
}
.savings-hero__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}
.savings-hero__title {
    font-size: var(--text-lg);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}
.savings-hero__amounts {
    font-size: var(--text-sm);
    opacity: 0.9;
    margin-bottom: var(--space-xs);
}
.savings-hero__bar {
    height: 10px;
    background: rgba(255,255,255,0.25);
    border-radius: 5px;
    overflow: hidden;
}
.savings-hero__bar-fill {
    height: 100%;
    background: #fff;
    border-radius: 5px;
    transition: width var(--transition-normal);
}
.savings-hero__percent {
    font-size: var(--text-xs);
    font-weight: 600;
    text-align: right;
    margin-top: 2px;
    opacity: 0.85;
}
.savings-hero__delete {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    font-size: var(--text-xs);
    cursor: pointer;
}
.savings-hero__delete:hover { background: rgba(255,255,255,0.35); }

.savings-goal-prompt {
    text-align: center;
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    background: var(--color-surface);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
}
.savings-goal-prompt:hover {
    border-color: var(--color-secondary);
    background: var(--gray-50);
}
.savings-goal-prompt__icon { font-size: var(--text-2xl); }
.savings-goal-prompt__text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* =============== Leaderboard =============== */
.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.leaderboard-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-border);
}
.leaderboard-item:last-child { border-bottom: none; }
.leaderboard-item__rank {
    font-size: var(--text-lg);
    font-weight: 800;
    min-width: 2em;
    text-align: center;
}
.leaderboard-item__name {
    flex: 1;
    font-weight: 600;
}
.leaderboard-item__stats {
    display: flex;
    gap: var(--space-md);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}
.leaderboard-item__stat {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* --- Period Toggle --- */
.period-toggle {
    display: inline-flex;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    padding: 2px;
    gap: 2px;
}
.period-toggle__btn {
    padding: var(--space-xs) var(--space-md);
    border: none;
    background: transparent;
    border-radius: calc(var(--radius-md) - 2px);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    text-decoration: none;
}
.period-toggle__btn--active,
.period-toggle__btn.active {
    background: var(--color-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* =============== Achievement Settings (config page) =============== */
.achievement-config-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}
.achievement-config-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
}
.achievement-config-card--disabled {
    opacity: 0.5;
}
.achievement-config-card__icon {
    font-size: var(--text-2xl);
    flex-shrink: 0;
}
.achievement-config-card__body { flex: 1; min-width: 0; }
.achievement-config-card__title {
    font-weight: 700;
    font-size: var(--text-base);
}
.achievement-config-card__desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: 2px;
}
.achievement-config-card__thresholds {
    font-size: var(--text-xs);
    color: var(--gray-400);
    margin-top: var(--space-xs);
}
.achievement-config-card__controls {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    margin-top: var(--space-sm);
    flex-wrap: wrap;
}
.achievement-config-card__reward-preview {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}
