/* ==========================================
   FAMILY DASHBOARD - STYLES
   ========================================== */

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

/* Color Theme Variables */
:root {
    /* Default Purple Theme */
    --primary-start: #667eea;
    --primary-end: #764ba2;
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --accent-color: #764ba2;
}

/* Pink Theme */
body.theme-pink {
    --primary-start: #f093fb;
    --primary-end: #f5576c;
    --primary-color: #f093fb;
    --primary-dark: #e77bea;
    --accent-color: #f5576c;
}

/* Blue Theme */
body.theme-blue {
    --primary-start: #4facfe;
    --primary-end: #00f2fe;
    --primary-color: #4facfe;
    --primary-dark: #3b8dd9;
    --accent-color: #00d4e6;
}

/* Green Theme */
body.theme-green {
    --primary-start: #43e97b;
    --primary-end: #38f9d7;
    --primary-color: #43e97b;
    --primary-dark: #2ec968;
    --accent-color: #38f9d7;
}

/* Teal Theme */
body.theme-teal {
    --primary-start: #2ebf91;
    --primary-end: #8360c3;
    --primary-color: #2ebf91;
    --primary-dark: #259c75;
    --accent-color: #8360c3;
}

/* Orange Theme */
body.theme-orange {
    --primary-start: #fa709a;
    --primary-end: #fee140;
    --primary-color: #fa709a;
    --primary-dark: #e55982;
    --accent-color: #fee140;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, var(--primary-start) 0%, var(--primary-end) 100%);
    min-height: 100vh;
    padding: 10px;
}

/* Twemoji image styling */
img.emoji {
    height: 1em;
    width: 1em;
    margin: 0 0.05em 0 0.1em;
    vertical-align: -0.1em;
}

/* Three-column layout: sidebar, main content, and chores column */
.dashboard-layout {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 12px;
    max-width: 1600px;
    margin: 0 auto;
    height: 100vh;
    overflow: hidden;
}

/* Left Sidebar */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100vh;
    overflow-y: auto;
}

/* Main Content Area */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

/* Right Column for Chores */
.right-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    height: 100vh;
    overflow: hidden;
}

