/* styles/widgets/calendar.css
 *
 * Extracted from styles/main.css during T4#20 (the May-2026
 * CSS-split refactor). Originally lived at lines 6307-7028
 * of main.css. Cascade order is preserved: main.css loads first
 * (themes + base + modal/tab/layout infra), then per-widget
 * files in alphabetical order via <link> tags in index.html.
 */

/* ── CALENDAR WIDGET (Phase 2.10) ──────────────────────────── */
.cal-views {
    display: flex;
    gap: 4px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.cal-view {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 12px;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
}
.cal-view:hover { color: var(--text); border-color: var(--accent); }
.cal-view-active {
    background: color-mix(in oklab, var(--accent) 20%, var(--surface2));
    border-color: var(--accent);
    color: var(--text);
    font-weight: 600;
}

.cal-kind-filters {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.cal-kind-chip {
    --kind-color: var(--accent);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 10px;
    color: var(--muted);
    cursor: pointer;
    font-family: inherit;
    line-height: 1.3;
}
.cal-kind-chip:hover { border-color: var(--kind-color); color: var(--text); }
.cal-kind-chip-active {
    background: color-mix(in oklab, var(--kind-color) 22%, var(--surface2));
    border-color: var(--kind-color);
    color: var(--text);
    font-weight: 600;
}

.cal-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cal-empty {
    color: var(--muted);
    text-align: center;
    padding: 16px 8px;
    line-height: 1.5;
}
.cal-group-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--border);
}
.cal-group-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cal-event {
    --kind-color: var(--accent);
    display: grid;
    grid-template-columns: 76px 1fr auto;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--kind-color);
    border-radius: 8px;
    background: var(--surface2);
}
.cal-event-urgency-urgent     { border-color: var(--red);    background: color-mix(in oklab, var(--red) 12%, var(--surface2)); }
.cal-event-urgency-soon       { border-color: #fb923c;       background: color-mix(in oklab, #fb923c 10%, var(--surface2)); }
.cal-event-urgency-this-week  { border-color: #fbbf24;       background: color-mix(in oklab, #fbbf24 8%,  var(--surface2)); }
.cal-event-urgency-later      { /* default */ }
.cal-event-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.cal-event-day-icon  { font-size: 18px; line-height: 1; }
.cal-event-day-label { font-size: 10px; color: var(--muted); text-align: center; }
.cal-event-day-time  { font-size: 10px; color: var(--text); font-weight: 600; }
.cal-event-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cal-event-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-event-desc {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.cal-event-extras {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
}
.cal-event-extra {
    font-size: 10px;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 6px;
}
.cal-event-countdown {
    color: var(--kind-color);
    border-color: var(--kind-color);
    font-weight: 700;
}
.cal-event-actions {
    display: flex;
    gap: 2px;
    flex: 0 0 auto;
}
.cal-icon-btn {
    width: 24px; height: 24px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 5px;
    color: var(--muted);
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
    padding: 0;
}
.cal-icon-btn:hover { color: var(--text); border-color: var(--border); background: var(--surface); }
.cal-icon-btn-del:hover { color: var(--red); border-color: var(--red); }

/* ── Month grid view ─────────────────────────────────────────── */
.cal-month-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0 8px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.cal-nav-btn {
    width: 28px; height: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 16px;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
    padding: 0;
}
.cal-nav-btn:hover { border-color: var(--accent); color: var(--accent); }
.cal-month-label {
    flex: 1 1 auto;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    text-align: center;
}
.cal-nav-today {
    flex: 0 0 auto;
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: var(--accent);
    font-size: 12px;
    padding: 4px 12px;
    cursor: pointer;
    font-family: inherit;
    line-height: 1;
}
.cal-nav-today:hover { background: color-mix(in oklab, var(--accent) 15%, transparent); }

.cal-month-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.cal-month-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cal-month-weekday {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    text-align: center;
    padding: 4px 0;
}
.cal-month-cells {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(78px, auto);
    gap: 4px;
}
.cal-month-cell {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface2);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
    overflow: hidden;
    min-width: 0;
    transition: border-color 0.15s, background 0.15s;
}
.cal-month-cell:hover { border-color: var(--accent); }
.cal-month-cell-other {
    background: transparent;
    opacity: 0.45;
}
.cal-month-cell-today {
    border-color: var(--accent);
    background: color-mix(in oklab, var(--accent) 10%, var(--surface2));
}
.cal-month-cell-today .cal-month-cell-num {
    color: var(--accent);
    font-weight: 800;
}
.cal-month-cell-num {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    line-height: 1;
    margin-bottom: 2px;
}
.cal-month-cell-other .cal-month-cell-num { color: var(--muted); }

.cal-month-chip {
    --kind-color: var(--accent);
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 1px 4px;
    border: none;
    border-left: 2px solid var(--kind-color);
    border-radius: 2px;
    background: color-mix(in oklab, var(--kind-color) 18%, var(--surface));
    color: var(--text);
    font-family: inherit;
    font-size: 10px;
    line-height: 1.3;
    cursor: pointer;
    overflow: hidden;
    min-width: 0;
    text-align: left;
}
.cal-month-chip:hover {
    filter: brightness(1.15);
}
.cal-month-chip-icon {
    flex: 0 0 auto;
    font-size: 10px;
}
.cal-month-chip-title {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-month-more {
    font-size: 9px;
    color: var(--muted);
    padding: 1px 4px;
}

/* Mobile: shrink cell padding and chip text. The 7-column grid
   stays but each cell becomes denser. */
@media (max-width: 600px) {
    .cal-month-cells { grid-auto-rows: minmax(60px, auto); }
    .cal-month-cell  { padding: 2px; }
    .cal-month-chip  { padding: 1px 3px; font-size: 9px; }
    .cal-month-chip-title { display: none; }
    .cal-month-weekday    { font-size: 9px; }
}

/* Conflict markers (Slice 2) ─── month chip + list event row */
.cal-month-chip-conflict {
    box-shadow: inset 0 0 0 1px var(--red);
    background: color-mix(in oklab, var(--red) 14%, var(--surface));
}
.cal-month-chip-warn {
    margin-left: auto;
    color: var(--red);
    font-size: 9px;
    flex: 0 0 auto;
}
.cal-event.cal-event-conflict {
    border-color: var(--red);
    box-shadow: 0 0 0 1px color-mix(in oklab, var(--red) 50%, transparent);
}
.cal-event-conflict-badge {
    background: color-mix(in oklab, var(--red) 18%, var(--surface));
    border-color: var(--red);
    color: var(--red);
    font-weight: 700;
}

/* ── Day view (Google-Calendar-style hourly grid) ───────────── */
.cal-day-allday {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 6px 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface2);
}
.cal-day-allday-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    font-weight: 700;
    flex: 0 0 auto;
}
.cal-day-allday-chip {
    --kind-color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--kind-color);
    border-radius: 999px;
    background: color-mix(in oklab, var(--kind-color) 14%, var(--surface));
    color: var(--text);
    font-size: 11px;
    padding: 2px 8px;
    cursor: pointer;
    font-family: inherit;
}
.cal-day-allday-chip:hover { filter: brightness(1.1); }

