/* ============================================================
   象新科技业务管理系统 - 全局样式
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px; color: #333; background: #f4f6f9;
}
a { color: #2563eb; text-decoration: none; }
a:hover { color: #1d4ed8; }
ul, li { list-style: none; }
input, select, textarea, button { font-family: inherit; font-size: 14px; outline: none; }

/* ---------- 布局 ---------- */
.app-layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 220px; background: linear-gradient(180deg, #312e81 0%, #1e1b4b 100%);
    color: #fff; position: fixed; top: 0; left: 0; bottom: 0; overflow-y: auto; z-index: 100;
}
.sidebar .logo {
    padding: 22px 16px; font-size: 17px; font-weight: 700; text-align: center;
    border-bottom: 1px solid rgba(255,255,255,.15); letter-spacing: 1px;
}
.sidebar .logo small { display: block; font-size: 11px; font-weight: 400; opacity: .7; margin-top: 4px; }
.sidebar .nav { padding: 8px 0; }
.sidebar .nav-group-title {
    padding: 10px 20px 4px; font-size: 11px; color: rgba(255,255,255,.6);
    text-transform: uppercase; letter-spacing: 1px;
}
.sidebar .nav a, .sidebar .nav .nav-parent {
    display: flex; align-items: center; padding: 11px 20px; color: #fff;
    cursor: pointer; transition: background .2s; font-size: 14px;
}
.sidebar .nav a:hover, .sidebar .nav .nav-parent:hover { background: rgba(255,255,255,.10); }
.sidebar .nav a.active { background: rgba(255,255,255,.18); border-left: 4px solid #fbbf24; padding-left: 16px; }
.sidebar .nav .icon { width: 20px; margin-right: 10px; text-align: center; }
.sidebar .nav .submenu { display: none; background: rgba(0,0,0,.15); }
.sidebar .nav .submenu a { padding-left: 50px; font-size: 13px; }
.sidebar .nav .submenu .submenu-group { padding: 8px 20px 2px 35px; font-size: 11px; color: rgba(255,255,255,.5); letter-spacing: 1px; }
.sidebar .nav .submenu.open { display: block; }
.sidebar .nav .arrow { margin-left: auto; transition: transform .2s; }
.sidebar .nav .arrow.up { transform: rotate(180deg); }

.main { flex: 1; margin-left: 220px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
    height: 56px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.06);
    display: flex; align-items: center; padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.topbar .page-title { font-size: 16px; font-weight: 600; color: #2c3e50; }
.topbar .topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.topbar .user-info { display: flex; align-items: center; gap: 8px; color: #555; }
.topbar .avatar {
    width: 34px; height: 34px; border-radius: 50%; background: #1e40af; color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.topbar .btn-link { color: #888; cursor: pointer; }
.topbar .btn-link:hover { color: #e74c3c; }
.content { flex: 1; padding: 20px 24px; }

/* ---------- 卡片 ---------- */
.card {
    background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
    padding: 18px 20px; margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; color: #2c3e50; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid #eee; display: flex; align-items: center; }
.card-title .actions { margin-left: auto; }

/* ---------- 统计卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: 8px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); border-left: 4px solid #2563eb; }
.stat-card.income { border-left-color: #e74c3c; }
.stat-card.expense { border-left-color: #27ae60; }
.stat-card.profit { border-left-color: #f39c12; }
.stat-card .label { color: #888; font-size: 13px; margin-bottom: 6px; }
.stat-card .value { font-size: 24px; font-weight: 700; color: #2c3e50; }
.stat-card .sub { font-size: 12px; color: #aaa; margin-top: 4px; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 4px;
    padding: 7px 16px; border: 1px solid #ddd; background: #fff; color: #444;
    border-radius: 5px; cursor: pointer; transition: all .15s; font-size: 13px;
}
.btn:hover { background: #f5f5f5; }
.btn-primary { background: #2563eb; border-color: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #27ae60; border-color: #27ae60; color: #fff; }
.btn-danger { background: #e74c3c; border-color: #e74c3c; color: #fff; }
.btn-warning { background: #f39c12; border-color: #f39c12; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link { border: none; background: transparent; padding: 4px 8px; color: #2563eb; }
.btn-link.danger { color: #e74c3c; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-income { background: #e74c3c; border-color: #e74c3c; color: #fff; }
.btn-expense { background: #27ae60; border-color: #27ae60; color: #fff; }

/* ---------- 表单 ---------- */
.form-row { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-group label { color: #555; font-size: 13px; }
.form-group label .req { color: #e74c3c; }
.form-control {
    padding: 7px 10px; border: 1px solid #ddd; border-radius: 5px; min-width: 160px;
    transition: border-color .2s;
}
.form-control:focus { border-color: #2563eb; }
.form-control.wide { min-width: 320px; }
.search-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search-bar .form-control { min-width: 200px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th, table.data-table td {
    padding: 10px 12px; text-align: center; border-bottom: 1px solid #eee; border-right: 1px solid #f0f0f0;
}
table.data-table th { background: #fafbfc; color: #666; font-weight: 600; white-space: nowrap; text-align: center; }
table.data-table tr:hover { background: #f9fafb; }
table.data-table td.text-right { text-align: right; }
table.data-table .text-center { text-align: center; }
table.data-table .text-red { color: #e74c3c; }
table.data-table .text-green { color: #27ae60; }

/* 状态标签 */
.tag { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; line-height: 1.6; }
.tag-blue { background: #e0ecff; color: #2563eb; }
.tag-green { background: #e0f5e9; color: #27ae60; }
.tag-red { background: #fde8e8; color: #e74c3c; }
.tag-orange { background: #fff3e0; color: #f39c12; }
.tag-gray { background: #f0f0f0; color: #888; }

/* ---------- 分页 ---------- */
.pagination { display: flex; gap: 6px; justify-content: flex-end; margin-top: 14px; align-items: center; }
.pagination .pg-info { color: #888; margin-right: auto; font-size: 13px; }
.pagination button { padding: 5px 11px; border: 1px solid #ddd; background: #fff; border-radius: 4px; cursor: pointer; }
.pagination button.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- 弹窗 ---------- */
.modal-mask {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45);
    z-index: 1000; align-items: flex-start; justify-content: center; padding-top: 40px;
    overflow-y: auto;
}
.modal-mask.show { display: flex; }
.modal {
    background: #fff; border-radius: 8px; width: 560px; max-width: 92vw; margin-bottom: 40px;
    box-shadow: 0 8px 32px rgba(0,0,0,.2); animation: modalIn .2s;
}
.modal.large { width: 820px; }
.modal.xlarge { width: 1050px; }
@keyframes modalIn { from { transform: translateY(-20px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header { padding: 14px 20px; border-bottom: 1px solid #eee; display: flex; align-items: center; }
.modal-header h3 { font-size: 16px; color: #2c3e50; }
.modal-header .close { margin-left: auto; cursor: pointer; font-size: 22px; color: #999; line-height: 1; }
.modal-body { padding: 20px; max-height: 68vh; overflow-y: auto; }
.modal-footer { padding: 12px 20px; border-top: 1px solid #eee; text-align: right; display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
    padding: 10px 18px; border-radius: 5px; color: #fff; font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,.15); animation: toastIn .25s; min-width: 200px;
}
.toast.success { background: #27ae60; }
.toast.error { background: #e74c3c; }
.toast.info { background: #2563eb; }
@keyframes toastIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 工具类 ---------- */
.row { display: flex; gap: 12px; align-items: stretch; }
.col { flex: 1; display: flex; flex-direction: column; }
.col > .card { flex: 1; }
.text-red { color: #e74c3c; }
.text-green { color: #27ae60; }
.text-blue { color: #2563eb; }
.text-orange { color: #f39c12; }
.text-gray { color: #888; }
.bold { font-weight: 600; }
.mt-10 { margin-top: 10px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.empty { text-align: center; color: #999; padding: 40px 0; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.items-table { width: 100%; }
.items-table th, .items-table td { padding: 6px 8px; }
.items-table input { width: 100%; padding: 5px 8px; border: 1px solid #ddd; border-radius: 4px; }
.add-item-btn { border: 1px dashed #bbb; background: #fafafa; color: #888; width: 100%; padding: 8px; cursor: pointer; border-radius: 5px; }
.add-item-btn:hover { color: #2563eb; border-color: #2563eb; }
.divider { height: 1px; background: #eee; margin: 14px 0; }
.table-row-summary { background: #fafbfc !important; font-weight: 600; }

/* ---------- Tab 切换 ---------- */
.tab-bar { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid #eee; }
.tab-bar .tab {
    padding: 10px 20px; cursor: pointer; color: #666; font-size: 14px;
    border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s;
    user-select: none;
}
.tab-bar .tab:hover { color: #2563eb; }
.tab-bar .tab.active { color: #2563eb; border-bottom-color: #2563eb; font-weight: 600; }

/* ---------- Tab 按钮（页面内联Tab切换） ---------- */
.tab-btn { border: none; background: transparent; border-radius: 0; color: #666; padding: 6px 16px; cursor: pointer; }
.tab-btn.active { color: #e67e22; border-bottom: 2px solid #e67e12; font-weight: 600; }
.tab-btn-top { border: none; background: transparent; border-radius: 0; color: #666; padding: 6px 16px; cursor: pointer; }
.tab-btn-top.active { color: #e67e22; border-bottom: 2px solid #e67e12; font-weight: 600; }
.tab-badge { display: inline-block; min-width: 18px; height: 18px; line-height: 18px; text-align: center; background: #e74c3c; color: #fff; border-radius: 9px; font-size: 11px; margin-left: 4px; padding: 0 5px; }

/* ---------- 报表侧导航 ---------- */
/* ---------- 通用辅助 ---------- */
.hidden { display: none !important; }
.content .page-title { font-size: 16px; font-weight: 600; color: #2c3e50; margin-bottom: 14px; }
table.data-table tr.total-row { background: #f0f7ff !important; font-weight: 700; }
table.data-table tr.total-row td { border-top: 2px solid #2563eb; border-bottom: 2px solid #2563eb; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #2563eb 100%); }
.login-box { background: #fff; padding: 40px 36px; border-radius: 10px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.login-box h2 { text-align: center; color: #2c3e50; margin-bottom: 6px; }
.login-box .sub { text-align: center; color: #888; margin-bottom: 28px; font-size: 13px; }
.login-box .form-group { margin-bottom: 16px; }
.login-box .form-control { width: 100%; padding: 10px 12px; box-sizing: border-box; min-width: 0; }
.login-box .btn { width: 100%; padding: 11px; font-size: 15px; }
.login-tip { margin-top: 18px; padding: 10px; background: #f8f9fa; border-radius: 5px; font-size: 12px; color: #888; line-height: 1.7; }

/* 处方打印 */
.print-page { padding: 40px 50px; background: #fff; max-width: 800px; margin: 20px auto; }
.print-only { display: none; }
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main { margin: 0; }
    .content { padding: 0; }
    .print-page { margin: 0; max-width: none; padding: 20px; }
}

/* ---------- 日历视图(防疫计划) ---------- */
.calendar-grid { display: flex; flex-direction: column; border: 1px solid #e8e8e8; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.calendar-row { display: flex; }
.calendar-cell { flex: 1; min-height: 96px; border-right: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0; padding: 4px 6px; vertical-align: top; position: relative; min-width: 0; }
.calendar-cell.empty { background: #fafafa; }
.calendar-cell:nth-child(7n) { border-right: none; }
.calendar-header .calendar-cell { min-height: auto; padding: 8px; text-align: center; font-weight: 600; background: #f5f7fa; color: #666; border-bottom: 1px solid #e8e8e8; }
.calendar-day { font-size: 13px; color: #666; font-weight: 600; margin-bottom: 2px; }
.calendar-cell.today { background: #fff8e1; }
.calendar-cell.today .calendar-day { color: #fa8c16; }
.calendar-events { font-size: 11px; }
.cal-event { padding: 2px 4px; margin: 2px 0; border-radius: 3px; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; background: #e6f4ff; color: #1677ff; border-left: 3px solid #1677ff; }
.cal-event.done { background: #f0f9eb; color: #529b2e; border-left-color: #529b2e; }
.cal-event.skipped { background: #f4f4f5; color: #909399; border-left-color: #909399; text-decoration: line-through; }
.cal-event.canceled { background: #fef0f0; color: #c45656; border-left-color: #c45656; }
.cal-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 2px; }
.cal-dot.planned { background: #1677ff; }
.cal-dot.done { background: #529b2e; }
.cal-dot.skipped { background: #909399; }
.cal-dot.canceled { background: #c45656; }
.cal-more { color: #999; font-size: 10px; padding: 1px 4px; }
