@font-face {
    font-family: "HiraWeb";
    src: url("fonts/HW400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "HiraWeb";
    src: url("fonts/HW500.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "HiraWeb";
    src: url("fonts/HW600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "HiraWeb";
    src: url("fonts/HW700.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --bg-color: #f8fafc;
    --sidebar-bg: rgba(241, 245, 249, 0.85);
    --text-dark: #1e293b;
    --text-gray: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.08);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --hover-bg: rgba(0, 0, 0, 0.04);
    --card-bg: #ffffff;
    --input-bg: #f8fafc;
    --badge-completed-bg: rgba(0, 0, 0, 0.05);
    --badge-completed-color: #94a3b8;
    --date-overdue: #ef4444;
    --date-today: #f59e0b;
    --date-future: #3b82f6;
    --date-future-bg: rgba(59, 130, 246, 0.1);
    --label-bg: rgba(239, 68, 68, 0.1);
    --label-hover-bg: rgba(239, 68, 68, 0.2);
    --nav-active-bg: rgba(59, 130, 246, 0.1);
    --drag-handle-color: #cbd5e1;
    --toggle-bg: #cbd5e1;
    --google-btn-bg: #ffffff;
    --google-btn-border: #e2e8f0;
    --google-btn-color: #475569;
    --google-connected-bg: #f0fdf4;
    --google-connected-border: #bbf7d0;
    --google-connected-color: #166534;
    --subtask-edit-bg: #ffffff;
    --title-tag-bg: rgba(239, 68, 68, 0.1);
    --title-tag-color: #b91c1c;
    --date-tag-bg: rgba(59, 130, 246, 0.1);
    --date-tag-color: #1d4ed8;
    --focus-ring: rgba(59, 130, 246, 0.3);
    --today-filter-active-bg: rgba(59, 130, 246, 0.08);
    --today-filter-active-ring: rgba(59, 130, 246, 0.25);
    color-scheme: light;
}

[data-theme="dark"] {
    --primary: #60a5fa;
    --primary-hover: #93c5fd;
    --bg-color: #0f172a;
    --sidebar-bg: rgba(30, 41, 59, 0.75);
    --text-dark: #f8fafc;
    --text-gray: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --white: #1e293b;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
    --hover-bg: rgba(255, 255, 255, 0.06);
    --card-bg: #1e293b;
    --input-bg: #0f172a;
    --badge-completed-bg: rgba(255, 255, 255, 0.08);
    --badge-completed-color: #94a3b8;
    --date-overdue: #f87171;
    --date-today: #fbbf24;
    --date-future: #93c5fd;
    --date-future-bg: rgba(96, 165, 250, 0.15);
    --label-bg: rgba(248, 113, 113, 0.15);
    --label-hover-bg: rgba(248, 113, 113, 0.25);
    --nav-active-bg: rgba(96, 165, 250, 0.15);
    --drag-handle-color: #64748b;
    --toggle-bg: #475569;
    --google-btn-bg: #1e293b;
    --google-btn-border: #475569;
    --google-btn-color: #f8fafc;
    --google-connected-bg: rgba(34, 197, 94, 0.15);
    --google-connected-border: rgba(74, 222, 128, 0.3);
    --google-connected-color: #86efac;
    --subtask-edit-bg: #0f172a;
    --title-tag-bg: rgba(248, 113, 113, 0.2);
    --title-tag-color: #fca5a5;
    --date-tag-bg: rgba(96, 165, 250, 0.2);
    --date-tag-color: #bfdbfe;
    --focus-ring: rgba(96, 165, 250, 0.3);
    --today-filter-active-bg: rgba(96, 165, 250, 0.15);
    --today-filter-active-ring: rgba(96, 165, 250, 0.35);
    color-scheme: dark;
}

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

html {
    background-color: var(--bg-color);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-dark);
    display: flex;
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.fonts-loaded body {
    font-family: "HiraWeb", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-thumb {
    background: rgba(120, 130, 145, 0.28);
    border: 3px solid transparent;
    border-radius: var(--radius-full);
    background-clip: padding-box;
}

input,
textarea,
[contenteditable="true"] {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    height: 100vh;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    border-right: 1px solid var(--border-color);
}

.user-profile {
    display: flex;
    align-items: center;
    padding: 0 0 16px;
    font-weight: 500;
}

.user-profile-button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 40px;
    padding: 6px 8px;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
}

#user-display {
    flex: 1;
    min-width: 0;
    order: 2;
}

.update-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: var(--radius-full);
    flex-shrink: 0;
    order: 1;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background-color: var(--border-color);
    background-size: cover;
    background-position: center;
    color: var(--text-gray);
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.add-task-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary);
    font-weight: 600;
    background: transparent;
    border: none;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition);
    width: 100%;
    text-align: left;
    font-size: 15px;
    min-height: 44px;
}

.add-task-btn .icon {
    background-color: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-size: 18px;
    line-height: 1;
    padding-bottom: 2px;
}

.nav-list {
    list-style: none;
    margin-top: 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-dark);
    transition: var(--transition);
    font-size: 14px;
}

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

.nav-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-count {
    font-size: 12px;
    color: var(--text-gray);
    min-width: 1.8em;
    text-align: right;
}