/* Clock Widget */
.clock-widget {
    background: white;
    border-radius: 15px;
    padding: 12px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.clock-time {
    font-size: 42px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
    font-family: 'Courier New', monospace;
}

.clock-date {
    font-size: 10px;
    color: #666;
    line-height: 1.3;
}

/* Weather Widget */
.weather-widget {
    background: white;
    border-radius: 15px;
    padding: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.weather-current {
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 10px;
}

.weather-emoji-large {
    font-size: 36px;
    margin-bottom: 5px;
}

.weather-temp-large {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 3px;
}

.weather-humidity {
    font-size: 10px;
    color: #999;
}

.hourly-forecast {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.hourly-forecast-item {
    text-align: center;
    padding: 5px;
    background: #f8f9fa;
    border-radius: 8px;
}

.forecast-hour {
    font-size: 9px;
    color: #666;
    margin-bottom: 2px;
}

.forecast-emoji {
    font-size: 18px;
    margin: 3px 0;
}

.forecast-temp {
    font-size: 11px;
    font-weight: bold;
    color: #667eea;
}

/* Calendar Widget */
.calendar-widget {
    background: white;
    border-radius: 15px;
    padding: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    flex: 1;
    overflow-y: auto;
}

.calendar-header {
    font-size: 12px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

.calendar-week {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.calendar-day {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 10px;
    border-left: 3px solid #e0e0e0;
    transition: all 0.2s ease;
}

.calendar-day.today {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.1), rgba(var(--secondary-rgb), 0.1));
    border-left: 3px solid var(--primary-color);
}

.day-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e0e0e0;
}

.day-name {
    font-size: 11px;
    font-weight: bold;
    color: var(--primary-color);
    text-transform: uppercase;
}

.day-date {
    font-size: 10px;
    color: #666;
}

.holiday-indicator {
    margin-left: auto;
    font-size: 14px;
}

.holiday-name {
    font-size: 9px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 4px;
    text-align: center;
}

.day-weather {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 6px 0;
}

.day-weather-emoji {
    font-size: 24px;
    line-height: 1;
}

.day-weather-temp {
    font-size: 11px;
    font-weight: 600;
    color: #333;
}

.day-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.day-event {
    font-size: 9px;
    color: #666;
    padding: 4px 6px;
    background: white;
    border-radius: 4px;
    line-height: 1.3;
}

.day-event-more {
    font-size: 8px;
    color: #999;
    font-style: italic;
    padding: 2px 6px;
}

.no-events {
    font-size: 9px;
    color: #bbb;
    font-style: italic;
}

.weather-label {
    font-size: 9px;
    color: #999;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Legacy calendar event styles (kept for backwards compatibility) */
.calendar-event {
    padding: 8px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.calendar-event:last-child {
    margin-bottom: 0;
}

.event-time {
    font-size: 9px;
    color: #999;
    margin-bottom: 3px;
}

.event-title {
    font-size: 11px;
    color: #333;
    font-weight: 500;
    line-height: 1.3;
}

.header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: white;
    margin-bottom: 10px;
}

.header h1 {
    font-size: 22px;
    margin-bottom: 5px;
}

.color-scheme-selector {
    position: absolute;
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-scheme-selector label {
    font-size: 18px;
    cursor: default;
}

/* ==========================================
   PARENT DASHBOARD
   ========================================== */

.parent-dash-btn {
    position: relative;
}

.pending-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #e03131;
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    pointer-events: none;
}

.parent-dash-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1100;
    backdrop-filter: blur(2px);
}

.parent-dash-overlay.active {
    display: block;
}

.parent-dash-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(420px, 100vw);
    height: 100vh;
    background: white;
    z-index: 1200;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.2);
}

.parent-dash-panel.open {
    transform: translateX(0);
}

.parent-dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 2px solid #f0f0f0;
    flex-shrink: 0;
}

.parent-dash-header h2 {
    font-size: 20px;
    color: var(--primary-color);
    margin: 0;
}

.parent-dash-section-title {
    font-size: 12px;
    font-weight: bold;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 20px 8px;
    flex-shrink: 0;
}

#parentDashContent {
    overflow-y: auto;
    flex: 1;
    padding: 0 12px 20px;
}

.parent-dash-empty {
    text-align: center;
    color: #999;
    padding: 40px 20px;
    font-size: 15px;
}

.parent-dash-kid-group {
    margin-bottom: 16px;
}

.parent-dash-kid-name {
    font-size: 13px;
    font-weight: bold;
    color: var(--primary-color);
    padding: 8px 8px 6px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 4px;
}

.parent-dash-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 8px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: #f8f9fa;
}

.parent-dash-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.parent-dash-type-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.parent-dash-item-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.parent-dash-item-meta {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}

.parent-dash-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 8px;
}

/* Dark mode */
body.dark-mode .parent-dash-panel {
    background: #2d3748;
    color: #e2e8f0;
}

body.dark-mode .parent-dash-header {
    border-bottom-color: #4a5568;
}

body.dark-mode .parent-dash-kid-name {
    border-bottom-color: #4a5568;
}

body.dark-mode .parent-dash-item {
    background: #1a202c;
}

body.dark-mode .parent-dash-item-name {
    color: #e2e8f0;
}

/* ── Reward limit badge + guidelines ──────────────────────────────────────── */

.reward-details {
    flex: 1;
}

.reward-limit-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    background: #e7f5ff;
    border: 1px solid #4dabf7;
    border-radius: 10px;
    color: #1971c2;
    margin-left: 6px;
    vertical-align: middle;
}

.reward-guidelines {
    font-size: 11px;
    color: #868e96;
    margin-top: 2px;
    font-style: italic;
}

