/* ==========================================================================
   Design Tokens — single source of truth for the shared visual language.
   Use these variables across every view so all pages stay consistent.
   ========================================================================== */
:root {
    /* The Inner Light palette */
    --til-ink-950: #1a140e;
    --til-ink-900: #2a241e;
    --til-ink-800: #342c24;
    --til-ink-700: #3e352c;
    --til-ink-600: #52483e;
    --til-ink-500: #665c50;
    --til-ink-400: #5c564d;
    --til-ink-300: #7a7368;
    --til-ink-200: #9a9284;
    --til-ink-100: #b8b0a0;
    --til-ink-50: #d6cfbf;

    --til-cream-50: #fffdf8;
    --til-cream-100: #fbf7ef;
    --til-cream-200: #f5f0e6;
    --til-cream-300: #e8e2d5;
    --til-cream-400: #d6cfbf;
    --til-cream-500: #b8b0a0;
    --til-cream-600: #9a9284;

    --til-gold-950: #2a2110;
    --til-gold-900: #463818;
    --til-gold-800: #6b5520;
    --til-gold-700: #8f7328;
    --til-gold-600: #b8942d;
    --til-gold-500: #d4af37;
    --til-gold-400: #dec23e;
    --til-gold-300: #e6cf66;
    --til-gold-200: #ede095;
    --til-gold-100: #f5edc0;
    --til-gold-50: #fbf7e6;

    /* Brand (mapped to gold / ink) */
    --brand-start: var(--til-gold-600);
    --brand-end: var(--til-gold-400);
    --gradient-brand: linear-gradient(135deg, var(--til-gold-700) 0%, var(--til-gold-400) 100%);
    --gradient-primary: linear-gradient(135deg, var(--til-gold-600) 0%, var(--til-gold-400) 100%);
    --gradient-info: linear-gradient(135deg, var(--til-gold-800) 0%, var(--til-gold-600) 100%);

    /* Status — bronze and copper, same warm family as gold */
    --success: #463818;
    --success-border: var(--til-gold-600);
    --success-text: var(--til-gold-300);
    --success-soft: linear-gradient(135deg, rgba(212, 175, 55, 0.16) 0%, var(--til-ink-800) 100%);
    --danger: #5c2e20;
    --danger-strong: #3d1e14;
    --danger-border: #c47a4a;
    --danger-text: #f3d5c4;
    --danger-soft: linear-gradient(135deg, rgba(168, 84, 48, 0.18) 0%, var(--til-ink-800) 100%);
    --warning: var(--til-gold-500);
    --warning-text: var(--til-ink-950);
    --warning-soft: linear-gradient(135deg, rgba(212, 175, 55, 0.12) 0%, var(--til-ink-800) 100%);
    --muted: var(--til-ink-400);
    --muted-soft: linear-gradient(135deg, var(--til-ink-700) 0%, var(--til-ink-800) 100%);

    /* Surfaces & lines */
    --bg: var(--til-ink-900);
    --surface: var(--til-ink-800);
    --surface-elevated: var(--til-ink-700);
    --surface-alt: var(--til-ink-700);
    --border: var(--til-ink-600);
    --border-soft: var(--til-ink-500);

    /* Text */
    --text: var(--til-cream-200);
    --text-body: var(--til-cream-300);
    --text-muted: var(--til-cream-400);
    --heading: var(--til-cream-100);
    --primary: var(--til-gold-500);
    --primary-hover: var(--til-gold-400);
    --on-primary: var(--til-ink-950);

    /* Radii */
    --radius-sm: 4px;
    --radius: 10px;
    --radius-lg: 20px;
    --radius-pill: 25px;

    /* Shadows */
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5);
}

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

html {
    color-scheme: dark;
}

body {
    font-family: 'Nunito', ui-sans-serif, system-ui, sans-serif;
    margin: 0;
    line-height: 1.6;
    color: var(--text);
    padding: 0;
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 15% 20%, rgba(212, 175, 55, 0.16) 0%, transparent 38%),
        radial-gradient(circle at 85% 80%, rgba(245, 240, 230, 0.08) 0%, transparent 42%),
        radial-gradient(circle at 50% 50%, rgba(212, 175, 55, 0.06) 0%, transparent 62%);
    background-attachment: fixed;
    min-height: 100vh;
    font-weight: 400;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

nav {
    background: rgba(42, 36, 30, 0.92);
    backdrop-filter: blur(12px);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border);
}

nav .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    color: var(--til-cream-100);
    font-size: 1.35rem;
    font-weight: 800;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.logo:hover {
    color: var(--primary-hover);
    transform: scale(1.02);
}

.nav-links {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--til-cream-200);
    text-decoration: none;
    font-weight: 600;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-pill);
    transition: all 0.3s ease;
    background: var(--til-ink-700);
    border: 1px solid var(--border);
}

.nav-links a:hover {
    background: var(--til-ink-600);
    color: var(--til-cream-100);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    border-color: var(--til-gold-700);
}

.user-welcome {
    color: var(--til-cream-200);
    padding: 0.45rem 0.9rem;
    background: var(--til-ink-700);
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
}

main {
    padding: 2rem;
    background: var(--surface);
    color: var(--text);
    backdrop-filter: blur(10px);
    margin: 2rem auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

/* Typography System */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    color: var(--heading);
}

h1 {
    font-size: clamp(1.28rem, 3.4vw, 1.87rem);
    font-weight: 800;
    text-align: center;
    margin-top: 1.28rem;
    margin-bottom: 1.28rem;
    color: var(--til-cream-100);
}

