/* ─── Reset + Base ─────────────────────────────── */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #F5F0EB;
    color: #2C2C2C;
    height: 100vh;
    overflow: hidden;
}

/* ─── Header ──────────────────────────────────── */

#header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: #4A6741;
    color: white;
    height: 56px;
}

.header-col {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-col:first-child {
    justify-content: flex-start;
}

.header-col:nth-child(2) {
    justify-content: center;
}

.header-col:nth-child(3) {
    justify-content: center;
}

.header-col:last-child {
    justify-content: flex-end;
}

.header-col h1 {
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
}

/* View toggle */
.view-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    overflow: hidden;
}

.priority-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 12px;
}
.priority-filters.hidden { display: none; }
.pf-label {
    display: flex;
    align-items: center;
    gap: 3px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.pf-label input[type="checkbox"] {
    accent-color: #fff;
    cursor: pointer;
}

.toggle-btn {
    padding: 5px 14px;
    border: none;
    background: #4A6741;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

.toggle-btn.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    font-weight: 700;
}

.toggle-btn:hover {
    color: white;
}

/* Search */
.search-box input {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 13px;
    width: 200px;
    outline: none;
    transition: border-color 0.15s;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-box input:focus {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
}

/* Undo / Redo buttons */
.btn-undo-redo {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.15s;
}

.btn-undo-redo:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.25);
}

.btn-undo-redo:disabled {
    opacity: 0.35;
    cursor: default;
}

/* Add button */
.btn-add {
    padding: 6px 14px;
    min-width: 90px;
    background: #B8860B;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    text-align: center;
    transition: background 0.15s;
}

.btn-add:hover {
    background: #9A7209;
}

/* ─── Main Layout ─────────────────────────────── */

.main-layout {
    display: flex;
    height: calc(100vh - 56px);
}

/* ─── Sidebar ─────────────────────────────────── */

#sidebar {
    width: 400px;
    min-width: 140px;
    max-width: 400px;
    background: #EDE8E1;
    border-right: 1px solid #D5CFC7;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-header {
    padding: 14px 16px 8px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #888;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 3px;
}

.sort-btn {
    padding: 1px 5px;
    border: none;
    background: transparent;
    color: #AAA;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.15s;
}

.sort-btn.active {
    color: #4A6741;
}

.sort-btn:hover {
    color: #555;
}

.sort-sep {
    color: #C8C1B8;
    font-size: 10px;
}

.sort-dir-btn {
    padding: 1px 4px;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.15s;
}

.sort-dir-btn:hover {
    color: #4A6741;
}

#project-list {
    list-style: none;
    flex: 1;
}

.project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.1s;
    border-left: 3px solid transparent;
}

.project-item:hover {
    background: #E2DCD5;
}

.project-item.active {
    background: #DDD7CF;
    border-left-color: #4A6741;
    font-weight: 500;
}

.project-item.drop-highlight {
    background: #C8D8C4;
    border-left-color: #4A6741;
}

.project-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.project-count {
    background: #C8C1B8;
    color: #555;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    margin-left: 8px;
}

/* ── Hierarchical sidebar ── */

.project-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    cursor: pointer;
    font-size: 9px;
    color: #888;
    margin-right: 2px;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}

.project-toggle:hover {
    color: #4A6741;
    background: rgba(74, 103, 65, 0.1);
}

.project-folder {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: 6px;
}

.project-toggle-spacer {
    display: inline-block;
    width: 16px;
    flex-shrink: 0;
    margin-right: 2px;
}

.project-item.child {
    padding-left: 32px;
    font-size: 12px;
}

.project-item.child .project-name {
    color: #555;
}

.project-item.child.active .project-name {
    color: #2C2C2C;
}

.project-item.parent .project-name {
    font-weight: 500;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid #D5CFC7;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.btn-small {
    padding: 4px 10px;
    font-size: 11px;
    border: 1px solid #C8C1B8;
    border-radius: 4px;
    background: white;
    color: #555;
    cursor: pointer;
    transition: all 0.1s;
}

.btn-small:hover {
    background: #F0EBE5;
}

.btn-archive,
.btn-reminders,
.btn-tally {
    color: #B8860B;
    border-color: #B8860B;
}

.btn-archive:hover,
.btn-reminders:hover,
.btn-tally:hover {
    background: #FFF8E7;
}

