/* ============================================================
   cal.css —— 「日历」独立组件样式
   - 看板卡片：与下班倒计时同款白色圆角卡，宽度撑满左侧组件区，
     卡片下方显示名称。
   - 完整版：左侧大日期 + 农历/节日，右侧当月月历（今天高亮、周末红色）。
   - 简版：红色日历头（年月份）+ 白色卡身（大日期 + 农历）。
   - 横条：白底药丸，左侧 月/日、右侧星期（节假日变红）。
   ============================================================ */

/* ===== 看板卡片（完整版）：宽度撑满左侧组件区，高度为两排网址图标，
   与右侧网址图标在同一网格中排列 ===== */
.widget-card[data-widget="calendar"] {
    width: 100%;
    max-width: 100%;
    --cal-red: #f5564d;
    background: #ffffff;
    border: none;
    border-radius: 20px;
    box-shadow: 0 10px 26px rgba(31, 45, 80, 0.14);
    padding: 12px 16px;
    height: var(--widget-h);  /* = 两排网址图标方块高度，卡片底对齐第二排图标底 */
    margin-bottom: 0;
    color: #454a58;
    overflow: visible;
}
.widget-card[data-widget="calendar"]:hover {
    border: none;
    box-shadow: 0 14px 30px rgba(31, 45, 80, 0.2);
}

