/* ==========================================================================
   日历（对标 Outlook 网页版日历）
   ========================================================================== */
.cal-app .cal-nav { width: 260px; }
.cal-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- 左侧：月份小日历 ---------- */
.mini-cal { padding: 4px 12px 8px 14px; user-select: none; }
.mini-cal-head { display: flex; align-items: center; gap: 2px; height: 32px; padding: 0 0 0 4px; }
.mini-cal-title { flex: 1; font-weight: 600; font-size: 14px; color: var(--fg1); }
.mini-cal-nav { width: 28px; height: 28px; border: 0; border-radius: var(--radius); background: transparent; color: var(--fg2); cursor: pointer; display: grid; place-items: center; }
.mini-cal-nav:hover { background: var(--hover); color: var(--fg1); }
.mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.mini-cal-wd { height: 26px; display: grid; place-items: center; font-size: 12px; color: var(--fg3); }
.mini-cal-day {
    height: 28px; border: 0; padding: 0; background: transparent; font: inherit; font-size: 12px; color: var(--fg1);
    cursor: pointer; position: relative; display: grid; place-items: center; z-index: 0;
}
.mini-cal-day::before { content: ""; position: absolute; width: 26px; height: 26px; border-radius: 50%; z-index: -1; }
.mini-cal-day:hover::before { background: var(--hover); }
.mini-cal-day.other { color: var(--fg4); }
.mini-cal-day.in-range { background: var(--brand-soft); }
.mini-cal-day.in-range:hover::before { background: rgba(15,108,189,.12); }
.mini-cal-day.selected::before { box-shadow: inset 0 0 0 1px var(--brand); }
.mini-cal-day.today { color: #fff; font-weight: 600; }
.mini-cal-day.today::before, .mini-cal-day.today:hover::before { background: var(--brand); }

/* ---------- 左侧：我的日历 ---------- */
.cal-item { gap: 10px; padding-left: 10px; font-weight: 400; }
.cal-check { width: 16px; height: 16px; margin: 0; flex: none; cursor: pointer; accent-color: var(--cal, var(--brand)); }

/* ---------- 命令栏 ---------- */
.cal-range { margin-left: 8px; font-size: 16px; font-weight: 600; color: var(--fg1); white-space: nowrap; }
.cal-views { display: flex; align-items: center; gap: 2px; }
.cal-view {
    height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border: 0; border-radius: var(--radius);
    background: transparent; color: var(--fg2); font: inherit; cursor: pointer; white-space: nowrap; position: relative;
}
.cal-view:hover { background: var(--hover); color: var(--fg1); }
.cal-view.on { background: var(--brand-soft); color: var(--brand-fg); font-weight: 600; }
.cal-view.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 2px; border-radius: 1px; background: var(--brand); }

.cal-surface { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; background: var(--surface); }
.cal-progress { position: absolute; top: 0; left: 0; right: 0; height: 2px; overflow: hidden; z-index: 5; }
.cal-progress::after { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: var(--brand); animation: cal-progress 1s ease-in-out infinite; }
@keyframes cal-progress { from { left: -30%; } to { left: 100%; } }