/* ─── Sidebar Resize Handle ───────────────────── */

#sidebar-handle {
    width: 5px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.15s;
    flex-shrink: 0;
}

#sidebar-handle:hover,
#sidebar-handle.dragging {
    background: #4A6741;
}

/* ─── Board ───────────────────────────────────── */

#board {
    flex: 1;
    display: flex;
    gap: 16px;
    padding: 16px;
    overflow-x: auto;
}

.column {
    min-width: 280px;
    flex: 1 1 0%;
    background: #EDE8E1;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.column-header {
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 10px 10px 0 0;
}

.column-header .col-count {
    font-size: 12px;
    font-weight: 500;
    background: rgba(0,0,0,0.08);
    padding: 1px 8px;
    border-radius: 10px;
}

.col-sort-btn {
    margin-left: auto;
}

/* Context menu */
.ctx-menu {
    position: fixed;
    z-index: 1500;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 4px 0;
    min-width: 160px;
}
.ctx-item {
    padding: 7px 14px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}
.ctx-item:hover {
    background: #f0f0f0;
}
.ctx-danger {
    color: #C0392B;
}
.ctx-danger:hover {
    background: #FDECEA;
}

/* Column colour accents */
.column[data-col="todo"] .column-header,
.column[data-col="P1"] .column-header {
    color: #C0392B;
    border-bottom: 2px solid #C0392B;
}

.column[data-col="in_progress"] .column-header,
.column[data-col="P2"] .column-header {
    color: #B8860B;
    border-bottom: 2px solid #B8860B;
}

.column[data-col="done"] .column-header,
.column[data-col="P3"] .column-header {
    color: #4A6741;
    border-bottom: 2px solid #4A6741;
}

.column[data-col="P4"] .column-header {
    color: #5B7FA5;
    border-bottom: 2px solid #5B7FA5;
}

.column-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

/* Quick-add at bottom of column */
.quick-add {
    padding: 8px;
    border-top: 1px solid #D5CFC7;
}

.quick-add input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #B8860B;
    border-radius: 4px;
    background: white;
    color: #555;
    font-size: 11px;
    outline: none;
    transition: all 0.1s;
}

.quick-add input:focus {
    border-color: #B8860B;
    background: #FFF8E7;
}

.quick-add input::placeholder {
    color: #B8860B;
}

/* ─── Cards ───────────────────────────────────── */

.card {
    background: white;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    cursor: grab;
    transition: box-shadow 0.15s, transform 0.15s;
    border-left: 3px solid transparent;
}

.card:hover {
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
}

.card.timer-running {
    background: #FFFDE7;
}

.card.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
}

.drop-placeholder {
    height: 50px;
    margin-bottom: 8px;
    border: 2px dashed #4A6741;
    border-radius: 8px;
    background: rgba(74, 103, 65, 0.08);
    position: relative;
}

.drop-placeholder::after {
    content: '';
    position: absolute;
    left: 10%;
    right: 10%;
    top: 50%;
    height: 3px;
    background: #4A6741;
    border-radius: 2px;
}

/* Priority border colours */
.card[data-priority="P1"] {
    border-left-color: #C0392B;
}

.card[data-priority="P2"] {
    border-left-color: #B8860B;
}

.card[data-priority="P3"] {
    border-left-color: #4A6741;
}

.card[data-priority="P4"] {
    border-left-color: #5B7FA5;
}

.card-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.priority-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    text-transform: uppercase;
}

.priority-badge.P1 {
    background: #FDECEA;
    color: #C0392B;
}

.priority-badge.P2 {
    background: #FFF8E7;
    color: #B8860B;
}

.priority-badge.P3 {
    background: #EDF7EC;
    color: #4A6741;
}

.priority-badge.P4 {
    background: #E8F0F8;
    color: #5B7FA5;
}

.substep-badge {
    font-size: 10px;
    color: #888;
    font-weight: 500;
}

.archive-cb {
    cursor: pointer;
    accent-color: #4A6741;
    width: 14px;
    height: 14px;
}

.btn-archive-sel {
    margin-left: auto;
    font-size: 11px;
    padding: 2px 8px;
    border: 1px solid currentColor;
    border-radius: 4px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
}

.btn-archive-sel:hover {
    opacity: 1;
    background: rgba(0,0,0,0.05);
}

.card-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: #2C2C2C;
}

