* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; background: #f1f5f9; color: #1f2937; line-height: 1.6; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a8a, #2563eb); }
.login-card { background: #fff; width: 340px; max-width: 92vw; border-radius: 14px; padding: 32px 28px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card h1 { font-size: 22px; text-align: center; color: #1e3a8a; }
.login-sub { text-align: center; color: #6b7280; font-size: 13px; margin-bottom: 18px; }
.login-card label { display: block; font-size: 13px; color: #374151; margin: 12px 0 4px; }
.login-card input { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; }
.login-card button { width: 100%; margin-top: 18px; padding: 11px; background: #2563eb; color: #fff; border: none; border-radius: 8px; font-size: 15px; cursor: pointer; }
.login-card button:hover { background: #1d4ed8; }
.login-tip { text-align: center; color: #9ca3af; font-size: 12px; margin-top: 14px; }
.error-box { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; padding: 8px 10px; border-radius: 8px; font-size: 13px; margin-bottom: 8px; }

/* 主框架 */
.topbar { background: #1e3a8a; color: #fff; padding: 12px 20px; display: flex; justify-content: space-between; align-items: center; }
.topbar .brand { font-size: 17px; font-weight: 600; }
.topbar .user { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.topbar .ghost { background: transparent; border: 1px solid #ffffff66; color: #fff; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.topbar .ghost:hover { background: #ffffff22; }
.tag { background: #2563eb; padding: 2px 8px; border-radius: 10px; font-size: 12px; color: #fff; margin: 0 4px; }
.tag.green { background: #16a34a; }
.tag.gray { background: #6b7280; }

.layout { display: flex; min-height: calc(100vh - 54px); }
.nav { width: 180px; background: #fff; border-right: 1px solid #e5e7eb; padding: 10px 0; flex-shrink: 0; }
.nav button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 11px 18px; font-size: 14px; color: #374151; cursor: pointer; border-left: 3px solid transparent; }
.nav button:hover { background: #f1f5f9; }
.nav button.active { background: #eff6ff; color: #2563eb; border-left-color: #2563eb; font-weight: 600; }

.content { flex: 1; padding: 22px 26px; overflow: auto; }
.content h2 { font-size: 18px; margin-bottom: 14px; }
.content h3 { font-size: 15px; margin: 18px 0 8px; color: #2563eb; }

/* 表格 */
.table-wrap { width: 100%; overflow-x: auto; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.06); background: #fff; }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: 13.5px; margin: 0; table-layout: fixed; }
.table-wrap table { border-radius: 8px; overflow: hidden; }
th, td { border: 1px solid #e5e7eb; padding: 9px 8px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
th { background: #f8fafc; font-weight: 600; color: #374151; }
/* 记录表各列宽度——按内容"最低可读"分配 */
.rec-table col.c-date { width: 95px; }
.rec-table col.c-type { width: 60px; }
.rec-table col.c-dept { width: 75px; }
.rec-table col.c-name { width: 75px; }
.rec-table col.c-num  { width: 50px; }
.rec-table col.c-money{ width: 75px; }
.rec-table col.c-status { width: 95px; }
.rec-table col.c-act  { width: 220px; }
/* 表头内嵌检索：直接把 th 内的标题替换为 input，输入即筛选 */
.rec-table thead th { padding: 6px 8px; }
.rec-table thead input.rec-filter {
  width: 100%; box-sizing: border-box; padding: 4px 6px; font-size: 12.5px;
  border: 1px solid #d1d5db; border-radius: 5px; background: #fff; outline: none;
  color: #111827; font-weight: 500;
}
.rec-table thead input.rec-filter::placeholder { color: #9ca3af; font-weight: 400; }
.rec-table thead input.rec-filter:focus { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.15); }
.rec-table td.c-act { white-space: normal; background: #fff; box-shadow: -2px 0 4px rgba(0,0,0,.06); }
.rec-table td.c-act .btn.sm { margin: 2px 4px 2px 0; }
.rec-table thead th:last-child,
.rec-table tbody td.c-act { position: sticky; right: 0; z-index: 2; }
.rec-table thead th:last-child { background: #f1f5f9; box-shadow: -2px 0 4px rgba(0,0,0,.06); }

/* 表单 */
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: #6b7280; }
.field input, .field select { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 7px; font-size: 14px; }
.field .readonly-val { padding: 8px 10px; border: 1px solid #e5e7eb; background: #f9fafb; border-radius: 7px; font-size: 14px; color: #374151; font-weight: 500; }
.btn { background: #2563eb; color: #fff; border: none; padding: 9px 16px; border-radius: 7px; font-size: 14px; cursor: pointer; }
.btn:hover { background: #1d4ed8; }
.btn.sm { padding: 5px 12px; font-size: 13px; }
.btn.green { background: #16a34a; }
.btn.green:hover { background: #15803d; }
.btn.red { background: #dc2626; }
.btn.red:hover { background: #b91c1c; }
.btn.ghost { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.muted { color: #9ca3af; font-size: 12px; }
/* 假日来源标记 */
.src { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.src-system { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.src-manual { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
/* 实际人员列：已登记的人姓名 */
td .actual { color: #059669; font-weight: 600; }

/* 状态徽标 */
.badge { display: inline-block; padding: 2px 9px; border-radius: 11px; font-size: 12px; }
.b-pending_leader { background: #fef3c7; color: #92400e; }
.b-pending_manager { background: #dbeafe; color: #1e40af; }
.b-approved { background: #dcfce7; color: #166534; }
.b-rejected { background: #fee2e2; color: #991b1b; }

/* 卡片/提示 */
.card { background: #fff; border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.notice { background: #eff6ff; border: 1px dashed #93c5fd; border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #1e40af; margin-bottom: 14px; }
.preview { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 12px 14px; margin-top: 12px; font-size: 14px; }
.preview b { color: #166534; }

/* 弹层 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: #fff; border-radius: 12px; padding: 22px 24px; width: 440px; max-width: 94vw; max-height: 90vh; overflow: auto; }
.modal h3 { margin-top: 0; }
.modal .field { margin-bottom: 10px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.modal .req { color: #dc2626; font-weight: 700; margin-left: 2px; }
.modal .field-check { margin-top: 8px; font-size: 13px; display: flex; flex-wrap: wrap; gap: 10px; }
.modal .ck-ok { color: #16a34a; }
.modal .ck-no { color: #dc2626; }
.modal .btn[disabled] { opacity: .5; cursor: not-allowed; background: #9ca3af !important; border-color: #9ca3af !important; }

.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; z-index: 80; }
.ok-toast { background: #16a34a; }

/* 详情里的截图缩略图 */
.thumb { max-width: 220px; max-height: 220px; border: 1px solid #e5e7eb; border-radius: 8px; cursor: zoom-in; transition: transform .15s, box-shadow .15s; }
.thumb:hover { transform: scale(1.03); box-shadow: 0 4px 14px rgba(0,0,0,.18); }

/* 图片放大浮层（独立于 modal 体系，避免嵌套冲突） */
#img-lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 9999; display: none; flex-direction: column; align-items: center; justify-content: center; cursor: zoom-out; }
#img-lightbox-bar { position: absolute; top: 0; left: 0; right: 0; padding: 10px 16px; display: flex; gap: 16px; align-items: center; color: #fff; background: linear-gradient(to bottom, rgba(0,0,0,.7), transparent); font-size: 14px; }
#img-lightbox-title { font-weight: 600; }
#img-lightbox-tools { display: flex; gap: 6px; align-items: center; flex: 1; justify-content: flex-end; }
#img-lightbox-tools .btn { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.3); }
#img-lightbox-tools .btn:hover { background: rgba(255,255,255,.25); }
#img-lightbox-tip { color: #cbd5e1; font-size: 12px; margin-right: 8px; }
#img-lightbox-close { background: #fff; color: #1f2937; border: none; padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }
#img-lightbox-close:hover { background: #f1f5f9; }
#img-lightbox-stage { max-width: 95vw; max-height: 85vh; display: flex; align-items: center; justify-content: center; cursor: default; }
#img-lightbox-img { max-width: 95vw; max-height: 85vh; object-fit: contain; transform-origin: center center; transition: transform .12s; cursor: default; }
.err-toast { background: #dc2626; }

/* 月历视图 */
.cal-legend { display: flex; gap: 8px; font-size: 12px; }
.lg { padding: 2px 8px; border-radius: 4px; border: 1px solid #e5e7eb; background: #f9fafb; }
.lg-we { background: #fee2e2; border-color: #fecaca; }
.lg-hol { background: #fef3c7; border-color: #fde68a; }
.lg-off { background: #fed7aa; border-color: #fdba74; }
.lg-work{ background: #bbf7d0; border-color: #86efac; }
.lg-sch { background: #dbeafe; border-color: #bfdbfe; }
.lg-today { background: #ede9fe; border-color: #7c3aed; border-width: 2px; color: #5b21b6; font-weight: 700; }
.cal-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head > div { text-align: center; font-weight: 600; color: #6b7280; padding: 6px 0; }
.cal-empty { background: transparent; }
.cal-cell { background: #fff; border: 1px solid #e5e7eb; border-radius: 6px; padding: 4px 6px; min-height: 56px; cursor: pointer; transition: transform .08s; position: relative; }
.cal-cell:hover { transform: translateY(-1px); border-color: #2563eb; box-shadow: 0 2px 4px rgba(37,99,235,.1); }
.cal-day { font-weight: 700; font-size: 14px; }
.cal-we { background: #fee2e2; border-color: #fca5a5; }
.cal-hol { background: #fef3c7; border-color: #fde68a; }
.cal-hol .cal-day { color: #b45309; }
.cal-off { background: #fed7aa; border-color: #fdba74; }
.cal-off .cal-day { color: #9a3412; }
.cal-work { background: #bbf7d0; border-color: #86efac; }
.cal-work .cal-day { color: #166534; }
.cal-sch { background: #dbeafe; border-color: #93c5fd; }
.cal-sch::after { content: "●"; position: absolute; bottom: 2px; right: 6px; color: #2563eb; font-size: 12px; }
.cal-today { border-width: 2px; border-color: #7c3aed; outline: 2px solid #7c3aed; outline-offset: -3px; background: #ede9fe; }
.cal-today .cal-day { color: #5b21b6; }
.cal-hol-name { font-size: 10px; color: #b45309; margin-top: 2px; line-height: 1.2; max-height: 24px; overflow: hidden; }
.cal-collapse { cursor: pointer; user-select: none; display: flex; align-items: center; gap: 6px; }
.cal-collapse:hover { color: #2563eb; }
.cal-arrow { display: inline-block; transition: transform .15s; font-size: 12px; color: #9ca3af; }
.cal-collapse.open .cal-arrow { transform: rotate(90deg); color: #2563eb; }
.cal-body { margin-top: 10px; }

@media (max-width: 720px) {
  .layout { flex-direction: column; }
  .nav { width: 100%; display: flex; overflow-x: auto; border-right: none; border-bottom: 1px solid #e5e7eb; }
  .nav button { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
  .nav button.active { border-left: none; border-bottom-color: #2563eb; }
  .content { padding: 16px; }
  table { font-size: 12.5px; }
  th, td { padding: 7px 6px; }
}