.nav-item.active .nav-count {
    color: var(--primary);
}

.nav-separator {
    height: 1px;
    margin: 8px 14px;
    background: var(--border-color);
}

.projects-section {
    margin-top: 24px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.projects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px 8px;
}

.projects-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-gray);
}

.projects-add-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
}

.project-menu-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.nav-item:hover .project-menu-btn,
.nav-item.active .project-menu-btn {
    opacity: 1;
}

.project-context-menu {
    position: fixed;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 1000;
    display: none;
    min-width: 160px;
    padding: 4px 0;
}

.project-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-dark);
    transition: background 0.15s;
}

.project-menu-item-danger {
    color: #dc3545;
}

/* Project Drag Reorder */
.project-dragging {
    background: var(--card-bg) !important;
    box-shadow: var(--shadow-lg) !important;
    border-radius: var(--radius-md) !important;
    transform: scale(1.03);
    opacity: 0.95;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.project-drag-placeholder {
    border: 2px dashed var(--primary);
    border-radius: var(--radius-md);
    background: rgba(67, 135, 210, 0.06);
    list-style: none;
    transition: height 0.15s ease;
}

/* Main Content Styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    position: relative;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0)) 0 0 / 100% 220px no-repeat,
        var(--bg-color);
}

[data-theme="dark"] .main-content {
    background:
        linear-gradient(180deg, rgba(27, 32, 48, 0.5), rgba(27, 32, 48, 0)) 0 0 / 100% 220px no-repeat,
        var(--bg-color);
}

.header {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 1020px;
    padding: 36px 44px 18px;
    margin: 0 auto;
    margin-bottom: 0;
    background-color: color-mix(in srgb, var(--bg-color) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

.sync-btn {
    margin-left: auto;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    width: 34px;
    height: 34px;
    padding: 0;
    cursor: pointer;
    color: var(--text-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sync-btn:hover {
    color: var(--text-gray);
    border-color: var(--border-color);
    background: none;
}

.sync-btn.syncing svg {
    animation: ptr-spin 0.7s linear infinite;
}

@media (max-width: 768px) {
    .sync-btn {
        display: none;
    }
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-dark);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    align-items: center;
    justify-content: center;
}

h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
}

/* Pull-to-refresh indicator */
.ptr-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    margin-bottom: -48px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(calc(var(--ptr-offset, 0px) - 48px));
    transition: transform 0.18s ease, opacity 0.18s ease;
    color: var(--text-gray);
    font-size: 13px;
    gap: 8px;
    pointer-events: none;
    will-change: transform, opacity;
}

.ptr-indicator.visible {
    opacity: 1;
}

.ptr-indicator.is-pulling {
    transition: opacity 0.12s ease;
}

.ptr-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: ptr-spin 0.7s linear infinite;
}

@keyframes ptr-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Task List */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 1020px;
    margin: 0 auto;
    padding: 0 44px 40px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    transform: translateY(var(--ptr-list-offset, 0px));
    transition: transform 0.18s ease;
    will-change: transform;
}

.task-list.is-pulling {
    transition: none;
}

.today-dashboard {
    padding: var(--today-dashboard-padding-y, 6px) 0 var(--today-dashboard-padding-bottom, 20px);
    margin: 0 0 calc(6px + var(--today-dashboard-collapse-space, 0px));
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg-color);
    transition: box-shadow 0.18s ease;
}

.today-dashboard.is-compact {
    box-shadow: 0 12px 24px -22px rgba(18, 28, 45, 0.65);
}

.today-dashboard.is-compact .today-dashboard-header,
.today-dashboard.is-compact .today-insights {
    pointer-events: none;
}

.today-dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: var(--today-header-margin-bottom, 16px);
    max-height: var(--today-header-max-height, 64px);
    opacity: var(--today-fade-opacity, 1);
    overflow: hidden;
}

.today-dashboard-kicker {
    color: var(--text-gray);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.today-dashboard-title {
    color: var(--text-dark);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.35;
}

.today-dashboard-date {
    color: var(--text-gray);
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 12px;
    padding: 5px 8px;
    white-space: nowrap;
}

.today-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.today-stat {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--today-stat-padding-y, 13px) 14px;
    min-height: var(--today-stat-min-height, 104px);
    display: flex;
    flex-direction: column;
    gap: var(--today-stat-gap, 6px);
    text-align: left;
    font: inherit;
    color: inherit;
}

button.today-stat {
    appearance: none;
    -webkit-appearance: none;
}