.card-title.done-title {
    text-decoration: line-through;
    color: #999;
}

.card-explainer {
    font-size: 11px;
    color: #777;
    margin-top: 6px;
    line-height: 1.4;
    display: none;
}

.card-explainer.expanded {
    display: block;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.card-project-tag {
    font-size: 10px;
    color: #999;
    background: #F5F0EB;
    padding: 1px 6px;
    border-radius: 3px;
}

.card-expand {
    font-size: 10px;
    color: #AAA;
    cursor: pointer;
    border: none;
    background: none;
    padding: 2px 4px;
}

.card-expand:hover {
    color: #666;
}

/* ─── Timer ──────────────────────────────────── */

.card-timer {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    justify-items: center;
    align-items: center;
    margin-top: 6px;
}

.timer-display {
    font-size: 16px;
    font-variant-numeric: tabular-nums;
    color: #2C2C2C;
    min-width: 68px;
}

.timer-display.running {
    color: #4A6741;
    font-weight: 600;
}

@keyframes timer-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.timer-session {
    font-size: 16px;
    font-variant-numeric: tabular-nums;
    color: #888;
    line-height: 1;
    min-width: 68px;
    text-align: center;
}

.timer-session.running {
    color: #22A04A;
    font-weight: 600;
    animation: timer-pulse 2s ease-in-out infinite;
}

.timer-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.timer-btn.timer-play {
    background: #EDF7EC;
    color: #4A6741;
}

.timer-btn.timer-play:hover {
    background: #D5EACD;
}

.timer-btn.timer-stop {
    background: #FDECEA;
    color: #C0392B;
}

.timer-btn.timer-stop:hover {
    background: #F8D5D1;
}

.timer-btn.timer-log {
    height: 28px;
    padding: 0 8px;
    font-size: 11px;
    font-weight: 600;
    background: #F0EBE5;
    color: #888;
    margin-left: auto;
    width: auto;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.timer-btn.timer-log:hover {
    background: #EDF7EC;
    color: #4A6741;
}

/* Timer Log Popup — fixed centre, no overlay */
.timer-log-popup {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    padding: 18px 20px;
    z-index: 2000;
    width: 380px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}

.tl-title {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.tl-task-name {
    font-size: 13px;
    font-weight: 600;
    color: #2C2C2C;
    margin-bottom: 12px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tl-table-wrap {
    overflow-y: auto;
    max-height: 45vh;
    margin-bottom: 10px;
}

.tl-table {
    width: 100%;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.tl-table thead th {
    font-size: 10px;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 4px 6px;
    border-bottom: 1px solid #E0D9D1;
    text-align: left;
}

.tl-table th.tl-num,
.tl-table td.tl-num {
    width: 30px;
    text-align: center;
    color: #aaa;
    font-size: 11px;
}

.tl-table td {
    padding: 6px;
    font-size: 13px;
    color: #2C2C2C;
    border-bottom: 1px solid #f0ebe5;
}

.tl-table td.tl-duration {
    font-weight: 600;
}

.tl-table td.tl-cumulative {
    color: #888;
}

.tl-table td.tl-action {
    min-width: 40px;
    width: auto;
    white-space: nowrap;
    text-align: center;
}

.tl-edit-btn, .tl-save-btn {
    background: none;
    border: none;
    color: #4A6741;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: inherit;
}

.tl-edit-btn:hover, .tl-save-btn:hover {
    background: #EDF7EC;
}

.tl-save-btn {
    color: #4A6741;
    font-weight: 700;
}

.tl-editing {
    display: flex;
    align-items: center;
    gap: 0;
}

.tl-edit-input {
    width: 36px;
    height: 28px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    border: 2px solid #E0D9D1;
    border-radius: 4px;
    color: #2C2C2C;
    outline: none;
    font-family: inherit;
}

.tl-edit-input:focus {
    border-color: #4A6741;
    box-shadow: 0 0 0 2px rgba(74,103,65,0.15);
}

.tl-empty {
    text-align: center;
    color: #aaa;
    font-size: 12px;
    padding: 16px !important;
}

.tl-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    padding: 8px 6px;
    border-top: 2px solid #E0D9D1;
    margin-bottom: 10px;
}

.tl-total-label {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
}

.tl-total-value {
    font-size: 16px;
    font-weight: 700;
    color: #2C2C2C;
    font-variant-numeric: tabular-nums;
}

.tl-buttons {
    display: flex;
    gap: 8px;
}

/* Reuse timer-edit-btn styles for log buttons */
.timer-edit-btn {
    flex: 1;
    height: 34px;
    border-radius: 6px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.timer-edit-btn.cancel {
    background: #F0EBE5;
    color: #666;
}

.timer-edit-btn.cancel:hover {
    background: #E0D9D1;
}

.timer-edit-btn.reset {
    background: #FDECEA;
    color: #C0392B;
}

.timer-edit-btn.reset:hover {
    background: #F8D5D1;
}

.time-badge {
    font-size: 10px;
    background: #EDF7EC;
    color: #4A6741;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 500;
    white-space: nowrap;
}

/* ─── Drop zone highlight ─────────────────────── */

.column-body.drop-target {
    background: rgba(74, 103, 65, 0.08);
    border-radius: 6px;
}

/* ─── Modal ───────────────────────────────────── */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 24px;
    width: 520px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-small {
    width: 360px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    font-size: 24px;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    margin-bottom: 4px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #DDD;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #4A6741;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

.btn-save {
    padding: 8px 20px;
    background: #4A6741;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-save:hover {
    background: #3D5636;
}

.btn-cancel {
    padding: 8px 20px;
    background: #EEE;
    color: #555;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.btn-cancel:hover {
    background: #DDD;
}

.btn-delete {
    padding: 8px 20px;
    background: #C0392B;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-right: auto;
}

.btn-delete:hover {
    background: #A33025;
}

/* ─── Conflict Banner ─────────────────────────── */

.conflict-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #C0392B;
    color: white;
    padding: 10px 24px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    z-index: 999;
}

.conflict-banner.hidden {
    display: none;
}

/* ─── Utility ─────────────────────────────────── */

.hidden {
    display: none !important;
}

/* ─── Scrollbar ───────────────────────────────── */

.column-body::-webkit-scrollbar {
    width: 6px;
}

.column-body::-webkit-scrollbar-track {
    background: transparent;
}

.column-body::-webkit-scrollbar-thumb {
    background: #C8C1B8;
    border-radius: 3px;
}

#sidebar::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-thumb {
    background: #C8C1B8;
    border-radius: 3px;
}

/* ─── Responsive ──────────────────────────────── */

@media (max-width: 768px) {
    #sidebar {
        width: 180px;
        min-width: 180px;
    }

    .column {
        min-width: 250px;
        width: 250px;
    }

    .search-box input {
        width: 140px;
    }
}

/* ── Project Picker Overlay ── */

.projects-label {
    cursor: pointer;
    transition: color 0.15s;
}

.projects-label:hover {
    color: #4A6741;
    text-decoration: underline;
}

.picker-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.picker-overlay.hidden {
    display: none;
}

.picker-panel {
    background: #F5F0EB;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    width: 420px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.picker-header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid #D5CFC7;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.picker-header h3 {
    margin: 0;
    font-size: 15px;
    color: #2C2C2C;
}

.picker-actions {
    display: flex;
    gap: 6px;
}

.picker-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex: 1;
}

.picker-item {
    padding: 6px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.picker-item:hover {
    background: #EDE8E1;
}

.picker-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #2C2C2C;
}

.picker-item label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #4A6741;
    flex-shrink: 0;
}

.picker-item.child {
    padding-left: 44px;
}

.picker-name {
    flex: 1;
}

.picker-count {
    background: #C8C1B8;
    color: #555;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}

.picker-item.child label {
    font-size: 12px;
    color: #555;
}

.picker-footer {
    padding: 12px 20px;
    border-top: 1px solid #D5CFC7;
    text-align: right;
}

.picker-footer .btn-primary {
    padding: 6px 24px;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: #4A6741;
    color: white;
    cursor: pointer;
    transition: background 0.15s;
}

.picker-footer .btn-primary:hover {
    background: #3A5331;
}

/* ─── Full-Page Archive ──────────────────────────── */

.archive-page {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.archive-page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0 16px;
    border-bottom: 1px solid #D5CFC7;
    margin-bottom: 0;
    flex-shrink: 0;
}

.archive-page-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #2C2C2C;
    white-space: nowrap;
}

.archive-count {
    font-weight: 400;
    color: #888;
    font-size: 14px;
}

.btn-back {
    padding: 6px 14px;
    background: #EDE8E1;
    color: #555;
    border: 1px solid #D5CFC7;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.15s;
}

.btn-back:hover {
    background: #E2DCD5;
    color: #2C2C2C;
}

.archive-search-input {
    margin-left: auto;
    width: 220px;
    padding: 6px 10px;
    border: 1px solid #D5CFC7;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    background: white;
}

.archive-search-input:focus {
    border-color: #4A6741;
}

.archive-page-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.archive-date-header {
    padding: 12px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid #EDE8E1;
    margin-top: 4px;
}

.archive-date-header:first-child {
    margin-top: 0;
}

.archive-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid #F0EBE5;
    transition: background 0.1s;
}