@keyframes shimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

h2 {
    font-size: clamp(1.28rem, 3.4vw, 2.13rem);
    color: var(--heading);
    position: relative;
    padding-bottom: 0.43rem;
}

h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--gradient-brand);
    border-radius: 2px;
}

h3 {
    font-size: clamp(1.06rem, 2.55vw, 1.49rem);
    color: var(--heading);
    font-weight: 700;
}

h4 {
    font-size: clamp(0.94rem, 2.13vw, 1.28rem);
    color: var(--heading);
    font-weight: 700;
}

/* Paragraph and text styling */
p {
    margin-bottom: 1rem;
    color: var(--text-body);
    font-size: 1.05rem;
    line-height: 1.7;
}

.text-gradient {
    color: var(--til-gold-400);
}

.text-primary {
    color: var(--til-gold-400);
    font-weight: 600;
}

.text-secondary {
    color: var(--text-body);
    font-size: 0.95rem;
}

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

.text-success {
    color: var(--success-text);
    font-weight: 600;
}

.text-danger {
    color: var(--danger-text);
    font-weight: 600;
}

.text-warning {
    color: var(--til-gold-300);
    font-weight: 600;
}

::selection {
    background-color: var(--til-gold-800);
    color: #ffffff;
}

/* Text utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }

/* Lead text for introductions */
.lead {
    font-size: 1.25rem;
    font-weight: 300;
    color: var(--text-body); /* WCAG AAA contrast */
    line-height: 1.8;
    margin-bottom: 2rem;
    text-align: center;
}

/* Blockquotes */
blockquote {
    border-left: 4px solid var(--til-gold-500);
    margin: 2rem 0;
    font-style: italic;
    color: var(--text-body); /* WCAG AAA contrast */
    background: var(--til-ink-800);
    padding: 1rem 1.5rem;
    border-radius: 0 8px 8px 0;
}

blockquote p {
    margin-bottom: 0;
}

/* Lists */
ul, ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
    color: var(--text-body); /* WCAG AAA contrast */
}

li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Links */
a {
    color: var(--til-gold-400); /* Better contrast - darker blue */
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(135deg, var(--til-gold-500) 0%, var(--til-gold-700) 100%);
    transition: width 0.3s ease;
}

a:hover::after {
    width: 100%;
}

a:hover {
    color: var(--til-gold-800);
    transform: translateY(-1px);
}

/* Code and preformatted text */
code {
    background: var(--til-ink-800);
    color: var(--til-cream-100);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
}

pre {
    background: rgba(44, 62, 80, 0.95);
    color: #ffffff; /* WCAG AAA contrast on dark background */
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

pre code {
    background: none;
    color: inherit;
    padding: 0;
}

/* Highlight and emphasis */
mark {
    background: var(--til-gold-500);
    color: var(--on-primary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}

strong, b {
    color: var(--text); /* WCAG AAA contrast */
    font-weight: 600;
}

em, i {
    color: var(--text-body); /* WCAG AAA contrast */
    font-style: italic;
}

/* Text shadows and effects */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.text-glow {
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.5);
}

.text-outline {
    color: var(--til-gold-400); /* WCAG AAA */
}

/* Enhanced Actions Bar */
.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--til-ink-800);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}


@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.actions-bar .btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    font-size: 0.9rem; /* 10% smaller than default */
}

.actions-bar .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: var(--til-ink-600);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.actions-bar .btn:hover::before {
    width: 300px;
    height: 300px;
}

.actions-bar .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.4);
}

/* Filter dropdown styling */
.filter-select {
    min-width: 200px;
    padding: 0.75rem 1rem !important;
    border: 2px solid rgba(212, 175, 55, 0.2) !important;
    border-radius: 12px !important;
    background: var(--til-ink-700) !important;
    backdrop-filter: blur(10px) !important;
    font-weight: 500 !important;
    color: var(--heading) !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.filter-select:hover {
    border-color: rgba(212, 175, 55, 0.4) !important;
    background: var(--til-ink-700) !important;
    transform: translateY(-1px);
}

.filter-select:focus {
    outline: none !important;
    border-color: var(--til-gold-500) !important;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1) !important;
}

/* Actions bar sections */
.actions-bar-left,
.actions-bar-right {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.actions-bar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Responsive actions bar */
@media (max-width: 768px) {
    .actions-bar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .actions-bar-left,
    .actions-bar-right,
    .actions-bar-center {
        width: 100%;
        justify-content: center;
    }
    
    .filter-select {
        width: 100%;
        min-width: auto;
    }
}

/* Actions bar with search */
.actions-bar.has-search {
    padding: 1.5rem 2rem;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--til-ink-900);
    color: var(--text);
    font-size: 1rem;
}

.search-box input::placeholder {
    color: var(--text-body); /* Better contrast */
    font-style: italic;
}

.search-box input:focus {
    outline: none;
    border-color: var(--til-gold-500);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
    background: var(--til-ink-700);
}

.search-box i {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--text); /* WCAG AAA contrast */
}

/* Actions bar stats */
.actions-bar-stats {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(212, 175, 55, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--til-gold-400); /* Better contrast - darker blue */
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text); /* WCAG AAA contrast */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Actions bar with tabs */
.actions-bar-tabs {
    display: flex;
    gap: 0.5rem;
    background: var(--til-ink-700);
    padding: 0.25rem;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.tab-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: var(--til-ink-700);
    color: var(--til-cream-100);
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    background: var(--til-ink-600);
    color: var(--til-cream-100);
}

