/* === Theme Variables === */
:root,
[data-theme="classic"] {
    --bg-page: #f5f0e8;
    --bg-card: #fffef9;
    --bg-card-gradient: linear-gradient(180deg, #fffef9 0%, #faf6ee 100%);
    --text-primary: #2c2c2c;
    --text-secondary: #555;
    --text-muted: #777;
    --text-faint: #999;
    --text-placeholder: #888;
    --text-empty: #b0a898;
    --border-primary: #d4cfc4;
    --border-secondary: #eae5da;
    --border-light: #eee8dd;
    --border-accent: #e8ddd0;
    --border-input: #d4cfc4;
    --border-input-focus: #a09888;
    --border-text-focus: #c8c0b4;
    --border-text-hover: #e0dbd2;
    --bg-input: #fff;
    --bg-input-focus: #fff;
    --bg-button: #f5f0e8;
    --bg-button-hover: #ebe5d9;
    --bg-hover: #fdfbf5;
    --bg-notes: #fcfaf4;
    --text-notes: #444;
    --bg-notification: #fef9e7;
    --border-notification: #f0e6c0;
    --text-notification: #7d6608;
    --bg-dropdown: #fff;
    --bg-dropdown-hover: #f5f0e8;
    --bg-delete-hover: #fdf0ed;
    --bg-signout-hover: #fdf0ed;
    --shadow-card: 0 2px 20px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    --shadow-dropdown: 0 4px 12px rgba(0, 0, 0, 0.1);
    --border-dashed: #e0dbd2;
    --reorder-color: #bbb;
    --reorder-hover: #555;
    --status-open-border: #ccc;
    --status-open-color: #ccc;
    --delete-color: #ccc;
    --forward-border: #e0dbd2;
    --forward-color: #999;
    --task-number-color: #999;
    --notes-label-color: #999;
    --fwd-cancel-bg: #fff;
    --fwd-cancel-color: #666;
    --heatmap-empty: #e8e3da;
    --heatmap-low: #c8e6c9;
    --heatmap-mid: #66bb6a;
    --heatmap-high: #2e7d32;
    --color-scheme: light;
}

[data-theme="light"] {
    --bg-page: #f0f2f5;
    --bg-card: #ffffff;
    --bg-card-gradient: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
    --text-primary: #1a1a1a;
    --text-secondary: #444;
    --text-muted: #666;
    --text-faint: #888;
    --text-placeholder: #999;
    --text-empty: #aaa;
    --border-primary: #d0d5dd;
    --border-secondary: #e4e7ec;
    --border-light: #eaecf0;
    --border-accent: #d0d5dd;
    --border-input: #d0d5dd;
    --border-input-focus: #7b8794;
    --border-text-focus: #b0b8c4;
    --border-text-hover: #d0d5dd;
    --bg-input: #fff;
    --bg-input-focus: #fff;
    --bg-button: #f2f4f7;
    --bg-button-hover: #e4e7ec;
    --bg-hover: #f8f9fb;
    --bg-notes: #fafbfc;
    --text-notes: #333;
    --bg-notification: #fffbeb;
    --border-notification: #fde68a;
    --text-notification: #92400e;
    --bg-dropdown: #fff;
    --bg-dropdown-hover: #f2f4f7;
    --bg-delete-hover: #fef2f2;
    --bg-signout-hover: #fef2f2;
    --shadow-card: 0 1px 10px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
    --shadow-dropdown: 0 4px 12px rgba(0, 0, 0, 0.08);
    --border-dashed: #d0d5dd;
    --reorder-color: #ccc;
    --reorder-hover: #555;
    --status-open-border: #ccc;
    --status-open-color: #ccc;
    --delete-color: #ccc;
    --forward-border: #d0d5dd;
    --forward-color: #888;
    --task-number-color: #888;
    --notes-label-color: #888;
    --fwd-cancel-bg: #fff;
    --fwd-cancel-color: #555;
    --heatmap-empty: #e4e7ec;
    --heatmap-low: #c8e6c9;
    --heatmap-mid: #66bb6a;
    --heatmap-high: #2e7d32;
    --color-scheme: light;
}

[data-theme="dark"] {
    --bg-page: #121212;
    --bg-card: #1e1e1e;
    --bg-card-gradient: linear-gradient(180deg, #1e1e1e 0%, #1a1a1a 100%);
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #888;
    --text-faint: #777;
    --text-placeholder: #666;
    --text-empty: #555;
    --border-primary: #383838;
    --border-secondary: #2e2e2e;
    --border-light: #2a2a2a;
    --border-accent: #333;
    --border-input: #444;
    --border-input-focus: #777;
    --border-text-focus: #555;
    --border-text-hover: #444;
    --bg-input: #2a2a2a;
    --bg-input-focus: #333;
    --bg-button: #2a2a2a;
    --bg-button-hover: #383838;
    --bg-hover: #252525;
    --bg-notes: #252525;
    --text-notes: #ccc;
    --bg-notification: #332b00;
    --border-notification: #554400;
    --text-notification: #fbbf24;
    --bg-dropdown: #2a2a2a;
    --bg-dropdown-hover: #383838;
    --bg-delete-hover: #3a2020;
    --bg-signout-hover: #3a2020;
    --shadow-card: 0 2px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-dropdown: 0 4px 12px rgba(0, 0, 0, 0.4);
    --border-dashed: #444;
    --reorder-color: #555;
    --reorder-hover: #aaa;
    --status-open-border: #555;
    --status-open-color: #555;
    --delete-color: #555;
    --forward-border: #444;
    --forward-color: #666;
    --task-number-color: #666;
    --notes-label-color: #666;
    --fwd-cancel-bg: #2a2a2a;
    --fwd-cancel-color: #999;
    --heatmap-empty: #2a2a2a;
    --heatmap-low: #1b5e20;
    --heatmap-mid: #388e3c;
    --heatmap-high: #4caf50;
    --color-scheme: dark;
}

/* === Base Reset & Typography === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px 12px;
    color-scheme: var(--color-scheme);
    transition: background 0.3s, color 0.3s;
}

/* === Auth Bar === */
.auth-bar {
    max-width: 1120px;
    margin: 0 auto 8px;
}

.auth-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text-muted);
}