.archive-item:hover {
    background: #F5F0EB;
}

.archive-item-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.archive-item-title {
    font-size: 13px;
    font-weight: 500;
    color: #2C2C2C;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.archive-item-project {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    flex-shrink: 0;
}

.archive-empty {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

.btn-restore {
    font-size: 11px;
    padding: 4px 12px;
    border: 1px solid #4A6741;
    border-radius: 4px;
    background: transparent;
    color: #4A6741;
    cursor: pointer;
    white-space: nowrap;
    margin-left: 8px;
    transition: all 0.15s;
    flex-shrink: 0;
}

.btn-restore:hover {
    background: #4A6741;
    color: #fff;
}

/* ─── Reminder Modal Extras ──────────────────────── */

.repeat-every-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.interval-input {
    width: 60px !important;
    text-align: center;
}

.dow-toggles {
    display: flex;
    gap: 6px;
}

.dow-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #DDD;
    background: white;
    color: #555;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.dow-btn.active {
    background: #4A6741;
    color: white;
    border-color: #4A6741;
}

.dow-btn:hover:not(.active) {
    border-color: #4A6741;
    color: #4A6741;
}

.ends-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ends-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #2C2C2C;
    cursor: pointer;
}

.ends-radio input[type="radio"] {
    accent-color: #4A6741;
    width: auto;
    cursor: pointer;
}

