:root {
    --bg-base: #f8fafc; /* Lighter Slate 50 for max background brightness */
    --bg-glass: rgba(255, 255, 255, 0.85); /* More opaque white for panels */
    --bg-glass-hover: rgba(255, 255, 255, 1);
    --border-color: rgba(0, 0, 0, 0.2); /* Stronger borders */
    --primary-color: #2563eb; /* Darker, punchier blue for contrast */
    --primary-glow: rgba(37, 99, 235, 0.4);
    --secondary-color: #7c3aed; /* Darker violet */
    --text-main: #0f172a; /* Slate 900 for almost black text */
    --text-muted: #475569; /* Slate 600 for darker muted text */
    --danger: #dc2626; /* Darker Red */
    --warning: #d97706; /* Darker Amber */
    --success: #059669; /* Darker Emerald */
    --drag-bg: rgba(0, 0, 0, 0.08); /* More visible drag background */
}

/* === Dark Theme === */
body.dark-theme {
    --bg-base: #0f172a;
    --bg-glass: rgba(30, 41, 59, 0.85);
    --bg-glass-hover: rgba(30, 41, 59, 1);
    --border-color: rgba(255, 255, 255, 0.12);
    --primary-color: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.35);
    --secondary-color: #a78bfa;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --drag-bg: rgba(255, 255, 255, 0.06);
}

/* Dark overrides for hardcoded colors */
body.dark-theme .glass-panel {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
}