.today-stat-filter {
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.today-stat-filter:hover {
    box-shadow: var(--shadow-md);
}

.today-stat-filter:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.today-stat-filter.active {
    background: var(--today-filter-active-bg);
    border-color: var(--primary);
    box-shadow:
        inset 0 0 0 1px var(--primary),
        0 0 0 3px var(--today-filter-active-ring),
        var(--shadow-sm);
}

.today-stat span {
    color: var(--text-gray);
    font-size: 12px;
    font-weight: 600;
}

.today-stat strong {
    color: var(--text-dark);
    font-size: var(--today-stat-count-size, 28px);
    line-height: 1;
}

.today-stat small {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
    max-height: var(--today-stat-small-max-height, 34px);
    opacity: var(--today-stat-small-opacity, 1);
    overflow: hidden;
}

.today-stat-overdue strong {
    color: var(--date-overdue);
}

.today-stat-due strong,
.today-stat-today strong {
    color: var(--date-today);
}

.today-stat-completed strong {
    color: #2e7d32;
}

.today-insights {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 14px;
    color: var(--text-gray);
    font-size: 13px;
    line-height: 1.5;
    max-height: var(--today-insights-max-height, 120px);
    margin-top: var(--today-insights-margin-top, 14px);
    opacity: var(--today-fade-opacity, 1);
    overflow: hidden;
}

.today-insights div {
    min-width: 0;
}

.today-insights span {
    color: var(--text-dark);
    font-weight: 600;
    margin-right: 8px;
}

.task-item {
    display: flex;
    align-items: flex-start;
    padding: 16px 20px;
    border: 1px solid var(--border-color);
    gap: 14px;
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s ease;
}

@media (hover: hover) {
    .task-item:hover {
        box-shadow: var(--shadow-md);
        border-color: color-mix(in srgb, var(--primary) 30%, var(--border-color));
    }
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border: 1px solid var(--text-gray);
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 3px;
    transition: var(--transition);
    flex-shrink: 0;
}

.task-checkbox:hover {
    border-color: var(--text-gray);
    background-color: transparent;
}

.task-checkbox.priority-1 {
    border-color: #e11d48;
    border-width: 2px;
}

.task-checkbox.priority-1:hover {
    background-color: transparent;
}

.task-checkbox.priority-1.completed {
    background-color: #e11d48;
    border-color: #e11d48;
}

.task-checkbox.priority-2 {
    border-color: #f59e0b;
    border-width: 2px;
}

.task-checkbox.priority-2:hover {
    border-color: #f59e0b;
    background-color: transparent;
}

.task-checkbox.priority-2.completed {
    background-color: #f59e0b;
    border-color: #f59e0b;
}

.task-checkbox.priority-3 {
    border-color: var(--text-gray);
}

.task-checkbox.completed {
    background-color: var(--primary);
    border-color: var(--primary);
}

.task-checkbox.completed::after {
    content: "✓";
    color: white;
    font-size: 12px;
}

.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    min-width: 0;
}

.task-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-dark);
    line-height: 1.45;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-summary {
    color: var(--text-gray);
    font-size: 12px;
    line-height: 1.55;
    min-height: 5px;
    margin: -3px 0 4px 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    font-size: 12px;
    align-items: center;
}

.task-date {
    color: var(--primary);
    background: var(--date-future-bg);
    border-radius: 5px;
    padding: 2px 7px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.task-label {
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 22px;
}

.task-subtasks-count {
    color: var(--text-gray);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 22px;
    font-weight: 500;
}

.calendar-task-list {
    gap: 14px;
    overflow-x: hidden;
    overflow-y: auto;
    min-height: 0;
}

.calendar-task-list.calendar-month-task-list {
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
}

.calendar-toolbar {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 2px 0 8px;
}

.calendar-mode-group,
.calendar-period-controls {
    display: flex;
    align-items: center;
}

.calendar-mode-group {
    gap: 4px;
    padding: 4px;
    border-radius: var(--radius-full);
    background: var(--bg-color);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.calendar-period-controls {
    justify-content: center;
    gap: 8px;
    min-width: 0;
}

.calendar-period-controls-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    width: 100%;
}

.calendar-period-side {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-width: 0;
}

.calendar-mode-btn,
.calendar-icon-btn,
.calendar-period-label,
.calendar-overdue-jump {
    border: 0;
    color: var(--text-dark);
    border-radius: 7px;
    cursor: pointer;
}

.calendar-mode-btn,
.calendar-icon-btn,
.calendar-period-label {
    background: transparent;
}

.calendar-mode-btn {
    min-height: 32px;
    padding: 4px 16px;
    color: var(--text-gray);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-full);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.calendar-mode-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 6px color-mix(in srgb, var(--primary) 35%, transparent);
}

[data-theme="dark"] .calendar-mode-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 6px color-mix(in srgb, var(--primary) 40%, transparent);
}

.calendar-icon-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    color: var(--text-gray);
    font-size: 22px;
    line-height: 1;
}

.calendar-icon-btn:hover,
.calendar-source-menu-btn:hover {
    background: var(--hover-bg);
}

.calendar-period-label {
    min-width: 0;
    max-width: 100%;
    padding: 4px 8px;
    color: var(--text-dark);
    font-size: 15px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-period-picker-wrap {
    position: relative;
    display: inline-flex;
    min-width: 0;
    max-width: 100%;
}

.calendar-month-picker {
    position: absolute;
    inset: auto auto 0 50%;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.calendar-overdue-jump {
    flex-shrink: 0;
    min-height: 28px;
    padding: 3px 9px;
    border: 1px solid rgba(211, 47, 47, 0.28);
    border-radius: var(--radius-full);
    background: rgba(211, 47, 47, 0.08);
    color: var(--date-overdue);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.calendar-overdue-jump.is-hidden {
    pointer-events: none;
    visibility: hidden;
}

.calendar-source-menu {
    position: relative;
}

.calendar-source-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-gray);
    cursor: pointer;
    list-style: none;
}

.calendar-source-menu-btn::-webkit-details-marker {
    display: none;
}

.calendar-source-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: min(320px, calc(100vw - 32px));
    max-height: min(420px, 70vh);
    overflow: auto;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: var(--shadow-lg);
    z-index: 40;
}