/* The grid: scrollable container with two columns. Hour labels
   on the left, hour cells + absolutely-positioned event blocks
   on the right. */
.cal-day-grid {
    display: grid;
    grid-template-columns: 64px 1fr;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface2);
    overflow: auto;
    max-height: 70vh;
}
.cal-day-hours {
    border-right: 1px solid var(--border);
    background: var(--surface);
}
.cal-day-hour-label {
    font-size: 10px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    text-align: right;
    padding: 0 8px 0 4px;
    border-bottom: 1px dashed var(--border);
    line-height: 1;
    /* Push the label up a touch so it appears at the start of
       the hour, matching how Google Calendar lines up its
       labels. */
    transform: translateY(-5px);
}
.cal-day-events {
    position: relative;
    min-height: 100%;
}
.cal-day-hour-cell {
    border-bottom: 1px dashed var(--border);
    cursor: pointer;
    transition: background 0.12s;
}
.cal-day-hour-cell:hover {
    background: color-mix(in oklab, var(--accent) 8%, transparent);
}
.cal-day-blocks {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.cal-day-block {
    --kind-color: var(--accent);
    pointer-events: auto;
    position: absolute;
    background: color-mix(in oklab, var(--kind-color) 22%, var(--surface));
    border: 1px solid var(--kind-color);
    border-left: 3px solid var(--kind-color);
    border-radius: 6px;
    padding: 4px 6px;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 2px;
    color: var(--text);
    box-shadow: 0 1px 4px color-mix(in oklab, var(--kind-color) 25%, transparent);
}
.cal-day-block:hover { filter: brightness(1.1); z-index: 5; }
.cal-day-block-time {
    font-size: 10px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.cal-day-block-title {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-day-block-dur {
    font-size: 10px;
    color: var(--muted);
    line-height: 1;
}
.cal-day-block-warn {
    position: absolute;
    top: 4px;
    right: 6px;
    color: var(--red);
    font-size: 12px;
    font-weight: 700;
}
.cal-day-block-conflict {
    border-color: var(--red);
    box-shadow: 0 0 0 1px var(--red), 0 1px 4px color-mix(in oklab, var(--red) 30%, transparent);
}

/* "Now" line that sweeps across the event column at the
   current local time when the day cursor is today. */
.cal-day-now {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--red);
    z-index: 4;
    pointer-events: none;
}
.cal-day-now::before {
    content: '';
    position: absolute;
    left: -5px;
    top: -4px;
    width: 10px;
    height: 10px;
    background: var(--red);
    border-radius: 50%;
}

/* ── Week view (Slice 2.x) ──────────────────────────────────── */
.cal-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}
.cal-week-col {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface2);
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    min-height: 200px;
}
.cal-week-col:hover { border-color: var(--accent); }
.cal-week-col-today {
    border-color: var(--accent);
    background: color-mix(in oklab, var(--accent) 10%, var(--surface2));
}
.cal-week-head {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    font-family: inherit;
    color: var(--text);
}
.cal-week-head:hover {
    border-color: var(--accent);
    background: color-mix(in oklab, var(--accent) 12%, var(--surface));
}
.cal-week-col-today .cal-week-head {
    border-color: var(--accent);
    color: var(--accent);
}
.cal-week-head-day {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    color: var(--muted);
}
.cal-week-col-today .cal-week-head-day { color: var(--accent); }
.cal-week-head-num {
    font-size: 18px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.cal-week-chips {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1 1 auto;
}
.cal-week-chip {
    --kind-color: var(--accent);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    border: none;
    border-left: 3px solid var(--kind-color);
    border-radius: 3px;
    background: color-mix(in oklab, var(--kind-color) 18%, var(--surface));
    color: var(--text);
    font-family: inherit;
    font-size: 10px;
    line-height: 1.3;
    cursor: pointer;
    overflow: hidden;
    min-width: 0;
    text-align: left;
}
.cal-week-chip:hover { filter: brightness(1.15); }
.cal-week-chip-time {
    font-size: 9px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    flex: 0 0 auto;
}
.cal-week-chip-icon { flex: 0 0 auto; }
.cal-week-chip-title {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cal-week-chip-warn {
    color: var(--red);
    font-size: 10px;
    flex: 0 0 auto;
}
.cal-week-chip-conflict {
    box-shadow: inset 0 0 0 1px var(--red);
    background: color-mix(in oklab, var(--red) 12%, var(--surface));
}

/* Mobile: Week and Day views get cramped at < 600px. Keep the
   7-column grid but shrink chip text to icon-only, and the
   day-grid hour column gets a smaller font. */
@media (max-width: 600px) {
    .cal-week-col      { min-height: 140px; padding: 2px; }
    .cal-week-head-num { font-size: 14px; }
    .cal-week-chip     { padding: 2px 3px; font-size: 9px; }
    .cal-week-chip-title { display: none; }
    .cal-week-chip-time  { display: none; }
    .cal-day-grid      { grid-template-columns: 48px 1fr; max-height: 60vh; }
    .cal-day-hour-label { font-size: 9px; padding: 0 4px 0 2px; }
}

/* Calendar editor modal */
.calendar-edit-modal { width: min(540px, 94vw); }
.cal-edit-dates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.cal-edit-dow, .cal-edit-dom {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 6px;
}
.cal-day-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    background: var(--surface);
    user-select: none;
}
.cal-day-chip:hover { border-color: var(--accent); }
.cal-day-chip input { margin: 0; }
.cal-day-chip input:checked + span { color: var(--accent); font-weight: 700; }
.cal-dom-input { width: 70px; text-align: center; }
.cal-edit-paid {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    font-size: 12px;
    color: var(--text);
}
.cal-edit-danger-row {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* ── TODAY home card ─────────────────────────────────────────── */
.cal-today-list { display: flex; flex-direction: column; gap: 4px; padding: 4px 0; }
.cal-today-empty { color: var(--muted); text-align: center; padding: 14px 8px; line-height: 1.4; }
.cal-today-row {
    display: grid;
    grid-template-columns: 70px 22px 1fr;
    gap: 8px;
    align-items: center;
    padding: 5px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface2);
    font-size: 12px;
}
.cal-today-time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }
.cal-today-icon { text-align: center; }
.cal-today-title { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-today-row-task-recurring { background: color-mix(in oklab, var(--accent) 5%, var(--surface2)); }

/* ── UPCOMING home card ──────────────────────────────────────── */

/* 20260639: per-kind filter chip row at the top of the widget.
   One chip per KINDS entry; active = visible, muted = hidden.
   Click toggles + persists via saveUpcomingKindFilter. */
.cal-upcoming-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 0 6px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}
.cal-up-chip {
    appearance: none;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 10px;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    user-select: none;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease, opacity 120ms ease;
    opacity: 0.55;
    font-family: inherit;
}
.cal-up-chip.active {
    opacity: 1;
    color: var(--text);
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, var(--surface2));
}
.cal-up-chip:hover {
    opacity: 1;
    border-color: var(--text);
}
.cal-up-chip-icon { font-size: 11px; line-height: 1; }
.cal-up-chip-label { font-weight: 600; }