body.dark-theme .header-title h1 {
    background: linear-gradient(135deg, #e2e8f0, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
}

body.dark-theme .input-wrapper {
    background: rgba(255, 255, 255, 0.06);
}

body.dark-theme .form-group input,
body.dark-theme .form-group select,
body.dark-theme .form-group textarea {
    background: rgba(255, 255, 255, 0.06);
}

body.dark-theme .form-group select option {
    background: #1e293b;
}

body.dark-theme .user-filter-select option {
    background: #1e293b;
}

body.dark-theme .task-item {
    background: rgba(30, 41, 59, 0.7);
}

body.dark-theme .task-item:hover {
    background: rgba(51, 65, 85, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
}

body.dark-theme .task-item.highlight {
    background: rgba(59, 130, 246, 0.15);
}

body.dark-theme .task-item.overdue-task {
    background: rgba(239, 68, 68, 0.12);
}

body.dark-theme .task-item.overdue-task:hover {
    background: rgba(239, 68, 68, 0.18);
}

body.dark-theme .badge {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-theme .task-count {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-theme .sidebar-btn {
    background: rgba(255, 255, 255, 0.04);
}

body.dark-theme .sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

body.dark-theme .icon-btn {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-theme .icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-theme .calendar-day.today {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-theme .calendar-day.has-due-date:hover,
body.dark-theme .calendar-day.has-overdue-date:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-theme .column-content.drag-over {
    background: rgba(255, 255, 255, 0.04);
}

body.dark-theme .column-content.drag-over.limit-reached {
    background: rgba(239, 68, 68, 0.08);
}

body.dark-theme .kanban-column {
    background: rgba(30, 41, 59, 0.6);
}

/* Auth container dark */
body.dark-theme .auth-container {
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

body.dark-theme .auth-box input {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

body.dark-theme .auth-buttons .btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

body.dark-theme .auth-buttons .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-theme .btn-google {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
}

body.dark-theme .btn-google:hover {
    background: rgba(255, 255, 255, 0.14);
}

/* Archive/Agenda rows dark */
body.dark-theme .archive-row,
body.dark-theme .agenda-task-row {
    background: rgba(255, 255, 255, 0.04);
}

body.dark-theme .archive-row:hover {
    background: rgba(255, 255, 255, 0.07);
}

body.dark-theme .agenda-task-row:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

body.dark-theme .agenda-task-row.row-overdue {
    background: rgba(239, 68, 68, 0.06);
}

body.dark-theme .agenda-task-row.row-today {
    background: rgba(59, 130, 246, 0.06);
}

body.dark-theme .archive-modal-count {
    background: rgba(255, 255, 255, 0.1);
}

/* User management dark */
body.dark-theme .user-row {
    background: rgba(255, 255, 255, 0.04);
}

body.dark-theme .user-row:hover {
    background: rgba(255, 255, 255, 0.07);
}

body.dark-theme .add-user-section input[type="text"] {
    background: rgba(255, 255, 255, 0.06);
}

/* Scrollbar dark */
body.dark-theme .kanban-board::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
}

body.dark-theme .kanban-board::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Theme toggle button */
.theme-toggle-btn {
    color: var(--text-muted);
    border-color: rgba(148, 163, 184, 0.3);
}

.theme-toggle-btn:hover {
    background: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.5);
}

.sync-btn {
    color: var(--primary-color);
}

.sync-btn:hover {
    background: var(--primary-glow);
    color: var(--primary-color);
}

.sidebar-btn.is-working {
    pointer-events: none;
    opacity: 0.7;
}

.sidebar-btn.is-working i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Smooth transition when toggling theme */
body {
    transition: background-color 0.3s ease, color 0.3s ease;
}

.glass-panel,
.kanban-column,
.task-item,
.sidebar-btn,
.icon-btn,
.input-wrapper,
.badge,
.task-count,
.auth-container,
.auth-box input,
.btn-google,
.sync-btn {
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Roboto', sans-serif;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Background Shapes for Glassmorphism */
.shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.6;
    animation: float 20s infinite alternate ease-in-out;
}

.shape-1 {
    top: -10%;
    left: 10%;
    width: 300px;
    height: 300px;
    background: var(--primary-color);
    animation-delay: 0s;
}

.shape-2 {
    bottom: -10%;
    right: 20%;
    width: 500px;
    height: 500px;
    background: var(--secondary-color);
    animation-delay: -5s;
}

.shape-3 {
    top: 40%;
    left: 50%;
    width: 350px;
    height: 350px;
    background: #ec4899; /* Pink 500 */
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(50px) scale(1.1); }
}

/* Glass Panel Utility */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05); /* Softer shadow for light mode */
}

/* Main Container */
.app-container {
    width: 100%;
    padding: 12px; /* Reduced padding from 24px */
    height: 100vh;
    display: flex;
    flex-direction: row; /* Layout changed to row to fit sidebar */
    gap: 16px; /* Reduced from 24px */
    z-index: 1;
}

.main-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    min-width: 0;
    max-width: 1160px;  /* matches 4 columns × 280px + 3 gaps */
    margin: 0 auto;
}

.sidebar {
    width: 300px; /* Made slightly narrower for better space usage */
    display: flex;
    flex-direction: column;
    gap: 16px; /* Reduced from 24px */
    flex-shrink: 0;
}

/* Calendar Widget */
.calendar-widget {
    padding: 12px; /* Reduced from 20px */
    border-radius: 12px; /* Reduced from 16px */
    display: flex;
    flex-direction: column;
    gap: 12px; /* Reduced from 16px */
}

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

.calendar-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.3);
}

.calendar-days-header {
    display: grid;
    grid-template-columns: 26px repeat(7, 1fr);
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.kw-header {
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.6;
    text-align: right;
    padding-right: 4px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: 26px repeat(7, 1fr);
    gap: 6px;
}

/* KW (Kalenderwoche) cell */
.calendar-kw {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 4px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    opacity: 0.55;
    user-select: none;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 8px;
    cursor: default;
    color: var(--text-main);
    position: relative;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.calendar-day.empty {
    visibility: hidden;
}

.calendar-day.today {
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
}

.calendar-day.selected {
    border-color: var(--primary-color);
    background: var(--primary-glow);
}

.calendar-day.has-due-date::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 6px;
    height: 6px;
    background: var(--warning);
    border-radius: 50%;
    box-shadow: 0 0 4px var(--warning);
}

.calendar-day.has-overdue-date::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 6px;
    height: 6px;
    background: var(--danger);
    border-radius: 50%;
    box-shadow: 0 0 4px var(--danger);
}