.tab-btn.active {
    background: var(--gradient-primary);
    color: var(--on-primary);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

/* Login Page Styling */
.login-container {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    position: relative;
}

.login-container h1 {
    font-size: clamp(1.875rem, 4.5vw, 3rem); /* 25% smaller */
    font-weight: 800;
    margin-bottom: 3rem;
    color: var(--til-gold-400); /* WCAG AAA — solid (was gradient text) */
    text-align: center;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

/* Social Login Section */
.social-login {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.social-login::before {
    content: 'Welcome Back!';
    display: block;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--heading);
    margin-bottom: 2rem;
    background: var(--til-ink-800);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.25);
}

/* Social Login Buttons */
.btn-google,
.btn-facebook {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 60px;
}

.btn-google::before,
.btn-facebook::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.btn-google:hover::before,
.btn-facebook:hover::before {
    left: 100%;
}

/* Google Button */
.btn-google {
    background: var(--til-ink-800);
    color: var(--til-cream-100);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.15);
    border: 2px solid var(--til-gold-700);
}

.btn-google:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(212, 175, 55, 0.35);
    background: var(--til-gold-500);
    color: var(--on-primary);
    border-color: var(--til-gold-400);
}

.btn-google::after {
    content: '🔍';
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

/* Facebook Button */
.btn-facebook {
    background: var(--til-ink-800);
    color: var(--til-cream-100);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.15);
    border: 2px solid var(--til-gold-700);
}

.btn-facebook:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(212, 175, 55, 0.35);
    background: var(--til-gold-500);
    color: var(--on-primary);
    border-color: var(--til-gold-400);
}

.btn-facebook::after {
    content: '📘';
    font-size: 1.5rem;
    margin-right: 0.5rem;
}

/* Alert Styling */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    font-weight: 500;
    text-align: center;
    border: 2px solid;
    position: relative;
    overflow: hidden;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-danger {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger-text);
    box-shadow: 0 4px 15px rgba(168, 84, 48, 0.22);
}

.alert-success {
    background: var(--til-gold-800);
    color: #ffffff;
    border-color: var(--success);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.22);
}

.alert::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.alert-danger::before {
    background: linear-gradient(90deg, #c47a4a, #8a4630, #c47a4a);
    background-size: 200% 100%;
    animation: gradientShift 2s ease-in-out infinite;
}

.alert-success::before {
    background: linear-gradient(90deg, var(--til-gold-600), var(--til-gold-400), var(--til-gold-600));
    background-size: 200% 100%;
    animation: gradientShift 2s ease-in-out infinite;
}

/* Login Background Elements */
.login-container::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 10%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse 4s ease-in-out infinite;
}

.login-container::after {
    content: '';
    position: absolute;
    bottom: 10%;
    right: 10%;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulse 4s ease-in-out infinite 2s;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Divider for login options */
.login-divider {
    display: flex;
    align-items: center;
    margin: 2rem 0;
    gap: 1rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.3), transparent);
}

.login-divider span {
    color: var(--text-body);
    font-weight: 500;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Responsive Login */
@media (max-width: 768px) {
    .login-container {
        padding: 1rem;
        min-height: 70vh;
    }
    
    .social-login {
        max-width: 100%;
    }
    
    .btn-google,
    .btn-facebook {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 55px;
    }
    
    .login-container h1 {
        font-size: clamp(2rem, 8vw, 3rem);
        margin-bottom: 2rem;
    }
}

/* Loading state for login buttons */
.btn-google.loading,
.btn-facebook.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-google.loading::after,
.btn-facebook.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.btn {
    padding: 0.64rem 1.28rem;
    border: none;
    border-radius: 21px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.43rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--on-primary);
    border: 1px solid var(--til-gold-700);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.35);
    background: linear-gradient(135deg, var(--til-gold-500) 0%, var(--til-gold-300) 100%);
    color: var(--on-primary);
}

.btn-secondary {
    background: var(--til-ink-700);
    color: var(--til-cream-200);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--til-ink-600);
    border-color: var(--til-gold-700);
    color: var(--til-cream-100);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(298px, 1fr));
    gap: 1.7rem;
    margin-top: 1.7rem;
}

/* Child Card Status Styles */
.child-card.active {
    border-left: 5px solid var(--success-border);
}

.child-card.inactive {
    border-left: 5px solid var(--til-ink-400);
}


/* Child Card Header */
.child-card .card-header {
    padding: 1rem 1.5rem 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--til-ink-800);
    border-bottom: 1px solid var(--border);
}

.child-card .card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading);
    flex: 1;
}

.child-card .child-status.active {
    background: var(--success);
    color: white;
}

.child-card .child-status.inactive {
    background: #343a40;
    color: white;
}

/* Child Card Body */
.child-card .card-body {
    padding: 1rem 1.5rem;
    text-align: center;
}

.child-card .child-info {
    margin: 1rem 0;
    text-align: left;
}

.child-card .child-info p {
    margin: 0.25rem 0;
    color: var(--text-body);
    font-size: 0.9rem;
}

.child-card .child-info strong {
    color: var(--text-muted);
    font-weight: 600;
}

/* Child Card Footer */
.child-card .card-footer {
    padding: 0.75rem 1.5rem 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    background: var(--til-ink-800);
    border-top: 1px solid var(--border);
}

.child-card .card-footer .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
}

.btn-info {
    background: var(--gradient-info);
    color: var(--on-primary);
    border: 1px solid var(--til-gold-800);
}