.calendar-source-title {
    color: var(--text-gray);
    font-size: 12px;
    font-weight: 600;
}

.calendar-source-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
    padding-top: 12px;
}

.calendar-source-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 220px;
    min-height: 28px;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    color: var(--text-dark);
    font-size: 12px;
    cursor: pointer;
}

.calendar-source-option span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-source-swatch {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.calendar-google-error {
    flex-basis: 100%;
    color: var(--date-overdue);
    font-size: 12px;
}

.calendar-google-error button {
    margin-left: 8px;
    color: var(--primary);
    border: 0;
    background: transparent;
    cursor: pointer;
    font-weight: 700;
}

.calendar-list-scroll,
.calendar-week-scroll {
    flex: 1;
    min-height: 420px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.calendar-list-view {
    display: grid;
    grid-auto-columns: 300px;
    grid-auto-flow: column;
    gap: 28px;
    width: max-content;
    height: 100%;
}

.calendar-week-view {
    display: grid;
    grid-template-columns: repeat(7, 260px);
    gap: 28px;
    width: max-content;
    height: 100%;
}

.calendar-day-section,
.calendar-week-day {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    height: 100%;
    min-height: 0;
    padding: 12px;
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--border-color) 30%, transparent);
}

.calendar-day-section.today,
.calendar-week-day.today {
    background: color-mix(in srgb, var(--primary) 9%, transparent);
    box-shadow: none;
}

.calendar-day-section.overdue {
    background: rgba(211, 47, 47, 0.08);
}

.calendar-day-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.calendar-day-section h2,
.calendar-week-day h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-dark);
    font-size: 15px;
    line-height: 1.35;
}

.calendar-day-section h2 span,
.calendar-week-day h2 span {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
}

.calendar-day-items {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--border-color);
    min-height: 44px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    touch-action: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
    padding-right: 4px;
}

