/* ==========================================================================
   CALENDAR (calendar.html, static/js/calendar/*)
   Built on the shared dash tokens (--surface-*, --space-*, --text-*, bronze
   --accent-color). Every class is cal-* so nothing here touches another page.
   ========================================================================== */

.cal-page {
    --cal-line: rgba(255, 255, 255, 0.06);
    --cal-line-strong: rgba(255, 255, 255, 0.11);
    --cal-now: #ea4335;
    --cal-off: rgba(0, 0, 0, 0.22);
    --cal-hover: rgba(255, 255, 255, 0.035);
    --bar-h: 20px;
    --cal-radius: 8px;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
}

.cal-shell {
    display: flex;
    height: calc(100vh - var(--nav-h, 78px));
    margin-top: var(--nav-h, 78px);
    background: var(--surface-0);
    overflow: hidden;
}

/* ── Buttons ── */
.cal-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%;
    border: none; background: none; color: var(--text-light);
    font-size: 0.85rem; text-decoration: none; cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.cal-icon-btn:hover { background: var(--cal-hover); color: var(--text-color); }

.cal-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 14px;
    border: 1px solid var(--surface-border-strong); border-radius: 8px;
    background: var(--surface-1); color: var(--text-color);
    font-size: var(--text-sm); font-weight: 600; cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}
.cal-btn:hover { border-color: var(--accent-color); background: var(--surface-2); }
.cal-btn-ai i { color: #fbbf24; }

/* ── Sidebar ── */
.cal-side {
    width: 276px; flex: 0 0 276px;
    display: flex; flex-direction: column; gap: var(--space-4);
    padding: var(--space-4) var(--space-3) var(--space-4) var(--space-4);
    background: var(--surface-1);
    border-right: 1px solid var(--surface-border);
    overflow-y: auto;
}

.cal-side-create { position: relative; }
.cal-create {
    display: inline-flex; align-items: center; gap: 12px;
    height: 48px; padding: 0 22px 0 16px;
    border: 1px solid var(--surface-border-strong); border-radius: 16px;
    background: var(--surface-2); color: var(--text-color);
    font-weight: 600; font-size: var(--text-base);
    box-shadow: 0 6px 18px -10px rgba(0, 0, 0, 0.8);
    cursor: pointer; transition: background var(--transition-fast), box-shadow var(--transition-fast);
}
.cal-create i { color: var(--accent-hover); font-size: 1.05rem; }
.cal-create:hover { background: #2a2a2a; box-shadow: 0 10px 26px -12px rgba(0, 0, 0, 0.9); }
.cal-create-menu {
    position: absolute; top: 6px; left: 150px;
    display: flex; gap: 4px; opacity: 0; pointer-events: none;
    transition: opacity var(--transition-fast);
}
.cal-side-create:hover .cal-create-menu, .cal-side-create:focus-within .cal-create-menu { opacity: 1; pointer-events: auto; }
.cal-create-menu button {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px;
    border: 1px solid var(--surface-border-strong); border-radius: 8px;
    background: var(--surface-1); color: var(--text-light); font-size: var(--text-xs); cursor: pointer;
}
.cal-create-menu button:hover { color: var(--text-color); border-color: var(--accent-color); }

.cal-nl { position: relative; margin: 0; }
.cal-nl i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #fbbf24; font-size: 0.8rem; }
.cal-nl input {
    width: 100%; height: 38px; padding: 0 12px 0 34px;
    border: 1px solid var(--surface-border-strong); border-radius: 10px;
    background: var(--surface-0); color: var(--text-color); font-size: var(--text-sm);
}
.cal-nl input::placeholder { color: var(--text-muted); }
.cal-nl input:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--accent-light); }