.calendar-day.has-due-date,
.calendar-day.has-overdue-date {
    cursor: pointer;
}

.calendar-day.has-due-date:hover,
.calendar-day.has-overdue-date:hover {
    background: rgba(255, 255, 255, 0.05);
}

.calendar-day.selected:hover {
    background: var(--primary-glow);
}

/* Header Section */
.app-header {
    border-radius: 16px; /* Reduced from 20px */
    padding: 16px 24px; /* Reduced from 24px 32px */
    display: flex;
    flex-direction: row;
    justify-content: flex-start; /* Changed from space-between to align content to the left */
    align-items: center;
    gap: 16px; /* Space between logo and text */
    flex-shrink: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.app-logo {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 6px var(--primary-glow));
    transition: transform 0.3s ease;
}

.app-logo:hover {
    transform: scale(1.05) rotate(-2deg);
}

.header-title {
    flex: 1;
}

.header-title h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #0f172a, #334155);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.date-display {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Input Section */
.input-section {
    width: 100%;
    max-width: 500px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.input-wrapper:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.icon-plus {
    position: absolute;
    left: 16px;
    color: var(--primary-color);
    font-size: 20px;
}

#task-input {
    width: 100%;
    background: transparent;
    border: none;
    padding: 10px 12px 10px 42px; /* Reduced padding */
    color: var(--text-main);
    font-size: 14px; /* Reduced slightly */
    outline: none;
}

/* Filter Section */
.filter-section {
    width: 100%;
    max-width: 250px;
}

.icon-filter {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 20px;
    pointer-events: none;
}

.user-filter-select {
    width: 100%;
    background: transparent;
    border: none;
    padding: 10px 12px 10px 42px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.user-filter-select option {
    background: var(--bg-base);
    color: var(--text-main);
}

#task-input::placeholder {
    color: var(--text-muted);
}

/* Kanban Board Layout */
.kanban-board {
    display: flex;
    gap: 12px; /* Reduced from 20px */
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px; /* Reduced from 12px */
}

/* Custom Scrollbar for Board */
.kanban-board::-webkit-scrollbar {
    height: 8px;
}
.kanban-board::-webkit-scrollbar-track {
    background: transparent;
}
.kanban-board::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
.kanban-board::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Columns */
.kanban-column {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 12px; /* Reduced from 16px */
    min-width: 250px; /* Reduced from 300px */
    max-width: 280px; /* Reduced from 320px */
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: border-color 0.3s ease;
}

.column-header {
    padding: 12px 16px; /* Reduced from 16px 20px */
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.column-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

/* Coloring Headers softly based on type */
#col-todo .column-header h2 { color: var(--primary-color); }
#col-wip .column-header h2 { color: var(--warning); }
#col-waiting .column-header h2 { color: var(--secondary-color); }
#col-done .column-header h2 { color: var(--success); }

.task-count {
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Error state for WIP limit */
.wip-container.limit-reached {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.05);
}

.wip-limit-exceeded .task-count {
    background: var(--danger);
    color: white;
}

/* Column Content (Dropzone) */
.column-content {
    padding: 12px; /* Reduced from 16px */
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px; /* Reduced from 12px */
    transition: background 0.3s ease;
    min-height: 100px; /* Reduced from 150px */
}

/* Custom Scrollbar for Columns */
.column-content::-webkit-scrollbar {
    width: 6px;
}
.column-content::-webkit-scrollbar-track {
    background: transparent;
}
.column-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Drop Highlights */
.column-content.drag-over {
    background: var(--drag-bg);
}

/* Over-the-limit WIP Column drag highlight */
.column-content.drag-over.limit-reached {
    background: rgba(239, 68, 68, 0.1);
    cursor: not-allowed;
}

/* Tasks */
.task-item {
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: 8px; /* Reduced from 12px */
    padding: 12px; /* Reduced from 16px */
    cursor: grab;
    display: flex;
    flex-direction: column;
    gap: 8px; /* Reduced from 12px */
    position: relative;
    user-select: none;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s, opacity 0.3s ease;
    animation: slideIn 0.3s ease-out forwards;
}

.task-item.dimmed {
    opacity: 0.3;
}

.task-item.highlight {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-glow);
    background: rgba(59, 130, 246, 0.1);
}