.calendar-entry {
    display: grid;
    grid-template-columns: 48px auto minmax(0, 1fr);
    gap: 10px;
    align-items: flex-start;
    flex-shrink: 0;
    position: relative;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.calendar-entry-google {
    grid-template-columns: 48px minmax(0, 1fr);
    margin: 5px 0;
    padding: 5px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.calendar-entry-todo,
.calendar-entry-subtask {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "check body";
    margin: 8px 0;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.calendar-entry-todo .task-checkbox,
.calendar-entry-subtask .calendar-subtask-dot {
    grid-area: check;
    align-self: start;
    margin-top: 1px;
}

.calendar-entry-todo .calendar-entry-body,
.calendar-entry-subtask .calendar-entry-body {
    grid-area: body;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.calendar-entry-task-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    margin: 0;
    padding: 0;
    line-height: 1;
}

.calendar-meta-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 24px;
    margin: 0;
    padding: 3px 7px;
    border-radius: 5px;
    color: var(--primary);
    font-size: 12px;
    line-height: 18px;
    white-space: nowrap;
}

.calendar-meta-pill svg {
    flex-shrink: 0;
}

.calendar-meta-date {
    background: var(--date-future-bg);
    font-weight: 600;
}

.calendar-meta-date.calendar-date-overdue {
    background: rgba(211, 47, 47, 0.1);
    color: var(--date-overdue);
}

.calendar-meta-date.calendar-date-today {
    background: rgba(245, 124, 0, 0.12);
    color: var(--date-today);
}

.calendar-meta-date.calendar-date-future {
    background: var(--date-future-bg);
    color: var(--date-future);
}

.calendar-meta-label {
    cursor: default;
}

.calendar-meta-repeat {
    background: var(--hover-bg);
    color: var(--text-gray);
    font-weight: 600;
}

.calendar-entry.compact {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: center;
    gap: 2px;
    height: 18px;
    min-height: 18px;
    padding: 0 6px;
    margin: 0 0 2px;
    border: 0;
    border-radius: 4px;
    background: var(--bg-color);
    font-size: 11px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

@media (hover: hover) {
    .calendar-entry.compact:hover {
        box-shadow: var(--shadow-sm);
    }
}

.calendar-entry-google.compact {
    box-shadow: none;
    border: 1px solid color-mix(in srgb, var(--event-color, var(--primary)) 20%, transparent);
    background: color-mix(in srgb, var(--event-color, var(--primary)) 20%, var(--white));
}

.calendar-entry-todo.compact {
    box-shadow: none;
}

.calendar-entry-subtask.compact {
    box-shadow: none;
}

.calendar-entry-google.compact::before,
.calendar-entry-todo.compact::before,
.calendar-entry-subtask.compact::before {
    content: none;
}

.calendar-compact-source {
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
}

.calendar-compact-time {
    color: var(--text-gray);
    font-size: 10px;
}

.calendar-compact-title {
    min-width: 0;
    color: var(--text-dark);
    line-height: 16px;
    overflow: hidden;
    white-space: nowrap;
}

.calendar-source-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    background: var(--event-color, var(--primary));
    vertical-align: 1px;
}

.calendar-entry-time {
    color: var(--text-gray);
    font-size: 12px;
    line-height: 22px;
    white-space: nowrap;
}

.calendar-entry-body {
    min-width: 0;
}

.calendar-entry-title {
    color: var(--text-dark);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.calendar-entry.compact .calendar-entry-title {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
}

.calendar-entry-meta {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
    margin-top: 2px;
}

.calendar-subtask-dot {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 5px;
    margin-top: 1px;
}

.calendar-empty-text {
    color: var(--text-muted);
    font-size: 13px;
    padding: 12px 0;
}

.calendar-weekdays,
.calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays {
    color: var(--text-gray);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.calendar-month-grid {
    grid-template-rows: repeat(6, minmax(0, 1fr));
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
}

.calendar-month-swipe {
    padding-bottom: 24px;
    touch-action: pan-y;
}

.calendar-month-task-list .calendar-month-swipe {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    flex: 1;
    min-height: 0;
    padding-bottom: 0;
    overflow: hidden;
}

.calendar-month-task-list .calendar-month-grid {
    min-height: 0;
}

.calendar-month-cell {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 6px;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    background: var(--white);
    overflow: hidden;
    cursor: pointer;
    transition: background 0.16s ease;
}

@media (hover: hover) {
    .calendar-month-cell:hover {
        background: var(--hover-bg);
    }
}

.calendar-cell-items {
    min-height: 0;
    overflow: hidden;
}

.calendar-month-cell.muted {
    background: var(--bg-color);
    opacity: 0.62;
}

.calendar-month-cell.today {
    background: rgba(245, 158, 11, 0.05);
    /* very light tint */
}

.calendar-cell-date {
    color: var(--text-gray);
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
}

.calendar-month-cell.today .calendar-cell-date {
    background: var(--primary);
    color: var(--white);
}

.calendar-more {
    color: var(--text-muted);
    font-size: 11px;
    padding: 0 5px;
}

.inline-add {
    width: calc(100% - 88px);
    max-width: 932px;
    margin: 12px auto 40px;
    color: var(--text-gray);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background-color: var(--bg-color);
    position: relative;
    z-index: 1;
    transition: var(--transition);
}

.inline-add::before {
    content: "";
    position: absolute;
    left: 50%;
    bottom: calc(-40px - env(safe-area-inset-bottom, 0px));
    width: 100vw;
    height: calc(100% + 52px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-color);
    transform: translateX(-50%);
    z-index: -1;
    pointer-events: none;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--white);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    transform: translateY(20px);
    transition: transform 0.2s ease;
}

[data-theme="dark"] .modal {
    border: 1px solid var(--border-color);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

#task-modal .modal {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

#task-modal .modal-header {
    flex-shrink: 0;
    margin: 0;
    padding: 24px 24px 18px;
}

#task-modal .modal.is-editing .modal-header {
    min-height: 48px;
    padding: 12px 16px 4px 24px;
}

.task-modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 24px;
    -webkit-overflow-scrolling: touch;
}

.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.confirm-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.confirm-dialog {
    background: var(--white);
    width: calc(100% - 32px);
    max-width: 360px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 22px;
    transform: translateY(12px);
    transition: transform 0.2s ease;
}

[data-theme="dark"] .confirm-dialog {
    border: 1px solid var(--border-color);
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.confirm-overlay.active .confirm-dialog {
    transform: translateY(0);
}

.confirm-dialog h2 {
    margin: 0 0 8px;
    font-size: 18px;
    color: var(--text-dark);
}

.confirm-dialog p {
    margin: 0;
    color: var(--text-gray);
    font-size: 13px;
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.sync-conflict-dialog {
    display: flex;
    flex-direction: column;
    max-width: 680px;
    max-height: calc(100dvh - 32px);
    overflow: hidden;
}

.conflict-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 16px;
    min-height: 0;
}

.conflict-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-color);
}

.conflict-card-title {
    color: var(--text-dark);
    font-size: 13px;
    font-weight: 700;
}

.conflict-preview {
    min-height: 108px;
    max-height: min(42vh, 340px);
    color: var(--text-gray);
    font-size: 12px;
    line-height: 1.5;
    overflow-y: auto;
    overflow-wrap: anywhere;
    padding-right: 4px;
}

.conflict-preview strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text-dark);
    font-size: 14px;
}

.conflict-diff-list {
    display: grid;
    gap: 5px;
    margin: 8px 0 10px;
    padding: 8px;
    border-radius: 8px;
    background: var(--input-bg);
}

.conflict-diff-title {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}

.conflict-diff-row {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
}

.conflict-diff-row span {
    color: var(--text-muted);
}

