@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --primary: #7b61ff;
    --primary-hover: #6b4ff5;
    --primary-light: rgba(123, 97, 255, 0.1);
    
    /* Pure Black & White */
    --bg-app: #000000;
    --bg-panel: #0a0a0a;
    --bg-elevated: #141414;
    --bg-input: #1a1a1a;
    --bg-hover: rgba(123, 97, 255, 0.05);
    
    /* Borders - Minimal */
    --border-subtle: #1a1a1a;
    --border-medium: #2a2a2a;
    --border-strong: #3a3a3a;
    
    /* Text - High Contrast */
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --text-muted: #666666;
    
    /* Status Colors */
    --success: #00d4aa;
    --success-bg: rgba(0, 212, 170, 0.15);
    --warning: #ffd166;
    --warning-bg: rgba(255, 209, 102, 0.15);
    --danger: #ff6b6b;
    --danger-bg: rgba(255, 107, 107, 0.15);
    
    /* Shift Colors */
    --shift-morning: #ffd166;
    --shift-evening: #a78bfa;
    --shift-overnight: #60a5fa;
    --shift-closing: #c084fc;
    --shift-monthly: #f472b6;
    
    /* Layout */
    --sidebar-width: 280px;
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
}

[data-theme="light"] {
    /* Pure White */
    --bg-app: #ffffff;
    --bg-panel: #ffffff;
    --bg-elevated: #fafafa;
    --bg-input: #f5f5f5;
    --bg-hover: rgba(123, 97, 255, 0.05);
    
    /* Borders */
    --border-subtle: #f0f0f0;
    --border-medium: #e0e0e0;
    --border-strong: #d0d0d0;
    
    /* Text */
    --text-primary: #000000;
    --text-secondary: #4d4d4d;
    --text-muted: #999999;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

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

body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
    background: var(--bg-app); 
    color: var(--text-primary); 
    line-height: 1.6; 
    font-size: 13px;
    font-weight: 400;
    height: 100vh; 
    overflow: hidden;
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: -0.01em;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.icon-sm { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

.app-container { display: flex; height: 100vh; width: 100vw; }

/* --- SIDEBAR --- */
.sidebar { 
    width: var(--sidebar-width); 
    background: var(--bg-panel); 
    border-right: 1px solid var(--border-subtle);
    display: flex; 
    flex-direction: column; 
    height: 100vh; 
    z-index: 50;
}

.sidebar-header { 
    padding: 32px 24px 24px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex; 
    align-items: center; 
    gap: 16px;
}

.logo-box {
    width: 40px; 
    height: 40px;
    background: var(--primary);
    color: white; 
    border-radius: var(--radius);
    display: flex; 
    align-items: center; 
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    font-weight: 700;
}

.sidebar-title { 
    font-size: 15px; 
    font-weight: 600; 
    color: var(--text-primary); 
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.sidebar-subtitle { 
    font-size: 13px; 
    color: var(--text-muted); 
    margin-top: 2px; 
    font-weight: 500;
}

.sidebar-content { 
    flex: 1; 
    overflow-y: auto; 
    padding: 24px; 
    -webkit-overflow-scrolling: touch; 
}

.sidebar-section { margin-bottom: 32px; }

.section-title { 
    font-size: 11px; 
    font-weight: 700; 
    text-transform: uppercase; 
    color: var(--text-muted); 
    margin-bottom: 12px; 
    letter-spacing: 0.15em;
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    cursor: default;
}

.section-title.collapsible { cursor: pointer; }
.section-title.collapsible:hover { color: var(--text-secondary); }
.section-title .arrow { transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1); font-size: 10px; }
.sidebar-section.collapsed .arrow { transform: rotate(-90deg); }
.sidebar-section.collapsed .section-content { display: none; }

.nav-item {
    display: flex; 
    align-items: center; 
    gap: 12px;
    padding: 10px 12px; 
    border-radius: var(--radius-sm);
    cursor: pointer; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 13px; 
    font-weight: 500;
    color: var(--text-secondary); 
    margin-bottom: 4px; 
    min-height: 44px;
}

.nav-item:hover { 
    background: var(--bg-hover); 
    color: var(--text-primary);
}

.nav-item.active { 
    background: var(--primary-light); 
    color: var(--primary); 
    font-weight: 600;
}

.btn {
    background: var(--primary); 
    color: white; 
    border: none;
    padding: 16px 24px; 
    border-radius: var(--radius);
    cursor: pointer; 
    font-size: 14px; 
    font-weight: 600;
    letter-spacing: -0.01em;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%; 
    display: flex;
    align-items: center; 
    justify-content: center; 
    gap: 10px;
    min-height: 56px;
}

.btn:hover { 
    background: var(--primary-hover); 
    transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

.btn-secondary {
    background: transparent; 
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover { 
    background: var(--bg-hover); 
    border-color: var(--text-primary);
}

.theme-toggle {
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 12px 16px; 
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 1px solid var(--border-medium);
    color: var(--text-primary); 
    margin-top: auto; 
    min-height: 48px; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
}

.theme-toggle:hover { 
    background: var(--bg-hover); 
    border-color: var(--border-strong);
}

/* --- MAIN CONTENT & TOP BAR --- */
.main-content { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
    position: relative; 
}

.top-bar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 48px;
    height: 88px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
    flex-shrink: 0;
}

.view-header {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 200px;
    gap: 8px;
}

.view-title {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.03em;
    color: var(--text-primary);
}

.date-display {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.task-count {
    background: var(--primary-light);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
}

.progress-section {
    flex: 1;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-header span:first-child {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.15em;
}

.progress-header span:last-child {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.progress-track {
    background: var(--border-medium);
    height: 8px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

[data-theme="light"] .progress-track {
    background: var(--border-subtle);
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    border-radius: 8px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.day-tabs {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.day-tab {
    padding: 10px 20px;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 1px solid transparent;
}

.day-tab:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

.day-tab.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.search-box {
    width: 300px;
    background: var(--bg-input);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    height: 48px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 400;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-box::placeholder {
    color: var(--text-muted);
}

.search-box:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-elevated);
}

/* --- TASK LIST & ELEMENTS --- */
.task-list-container { 
    flex: 1; 
    overflow-y: auto; 
    padding: 32px 48px; 
    position: relative; 
    -webkit-overflow-scrolling: touch; 
}

.task-loader {
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: var(--bg-app); 
    z-index: 10;
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center;
    color: var(--text-muted); 
    opacity: 0; 
    pointer-events: none; 
    transition: opacity 0.3s;
}
.task-loader.visible { opacity: 1; pointer-events: all; }

.task-section { 
    margin-bottom: 40px; 
    background: var(--bg-panel); 
    border-radius: var(--radius-lg); 
    border: 1px solid var(--border-subtle);
    overflow: visible;
}

.task-list {
    overflow: visible;
    position: relative;
}

.section-header {
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    padding: 20px 32px;
    cursor: pointer; 
    user-select: none;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-header:hover { 
    background: var(--bg-hover); 
}

.collapse-icon { 
    font-size: 14px; 
    color: var(--text-muted); 
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    margin-right: 12px;
    font-weight: 600;
}
.task-section.collapsed .collapse-icon { transform: rotate(-90deg); }
.task-section.collapsed .task-list { display: none; }

.shift-badge { 
    width: 12px; 
    height: 12px; 
    border-radius: 50%; 
    margin-right: 12px; 
    display: inline-block;
}

.shift-badge.morning { background: var(--shift-morning); }
.shift-badge.evening { background: var(--shift-evening); }
.shift-badge.overnight { background: var(--shift-overnight); }
.shift-badge.closing { background: var(--shift-closing); }
.shift-badge.monthly { background: var(--shift-monthly); }

.task-grid-template {
    display: grid; 
    grid-template-columns: 40px 1fr 200px 120px 100px 50px; 
    align-items: center; 
    gap: 16px;
}

.task-list-header {
    padding: 12px 32px; 
    background: transparent;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 11px; 
    font-weight: 700; 
    text-transform: uppercase;
    color: var(--text-muted); 
    letter-spacing: 0.15em;
}

.header-sortable { 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 6px; 
}
.header-sortable:hover { color: var(--text-secondary); }

.task-row {
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: visible;
    z-index: 1;
}

.task-row:last-child { border-bottom: none; }

.task-row:hover { 
    background: var(--bg-hover);
    z-index: 10;
}

.task-row.completed { opacity: 0.5; }
.task-row.completed .task-name { 
    text-decoration: line-through; 
    color: var(--text-muted); 
}

.checkbox-input {
    width: 24px; 
    height: 24px; 
    border: 2px solid var(--border-strong);
    border-radius: 6px;
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}

.checkbox-input:hover { 
    border-color: var(--primary);
}

.checkbox-input.checked { 
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-input.checked::after { 
    content: '✓'; 
    color: white; 
    font-size: 14px; 
    font-weight: 700;
}

.task-name { 
    font-weight: 500; 
    font-size: 14px; 
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.task-meta { 
    font-size: 13px; 
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
}

.assignee-avatar {
    width: 28px; 
    height: 28px; 
    border-radius: 50%; 
    background: var(--primary);
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 12px; 
    font-weight: 600; 
    color: white; 
    flex-shrink: 0;
}

.assignee-cell, .priority-cell {
    position: relative;
    overflow: visible;
}

.priority-badge { 
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.priority-badge.High { 
    background: var(--danger-bg); 
    color: var(--danger); 
}

.priority-badge.Medium { 
    background: var(--warning-bg); 
    color: var(--warning);
}

.priority-badge.Low { 
    background: var(--bg-elevated); 
    color: var(--text-muted);
}

.status-badge { 
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.status-badge.Pending { 
    background: var(--warning-bg); 
    color: var(--warning); 
}

.status-badge.Completed { 
    background: var(--success-bg); 
    color: var(--success); 
}

.notes-btn {
    width: 36px; 
    height: 36px; 
    border-radius: 50%; 
    border: 1px solid var(--border-medium);
    background: transparent; 
    color: var(--text-muted); 
    cursor: pointer;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative; 
}

.notes-btn:hover { 
    background: var(--bg-hover); 
    color: var(--primary); 
    border-color: var(--primary);
}

.notes-btn.has-notes { 
    background: var(--primary-light); 
    color: var(--primary); 
    border-color: var(--primary);
}

.sticky-note {
    position: absolute; 
    right: 60px; 
    top: 10px; 
    z-index: 100;
    background: var(--bg-panel); 
    border: 1px solid var(--border-medium);
    border-radius: var(--radius);
    padding: 16px; 
    width: 320px;
    display: none;
}
.sticky-note.visible { display: block; animation: fadeIn 0.2s ease; }

/* DROPDOWNS */
.c-dropdown { 
    position: relative; 
    width: 100%; 
    cursor: pointer; 
    overflow: visible;
}

.c-dropdown.active {
    z-index: 100;
}

.c-dropdown-trigger {
    display: flex; 
    align-items: center; 
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    min-height: 36px;
}

.c-dropdown-trigger:hover { 
    background: var(--bg-hover);
}

.c-dropdown-menu {
    position: absolute; 
    top: 100%; 
    left: 0; 
    width: 100%; 
    min-width: 200px;
    background: var(--bg-elevated); 
    border: 1px solid var(--border-medium);
    border-radius: var(--radius);
    z-index: 1000; 
    max-height: 280px; 
    overflow-y: auto;
    display: none; 
    animation: fadeIn 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 4px;
}
.c-dropdown-menu.active { display: block; }

.c-dropdown-item {
    display: flex; 
    align-items: center; 
    gap: 12px;
    padding: 12px 16px;
    font-size: 13px; 
    font-weight: 500;
    color: var(--text-primary);
    transition: background 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.c-dropdown-item:hover { 
    background: var(--bg-hover);
}

.team-list-item {
    display: flex; 
    align-items: center; 
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary); 
    font-size: 13px;
    font-weight: 500;
}
.team-list-item:hover { 
    background: var(--bg-hover); 
    color: var(--text-primary);
}

/* MODALS */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 2000; 
    align-items: center; 
    justify-content: center; 
}
.modal.visible { display: flex; animation: fadeIn 0.2s; }

.modal-card { 
    background: var(--bg-panel); 
    padding: 32px;
    border-radius: var(--radius-lg); 
    border: 1px solid var(--border-medium);
    width: 480px; 
    max-width: 90%; 
    color: var(--text-primary);
}

.form-input {
    width: 100%; 
    padding: 14px 16px;
    margin-bottom: 16px; 
    border-radius: var(--radius-sm); 
    border: 1px solid var(--border-medium);
    background: var(--bg-input); 
    color: var(--text-primary); 
    outline: none; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 13px;
    font-weight: 400;
}

.form-input:focus { 
    border-color: var(--primary); 
    background: var(--bg-elevated);
}

.lbl {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
    margin-top: 16px;
    letter-spacing: 0.15em;
}

.toast {
    position: fixed; 
    top: 24px; 
    right: 24px;
    background: var(--bg-elevated); 
    border: 1px solid var(--border-medium);
    border-radius: var(--radius);
    padding: 16px 24px;
    display: none; 
    align-items: center; 
    gap: 12px; 
    z-index: 3000; 
    color: var(--text-primary);
    font-weight: 500;
}
.toast.visible { display: flex; animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { 
    from { transform: translateX(400px); opacity: 0; } 
    to { transform: translateX(0); opacity: 1; } 
}

.mobile-menu-btn {
    display: none; 
    background: transparent; 
    border: none; 
    color: var(--text-primary);
    cursor: pointer; 
    padding: 8px; 
    margin-right: 12px;
}

.sidebar-overlay {
    display: none; 
    position: fixed; 
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 40; 
    opacity: 0; 
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar-overlay.visible { display: block; opacity: 1; }

/* ⭐ SKELETON LOADER */
.skeleton-section {
    margin-bottom: 40px;
    background: var(--bg-panel);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    padding: 20px;
}

.skeleton-header {
    height: 48px;
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    animation: shimmer 1.5s infinite;
}

.skeleton-row {
    height: 72px;
    background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
    background-size: 200% 100%;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ⭐ UPDATE BANNER */
.update-banner {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 16px 24px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    z-index: 3000;
    min-width: 400px;
    animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 13px;
    font-weight: 500;
}

.update-banner.visible {
    display: flex;
}

@keyframes slideDown {
    from {
        transform: translateX(-50%) translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* ⭐ ENHANCED PAST LOGS MODAL */
.modal-card-large {
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 32px 40px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-panel);
    flex-shrink: 0;
}

.history-controls {
    display: flex;
    gap: 16px;
    padding: 20px 40px;
    align-items: center;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.history-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: var(--bg-panel);
}

.history-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 80px 20px;
}

.history-footer {
    padding: 20px 40px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-panel);
    text-align: center;
    flex-shrink: 0;
}

.history-stats-section {
    padding: 40px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
}

.history-tasks-section {
    padding: 40px;
}

.history-shift-group {
    margin-bottom: 40px;
}

.history-shift-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.history-shift-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: -0.01em;
}

.history-task-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px 24px;
    margin-bottom: 12px;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    border: 1px solid var(--border-subtle);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.history-task-item:hover {
    background: var(--bg-hover);
}

.history-task-check {
    color: var(--success);
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
    font-weight: 700;
}

.history-task-content {
    flex: 1;
}

.history-task-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.history-task-meta {
    font-size: 14px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-weight: 500;
}

.history-task-note {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--primary-light);
    border-left: 2px solid var(--primary);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 400;
}

@media print {
    .modal, .modal-card-large {
        position: static;
        width: 100%;
        height: auto;
        max-width: none;
        max-height: none;
        background: white;
    }
    
    .history-header button,
    .history-controls,
    .history-footer {
        display: none !important;
    }
    
    .history-content {
        overflow: visible;
        height: auto;
    }
}

/* ================================================
   MOBILE RESPONSIVE (≤ 768px)
   ================================================ */
@media (max-width: 768px) {
    .sidebar {
        position: fixed; 
        left: -100%; 
        top: 0; 
        bottom: 0;
        width: 85%; 
        max-width: 320px; 
        z-index: 50;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .sidebar.open { left: 0; }
    
    .mobile-menu-btn { 
        display: flex; 
        align-items: center; 
        justify-content: center;
        min-width: 44px; 
        min-height: 44px; 
        margin-right: 8px; 
        flex-shrink: 0;
    }
    
    .main-content { width: 100%; }
    
    .top-bar {
        padding: 16px 20px;
        height: auto;
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto auto auto;
        gap: 16px 12px;
        align-items: center;
    }

    .mobile-menu-btn {
        grid-row: 1;
        grid-column: 1;
        margin-right: 0;
    }

    .view-header {
        grid-row: 1;
        grid-column: 2;
        width: 100%;
        min-width: 0;
    }

    .view-title {
        font-size: 24px;
        letter-spacing: -0.02em;
    }

    .date-display {
        font-size: 13px;
    }

    .progress-section {
        grid-row: 2;
        grid-column: 1 / -1;
        margin: 0;
        max-width: 100%;
        width: 100%;
    }

    .day-tabs {
        grid-row: 3;
        grid-column: 1 / -1;
        overflow-x: auto;
        width: calc(100% + 40px);
        margin: 0 -20px;
        padding: 4px 20px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .day-tabs::-webkit-scrollbar {
        display: none;
    }

    .day-tab {
        min-width: 80px;
        padding: 10px 18px;
    }

    .search-box {
        grid-row: 4;
        grid-column: 1 / -1;
        width: 100%;
        font-size: 16px;
        height: 48px;
    }

    .task-list-container {
        padding: 24px 20px;
    }
    
    .task-list-header { display: none; }
    .task-grid-template { display: block; }
    
    .task-row {
        display: flex; 
        flex-direction: column;
        padding: 20px; 
        margin: 0 0 16px 0;
        border-radius: var(--radius);
        border: 1px solid var(--border-subtle);
        background: var(--bg-elevated);
    }
    .task-row:last-child { border-bottom: 1px solid var(--border-subtle); }
    
    .task-row > div:first-child { position: absolute; top: 20px; left: 20px; }
    .task-row > div:nth-child(2) { margin-left: 44px; margin-bottom: 16px; }
    .task-name { font-size: 16px; font-weight: 600; line-height: 1.4; }
    
    .task-row > div:nth-child(3) { order: 1; }
    .task-row > div:nth-child(4) { order: 2; display: flex !important; align-items: center; gap: 8px; }
    .task-row > div:nth-child(5) { display: none; }
    .task-row > div:nth-child(6) { order: 3; margin-left: auto; }
    
    .task-row > div:nth-child(7) { position: absolute; top: 20px; right: 20px; }
    .status-badge { font-size: 13px; padding: 6px 14px; order: 4; margin-top: 12px; align-self: flex-start; }
    
    .modal-card { 
        width: 100%; 
        height: 100%; 
        max-width: 100%; 
        max-height: 100%; 
        border-radius: 0; 
    }
    
    .modal-card-large {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .history-header,
    .history-controls,
    .history-stats-section,
    .history-tasks-section {
        padding: 20px;
    }
}
