/* ===== today_work.css - 今日工作台独立样式 ===== */
/* 子页面运行于主父框架(home)内，所有选择器均以 .today-work-container 作用域限定，避免污染父框架 */
/* 样式值完全按原页面提供的内容还原 */

/* 今日就诊 / 明日预约 视图：撑满右侧内容区成纵向 flex 容器，
   表格区域 flex:1 内部滚动（行数再多也可上下滚动），分页条吸底常驻不被裁掉 */
.today-work-container #today-work-main,
.today-work-container #appointment-list-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.today-work-container #today-work-main > .content-header,
.today-work-container #today-work-main > .filter-bar,
.today-work-container #today-work-main > nav,
.today-work-container #appointment-list-view > .content-header,
.today-work-container #appointment-list-view > .filter-bar,
.today-work-container #appointment-list-view > nav {
    flex-shrink: 0;
}

/* 内容区适配父框架布局（顶部 topbar 约 70px）：锁定内容区高度为可视区域，
   使翻页行吸底且不超出浏览器窗口，超出部分在表格容器内部滚动 */
body.kf-today-work .content-page {
    height: calc(100vh - 70px);
    min-height: 0;
    overflow-y: auto;
}

/* 容器基础（原 body 样式，作用域化到容器；纵向 flex 撑满内容区） */
.today-work-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #f5f7fa;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
    margin-top: 10px;
}

/* ===== 顶部统计卡片 ===== */
.today-work-container .stats-container {
    background: #fff;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 4px;
    flex-shrink: 0;
}

.today-work-container .stat-item {
    display: flex;
    align-items: center;
    padding: 0 15px;
    border-right: 1px solid #f0f0f0;
}

.today-work-container .stat-item:last-child {
    border-right: none;
}

.today-work-container .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 20px;
}