.auth-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sync-indicator {
    font-size: 10px;
    transition: color 0.3s;
}

.sync-indicator.sync-offline { color: #bbb; }
.sync-indicator.sync-syncing { color: #f39c12; animation: pulse 1s infinite; }
.sync-indicator.sync-synced { color: #27ae60; }
.sync-indicator.sync-error { color: #e74c3c; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

#auth-label {
    color: var(--text-placeholder);
}

.auth-btn {
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.sign-in-btn {
    background: var(--bg-input);
    color: var(--text-secondary);
}

.sign-in-btn:hover {
    background: var(--bg-button);
}

.sign-out-btn {
    background: var(--bg-input);
    color: var(--text-faint);
}

.sign-out-btn:hover {
    background: var(--bg-signout-hover);
    color: #c0392b;
}

#auth-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hidden {
    display: none !important;
}

/* === Theme Selector === */
.theme-selector {
    position: relative;
}

.theme-toggle {
    padding: 5px 12px;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--bg-button);
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.theme-toggle:hover {
    background: var(--bg-button-hover);
}

.theme-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    background: var(--bg-dropdown);
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    box-shadow: var(--shadow-dropdown);
    z-index: 200;
    overflow: hidden;
    min-width: 120px;
}

.theme-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: var(--bg-dropdown);
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-secondary);
    transition: background 0.15s;
    white-space: nowrap;
}

.theme-btn:hover {
    background: var(--bg-dropdown-hover);
}

.theme-btn.active {
    color: var(--text-primary);
    font-weight: 600;
}

/* === Planner Layout (side-by-side on desktop) === */
.planner-layout {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

/* === Planner Container === */
.planner {
    flex: 1;
    min-width: 0;
    max-width: 700px;
    background: var(--bg-card);
    border-radius: 6px;
    box-shadow: var(--shadow-card);
    padding: 0;
    overflow: hidden;
    transition: background 0.3s, box-shadow 0.3s;
}

/* === Notification Banner === */
.notification {
    background: var(--bg-notification);
    border-bottom: 1px solid var(--border-notification);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    color: var(--text-notification);
    transition: opacity 0.3s ease;
}

.notification-link {
    color: var(--text-notification);
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
    margin-left: 2px;
}

.notification-link:hover {
    opacity: 0.8;
}

.notification-close {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--text-notification);
    cursor: pointer;
    padding: 0 4px;
}

/* === Date Header === */
.date-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 20px 20px 12px;
    border-bottom: 2px solid var(--border-primary);
    background: var(--bg-card-gradient);
}

.date-display {
    flex: 1;
    text-align: center;
    position: relative;
    cursor: pointer;
}

.date-display h1 {
    font-family: "Georgia", "Times New Roman", serif;
    font-size: 22px;
    font-weight: normal;
    letter-spacing: 0.5px;
    color: var(--text-primary);
    margin: 0;
}

.date-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 8px;
    border-radius: 3px;
    margin-top: 4px;
}

.date-badge.today {
    background: #e8f5e9;
    color: #2e7d32;
}