.ends-date-input {
    width: 150px !important;
    padding: 4px 8px !important;
    font-size: 13px !important;
}

.ends-num-input {
    width: 70px !important;
    padding: 4px 8px !important;
    font-size: 13px !important;
    text-align: center;
}

/* ─── Reminder Firing Popup ──────────────────────── */

.reminder-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.reminder-popup.hidden {
    display: none;
}

.reminder-popup-content {
    background: white;
    border-radius: 16px;
    padding: 48px 64px;
    text-align: center;
    max-width: 500px;
    width: 90vw;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
    animation: popupBounce 0.3s ease-out;
}

@keyframes popupBounce {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.reminder-popup-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.reminder-popup-content h1 {
    font-size: 28px;
    font-weight: 700;
    color: #2C2C2C;
    margin-bottom: 12px;
}

.reminder-popup-content p {
    font-size: 16px;
    color: #555;
    margin-bottom: 8px;
    line-height: 1.5;
}

.reminder-popup-meta {
    font-size: 13px;
    color: #999;
    margin-bottom: 24px;
}

.btn-dismiss {
    padding: 12px 48px;
    font-size: 16px;
    font-weight: 600;
    background: #4A6741;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-dismiss:hover {
    background: #3D5636;
}

/* ─── Reminders Manage View ──────────────────────── */

.reminders-page {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.reminders-page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0 16px;
    border-bottom: 1px solid #D5CFC7;
    margin-bottom: 0;
    flex-shrink: 0;
}

.reminders-page-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #2C2C2C;
    white-space: nowrap;
}

.reminders-page-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.reminder-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid #F0EBE5;
    transition: background 0.1s;
}

.reminder-item:hover {
    background: #F5F0EB;
}

.reminder-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.reminder-item-title {
    font-size: 14px;
    font-weight: 500;
    color: #2C2C2C;
}

.reminder-item-meta {
    font-size: 12px;
    color: #888;
}

.reminder-item-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.reminder-active-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: 500;
}

.reminder-active-badge.active {
    background: #EDF7EC;
    color: #4A6741;
}

.reminder-active-badge.inactive {
    background: #F0EBE5;
    color: #999;
}

.reminder-empty {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* ─── Time Tally Page ──────────────────────────── */

.tally-page {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0 16px;
}

.tally-page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0 16px;
    border-bottom: 1px solid #D5CFC7;
    flex-shrink: 0;
}