.conflict-diff-row strong {
    display: block;
    margin: 0;
    color: var(--text-dark);
    font-size: 12px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.conflict-diff-more {
    color: var(--text-muted);
    font-size: 11px;
}

.conflict-meta {
    margin-top: 6px;
    color: var(--text-muted);
}

.modal-header {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal.is-editing .modal-header {
    height: 0;
    justify-content: flex-end;
}

.modal.is-editing .close-btn {
    transform: translateY(-6px);
}

#task-modal .modal.is-editing .close-btn {
    transform: none;
}

.modal-checkbox-wrapper {
    width: 22px;
    height: 22px;
    border: 2px solid var(--text-gray);
    border-radius: var(--radius-full);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.modal-checkbox-wrapper:hover {
    border-color: var(--text-gray);
    background-color: transparent;
}

.modal-checkbox-wrapper.completed {
    background-color: var(--primary);
    border-color: var(--primary);
}

.modal-checkbox-wrapper.completed::after {
    content: "✓";
    color: white;
    font-size: 13px;
}

.modal-checkbox-wrapper.priority-1 {
    border-color: #e11d48;
}

.modal-checkbox-wrapper.priority-2 {
    border-color: #f59e0b;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-gray);
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    line-height: 1;
    transition: var(--transition);
}

.close-btn:hover {
    background: transparent;
    color: var(--text-gray);
}

.form-group {
    margin-bottom: 16px;
}

/* --- Utility classes (extracted from inline styles) --- */

.form-label {
    font-size: 12px;
    color: var(--text-gray);
    font-weight: 600;
}

.form-label-block {
    font-size: 12px;
    color: var(--text-gray);
    font-weight: 600;
    display: block;
    margin-bottom: 12px;
}

.settings-radio-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.settings-radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
}

.settings-section-divider {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.app-info-box {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 16px;
    border: 1px solid var(--border-color);
}

.footer-link {
    font-size: 12px;
    color: #999;
    text-decoration: none;
}

.footer-link:hover {
    text-decoration: underline;
}

.delete-account-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    min-width: 128px;
    padding: 8px 0px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    color: var(--date-overdue);
    text-decoration: none;
    transition: var(--transition);
}

.delete-account-link:hover {
    border-color: rgba(211, 47, 47, 0.36);
    background: rgba(211, 47, 47, 0.08);
    color: var(--date-overdue);
}

.icon-plus {
    color: var(--primary);
}

.icon-plus-lg {
    color: var(--primary);
    font-size: 18px;
}

.icon-plus-md {
    color: var(--primary);
    font-size: 16px;
}

.schedule-view-box {
    cursor: pointer;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    transition: background 0.2s;
}

.schedule-view-text {
    font-size: 13px;
    color: var(--text-dark);
}

.date-row {
    display: flex;
    gap: 5px;
    align-items: center;
}

.date-input-date {
    width: 140px;
}

.date-input-time {
    width: 100px;
}

.date-reset-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
}