.task-item.overdue-task {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.2);
}

.task-item.overdue-task:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.3);
}

@keyframes slideIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.task-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.task-item.is-dragging {
    opacity: 0.4;
    cursor: grabbing;
    transform: scale(0.95);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.task-text {
    font-size: 15px;
    line-height: 1.4;
    word-break: break-word;
    color: var(--text-main);
}

/* Done items styling */
.done-column .task-item {
    opacity: 0.7;
}
.done-column .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Delete Button */
.delete-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    opacity: 0;
}

.task-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Toast Notification for errors */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--danger);
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    box-shadow: 0 10px 25px -5px rgba(239, 68, 68, 0.5);
    transition: bottom 0.4s cubic-bezier(0.68, -0.55, 0.26, 1.55);
    z-index: 1000;
}

.toast.show {
    bottom: 30px;
}

.toast i {
    font-size: 20px;
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    padding: 24px;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.show .modal-content {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h2 {
    font-size: 20px;
    color: var(--text-main);
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover {
    color: var(--danger);
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.form-group input,
.form-group select,
.form-group textarea {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-color);
}

.form-group select option {
    background: var(--bg-base); /* Needed for select options to be legible */
    color: var(--text-main);
}

.form-group textarea {
    resize: vertical;
}

.modal-footer {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #2563eb; /* Blue 600 */
}

/* Badges */
.task-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.badge i {
    font-size: 12px;
}

.badge.priority-high { border-left: 2px solid var(--danger); }
.badge.priority-medium { border-left: 2px solid var(--warning); }
.badge.priority-low { border-left: 2px solid var(--primary-color); }
.badge.completed-badge { border-left: 2px solid var(--success); color: var(--success); }

/* --- Sidebar Widget --- */
.sidebar-widget {
    padding: 16px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.current-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    color: var(--text-muted);
    font-size: 13px;
}

.current-user-info i {
    font-size: 20px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.current-user-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
    color: var(--text-main);
}

.sidebar-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* --- User Management Modal --- */
.add-user-section {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.add-user-section input[type="text"] {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.2s;
}

.add-user-section input[type="text"]:focus {
    border-color: var(--primary-color);
}

.user-color-picker {
    appearance: none;
    -webkit-appearance: none;
    width: 42px;
    height: 42px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    flex-shrink: 0;
}

.user-color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.user-color-picker::-webkit-color-swatch {
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.user-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(0,0,0,0.2);
    vertical-align: middle;
    margin-right: 6px;
    flex-shrink: 0;
}

.color-picker-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-right: 6px;
    flex-shrink: 0;
    cursor: pointer;
}

.user-list-color-picker-hidden {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2; /* Ensure it is clickable over the dot */
}

.color-picker-wrapper .user-color-dot {
    position: absolute;
    top: 0;
    left: 0;
    margin-right: 0; 
    width: 100%;
    height: 100%;
    pointer-events: none; /* Ignore clicks so the input catches them */
    z-index: 1;
}

.users-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

/* Custom Scrollbar for Users List */
.users-list::-webkit-scrollbar {
    width: 6px;
}
.users-list::-webkit-scrollbar-track {
    background: transparent;
}
.users-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: background 0.2s;
}

.user-row:hover {
    background: rgba(255, 255, 255, 0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-main);
}

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

.user-actions button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: color 0.2s;
}

.user-actions .edit-user-btn:hover {
    color: var(--primary-color);
}

.auth-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    z-index: 50;
    transition: opacity 0.3s ease, transform 0.3s ease;
    background: rgba(255, 255, 255, 0.95); /* Extremely opaque */
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
}