.cal-upcoming-list { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.cal-upcoming-empty { color: var(--muted); text-align: center; padding: 14px 8px; line-height: 1.4; }
.cal-up-day {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 8px;
    background: var(--surface2);
}
.cal-up-day-urgent     { border-color: var(--red);    background: color-mix(in oklab, var(--red) 10%, var(--surface2)); }
.cal-up-day-soon       { border-color: #fb923c;       background: color-mix(in oklab, #fb923c 8%,  var(--surface2)); }
.cal-up-day-this-week  { border-color: #fbbf24;       background: color-mix(in oklab, #fbbf24 6%,  var(--surface2)); }
.cal-up-day-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.cal-up-day-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text); }
/* Date suffix appended to the relative label ("Today",
   "Tomorrow", "Wednesday") so users can see the actual
   calendar date at a glance. Muted + lighter weight so the
   day name still reads as the primary text. */
.cal-up-day-date {
    font-weight: 500;
    color: var(--muted);
    text-transform: none;
    letter-spacing: 0;
}
.cal-up-day-count {
    font-size: 10px;
    color: var(--muted);
    background: var(--surface);
    border-radius: 999px;
    padding: 1px 7px;
    border: 1px solid var(--border);
}
.cal-up-row {
    --kind-color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 12px;
    border-left: 3px solid var(--kind-color);
    padding-left: 6px;
}
.cal-up-icon { flex: 0 0 auto; }
.cal-up-title {
    flex: 1 1 auto;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