body.dark-mode .reward-limit-badge {
    background: #1c3a5e;
    border-color: #4dabf7;
    color: #74c0fc;
}

body.dark-mode .reward-guidelines {
    color: #718096;
}

/* ── Chores Admin Section ─────────────────────────────────────────────────── */

.chores-admin-section {
    margin-top: 20px;
    border-top: 1px solid #e9ecef;
    padding-top: 4px;
}

.chores-admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    color: var(--primary-color);
    user-select: none;
}

.chores-admin-header:hover {
    opacity: 0.8;
}

.chores-admin-body {
    padding-bottom: 8px;
}

.chores-admin-group-label {
    font-size: 11px;
    font-weight: bold;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 10px 0 4px;
}

.chores-admin-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
    background: #f8f9fa;
}

.chores-admin-row-disabled {
    opacity: 0.5;
}

.chores-admin-disabled-name {
    text-decoration: line-through;
    color: #aaa !important;
}

.chores-admin-mult-label {
    font-size: 12px;
    color: #868e96;
    flex-shrink: 0;
}

.chores-admin-row-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.chores-admin-meta {
    font-size: 11px;
    color: #f59f00;
}

.chores-admin-row-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.chores-admin-add-form {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.chores-admin-input {
    padding: 5px 8px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 12px;
    background: white;
    color: #333;
}

.chores-admin-input-grow {
    flex: 1;
    min-width: 80px;
}

.chores-admin-input-sm {
    width: 52px;
}

body.dark-mode .chores-admin-section {
    border-top-color: #4a5568;
}

body.dark-mode .chores-admin-row {
    background: #1a202c;
}

body.dark-mode .chores-admin-group-label {
    color: #718096;
}

body.dark-mode .chores-admin-input {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
}

/* House Rules button in header */
.house-rules-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    padding: 0 12px;
    font-size: 18px;
    width: auto;
    height: 35px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.house-rules-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* House Rules modal — wider, border-radius preserved, scrollable inner div */
.house-rules-modal-content {
    position: relative;
    width: min(95vw, 1100px);
    max-height: 88vh;
    background: white;
    border-radius: 20px;
    overflow: hidden; /* clips scroll content to border-radius */
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.house-rules-scroll {
    overflow-y: auto;
    max-height: 88vh;
    padding: 30px 30px 24px;
}

.modal-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
    z-index: 1;
}

.modal-close-btn:hover {
    background: #e03131;
    color: white;
    transform: scale(1.1);
}

/* Two-row grid layout for house rules sections */
.rules-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Right column: stack multiple sections vertically */
.rules-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rules-section {
    min-width: 0;
}

/* Dark mode */
body.dark-mode .house-rules-modal-content {
    background: #2d3748;
    color: #e2e8f0;
}

body.dark-mode .modal-close-btn {
    background: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .modal-close-btn:hover {
    background: #e03131;
    color: white;
}

/* Mobile: stack both rows */
@media (max-width: 768px) {
    .house-rules-scroll {
        padding: 20px 15px;
    }

    .rules-row {
        grid-template-columns: 1fr;
    }
}

.color-scheme-selector select {
    padding: 6px 10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.color-scheme-selector select:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.color-scheme-selector select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.color-scheme-selector select option {
    background: #2d1b4e;
    color: white;
}

.date-time {
    font-size: 14px;
    opacity: 0.9;
}

.kids-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.kid-card {
    background: white;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.currency-section {
    margin-bottom: 8px;
}

.currency-section:last-child {
    margin-bottom: 0;
}

.total-bp-section {
    border-top: 2px solid #f0f0f0;
    padding-top: 8px;
}

.total-bp-display {
    color: #5c7cfa;
}


.kid-name {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 4px;
    color: var(--primary-color);
}

.points-display {
    font-size: 28px;
    font-weight: bold;
    text-align: center;
    margin: 4px 0;
    color: var(--accent-color);
}

.points-label {
    text-align: center;
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
}

.button-group {
    display: flex;
    gap: 6px;
    justify-content: center;
}

button {
    font-size: 18px;
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.minus-btn {
    background: #ff6b6b;
    color: white;
}

.minus-btn:hover {
    background: #ff5252;
    transform: scale(1.1);
}

.plus-btn {
    background: #51cf66;
    color: white;
}

.plus-btn:hover {
    background: #40c057;
    transform: scale(1.1);
}

.reset-container {
    text-align: center;
    margin-top: 8px;
}

.reset-btn {
    background: white;
    color: var(--primary-color);
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 8px;
    width: auto;
    height: auto;
}

.reset-btn:hover {
    background: #f0f0f0;
}

.end-of-day-btn {
    background: #5c7cfa;
    color: white;
    padding: 6px 10px;
    font-size: 10px;
    border-radius: 6px;
    width: 100%;
    height: auto;
    margin-top: 6px;
}

.end-of-day-btn:hover {
    background: #4c6ef5;
}


.status-message {
    text-align: center;
    color: white;
    font-size: 12px;
    margin-top: 10px;
    min-height: 20px;
}

/* PIN Modal Styles */
.pin-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.pin-modal.active {
    display: flex;
}

.pin-content {
    background: white;
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
}

.pin-content h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
}

.pin-display {
    font-size: 48px;
    padding: 20px;
    text-align: center;
    border: 3px solid var(--primary-color);
    border-radius: 10px;
    margin-bottom: 20px;
    letter-spacing: 20px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    transition: all 0.2s ease;
}

.pin-display.pulse {
    animation: pulse-animation 0.3s ease;
}

@keyframes pulse-animation {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); border-color: #51cf66; }
    100% { transform: scale(1); }
}

.pin-error {
    color: #ff6b6b;
    font-size: 14px;
    font-weight: bold;
    margin-top: -10px;
    margin-bottom: 15px;
    min-height: 20px;
    display: none;
}

.numpad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.num-btn {
    font-size: 32px;
    width: 80px;
    height: 80px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    background: var(--primary-color);
    color: white;
    transition: all 0.2s ease;
}

.num-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.num-btn:active {
    transform: scale(0.95);
}

.clear-btn {
    background: #ff6b6b;
}

.clear-btn:hover {
    background: #ff5252;
}

.pin-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.pin-btn {
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 10px;
    width: auto;
    height: auto;
}

.unlock-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #51cf66;
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 16px;
    display: none;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.unlock-indicator.active {
    display: block;
}

.unlock-indicator:hover {
    background: #40c057;
    transform: scale(1.05);
}

.unlock-indicator:active {
    transform: scale(0.95);
}

/* Dark Mode Toggle Button */
.dark-mode-toggle {
    background: white;
    border-radius: 15px;
    padding: 12px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 24px;
    user-select: none;
}

.dark-mode-toggle:hover {
    transform: scale(1.05);
}

.dark-mode-toggle:active {
    transform: scale(0.95);
}

/* ==========================================
   DARK MODE STYLES
   ========================================== */

body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* Dark mode for all white widgets */
body.dark-mode .kid-card,
body.dark-mode .clock-widget,
body.dark-mode .weather-widget,
body.dark-mode .calendar-widget,
body.dark-mode .pin-content,
body.dark-mode .dark-mode-toggle {
    background: #2d3748;
    color: #e2e8f0;
}

/* Clock */
body.dark-mode .clock-time {
    color: var(--primary-color);
}

body.dark-mode .clock-date {
    color: #cbd5e0;
}

/* Weather */
body.dark-mode .weather-temp-large {
    color: var(--primary-color);
}

body.dark-mode .weather-humidity {
    color: #a0aec0;
}

body.dark-mode .weather-current {
    border-bottom: 1px solid #4a5568;
}

body.dark-mode .hourly-forecast-item {
    background: #1a202c;
    color: #e2e8f0;
}

body.dark-mode .forecast-hour {
    color: #cbd5e0;
}

body.dark-mode .forecast-temp {
    color: var(--primary-color);
}

/* Calendar */
body.dark-mode .calendar-header {
    color: var(--primary-color);
    border-bottom: 2px solid #4a5568;
}

body.dark-mode .calendar-event {
    background: #1a202c;
    border-left: 3px solid var(--primary-color);
}

body.dark-mode .event-time {
    color: #a0aec0;
}

body.dark-mode .event-title {
    color: #e2e8f0;
}

body.dark-mode .calendar-day {
    background: #1a202c;
    border-left: 3px solid #4a5568;
}

body.dark-mode .calendar-day.today {
    background: linear-gradient(135deg, color-mix(in srgb, var(--primary-color) 20%, transparent), color-mix(in srgb, var(--accent-color) 20%, transparent));
    border-left: 3px solid var(--primary-color);
}

body.dark-mode .day-header {
    border-bottom: 1px solid #4a5568;
}

body.dark-mode .day-name {
    color: var(--primary-color);
}

body.dark-mode .day-date {
    color: #a0aec0;
}

body.dark-mode .day-weather-temp {
    color: #e2e8f0;
}

body.dark-mode .day-event {
    background: #2d3748;
    color: #cbd5e0;
}

body.dark-mode .no-events {
    color: #4a5568;
}

body.dark-mode .weather-label {
    color: #718096;
}

/* Kid Cards */
body.dark-mode .kid-name {
    color: var(--primary-color);
}

body.dark-mode .points-display {
    color: var(--primary-color);
}

body.dark-mode .points-label {
    color: #cbd5e0;
}

body.dark-mode .total-bp-section {
    border-top: 2px solid #4a5568;
}

body.dark-mode .total-bp-display {
    color: var(--primary-color);
}

/* PIN Modal */
body.dark-mode .pin-content h2 {
    color: var(--primary-color);
}

body.dark-mode .pin-display {
    background: #1a202c;
    border-color: var(--primary-color);
    color: #e2e8f0;
}

body.dark-mode .pin-error {
    color: #fc8181;
}

/* Buttons in dark mode keep their original colors for visibility */
body.dark-mode .reset-btn {
    background: #4a5568;
    color: #e2e8f0;
}

body.dark-mode .reset-btn:hover {
    background: #2d3748;
}

/* ==========================================
   CHORES AND REWARDS SECTIONS
   ========================================== */

/* Section Containers */
.chores-section,
.rewards-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chores-section {
    flex: 1;
    min-height: 0;
}

#choresContainer,
#activitiesContainer {
    overflow-y: auto;
    flex: 1;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.section-header h2 {
    font-size: 20px;
    color: var(--primary-color);
    margin: 0;
}

/* Chores Styling */
.chore-kid-section {
    margin-bottom: 20px;
}

.chore-kid-section:last-child {
    margin-bottom: 0;
}

.chore-kid-section h3 {
    font-size: 16px;
    color: #667eea;
    margin-bottom: 10px;
}

.chore-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chore-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #ddd;
    transition: all 0.3s ease;
}

.chore-item.pending {
    border-left-color: #f59f00;
    background: #fff8e6;
}

.chore-item.approved {
    border-left-color: #51cf66;
    background: #e6f9ed;
}

.chore-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chore-status-icon {
    font-size: 18px;
}

.chore-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.chore-bp {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: bold;
}

.chore-actions {
    display: flex;
    gap: 8px;
}

.chore-btn {
    padding: 6px 12px;
    font-size: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

/* Make shopping cart icon bigger on reward buttons */
.chore-btn.complete-btn {
    font-size: 18px;
}

/* Undo button on recent activity rows */
.activity-undo-btn {
    flex-shrink: 0;
    padding: 2px 6px;
    font-size: 11px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    color: #868e96;
    cursor: pointer;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s;
}

.activity-undo-btn:hover {
    background: #fff3bf;
    border-color: #f59f00;
    color: #e67700;
    opacity: 1 !important;
}

div:has(> .activity-undo-btn):hover .activity-undo-btn {
    opacity: 1;
}

body.dark-mode .activity-undo-btn {
    background: #2d3748;
    border-color: #4a5568;
    color: #718096;
}

body.dark-mode .activity-undo-btn:hover {
    background: #3d2c00;
    border-color: #f59f00;
    color: #f59f00;
}

.complete-btn {
    background: #5c7cfa;
    color: white;
}

.complete-btn:hover {
    background: #4c6ef5;
    transform: scale(1.05);
}

.approve-btn {
    background: #51cf66;
    color: white;
}

.approve-btn:hover {
    background: #40c057;
    transform: scale(1.05);
}

.reject-btn {
    background: #ff6b6b;
    color: white;
}

.reject-btn:hover {
    background: #ff5252;
    transform: scale(1.05);
}

.approved-text {
    font-size: 12px;
    color: #51cf66;
    font-weight: bold;
}

/* Shared Chores */
.shared-chore-item {
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
}

.shared-chore-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

.shared-chore-kids {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.shared-chore-kid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    background: white;
    border-radius: 8px;
    border-left: 3px solid #ddd;
}

.shared-chore-kid.pending {
    border-left-color: #f59f00;
    background: #fff8e6;
}

.shared-chore-kid.approved {
    border-left-color: #51cf66;
    background: #e6f9ed;
}

.kid-name-small {
    font-size: 12px;
    font-weight: 500;
    color: #333;
}

.chore-btn-small {
    padding: 4px 8px;
    font-size: 11px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

/* Rewards Styling */
.rewards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
}

.reward-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.reward-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.reward-icon {
    font-size: 30px;
    margin-bottom: 4px;
}

.reward-name {
    font-size: 11px;
    font-weight: 500;
    color: #333;
    margin-bottom: 3px;
}

.reward-cost {
    font-size: 12px;
    font-weight: bold;
    color: #f59f00;
    margin-bottom: 6px;
}

.reward-btn {
    width: 100%;
    padding: 6px;
    font-size: 10px;
    border: none;
    border-radius: 6px;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.reward-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Dark Mode for Chores and Rewards */
body.dark-mode .chores-section,
body.dark-mode .rewards-section {
    background: #2d3748;
    color: #e2e8f0;
}

body.dark-mode .section-header {
    border-bottom-color: #4a5568;
}

body.dark-mode .section-header h2 {
    color: var(--primary-color);
}

body.dark-mode .chore-kid-section h3 {
    color: var(--primary-color);
}

body.dark-mode .chore-item {
    background: #1a202c;
    color: #e2e8f0;
}

body.dark-mode .chore-item.pending {
    background: #2d2416;
}

body.dark-mode .chore-item.approved {
    background: #1a2e1f;
}

body.dark-mode .chore-name,
body.dark-mode .kid-name-small {
    color: #e2e8f0;
}

body.dark-mode .shared-chore-item {
    background: #1a202c;
}

body.dark-mode .shared-chore-header {
    border-bottom-color: #4a5568;
}

body.dark-mode .shared-chore-kid {
    background: #2d3748;
}

body.dark-mode .shared-chore-kid.pending {
    background: #2d2416;
}

body.dark-mode .shared-chore-kid.approved {
    background: #1a2e1f;
}

body.dark-mode .reward-card {
    background: #1a202c;
    color: #e2e8f0;
}

body.dark-mode .reward-card:hover {
    border-color: var(--primary-color);
}

body.dark-mode .reward-name {
    color: #e2e8f0;
}

/* ==========================================
   KID SELECTOR MODAL
   ========================================== */

.kid-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.kid-selector-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.kid-selector-card:hover:not(.disabled) {
    border-color: #51cf66;
    transform: scale(1.05);
    background: #e6f9ed;
}

.kid-selector-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #fff1f0;
}

.kid-selector-name {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.kid-selector-pc {
    font-size: 24px;
    font-weight: bold;
    color: #f59f00;
    margin-bottom: 8px;
}

.kid-selector-status {
    font-size: 14px;
    color: #51cf66;
    font-weight: 500;
}

.kid-selector-card.disabled .kid-selector-status {
    color: #ff6b6b;
}

/* Dark mode for kid selector */
body.dark-mode .kid-selector-card {
    background: #1a202c;
}

body.dark-mode .kid-selector-card:hover:not(.disabled) {
    background: #1a2e1f;
}

body.dark-mode .kid-selector-card.disabled {
    background: #2d1f1f;
}

body.dark-mode .kid-selector-name {
    color: var(--primary-color);
}

/* ==========================================
   COMPACT MODE - Smaller sizes for Pi display
   ========================================== */

/* Compact Kid Cards */
.kid-card {
    padding: 6px;
}

.kid-name {
    font-size: 12px;
    margin-bottom: 4px;
}

.points-display {
    font-size: 24px;
    margin: 3px 0;
}

.points-label {
    font-size: 10px;
    margin-bottom: 3px;
}

.currency-section {
    margin-bottom: 6px;
}

.total-bp-section {
    padding-top: 6px;
}

button {
    font-size: 16px;
    width: 35px;
    height: 35px;
}

.button-group {
    gap: 6px;
}

.end-of-day-btn {
    padding: 4px 6px;
    font-size: 9px;
    margin-top: 4px;
}

/* Compact Chores */
.chores-section,
.rewards-section {
    padding: 10px;
    margin-top: 0;
    /* Preserve flex and overflow from main styles */
}

.section-header {
    margin-bottom: 8px;
    padding-bottom: 6px;
    flex-shrink: 0;
}

.section-header h2 {
    font-size: 14px;
}

.chore-kid-section {
    margin-bottom: 10px;
}

.chore-kid-section h3 {
    font-size: 12px;
    margin-bottom: 6px;
}

.chore-list {
    gap: 4px;
}

.chore-item {
    padding: 5px 8px;
}

.chore-status-icon {
    font-size: 14px;
}

.chore-name {
    font-size: 11px;
}

.chore-bp {
    font-size: 10px;
}

.chore-btn {
    padding: 4px 8px;
    font-size: 9px;
}

/* Keep shopping cart icon bigger even in compact mode */
.chore-btn.complete-btn {
    font-size: 16px;
}

.shared-chore-item {
    margin-bottom: 8px;
    padding: 6px;
}

.shared-chore-header {
    margin-bottom: 6px;
    padding-bottom: 4px;
}

.shared-chore-kids {
    gap: 4px;
}

.shared-chore-kid {
    padding: 4px;
}

.kid-name-small {
    font-size: 10px;
}

.chore-btn-small {
    padding: 2px 4px;
    font-size: 9px;
}

/* Compact Rewards */
.rewards-grid {
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 8px;
}

.reward-card {
    padding: 8px;
}

.reward-icon {
    font-size: 28px;
    margin-bottom: 4px;
}

.reward-name {
    font-size: 10px;
    margin-bottom: 3px;
}

.reward-cost {
    font-size: 11px;
    margin-bottom: 6px;
}

.reward-btn {
    padding: 5px;
    font-size: 9px;
}

/* ==========================================
   MOBILE RESPONSIVE LAYOUT
   ========================================== */

/* Shared mobile layout rules — applied via both portrait and landscape queries below */
.mobile-layout .dashboard-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
    gap: 8px;
}

/* Portrait phones (≤768px wide) */
@media (max-width: 768px) {
    html, body {
        overflow-y: auto;
        height: auto;
    }

    body {
        padding: 6px;
    }

    /* Stack 3 columns into 1 */
    .dashboard-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
        gap: 8px;
    }

    /* Reorder sections: Kids/Points first, Chores/Activities second, Sidebar last */
    .main-content {
        order: 1;
        height: auto;
        overflow: visible;
    }

    .right-column {
        order: 2;
        height: auto;
        overflow: visible;
        gap: 8px;
    }

    .sidebar {
        order: 3;
        height: auto;
        overflow: visible;
    }

    /* Chores section - no longer needs flex:1 height fill */
    .chores-section {
        flex: none;
    }

    /* Rewards/Recent Activity: single column on mobile */
    .rewards-activity-grid {
        grid-template-columns: 1fr !important;
    }

    /* Header */
    .header h1 {
        font-size: 20px;
    }

    .color-scheme-selector select {
        font-size: 13px;
        padding: 4px 8px;
    }

    /* Kids cards - 2 per row minimum on mobile */
    .kids-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .kid-name {
        font-size: 16px;
    }

    .points-display {
        font-size: 32px;
    }

    .points-label {
        font-size: 12px;
    }

    /* Touch-friendly + and - buttons */
    .minus-btn, .plus-btn {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .end-of-day-btn {
        font-size: 12px;
        padding: 8px 10px;
        height: auto;
        margin-top: 6px;
    }

    /* Touch-friendly chore buttons */
    .chore-btn {
        padding: 8px 14px;
        font-size: 16px;
        min-height: 44px;
    }

    .chore-btn.complete-btn {
        font-size: 22px;
        min-width: 48px;
        min-height: 48px;
    }

    /* More readable chore/activity text */
    .chore-name {
        font-size: 15px;
    }

    .chore-bp {
        font-size: 13px;
    }

    .chore-status-icon {
        font-size: 18px;
    }

    /* Section headers */
    .section-header h2 {
        font-size: 18px;
    }

    /* Clock widget */
    .clock-time {
        font-size: 40px;
    }

    /* Rewards grid - wider items */
    .rewards-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    /* PIN modal fits mobile screen */
    .pin-content {
        padding: 20px;
        max-width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
    }

    .num-btn {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }

    .numpad {
        gap: 10px;
    }
}

/* Landscape phones — height ≤ 500px catches phones in landscape without affecting tablets */
@media screen and (max-height: 500px) {
    html, body {
        overflow-y: auto;
        height: auto;
    }

    body {
        padding: 6px;
    }

    /* Same single-column stacking as portrait */
    .dashboard-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
        gap: 8px;
    }

    .main-content {
        order: 1;
        height: auto;
        overflow: visible;
    }

    .right-column {
        order: 2;
        height: auto;
        overflow: visible;
        gap: 8px;
    }

    .sidebar {
        order: 3;
        height: auto;
        overflow: visible;
    }

    .chores-section {
        flex: none;
    }

    .rewards-activity-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    /* In landscape, kids can sit 2-up */
    .kids-container {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .kid-name {
        font-size: 15px;
    }

    .points-display {
        font-size: 28px;
    }

    .points-label {
        font-size: 12px;
    }

    .minus-btn, .plus-btn {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }

    .end-of-day-btn {
        font-size: 11px;
        padding: 6px 8px;
        height: auto;
        margin-top: 4px;
    }

    .chore-btn {
        padding: 6px 12px;
        font-size: 15px;
        min-height: 40px;
    }

    .chore-btn.complete-btn {
        font-size: 20px;
        min-width: 44px;
        min-height: 44px;
    }

    .chore-name {
        font-size: 14px;
    }

    .chore-bp {
        font-size: 12px;
    }

    .section-header h2 {
        font-size: 16px;
    }

    /* PIN modal fits landscape screen */
    .pin-content {
        padding: 15px;
        max-width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
    }

    .num-btn {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    .numpad {
        gap: 8px;
    }
}