.tally-page-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #2C2C2C;
    white-space: nowrap;
}

.tally-toggle {
    display: flex;
    background: #EDE8E1;
    border-radius: 6px;
    overflow: hidden;
    margin-left: auto;
}

.tally-toggle-btn {
    padding: 6px 16px;
    border: none;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
}

.tally-toggle-btn.active {
    background: #4A6741;
    color: white;
    font-weight: 600;
}

.tally-toggle-btn:hover:not(.active) {
    color: #2C2C2C;
    background: #E2DCD5;
}

.tally-charts {
    display: flex;
    gap: 24px;
    flex: 1;
    padding: 20px 0;
    overflow: hidden;
}

.tally-bar-panel {
    flex: 2;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tally-donut-panel {
    flex: 1;
    min-width: 260px;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tally-donut-full {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-top: 24px;
}

.tally-chart-title {
    font-size: 16px;
    font-weight: 600;
    color: #2C2C2C;
    margin-bottom: 20px;
}

/* Bar chart */
.tally-bar-chart {
    flex: 1;
    position: relative;
    display: flex;
    overflow: hidden;
}

.tally-grid {
    position: absolute;
    top: 0;
    left: 30px;
    right: 0;
    bottom: 30px;
}

.tally-grid-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid #EDE8E1;
}

.tally-grid-label {
    position: absolute;
    left: -30px;
    top: -8px;
    font-size: 10px;
    color: #888;
    width: 26px;
    text-align: right;
}

.tally-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    flex: 1;
    padding-left: 34px;
    padding-bottom: 30px;
    overflow-x: auto;
    overflow-y: hidden;
}