.recurrence-row {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recurrence-label {
    font-size: 12px;
    color: var(--text-gray);
    font-weight: 600;
    white-space: nowrap;
}

.recurrence-select {
    width: auto;
    min-width: 120px;
    padding: 6px 10px;
    font-size: 13px;
}

.schedule-done-row {
    margin-top: 15px;
    display: flex;
    justify-content: flex-end;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.label-priority-row {
    display: flex;
    gap: 10px;
}

.label-dropdown-wrapper {
    flex: 1;
    position: relative;
}

.label-btn-inner {
    cursor: pointer;
    min-height: 40px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

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

.dropdown-popup {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    padding: 8px;
}

.suggest-popup {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1050;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    padding: 4px;
}

.label-search-input {
    margin-bottom: 8px;
    padding: 6px 10px;
    font-size: 13px;
}

.label-list-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.priority-col {
    width: 100px;
}

.title-editor-container {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--input-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.title-editor-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.title-inline-labels {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.subtask-label-block {
    font-size: 12px;
    color: var(--text-gray);
    font-weight: 600;
    margin-bottom: 10px;
    display: block;
}

.completed-subtasks-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.completed-subtasks-label {
    font-size: 11px;
    color: var(--text-gray);
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
}

.modal-spacer {
    flex: 1;
}

.settings-modal-title {
    font-weight: 600;
    font-size: 18px;
}

.gcal-sync-section {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    margin-top: 8px;
}

.gcal-sync-description {
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 4px;
}

.notify-description {
    font-size: 11px;
    color: var(--text-gray);
    margin-top: 4px;
}

.google-status-loading {
    color: var(--text-gray);
    font-size: 13px;
}

.gcal-label-sm {
    font-size: 12px;
    color: var(--text-gray);
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.app-version-text {
    font-size: 14px;
    margin: 0 0 8px 0;
}

.app-update-status {
    font-size: 13px;
    color: var(--text-gray);
    margin: 0;
}

.account-links {
    margin-top: 18px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.account-action-buttons {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 60px;
}

/* User display (JS-rendered) */
.user-display-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    width: 100%;
}

.user-display-email {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

/* Label dropdown items (JS-rendered) */
.label-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 14px;
}

.label-checkbox-item:hover {
    background-color: var(--hover-bg);
}

/* Inline tag badges (JS-rendered) */
.tag-badge-label {
    background: var(--label-bg);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tag-badge-date {
    background: var(--date-tag-bg);
    color: var(--date-tag-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
}

.tag-badge-inline {
    background: var(--title-tag-bg);
    color: var(--title-tag-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    user-select: none;
}

.tag-remove-btn {
    font-size: 10px;
    opacity: 0.6;
    padding: 0 4px;
}

.form-control {
    width: 100%;
    min-height: 40px;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--input-bg);
    color: var(--text-dark);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.label-add-from-modal {
    width: 100%;
    min-height: 34px;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 7px 8px;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-color);
    color: var(--primary);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    text-align: left;
}

.label-add-from-modal:hover {
    background: var(--label-bg);
    border-color: var(--primary);
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

#task-title {
    flex: 1;
    min-width: 100px;
    width: auto;
}

textarea.form-control.task-title-input {
    height: auto;
    min-height: 24px;
    max-height: 112px;
    padding: 0;
    border: none;
    border-radius: 0;
    outline: none;
    resize: none;
    overflow-y: auto;
    background: transparent;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.45;
}

textarea.form-control.task-title-input:focus {
    box-shadow: none;
}

.task-detail-input {
    min-height: 80px;
    max-height: 260px;
    resize: none;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.65;
}

.task-detail-input:focus {
    box-shadow: none;
}

/* Date Toggles */
.date-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px;
    width: fit-content;
}

.date-toggle label {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
    padding: 4px 8px;
    border-radius: 6px;
}

.date-toggle label:has(input:checked) {
    background: var(--white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.date-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.date-divider {
    color: var(--text-gray);
}

/* Subtasks */
.subtasks-section {
    margin-top: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.subtask-item {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
    min-height: 32px;
    flex-wrap: nowrap;
    background: var(--white);
    transition: opacity 0.2s;
}

.subtask-view:hover {
    background: transparent;
    border-radius: var(--radius-md);
}

.subtask-item.dragging {
    opacity: 0.5;
    background: var(--card-bg);
}

/* Settings Tabs */
.settings-layout {
    display: flex;
    gap: 20px;
    min-height: 300px;
}

#settings-modal .modal {
    display: flex;
    flex-direction: column;
    height: 620px;
    max-height: calc(100vh - 48px);
    overflow: hidden;
}

#settings-modal .modal-header {
    flex-shrink: 0;
}

#settings-modal .settings-layout {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.settings-sidebar {
    width: 150px;
    border-right: 1px solid var(--border-color);
    padding-right: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex-shrink: 0;
}

.settings-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    color: var(--text-gray);
    transition: var(--transition);
}

.settings-tab.active {
    background-color: var(--nav-active-bg);
    color: var(--primary);
    font-weight: 600;
}

.settings-update-dot {
    margin-left: auto;
}

.settings-content-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.btn-google-connect {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: var(--google-btn-bg);
    border: 1px solid var(--google-btn-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--google-btn-color);
    transition: var(--transition);
    text-decoration: none;
}

.btn-google-connect:hover {
    background: var(--google-btn-bg);
    box-shadow: none;
}

.gcal-connected-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--google-connected-bg);
    border: 1px solid var(--google-connected-border);
    border-radius: var(--radius-md);
    font-size: 14px;
}

.gcal-connected-email {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--google-connected-color);
    font-weight: 500;
}

.gcal-sync-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
}

.gcal-sync-row label {
    font-size: 14px;
    cursor: pointer;
    flex: 1;
}

.toggle-switch {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: var(--toggle-bg);
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-switch:checked {
    background: var(--primary);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: left 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch:checked::after {
    left: 22px;
}

.subtask-item input[type="text"].subtask-title {
    flex: 1;
    min-width: 150px;
}

.subtask-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.subtask-remove {
    background: none;
    border: none;
    color: var(--date-overdue);
    cursor: pointer;
    font-size: 16px;
    padding: 10px 0;
    margin-left: 5px;
}

.add-subtask-btn {
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
    min-height: 32px;
    padding: 4px 2px;
    border-radius: var(--radius-md);
}

.modal-footer {
    position: sticky;
    bottom: -24px;
    z-index: 2;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: 16px -24px -24px;
    padding: 10px 24px 18px;
    border-top: 1px solid var(--border-color);
    background: var(--white);
    box-shadow: 0 -18px 36px -34px rgba(18, 28, 45, 0.48);
}

#task-modal .modal-footer {
    position: static;
    flex-shrink: 0;
    margin: 0;
    padding: 10px 24px 18px;
}

.btn-delete {
    background: none;
    border: 1px solid #e53935;
    color: #e53935;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 13px;
    transition: var(--transition);
}

.btn-delete:hover {
    background: none;
    color: #e53935;
}

.btn {
    min-height: 36px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 500;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.btn-cancel {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-dark);
}

.btn-cancel:hover {
    background: var(--bg-color);
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 128px;
    border: 1px solid rgba(211, 47, 47, 0.36);
    background: rgba(211, 47, 47, 0.08);
    color: var(--date-overdue);
    font-weight: 700;
}

.logout-btn:hover {
    border-color: rgba(211, 47, 47, 0.36);
    background: rgba(211, 47, 47, 0.08);
    color: var(--date-overdue);
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.22) inset, 0 6px 16px rgba(67, 135, 210, 0.24);
}

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

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }

    .main-content {
        padding: 0;
        background: var(--bg-color);
    }

    .header {
        padding: 20px 20px 10px 20px;
        background-color: var(--bg-color);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .task-list {
        padding: 0 20px 20px 20px;
    }

    .today-dashboard {
        padding: var(--today-dashboard-padding-y, 14px) 0 var(--today-dashboard-padding-bottom, 14px);
        margin-top: 2px;
    }

    .today-dashboard-header {
        flex-direction: column;
        gap: 8px;
    }

    .today-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .today-insights {
        grid-template-columns: 1fr;
    }

    .calendar-toolbar {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "mode source"
            "period period";
        gap: 8px 10px;
        padding: 0 0 6px;
    }

    .calendar-mode-group {
        grid-area: mode;
        width: auto;
        min-width: 0;
    }

    .calendar-mode-btn {
        flex: 1;
        min-height: 30px;
        padding: 4px 6px;
        font-size: 13px;
    }

    .calendar-period-controls {
        grid-area: period;
        width: 100%;
        justify-content: space-between;
        gap: 6px;
        padding: 2px 0 0;
    }

    .calendar-period-label {
        flex: 1;
        min-width: 0;
        text-align: center;
        font-size: 15px;
        background: transparent;
    }

    .calendar-period-picker-wrap {
        flex: 1;
    }

    .calendar-source-menu {
        grid-area: source;
        justify-self: end;
        align-self: center;
    }

    .calendar-source-menu-btn,
    .calendar-icon-btn {
        width: 32px;
        height: 32px;
    }

    .calendar-source-popover {
        right: -2px;
    }

    .calendar-source-list {
        width: 100%;
    }

    .calendar-source-option {
        max-width: 100%;
    }

    .calendar-entry {
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 8px;
    }

    .calendar-entry-todo,
    .calendar-entry-subtask {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .calendar-entry-google {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .calendar-list-view {
        grid-template-columns: repeat(3, 285px);
        gap: 22px;
        width: max-content;
        min-width: 0;
    }

    .calendar-week-view {
        grid-template-columns: repeat(7, 285px);
        gap: 22px;
        width: max-content;
        min-width: 0;
    }

    .calendar-month-cell {
        min-height: 0;
        padding: 4px;
    }

    .inline-add {
        width: calc(100% - 40px);
        margin: 15px 20px max(20px, env(safe-area-inset-bottom, 0px)) 20px;
    }

    .hamburger {
        display: flex;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 90;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .date-inputs>div {
        flex: 1 1 100%;
    }

    .date-inputs>span {
        display: none;
        /* Hide tilde on mobile wrapping */
    }

    /* Standard Modals like Task Edit */
    .modal {
        width: calc(100% - 32px);
    }

    .conflict-choices {
        grid-template-columns: 1fr;
    }

    .conflict-preview {
        max-height: 22vh;
    }

    /* Settings Modal Mobile Transition */
    #settings-modal {
        background: var(--bg-color);
    }

    #settings-modal .modal {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        height: 100vh;
        border-radius: 0;
        transform: translateX(100%);
        padding: 20px;
        box-shadow: none;
    }

    #settings-modal.active .modal {
        transform: translateX(0);
    }

    .settings-layout {
        flex-direction: column;
    }

    .settings-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        flex-direction: row;
        padding-right: 0;
        padding-bottom: 10px;
        overflow-x: auto;
    }

    .project-menu-btn {
        opacity: 1;
    }
}