.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
    color: var(--on-primary);
}


.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

/* ==========================================================================
   Unified Card System — shared base for every card variant
   (.card, .child-card, .reward-card, .task-card).
   ========================================================================== */
.card,
.child-card,
.reward-card,
.task-card {
    background: var(--surface-elevated);
    color: var(--text);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
    padding: 0.43rem;
}

.card:hover,
.child-card:hover,
.reward-card:hover,
.task-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Card Header */
.card .card-header {
    padding: 1rem 1.5rem 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--til-ink-800);
    border-bottom: 1px solid var(--border);
}

.card .card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading);
    flex: 1;
}

/* Card Body */
.card .card-body {
    padding: 1rem 1.5rem;
    text-align: center;
}

/* Card Footer */
.card .card-footer {
    padding: 0.75rem 1.5rem 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    background: var(--til-ink-800);
    border-top: 1px solid var(--border);
}

.card .card-footer .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
}

/* ==========================================================================
   Unified Status Badge base — all card status pills share this shape.
   ========================================================================== */
.status-badge,
.child-card .child-status,
.reward-card .reward-status,
.task-card .task-status {
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background: var(--success);
    color: #ffffff;
}

.status-badge.available {
    background: var(--success);
    color: #ffffff;
}

.status-badge.claimed {
    background: var(--danger);
    color: #ffffff;
}

.status-badge.out-of-stock {
    background: #343a40;
    color: #ffffff;
}

.status-badge.pending {
    background: var(--til-ink-800);
    color: var(--til-cream-100);
    border: 1px solid var(--til-cream-500);
}

.status-badge.completed {
    background: var(--til-gold-500);
    color: var(--on-primary);
    border: 1px solid var(--til-gold-600);
}

.status-badge.overdue {
    background: var(--danger);
    color: #ffffff;
}

.status-badge.expired {
    background: #343a40;
    color: #ffffff;
}

/* Card Status Styles */
.card.active {
    border-left: 5px solid var(--success-border);
}

.card.inactive {
    border-left: 5px solid var(--til-cream-600);
    opacity: 0.72;
}

.card.inactive .card-header h3 {
    color: var(--text-muted);
}

.status-badge.inactive {
    background: var(--til-ink-800);
    color: var(--til-cream-100);
    border: 1px solid var(--til-cream-500);
}

.card.available {
    border-left: 5px solid var(--success-border);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.14) 0%, var(--til-ink-800) 100%);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.16);
}

.card.claimed {
    border-left: 5px solid var(--danger-border);
    background: linear-gradient(135deg, rgba(168, 84, 48, 0.16) 0%, var(--til-ink-800) 100%);
    box-shadow: 0 4px 12px rgba(168, 84, 48, 0.18);
}

.card.out-of-stock {
    border-left: 5px solid var(--til-ink-400);
    background: linear-gradient(135deg, var(--til-ink-700) 0%, var(--til-ink-800) 100%);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.2);
    opacity: 0.8;
}

.card.pending {
    border-left: 5px solid var(--til-cream-500);
    background: var(--surface-elevated);
    box-shadow: var(--shadow-sm);
}

.card.completed {
    border-left: 5px solid var(--til-gold-400);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.22) 0%, var(--til-ink-800) 100%);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.22);
}

.card.overdue {
    border-left: 5px solid var(--danger-border);
    background: linear-gradient(135deg, rgba(168, 84, 48, 0.16) 0%, var(--til-ink-800) 100%);
    box-shadow: 0 4px 12px rgba(168, 84, 48, 0.2);
}

.card.expired {
    border-left: 5px solid var(--til-ink-400);
    background: linear-gradient(135deg, var(--til-ink-700) 0%, var(--til-ink-800) 100%);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.2);
    opacity: 0.8;
}

.child-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: block;
    border: 4px solid rgba(212, 175, 55, 0.2);
    object-fit: cover;
}

.child-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text); /* WCAG AAA contrast */
    text-align: center;
    margin-bottom: 0.5rem;
}

.child-info {
    margin-bottom: 1.5rem;
}

.child-info p {
    margin: 0.25rem 0;
    color: var(--text-body); /* WCAG AAA contrast */
    font-size: 0.95rem;
}

/* Reward Card Styles */

/* Reward Card Status Styles */
.reward-card.available {
    border-left: 5px solid var(--success-border);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.14) 0%, var(--til-ink-800) 100%);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.16);
}

.reward-card.claimed {
    border-left: 5px solid var(--danger-border);
    background: linear-gradient(135deg, rgba(168, 84, 48, 0.16) 0%, var(--til-ink-800) 100%);
    box-shadow: 0 4px 12px rgba(168, 84, 48, 0.18);
}

.reward-card.out-of-stock {
    border-left: 5px solid var(--til-ink-400);
    background: linear-gradient(135deg, var(--til-ink-700) 0%, var(--til-ink-800) 100%);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.2);
    opacity: 0.8;
}

/* Reward Card Header */
.reward-card .card-header {
    padding: 1rem 1.5rem 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--til-ink-800);
    border-bottom: 1px solid var(--border);
}

.reward-card .card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading);
    flex: 1;
}

.reward-card .reward-status.available {
    background: var(--success);
    color: white;
}

.reward-card .reward-status.claimed {
    background: var(--danger);
    color: white;
}

.reward-card .reward-status.out-of-stock {
    background: #343a40;
    color: white;
}

.reward-card .card-body {
    padding: 1rem 1.5rem;
    text-align: center;
}