.tally-bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.tally-bar-label {
    font-size: 9px;
    color: #555;
    font-weight: 500;
    white-space: nowrap;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.tally-bar-track {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: flex-end;
    border-radius: 3px 3px 0 0;
    overflow: hidden;
}

.tally-bar-fill {
    width: 100%;
    background: #9B59B6;
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: height 0.3s ease;
}

.tally-bar-x {
    font-size: 9px;
    color: #888;
    margin-top: 6px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Donut chart */
.tally-donut-wrap {
    margin: 8px 0 16px;
}

.tally-donut-layout {
    display: flex;
    align-items: center;
    gap: 40px;
}

.tally-donut-wrap {
    flex-shrink: 0;
}

.tally-donut-wrap svg {
    display: block;
}

.tally-legend {
    flex: 0.85;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tally-legend-item {
    display: grid;
    grid-template-columns: 18px 60% 20% 20%;
    align-items: center;
    font-size: 14px;
    padding: 5px 20px 5px 8px;
    border-radius: 4px;
    cursor: default;
    transition: background 0.15s;
}

.tally-legend-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.tally-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
}

.tally-legend-name {
    color: #2C2C2C;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 6px;
}

.tally-legend-time {
    color: #2C2C2C;
    font-weight: 600;
    font-size: 14px;
    text-align: right;
}

.tally-legend-pct {
    color: #888;
    font-weight: 500;
    text-align: right;
}

.tally-empty {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* ─── Calendar View ──────────────────────────── */

.cal-loading {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

.cal-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

/* Header row */
.cal-header-row {
    display: flex;
    border-bottom: 1px solid #D5CFC7;
    flex-shrink: 0;
}

.cal-time-gutter-header {
    width: 60px;
    flex-shrink: 0;
}

.cal-day-header {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 4px;
    font-size: 13px;
    color: #555;
}

.cal-day-header.cal-today {
    color: #2C2C2C;
    font-weight: 600;
}

.cal-day-name {
    font-weight: 500;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.3px;
}

.cal-day-num {
    font-size: 22px;
    font-weight: 300;
    line-height: 1;
}

.cal-today-num {
    background: #C0392B;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
}

.cal-day-month {
    font-size: 11px;
    color: #888;
    font-weight: 400;
}

.cal-refresh-col {
    width: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cal-refresh-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #D5CFC7;
    border-radius: 6px;
    background: white;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.cal-refresh-btn:hover {
    background: #EDF7EC;
    color: #4A6741;
    border-color: #4A6741;
}

.cal-refresh-btn.spinning {
    animation: calSpin 0.8s linear infinite;
}

@keyframes calSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* All-day row */
.cal-allday-row {
    display: flex;
    border-bottom: 1px solid #D5CFC7;
    flex-shrink: 0;
    min-height: 32px;
}

.cal-allday-label {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding-right: 8px;
    padding-top: 6px;
    font-size: 10px;
    color: #888;
    font-weight: 500;
}

.cal-allday-cell {
    flex: 1;
    padding: 4px 2px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-left: 1px solid #EDE8E1;
}

.cal-allday-event {
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

/* Grid scroll area */
.cal-grid-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.cal-grid {
    display: flex;
    position: relative;
}

/* Time gutter */
.cal-time-gutter {
    width: 60px;
    flex-shrink: 0;
    position: relative;
}

.cal-time-label {
    position: absolute;
    right: 8px;
    font-size: 10px;
    color: #888;
    font-weight: 500;
    transform: translateY(-6px);
}

/* Day columns */
.cal-day-col {
    flex: 1;
    position: relative;
    border-left: 1px solid #EDE8E1;
}

.cal-hour-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid #EDE8E1;
}

/* Events */
.cal-event {
    position: absolute;
    left: 2px;
    right: 2px;
    border-radius: 4px;
    padding: 3px 6px;
    overflow: hidden;
    cursor: default;
    font-size: 11px;
    z-index: 1;
    transition: box-shadow 0.15s;
}

.cal-event:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 2;
}

.cal-event-time {
    font-size: 10px;
    font-weight: 600;
}

.cal-event-title {
    font-size: 12px;
    font-weight: 500;
    color: #2C2C2C;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-event-loc {
    font-size: 10px;
    color: #888;
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Current time line */
.cal-now-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: #C0392B;
    z-index: 10;
    pointer-events: none;
}

.cal-now-dot {
    position: absolute;
    left: -4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #C0392B;
    z-index: 10;
    pointer-events: none;
}

/* Scrollbar for calendar */
.cal-grid-scroll::-webkit-scrollbar {
    width: 6px;
}

.cal-grid-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.cal-grid-scroll::-webkit-scrollbar-thumb {
    background: #C8C1B8;
    border-radius: 3px;
}

/* ─── Custom Tooltips ────────────────────────── */

.custom-tooltip {
    position: fixed;
    z-index: 9999;
    background: #fff;
    color: #2C2C2C;
    font-size: 13px;
    line-height: 1.4;
    padding: 6px 10px;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    pointer-events: none;
    white-space: nowrap;
    max-width: 300px;
    overflow-wrap: break-word;
    white-space: normal;
}

/* ─── Long-Session Warning ──────────────────────── */

/* Card-level warning icon (any task with a session > 8h) */
.card-warn-icon {
    display: inline-block;
    color: #C53030;
    font-size: 16px;
    margin-left: 6px;
    vertical-align: middle;
    cursor: help;
    user-select: none;
}

/* Time Log popup — long-session styling.
   .tl-long      = duration > 8h (always red text — kept or not)
   .tl-long-warn = unkept long session (red + pink bg + ⚠ #) */
.tl-row.tl-long .tl-duration {
    color: #C53030;
    font-weight: 700;
}

.tl-row.tl-long-warn {
    background: #FFEBEE;
}

.tl-row.tl-long-warn .tl-num {
    color: #C53030;
    font-weight: 700;
}

/* Keep button — matches edit-btn styling (plain green text, side by side) */
.tl-keep-btn {
    background: none;
    border: none;
    color: #4A6741;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: inherit;
    margin-right: 4px;
}

.tl-keep-btn:hover {
    background: #EDF7EC;
}

/* Long-session popup — distinct from reminder (orange/red, not green) */
.long-session-popup .reminder-popup-icon {
    color: #C53030;
}

.long-session-popup .btn-dismiss {
    background: #C53030;
}

.long-session-popup .btn-dismiss:hover {
    background: #A52828;
}

#long-session-popup-details {
    font-weight: 600;
    color: #2C2C2C;
}

/* Time Log popup — live (currently running) row */
.tl-row.tl-live {
    background: rgba(74, 103, 65, 0.08);
}

.tl-row.tl-live.tl-long {
    background: #FFEBEE;
}

.tl-live-tag {
    display: inline-block;
    color: #4A6741;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border: 1px solid #4A6741;
    border-radius: 10px;
}
