/* === Calendar === */
.calendar-page { padding: 1rem 0 1rem 1.5rem; height: 100%; display: flex; flex-direction: column; overflow: hidden; box-sizing: border-box; }

.cal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-right: 1.5rem;
}

.cal-header h2 { font-size: 1.1rem; font-weight: 400; flex: 1; }

.cal-filter-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding-right: 1.5rem;
}
.cal-filter-row .input { max-width: 240px; }
.cal-filter-pills { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.cal-filter-pill { transition: var(--transition); }
.cal-filter-pill.dimmed { opacity: 0.35; }

.btn-nav {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg2);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.btn-nav:hover { border-color: var(--border2); }

.btn-today {
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    background: var(--bg3);
    font-size: 0.8rem;
    color: var(--text2);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.btn-today:hover { color: var(--text); }
.print-unsupported-hint { font-size: 0.75rem; color: var(--text3); margin-left: 0.25rem; }

.cal-import-row { display: flex; gap: 0.5rem; margin-bottom: 1rem; padding-right: 1.5rem; }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* === Session templates === */
.field-save-template { margin-top: 0.25rem; }
.save-template-form { display: flex; align-items: center; gap: 0.5rem; }
.save-template-form .input { flex: 1; min-width: 0; }
.template-list { display: flex; flex-direction: column; gap: 0.6rem; max-height: 50vh; overflow-y: auto; }
.template-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg3);
}
.template-info { flex: 1; min-width: 0; }
.template-title { font-size: 0.875rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.template-meta { font-size: 0.78rem; color: var(--text2); }
.template-actions { display: flex; align-items: center; gap: 0.4rem; flex: 0 0 auto; }
.template-actions span { font-size: 0.78rem; color: var(--text2); }

/* === ICS-Import-Modal === */
.modal-wide { width: 640px; }
.import-review-list { display: flex; flex-direction: column; gap: 0.6rem; max-height: 50vh; overflow-y: auto; }
.import-review-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg3);
}
.import-review-info { flex: 1; min-width: 0; }
.import-review-title { font-size: 0.875rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-review-time { font-size: 0.78rem; color: var(--text2); }
.import-review-warning { font-size: 0.72rem; color: var(--warning, #e6a23c); margin-top: 0.15rem; }
.import-review-row .select { width: 200px; flex: 0 0 200px; }

.cal-grid {
    display: flex;
    flex: 1;
    gap: 0;
    align-items: stretch;
    min-height: 1440px;
    background: var(--bg2);
}

/* Outer wrapper: horizontal AND vertical scroll — a single scrollbar all the way on the right */
.cal-outer {
    flex: 1;
    overflow: auto;
    min-height: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg2);
    position: relative;
}

/* Inner: header + body rigidly together, min-width forces horizontal scroll */
.cal-inner {
    display: flex;
    flex-direction: column;
    min-width: 680px;
}

/* Day view: a single column fills the full width, no horizontal scroll.
   The doubled class specificity deliberately also beats the mobile min-width rule
   in responsive.css (.cal-inner { min-width: 560px }). */
.cal-inner.cal-day-mode { min-width: 0; }
.cal-inner.cal-day-mode .cal-day,
.cal-inner.cal-day-mode .cal-day-header-cell { min-width: 0; }

/* Week/day switcher in the calendar header (same look as .theme-switch in setup.css) */
.cal-view-switch { display: inline-flex; gap: 0.35rem; }
.cal-view-opt {
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text2);
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}
.cal-view-opt:hover { color: var(--text); border-color: var(--border2); }
.cal-view-opt.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Sticky header row — stays pinned to the top of cal-outer */
.cal-header-row {
    display: flex;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.cal-hours-spacer {
    width: 52px;
    min-width: 52px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    position: sticky;
    left: 0;
    z-index: 11;
    background: var(--bg2);
}

.cal-day-header-cell {
    flex: 1;
    min-width: 90px;
    padding: 0.5rem;
    text-align: center;
    border-right: 1px solid var(--border);
}
.cal-day-header-cell:last-child { border-right: none; }
.cal-day-header-cell.past { opacity: 0.6; }
.cal-day-header-cell.today { background: rgba(204,120,92,0.03); }

/* Scroll body: no scroll of its own, cal-outer scrolls vertically */
.cal-scroll-body {
    overflow: visible;
    background: var(--bg2);
}

/* Now-line indicator */
.cal-now-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
    z-index: 5;
    pointer-events: none;
}
.cal-now-line::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.cal-hours {
    width: 52px;
    min-width: 52px;
    flex-shrink: 0;
    position: sticky;
    left: 0;
    z-index: 9;
    border-right: 1px solid var(--border);
    height: 1440px;
    background: var(--bg2);
}

.hour-label {
    position: absolute;
    right: 8px;
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text3);
    transform: translateY(-50%);
}

.cal-day {
    flex: 1;
    min-width: 90px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--bg2);
    align-self: stretch;
}
.cal-day:last-child { border-right: none; }

.day-header {
    padding: 0.5rem 0.5rem 0.5rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.day-name { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text3); }
.day-num { font-size: 0.875rem; font-weight: 500; color: var(--text); margin-top: 2px; }
.today-dot {
    background: var(--accent);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 0.8rem;
}

.cal-day.today { background: rgba(204,120,92,0.03); }
.cal-day.past { opacity: 0.6; }

.day-body {
    flex: 1;
}

.cal-session {
    position: absolute;
    left: 3px;
    right: 3px;
    background: color-mix(in srgb, var(--c) 20%, var(--bg2));
    border-left: 3px solid var(--c);
    border-radius: 6px;
    padding: 3px 6px;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}
.cal-session:hover { filter: brightness(1.1); }
.cs-name { font-size: 0.7rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-topic { font-size: 0.65rem; color: var(--text2); }
.cs-time { font-size: 0.6rem; font-family: var(--font-mono); color: var(--text3); }


.warning-banner {
    color: var(--text2);
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    background: rgba(253, 203, 110, 0.08);
    border-left: 2px solid #fdcb6e;
    border-radius: 0 6px 6px 0;
}

.confirm-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}
.confirm-row .confirm-text {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text2);
}

