/* ==========================================
   COUPLE CALENDAR - MAIN STYLES
   ========================================== */

/* Base Font */
* { 
    font-family: 'Poppins', sans-serif; 
}

/* Event modal: keep date/time side-by-side but prioritize width for date inputs. */
.event-date-time-row {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
}

.event-date-input {
    padding-right: 2.8rem;
}

.event-time-input {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

@media (max-width: 420px) {
    .event-date-time-row {
        gap: 0.6rem;
        grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.75fr);
    }
}

/* ==========================================
   BACKGROUNDS & GRADIENTS
   ========================================== */
.gradient-bg {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
}

.glass {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
}

/* ==========================================
   EVENT COLORS
   ========================================== */
.event-user1 { 
    background: linear-gradient(135deg, #3b82f6, #1d4ed8); 
}

.event-user2 { 
    background: linear-gradient(135deg, #ec4899, #db2777); 
}

.event-both { 
    background: linear-gradient(135deg, #8b5cf6, #7c3aed); 
}

.event-birthday {
    background: linear-gradient(135deg, #f97316, #ec4899);
}

.event-anniversary {
    background: linear-gradient(135deg, #fde68a, #f59e0b);
    color: #6b3f00;
    box-shadow: inset 0 0 0 1px rgba(180, 83, 9, 0.16), 0 4px 12px rgba(245, 158, 11, 0.2);
}

/* ==========================================
   CALENDAR STYLES
   ========================================== */
.calendar-day { 
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    overflow: visible;
    position: relative;
}

.calendar-day:hover { 
    background-color: rgba(139, 92, 246, 0.05) !important;
    box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.2);
}

.calendar-slider-viewport {
    position: relative;
    overflow: hidden;
    touch-action: pan-y;
    transition: height 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.calendar-slider-track {
    display: flex;
    width: 100%;
    will-change: transform;
    transform: translate3d(0, 0, 0);
}

.calendar-slider-track.is-animating {
    transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.calendar-slider-slide {
    min-width: 100%;
    flex: 0 0 100%;
    padding: 0 2px;
    box-sizing: border-box;
}

.calendar-slider-panel {
    position: relative;
}

.calendar-slider-weekdays {
    margin-bottom: 0.25rem;
}

@media (min-width: 640px) {
    .calendar-slider-weekdays {
        margin-bottom: 0.5rem;
    }
}

.today-marker {
    box-shadow: 0 0 0 3px #8b5cf6, 0 0 15px rgba(139, 92, 246, 0.4);
}

.today-marker:hover {
    box-shadow: 0 0 0 3px #8b5cf6, 0 0 15px rgba(139, 92, 246, 0.4), inset 0 0 0 1px rgba(139, 92, 246, 0.2) !important;
}

/* Multi-day events */
.event-container {
    position: relative;
    z-index: 2;
    width: calc(100% - var(--spacing));
}

.multi-day-event {
    position: relative;
    z-index: 5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.multi-day-event:hover {
    z-index: 20;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

.event-row-placeholder {
    height: 1rem;
}

@media (min-width: 640px) {
    .event-row-placeholder {
        height: 1.25rem;
    }
}

/* Ensure multi-day events sit above placeholders and day content */
.multi-day-event { z-index: 6; }
.event-container .event-row-placeholder { visibility: visible; }

/* Collapsed early-hours area in week timeline */
.timeline-collapsed-area {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 6px;
    padding: 6px;
    align-items: center;
    overflow: hidden;
    background: #fafafa;
    z-index: 5;
}

.collapsed-event {
    color: #fff;
    font-size: 12px;
    padding: 6px 8px;
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    opacity: 0.95;
}

.collapsed-event:hover { opacity: 1; transform: translateY(-1px); }

.mini-event-indicator {
    margin: 2px auto 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 10px;
    font-size: 9px;
    line-height: 1;
}

.mini-event-indicator-default {
    width: 4px;
    height: 4px;
    border-radius: 9999px;
    background: #f472b6;
}

.mini-event-indicator-birthday {
    color: #ea580c;
}

.mini-event-indicator-anniversary {
    color: #b45309;
    font-size: 10px;
}

/* Event segment styling to visually connect multi-day events */
.event-seg {
    display: block;
    box-sizing: border-box;
    width: calc(100% + 4px);
    margin-right: -4px; /* cancel grid gap to connect segments */
    z-index: 12;
    padding-top: 1px;
}

/* Use solid fills for month multi-day segments so adjacent pieces look like one bar */
.event-seg.event-user1 {
    background: #2563eb;
}

.event-seg.event-user2 {
    background: #db2777;
}

.event-seg.event-both {
    background: #9333ea;
}

.event-seg.event-birthday {
    background: linear-gradient(135deg, #f97316, #ec4899);
}

.event-seg.event-anniversary {
    background: linear-gradient(135deg, #fde68a, #f59e0b);
    color: #6b3f00 !important;
}

.event-seg.event-cont {
    margin-left: -14px;
    width: calc(100% + 18px);
    box-shadow: none;
}

/* Do not extend beyond week boundaries (Mon left edge / Sun right edge). */
.event-seg.event-week-start.event-cont {
    margin-left: 0;
    width: calc(100% + 4px);
}

.event-seg.event-week-end {
    margin-right: 0;
}

.event-seg.event-week-end:not(.event-cont) {
    width: 100%;
}

.event-seg.event-week-end.event-cont {
    width: calc(100% + 14px);
}

.event-seg.event-start { /* ensure start has full left radius */
    margin-left: 0;
}

/* Ensure the event container allows visible overflow so connecting segments are not clipped */
.calendar-day .event-container { overflow: visible; }

/* ==========================================
   ANIMATIONS
   ========================================== */
.modal-enter { 
    animation: modalIn 0.3s ease-out; 
}

@keyframes modalIn {
    from { 
        opacity: 0; 
        transform: scale(0.9) translateY(-20px); 
    }
    to { 
        opacity: 1; 
        transform: scale(1) translateY(0); 
    }
}

.heart-float {
    animation: floatHeart 3s ease-in-out infinite;
}

@keyframes floatHeart {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.slide-in { 
    animation: slideIn 0.4s ease-out; 
}

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

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #8b5cf6;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================
   SHARED TODO / NOTES BOARD
   ========================================== */
.todo-board {
    background: linear-gradient(130deg, rgba(255, 255, 255, 0.97), rgba(237, 250, 255, 0.96));
    border: 1px solid rgba(191, 219, 254, 0.58);
    position: relative;
    overflow: hidden;
}

.todo-board::before {
    content: '';
    position: absolute;
    inset: -25% auto auto -18%;
    width: 280px;
    height: 280px;
    border-radius: 9999px;
    background: radial-gradient(circle at center, rgba(34, 211, 238, 0.2), rgba(34, 211, 238, 0));
    pointer-events: none;
}

.todo-board-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 1rem;
    padding: 0.35rem 0.15rem 0.2rem;
}

.todo-board-header h2 {
    letter-spacing: -0.015em;
}

.todo-board-header-title {
    min-width: 0;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.todo-header-back.hidden {
    display: none;
}

.todo-panel {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(226, 232, 240, 0.95);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
}

.todo-chooser-shell {
    display: grid;
    gap: 0.75rem;
}

.todo-chooser-shell.hidden {
    display: none;
}

.todo-groups-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
}

.todo-group-create-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.8rem;
    border-radius: 9999px;
    border: 1px solid #c4b5fd;
    color: #6d28d9;
    font-size: 0.73rem;
    font-weight: 700;
    background: linear-gradient(135deg, #faf5ff, #fdf4ff);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.todo-group-create-trigger:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(168, 85, 247, 0.18);
}

.todo-group-add-form {
    align-items: center;
    gap: 0.5rem;
}

.todo-group-add-form.hidden {
    display: none;
}

.todo-group-add-form:not(.hidden) {
    display: flex;
}

.todo-groups-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.todo-group-row {
    position: relative;
    min-height: 7.8rem;
}

.todo-group-btn {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-rows: auto 1fr auto;
    align-items: start;
    gap: 0.45rem;
    border-radius: 1.1rem;
    border: 1px solid #dbeafe;
    background: linear-gradient(160deg, #ffffff, #f8fbff);
    color: #334155;
    padding: 0.85rem;
    text-align: left;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.todo-group-btn:hover {
    border-color: #7dd3fc;
    transform: translateY(-2px);
    box-shadow: 0 14px 22px rgba(2, 132, 199, 0.14);
}

.todo-group-btn-active {
    border-color: #38bdf8;
    background: linear-gradient(155deg, #effcff, #eef2ff);
    box-shadow: 0 14px 24px rgba(59, 130, 246, 0.2);
}

.todo-group-name {
    font-size: 0.98rem;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #0f172a;
}

.todo-group-icon {
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #cffafe, #dbeafe);
    box-shadow: inset 0 0 0 1px rgba(14, 165, 233, 0.25);
    font-size: 1rem;
}

.todo-group-count {
    justify-self: end;
    min-width: 2rem;
    padding: 0.12rem 0.55rem;
    border-radius: 9999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.74rem;
    font-weight: 800;
    text-align: center;
}

.todo-group-delete-btn {
    position: absolute;
    top: 0.45rem;
    right: 0.45rem;
    width: 1.95rem;
    height: 1.95rem;
    border-radius: 9999px;
    border: 1px solid #fecaca;
    color: #ef4444;
    background: #fff;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.todo-group-delete-btn:hover {
    background: #fee2e2;
    transform: scale(1.06);
}

.todo-command-hud {
    background: linear-gradient(135deg, rgba(236, 254, 255, 0.92), rgba(239, 246, 255, 0.94));
    border-color: rgba(186, 230, 253, 0.95);
}

.todo-hud-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.todo-hud-metric {
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
    border-radius: 9999px;
    border: 1px solid #bae6fd;
    background: #f0f9ff;
    color: #0f172a;
    padding: 0.35rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 600;
}

.todo-hud-metric strong {
    color: #075985;
    font-size: 0.82rem;
    font-weight: 800;
}

.todo-detail-shell {
    display: grid;
    gap: 1rem;
}

.todo-detail-shell.hidden {
    display: none;
}

.todo-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.todo-detail-column {
    display: grid;
    gap: 1rem;
}

.todo-compose-panel {
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.95), rgba(252, 231, 243, 0.6));
}

.todo-routine-builder {
    background: linear-gradient(170deg, rgba(255, 255, 255, 0.95), rgba(224, 242, 254, 0.66));
}

.todo-feed-panel {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95));
}

.todo-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.62rem 1rem;
    border-radius: 0.9rem;
    border: 1px solid #a78bfa;
    color: #fff;
    font-size: 0.84rem;
    font-weight: 700;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.todo-cta-btn:hover {
    transform: translateY(-1px);
    opacity: 0.94;
}

.todo-cta-btn-cyan {
    border-color: #67e8f9;
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
}

.todo-muted-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.58rem 0.95rem;
    border-radius: 0.85rem;
    border: 1px solid #d1d5db;
    color: #475569;
    font-size: 0.82rem;
    font-weight: 600;
    background: #fff;
    transition: background-color 0.2s ease;
}

.todo-muted-btn:hover {
    background: #f8fafc;
}

.todo-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border-radius: 0.85rem;
    border: 1px solid #bae6fd;
    color: #0369a1;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-weight: 700;
    transition: transform 0.18s ease, background-color 0.18s ease;
}

.todo-back-btn:hover {
    transform: translateY(-1px);
    background: #f0f9ff;
}

.todo-add-quick-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    margin-top: 0.2rem;
}

.todo-add-quick-wrap.hidden {
    display: none;
}

.todo-add-trigger {
    min-width: 10rem;
}

.todo-add-menu {
    position: absolute;
    bottom: calc(100% + 0.55rem);
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    min-width: 12rem;
    border-radius: 0.95rem;
    border: 1px solid #dbeafe;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 14px 26px rgba(30, 64, 175, 0.16);
    padding: 0.35rem;
}

.todo-add-menu.hidden {
    display: none;
}

.todo-add-menu-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 0.7rem;
    color: #1f2937;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.52rem 0.62rem;
    transition: background-color 0.18s ease;
}

.todo-add-menu-option:hover {
    background: #eff6ff;
}

.todo-quick-compose-stack {
    display: grid;
    gap: 0.85rem;
}

.todo-quick-compose-stack.hidden {
    display: none;
}

.todo-item-card {
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    background: linear-gradient(155deg, #ffffff, #f8fafc);
    padding: 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.todo-item-card:hover {
    border-color: #7dd3fc;
    box-shadow: 0 10px 20px rgba(2, 132, 199, 0.13);
}

.todo-item-done {
    opacity: 0.72;
}

.todo-item-done .todo-item-title {
    text-decoration: line-through;
}

.todo-items-layout {
    display: grid;
    gap: 0.7rem;
}

.todo-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.todo-item-title-wrap {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    min-width: 0;
}

.todo-item-title {
    color: #111827;
    font-weight: 700;
    line-height: 1.25;
    word-break: break-word;
}

.todo-item-kind {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.68rem;
    font-weight: 700;
}

.todo-item-kind-todo {
    background: #dcfce7;
    color: #166534;
}

.todo-item-kind-note {
    background: #ffedd5;
    color: #9a3412;
}

.todo-active-group-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 9999px;
    border: 1px solid #d8b4fe;
    background: linear-gradient(135deg, #faf5ff, #fdf2f8);
    color: #6d28d9;
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.todo-active-group-prefix {
    color: #7c3aed;
    opacity: 0.9;
}

.todo-active-group-name {
    color: #4c1d95;
    font-weight: 700;
    max-width: 20rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1023px) {
    .todo-detail-grid {
        grid-template-columns: 1fr;
    }

    .todo-groups-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
    }

    .todo-group-row {
        min-height: 7rem;
    }

    .todo-group-btn {
        border-radius: 1rem;
        padding: 0.75rem 0.8rem;
    }

    .todo-group-delete-btn {
        width: 1.85rem;
        height: 1.85rem;
        border-radius: 9999px;
    }

    .todo-active-group-chip {
        max-width: 100%;
    }
}

.todo-check {
    width: 1rem;
    height: 1rem;
    margin-top: 0.15rem;
    accent-color: #8b5cf6;
}

.todo-note-dot {
    width: 0.7rem;
    height: 0.7rem;
    margin-top: 0.35rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    flex-shrink: 0;
}

.todo-delete-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 0.75rem;
    color: #ef4444;
    transition: background-color 0.2s ease;
}

.todo-delete-btn:hover {
    background: #fee2e2;
}

.todo-edit-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 0.75rem;
    color: #6366f1;
    transition: background-color 0.2s ease;
}

.todo-edit-btn:hover {
    background: #e0e7ff;
}

.recurring-tasks-panel {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(240, 249, 255, 0.92));
    border: 1px solid rgba(125, 211, 252, 0.5);
}

.task-period-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.28rem 0.62rem;
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.28);
    width: max-content;
}

.todo-task-grid {
    display: grid;
    gap: 0.75rem;
}

.task-card {
    border-radius: 1rem;
    border: 1px solid #cfe8ff;
    background: linear-gradient(170deg, #ffffff, #f4fbff);
    padding: 0.9rem;
    box-shadow: 0 12px 24px rgba(30, 64, 175, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.task-card:hover {
    transform: translateY(-2px);
    border-color: #93c5fd;
    box-shadow: 0 16px 28px rgba(37, 99, 235, 0.15);
}

.task-card-complete {
    border-color: #86efac;
    background: linear-gradient(170deg, #f0fdf4, #ecfeff);
}

.task-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.task-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.25;
    word-break: break-word;
}

.task-card-meta {
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: #475569;
}

.task-card-visual {
    margin-top: 0.65rem;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.7rem;
    align-items: center;
}

.task-orbit {
    --task-progress: 0;
    width: 3.2rem;
    height: 3.2rem;
    border-radius: 9999px;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at center, #fff 58%, transparent 59%),
        conic-gradient(#0284c7 calc(var(--task-progress) * 1%), #dbeafe 0);
    box-shadow: inset 0 0 0 1px rgba(2, 132, 199, 0.2);
}

.task-orbit span {
    font-size: 0.68rem;
    font-weight: 800;
    color: #0c4a6e;
}

.task-progress-track {
    margin-top: 0.5rem;
    width: 100%;
    height: 0.56rem;
    border-radius: 9999px;
    background: #e2e8f0;
    overflow: hidden;
    position: relative;
}

.task-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #06b6d4, #2563eb);
    transition: width 0.35s ease;
    position: relative;
}

.task-progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transform: translateX(-100%);
    animation: taskProgressShine 2.8s linear infinite;
}

@keyframes taskProgressShine {
    to {
        transform: translateX(100%);
    }
}

.task-progress-summary {
    margin-top: 0.45rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    font-size: 0.76rem;
    color: #334155;
}

.task-progress-percent {
    color: #1d4ed8;
    font-weight: 700;
}

.task-log-row {
    margin-top: 0.65rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
}

.task-log-input {
    border-radius: 0.75rem;
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #0f172a;
    padding: 0.5rem 0.7rem;
    font-size: 0.82rem;
}

.task-log-input:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.22);
}

.task-log-btn {
    border-radius: 0.75rem;
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #0891b2, #2563eb);
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.task-log-btn:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

.task-log-hint {
    margin-top: 0.35rem;
    font-size: 0.72rem;
    color: #64748b;
}

.task-badge-done {
    display: inline-flex;
    align-items: center;
    border-radius: 9999px;
    padding: 0.2rem 0.56rem;
    font-size: 0.68rem;
    font-weight: 700;
    background: #dcfce7;
    color: #15803d;
}

.task-delete-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 0.75rem;
    color: #ef4444;
    transition: background-color 0.2s ease;
}

.task-delete-btn:hover {
    background: #fee2e2;
}

.task-edit-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 0.75rem;
    color: #0284c7;
    transition: background-color 0.2s ease;
}

.task-edit-btn:hover {
    background: #e0f2fe;
}

@media (max-width: 820px) {
    .todo-group-add-form {
        flex-wrap: wrap;
    }

    .todo-cta-btn,
    .todo-muted-btn {
        width: 100%;
    }
}

@media (max-width: 560px) {
    .todo-board-header {
        gap: 0.65rem;
    }

    .todo-group-name {
        font-size: 0.92rem;
    }

    .todo-group-count {
        font-size: 0.7rem;
    }

    .task-card-visual {
        grid-template-columns: 1fr;
        gap: 0.45rem;
    }

    .task-orbit {
        width: 2.85rem;
        height: 2.85rem;
    }
}

/* ==========================================
   UI COMPONENTS
   ========================================== */
.modal-backdrop {
    transition: opacity 0.2s ease;
}

.modal-panel {
    width: 100%;
    max-height: min(92vh, 920px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.modal-panel-sm {
    max-width: 32rem;
}

.modal-panel-md {
    max-width: 42rem;
}

.modal-panel-lg {
    max-width: 56rem;
}

.modal-panel-xl {
    max-width: 72rem;
}

.admin-tools-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 1024px) {
    .admin-tools-grid {
        grid-template-columns: 1fr 1fr;
    }

    .admin-tools-grid .admin-tools-full {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    .modal-panel {
        border-radius: 1.125rem;
        padding: 1rem;
    }
}

.tab-active {
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    color: #9333ea;
}

/* ==========================================
   PWA INSTALL BANNER
   ========================================== */
@media (display-mode: standalone) {
    /* Styles when running as installed PWA */
    body {
        /* Remove any extra padding for standalone mode */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
    
    /* Hide install banner when already installed */
    #installBanner {
        display: none !important;
    }
}

/* ==========================================
   DAY DETAIL BOTTOM SHEET
   ========================================== */
.day-sheet-backdrop {
    animation: fadeIn 0.2s ease-out;
}

.day-sheet-content {
    animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.day-sheet-closing .day-sheet-backdrop {
    animation: fadeOut 0.25s ease-in forwards;
}

.day-sheet-closing .day-sheet-content {
    animation: slideDown 0.25s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes slideDown {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(100%);
    }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.day-event-card {
    transition: all 0.15s ease;
}

.day-event-card:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.day-event-card:active {
    transform: scale(0.98);
}

/* ==========================================
   SCROLLBAR
   ========================================== */
::-webkit-scrollbar { 
    width: 8px; 
}

::-webkit-scrollbar-track { 
    background: #f1f1f1; 
    border-radius: 4px; 
}

::-webkit-scrollbar-thumb { 
    background: #c084fc; 
    border-radius: 4px; 
}

::-webkit-scrollbar-thumb:hover {
    background: #a855f7;
}

/* ==========================================
   TIMELINE WEEK VIEW STYLES
   ========================================== */

/* Timeline container */
#timelineContainer {
    position: relative;
    background: white;
}

/* Day headers for timeline */
#timelineDayHeaders {
    background: white;
    border-bottom: 1px solid #e5e7eb;
}

.timeline-day-header {
    padding: 12px 8px;
    text-align: center;
    border-right: 1px solid #e5e7eb;
    min-height: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background: #f9fafb;
    font-size: 13px;
    gap: 8px;
}

.timeline-day-name {
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.timeline-day-date {
    color: #6b7280;
    font-size: 12px;
}

.timeline-day-header.is-today {
    background: #ede9fe;
    border-left: 3px solid #8b5cf6;
}

.timeline-day-header.is-today .timeline-day-name {
    color: #8b5cf6;
}

/* Time labels sidebar */
#timelineHours {
    width: 100%;
}

.timeline-hour {
    height: 60px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding-right: 8px;
    padding-top: 4px;
    font-size: 11px;
    color: #9ca3af;
    border-bottom: 1px solid #f3f4f6;
    font-weight: 500;
}

/* Days grid container */
#timelineDaysArea {
    position: relative;
}

/* Individual day column */
.timeline-day-column {
    border-right: 1px solid #e5e7eb;
    position: relative;
    background: white;
}

.timeline-day-column:last-child {
    border-right: none;
}

.timeline-day-column.is-today {
    background: #faf5ff;
}

.timeline-day-column.is-today .timeline-hour-line {
    border-bottom-color: #ede9fe;
}

.timeline-day-column.is-today .timeline-hour-line:nth-child(odd) {
    background: rgba(237, 233, 254, 0.5);
}

/* Hour grid lines — height matches the 60px per-hour sidebar labels */
.timeline-hour-line {
    position: absolute;
    width: 100%;
    height: 60px;
    border-bottom: 1px solid #f3f4f6;
    left: 0;
}

.timeline-hour-line:nth-child(odd) {
    background: rgba(249, 250, 251, 0.5);
}

/* Events in timeline */
.timeline-event {
    position: absolute;
    left: 2px;
    right: 2px;
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 11px;
    font-weight: 500;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.15s ease;
    z-index: 10;
    color: white;
}

.timeline-event:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 20;
}

.timeline-event:active {
    transform: scale(0.98);
}

.timeline-event-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-event-time {
    font-size: 10px;
    opacity: 0.9;
    white-space: nowrap;
}

/* Event colors - reuse from calendar */
.timeline-event.event-user1 {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.timeline-event.event-user2 {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

.timeline-event.event-both {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
}

.timeline-event.event-birthday {
    background: linear-gradient(135deg, #fb923c 0%, #ec4899 100%);
}

.timeline-event.event-anniversary {
    background: linear-gradient(135deg, #fde68a 0%, #f59e0b 100%);
    color: #6b3f00;
}

/* Current time indicator */
.timeline-current-time-line {
    position: absolute;
    width: 100%;
    height: 2px;
    background: #ef4444;
    z-index: 15;
    left: 0;
    pointer-events: none;
}

.timeline-current-time-line::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -4px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border-radius: 50%;
}

/* Collapse/Expand button for early hours */
.timeline-collapse-btn {
    height: auto;
    padding: 0;
    margin: 0;
    border-bottom: 1px solid #f3f4f6;
}

.timeline-collapse-btn:hover {
    background-color: #f9fafb;
}
/* ==========================================
   ALL-DAY EVENTS SECTION STYLES
   ========================================== */

/* Dedicated all-day row — one cell per day */
.timeline-allday-cell {
    border-right: 1px solid #e5e7eb;
    padding: 3px 2px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-height: 26px;
    background: #fafafa;
}

.timeline-allday-cell:last-child {
    border-right: none;
}

.timeline-allday-cell.is-today {
    background: #ede9fe;
}

.timeline-allday-event {
    padding: 2px 5px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    display: block;
    color: white;
    /* default: rounded on both sides (single-day event) */
    border-radius: 4px;
    line-height: 1.5;
}

/* Multi-day: round only the start edge */
.timeline-allday-event.allday-start:not(.allday-end) {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    padding-right: 2px;
}

/* Multi-day: round only the end edge */
.timeline-allday-event.allday-end:not(.allday-start) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    padding-left: 2px;
}

/* Multi-day: neither start nor end — no rounding */
.timeline-allday-event:not(.allday-start):not(.allday-end) {
    border-radius: 0;
    padding-left: 2px;
    padding-right: 2px;
}

.timeline-allday-event:hover {
    filter: brightness(1.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* All-day event colors - reuse from calendar */
.timeline-allday-event.event-user1 {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.timeline-allday-event.event-user2 {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

.timeline-allday-event.event-both {
    background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
}

.timeline-allday-event.event-birthday {
    background: linear-gradient(135deg, #fb923c 0%, #ec4899 100%);
}

.timeline-allday-event.event-anniversary {
    background: linear-gradient(135deg, #fde68a 0%, #f59e0b 100%);
    color: #6b3f00;
}