.reward-card .reward-info {
    margin: 1rem 0;
    text-align: left;
}

.reward-card .reward-info p {
    margin: 0.25rem 0;
    color: var(--text-body);
    font-size: 0.9rem;
}

.reward-card .reward-info strong {
    color: var(--text-muted);
    font-weight: 600;
}

.reward-card .card-footer {
    padding: 0.75rem 1.5rem 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    background: var(--til-ink-800);
    border-top: 1px solid var(--border);
}

.reward-card .card-footer .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
}

.reward-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: block;
    border: 4px solid rgba(212, 175, 55, 0.2);
    object-fit: cover;
}

.reward-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text); /* WCAG AAA contrast */
    text-align: center;
    margin-bottom: 0.5rem;
}

.reward-info {
    margin-bottom: 1.5rem;
}

.reward-info p {
    margin: 0.25rem 0;
    color: var(--text-body); /* WCAG AAA contrast */
    font-size: 0.95rem;
}

.reward-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Task Card Styles */
.task-card.overdue {
    border-left: 5px solid var(--danger-border);
    background: linear-gradient(135deg, rgba(168, 84, 48, 0.16) 0%, var(--til-ink-800) 100%);
    box-shadow: 0 4px 12px rgba(168, 84, 48, 0.2);
}

.task-card.completed {
    border-left: 5px solid var(--til-gold-400);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.22) 0%, var(--til-ink-800) 100%);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.22);
}

.task-card.pending {
    border-left: 5px solid var(--til-cream-500);
    background: var(--surface-elevated);
    box-shadow: var(--shadow-sm);
}

.task-card.expired {
    border-left: 5px solid var(--til-ink-400);
    background: linear-gradient(135deg, var(--til-ink-700) 0%, var(--til-ink-800) 100%);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.2);
    opacity: 0.8;
}

.task-card.expired .card-header {
    background: linear-gradient(135deg, var(--til-ink-700) 0%, var(--til-ink-800) 100%);
}

.task-card.expired .task-due {
    color: var(--text-body);
    font-weight: 600;
}

.task-card.expired .card-footer .btn-success {
    background: var(--til-ink-700);
    color: var(--til-cream-100);
    border: 2px solid var(--til-gold-600);
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.task-card.expired .card-footer .btn-secondary {
    background: #343a40;
    color: white;
    cursor: not-allowed;
    opacity: 0.6;
}

.task-card.expired .card-footer .btn-secondary:hover {
    background: #343a40;
    transform: none;
    box-shadow: none;
}

/* Hover states for different task statuses */
.task-card.overdue:hover {
    box-shadow: 0 8px 25px rgba(168, 84, 48, 0.3);
}

.task-card.completed:hover {
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.35);
}

.task-card.pending:hover {
    box-shadow: var(--shadow-md);
}

.task-card.expired:hover {
    box-shadow: 0 8px 25px rgba(108, 117, 125, 0.3);
}

.task-card.overdue .card-header {
    background: linear-gradient(135deg, rgba(168, 84, 48, 0.18) 0%, var(--til-ink-800) 100%);
}

.task-card.overdue .task-status.overdue {
    background: var(--danger);
    color: white;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
}

.task-card.overdue .task-due {
    color: var(--danger-text);
    font-weight: 600;
}

/* Task Card Header */
.task-card .card-header {
    padding: 1rem 1.5rem 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--til-ink-800);
    border-bottom: 1px solid var(--border);
}

.task-card .card-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--heading);
    flex: 1;
}

.task-card .task-status.pending {
    background: var(--til-ink-800);
    color: var(--til-cream-100);
    border: 1px solid var(--til-cream-500);
}

.task-card .task-status.completed {
    background: var(--til-gold-500);
    color: var(--on-primary);
    border: 1px solid var(--til-gold-600);
}

.task-card .task-status.expired {
    background: #343a40;
    color: white;
}

.task-card .task-status.overdue {
    background: var(--danger);
    color: white;
}

/* Task Card Body paragraph styling */
.card .card-body p {
    margin: 0 0 0.75rem 0;
    color: var(--text-body);
    font-size: 0.9rem;
    line-height: 1.4;
}

.card .task-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card .task-meta span {
    font-size: 0.8rem;
    color: var(--text-body);
}

.card .task-meta .task-child {
    font-weight: 500;
    color: var(--text-muted);
}

.card .task-meta .task-points {
    font-weight: 600;
    color: var(--til-gold-400);
}


.card .completed-badge {
    background: var(--til-gold-500);
    color: var(--on-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.card .expired-badge {
    background: #343a40;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.child-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Duplicate stat selectors removed */

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--heading); /* Better contrast */
    font-size: 1.1rem;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    padding: 1rem;
    box-sizing: border-box;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.modal-content {
    background: var(--surface-elevated);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    animation: slideUp 0.3s ease;
    position: relative;
    color: var(--text);
}

.close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--til-cream-100);
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--til-ink-600);
}

.close:hover {
    color: #ffffff;
    background: var(--danger); /* WCAG AAA with white */
    transform: rotate(90deg);
}

.modal h2 {
    color: var(--text); /* WCAG AAA contrast */
    margin-bottom: 1rem;
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
}

/* Delete Modal Specific Styles */
.modal-delete {
    max-width: 350px;
    text-align: center;
    padding: 1.2rem;
}

/* Completed tasks overlay (children Achievements) */
.modal-completed-tasks {
    max-width: 480px;
    width: 94%;
    text-align: left;
    padding: 1.4rem 1.4rem 1.2rem;
    max-height: min(85vh, 640px);
    display: flex;
    flex-direction: column;
}