.date-badge.past {
    background: #fce4ec;
    color: #c62828;
}

.date-badge.future {
    background: #e3f2fd;
    color: #1565c0;
}

.date-picker-hidden {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    overflow: hidden;
}

.nav-btn {
    background: var(--bg-button);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.nav-btn:hover {
    background: var(--bg-button-hover);
}

.today-btn {
    background: var(--bg-button);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-secondary);
    transition: background 0.15s;
    white-space: nowrap;
}

.today-btn:hover {
    background: var(--bg-button-hover);
}

/* === Task Summary === */
.task-summary {
    padding: 8px 20px;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-secondary);
}

.task-summary:empty {
    display: none;
}

/* === Task Section === */
.task-section {
    border-left: 3px solid var(--border-accent);
    margin-left: 16px;
    margin-right: 16px;
    margin-top: 12px;
}

.task-list-header {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-faint);
    border-bottom: 1px solid var(--border-secondary);
}

/* === Task Row === */
.task-row {
    display: flex;
    align-items: flex-start;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
    min-height: 44px;
}

.col-priority,
.col-number,
.col-actions {
    padding-top: 2px;
}

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

.task-row.status-completed .task-text {
    text-decoration: line-through;
    opacity: 0.55;
}

.task-row.status-cancelled .task-text {
    text-decoration: line-through;
    opacity: 0.4;
}

.task-row.status-forwarded .task-text {
    opacity: 0.5;
    font-style: italic;
}

.col-priority {
    width: 40px;
    flex-shrink: 0;
    text-align: center;
}

.col-number {
    width: 28px;
    flex-shrink: 0;
    text-align: center;
}

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

.col-actions {
    width: 120px;
    flex-shrink: 0;
    text-align: center;
}