/* Mini month */
.cal-mini-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 4px 6px; font-size: var(--text-sm); font-weight: 600; }
.cal-mini-head .cal-icon-btn { width: 26px; height: 26px; font-size: 0.7rem; }
.cal-mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.cal-mini-dow { text-align: center; font-size: 0.66rem; font-weight: 600; color: var(--text-muted); padding-bottom: 2px; }
.cal-mini-day {
    position: relative; height: 28px; margin: 0 auto; width: 28px;
    border: none; border-radius: 50%; background: none; color: var(--text-color);
    font-size: 0.72rem; font-variant-numeric: tabular-nums; cursor: pointer;
}
.cal-mini-day:hover { background: var(--cal-hover); }
.cal-mini-day.is-other { color: var(--text-muted); }
.cal-mini-day.in-range { background: rgba(140, 110, 82, 0.14); border-radius: 0; width: 100%; }
.cal-mini-day.has-items::after {
    content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%);
    width: 3px; height: 3px; border-radius: 50%; background: var(--accent-hover);
}
.cal-mini-day.is-cursor { outline: 1px solid var(--accent-color); outline-offset: -1px; border-radius: 50%; width: 28px; }
.cal-mini-day.is-today { background: var(--accent-color); color: #fff; font-weight: 700; border-radius: 50%; width: 28px; }
.cal-mini-day.is-today::after { background: #fff; }

/* Sections */
.cal-side-sec { display: flex; flex-direction: column; gap: 2px; }
.cal-side-title {
    display: flex; align-items: center; gap: 8px; padding: 0 6px 4px;
    font-size: var(--text-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-light);
}
.cal-side-title i { color: var(--accent-color); width: 14px; text-align: center; }
.cal-side-title.is-danger, .cal-side-title.is-danger i { color: #f87171; }
.cal-count {
    margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px;
    background: var(--surface-2); color: var(--text-light); font-size: 0.66rem; text-align: center; letter-spacing: 0;
}
.cal-side-row {
    display: flex; gap: 10px; align-items: flex-start; padding: 6px 6px; border-radius: 8px; cursor: pointer;
}
.cal-side-row:hover { background: var(--cal-hover); }
.cal-side-dot { flex: 0 0 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--c); }
.cal-side-main { display: flex; flex-direction: column; min-width: 0; }
.cal-side-name { display: flex; align-items: center; gap: 6px; font-size: var(--text-sm); color: var(--text-color); }
.cal-side-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-side-when { font-size: 0.7rem; color: var(--text-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-side-empty { padding: 4px 6px; font-size: var(--text-xs); color: var(--text-muted); }
.cal-side-more { padding: 2px 6px; font-size: var(--text-xs); color: var(--accent-hover); text-decoration: none; }

/* Layers */
.cal-layer {
    display: flex; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 8px;
    font-size: var(--text-sm); color: var(--text-color); cursor: pointer; user-select: none;
}
.cal-layer:hover { background: var(--cal-hover); }
.cal-layer input { position: absolute; opacity: 0; pointer-events: none; }
.cal-layer-box {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; border-radius: 4px; border: 2px solid var(--c); color: #fff; font-size: 0.55rem;
}
.cal-layer-box i { opacity: 0; }
.cal-layer input:checked + .cal-layer-box { background: var(--c); }
.cal-layer input:checked + .cal-layer-box i { opacity: 1; }
.cal-layer input:focus-visible + .cal-layer-box { box-shadow: 0 0 0 3px var(--accent-light); }
.cal-layer-name { flex: 1; }
.cal-layer-n { font-size: 0.68rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* Heads-up */
.cal-heads-row {
    display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left;
    padding: 7px 8px; border: none; border-radius: 8px; background: none; color: var(--text-color); cursor: pointer;
}
.cal-heads-row:hover { background: var(--cal-hover); }
.cal-heads-row > i { margin-top: 3px; font-size: 0.75rem; }
.cal-heads-row.is-danger > i { color: #f87171; }
.cal-heads-row.is-warning > i { color: #fbbf24; }
.cal-heads-row.is-info > i { color: #60a5fa; }
.cal-heads-row > span { display: flex; flex-direction: column; min-width: 0; }
.cal-heads-title { font-size: var(--text-sm); font-weight: 600; }
.cal-heads-detail { font-size: 0.7rem; color: var(--text-light); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.cal-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: var(--space-3); border-top: 1px solid var(--surface-border); }
.cal-side-link {
    display: flex; align-items: center; gap: 10px; padding: 6px; border: none; border-radius: 8px; background: none;
    color: var(--text-light); font-size: var(--text-sm); text-decoration: none; text-align: left; cursor: pointer;
}
.cal-side-link:hover { background: var(--cal-hover); color: var(--text-color); }
.cal-side-link i { width: 14px; text-align: center; }

/* ── Main + toolbar ── */
.cal-main { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cal-toolbar {
    display: flex; align-items: center; gap: var(--space-3);
    padding: 10px var(--space-5); min-height: 60px;
    border-bottom: 1px solid var(--surface-border);
    background: var(--surface-0);
}
.cal-side-toggle { display: none; }
.cal-nav { display: flex; gap: 2px; }
.cal-title {
    margin: 0; font-size: 1.35rem; font-weight: 600; letter-spacing: -0.2px; color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.cal-toolbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-2); }
.cal-search { position: relative; margin: 0; }
.cal-search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 0.75rem; }
.cal-search input {
    width: 170px; height: 34px; padding: 0 10px 0 30px; border-radius: 8px;
    border: 1px solid var(--surface-border-strong); background: var(--surface-1); color: var(--text-color); font-size: var(--text-sm);
    transition: width var(--transition-fast), border-color var(--transition-fast);
}
.cal-search input:focus { outline: none; width: 220px; border-color: var(--accent-color); }
.cal-select {
    height: 34px; max-width: 180px; padding: 0 28px 0 10px; border-radius: 8px;
    border: 1px solid var(--surface-border-strong); background-color: var(--surface-1); color: var(--text-color);
    font-size: var(--text-sm); appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239A9A9A' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
.cal-select:focus { outline: none; border-color: var(--accent-color); }
.cal-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-1); border: 1px solid var(--surface-border-strong); }
.cal-seg button {
    height: 28px; padding: 0 12px; border: none; border-radius: 7px; background: none;
    color: var(--text-light); font-size: var(--text-sm); font-weight: 600; cursor: pointer;
}
.cal-seg button:hover { color: var(--text-color); }
.cal-seg button.is-active { background: var(--accent-color); color: #fff; }

.cal-view { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.cal-view.is-loading::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; z-index: 30;
    background: linear-gradient(90deg, transparent, var(--accent-hover), transparent);
    background-size: 40% 100%; background-repeat: no-repeat;
    animation: cal-load 1s linear infinite;
}
@keyframes cal-load { from { background-position: -40% 0; } to { background-position: 140% 0; } }

/* ── Shared item pieces ── */
.cal-tick {
    flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
    width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid currentColor;
    font-size: 0.5rem; cursor: pointer; opacity: .9;
}
.cal-tick:hover { background: rgba(255, 255, 255, 0.15); }
.cal-tick.is-done { background: var(--c); border-color: var(--c); color: #fff; }
.cal-lead { flex: 0 0 auto; font-size: 0.62rem; opacity: .85; }
.cal-lead-dim { opacity: .55; }
.cal-more {
    align-self: center; justify-self: start; margin-left: 4px;
    border: none; background: none; padding: 0 6px; border-radius: 4px;
    color: var(--text-light); font-size: 0.7rem; font-weight: 600; cursor: pointer; z-index: 2;
}
.cal-more:hover { background: var(--cal-hover); color: var(--text-color); }

.cal-daynote { display: inline-flex; align-items: center; gap: 3px; font-size: 0.62rem; font-weight: 700; cursor: help; }
.cal-daynote.is-danger { color: #f87171; }
.cal-daynote.is-warning { color: #fbbf24; }
.cal-daynote.is-info { color: #60a5fa; }

/* Bars: all-day strip and month rows */
.cal-bar {
    position: relative; z-index: 1;
    display: flex; align-items: center; gap: 5px; min-width: 0; height: var(--bar-h);
    margin: 1px 3px; padding: 0 7px; border-radius: 5px;
    font-size: 0.72rem; line-height: var(--bar-h); color: var(--text-color);
    cursor: pointer; user-select: none; overflow: hidden;
}
.cal-bar.is-solid { background: color-mix(in srgb, var(--c) 78%, #000); color: #fff; font-weight: 600; }
.cal-bar.is-solid:hover { background: color-mix(in srgb, var(--c) 90%, #000); }
.cal-bar.is-dot:hover { background: var(--cal-hover); }
.cal-bar-dot { flex: 0 0 7px; height: 7px; border-radius: 50%; background: var(--c); }
.cal-bar.is-task { color: var(--text-color); }
.cal-bar.is-task .cal-tick { color: var(--c); }
.cal-bar-time { flex: 0 0 auto; color: var(--text-light); font-variant-numeric: tabular-nums; }
.cal-bar-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-bar.cont-left { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.cal-bar.cont-right { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.cal-bar.is-done .cal-bar-title { text-decoration: line-through; opacity: .55; }
.cal-bar.is-overdue { box-shadow: inset 2px 0 0 #f87171; }
.cal-bar.is-overdue.is-dot .cal-bar-title { color: #fca5a5; }
.cal-bar.is-proposed { background: transparent !important; border: 1px dashed var(--c); color: var(--text-color); }
.cal-bar.is-past.is-solid { opacity: .7; }
.cal-bar[data-drag] { cursor: grab; }
.cal-bar.is-dragging { opacity: .35; }
.cal-bar.is-saving, .cal-ev.is-saving { opacity: .6; pointer-events: none; }
.cal-drag-ghost {
    position: fixed; z-index: 2000; pointer-events: none; margin: 0;
    box-shadow: 0 12px 28px -8px rgba(0, 0, 0, .8); transform: rotate(-1.5deg);
    background: var(--surface-2);
}
body.cal-grabbing, body.cal-grabbing * { cursor: grabbing !important; user-select: none; }

@keyframes cal-flash { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 30% { box-shadow: 0 0 0 3px #fbbf24; } }
.is-flash { animation: cal-flash 1.2s ease 2; }

/* ── Time grid (Day / Week) ── */
.cal-tg {
    --hour-h: 52px; --gutter: 60px;
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
}
.cal-tg-head, .cal-tg-allday {
    display: grid; grid-template-columns: var(--gutter) repeat(var(--cols), minmax(0, 1fr));
    flex: 0 0 auto; background: var(--surface-0);
}
.cal-tg-head { padding-top: 6px; }
.cal-tg-zone {
    display: flex; align-items: flex-end; justify-content: flex-end; padding: 0 8px 4px 0;
    font-size: 0.6rem; color: var(--text-muted); text-align: right; line-height: 1.2;
}
.cal-tg-dayhead {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding-bottom: 6px;
    position: relative;
}
.cal-tg-dayhead::after { content: ''; position: absolute; left: 0; bottom: 0; height: 10px; border-left: 1px solid var(--cal-line); }
.cal-tg-dow { font-size: 0.66rem; font-weight: 600; letter-spacing: .08em; color: var(--text-light); }
.cal-tg-date {
    width: 42px; height: 42px; border: none; border-radius: 50%; background: none;
    font-size: 1.45rem; font-weight: 500; color: var(--text-color); font-variant-numeric: tabular-nums; cursor: pointer;
}
.cal-tg-date:hover { background: var(--cal-hover); }
.cal-tg-dayhead.is-past .cal-tg-date, .cal-tg-dayhead.is-past .cal-tg-dow { color: var(--text-muted); }
.cal-tg-dayhead.is-today .cal-tg-dow { color: var(--accent-hover); }
.cal-tg-dayhead.is-today .cal-tg-date { background: var(--accent-color); color: #fff; font-weight: 600; }
.cal-tg-dayhead .cal-daynote { position: absolute; top: 2px; right: 8px; }
.is-day .cal-tg-dayhead { align-items: flex-start; padding-left: 12px; }

.cal-tg-allday { border-bottom: 1px solid var(--cal-line-strong); box-shadow: 0 6px 10px -10px rgba(0, 0, 0, .9); position: relative; z-index: 3; }
.cal-tg-allday-label { align-items: center; gap: 2px; padding: 4px 8px 4px 0; }
.cal-tg-expand { width: 22px; height: 22px; font-size: 0.6rem; }
.cal-tg-bars {
    grid-column: 2 / -1; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    padding: 2px 0 4px; min-height: 28px; position: relative;
}
.cal-tg-allday.is-empty .cal-tg-bars { min-height: 14px; }
.cal-tg-bars-cell { border-left: 1px solid var(--cal-line); z-index: 0; }
.cal-tg-bars-cell.is-drop, .cal-mcell.is-drop { background: rgba(140, 110, 82, .16); }

.cal-tg-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; position: relative; }
.cal-tg-body { position: relative; display: grid; grid-template-columns: var(--gutter) 1fr; }
.cal-tg-gutter { position: relative; }
.cal-tg-hour {
    position: absolute; right: 0; transform: translateY(-50%);
    display: flex; flex-direction: column; align-items: flex-end; padding-right: 8px;
    font-size: 0.64rem; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.cal-tg-hour2 { color: #5d6b7c; font-size: 0.6rem; }
.cal-tg-cols {
    position: relative; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    background-image: linear-gradient(to bottom, var(--cal-line) 1px, transparent 1px);
    background-size: 100% var(--hour-h);
}
.cal-tg-col { position: relative; border-left: 1px solid var(--cal-line); cursor: cell; }
.cal-tg-col.is-today { background: rgba(140, 110, 82, 0.035); }
.cal-tg-off { position: absolute; left: 0; right: 0; background: var(--cal-off); pointer-events: none; }

/* Now line */
.cal-now { position: absolute; left: -1px; right: 0; height: 2px; background: var(--cal-now); z-index: 6; pointer-events: none; }
.cal-now::before {
    content: ''; position: absolute; left: -6px; top: -5px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--cal-now); box-shadow: 0 0 0 3px rgba(234, 67, 53, .25);
}
.cal-now-faint { position: absolute; left: 0; right: 0; height: 1px; background: rgba(234, 67, 53, .35); z-index: 1; pointer-events: none; }
.cal-now-label {
    position: absolute; right: 4px; transform: translateY(-50%); z-index: 7;
    padding: 1px 5px; border-radius: 4px; background: var(--cal-now); color: #fff;
    font-size: 0.6rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* Selection while creating */
.cal-sel {
    position: absolute; left: 2px; right: 6px; z-index: 8; border-radius: 6px;
    background: color-mix(in srgb, var(--accent-color) 55%, transparent);
    border: 1px solid var(--accent-hover); box-shadow: 0 8px 18px -8px rgba(0, 0, 0, .8);
    padding: 3px 7px; font-size: 0.72rem; font-weight: 600; color: #fff; pointer-events: none;
}

/* Events */
.cal-ev {
    position: absolute; z-index: 4; overflow: hidden;
    display: flex; flex-direction: column; gap: 1px;
    padding: 3px 7px 3px 8px; border-radius: 6px;
    background: color-mix(in srgb, var(--c) 30%, #141414);
    border-left: 3px solid var(--c);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .55);
    color: #f5f5f5; font-size: 0.72rem; line-height: 1.25;
    cursor: pointer; user-select: none;
    transition: background var(--transition-fast), box-shadow var(--transition-fast);
}
.cal-ev:hover { background: color-mix(in srgb, var(--c) 42%, #141414); z-index: 9; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .9), 0 0 0 1px rgba(0, 0, 0, .55); }
.cal-ev:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 1px; }
.cal-ev-title { display: flex; align-items: center; gap: 5px; font-weight: 600; min-width: 0; }
.cal-ev-title > span:not(.cal-tick):not(.cal-ev-time-inline) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev:not(.is-short) .cal-ev-title > span:not(.cal-tick) { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-ev-time, .cal-ev-time-inline { color: rgba(255, 255, 255, .72); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-ev-time-inline { flex: 0 0 auto; margin-left: auto; font-size: 0.66rem; }
.cal-ev-loc { color: rgba(255, 255, 255, .62); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.68rem; }
.cal-ev.is-short { flex-direction: row; align-items: center; padding-top: 0; padding-bottom: 0; }
.cal-ev.is-short .cal-ev-title { flex: 1; }
.cal-ev.is-past { opacity: .62; }
.cal-ev.is-past:hover { opacity: 1; }
.cal-ev.is-tentative {
    background-image: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(255, 255, 255, .05) 6px 12px);
}
.cal-ev.is-proposed {
    background: color-mix(in srgb, var(--c) 10%, transparent);
    border: 1px dashed color-mix(in srgb, var(--c) 80%, #fff); border-left-width: 3px; border-left-style: solid;
}
.cal-ev.is-task { border-left: none; background: color-mix(in srgb, var(--c) 22%, #141414); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 55%, transparent); }
.cal-ev.is-task .cal-tick { color: var(--c); }
.cal-ev.is-done .cal-ev-title > span:not(.cal-tick) { text-decoration: line-through; opacity: .6; }
.cal-ev.is-overdue { box-shadow: inset 0 0 0 1px #f87171; }
.cal-ev.is-call { border-left-style: dotted; }
.cal-ev.clip-top { border-top-left-radius: 0; border-top-right-radius: 0; }
.cal-ev.clip-bottom { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.cal-ev.is-editable { cursor: grab; }
.cal-ev.is-dragging { z-index: 20; opacity: .92; box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .9); cursor: grabbing; }
.cal-ev-grip { position: absolute; left: 0; right: 0; bottom: 0; height: 7px; cursor: ns-resize; }
.cal-ev-grip::after { content: ''; position: absolute; left: 50%; bottom: 2px; width: 16px; height: 2px; margin-left: -8px; border-radius: 2px; background: rgba(255, 255, 255, .5); opacity: 0; }
.cal-ev:hover .cal-ev-grip::after { opacity: 1; }
.cal-ev-ai { position: absolute; right: 3px; top: 3px; display: flex; gap: 3px; opacity: 0; transition: opacity var(--transition-fast); }
.cal-ev:hover .cal-ev-ai, .cal-ev:focus-within .cal-ev-ai { opacity: 1; }
@media (hover: none) { .cal-ev-ai { opacity: 1; } }
.cal-ev-ai button {
    width: 20px; height: 20px; border-radius: 50%; border: none;
    background: rgba(0, 0, 0, .55); color: #fff; font-size: 0.6rem; cursor: pointer;
}
.cal-ev-ai button:hover { background: var(--accent-color); }
.cal-ev.is-short .cal-ev-ai { top: 50%; transform: translateY(-50%); }

/* ── Month ── */
.cal-month { position: absolute; inset: 0; display: flex; flex-direction: column; }
.cal-mhead { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); flex: 0 0 32px; }
.cal-mh {
    display: flex; align-items: center; justify-content: center;
    font-size: 0.66rem; font-weight: 600; letter-spacing: .08em; color: var(--text-light);
    border-left: 1px solid var(--cal-line);
}
.cal-mh:first-child { border-left: none; }
.cal-mgrid { flex: 1; min-height: 0; display: grid; }
.cal-mrow { position: relative; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); border-top: 1px solid var(--cal-line); min-height: 0; overflow: hidden; }
.cal-mcell { border-left: 1px solid var(--cal-line); display: flex; justify-content: center; align-items: flex-start; padding-top: 4px; gap: 4px; cursor: cell; transition: background var(--transition-fast); }
.cal-mcell:first-child { border-left: none; }
.cal-mcell:hover { background: rgba(255, 255, 255, .015); }
.cal-mcell.is-weekend { background: rgba(0, 0, 0, .12); }
.cal-mcell.is-other .cal-mdate { color: var(--text-muted); }
.cal-mdate {
    min-width: 24px; height: 24px; padding: 0 6px; border: none; border-radius: 12px; background: none;
    font-size: 0.74rem; font-weight: 500; color: var(--text-color); font-variant-numeric: tabular-nums; cursor: pointer;
}
.cal-mdate:hover { background: var(--cal-hover); }
.cal-mcell.is-today .cal-mdate { background: var(--accent-color); color: #fff; font-weight: 700; }
.cal-mbars { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-auto-rows: 22px; z-index: 1; pointer-events: none; align-content: start; }
.cal-mbars > * { pointer-events: auto; }
.cal-mbars .cal-bar { margin-top: 1px; margin-bottom: 1px; }
.cal-mcell .cal-daynote { margin-top: 5px; }

/* ── Year ── */
.cal-year { position: absolute; inset: 0; overflow-y: auto; padding: var(--space-4) var(--space-6) var(--space-8); }
.cal-ysummary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); margin-bottom: var(--space-5); }
.cal-ychip {
    display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
    background: color-mix(in srgb, var(--c) 18%, transparent); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
    font-size: var(--text-xs); color: var(--text-color);
}
.cal-ychip i { color: var(--c); font-size: 0.65rem; }
.cal-ybusiest { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--text-light); margin-left: var(--space-2); }
.cal-ybusiest i { color: #f97316; }
.cal-ylegend { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 0.66rem; color: var(--text-muted); }
.cal-ylegend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; }
.cal-ylegend i.is-flag-key, .cal-ylegend i.is-flag-danger-key { width: 6px; height: 6px; border-radius: 50%; margin-left: 8px; }
.cal-ylegend i.is-flag-key { background: #fbbf24; }
.cal-ylegend i.is-flag-danger-key { background: #f87171; }
.cal-ygrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-5) var(--space-6); }
.cal-ymonth { padding: var(--space-3); border-radius: 12px; border: 1px solid transparent; }
.cal-ymonth.is-current { border-color: var(--surface-border-strong); background: var(--surface-1); }
.cal-ymonth header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; padding: 0 2px; }
.cal-ymonth-name { border: none; background: none; padding: 0; font-size: var(--text-base); font-weight: 700; color: var(--text-color); cursor: pointer; }
.cal-ymonth-name:hover { color: var(--accent-hover); }
.cal-ymonth.is-current .cal-ymonth-name { color: var(--accent-hover); }
.cal-ymonth-count { font-size: 0.66rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.cal-ydows, .cal-ydays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-ydows span { text-align: center; font-size: 0.6rem; color: var(--text-muted); font-weight: 600; }
.cal-yday {
    position: relative; aspect-ratio: 1; border: none; border-radius: 5px;
    font-size: 0.66rem; color: var(--text-light); font-variant-numeric: tabular-nums; cursor: pointer;
    transition: transform var(--transition-fast);
}
.cal-yday:hover { transform: scale(1.15); z-index: 1; outline: 1px solid var(--accent-hover); }
.cal-yday.is-blank { background: none; pointer-events: none; }
.cal-h0 { background: rgba(255, 255, 255, .025); }
.cal-h1 { background: rgba(140, 110, 82, .28); color: var(--text-color); }
.cal-h2 { background: rgba(140, 110, 82, .48); color: #fff; }
.cal-h3 { background: rgba(168, 128, 96, .72); color: #fff; }
.cal-h4 { background: #c49a6c; color: #1a120c; font-weight: 700; }
.cal-yday.is-flag::after, .cal-yday.is-flag-danger::after {
    content: ''; position: absolute; top: 2px; right: 2px; width: 5px; height: 5px; border-radius: 50%; background: #fbbf24;
}
.cal-yday.is-flag-danger::after { background: #f87171; }
.cal-yday.is-today { outline: 2px solid var(--cal-now); outline-offset: 0; color: #fff; font-weight: 700; }

/* ── Agenda ── */
.cal-agenda { position: absolute; inset: 0; overflow-y: auto; padding: var(--space-4) var(--space-6) var(--space-8); }
.cal-ag-day { display: grid; grid-template-columns: 96px 1fr; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--cal-line); }
.cal-ag-date { display: flex; align-items: baseline; gap: 8px; border: none; background: none; padding: 4px 0 0; color: var(--text-color); cursor: pointer; text-align: left; align-self: start; }
.cal-ag-num { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 1.3rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.cal-ag-dow { font-size: 0.64rem; font-weight: 600; color: var(--text-light); letter-spacing: .06em; }
.cal-ag-day.is-today .cal-ag-num { background: var(--accent-color); color: #fff; }
.cal-ag-day.is-today .cal-ag-dow { color: var(--accent-hover); }
.cal-ag-list { display: flex; flex-direction: column; }
.cal-ag-row {
    display: grid; grid-template-columns: 150px 12px 1fr; align-items: center; gap: var(--space-3);
    padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.cal-ag-row:hover, .cal-ag-row:focus-visible { background: var(--cal-hover); outline: none; }
.cal-ag-time { font-size: var(--text-sm); color: var(--text-light); font-variant-numeric: tabular-nums; }
.cal-ag-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.cal-ag-row.is-proposed .cal-ag-dot { background: none; border: 2px dashed var(--c); }
.cal-ag-main { display: flex; flex-direction: column; min-width: 0; }
.cal-ag-title { display: flex; align-items: center; gap: 7px; font-size: var(--text-base); color: var(--text-color); font-weight: 500; }
.cal-ag-title .cal-tick { color: var(--c); }
.cal-ag-title > span:not(.cal-tick):not(.cal-pop-badge) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ag-sub { font-size: var(--text-xs); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ag-row.is-done .cal-ag-title > span:not(.cal-tick) { text-decoration: line-through; opacity: .55; }
.cal-ag-foot { display: flex; justify-content: center; padding: var(--space-5) 0; }
.cal-empty { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); padding: 80px 0 40px; color: var(--text-muted); }
.cal-empty i { font-size: 2.4rem; color: var(--accent-muted); }

/* ── Popovers ── */
.cal-pop {
    position: fixed; z-index: 1060;
    padding: 14px 16px 14px; border-radius: 14px;
    background: #1d1d1d; border: 1px solid var(--surface-border-strong);
    box-shadow: 0 24px 60px -16px rgba(0, 0, 0, .9), 0 2px 6px rgba(0, 0, 0, .4);
    color: var(--text-color); font-size: var(--text-sm);
    animation: cal-pop-in .12s ease-out;
}
@keyframes cal-pop-in { from { opacity: 0; transform: translateY(4px) scale(.98); } to { opacity: 1; transform: none; } }
.cal-pop-tools { display: flex; justify-content: flex-end; gap: 2px; margin: -6px -8px 2px 0; }
.cal-pop-tools .cal-icon-btn { width: 30px; height: 30px; }
.cal-pop-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.cal-pop-swatch { flex: 0 0 14px; height: 14px; margin-top: 5px; border-radius: 4px; background: var(--c); }
.cal-pop-title { font-size: 1.05rem; font-weight: 600; line-height: 1.3; color: #fff; word-break: break-word; }
.cal-pop-title.is-done { text-decoration: line-through; opacity: .7; }
.cal-pop-when { margin-top: 2px; color: var(--text-light); font-size: var(--text-sm); }
.cal-pop-dim { color: var(--text-muted); font-size: var(--text-xs); }
.cal-pop-body { display: flex; flex-direction: column; gap: 7px; }
.cal-pop-row { display: grid; grid-template-columns: 14px 1fr; gap: 12px; align-items: start; }
.cal-pop-row > i { margin-top: 3px; color: var(--text-light); font-size: 0.78rem; text-align: center; }
.cal-pop-row a { color: var(--accent-hover); text-decoration: none; }
.cal-pop-row a:hover { text-decoration: underline; }
.cal-pop-layer { color: var(--text-muted); font-size: var(--text-xs); }
.cal-pop-desc { white-space: pre-wrap; color: var(--text-light); max-height: 160px; overflow-y: auto; }
.cal-pop-bar { height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 5px 0 2px; }
.cal-pop-bar span { display: block; height: 100%; background: var(--accent-hover); }
.cal-pop-badge {
    display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
    background: var(--surface-2); color: var(--text-light); font-size: 0.62rem; font-weight: 700; vertical-align: middle; letter-spacing: .02em;
}
.cal-pop-badge.is-danger { background: rgba(239, 68, 68, .16); color: #fca5a5; }
.cal-pop-badge.is-ai { background: rgba(251, 191, 36, .14); color: #fcd34d; }
.cal-pop-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-top: 14px; }
.cal-pop-actions .btn { border-radius: 8px; font-size: var(--text-xs); font-weight: 600; }

.cal-qc-title {
    width: 100%; margin-bottom: 10px; padding: 4px 0 6px; border: none; border-bottom: 2px solid var(--surface-border-strong);
    background: none; color: #fff; font-size: 1.15rem; font-weight: 500;
}
.cal-qc-title:focus { outline: none; border-bottom-color: var(--accent-hover); }
.cal-qc-kinds { display: flex; gap: 6px; margin-bottom: 10px; }
.cal-qc-kind {
    display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 8px;
    border: 1px solid transparent; background: none; color: var(--text-light); font-size: var(--text-xs); font-weight: 600; cursor: pointer;
}
.cal-qc-kind:hover { background: var(--cal-hover); }
.cal-qc-kind.is-active { background: rgba(140, 110, 82, .22); color: #fff; border-color: rgba(140, 110, 82, .5); }
.cal-qc-allday { margin: 8px 0 0 26px; }
.cal-nl-head { display: flex; align-items: center; gap: 8px; margin: -24px 0 8px; min-height: 18px; }
.cal-nl-head .cal-pop-badge { margin-left: 0; }

.cal-pop-dayhead { display: flex; flex-direction: column; align-items: center; margin: -18px 0 8px; }
.cal-pop-dayhead span { font-size: 0.66rem; font-weight: 600; color: var(--text-light); letter-spacing: .08em; }
.cal-pop-daynum { width: 44px; height: 44px; border-radius: 50%; border: none; background: none; color: #fff; font-size: 1.5rem; cursor: pointer; }
.cal-pop-daynum:hover { background: var(--cal-hover); }
.cal-pop-list { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow-y: auto; }
.cal-pop-li {
    display: flex; align-items: center; gap: 8px; width: 100%; padding: 5px 8px; border: none; border-radius: 6px;
    background: none; color: var(--text-color); text-align: left; font-size: var(--text-sm); cursor: pointer;
}
.cal-pop-li:hover { background: var(--cal-hover); }
.cal-pop-li-dot { flex: 0 0 8px; height: 8px; border-radius: 50%; background: var(--c); }
.cal-pop-li-time { flex: 0 0 auto; color: var(--text-light); font-size: var(--text-xs); font-variant-numeric: tabular-nums; min-width: 36px; }
.cal-pop-li-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-pop-li.is-done .cal-pop-li-title { text-decoration: line-through; opacity: .55; }

.cal-chip {
    display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px;
    border: 1px solid var(--surface-border-strong); background: none; color: var(--text-light);
    font-size: var(--text-xs); font-weight: 500; cursor: pointer; white-space: nowrap;
}
.cal-chip:hover { border-color: var(--accent-color); color: var(--text-color); }
.cal-chip.is-on { background: rgba(140, 110, 82, .2); border-color: rgba(140, 110, 82, .55); color: #fff; }
.cal-chip button { border: none; background: none; padding: 0; color: inherit; opacity: .7; font-size: 0.9rem; line-height: 1; cursor: pointer; }
.cal-chip button:hover { opacity: 1; }

/* ── Event editor ── */
.cal-editor .modal-content { border-radius: 16px; }
.cal-ed-title {
    width: 100%; margin: 0 0 var(--space-4); padding: 6px 0 8px; border: none; border-bottom: 2px solid var(--surface-border-strong);
    background: none; color: #fff; font-size: 1.4rem; font-weight: 500;
}
.cal-ed-title:focus { outline: none; border-bottom-color: var(--accent-hover); }
.cal-ed-grid { display: grid; grid-template-columns: 20px 1fr; gap: 16px 14px; align-items: start; }
.cal-ed-grid > i { margin-top: 9px; color: var(--text-light); text-align: center; font-size: 0.9rem; }
.cal-ed-when, .cal-ed-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cal-ed-row { margin-top: 8px; }
.cal-ed-when .form-control { width: auto; }
.cal-ed-when input[type="time"] { width: 120px; }
.cal-ed-to { color: var(--text-light); font-size: var(--text-sm); }
.cal-ed-check { display: inline-flex; align-items: center; gap: 7px; margin: 0; font-size: var(--text-sm); color: var(--text-color); cursor: pointer; }
.cal-ed-check input { accent-color: var(--accent-color); width: 15px; height: 15px; }
.cal-ed-repeat { width: auto; max-width: 300px; }
.cal-ed-status, .cal-ed-ends { width: auto; }
.cal-ed-dim { font-size: var(--text-xs); color: var(--text-muted); }
.cal-ed-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-ed-swatches { display: flex; gap: 8px; align-items: center; padding-top: 4px; }
.cal-swatch {
    width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; background: var(--c);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); cursor: pointer;
}
.cal-swatch.is-default { background: conic-gradient(var(--c) 0 50%, transparent 0) , var(--surface-2); }
.cal-swatch.is-on { border-color: #fff; transform: scale(1.1); }
.cal-editor .form-control, .cal-editor .form-select { background-color: var(--surface-0); border-color: var(--surface-border-strong); color: var(--text-color); }
.cal-editor .form-control:focus, .cal-editor .form-select:focus { border-color: var(--accent-color); box-shadow: 0 0 0 3px var(--accent-light); }
.cal-editor input[type="date"]::-webkit-calendar-picker-indicator,
.cal-editor input[type="time"]::-webkit-calendar-picker-indicator { filter: invert(.7); }

/* ── Drawer (Plan my week, Meeting prep) ── */
.cal-drawer {
    position: absolute; top: 0; right: 0; bottom: 0; z-index: 40;
    width: min(420px, 100%); display: flex; flex-direction: column;
    background: var(--surface-1); border-left: 1px solid var(--surface-border-strong);
    box-shadow: -24px 0 48px -24px rgba(0, 0, 0, .9);
    transform: translateX(100%); transition: transform .2s ease;
}
.cal-drawer.is-open { transform: none; }
.cal-drawer > header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 10px 20px; border-bottom: 1px solid var(--surface-border); }
.cal-drawer h2 i { color: #fbbf24; font-size: 0.85rem; }
.cal-drawer h2 { margin: 0; font-size: var(--text-md); font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.cal-drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 18px; }
.cal-drawer > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--surface-border); }
.cal-drawer-loading { color: var(--text-light); font-size: var(--text-sm); padding: 20px 0; }
.cal-drawer-error { padding: 10px 12px; border-radius: 8px; background: rgba(239, 68, 68, .1); color: #fca5a5; font-size: var(--text-sm); }
.cal-drawer-lead { margin: 0; color: var(--text-light); font-size: var(--text-sm); line-height: 1.5; }
.cal-drawer-sec { display: flex; flex-direction: column; gap: 6px; }
.cal-drawer-sec-title { font-size: var(--text-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-light); display: flex; align-items: center; gap: 8px; }
.cal-drawer-sec-title a { color: #fff; text-transform: none; letter-spacing: 0; font-size: var(--text-md); text-decoration: none; }
.cal-drawer-sec-title a:hover { color: var(--accent-hover); }
.cal-drawer-sec-title.is-warn { color: #fbbf24; }
.cal-drawer-hint { font-size: var(--text-xs); color: var(--text-muted); }
.cal-drawer-hint a { color: var(--accent-hover); }
.cal-plan-row {
    display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 8px 10px; border-radius: 8px;
    border: 1px dashed var(--surface-border-strong); background: none; color: var(--text-color); text-align: left;
}
button.cal-plan-row { cursor: pointer; }
button.cal-plan-row:hover { border-color: var(--accent-color); }
.cal-plan-row.is-late { border-color: rgba(251, 191, 36, .45); }
.cal-plan-time { flex: 0 0 96px; font-size: var(--text-xs); color: var(--text-light); font-variant-numeric: tabular-nums; padding-top: 1px; }
.cal-plan-main { display: flex; flex-direction: column; min-width: 0; }
.cal-plan-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-color); text-decoration: none; }
.cal-plan-why { font-size: 0.7rem; color: var(--text-muted); }
.cal-prep-event { padding-bottom: 4px; }
.cal-prep-title { font-size: 1.1rem; font-weight: 600; color: #fff; }
.cal-prep-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-prep-facts span { padding: 2px 9px; border-radius: 999px; background: var(--surface-2); font-size: var(--text-xs); color: var(--text-light); }
.cal-md { font-size: var(--text-sm); line-height: 1.55; color: var(--text-color); }
.cal-md p { margin: 0 0 8px; }
.cal-md ul { margin: 0 0 8px; padding-left: 18px; }
.cal-md strong { color: #fff; }
.cal-prep-task {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px;
    color: var(--text-color); text-decoration: none; font-size: var(--text-sm);
}
.cal-prep-task:hover { background: var(--cal-hover); color: #fff; }
.cal-prep-task > span:nth-child(2) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-prep-task.is-overdue .cal-pop-dim { color: #fca5a5; }
.cal-prep-dot { flex: 0 0 8px; height: 8px; border-radius: 50%; background: #eab308; }
.cal-prep-dot.is-critical { background: #ef4444; }
.cal-prep-dot.is-high { background: #f97316; }
.cal-prep-dot.is-low { background: #64748b; }
.cal-prep-call { padding: 10px 12px; border-radius: 10px; background: var(--surface-0); border: 1px solid var(--surface-border); display: flex; flex-direction: column; gap: 6px; }
.cal-prep-call-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.cal-prep-call-head a { color: var(--text-color); font-weight: 600; font-size: var(--text-sm); text-decoration: none; }
.cal-prep-call-head a:hover { color: var(--accent-hover); }
.cal-prep-text { font-size: var(--text-xs); color: var(--text-light); line-height: 1.5; }
.cal-prep-actions { margin: 0; padding-left: 18px; font-size: var(--text-xs); color: var(--text-color); }
.cal-prep-call .btn { align-self: flex-start; font-size: var(--text-xs); border-radius: 8px; }
.cal-prep-note { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--surface-0); color: var(--text-light); font-size: var(--text-xs); text-decoration: none; }
.cal-prep-note b { color: var(--text-color); font-size: var(--text-sm); }
.cal-prep-note:hover { outline: 1px solid var(--accent-color); }

/* ── Narrow screens ── */
@media (max-width: 1100px) {
    .cal-search input { width: 120px; }
    .cal-btn-ai span { display: none; }
    .cal-select { max-width: 130px; }
}
@media (max-width: 900px) {
    .cal-side {
        position: fixed; top: var(--nav-h, 78px); bottom: 0; left: 0; z-index: 50;
        transform: translateX(-100%); transition: transform .2s ease; box-shadow: 20px 0 40px -20px rgba(0, 0, 0, .9);
    }
    body.cal-side-open .cal-side { transform: none; }
    .cal-side-toggle { display: inline-flex; }
    .cal-toolbar { flex-wrap: wrap; padding: 8px 16px; }
    .cal-toolbar-right { width: 100%; margin-left: 0; overflow-x: auto; }
    .cal-title { font-size: 1.1rem; }
    .cal-search { display: none; }
}
@media (max-width: 600px) {
    .cal-seg button { padding: 0 8px; font-size: var(--text-xs); }
    .cal-select { display: none; }
    .cal-ag-day { grid-template-columns: 1fr; gap: 4px; }
    .cal-ag-row { grid-template-columns: 90px 10px 1fr; }
    .cal-year { padding: var(--space-3) var(--space-4); }
    .cal-tg { --gutter: 46px; }
    .cal-tg-date { width: 34px; height: 34px; font-size: 1.1rem; }
}
/* Relationship block in meeting prep (Network) */
.cal-prep-rel { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); margin-bottom: 6px; color: inherit; text-decoration: none; }
.cal-prep-rel:hover { color: inherit; border-color: var(--accent-color); background: color-mix(in srgb, var(--accent-color) 12%, var(--surface-2)); }
.cal-prep-rel-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