.modal-completed-tasks h2 {
    text-align: left;
    padding-right: 2rem;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.completion-rate-banner {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    border-left-width: 6px;
    color: var(--text);
}

.completion-rate-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--til-cream-100);
}

.completion-rate-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.completion-rate-banner.rate-red {
    background: rgba(168, 84, 48, 0.18);
    border-color: var(--danger-text);
}

.completion-rate-banner.rate-orange {
    background: rgba(251, 146, 60, 0.15);
    border-color: var(--til-gold-600);
}

.completion-rate-banner.rate-yellow {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--til-gold-500);
}

.completion-rate-banner.rate-green {
    background: rgba(212, 175, 55, 0.16);
    border-color: var(--success-text);
}

.completion-rate-banner.rate-empty {
    background: var(--til-ink-800);
    border-color: var(--border);
}

.completed-tasks-summary {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(212, 175, 55, 0.08);
    border-radius: 10px;
    border: 1px solid rgba(212, 175, 55, 0.2);
}

.completed-tasks-summary .stat-item {
    align-items: flex-start;
}

.completed-tasks-list {
    flex: 1;
    overflow-y: auto;
    min-height: 120px;
    max-height: 360px;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.completed-task-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0.85rem;
    background: var(--til-ink-800);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.completed-task-row.status-expired {
    border-color: rgba(168, 84, 48, 0.28);
    background: rgba(168, 84, 48, 0.08);
}

.completed-task-main {
    min-width: 0;
    flex: 1;
}

.completed-task-title {
    font-weight: 600;
    color: var(--text-body);
    font-size: 0.95rem;
    line-height: 1.3;
    overflow-wrap: break-word;
}

.completed-task-meta {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-body);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.task-outcome-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.task-outcome-badge.completed {
    background: var(--til-gold-500);
    color: var(--on-primary);
}

.task-outcome-badge.expired {
    background: var(--danger);
    color: #ffffff; /* WCAG AAA on dark red */
}

.completed-task-points {
    flex-shrink: 0;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--til-gold-400);
    white-space: nowrap;
}

.completed-task-points.missed {
    color: var(--danger-text);
    font-weight: 600;
    font-size: 0.75rem;
}

.completed-tasks-list .loading,
.completed-tasks-list .no-data,
.completed-tasks-list .error {
    padding: 1.5rem 0.5rem;
    text-align: center;
    color: var(--text-body);
}

.completed-tasks-list .error {
    color: var(--danger-text);
}

.delete-icon {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.delete-message {
    color: var(--heading);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.delete-error {
    background: var(--danger);
    border: 1px solid var(--danger-border);
    color: #ffffff;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
}


.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--danger-border);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dropdown styling for time selection */
select#due_time {
    background-color: var(--til-ink-900);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text);
}

select#due_time:focus {
    border-color: var(--til-gold-500);
    outline: none;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.25);
}

/* Selected option in dropdown */
select#due_time option:checked {
    background-color: var(--til-gold-800) !important;
    color: var(--til-cream-50) !important;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-strong) 100%);
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
}

.btn-danger:hover {
    background: var(--danger);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(168, 84, 48, 0.3);
}

.btn-danger:focus {
    outline: 2px solid var(--danger-border);
    outline-offset: 2px;
}

.btn-success {
    background: var(--til-ink-700);
    color: var(--til-cream-100);
    border: 2px solid var(--til-gold-600);
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-success:hover {
    background: var(--til-gold-500);
    color: var(--on-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.3);
    border-color: var(--til-gold-500);
}

.btn-success:focus {
    outline: 2px solid var(--success-border);
    outline-offset: 2px;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text); /* WCAG AAA contrast */
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.form-group label:hover {
    color: var(--til-gold-400); /* WCAG AAA */
}

/* Form helper text and descriptions */
.form-help {
    font-size: 0.875rem;
    color: var(--heading); /* Better contrast */
    margin-top: 0.25rem;
    font-style: italic;
}

.form-description {
    font-size: 0.9rem;
    color: var(--text-body);
    margin-bottom: 1rem;
    line-height: 1.5;
    background: var(--til-ink-800);
    padding: 0.75rem;
    border-radius: 6px;
    border-left: 4px solid var(--til-gold-500);
}

/* Form section headers */
.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(212, 175, 55, 0.1);
}

.form-section h3 {
    color: var(--til-gold-500);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.form-section p {
    color: var(--text-body);
    font-size: 0.9rem;
    margin: 0;
}

/* Required field indicator */
.form-group label .required {
    color: var(--danger-text);
    font-weight: 700;
    margin-left: 0.25rem;
}

/* Form validation messages */
.form-error {
    color: #ffffff;
    background: var(--danger);
    border: 1px solid var(--danger-border);
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.form-success {
    color: #ffffff;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--til-gold-800);
    border-radius: 8px;
}

/* Form group variations */
.form-group.inline {
    display: flex;
    gap: 1rem;
    align-items: end;
}

.form-group.inline .form-group {
    flex: 1;
}

.form-group.compact {
    margin-bottom: 1rem;
}

.form-group.compact label {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

/* Checkbox and radio styling */
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    width: auto;
    margin-right: 0.5rem;
    cursor: pointer;
}

.form-group .checkbox-label,
.form-group .radio-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group .checkbox-label:hover,
.form-group .radio-label:hover {
    color: var(--til-gold-500);
}

/* Character counter for textareas */
.char-counter {
    font-size: 0.75rem;
    color: var(--text-body);
    text-align: right;
    margin-top: 0.25rem;
}

.char-counter.warning {
    color: var(--til-gold-300);
}

.char-counter.danger {
    color: var(--danger-text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--til-ink-900);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--til-gold-500);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
    background: var(--til-ink-700);
}

/* Custom dropdown styling */
.form-group select,
select.form-control {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d4af37' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 1rem center !important;
    background-size: 1.5rem !important;
    padding-right: 3rem !important;
}

.form-group select:hover,
select.form-control:hover {
    border-color: rgba(212, 175, 55, 0.4) !important;
    background-color: var(--til-ink-700) !important;
}

.form-group select:active,
select.form-control:active {
    border-color: var(--til-gold-500) !important;
    transform: scale(0.98) !important;
}

/* Target all select elements globally */
select {
    background: var(--til-ink-900);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-family: inherit;
}

select:focus {
    outline: none !important;
    border-color: var(--til-gold-500) !important;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1) !important;
    background: var(--til-ink-700) !important;
}