/* Reorder buttons */
.reorder-btns {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.reorder-btn {
    width: 22px;
    height: 16px;
    border: none;
    background: transparent;
    color: var(--reorder-color);
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: color 0.15s;
}

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

.reorder-btn:disabled {
    opacity: 0.25;
    cursor: default;
}

/* Priority badges */
.priority-badge {
    display: inline-block;
    width: 26px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
}

.priority-badge.priority-A { background: #c0392b; }
.priority-badge.priority-B { background: #2980b9; }
.priority-badge.priority-C { background: #7f8c8d; }

.task-number {
    font-size: 13px;
    color: var(--task-number-color);
    font-weight: 600;
}

/* Task text */
.task-text {
    font-size: 15px;
    line-height: 1.4;
    padding: 2px 4px;
    border: 1px solid transparent;
    border-radius: 3px;
    outline: none;
    width: 100%;
    background: transparent;
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
    resize: none;
    overflow: hidden;
    min-height: 24px;
    display: block;
}

.task-text:focus {
    border-color: var(--border-text-focus);
    background: var(--bg-input-focus);
}

.task-text:hover:not(:focus) {
    border-color: var(--border-text-hover);
}

/* Status and action buttons */
.task-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
}

.status-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, background 0.15s;
    background: transparent;
}

.status-btn:hover {
    transform: scale(1.15);
}

.status-btn.status-open {
    border: 2px solid var(--status-open-border);
    background: var(--bg-input);
    color: var(--status-open-color);
}

.status-btn.status-completed {
    background: #27ae60;
    color: #fff;
}

.status-btn.status-cancelled {
    background: #bdc3c7;
    color: #fff;
}

.status-btn.status-forwarded {
    background: #f39c12;
    color: #fff;
}

.forward-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--forward-border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    background: var(--bg-input);
    color: var(--forward-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s;
}

.forward-btn:hover {
    color: #f39c12;
    border-color: #f39c12;
}

.forward-btn.invisible {
    visibility: hidden;
}

/* Forward date picker inline */
.forward-picker {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: var(--bg-notification);
    border-bottom: 1px solid var(--border-secondary);
    font-size: 13px;
    color: var(--text-primary);
}

.forward-picker input[type="date"] {
    border: 1px solid var(--border-input);
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text-primary);
    color-scheme: var(--color-scheme);
}

.forward-picker button {
    padding: 4px 10px;
    border: 1px solid var(--border-primary);
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
}

.forward-picker .fwd-confirm {
    background: #f39c12;
    color: #fff;
    border-color: #e08e0b;
}

.forward-picker .fwd-cancel {
    background: var(--fwd-cancel-bg);
    color: var(--fwd-cancel-color);
}

.forwarded-info {
    font-size: 11px;
    color: #f39c12;
    margin-left: 4px;
    white-space: nowrap;
}

.forwarded-info.editable {
    cursor: pointer;
    text-decoration: underline dotted;
}

.forwarded-info.editable:hover {
    color: #e67e22;
}

/* Delete button */
.delete-btn {
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    background: transparent;
    color: var(--delete-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

.delete-btn:hover {
    color: #e74c3c;
    background: var(--bg-delete-hover);
}

/* === Add Task Form === */
.add-task-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px dashed var(--border-dashed);
}

.priority-select {
    border: 1px solid var(--border-input);
    border-radius: 4px;
    padding: 7px 8px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
}

.task-input {
    flex: 1;
    border: 1px solid var(--border-input);
    border-radius: 4px;
    padding: 7px 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
    background: var(--bg-input);
    color: var(--text-primary);
}

.task-input:focus {
    border-color: var(--border-input-focus);
}

.add-btn {
    background: #5d8a68;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.add-btn:hover {
    background: #4a7254;
}

/* === Notes Section === */
.notes-section {
    padding: 16px 20px 20px;
    border-top: 2px solid var(--border-primary);
    margin-top: 12px;
}

.notes-label {
    display: block;
    font-family: "Georgia", "Times New Roman", serif;
    font-style: italic;
    font-size: 14px;
    color: var(--notes-label-color);
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

.notes-textarea {
    width: 100%;
    min-height: 100px;
    border: 1px solid var(--border-text-hover);
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    background: var(--bg-notes);
    color: var(--text-notes);
    transition: border-color 0.15s, background 0.15s;
}

.notes-textarea:focus {
    border-color: var(--border-input-focus);
    background: var(--bg-input-focus);
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-empty);
    font-style: italic;
    font-size: 14px;
}

/* === Priority Change Dropdown === */
.priority-dropdown {
    position: absolute;
    background: var(--bg-dropdown);
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    box-shadow: var(--shadow-dropdown);
    z-index: 100;
    overflow: hidden;
}

.priority-dropdown button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    border: none;
    background: var(--bg-dropdown);
    cursor: pointer;
    font-size: 13px;
    text-align: left;
    font-family: inherit;
    color: var(--text-primary);
}

.priority-dropdown button:hover {
    background: var(--bg-dropdown-hover);
}

/* === Calendar Panel === */
.calendar-panel {
    width: 400px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: 6px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: background 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.calendar-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 2px solid var(--border-primary);
    background: var(--bg-card-gradient);
}

.calendar-day-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.calendar-day-name {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

.calendar-day-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    background: transparent;
}

/* Highlight today's date */
.calendar-day-number.is-today {
    background: #3b82f6;
    color: #fff;
}

/* Calendar sync button (in auth bar) */
.calendar-sync-btn {
    display: flex;
    align-items: center;
    gap: 4px;
}

.calendar-sync-btn.connected {
    border-color: #27ae60;
    color: #27ae60;
}

.calendar-sync-icon {
    font-size: 13px;
}

.calendar-timeline {
    position: relative;
    overflow-y: auto;
    height: 600px;
    scrollbar-width: thin;
}

.calendar-hour-slot {
    display: flex;
    align-items: flex-start;
    height: 60px;
    border-bottom: 1px solid var(--border-light);
}

.calendar-hour-label {
    width: 60px;
    flex-shrink: 0;
    font-size: 11px;
    color: var(--text-faint);
    text-align: right;
    padding-right: 8px;
    padding-top: 0;
    transform: translateY(-7px);
    user-select: none;
}

.calendar-hour-content {
    flex: 1;
    height: 100%;
    border-left: 1px solid var(--border-light);
    position: relative;
}

.calendar-events-container {
    position: absolute;
    top: 0;
    left: 60px;
    right: 8px;
    bottom: 0;
    pointer-events: none;
}

.calendar-event {
    position: absolute;
    left: 4px;
    right: 4px;
    background: #38bdf8;
    border-left: 3px solid #0ea5e9;
    border-radius: 4px;
    padding: 4px 8px;
    overflow: hidden;
    cursor: default;
    pointer-events: auto;
    z-index: 2;
    min-height: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.calendar-event-title {
    font-size: 12px;
    font-weight: 600;
    color: #0c1e2c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event-time {
    font-size: 10px;
    color: #1a3a52;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Current time indicator */
.calendar-time-indicator {
    position: absolute;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    z-index: 5;
    pointer-events: none;
}

.calendar-time-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
    flex-shrink: 0;
    margin-left: -5px;
}

.calendar-time-line {
    flex: 1;
    height: 2px;
    background: #ef4444;
}

/* Empty calendar state */
.calendar-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-empty);
    font-style: italic;
    font-size: 13px;
}

/* === Responsive === */