.auth-container.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -48%) scale(0.95);
}

.auth-container h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.auth-error {
    width: 100%;
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.4);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--danger);
    text-align: center;
    animation: errorShake 0.35s ease;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25%       { transform: translateX(-6px); }
    75%       { transform: translateX(6px); }
}


.auth-box {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-box input {
    width: 100%;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-main);
    font-size: 15px;
    outline: none;
    transition: all 0.2s;
}

.auth-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.auth-buttons {
    display: flex;
    gap: 12px;
}

.auth-buttons button {
    flex: 1;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.auth-buttons .btn-primary {
    background: var(--primary-color);
    color: white;
}

.auth-buttons .btn-primary:hover {
    background: #2563eb;
    transform: translateY(-2px);
}

.auth-buttons .btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.auth-buttons .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    margin: 8px 0;
}

.auth-divider::before, 
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
    padding: 0 10px;
}

.btn-google {
    background: white;
    color: #333;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    width: 100%;
}

.btn-google:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
}

/* Misc Utilities */
.hidden {
    display: none !important;
}

.app-wrap {
    width: 100%;
    height: 100%;
    transition: opacity 0.5s ease;
}

.app-wrap.hidden {
    opacity: 0;
    pointer-events: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logout-btn {
    width: auto;
    padding: 10px 16px;
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.5);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    body {
        min-height: 100vh;
        height: auto;
        display: block; /* Release flex lock */
        overflow-y: auto;
    }

    .app-wrap {
        min-height: 100vh;
        height: auto;
        display: block; /* Allow contents to push down correctly */
    }

    .app-container {
        flex-direction: column;
        padding: 16px;
        height: auto;
        min-height: 100vh;
        gap: 24px;
        overflow-y: visible; /* Prevent any hiding of pushed elements */
    }

    .main-content {
        flex: none; /* Do not force remaining space */
        height: auto;
        gap: 20px;
    }

    .sidebar {
        width: 100%;
        order: -1; /* Pushes the calendar above the board on mobile */
        flex: none;
        margin-bottom: 24px;
    }

    .app-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        padding: 20px;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
    }

    .input-section {
        max-width: 100%;
        width: 100%;
    }
    
    .logout-btn {
        width: 100%;
        justify-content: center;
    }

    .kanban-board {
        flex-direction: column;
        overflow-x: hidden;
        overflow-y: visible;
        gap: 16px;
    }

    .kanban-column {
        min-width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 250px;
    }
    
    .column-content {
        max-height: 400px; /* Optional: Constrain height on really big columns so they scroll internally */
    }

    /* Modals */
    .modal-content {
        width: 95%;
        margin: 10px;
        padding: 20px;
        max-height: 85vh;
    }

    .form-row {
        flex-direction: column;
        gap: 16px;
    }

    /* Auth */
    .auth-container {
        width: 90%;
        padding: 24px;
    }
}

/* --- Task Actions (archive + delete button group) --- */
.task-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Archive button on done-column cards */
.archive-btn {
    background: transparent;
    border: none;
    color: var(--warning);
    font-size: 17px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    opacity: 0;
}
.task-item:hover .archive-btn { opacity: 1; }
.archive-btn:hover {
    color: #b45309;
    background: rgba(217, 119, 6, 0.12);
}

/* Sidebar archive button */
.archive-sidebar-btn {
    color: var(--warning);
    border-color: rgba(217, 119, 6, 0.3);
}
.archive-sidebar-btn:hover {
    background: rgba(217, 119, 6, 0.1);
    border-color: rgba(217, 119, 6, 0.5);
}

/* Archive count badge on sidebar button */
.archive-count-badge {
    background: var(--warning);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 2px 7px;
    border-radius: 99px;
    margin-left: 6px;
}

/* Archive count badge in modal heading */
.archive-modal-count {
    background: rgba(0, 0, 0, 0.12);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    padding: 3px 9px;
    border-radius: 99px;
    margin-left: 10px;
}

