/* ============================================
   TO DO (GEN-TODO-01 / GEN-TODO-02)
   General Coordy To Do lists (named lists, privacy per list). Page-layout CSS only; every color comes
   from the active theme's variables (--bg-card, --text-primary, --accent-primary,
   ...) so the page follows whichever theme the user picked. Fallbacks are only
   there for a theme that does not define a variable.
   ============================================ */

#todoPage .todo-container {
    --todo-card: var(--bg-card, #2f2f3a);
    --todo-text: var(--text-primary, #e8e8f0);
    --todo-muted: var(--text-muted, #a0a0b4);
    --todo-line: var(--border-soft, rgba(255, 255, 255, 0.12));
    --todo-accent: var(--accent-primary, #667eea);
    --todo-accent-soft: var(--accent-soft-bg, rgba(102, 126, 234, 0.16));
    --todo-field: var(--bg-main, rgba(0, 0, 0, 0.18));
    --todo-ok: #4ade80;
    --todo-warn: #fb923c;
    --todo-bad: #f87171;

    max-width: 1320px;
    margin: 0 auto;
    padding: 36px 24px 72px;
    color: var(--todo-text);
}

#todoPage .todo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
    padding: 25px 30px;
    border-radius: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    color: #fff;
}
#todoPage .todo-header-copy { min-width: 0; }
#todoPage .todo-header-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 12px; }
#todoPage .todo-title { margin: 0; font-size: 28px; font-weight: 700; color: #fff; }
#todoPage .todo-subtitle { margin: 5px 0 0; font-size: 14px; color: rgba(255, 255, 255, 0.8); max-width: 62ch; }
#todoPage .todo-header .todo-btn.primary { background: #fff; border-color: #fff; color: #4f46e5; }
#todoPage .todo-header .todo-btn.primary:hover:not(:disabled) { background: rgba(255, 255, 255, 0.9); filter: none; }

/* Buttons + inputs */
#todoPage .todo-btn,
.todo-modal .todo-btn {
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.16));
    background: transparent;
    color: var(--text-primary, #e8e8f0);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
}
#todoPage .todo-btn:hover:not(:disabled),
.todo-modal .todo-btn:hover:not(:disabled) { background: var(--accent-soft-bg, rgba(102, 126, 234, 0.16)); }
#todoPage .todo-btn:disabled,
.todo-modal .todo-btn:disabled { opacity: 0.5; cursor: not-allowed; }
#todoPage .todo-btn.primary,
.todo-modal .todo-btn.primary { background: var(--accent-primary, #667eea); border-color: var(--accent-primary, #667eea); color: #fff; }
#todoPage .todo-btn.primary:hover:not(:disabled),
.todo-modal .todo-btn.primary:hover:not(:disabled) { background: var(--accent-primary, #667eea); filter: brightness(1.1); }
#todoPage .todo-btn.danger { color: #f87171; border-color: rgba(248, 113, 113, 0.5); }
#todoPage .todo-btn.danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.14); }
#todoPage .todo-btn.subtle { padding: 6px 12px; font-weight: 500; color: var(--text-muted, #a0a0b4); }

#todoPage .todo-input,
.todo-modal .todo-input {
    font: inherit;
    font-size: 14px;
    width: 100%;
    min-width: 0;
    padding: 9px 11px;
    border-radius: 9px;
    border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.16));
    background: var(--bg-main, rgba(0, 0, 0, 0.18));
    color: var(--text-primary, #e8e8f0);
    box-sizing: border-box;
}
#todoPage textarea.todo-input,
.todo-modal textarea.todo-input { resize: vertical; min-height: 64px; line-height: 1.4; }
#todoPage .todo-input:disabled,
.todo-modal .todo-input:disabled { opacity: 0.65; cursor: not-allowed; }
#todoPage .todo-input:focus-visible,
.todo-modal .todo-input:focus-visible,
#todoPage .todo-btn:focus-visible,
.todo-modal .todo-btn:focus-visible,
#todoPage .todo-rail-item:focus-visible,
#todoPage .todo-rail-toggle:focus-visible,
.todo-modal .todo-vis-card:focus-visible,
.todo-modal .todo-swatch:focus-visible {
    outline: 2px solid var(--accent-primary, #667eea);
    outline-offset: 2px;
}

/* Team picker (Team view) */
#todoPage .todo-team-select { width: auto; min-width: 9rem; padding: 6px 10px; }

#todoPage .todo-stats { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 10px 14px; margin-bottom: 14px; border: 1px solid var(--todo-line); border-radius: 10px; background: rgba(17, 17, 22, 0.34); font-size: 13px; color: var(--todo-muted); }
#todoPage .todo-stats b { color: var(--todo-text); font-weight: 600; font-variant-numeric: tabular-nums; }

#todoPage .todo-filters { display: grid; grid-template-columns: minmax(12rem, 2fr) repeat(4, minmax(8rem, 1fr)); gap: 8px; margin-bottom: 16px; }

/* List */
#todoPage .todo-list { display: flex; flex-direction: column; gap: 8px; }
#todoPage .todo-item {
    background: var(--todo-card);
    border: 1px solid var(--todo-line);
    border-left: 4px solid var(--todo-line);
    border-radius: 12px;
    min-width: 0;
}
#todoPage .todo-item.pri-urgent { border-left-color: var(--todo-bad); }
#todoPage .todo-item.pri-high { border-left-color: var(--todo-warn); }
#todoPage .todo-item.pri-low { opacity: 0.92; }
#todoPage .todo-item.is-open { border-color: var(--todo-accent); border-left-color: var(--todo-accent); }
#todoPage .todo-item.st-blocked { box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.35); }

#todoPage .todo-item-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    padding: 13px 16px;
    cursor: pointer;
    border-radius: 10px;
}
#todoPage .todo-item-head:hover { background: var(--todo-accent-soft); }
#todoPage .todo-item-head:focus-visible { outline: 2px solid var(--todo-accent); outline-offset: -2px; }
#todoPage .todo-item-title { min-width: 0; font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
#todoPage .todo-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
#todoPage .todo-tag { font-size: 11.5px; line-height: 1.5; padding: 1px 9px; border-radius: 999px; border: 1px solid var(--todo-line); color: var(--todo-muted); white-space: nowrap; }
#todoPage .todo-tag.who { color: var(--todo-accent); border-color: var(--todo-accent); background: var(--todo-accent-soft); font-weight: 600; }
#todoPage .todo-tag.none { border-style: dashed; }
#todoPage .todo-priority { flex: 0 0 auto; font-size: 11px; line-height: 1.5; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--todo-line); color: var(--todo-muted); white-space: nowrap; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
#todoPage .todo-priority.pri-urgent { color: var(--todo-bad); border-color: var(--todo-bad); background: rgba(248, 113, 113, 0.08); }
#todoPage .todo-priority.pri-high { color: var(--todo-warn); border-color: var(--todo-warn); background: rgba(251, 146, 60, 0.08); }
#todoPage .todo-tag.dirty { color: var(--todo-warn); border-color: var(--todo-warn); }
#todoPage .todo-tag.saving { color: var(--todo-accent); border-color: var(--todo-accent); }
#todoPage .todo-tag.saved { color: var(--todo-ok); border-color: var(--todo-ok); }
#todoPage .todo-tag.failed { color: var(--todo-bad); border-color: var(--todo-bad); font-weight: 600; }
#todoPage .todo-status { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--todo-line); color: var(--todo-muted); white-space: nowrap; }
#todoPage .todo-status.st-doing { color: var(--todo-accent); border-color: var(--todo-accent); }
#todoPage .todo-status.st-blocked { color: var(--todo-bad); border-color: var(--todo-bad); }
#todoPage .todo-item-badges { display: inline-flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; min-width: max-content; }

/* Circular checkbox (same look as the notification read toggle) */
#todoPage .todo-check { display: inline-flex; align-items: center; justify-content: center; padding: 6px; margin: -6px; cursor: pointer; }
#todoPage .todo-check input[type="checkbox"] {
    /* Exact 22x22 circle. base.css caps every checkbox at max-height:13px and the flex row can squeeze the width,
       which turned the circle into an oval: pin every dimension (the #todoPage selector outranks the global rule). */
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    max-width: 22px;
    max-height: 22px;
    flex: 0 0 22px;
    aspect-ratio: 1 / 1;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border-radius: 50%;
    border: 2px solid var(--todo-accent);
    background: transparent;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin: 0;
    overflow: hidden;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}
#todoPage .todo-check input[type="checkbox"]::after {
    content: '✓';
    color: #fff;
    opacity: 0;
    transform: scale(0.7);
    transition: opacity 0.15s ease, transform 0.15s ease;
}
#todoPage .todo-check input[type="checkbox"]:hover:not(:disabled)::after { opacity: 0.45; transform: scale(1); }
#todoPage .todo-check input[type="checkbox"]:checked { background: var(--todo-accent); }
#todoPage .todo-check input[type="checkbox"]:checked::after { opacity: 1; transform: scale(1); }
#todoPage .todo-check input[type="checkbox"]:focus-visible { box-shadow: 0 0 0 3px var(--todo-accent-soft); }
#todoPage .todo-check input[type="checkbox"]:disabled { opacity: 0.4; cursor: not-allowed; }

/* Expanded panel + form */
#todoPage .todo-panel { border-top: 1px solid var(--todo-line); padding: 16px; display: grid; gap: 14px; }
#todoPage .todo-panel-note { margin: 0; font-size: 13px; color: var(--todo-muted); }
#todoPage .todo-form,
.todo-modal .todo-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
#todoPage .todo-field,
.todo-modal .todo-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
#todoPage .todo-field.span-2,
.todo-modal .todo-field.span-2 { grid-column: 1 / -1; }
#todoPage .todo-field > span,
.todo-modal .todo-field > span { font-size: 12px; font-weight: 600; color: var(--text-muted, #a0a0b4); text-transform: uppercase; letter-spacing: 0.04em; }
.todo-modal .todo-field > span em { font-weight: 400; text-transform: none; letter-spacing: 0; opacity: 0.85; }
#todoPage .todo-hint,
.todo-modal .todo-hint { font-size: 12px; color: var(--text-muted, #a0a0b4); }
#todoPage .todo-panel-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
/* Autosave status line: empty most of the time; "Not saved: <why>" stays until the item saves. */
#todoPage .todo-save-state { flex: 1 1 100%; min-height: 0; font-size: 12.5px; color: var(--todo-muted); }
#todoPage .todo-save-state:empty { display: none; }
#todoPage .todo-save-state.is-error { color: var(--todo-bad); font-weight: 600; }
#todoPage .todo-panel-meta { font-size: 12px; color: var(--todo-muted); }
#todoPage .todo-panel-actions { display: inline-flex; gap: 8px; }

/* Completed section */
#todoPage .todo-completed { margin-top: 22px; }
#todoPage .todo-completed-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--todo-line); }
#todoPage .todo-completed-toggle { font: inherit; font-size: 14px; font-weight: 600; background: none; border: none; color: var(--todo-text); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 6px 4px; }
#todoPage .todo-chevron { display: inline-block; transition: transform 0.15s ease; color: var(--todo-muted); }
#todoPage .todo-chevron.is-open { transform: rotate(90deg); }
#todoPage .todo-count { font-size: 12px; font-weight: 600; padding: 1px 9px; border-radius: 999px; background: var(--todo-accent-soft); color: var(--todo-accent); }
#todoPage .todo-completed-list { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; }
#todoPage .todo-done-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; padding: 10px 16px; border-radius: 10px; background: var(--todo-card); border: 1px solid var(--todo-line); }
#todoPage .todo-done-title { font-size: 14px; color: var(--todo-muted); text-decoration: line-through; text-decoration-thickness: 1.5px; overflow-wrap: anywhere; }
#todoPage .todo-done-meta { font-size: 12px; color: var(--todo-muted); margin-top: 2px; opacity: 0.85; }
#todoPage .todo-completed-hint { margin: 6px 4px 0; font-size: 12px; color: var(--todo-muted); }

#todoPage .todo-state { padding: 26px 16px; text-align: center; font-size: 14px; color: var(--todo-muted); border: 1px dashed var(--todo-line); border-radius: 12px; }
#todoPage .todo-state.error { color: var(--todo-bad); border-color: rgba(248, 113, 113, 0.5); }

/* Add modal */
.todo-modal-overlay { position: fixed; inset: 0; z-index: var(--z-modal, 6000); display: flex; align-items: center; justify-content: center; padding: 16px; background: var(--modal-overlay, rgba(0, 0, 0, 0.7)); }
.todo-modal { width: min(640px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: var(--modal-bg, var(--bg-card, #2f2f3a)); border: 1px solid var(--modal-border, rgba(255, 255, 255, 0.14)); color: var(--text-primary, #e8e8f0); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5); }
.todo-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--modal-border, rgba(255, 255, 255, 0.14)); }
.todo-modal-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.todo-modal-close { font-size: 24px; line-height: 1; width: 34px; height: 34px; border-radius: 50%; border: none; background: transparent; color: var(--text-muted, #a0a0b4); cursor: pointer; }
.todo-modal-close:hover { background: var(--accent-soft-bg, rgba(102, 126, 234, 0.16)); color: var(--text-primary, #e8e8f0); }
.todo-modal-body { padding: 18px 20px 20px; overflow-y: auto; }
.todo-modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.todo-form-error { margin: 12px 0 0; font-size: 13px; color: #f87171; }

@media (max-width: 860px) {
    #todoPage .todo-filters { grid-template-columns: 1fr 1fr; }
    #todoPage .todo-filters #todoSearch { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
    #todoPage .todo-container { padding: 16px 12px 96px; }
    #todoPage .todo-header { align-items: flex-start; flex-direction: column; gap: 16px; padding: 20px; }
    #todoPage .todo-title { font-size: 24px; }
    #todoPage .todo-header-actions { width: 100%; }
    #todoPage .todo-header-actions { flex-wrap: wrap; }
    #todoPage .todo-header-actions .todo-btn { flex: 1 1 8rem; }
    #todoPage .todo-item-head { grid-template-columns: auto minmax(0, 1fr); padding: 12px; gap: 12px; }
    #todoPage .todo-item-badges { grid-column: 2; justify-self: start; justify-content: flex-start; min-width: 0; }
    #todoPage .todo-form,
    .todo-modal .todo-form { grid-template-columns: 1fr; }
    .todo-modal-overlay { align-items: flex-end; padding: 0; }
    .todo-modal { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
}

@media (prefers-reduced-motion: reduce) {
    #todoPage .todo-check input[type="checkbox"],
    #todoPage .todo-check input[type="checkbox"]::after,
    #todoPage .todo-chevron { transition: none; }
}

/* Optional due date */
#todoPage .todo-tag.due { color: var(--todo-muted); }
#todoPage .todo-tag.due-today { color: var(--todo-warn); border-color: var(--todo-warn); font-weight: 600; }
#todoPage .todo-tag.due-overdue { color: var(--todo-bad); border-color: var(--todo-bad); background: rgba(248, 113, 113, 0.12); font-weight: 600; }
#todoPage .todo-readonly { font-size: 14px; padding: 9px 0; color: var(--todo-text); }
#todoPage .todo-due,
.todo-modal .todo-due { width: 100%; }
#todoPage .todo-due .sched-dtp-trigger,
.todo-modal .todo-due .sched-dtp-trigger { width: 100%; box-sizing: border-box; }

/* ── GEN-TODO-02: lists ─────────────────────────────────────────────── */
#todoPage .lc-violet, .todo-modal .lc-violet { --lc: #8b5cf6; }
#todoPage .lc-blue, .todo-modal .lc-blue { --lc: #3b82f6; }
#todoPage .lc-teal, .todo-modal .lc-teal { --lc: #14b8a6; }
#todoPage .lc-green, .todo-modal .lc-green { --lc: #22c55e; }
#todoPage .lc-amber, .todo-modal .lc-amber { --lc: #f59e0b; }
#todoPage .lc-red, .todo-modal .lc-red { --lc: #ef4444; }
#todoPage .lc-pink, .todo-modal .lc-pink { --lc: #ec4899; }
#todoPage .lc-gray, .todo-modal .lc-gray { --lc: #94a3b8; }
#todoPage .priv-private, .todo-modal .priv-private { --pv: #94a3b8; }
#todoPage .priv-members, .todo-modal .priv-members { --pv: #60a5fa; }
#todoPage .priv-company, .todo-modal .priv-company { --pv: #4ade80; }

#todoPage .todo-header .todo-btn.on-banner { background: transparent; border-color: rgba(255, 255, 255, 0.7); color: #fff; }
#todoPage .todo-header .todo-btn.on-banner:hover:not(:disabled) { background: rgba(255, 255, 255, 0.16); }

#todoPage .todo-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
#todoPage .todo-main { min-width: 0; }

/* Rail */
/* The app header is position:fixed (z-index 2000) and floats above the page, so a plain top:12px parks the rail UNDER it and its top edge
   gets cut off. Offset by the header (it shrinks to ~72px once the page is scrolled, which is the only time a sticky rail is stuck) plus the
   email-verification banner when it is showing -- the same variable the other sticky side panels use. */
#todoPage .todo-container { --todo-sticky-top: calc(72px + var(--email-verify-banner-height, 0px) + 14px); }
#todoPage .todo-rail { position: sticky; top: var(--todo-sticky-top); display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - var(--todo-sticky-top) - 14px); max-height: calc(100dvh - var(--todo-sticky-top) - 14px); overflow-y: auto; padding: 12px; border-radius: 14px; background: var(--todo-card); border: 1px solid var(--todo-line); }
#todoPage .todo-rail-section { display: flex; flex-direction: column; gap: 2px; }
#todoPage .todo-rail-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--todo-muted); padding: 2px 8px 6px; }
#todoPage .todo-rail-title.todo-rail-toggle { font-family: inherit; background: none; border: none; cursor: pointer; display: flex; align-items: center; gap: 6px; text-align: left; }
#todoPage .todo-rail-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--todo-text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
#todoPage .todo-rail-item:hover { background: var(--todo-accent-soft); }
#todoPage .todo-rail-item.is-active { background: var(--todo-accent-soft); border-color: var(--todo-accent); font-weight: 600; }
#todoPage .todo-rail-item.is-archived { opacity: 0.7; }
#todoPage .todo-rail-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#todoPage .todo-rail-ico { display: inline-flex; color: var(--pv, var(--todo-muted)); opacity: 0.9; }
#todoPage .todo-rail-count { min-width: 1.6em; text-align: center; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 0 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); color: var(--todo-muted); }
#todoPage .todo-rail-item.is-active .todo-rail-count { background: var(--todo-accent); color: #fff; }
#todoPage .todo-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--lc, var(--todo-accent)); }

/* List header */
#todoPage .todo-list-head { margin-bottom: 14px; }
#todoPage .todo-list-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 16px 18px; border-radius: 14px; background: var(--todo-card); border: 1px solid var(--todo-line); border-left: 5px solid var(--lc, var(--todo-accent)); }
#todoPage .todo-list-card-main { min-width: 0; }
#todoPage .todo-list-card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
#todoPage .todo-list-name { margin: 0; font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
#todoPage .todo-list-desc { margin: 6px 0 0; font-size: 14px; color: var(--todo-muted); overflow-wrap: anywhere; }
#todoPage .todo-list-meta { margin: 6px 0 0; font-size: 12.5px; color: var(--todo-muted); }
#todoPage .todo-list-card-actions { display: flex; flex-wrap: wrap; gap: 8px; flex: 0 0 auto; }
#todoPage .todo-list-notice { margin: 8px 2px 0; font-size: 13px; color: var(--todo-warn); }
#todoPage .todo-view-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; padding: 4px 2px; }
#todoPage .todo-view-head .todo-list-desc { margin: 0; }
#todoPage .todo-privacy { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; color: var(--pv, var(--todo-muted)); border: 1px solid currentColor; background: transparent; }
#todoPage .todo-tag.list { display: inline-flex; align-items: center; gap: 6px; color: var(--todo-text); border-color: var(--lc, var(--todo-line)); }
#todoPage .todo-tag.list .todo-dot { width: 8px; height: 8px; }
#todoPage .todo-hint.warn,
.todo-modal .todo-hint.warn { color: var(--todo-warn, #fb923c); }

/* Share + new list modal */
.todo-modal.todo-modal--wide { width: min(720px, 100%); }
.todo-modal .todo-vis-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.todo-modal .todo-vis-card { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; text-align: left; font: inherit; color: inherit; cursor: pointer; border-radius: 12px; border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.16)); background: var(--bg-main, rgba(0, 0, 0, 0.18)); }
.todo-modal .todo-vis-card:hover { border-color: var(--accent-primary, #667eea); }
.todo-modal .todo-vis-card.is-active { border-color: var(--accent-primary, #667eea); background: var(--accent-soft-bg, rgba(102, 126, 234, 0.16)); box-shadow: 0 0 0 1px var(--accent-primary, #667eea); }
.todo-modal .todo-vis-card-ico { display: inline-flex; color: var(--pv, #94a3b8); }
.todo-modal .todo-vis-card-text { display: flex; flex-direction: column; gap: 2px; }
.todo-modal .todo-vis-card-text b { font-size: 14px; }
.todo-modal .todo-vis-card-text small { font-size: 12px; color: var(--text-muted, #a0a0b4); }
.todo-modal .todo-people-rows { display: flex; flex-direction: column; gap: 2px; max-height: 260px; overflow-y: auto; padding: 4px; border-radius: 10px; border: 1px solid var(--border-soft, rgba(255, 255, 255, 0.16)); }
.todo-modal .todo-person { display: grid; grid-template-columns: minmax(0, 1fr) 9rem; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; }
.todo-modal .todo-person[hidden] { display: none; }
.todo-modal .todo-person:hover { background: var(--accent-soft-bg, rgba(102, 126, 234, 0.12)); }
.todo-modal .todo-person-who { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }
.todo-modal .todo-person-who input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--accent-primary, #667eea); }
.todo-modal .todo-person-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.todo-modal .todo-person-who em { font-size: 12px; font-style: normal; color: var(--text-muted, #a0a0b4); white-space: nowrap; }
.todo-modal .todo-person-role { padding: 6px 8px; font-size: 13px; }
.todo-modal .todo-people[hidden] { display: none; }
.todo-modal .todo-form + .todo-hint { margin: 12px 0 0; }
.todo-modal .todo-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.todo-modal .todo-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; background: var(--lc, #8b5cf6); cursor: pointer; padding: 0; }
.todo-modal .todo-swatch.is-active { border-color: var(--text-primary, #e8e8f0); box-shadow: 0 0 0 2px var(--lc, #8b5cf6); }

@media (max-width: 600px) {
    .todo-modal .todo-person { grid-template-columns: minmax(0, 1fr); }
    .todo-modal .todo-vis-cards { grid-template-columns: minmax(0, 1fr); }
}

/* Phones/tablets. Declared LAST: these override the list-layout rules above at equal specificity. */
@media (max-width: 860px) {
    #todoPage .todo-layout { grid-template-columns: minmax(0, 1fr); }
    #todoPage .todo-rail { position: static; top: auto; max-height: none; flex-direction: row; align-items: center; overflow-x: auto; gap: 8px; padding: 2px 0 8px; -webkit-overflow-scrolling: touch; }
    #todoPage .todo-rail-section { display: contents; }
    #todoPage .todo-rail-title { display: none; }
    #todoPage .todo-rail-title.todo-rail-toggle { display: inline-flex; flex: 0 0 auto; }
    #todoPage .todo-rail-item { flex: 0 0 auto; width: auto; border: 1px solid var(--todo-line); border-radius: 999px; padding: 7px 12px; min-height: 40px; background: var(--todo-card); }
    #todoPage .todo-rail-item.is-active { border-color: var(--todo-accent); }
    #todoPage .todo-list-card { flex-direction: column; align-items: stretch; }
}

/* Cloud is the one light theme. The stats bar's fixed dark tint (rgba(17,17,22,.34)) turned into a gray slab with
   unreadable text there: use the theme's card color instead (dark themes keep the original tint). */
body[data-theme="cloud"] #todoPage .todo-stats { background: var(--bg-card, #ffffff); }