/* Dark mode form controls */
[data-theme="dark"] .form-control,
[data-theme="dark"] select.form-control {
    background-color: var(--input-bg);
    color: var(--text-dark);
    border-color: #444c60;
}

[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"] {
    color-scheme: dark;
}

[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.78);
}

[data-theme="dark"] #settings-modal {
    background: var(--bg-color);
}

[data-theme="dark"] .project-context-menu,
[data-theme="dark"] .today-stat,
[data-theme="dark"] .subtask-item,
[data-theme="dark"] .modal-footer,
[data-theme="dark"] .gcal-connected-box,
[data-theme="dark"] .btn-google-connect {
    border-color: var(--border-color);
}

[data-theme="dark"] .task-item {
    border-color: var(--border-color);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
    max-width: calc(100% - 32px);
    width: 400px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 13px;
    font-weight: 500;
    pointer-events: auto;
    animation: toast-in 0.3s ease forwards;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.toast.removing {
    animation: toast-out 0.3s ease forwards;
}

.toast-icon {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.6;
    cursor: pointer;
    font-size: 16px;
    padding: 0 2px;
    line-height: 1;
    transition: opacity 0.2s;
}

.toast.error {
    background: rgba(220, 38, 38, 0.95);
    color: #fff;
}

.toast.warning {
    background: rgba(245, 158, 11, 0.95);
    color: #fff;
}

.toast.success {
    background: rgba(22, 163, 74, 0.95);
    color: #fff;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateY(16px) scale(0.95);
    }
}

/* Calendar slide animations */
@keyframes calendar-slide-in-next {
    from {
        transform: translateX(20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes calendar-slide-in-prev {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.calendar-animate-next .calendar-month-swipe,
.calendar-animate-next .calendar-week-scroll,
.calendar-animate-next .calendar-list-scroll {
    animation: calendar-slide-in-next 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.calendar-animate-prev .calendar-month-swipe,
.calendar-animate-prev .calendar-week-scroll,
.calendar-animate-prev .calendar-list-scroll {
    animation: calendar-slide-in-prev 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Splash Screen */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 24px;
    color: var(--primary);
    border-radius: 14px;
    animation: splash-pulse 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes splash-pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(0.95);
    }
}

.splash-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