/* --- Archive Modal --- */
.archive-modal-content {
    max-width: 620px;
    width: 100%;
}
.archive-modal-content .modal-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.archive-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 460px;
    overflow-y: auto;
    padding-right: 4px;
}
.archive-list::-webkit-scrollbar { width: 6px; }
.archive-list::-webkit-scrollbar-track { background: transparent; }
.archive-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 10px; }

.archive-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    gap: 12px;
    transition: background 0.2s;
}
.archive-row:hover { background: rgba(0, 0, 0, 0.07); }

.archive-row-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}
.archive-task-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.archive-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.archive-date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--success);
}
.archive-owner {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
}

.archive-row-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.restore-btn, .del-archive-btn {
    background: transparent;
    border: none;
    font-size: 17px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
}
.restore-btn { color: var(--primary-color); }
.restore-btn:hover { background: rgba(37, 99, 235, 0.1); }
.del-archive-btn { color: var(--text-muted); }
.del-archive-btn:hover { color: var(--danger); background: rgba(220, 38, 38, 0.1); }

/* Archive empty state */
.archive-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    color: var(--text-muted);
}
.archive-empty i { font-size: 48px; opacity: 0.4; }
.archive-empty p { font-size: 15px; }

/* --- Agenda Sidebar Button --- */
.agenda-sidebar-btn {
    color: var(--primary-color);
    border-color: rgba(37, 99, 235, 0.3);
}
.agenda-sidebar-btn:hover {
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.5);
}

/* --- Agenda Modal --- */
.agenda-modal-content {
    max-width: 640px;
    width: 100%;
}
.agenda-modal-content .modal-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.agenda-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 4px;
}
.agenda-list::-webkit-scrollbar { width: 6px; }
.agenda-list::-webkit-scrollbar-track { background: transparent; }
.agenda-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 10px; }

/* Date Group */
.agenda-date-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.agenda-date-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 4px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2px;
}

.agenda-date-label {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.agenda-date-label.is-today {
    color: var(--primary-color);
}
.agenda-date-label.is-overdue {
    color: var(--danger);
}

.agenda-date-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 99px;
    line-height: 1.4;
}
.agenda-date-badge.badge-today {
    background: var(--primary-color);
    color: #fff;
}
.agenda-date-badge.badge-overdue {
    background: var(--danger);
    color: #fff;
}

/* Agenda Task Row */
.agenda-task-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    animation: slideIn 0.25s ease-out forwards;
}
.agenda-task-row:hover {
    background: rgba(37, 99, 235, 0.06);
    border-color: rgba(37, 99, 235, 0.25);
    transform: translateX(3px);
}
.agenda-task-row.row-overdue {
    border-left: 3px solid var(--danger);
    background: rgba(220, 38, 38, 0.04);
}
.agenda-task-row.row-today {
    border-left: 3px solid var(--primary-color);
    background: rgba(37, 99, 235, 0.04);
}

.agenda-task-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.agenda-task-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agenda-task-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.agenda-status-chip {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    opacity: 0.85;
}
.agenda-status-chip.chip-todo   { background: rgba(37,99,235,0.12);  color: var(--primary-color); }
.agenda-status-chip.chip-wip    { background: rgba(217,119,6,0.12);  color: var(--warning); }
.agenda-status-chip.chip-waiting { background: rgba(124,58,237,0.12); color: var(--secondary-color); }
.agenda-status-chip.chip-done   { background: rgba(5,150,105,0.12);  color: var(--success); }

.agenda-priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.agenda-priority-dot.prio-high   { background: var(--danger); }
.agenda-priority-dot.prio-medium { background: var(--warning); }
.agenda-priority-dot.prio-low    { background: var(--primary-color); }

.agenda-owner-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
}

.agenda-open-icon {
    color: var(--text-muted);
    font-size: 16px;
    flex-shrink: 0;
}

/* Agenda Empty State */
.agenda-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    color: var(--text-muted);
}
.agenda-empty i { font-size: 48px; opacity: 0.35; }
.agenda-empty p { font-size: 15px; }