select:hover {
    border-color: rgba(212, 175, 55, 0.4) !important;
    background-color: var(--til-ink-700) !important;
}

/* Enhanced dropdown options styling */
select option,
.form-group select option {
    background: var(--til-ink-800);
    color: var(--text);
}

/* Option hover states (works in some browsers) */
select option:hover,
.form-group select option:hover {
    background: var(--til-ink-700);
    color: var(--til-cream-100) !important;
    font-weight: 600 !important;
}

/* Selected option styling */
select option:checked,
.form-group select option:checked {
    background: var(--til-gold-800);
    color: var(--til-cream-50);
}

/* First option (placeholder) styling */
select option[value=""],
.form-group select option[value=""] {
    color: var(--text-muted) !important;
    font-style: italic !important;
    font-weight: 400 !important;
    background: var(--til-ink-800);
}

/* Enhanced select dropdown styling - duplicate removed */

/* Custom dropdown wrapper for better styling */
.select-wrapper {
    position: relative;
    display: block;
}

.select-wrapper::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--til-gold-500);
    pointer-events: none;
    transition: all 0.3s ease;
}

.select-wrapper:hover::after {
    border-top-color: var(--til-gold-800);
    transform: translateY(-50%) scale(1.1);
}

/* Category-specific option styling */
select option[value="chores"]::before { content: "🧹 "; }
select option[value="homework"]::before { content: "📚 "; }
select option[value="personal"]::before { content: "👤 "; }
select option[value="creative"]::before { content: "🎨 "; }
select option[value="helping"]::before { content: "🤝 "; }

select option[value="toys"]::before { content: "🧸 "; }
select option[value="activities"]::before { content: "🎮 "; }
select option[value="privileges"]::before { content: "👑 "; }
select option[value="treats"]::before { content: "🍬 "; }
select option[value="screen_time"]::before { content: "📱 "; }

/* Priority dropdown styling */
select option[value="low"]::before { content: "🟢 "; }
select option[value="medium"]::before { content: "🟡 "; }
select option[value="high"]::before { content: "🔴 "; }
select option[value="urgent"]::before { content: "🚨 "; }