.today-work-container .stat-icon-green { background: #52c41a; color: #fff; }
.today-work-container .stat-icon-orange { background: #fa8c16; color: #fff; }
.today-work-container .stat-icon-pink { background: #eb2f96; color: #fff; }
.today-work-container .stat-icon-purple { background: #722ed1; color: #fff; }
.today-work-container .stat-icon-blue { background: #1890ff; color: #fff; }
.today-work-container .stat-icon-cyan { background: #13c2c2; color: #fff; }
.today-work-container .stat-icon-navy { background: #2f54eb; color: #fff; }

.today-work-container .stat-content .stat-label {
    color: #999;
    font-size: 12px;
    margin-bottom: 2px;
}

.today-work-container .stat-content .stat-value {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    user-select: none;
}

.today-work-container .stat-content .stat-value:hover {
    opacity: 0.8;
}

.today-work-container .stat-content .stat-value .toggle-icon {
    font-size: 14px;
    margin-left: 5px;
    color: #999;
}

/* ===== 主容器 ===== */
.today-work-container .main-container {
    display: flex;
    background: #fff;
    border-radius: 4px;
    flex: 1;
    min-height: 0;
}

/* ===== 左侧菜单 ===== */
.today-work-container .left-sidebar {
    width: 180px;
    background: #fff;
    border-right: 1px solid #f0f0f0;
    padding: 10px 0;
    flex-shrink: 0;
}

.today-work-container .menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    cursor: pointer;
    color: #666;
    transition: all 0.3s;
}

.today-work-container .menu-item:hover {
    background: #f5f7fa;
    color: #1890ff;
}

.today-work-container .menu-item.active {
    background: #e6f7ff;
    color: #1890ff;
    border-right: 3px solid #1890ff;
}

.today-work-container .menu-item i {
    margin-right: 8px;
    font-size: 16px;
}

.today-work-container .menu-badge {
    color: #999;
    font-size: 12px;
}

/* ===== 右侧内容区 ===== */
.today-work-container .right-content {
    flex: 1;
    padding: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.today-work-container .content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.today-work-container .content-title {
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.today-work-container .content-title i {
    margin-right: 8px;
    color: #52c41a;
}

.today-work-container .filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.today-work-container .filter-bar .form-control,
.today-work-container .filter-bar .form-select {
    height: 32px;
    font-size: 13px;
    border-radius: 4px;
}

.today-work-container .filter-bar .btn {
    height: 32px;
    padding: 0 15px;
    font-size: 13px;
    border-radius: 4px;
}

/* 自定义日期段选择器（daterangepicker 无快速日期选择形态，样式同 html/datetwo.html / inwarehouse_list.css 的 .daterange-input） */
.today-work-container .daterange-input {
    background-color: #fff;
    cursor: pointer;
    border-radius: 5px;
    border: 1px solid #dce1e9;
    padding: 6px 12px;
    height: 34px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #212529;
    white-space: nowrap;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.today-work-container .daterange-input:hover {
    border-color: #86b7fe;
}
.today-work-container .daterange-input i {
    color: #6c757d;
}
.today-work-container .daterange-input .range-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* 预设（今天/昨天/本周）时锁定：不可点击 */
.today-work-container .daterange-input.disabled {
    cursor: not-allowed;
    background-color: #f5f5f5;
    opacity: 0.7;
    pointer-events: none;
}
/* 日历弹层：高于表格冻结表头(z-index:3/10)，避免展开时被遮挡 */
.today-work-container .daterangepicker {
    z-index: 1100 !important;
}

/* ===== 表格样式及冻结列 ===== */
.today-work-container .table-container {
    border: 1px solid #f0f0f0;
    border-radius: 4px;
    overflow: auto;
    flex: 1;
    min-height: 0;
}

.today-work-container .custom-table {
    margin-bottom: 0;
    font-size: 12px;
    width: max-content;
}

/* 右侧普通表头：z-index 设为 3，确保在左侧冻结列下方 */
.today-work-container .custom-table thead th:not(.sticky-th) {
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 500;
    color: #666;
    padding: 10px 8px;
    white-space: nowrap;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 3;
}

.today-work-container .custom-table tbody td {
    padding: 8px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
    white-space: nowrap;
    text-align: center;
}

.today-work-container .custom-table tbody tr:hover td {
    background: #fafafa;
}

/* 左侧冻结列的表头：z-index 最高，确保不被任何内容遮挡 */
.today-work-container .sticky-th {
    position: sticky;
    z-index: 10;
    background-color: #fafafa;
}

/* 左侧冻结列的单元格：z-index 设为 5，高于普通表头 */
.today-work-container .sticky-td {
    position: sticky;
    z-index: 5;
    background-color: #fff;
}

.today-work-container .custom-table tbody tr:hover td.sticky-td {
    background-color: #fafafa;
}

/* 冻结列位置计算：限定在今日就诊表格(.custom-table)内，避免 .col-3/.col-6 等类名
   泄漏到挂载于同一容器下的预约抽屉(Bootstrap 栅格列)，导致表单项被挤压成 40px 竖条 */
.today-work-container .custom-table .col-1 { left: 0; width: 40px; min-width: 40px; }
.today-work-container .custom-table .col-2 { left: 40px; width: 40px; min-width: 40px; }
.today-work-container .custom-table .col-3 { left: 80px; width: 40px; min-width: 40px; }
.today-work-container .custom-table .col-4 { left: 120px; width: 40px; min-width: 40px; }
.today-work-container .custom-table .col-5 { left: 160px; width: 40px; min-width: 40px; }
.today-work-container .custom-table .col-6 { left: 200px; width: 40px; min-width: 40px; }
.today-work-container .custom-table .col-7 { left: 240px; width: 40px; min-width: 40px; }
.today-work-container .custom-table .col-8 { left: 280px; width: 40px; min-width: 40px; }
.today-work-container .custom-table .col-9 { left: 320px; width: 80px; min-width: 80px; }
.today-work-container .custom-table .col-10 { left: 400px; width: 50px; min-width: 50px; }
.today-work-container .custom-table .col-11 { left: 450px; width: 50px; min-width: 50px; }

/* 患者姓名列（冻结列 col-9）：姓名居左显示 */
.today-work-container .custom-table thead th.col-9,
.today-work-container .custom-table tbody td.col-9 {
    text-align: left;
    padding-left: 12px;
}

.today-work-container .action-icon {
    cursor: pointer;
    font-size: 14px;
}

/* 颜色规则需 !important：项目主题(app.min.css)将 --bs-secondary 等变量改为主题色且 Bootstrap .text-* 带 !important，
   不加 !important 会被覆盖（如 --bs-secondary=#ad46ff 紫色导致不可点"+"显示为紫色而非灰度） */
.today-work-container .action-icon.text-success { color: #52c41a !important; }
.today-work-container .action-icon.text-danger { color: #ff4d4f !important; }
.today-work-container .action-icon.text-primary { color: #1890ff !important; }
.today-work-container .action-icon.text-warning { color: #fa8c16 !important; }
.today-work-container .action-icon.text-secondary { color: #999 !important; opacity: 0.6; }

/* 分诊列：triage_status=1（已挂号）/2（已划价）可取消——默认"已完成"，悬停显示 X 图标，点击弹出取消分诊 */
.today-work-container .triage-cancel-icon { display: inline-block; }
.today-work-container .triage-cancel-icon .bi-x-square { display: none; }
.today-work-container .triage-cancel-icon:hover .bi-check-square { display: none; }
.today-work-container .triage-cancel-icon:hover .bi-x-square { display: inline-block; }

/* 转诊列：已转诊可继续——默认"已完成"，悬停显示 + 图标，点击继续转诊 */
.today-work-container .referral-repeat-icon { display: inline-block; }
.today-work-container .referral-repeat-icon .bi-plus { display: none; }
.today-work-container .referral-repeat-icon:hover .bi-check-square { display: none; }
.today-work-container .referral-repeat-icon:hover .bi-plus { display: inline-block; }

/* 划价列：待收费(status=2，已有划价单)已完成可重划——默认"已完成"，悬停显示"撤销"图标，点击进入重划（行为不变） */
.today-work-container .fee-repeat-icon { display: inline-block; }
.today-work-container .fee-repeat-icon .bi-arrow-counterclockwise { display: none; }
.today-work-container .fee-repeat-icon:hover .bi-check-square { display: none; }
.today-work-container .fee-repeat-icon:hover .bi-arrow-counterclockwise { display: inline-block; }

/* "更多"列（原档案列）：更多图标灰显（触发图标在表格单元格内） */
.today-work-container .tw-more-wrap { display: inline-block; cursor: pointer; }
.today-work-container .tw-more-wrap .bi-three-dots { font-size: 16px; }

/* "更多"悬浮菜单（JS 动态 append 到 body 顶层的唯一实例）：
   置于 body 根部 + position:fixed + 高 z-index，彻底脱离表格结构，确保在数据行/冻结列/表头之上不被遮挡 */
#tw-more-menu {
    display: none;
    position: fixed;
    z-index: 10000;
    min-width: 112px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    padding: 4px 0;
}
#tw-more-menu.show { display: block; }
#tw-more-menu .tw-more-item {
    display: block;
    padding: 6px 14px;
    font-size: 12px;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}
#tw-more-menu .tw-more-item:hover { background: #f5f7fa; color: #52c41a; }
#tw-more-menu .tw-more-item.disabled { color: #bbb; cursor: not-allowed; }
#tw-more-menu .tw-more-item.disabled:hover { background: transparent; color: #bbb; }
/* 菜单底部"修改预约"项：仅数据源=预约表(schedule)且未到店 的行显示，其余行隐藏 */
#tw-more-menu .tw-more-item.hidden { display: none; }

/* 病历列：已写病历(medical_status=1)——默认"已完成"，悬停显示"撤销"图标，点击复显填写病历窗口 */
.today-work-container .record-repeat-icon { display: inline-block; }
.today-work-container .record-repeat-icon .bi-arrow-counterclockwise { display: none; }
.today-work-container .record-repeat-icon:hover .bi-check-square { display: none; }
.today-work-container .record-repeat-icon:hover .bi-arrow-counterclockwise { display: inline-block; }

/* 方案列"已完成"复显图标：默认显示"已完成"，悬停切换为"撤回" */
.today-work-container .remark-repeat-icon { display: inline-block; }
.today-work-container .remark-repeat-icon .bi-arrow-counterclockwise { display: none; }
.today-work-container .remark-repeat-icon:hover .bi-check-square { display: none; }
.today-work-container .remark-repeat-icon:hover .bi-arrow-counterclockwise { display: inline-block; }

/* 随访列"已完成"复显图标：默认显示"已完成"，悬停切换为"撤回" */
.today-work-container .follow-repeat-icon { display: inline-block; }
.today-work-container .follow-repeat-icon .bi-arrow-counterclockwise { display: none; }
.today-work-container .follow-repeat-icon:hover .bi-check-square { display: none; }
.today-work-container .follow-repeat-icon:hover .bi-arrow-counterclockwise { display: inline-block; }

/* 结账列：已收费(status=3)可作废——默认"已完成"，悬停显示"撤销"图标，点击弹出作废收费 */
.today-work-container .charge-void-icon { display: inline-block; }
.today-work-container .charge-void-icon .bi-arrow-counterclockwise { display: none; }
.today-work-container .charge-void-icon:hover .bi-check-square { display: none; }
.today-work-container .charge-void-icon:hover .bi-arrow-counterclockwise { display: inline-block; }

.today-work-container .status-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.today-work-container .status-treating { background: #fff7e6; color: #fa8c16; }
.today-work-container .status-completed { background: #e6f7ff; color: #1890ff; }
.today-work-container .status-progress { background: #f6ffed; color: #52c41a; }
.today-work-container .status-not-arrived { background: #fffbe6; color: #d4380d; }

/* ===== 分页 ===== */
.today-work-container .pagination {
    margin-top: 15px;
    justify-content: flex-end;
}

.today-work-container .page-link {
    font-size: 12px;
    padding: 4px 10px;
}

.today-work-container .page-item.active .page-link {
    background: #52c41a;
    border-color: #52c41a;
}

/* ===== 病历书写子窗口弹窗层（父页面级；iframe 加载独立文档，样式/脚本隔离） ===== */
.today-work-container .pc-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 20, 30, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    transition: padding 0.15s;
}

.today-work-container .pc-overlay iframe {
    width: 100%;
    max-width: 1400px;
    height: calc(100vh - 32px);
    border: none;
    border-radius: 8px;
    background: transparent;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    transition: all 0.15s;
}

/* 子窗口加载中提示（覆盖在 iframe 上方，iframe 加载完成后隐藏） */
.today-work-container .pc-loading {
    position: absolute;
    inset: 16px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f6f9;
    border-radius: 8px;
}

/* 最大化：弹窗层去掉留白，iframe 铺满整个视口 */
.today-work-container .pc-overlay.pc-fullscreen {
    padding: 0;
}

.today-work-container .pc-overlay.pc-fullscreen iframe {
    max-width: none;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
}

.today-work-container .pc-overlay.pc-fullscreen .pc-loading {
    inset: 0;
    border-radius: 0;
}

/* ===== Toast 通知（triage.js 分诊/转诊弹窗复用，追加到 body，需保持未加作用域前缀） ===== */
.toast-notification {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    animation: toast-in 0.3s ease;
    cursor: pointer;
}
.toast-notification.toast-hide {
    animation: toast-out 0.3s ease forwards;
}
.toast-notification .toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1a2a6c;
    color: #fff;
    padding: 14px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(26, 42, 108, 0.3);
    font-size: 15px;
    font-weight: 500;
}
.toast-notification .toast-icon {
    font-size: 20px;
    color: #48bb78;
}
.toast-notification .toast-close {
    font-size: 22px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    margin-left: 8px;
    line-height: 1;
}
.toast-notification .toast-close:hover {
    color: #fff;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* ===== 明日预约列表（#appointment-list-view，作用域隔离） ===== */
/* 视图自身为纵向 flex：表格容器占满剩余高度内部滚动，分页固定在底部不随表格滚动 */
.today-work-container #appointment-list-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}
.today-work-container #appointment-list-view > nav {
    flex-shrink: 0;
}
.today-work-container #appointment-list-view .custom-table th,
.today-work-container #appointment-list-view .custom-table td {
    white-space: nowrap;
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 预约状态徽标（与预约页颜色规则一致） */
.today-work-container .ap-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
}
.today-work-container .ap-unconfirmed { background: #fff7e6; color: #fa8c16; }
.today-work-container .ap-confirmed { background: #f0f9eb; color: #52c41a; }
.today-work-container .ap-arrived { background: #e6f7ff; color: #1890ff; }
.today-work-container .ap-paid { background: #f9f0ff; color: #722ed1; }
.today-work-container .ap-canceled { background: #f5f5f5; color: #999; }

/* 操作列下拉 */
.today-work-container .ap-action-wrap { position: relative; display: inline-block; }
.today-work-container .ap-action-btn {
    border: 1px solid #d9d9d9;
    background: #fff;
    color: #333;
    border-radius: 4px;
    font-size: 12px;
    padding: 2px 10px;
    cursor: pointer;
}
.today-work-container .ap-action-btn:hover { border-color: #52c41a; color: #52c41a; }
.today-work-container .ap-action-btn .bi-chevron-down { font-size: 11px; margin-left: 2px; }
/* 操作列下拉：position:fixed 由 JS 按触发按钮视口坐标定位（left/top 内联设置），
   避免被表格滚动容器 overflow:auto 裁剪遮挡；z-index 高于 Bootstrap 弹窗(1050) */
.today-work-container .ap-action-menu {
    display: none;
    position: fixed;
    z-index: 1060;
    min-width: 110px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    padding: 4px 0;
}
.today-work-container .ap-action-menu.show { display: block; }
.today-work-container .ap-menu-item {
    display: block;
    padding: 6px 14px;
    font-size: 12px;
    color: #333;
    text-decoration: none;
    white-space: nowrap;
}
.today-work-container .ap-menu-item:hover { background: #f5f7fa; color: #52c41a; }
.today-work-container .ap-menu-item.disabled { color: #bbb; cursor: not-allowed; }
.today-work-container .ap-menu-item.disabled:hover { background: transparent; color: #bbb; }

/* ===== 公用菜单未实现项占位视图（#menu-placeholder-view） ===== */
.today-work-container .menu-placeholder-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    border-radius: 4px;
    flex: 1;
    min-height: 240px;
    color: #999;
    font-size: 14px;
}
.today-work-container .menu-placeholder-body .menu-placeholder-icon {
    font-size: 40px;
    color: #d9d9d9;
    margin-bottom: 12px;
}