/* Prevent horizontal overflow globally */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

.planner {
    width: 100%;
}

/* === Weekly Heatmap === */
.weekly-heatmap {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-bottom: 1px solid var(--border-secondary);
}

.heatmap-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.heatmap-label {
    font-size: 9px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.heatmap-day {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    border: 2px solid transparent;
}

.heatmap-day:hover {
    transform: scale(1.2);
}

.heatmap-day.is-today {
    border-color: var(--text-primary);
}

.heatmap-day.is-current {
    box-shadow: 0 0 0 1px var(--text-muted);
}

.heatmap-day.no-tasks { background: var(--heatmap-empty); opacity: 0.5; }
.heatmap-day.pct-0    { background: var(--heatmap-empty); }
.heatmap-day.pct-25   { background: var(--heatmap-low); }
.heatmap-day.pct-50   { background: var(--heatmap-mid); }
.heatmap-day.pct-75   { background: var(--heatmap-mid); }
.heatmap-day.pct-100  { background: var(--heatmap-high); }

/* === Streak Display === */
.streak-display {
    padding: 4px 20px 8px;
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.streak-display:empty {
    display: none;
}
.streak-count {
    font-weight: 700;
    color: var(--text-primary);
}

/* === Confetti Canvas === */
#confetti-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    display: none;
}
#confetti-canvas.active {
    display: block;
}

/* === Micro-animations === */
@keyframes status-pop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.5); }
    100% { transform: scale(1); }
}

@keyframes row-flash-green {
    0%   { background-color: rgba(39, 174, 96, 0.18); }
    100% { background-color: transparent; }
}

@keyframes row-flash-gray {
    0%   { background-color: rgba(189, 195, 199, 0.25); }
    100% { background-color: transparent; }
}

.anim-complete-pop {
    animation: status-pop 300ms ease-out;
}
.anim-row-complete {
    animation: row-flash-green 600ms ease-out;
}
.anim-row-cancel {
    animation: row-flash-gray 600ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
    .anim-complete-pop,
    .anim-row-complete,
    .anim-row-cancel {
        animation: none !important;
    }
}

@media (max-width: 900px) {
    .planner-layout {
        flex-direction: column;
        align-items: stretch;
    }

    .planner {
        max-width: 100%;
    }

    .calendar-panel {
        width: 100%;
    }

    .calendar-timeline {
        height: 500px;
    }
}

@media (max-width: 600px) {
    body {
        padding: 8px 2px;
    }

    .planner {
        border-radius: 0;
        box-shadow: none;
    }

    .calendar-panel {
        border-radius: 0;
        box-shadow: none;
    }

    .date-header {
        padding: 14px 10px 10px;
        gap: 4px;
    }

    .date-display h1 {
        font-size: 17px;
    }

    .date-badge {
        font-size: 10px;
    }

    .task-section {
        margin-left: 4px;
        margin-right: 4px;
        border-left-width: 2px;
    }

    .task-row {
        padding: 8px 6px;
        flex-wrap: wrap;
    }

    .col-priority {
        width: 30px;
    }

    .col-number {
        width: 22px;
    }

    .col-actions {
        width: auto;
        flex-shrink: 1;
    }

    .task-actions {
        gap: 2px;
    }

    .status-btn,
    .forward-btn,
    .delete-btn {
        width: 32px;
        height: 32px;
        min-width: 32px;
    }

    .task-text {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .add-task-form {
        flex-wrap: wrap;
        padding: 10px 8px;
        gap: 6px;
    }

    .priority-select {
        flex: 1;
        min-width: 0;
    }

    .add-btn {
        flex: none;
    }

    .task-input {
        flex-basis: 100%;
        min-width: 0;
        order: -1;
    }

    .nav-btn, .today-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .notes-section {
        padding: 12px 10px;
    }

    .notes-textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .task-input {
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    .forward-picker {
        flex-wrap: wrap;
        gap: 6px;
        padding: 6px 8px;
    }

    .forwarded-info {
        font-size: 10px;
    }

    .notification {
        font-size: 13px;
        padding: 8px 10px;
    }

    .auth-bar-inner {
        flex-wrap: nowrap;
        gap: 6px;
    }

    .auth-status {
        flex: 1;
        min-width: 0;
    }

    #auth-actions {
        flex-shrink: 0;
    }

    .theme-toggle {
        flex-shrink: 0;
    }

    .theme-btn {
        padding: 14px 16px;
        font-size: 16px;
    }

    .weekly-heatmap {
        gap: 4px;
        padding: 6px 10px;
    }
    .heatmap-day {
        width: 20px;
        height: 20px;
    }
}