/* Status dropdown styling */
select option[value="pending"]::before { content: "⏳ "; }
select option[value="in_progress"]::before { content: "🔄 "; }
select option[value="completed"]::before { content: "✅ "; }
select option[value="cancelled"]::before { content: "❌ "; }

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted); /* WCAG AAA on white (~7:1) */
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Horizontal field row (e.g. side-by-side date + time inputs) */
.field-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.field-row > * {
    flex: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    main {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .data-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .actions-bar {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    h1 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .child-stats {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

.btn-logout:hover {
    background: var(--danger);
}

.dashboard-body {
    display: flex;
    gap: 30px;
}

.sidebar {
    width: 300px;
    background: var(--surface);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: fit-content;
    position: sticky;
    top: 30px;
}

.sidebar h2 {
    color: var(--heading);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f5f5f5;
}

.endpoint-list {
    list-style: none;
}

.endpoint-link {
    display: flex;
    align-items: center;
    padding: 12px;
    margin: 8px 0;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s;
    border: 1px solid transparent;
}

.endpoint-link:hover {
    background-color: var(--til-ink-800);
    border-color: var(--border);
}

.method {
    padding: 6px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 65px;
    text-align: center;
    margin-right: 12px;
}

.get { background: var(--til-gold-800); color: white; }
.post { background: var(--success); color: white; }
.put { background: var(--til-gold-800); color: #ffffff; }
.delete { background: var(--danger); color: #ffffff; /* WCAG AAA */ }

.path {
    color: var(--heading);
    font-size: 0.9rem;
    word-break: break-all;
}

.main-content {
    flex: 1;
    background: var(--surface);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.endpoint-details {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid #eee;
}

.endpoint-details h3 {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.description {
    color: var(--text-body);
    margin-bottom: 20px;
}

.test-endpoint {
    background: var(--til-ink-800);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.test-endpoint h4 {
    color: var(--text); /* WCAG AAA contrast */
    margin-bottom: 15px;
}

/* Legacy form styles - removed duplicates */

.btn-test {
    background: #2c3e50;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    margin-top: 15px;
}

.btn-test:hover {
    background: #34495e;
}

.result-section {
    margin-top: 20px;
}

.result-section h5 {
    color: var(--heading);
    margin-bottom: 10px;
}

.response {
    background: var(--til-ink-800);
    padding: 15px;
    border-radius: 4px;
    border: 1px solid var(--border);
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Legacy styles removed - duplicates fixed */
/* rest of your styles */

/* Add these styles */
.param-description {
    display: block;
    color: var(--heading); /* Better contrast */
    font-size: 0.8rem;
    margin-top: 4px;
}

.required {
    color: var(--danger-text);
    margin-left: 4px;
}

/* Footer styles with proper contrast */
footer {
    margin-top: 3rem;
    padding: 2rem 0;
    background-color: var(--surface); /* Solid white for contrast */
    border-top: 1px solid rgba(0, 0, 0, 0.1); /* Darker border */
    text-align: center;
    color: var(--heading); /* Better contrast */
}

/* Outline button — shared variant (used by the error page and elsewhere) */
.btn-outline {
    background: var(--til-ink-800);
    color: var(--til-cream-100);
    border: 2px solid var(--border);
}

.btn-outline:hover {
    background: var(--surface-alt);
    border-color: var(--muted);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Error Page (views/error.ejs) — moved from an inline <style> block so it
   shares the same design tokens as every other view.
   ========================================================================== */
.error-page {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.error-content {
    text-align: center;
    max-width: 500px;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.error-title {
    font-size: clamp(2rem, 5vw, 2.5rem);
    font-weight: 700;
    margin: 0 0 1rem 0;
}

.error-message {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin: 0 0 2rem 0;
    line-height: 1.6;
}

.error-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
}

.error-actions .btn {
    min-width: 200px;
    justify-content: center;
}

.error-details {
    margin-top: 2rem;
    text-align: left;
    background: var(--surface-alt);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
}

.error-details h3 {
    margin: 0 0 0.5rem 0;
    color: var(--heading);
    font-size: 1rem;
}

.error-details pre {
    margin: 0;
    font-size: 0.75rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 200px;
    overflow-y: auto;
}

@media (min-width: 640px) {
    .error-actions {
        flex-direction: row;
        justify-content: center;
        flex-wrap: wrap;
    }

    .error-actions .btn {
        min-width: 150px;
    }
}

/* ==========================================================================
   Reward Redemptions (views/rewards/redemptions.ejs) — moved from an inline
   <style> block and aligned to the shared design tokens.
   ========================================================================== */
.page-header {
    margin-bottom: 1.5rem;
}

.breadcrumb {
    margin-bottom: 1rem;
}

.breadcrumb-link {
    color: var(--brand-start);
    font-weight: 500;
}

.reward-summary {
    margin-bottom: 2rem;
}

.summary-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--brand-start);
}

.summary-card h2 {
    margin: 0 0 0.5rem 0;
    color: var(--heading);
}

.reward-description {
    color: var(--text-muted);
    margin: 0.5rem 0 1rem 0;
}

.reward-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.points-badge,
.category-badge,
.quantity-badge,
.points-spent {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
}

.points-badge { background: var(--success); }
.category-badge { background: var(--gradient-primary); }
.quantity-badge { background: var(--warning); color: var(--warning-text); }
.points-spent { background: var(--danger); }

.redemptions-section {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.redemptions-section h2 {
    margin: 0 0 1.5rem 0;
    color: var(--heading);
}

.redemption-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
    transition: transform 0.2s ease;
}

.redemption-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

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

.redemption-card .child-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0;
}

.redemption-card .child-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0;
    border: none;
    object-fit: cover;
}

.child-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.child-details h4 {
    margin: 0;
    color: var(--heading);
}

.redemption-date {
    margin: 0.25rem 0 0 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.redemption-points,
.redemption-status {
    text-align: right;
}

.redemption-notes {
    background: var(--surface-alt);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    margin: 0.75rem 0;
    font-size: 0.875rem;
    color: var(--text-body);
}

.no-data {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.no-data-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.no-data h3 {
    margin: 0 0 0.5rem 0;
    color: var(--heading);
}

.no-data p {
    margin: 0;
}

.actions-section {
    margin-top: 2rem;
    text-align: center;
}

/* ==========================================================================
   Dashboard (views/dashboard/index.ejs) — moved from an inline <style> block
   and aligned to the shared design tokens.
   ========================================================================== */
.welcome-section {
    text-align: center;
    margin-top: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--gradient-brand);
    color: #ffffff;
    border-radius: var(--radius-lg);
}

.user-greeting {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.system-description {
    font-size: 1.1rem;
    opacity: 0.9;
}

.navigation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.nav-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.nav-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.nav-card-header {
    background: var(--surface-alt);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-soft);
}

.nav-card-header h2 {
    margin: 0;
    color: var(--heading);
}

.nav-icon {
    font-size: 2rem;
}

.nav-card-body {
    padding: 1.5rem;
}

.nav-card-body p {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-list li {
    padding: 0.5rem 0;
    color: var(--heading);
    position: relative;
    padding-left: 1.5rem;
}

.feature-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: bold;
}

.nav-card-footer {
    padding: 1.5rem;
    background: var(--surface-alt);
    border-top: 1px solid var(--border-soft);
}

.btn-large {
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.stats-section {
    margin-bottom: 3rem;
    padding: 2rem;
    background: var(--surface-alt);
    border-radius: var(--radius);
}

.stats-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--heading);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-sm);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-card h3 {
    margin: 0 0 1rem 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--brand-start);
}

.quick-actions {
    text-align: center;
}

.quick-actions h2 {
    margin-bottom: 1.5rem;
    color: var(--heading);
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .navigation-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
    }

    .action-buttons .btn {
        width: 100%;
        max-width: 300px;
    }
}