/* ---------- 时间网格（日 / 工作周 / 周） ---------- */
.tg { --gutter: 60px; flex: 1; display: flex; flex-direction: column; min-height: 0; user-select: none; }
.tg-head, .tg-allday { display: grid; grid-template-columns: var(--gutter) repeat(var(--cols), minmax(0, 1fr)); overflow-y: hidden; scrollbar-gutter: stable; flex: none; }
.tg-head { border-bottom: 1px solid var(--colorNeutralStroke3, #f0f0f0); }
.tg-dayhead {
    position: relative; display: flex; align-items: baseline; gap: 6px; padding: 10px 10px 8px; cursor: pointer;
    border-left: 1px solid var(--colorNeutralStroke3, #f0f0f0); min-width: 0; overflow: hidden; white-space: nowrap;
}
.tg-dayhead:hover { background: var(--hover); }
.tg-daynum { font-size: 22px; line-height: 28px; font-weight: 600; color: var(--fg1); }
.tg-dayname { font-size: 13px; color: var(--fg3); }
.tg-dayhead.weekend .tg-daynum { color: var(--fg2); font-weight: 400; }
.tg-dayhead.today .tg-daynum, .tg-dayhead.today .tg-dayname { color: var(--brand-fg); font-weight: 600; }
.tg-dayhead.today::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--brand); }

.tg-allday { border-bottom: 1px solid var(--colorNeutralStroke1, #d1d1d1); max-height: 30%; overflow-y: auto; }
.tg-allday-label { font-size: 12px; color: var(--fg3); text-align: right; padding: 5px 8px 0 0; }
.tg-allday-cells {
    grid-column: 2 / -1;
    display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-auto-rows: 24px; row-gap: 2px; padding: 3px 0;
    min-height: 30px; box-sizing: border-box;
}
.tg-allday-cell { border-left: 1px solid var(--colorNeutralStroke3, #f0f0f0); margin: -3px 0; cursor: pointer; }
.tg-allday-cell:hover { background: var(--hover); }

.tg-scroll { flex: 1; overflow-y: auto; min-height: 0; scrollbar-gutter: stable; }
.tg-body { display: grid; grid-template-columns: var(--gutter) repeat(var(--cols), minmax(0, 1fr)); position: relative; }
.tg-hours { position: relative; }
.tg-hour { position: absolute; right: 8px; transform: translateY(-50%); font-size: 12px; color: var(--fg3); white-space: nowrap; }
.tg-col { position: relative; border-left: 1px solid var(--colorNeutralStroke2, #e0e0e0); min-width: 0; }
.tg-slot { height: 24px; box-sizing: border-box; border-bottom: 1px dashed var(--colorNeutralStroke3, #ededed); cursor: pointer; }
.tg-slot.half { border-bottom: 1px solid var(--colorNeutralStroke2, #e0e0e0); }
.tg-slot.off { background: var(--surface-alt); }
.tg-col.weekend .tg-slot { background: var(--surface-alt); }
.tg-slot:hover { background: var(--brand-soft) !important; box-shadow: inset 0 0 0 1px rgba(15,108,189,.35); }
.tg-now { position: absolute; left: -1px; right: 0; height: 2px; margin-top: -1px; background: #d13438; z-index: 4; pointer-events: none; }
.tg-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #d13438; }

/* ---------- 事件块 ---------- */
.ev { cursor: pointer; color: var(--fg1); box-sizing: border-box; }
.ev-block {
    position: absolute; z-index: 2; overflow: hidden; padding: 3px 6px 3px 8px; border-radius: var(--radius);
    background: var(--ev-bg); border-left: 3px solid var(--ev); box-shadow: 0 0 0 1px var(--surface);
    font-size: 12px; line-height: 16px; transition: box-shadow .1s;
}
.ev-block:hover { box-shadow: 0 0 0 1px var(--surface), var(--shadow-card); z-index: 3; }
.ev-block .ev-title { font-size: 13px; font-weight: 600; line-height: 18px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; }
.ev-block .ev-sub { color: var(--fg2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-block.compact { padding-top: 1px; padding-bottom: 1px; }
.ev-block.short .ev-title { -webkit-line-clamp: 1; }
.ev-block.compact .ev-title { -webkit-line-clamp: 1; display: block; white-space: nowrap; text-overflow: ellipsis; font-size: 12px; line-height: 16px; }
.ev-block.compact .ev-title .ev-sub { font-weight: 400; margin-left: 4px; }
.ev-icon { width: 12px !important; height: 12px !important; vertical-align: -1px; margin-right: 3px; flex: none; }
.ev-bar {
    position: relative; z-index: 1; display: flex; align-items: center; gap: 6px; min-width: 0; height: 24px; margin: 0 4px 0 3px; padding: 0 8px;
    border-radius: var(--radius); background: var(--ev-bg); border-left: 3px solid var(--ev); font-size: 12px; white-space: nowrap; overflow: hidden;
}
.ev-bar .ev-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.ev-bar .ev-sub { color: var(--fg2); overflow: hidden; text-overflow: ellipsis; }
.ev-bar.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.ev-bar.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.ev-bar:hover { box-shadow: var(--shadow-card); }
.ev.active { background: var(--ev) !important; color: #fff; }
.ev.active .ev-sub, .ev.active .mv-time { color: rgba(255,255,255,.9); }
.ev.active .mv-dot { background: #fff; }
/* 答复状态：未答复为白底虚线框，暂定为斜纹，拒绝 / 已取消为删除线 */
.ev-pending { background: var(--surface); outline: 1px dashed var(--ev); outline-offset: -1px; }
.ev-tentative { background: repeating-linear-gradient(-45deg, var(--ev-bg) 0 5px, var(--surface) 5px 10px); }
.ev-declined, .ev-cancelled { opacity: .7; }
.ev-declined .ev-title, .ev-cancelled .ev-title { text-decoration: line-through; }

/* ---------- 月视图 ---------- */
.mv { flex: 1; display: flex; flex-direction: column; min-height: 0; user-select: none; }
.mv-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1px solid var(--colorNeutralStroke2, #e0e0e0); flex: none; }
.mv-wd { padding: 10px 10px 8px; font-size: 13px; color: var(--fg2); }
.mv-grid { flex: 1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-template-rows: repeat(6, minmax(0, 1fr)); min-height: 0; }
.mv-cell {
    display: flex; flex-direction: column; gap: 2px; padding: 4px 4px 2px; min-height: 0; min-width: 0; overflow: hidden; cursor: pointer;
    border-right: 1px solid var(--colorNeutralStroke3, #f0f0f0); border-bottom: 1px solid var(--colorNeutralStroke2, #e0e0e0);
}
.mv-cell:nth-child(7n) { border-right: 0; }
.mv-cell:hover { background: var(--hover); }
.mv-cell.other { background: var(--surface-alt); }
.mv-cell.other .mv-daynum { color: var(--fg4); }
.mv-date { display: flex; height: 24px; flex: none; }
.mv-daynum {
    border: 0; background: transparent; font: inherit; font-size: 13px; color: var(--fg1); padding: 0 7px; height: 24px; min-width: 24px;
    border-radius: 12px; cursor: pointer;
}
.mv-daynum:hover { background: rgba(0,0,0,.06); }
.mv-cell.today .mv-daynum { background: var(--brand); color: #fff; font-weight: 600; }
.mv-ev { display: flex; align-items: center; gap: 6px; height: 22px; flex: none; padding: 0 6px; border-radius: var(--radius); font-size: 12px; white-space: nowrap; overflow: hidden; }
.mv-ev .ev-title { overflow: hidden; text-overflow: ellipsis; }
.mv-bar { background: var(--ev-bg); border-left: 3px solid var(--ev); font-weight: 600; }
.mv-timed:hover { background: rgba(0,0,0,.05); }
.mv-bar:hover { box-shadow: var(--shadow-card); }
.mv-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ev); flex: none; }
.mv-time { color: var(--fg3); flex: none; }
.mv-more { align-self: flex-start; border: 0; background: transparent; color: var(--brand-fg); font: inherit; font-size: 12px; font-weight: 600; padding: 1px 6px; border-radius: var(--radius); cursor: pointer; }
.mv-more:hover { background: var(--brand-soft); }

/* ---------- 加载骨架 ---------- */
.cal-skeleton { padding: 12px 16px; display: flex; flex-direction: column; gap: 14px; }
.cal-skeleton-head, .cal-skeleton-row { display: grid; grid-template-columns: 52px repeat(7, 1fr); gap: 10px; align-items: center; }
.cal-skeleton-head { grid-template-columns: repeat(7, 1fr); margin-left: 62px; margin-bottom: 8px; }
.cal-skeleton-row { min-height: 44px; }

/* ---------- 搜索结果 ---------- */
.cal-search { flex: 1; }
.cal-search-row { display: flex; align-items: center; gap: 14px; padding: 10px 20px; border-bottom: 1px solid var(--colorNeutralStroke3, #f0f0f0); cursor: pointer; }
.cal-search-row:hover { background: var(--hover); }
.cal-search-row.active { background: var(--brand-soft); }
.cal-search-bar { width: 4px; align-self: stretch; border-radius: 2px; flex: none; }
.cal-search-date { width: 84px; flex: none; }
.cal-search-day { font-size: 22px; line-height: 26px; font-weight: 600; }
.cal-search-title { font-weight: 600; }

/* ---------- 事件详情 ---------- */
.evd-rsvp { background: var(--brand-soft); border-radius: var(--radius-lg); padding: 12px 14px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 10px; }
.evd-rsvp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.evd-row { display: flex; align-items: flex-start; gap: 14px; padding: 10px 0; line-height: 20px; }
.evd-row > svg, .evd-row > .fluent-icon, .evd-row > fluent-icon { flex: none; color: var(--fg3); fill: var(--fg3); }
.evd-repeat { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.evd-repeat svg { width: 12px; height: 12px; }
.evd-cal { display: flex; align-items: center; gap: 8px; }
.evd-section { font-weight: 600; }
.evd-people .muted.small { margin-bottom: 6px; }
.evd-person { display: flex; align-items: center; gap: 10px; padding: 5px 0; min-width: 0; }
.evd-person-text { display: flex; flex-direction: column; min-width: 0; line-height: 18px; }
.evd-avatar { position: relative; display: inline-flex; flex: none; }
.evd-badge { position: absolute; right: -3px; bottom: -3px; width: 15px; height: 15px; border-radius: 50%; display: grid; place-items: center; background: #8a8a8a; box-shadow: 0 0 0 2px var(--surface); }
.evd-badge svg { width: 10px; height: 10px; }
.evd-badge.accepted { background: #13a10e; }
.evd-badge.declined { background: #d13438; }
.evd-badge.tentative { background: #8764b8; }
.evd-desc { white-space: pre-wrap; word-break: break-word; color: var(--fg1); }

/* ---------- 事件编辑 ---------- */
.eve { display: flex; flex-direction: column; }
.eve-title {
    width: 100%; border: 0; border-bottom: 1px solid var(--colorNeutralStroke1, #d1d1d1); outline: 0; background: transparent; color: var(--fg1);
    font: inherit; font-size: 20px; line-height: 28px; font-weight: 600; padding: 6px 2px 8px; margin-bottom: 8px;
}
.eve-title:focus { border-bottom: 2px solid var(--brand); padding-bottom: 7px; box-shadow: none; outline: none; }
.eve-title::placeholder { font-weight: 400; color: var(--fg4); }
.eve-row { display: flex; align-items: center; gap: 14px; padding: 6px 0; min-height: 44px; }
.eve-row-top { align-items: flex-start; }
.eve-row-top .eve-icon { padding-top: 6px; }
.eve-icon { width: 20px; flex: none; display: grid; place-items: center; color: var(--fg3); }
.eve-field { flex: 1; min-width: 0; }
.eve-people {
    border: 1px solid var(--colorNeutralStroke1, #d1d1d1); border-bottom-color: var(--colorNeutralStrokeAccessible, #616161); border-radius: var(--radius);
    padding: 0 8px; min-height: 32px; display: flex; background: var(--surface);
}
.eve-people:focus-within { border-bottom: 2px solid var(--brand); }
.eve-people .recipients { padding: 3px 0; }
.eve-time-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eve-time-line + .eve-time-line { margin-top: 8px; }
.eve-label { width: 32px; color: var(--fg3); flex: none; }
.eve-date { width: 160px; }
.eve-clock { width: 168px; }
.eve-allday { display: inline-flex; align-items: center; gap: 8px; margin-left: 10px; cursor: pointer; color: var(--fg1); }
.eve-wide { width: 100%; }
.eve-select { min-width: 280px; max-width: 100%; }
.eve-calsel { display: flex; align-items: center; gap: 10px; }
.eve-desc { min-height: 140px; }
.eve-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.eve-hint { min-height: 0; padding-top: 0; }
.eve-warn { display: inline-flex; align-items: center; gap: 6px; color: var(--warning); background: #fff9f5; border-radius: var(--radius); padding: 4px 10px; font-size: 13px; }