/* 卡片内不显示标题：标题栏透明覆盖在卡片顶部，仅作拖拽区与移除按钮容器 */
.widget-card[data-widget="calendar"] .widget-head {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    margin-bottom: 0;
    z-index: 5;
}
.widget-card[data-widget="calendar"] .widget-title { visibility: hidden; }
.widget-card[data-widget="calendar"] .widget-remove {
    background: rgba(60, 65, 80, 0.08);
    color: #555c6b;
}
.widget-card[data-widget="calendar"] .widget-remove:hover { background: rgba(255, 95, 109, 0.9); color: #fff; }

.widget-card[data-widget="calendar"] .widget-body {
    overflow-y: auto;
    overflow-x: hidden;
}

/* 卡片下方的组件名称（与网站快捷方式名称同款：白字 + 阴影，适配壁纸背景） */
.cal-card-name {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: var(--icon-gap);
    height: var(--icon-name-h);
    line-height: var(--icon-name-h);
    text-align: center;
    font-size: var(--icon-name-size, 12px);  /* 组件名称与图标名称同字号，由设置「名称大小」统一控制 */
    font-weight: 600;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

/* 三套布局共存于一个卡片，未选中的那套用 [hidden] 收起 */
.cal[hidden] { display: none; }

/* ===== 卡片上的左右切换箭头（探到卡片两侧外缘，点击切换 完整版/简版/横条） ===== */
.cal-card-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
    z-index: 6;
}
.cal-card-nav .cal-nav-arrow {
    pointer-events: auto;
    cursor: pointer;
    width: 30px;
    height: 30px;
    margin: 0 -22px;
    border-radius: 50%;
    line-height: 28px;
    font-size: 22px;
    text-align: center;
    background: rgba(255, 255, 255, 0.92);
    color: #8a92a6;
    box-shadow: 0 4px 12px rgba(31, 45, 80, 0.18);
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.15s ease, transform 0.15s var(--ease-out), color 0.15s ease;
}
.widget-card[data-widget="calendar"]:hover .cal-card-nav .cal-nav-arrow {
    opacity: 1;
    transform: scale(1);
}
.cal-card-nav .cal-nav-arrow:hover { color: #f0a93b; }

/* ===== 简版（中卡片）：宽度 = 2 个网址图标（--widget-w-2），高度为两排网址图标；
   在左侧组件区内水平居中 ===== */
.widget-card[data-widget="calendar"].cal-style-mini {
    width: var(--widget-w-2, 153px);
    padding: 0;
    height: var(--widget-h);
    /* 卡片本身保持 overflow:visible，否则探出边缘的切换箭头会被裁掉；
       红色日历头的圆角裁切由内部 .cal-mini 自身 overflow:hidden 完成 */
}
.widget-card[data-widget="calendar"].cal-style-mini .widget-body { display: flex; }
.cal-mini {
    flex: 1 1 auto;
    width: 100%;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
}
.cal-mini-head {
    flex: none;
    background: linear-gradient(135deg, #ff6a5f, var(--cal-red));
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    padding: 7px 0;
    letter-spacing: 1px;
}
.cal-mini-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 1px;
}
.cal-mini-day {
    font-size: 46px;
    font-weight: 800;
    line-height: 1.05;
    color: #2f3640;
    font-variant-numeric: tabular-nums;
}
.cal-mini-meta {
    font-size: 11px;
    color: #9aa3b2;
    margin-top: 2px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.cal-mini-lunar {
    font-size: 13px;
    font-weight: 600;
    color: #454a58;
    white-space: nowrap;
}
.cal-mini-lunar.is-festival { color: var(--cal-red); }

/* ===== 横条形态（小卡片）：占 2 个网址图标宽、高约 1 个图标；左日期右星期 ===== */
.widget-card[data-widget="calendar"].cal-style-bar {
    /* 宽度由 widgets.js 按实测格宽锚定成 2 整格像素；此处仅为无 JS 时的兜底 */
    width: var(--widget-w-2, 153px);
    min-width: 140px;
    max-width: 100%;
    padding: 0 16px;
    height: 56px;
    height: var(--icon-size, 56px);
    min-height: 56px;
    border-radius: 18px;
}
.widget-card[data-widget="calendar"].cal-style-bar .widget-body {
    overflow: hidden;
    display: flex;
}
/* 双类提权，避免被 .cal{flex-direction:column} 覆盖回竖排 */
.cal.cal-bar {
    flex: 1 1 auto;
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}
.cal-bar-date {
    font-size: 22px;
    font-weight: 800;
    color: #2f3640;
    line-height: 1;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.cal-bar-week {
    font-size: 15px;
    font-weight: 700;
    color: #6b7490;
    white-space: nowrap;
}
.cal-bar-week.is-holiday { color: var(--cal-red); }

/* ===== 完整版主体：左大日期 + 右月历 ===== */
.cal { display: flex; flex-direction: column; height: 100%; }
.cal-main {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: stretch;
    gap: 10px;
}

/* 左侧日期信息 */
.cal-info {
    width: 38%;
    min-width: 108px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}
.cal-info-month {
    font-size: 14px;
    font-weight: 700;
    color: #6b7490;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.cal-info-day {
    font-size: 56px;
    font-weight: 800;
    line-height: 1;
    color: #2f3640;
    margin: 2px 0 4px;
    font-variant-numeric: tabular-nums;
}
.cal-info-meta {
    font-size: 12px;
    color: #9aa3b2;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.cal-info-lunar {
    font-size: 14px;
    font-weight: 600;
    color: #454a58;
    margin-top: 3px;
    white-space: nowrap;
}
.cal-info-lunar.is-festival { color: var(--cal-red); }

/* 右侧月历 */
.cal-grid {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.cal-grid-head,
.cal-grid-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    align-items: center;
}
.cal-grid-head {
    margin-bottom: 2px;
}
.cal-grid-head span {
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: #6b7490;
    line-height: 1.6;
}
.cal-grid-head span.is-weekend { color: var(--cal-red); }
.cal-grid-body { gap: 1px 0; }
.cal-cell {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #454a58;
    line-height: 17px;
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.cal-cell.is-out { color: #c3c9d4; font-weight: 500; }
.cal-cell.is-weekend { color: var(--cal-red); }
.cal-cell.is-today {
    background: var(--cal-today, var(--cal-red));
    color: #fff;
    font-weight: 800;
}

/* ===== 看板「完整版」紧凑适配（仅桌面网格 >620px）=====
   桌面大卡内宽仅约 240px，左列固定 min-width:108px 后右侧月历只剩约 120px，
   7 列均分每列约 17px 且列间距为 0，两位日期数字几乎贴满列宽、左右挤在一起。
   以下规则仅作用于看板真实日历卡（日历组件无设置弹窗，无需排除预览舞台）：
   左列改按内容收缩把空间让给月历、增加列间距、字号/行距微调，使日期更疏朗。
   简版/横条用独立类 cal-style-mini / cal-style-bar，不受影响。 */
@media (min-width: 621px) {
    .widget-card[data-widget="calendar"]:not(.cal-style-mini):not(.cal-style-bar) .cal-main { gap: 6px; }
    .widget-card[data-widget="calendar"]:not(.cal-style-mini):not(.cal-style-bar) .cal-info {
        width: auto;
        min-width: 0;
        flex: 0 0 auto;
    }
    .widget-card[data-widget="calendar"]:not(.cal-style-mini):not(.cal-style-bar) .cal-info-day { font-size: 46px; }
    .widget-card[data-widget="calendar"]:not(.cal-style-mini):not(.cal-style-bar) .cal-info-month { font-size: 13px; }
    .widget-card[data-widget="calendar"]:not(.cal-style-mini):not(.cal-style-bar) .cal-info-meta { font-size: 11px; }
    .widget-card[data-widget="calendar"]:not(.cal-style-mini):not(.cal-style-bar) .cal-info-lunar { font-size: 12px; }
    .widget-card[data-widget="calendar"]:not(.cal-style-mini):not(.cal-style-bar) .cal-grid-head span { font-size: 11px; }
    .widget-card[data-widget="calendar"]:not(.cal-style-mini):not(.cal-style-bar) .cal-grid-body {
        gap: 2px 2px;
    }
    .widget-card[data-widget="calendar"]:not(.cal-style-mini):not(.cal-style-bar) .cal-cell {
        font-size: 11px;
        line-height: 16px;
    }
}

/* ===== 小屏适配：卡片宽度随 --widget-w 自动收缩（span 4 ≈ 整行），仅收敛高度与字号 ===== */
@media (max-width: 420px) {
    .widget-card[data-widget="calendar"] {
        height: 150px;
        padding: 8px 12px 10px;
    }
    .cal-info { min-width: 92px; }
    .cal-info-day { font-size: 44px; }
    .cal-info-month { font-size: 13px; }
    .cal-info-lunar { font-size: 12px; }
    .cal-cell { font-size: 11px; line-height: 16px; }
}

/* ============================================================
   设置弹窗（点击看板卡片弹出；结构见 templates/cal-modal.html）
   ============================================================ */
.cal-mask {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    /* 无遮罩：背景透明、不模糊，弹窗直接覆盖在页面上；该层仍用于居中与点击外部关闭 */
    background: transparent;
}
.cal-dialog {
    position: relative;
    width: 880px;
    max-width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 22px;
    padding: 26px 34px 30px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}
.cal-close {
    position: absolute;
    top: 14px;
    right: 20px;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: #9aa3b2;
    font-size: 26px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
}
.cal-close:hover { color: #4b5563; background: #f2f4f8; }
.cal-dialog-title {
    font-size: 22px;
    font-weight: 700;
    color: #2f3640;
    margin: 0 0 22px;
}
.cal-dialog-body {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) 1.1fr;
    gap: 26px;
    align-items: start;
}

/* ---- 左侧：样式选择（三个形态纵向排列，点击选中，选中项打勾） ---- */
.cal-preview {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.cal-style-opt {
    position: relative;
    display: block;
    padding: 10px 12px 12px;
    border: 2px solid #e9ecf1;
    border-radius: 16px;
    background: #f6f7f9;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.cal-style-opt:hover { border-color: #ffd9b0; }
.cal-style-opt.active {
    border-color: #ff8c1a;
    background: #fff6ee;
    box-shadow: 0 6px 18px rgba(255, 140, 26, 0.16);
}
.cal-style-name {
    display: block;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: #8a91a0;
    margin-bottom: 8px;
}
.cal-style-opt.active .cal-style-name { color: #ff8c1a; }
/* 选中打勾：橙色圆钉在选项右上角 */
.cal-style-check {
    position: absolute;
    top: -10px;
    right: -8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ff8c1a;
    color: #fff;
    font-size: 14px;
    font-weight: 800;
    line-height: 24px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(255, 140, 26, 0.4);
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.15s ease, transform 0.15s var(--ease-out);
}
.cal-style-opt.active .cal-style-check { opacity: 1; transform: scale(1); }

/* 样式小舞台：白色卡片底，其中是看板日历组件的真实预览 */
.cal-style-stage {
    --cal-red: #f5564d;
    --cal-today: #f5564d;
    background: #fff;
    color: #454a58;
    border-radius: 14px;
    box-shadow: 0 8px 22px rgba(31, 45, 80, 0.12);
    overflow: hidden;
    padding: 12px 14px;
}
/* 完整版舞台：内容铺满（.cal height:100%） */
.cal-style-stage-full {
    display: block;
    height: 150px;
}
/* 简版 / 横条舞台：内容在其中水平、垂直居中 */
.cal-style-stage-mini,
.cal-style-stage-bar {
    display: flex;
    align-items: center;
    justify-content: center;
}
.cal-style-stage-mini { height: 136px; }
.cal-style-stage-bar { height: 64px; padding: 0 14px; }

/* 简版预览：固定宽度的小红头日历 */
.cal-style-stage-mini .cal-mini {
    flex: none;
    width: 150px;
    height: 112px;
    margin: 0 auto;
}
/* 横条预览：铺满舞台。
   flex:none 必须加——看板规则 .cal.cal-bar{flex:1 1 auto} 会把横条横向拉满；
   此处舞台本身就是白卡，横条无需自带背景/阴影 */
.cal-style-stage-bar .cal-bar {
    flex: none;
    width: 100%;
    height: 100%;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

/* ---- 右侧表单 ---- */
.cal-form {
    background: #f6f7f9;
    border-radius: 16px;
    padding: 8px 18px;
}
.cal-row {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 20px 6px;
    border-bottom: 1px solid #e9ecf1;
}
.cal-row:last-child { border-bottom: none; }
.cal-row-label {
    flex: none;
    width: 86px;
    font-size: 17px;
    font-weight: 600;
    color: #3f4653;
}

/* 每周起始日：分段选择 */
.cal-seg {
    flex: 1;
    display: inline-flex;
    justify-content: flex-end;
}
.cal-seg-btn {
    border: 1.5px solid #cfd5de;
    background: #fff;
    color: #9aa3b2;
    font-size: 15px;
    font-weight: 600;
    padding: 8px 20px;
    cursor: pointer;
}
.cal-seg-btn:first-child { border-radius: 8px 0 0 8px; }
.cal-seg-btn:last-child { border-radius: 0 8px 8px 0; border-left: none; }
.cal-seg-btn.active {
    border-color: #3b8cf0;
    background: #3b8cf0;
    color: #fff;
}

/* 显示内容 开关 */
.cal-toggles {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}
.cal-toggle {
    border: 1.5px solid #3b8cf0;
    background: #fff;
    color: #3b8cf0;
    font-size: 15px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.cal-toggle.off {
    border-color: #cfd5de;
    color: #9aa3b2;
    background: #fff;
}

/* 今天高亮 色板 */
.cal-swatches {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    flex-wrap: wrap;
}
.cal-swatch {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    cursor: pointer;
    padding: 0;
    position: relative;
}
.cal-swatch.active {
    outline: 3px solid #8b94a6;
    outline-offset: 1px;
}
.cal-swatch-picker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #fff;
    cursor: pointer;
    overflow: hidden;
    position: relative;
}
.cal-swatch-picker input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.cal-swatch-picker svg { pointer-events: none; }
.cal-swatch-picker.active { outline: 3px solid #8b94a6; outline-offset: 1px; }

/* ============================================================
   深色主题覆盖（跟随 <html data-theme="dark">）
   弹窗外壳/表单/输入改为深色；左侧预览舞台保持白卡，其内是看板
   白底日历组件的真实预览，不做反色。
   ============================================================ */
:root[data-theme="dark"] .cal-dialog {
    background: var(--auth-card);
    border: 1px solid var(--auth-line);
    box-shadow: 0 24px 70px var(--auth-shadow);
}
:root[data-theme="dark"] .cal-close { color: var(--auth-muted); }
:root[data-theme="dark"] .cal-close:hover { color: var(--auth-text); background: var(--auth-card-2); }
:root[data-theme="dark"] .cal-dialog-title { color: var(--auth-text); }

:root[data-theme="dark"] .cal-style-opt {
    border-color: var(--auth-line);
    background: var(--auth-card-2);
}
:root[data-theme="dark"] .cal-style-opt:hover { border-color: rgba(255, 140, 26, 0.5); }
:root[data-theme="dark"] .cal-style-opt.active {
    border-color: #ff8c1a;
    background: rgba(255, 140, 26, 0.12);
    box-shadow: 0 6px 18px rgba(255, 140, 26, 0.18);
}
:root[data-theme="dark"] .cal-style-name { color: var(--auth-muted); }
:root[data-theme="dark"] .cal-style-opt.active .cal-style-name { color: #ffa64a; }

:root[data-theme="dark"] .cal-form { background: var(--auth-card-2); }
:root[data-theme="dark"] .cal-row { border-bottom-color: var(--auth-line); }
:root[data-theme="dark"] .cal-row-label { color: var(--auth-text); }

:root[data-theme="dark"] .cal-seg-btn {
    background: var(--auth-card);
    color: var(--auth-muted);
    border-color: var(--auth-line);
}
:root[data-theme="dark"] .cal-seg-btn.active {
    border-color: #3b8cf0;
    background: #3b8cf0;
    color: #fff;
}
:root[data-theme="dark"] .cal-toggle { background: var(--auth-card); color: #7cb0ff; border-color: #3b8cf0; }
:root[data-theme="dark"] .cal-toggle.off {
    border-color: var(--auth-line);
    color: var(--auth-muted);
    background: var(--auth-card);
}
:root[data-theme="dark"] .cal-swatch,
:root[data-theme="dark"] .cal-swatch-picker { border-color: rgba(255, 255, 255, 0.18); }
:root[data-theme="dark"] .cal-swatch.active,
:root[data-theme="dark"] .cal-swatch-picker.active { outline-color: #b8c4e0; }

@media (max-width: 760px) {
    .cal-dialog-body { grid-template-columns: 1fr; }
    .cal-row { flex-wrap: wrap; }
    .cal-row-label { width: auto; }
}

/* ============================================================
   万年历大弹窗（点击看板卡片弹出；结构见 templates/cal-panel.html）
   左：整月月历（周末红、节假日粉底「休」、调休上班灰底「班」）
   右：选中日黄历详情（大日期 / 干支生肖星座 / 宜忌 / 神位方位）
   ============================================================ */
.calp-mask {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 20px;
    background: rgba(18, 26, 42, 0.32);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.calp-dialog {
    position: relative;
    width: 980px;
    max-width: 100%;
    height: min(700px, 94vh);
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 22px;
    padding: 22px 30px 24px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
}
.calp-close {
    position: absolute;
    top: 14px;
    right: 18px;
    width: 34px;
    height: 34px;
    border: none;
    background: none;
    color: #9aa3b2;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
}
.calp-close:hover { color: #4b5563; background: #f2f4f8; }
.calp-title {
    flex: none;
    font-size: 21px;
    font-weight: 700;
    color: #2f3640;
    margin: 0 0 14px;
    padding-left: 2px;
}
.calp-body {
    flex: 1;
    min-height: 0;
    display: flex;
    gap: 26px;
}

/* ---- 顶部工具条：年选择 / 月切换 / 设置 / 假期安排 ---- */
.calp-left {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.calp-toolbar {
    flex: none;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.calp-select-wrap { position: relative; flex: none; }
.calp-select-wrap::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 1.6px solid #9aa3b2;
    border-bottom: 1.6px solid #9aa3b2;
    transform: translateY(-65%) rotate(45deg);
    pointer-events: none;
}
.calp-select {
    appearance: none;
    -webkit-appearance: none;
    height: 38px;
    box-sizing: border-box;
    border: 1px solid #dfe3ea;
    background: #f7f8fa;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    color: #4b5563;
    padding: 0 30px 0 14px;
    cursor: pointer;
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.calp-select:hover { border-color: #c4cad5; background: #f2f3f6; }
#calpYear { width: 92px; }
.calp-select-month { width: 100px; }
.calp-nav { display: inline-flex; align-items: center; gap: 2px; }
.calp-nav-btn {
    width: 34px;
    height: 38px;
    border: none;
    background: none;
    color: #8a91a0;
    font-size: 22px;
    line-height: 1;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.calp-nav-btn:hover { background: #f2f4f8; color: #2f3640; }
.calp-settings {
    flex: none;
    width: 38px;
    height: 38px;
    border: none;
    background: #f7f8fa;
    color: #8a91a0;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}
.calp-settings:hover { color: #ff8c1a; background: #fff3e8; }
.calp-holiday-wrap { flex: none; margin-left: auto; }
/* 「假期安排」按钮自带 caret，去掉通用 select-wrap 的 CSS 箭头 */
.calp-holiday-wrap::after { display: none; }
.calp-holiday-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 136px;
    justify-content: center;
    padding: 0 16px;
    font-weight: 500;
}
.calp-holiday-caret {
    color: #9aa3b2;
    transition: transform 0.18s ease;
}
.calp-holiday-wrap.is-open .calp-holiday-btn {
    border-color: #4a7dff;
    background: #fff;
    color: #8a91a0;
    box-shadow: 0 0 0 1px rgba(74, 125, 255, 0.35);
}
.calp-holiday-wrap.is-open .calp-holiday-caret { transform: rotate(180deg); }

/* 气泡菜单 */
.calp-holiday-menu {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 30;
    width: 308px;
    box-sizing: border-box;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 36px rgba(31, 41, 59, 0.18);
    border: 1px solid #eceef3;
    padding: 16px 0 12px;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}
.calp-holiday-wrap.is-open .calp-holiday-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
/* 指向按钮的小三角 */
.calp-holiday-menu::before {
    content: '';
    position: absolute;
    top: -7px;
    right: 56px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-left: 1px solid #eceef3;
    border-top: 1px solid #eceef3;
    transform: rotate(45deg);
}
.calp-holiday-menu-title {
    position: relative;
    padding: 0 22px 10px;
    font-size: 19px;
    font-weight: 700;
    color: #3a7afe;
}
.calp-holiday-menu-list {
    position: relative;
    max-height: 342px;
    overflow-y: auto;
}
.calp-holiday-menu-list::-webkit-scrollbar { width: 6px; }
.calp-holiday-menu-list::-webkit-scrollbar-thumb {
    background: #d4d8e0;
    border-radius: 3px;
}
.calp-holiday-item {
    display: block;
    width: 100%;
    box-sizing: border-box;
    border: none;
    background: none;
    padding: 11px 22px;
    text-align: left;
    font-size: 16px;
    line-height: 1.3;
    color: #6b7280;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    transition: background 0.13s ease;
}
.calp-holiday-item:hover { background: #f2f5fa; }
.calp-holiday-item-date { color: #6b7280; }

/* ---- 月历网格 ---- */
.calp-grid {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.calp-grid-head,
.calp-grid-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}
.calp-grid-head {
    flex: none;
    margin-bottom: 4px;
}
.calp-grid-head span {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: #8a91a0;
    line-height: 26px;
}
.calp-grid-head span.is-weekend { color: #e23b2e; }
.calp-grid-body {
    flex: 1;
    min-height: 0;
    gap: 4px;
    grid-template-rows: repeat(6, 1fr);
}
.calp-cell {
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 12px;
    cursor: pointer;
    user-select: none;
    border: 1.5px solid transparent;
    transition: background 0.12s ease, border-color 0.12s ease;
}
.calp-cell:hover { background: #f2f4f8; }
.calp-cell-day {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.1;
    color: #3c434f;
    font-variant-numeric: tabular-nums;
}
.calp-cell-lunar {
    font-size: 11.5px;
    line-height: 1.2;
    color: #a3aab7;
    white-space: nowrap;
}
.calp-cell.is-weekend .calp-cell-day { color: #e23b2e; }
.calp-cell.is-out { opacity: 0.32; }
.calp-cell.is-festival .calp-cell-lunar { color: #e23b2e; }
.calp-cell.is-out:hover { background: transparent; }

/* 法定放假（休）：粉底红字 */
.calp-cell.is-off {
    background: #fdeceb;
}
.calp-cell.is-off:hover { background: #fbdfdd; }
.calp-cell.is-off .calp-cell-day,
.calp-cell.is-off .calp-cell-lunar { color: #e23b2e; }

/* 调休上班（班）：灰底 */
.calp-cell.is-work {
    background: #f3f4f6;
}
.calp-cell.is-work:hover { background: #ebedf1; }

/* 休 / 班 角标 */
.calp-cell-badge {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    padding: 3px 5px;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
}
.calp-cell-badge.is-off { background: #e8412f; }
.calp-cell-badge.is-work { background: #5b6478; }

/* 选中日（也是今天打开时的默认态）：蓝框浅蓝底 */
.calp-cell.is-selected {
    background: #e9f1ff;
    border-color: #4a7dff;
}
.calp-cell.is-selected:hover { background: #dfeaff; }
.calp-cell.is-selected .calp-cell-day { color: #2f5fe0; }
.calp-cell.is-selected .calp-cell-lunar { color: #5a82e8; }
.calp-cell.is-selected.is-off { background: #fde3e1; border-color: #ef8a82; }
.calp-cell.is-selected.is-off:hover { background: #fbd9d6; }
.calp-cell.is-selected.is-off .calp-cell-day,
.calp-cell.is-selected.is-off .calp-cell-lunar { color: #e23b2e; }

/* ---- 右侧：选中日黄历详情 ---- */
.calp-right {
    position: relative;
    flex: none;
    width: 330px;
    overflow-y: auto;
    background: #f5f6f8;
    border-radius: 14px;
    padding: 18px 20px 14px;
    color: #4b5563;
    scrollbar-width: thin;
    scrollbar-color: #c9ced8 transparent;
}
.calp-right::-webkit-scrollbar { width: 6px; }
.calp-right::-webkit-scrollbar-thumb { background: #c9ced8; border-radius: 3px; }
.calp-right::-webkit-scrollbar-track { background: transparent; }

/* 选中日为今天时，顶部一条品牌色条 */
.calp-right.is-today::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20px;
    right: 20px;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, #ff8c1a, #ffb259);
}
.calp-d-date {
    text-align: center;
    font-size: 16.5px;
    font-weight: 600;
    color: #333a46;
    font-variant-numeric: tabular-nums;
}
.calp-d-tile {
    width: 76px;
    height: 76px;
    margin: 10px auto 8px;
    border-radius: 14px;
    background: linear-gradient(145deg, #e98a80, #dd6a60);
    color: #fff;
    font-size: 48px;
    font-weight: 800;
    line-height: 76px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 8px 16px rgba(221, 106, 96, 0.25);
}
.calp-d-lunar {
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: #333a46;
}
.calp-d-gan {
    text-align: center;
    font-size: 13.5px;
    color: #333a46;
    margin-top: 4px;
}
.calp-d-meta {
    text-align: center;
    font-size: 12.5px;
    color: #6b7280;
    margin-top: 3px;
    margin-bottom: 10px;
}

/* 生肖 / 星座 / 宜忌 行 */
.calp-d-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid #e7e9ee;
}
.calp-d-row:last-of-type { border-bottom: none; }
.calp-d-tag {
    flex: none;
    width: 36px;
    height: 24px;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    line-height: 24px;
    font-weight: 700;
    text-align: center;
}
.calp-d-tag.is-zodiac { background: #e85a4f; }
.calp-d-tag.is-star { background: #f5a623; }
.calp-d-tag.is-yi { background: #3aa76d; }
.calp-d-tag.is-ji { background: #e05246; }
.calp-d-text {
    font-size: 13.5px;
    color: #4b5563;
}
.calp-d-row.is-ji .calp-d-text { color: #aeb4bf; }
.calp-d-row.is-ji .calp-d-list span { color: #aeb4bf; }
.calp-d-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    flex: 1;
    min-width: 0;
}
.calp-d-list span { font-size: 13.5px; color: #4b5563; white-space: nowrap; }

/* 神位方位 */
.calp-d-gods { padding-top: 6px; }
.calp-d-god {
    display: flex;
    font-size: 12.5px;
    line-height: 1.7;
}
.calp-d-god-name {
    flex: none;
    width: 70px;
    color: #9aa3b2;
}
.calp-d-god-pos { color: #6b7280; font-weight: 600; }

/* 深色主题：弹窗外壳与面板改深色；月历日期区保持浅底（黄历内容无深色语义） */
:root[data-theme="dark"] .calp-mask { background: rgba(0, 0, 0, 0.5); }
:root[data-theme="dark"] .calp-dialog {
    background: var(--auth-card);
    border: 1px solid var(--auth-line);
    box-shadow: 0 24px 70px var(--auth-shadow);
}
:root[data-theme="dark"] .calp-title { color: var(--auth-text); }
:root[data-theme="dark"] .calp-close { color: var(--auth-muted); }
:root[data-theme="dark"] .calp-close:hover { color: var(--auth-text); background: var(--auth-card-2); }
:root[data-theme="dark"] .calp-select {
    background: var(--auth-card-2);
    color: var(--auth-text);
    border-color: var(--auth-line);
}
:root[data-theme="dark"] .calp-select:hover { border-color: #4a5568; }
:root[data-theme="dark"] .calp-settings {
    background: var(--auth-card-2);
    color: var(--auth-muted);
}
:root[data-theme="dark"] .calp-settings:hover {
    background: rgba(255, 140, 26, 0.16);
    color: #ff8c1a;
}
:root[data-theme="dark"] .calp-grid-head span { color: var(--auth-muted); }
:root[data-theme="dark"] .calp-cell { border-color: var(--auth-line); }
:root[data-theme="dark"] .calp-cell:hover { background: var(--auth-card-2); }
:root[data-theme="dark"] .calp-cell.is-out:hover { background: none; }
:root[data-theme="dark"] .calp-cell-day { color: var(--auth-text); }
:root[data-theme="dark"] .calp-cell-lunar { color: var(--auth-muted); }
:root[data-theme="dark"] .calp-cell.is-weekend .calp-cell-day { color: #ef6b5e; }
:root[data-theme="dark"] .calp-cell.is-work { background: rgba(255, 255, 255, 0.07); }
:root[data-theme="dark"] .calp-cell.is-work:hover { background: rgba(255, 255, 255, 0.1); }
:root[data-theme="dark"] .calp-cell.is-off { background: rgba(226, 59, 46, 0.14); }
:root[data-theme="dark"] .calp-cell.is-off:hover { background: rgba(226, 59, 46, 0.2); }
:root[data-theme="dark"] .calp-cell.is-off .calp-cell-day,
:root[data-theme="dark"] .calp-cell.is-off .calp-cell-lunar { color: #f57468; }
:root[data-theme="dark"] .calp-holiday-menu {
    background: var(--auth-card);
    border-color: var(--auth-line);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}
:root[data-theme="dark"] .calp-holiday-menu::before {
    background: var(--auth-card);
    border-left-color: var(--auth-line);
    border-top-color: var(--auth-line);
}
:root[data-theme="dark"] .calp-holiday-wrap.is-open .calp-holiday-btn {
    background: var(--auth-card);
    color: var(--auth-muted);
}
:root[data-theme="dark"] .calp-holiday-item { color: var(--auth-muted); }
:root[data-theme="dark"] .calp-holiday-item-date { color: var(--auth-muted); }
:root[data-theme="dark"] .calp-holiday-item:hover { background: var(--auth-card-2); }
:root[data-theme="dark"] .calp-holiday-menu-list::-webkit-scrollbar-thumb { background: #4a5568; }
:root[data-theme="dark"] .calp-cell.is-selected.is-off { background: rgba(226, 59, 46, 0.22); }
:root[data-theme="dark"] .calp-cell.is-selected.is-off:hover { background: rgba(226, 59, 46, 0.28); }
:root[data-theme="dark"] .calp-cell.is-selected { background: rgba(74, 125, 255, 0.18); }
:root[data-theme="dark"] .calp-cell.is-selected:hover { background: rgba(74, 125, 255, 0.24); }
:root[data-theme="dark"] .calp-nav-btn { color: var(--auth-muted); }
:root[data-theme="dark"] .calp-nav-btn:hover { background: var(--auth-card-2); color: var(--auth-text); }
:root[data-theme="dark"] .calp-right {
    background: var(--auth-card-2);
    scrollbar-color: #4a5568 transparent;
}
:root[data-theme="dark"] .calp-right::-webkit-scrollbar-thumb { background: #4a5568; }
:root[data-theme="dark"] .calp-d-date,
:root[data-theme="dark"] .calp-d-lunar,
:root[data-theme="dark"] .calp-d-gan { color: var(--auth-text); }
:root[data-theme="dark"] .calp-d-meta,
:root[data-theme="dark"] .calp-d-text,
:root[data-theme="dark"] .calp-d-list span,
:root[data-theme="dark"] .calp-d-god-pos { color: var(--auth-muted); }
:root[data-theme="dark"] .calp-d-row { border-bottom-color: var(--auth-line); }

/* 设置弹窗从万年历内打开时：加深遮罩并浮于万年历之上 */
.cal-mask.cal-mask-veil {
    z-index: 1200;
    background: rgba(18, 26, 42, 0.36);
}

@media (max-width: 960px) {
    .calp-dialog { height: auto; max-height: 94vh; overflow-y: auto; }
    .calp-body { flex-direction: column; }
    .calp-right { width: auto; overflow: visible; }
    .calp-grid-body { min-height: 340px; }
    .calp-holiday-menu { width: 280px; }
}
@media (max-width: 420px) {
    .calp-toolbar { flex-wrap: wrap; }
    .calp-holiday-wrap { margin-left: 0; }
    .calp-holiday-menu { width: min(300px, calc(100vw - 56px)); }
}
