body {
    background: #f6f7fb;
}

.calendar-table th {
    background: #212529;
    color: #fff;
}

.calendar-cell {
    width: 14.28%;
    height: 120px;
    vertical-align: top;
    cursor: pointer;
    transition: background 0.15s ease-in-out;
    padding: 6px;
}

.calendar-cell:hover {
    background: #eef2ff;
}

.today-cell {
    background: #fff8e1;
}

.today-cell:hover {
    background: #fff3cd;
}

.event-list {
    max-height: 78px;
    overflow: hidden;
}

.event-chip {
    border-left: 4px solid #3788d8;
    background: #fff;
    border-radius: 3px;
    padding: 2px 4px;
    margin-bottom: 2px;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.event-time {
    font-weight: 600;
    margin-right: 4px;
    color: #555;
}

.color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 4px;
}

.event-chip-multiday {
    border-left-color: #6c757d !important;
    font-style: italic;
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: -6px;
    font-size: 0.6rem;
    padding: 0.2em 0.4em;
}

/* Give plain Django auth form inputs a bootstrap-ish look */
form input[type="text"],
form input[type="password"],
form input[type="email"] {
    display: block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
}

/* Pretty custom checkbox for to-do items */
.todo-toggle-btn {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 2px solid #ced4da;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease-in-out;
}

.todo-toggle-btn:hover {
    border-color: #6c8cff;
    box-shadow: 0 0 0 3px rgba(108, 140, 255, 0.15);
}

.todo-toggle-btn.done {
    background: linear-gradient(135deg, #6ee7b7, #34a853);
    border-color: #34a853;
}

.todo-toggle-btn.done::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Drag handle for reorderable to-do items */
.todo-row {
    cursor: default;
}

.drag-handle,
.drag-handle-inline {
    cursor: grab;
    color: #adb5bd;
    font-size: 1.1rem;
    line-height: 1;
    user-select: none;
    flex: 0 0 auto;
}

.drag-handle:hover {
    color: #495057;
}

.todo-ghost {
    opacity: 0.4;
    background: #eef2ff;
}

/* Kanban board */
.kanban-board {
    /*display: flex;*/
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.kanban-column {
    flex: 0 0 230px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 10px;
    min-height: 300px;
}

.kanban-column.today-column {
    background: #fff8e1;
    box-shadow: 0 0 0 2px #ffca28 inset;
}

.kanban-card {
    background: #f8f9fb;
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 6px;
    font-size: 0.85rem;
    border-left: 4px solid #3788d8;
}

.kanban-card.done {
    opacity: 0.6;
}

/* Productivity page */
.karma-badge {
    font-size: 2.5rem;
    font-weight: 700;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 16px;
    text-align: center;
}

.stat-card .stat-number {
    font-size: 1.8rem;
    font-weight: 700;
}

.kanban-room-badge {
    background: #e9ecef;
    color: #495057;
    font-weight: 500;
    font-size: 0.7rem;
}

.todo-assign-select {
    width: auto;
    max-width: 160px;
    font-size: 0.78rem;
    padding-top: 0.15rem;
    padding-bottom: 0.15rem;
}

/* ---------------------------------------------------------------------
   Dark theme overrides. Bootstrap 5.3's data-bs-theme="dark" already
   re-colors all standard Bootstrap components (cards, tables, modals,
   forms, navbar, etc). These overrides only cover our custom classes.
   --------------------------------------------------------------------- */
[data-bs-theme="dark"] body {
    background: #14161a;
}

[data-bs-theme="dark"] .calendar-cell:hover {
    background: #262b3d;
}

[data-bs-theme="dark"] .today-cell {
    background: #3a331a;
}

[data-bs-theme="dark"] .today-cell:hover {
    background: #46391c;
}

[data-bs-theme="dark"] .event-chip {
    background: #23262c;
    box-shadow: none;
    border: 1px solid #343a40;
}

[data-bs-theme="dark"] .event-time {
    color: #adb5bd;
}

[data-bs-theme="dark"] .todo-toggle-btn {
    background: #1f2228;
    border-color: #495057;
}

[data-bs-theme="dark"] .todo-toggle-btn:hover {
    border-color: #6c8cff;
}

[data-bs-theme="dark"] .todo-ghost {
    background: #262b3d;
}

[data-bs-theme="dark"] .drag-handle,
[data-bs-theme="dark"] .drag-handle-inline {
    color: #6c757d;
}

[data-bs-theme="dark"] .drag-handle:hover {
    color: #dee2e6;
}

[data-bs-theme="dark"] .kanban-column {
    background: #1f2228;
    box-shadow: none;
    border: 1px solid #343a40;
}

[data-bs-theme="dark"] .kanban-column.today-column {
    background: #3a331a;
    box-shadow: 0 0 0 2px #ffca28 inset;
}

[data-bs-theme="dark"] .kanban-card {
    background: #262b3d;
}

[data-bs-theme="dark"] .kanban-room-badge {
    background: #343a40;
    color: #dee2e6;
}

[data-bs-theme="dark"] .stat-card {
    background: #1f2228;
    box-shadow: none;
    border: 1px solid #343a40;
}

[data-bs-theme="dark"] form input[type="text"],
[data-bs-theme="dark"] form input[type="password"],
[data-bs-theme="dark"] form input[type="email"] {
    background: #1f2228;
    color: #e9ecef;
    border-color: #495057;
}

/* ---------------------------------------------------------------------
   Mobile responsiveness. Full-screen layout is the baseline; these rules
   adapt the calendar grid, nav, modal, and boards for narrow viewports.
   --------------------------------------------------------------------- */
@media (max-width: 767.98px) {
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Calendar grid: shrink cells, keep them tappable, trim text */
    .calendar-cell {
        height: 78px;
        padding: 4px;
        font-size: 0.75rem;
    }

    .calendar-table th {
        font-size: 0.7rem;
        padding: 0.35rem 0.15rem;
    }

    .event-list {
        max-height: 40px;
    }

    .event-chip {
        font-size: 0.62rem;
        padding: 1px 3px;
    }

    .event-time {
        margin-right: 2px;
    }

    /* Give calendar-cell day number more breathing room on small screens */
    .calendar-cell .badge {
        font-size: 0.6rem;
    }

    /* Nav: stack the language/timezone/theme controls full-width when
       the menu is expanded on mobile */
    .navbar-collapse .form-select {
        min-width: 140px;
    }

    .navbar-nav.align-items-lg-center .nav-item {
        margin-top: 4px;
        margin-bottom: 4px;
    }

    /* Modal comfortably fills small screens */
    .modal-dialog {
        margin: 0.75rem;
    }

    /* Kanban columns: slightly narrower so ~1.3 columns peek on screen,
       hinting at horizontal scroll */
    .kanban-column {
        flex: 0 0 78vw;
    }

    /* Stat cards / karma badge scale down a bit */
    .karma-badge {
        font-size: 2rem;
    }

    .stat-card .stat-number {
        font-size: 1.4rem;
    }

    /* Event detail action buttons take full width for easy tapping */
    .btn-group > .btn {
        min-height: 38px;
    }

    /* Larger tap targets for to-do toggle/drag handle */
    .todo-toggle-btn {
        width: 26px;
        height: 26px;
    }

    .drag-handle {
        font-size: 1.3rem;
        padding: 4px;
    }
}

@media (max-width: 400px) {
    .calendar-cell {
        height: 64px;
    }

    .event-list {
        max-height: 28px;
    }

    .kanban-column {
        flex: 0 0 88vw;
    }
}
