/* ============================================================
   思库新媒体 · 内部任务看板
   ============================================================ */

:root {
  --bg:          #f4f6fb;
  --panel:       #ffffff;
  --line:        #e6eaf2;
  --line-soft:   #f0f3f9;
  --text:        #1b2233;
  --text-2:      #465069;
  --muted:       #7b869c;
  --primary:     #4f6ef7;
  --primary-dark:#3f5ce0;
  --primary-soft:#eef2ff;
  --ok:          #12b76a;
  --ok-soft:     #e7f8ef;
  --warn:        #f79009;
  --warn-soft:   #fff6e5;
  --danger:      #f04438;
  --danger-soft: #feecea;
  --r:           14px;
  --shadow:      0 6px 24px rgba(27, 34, 51, .06);
}

* { box-sizing: border-box; }

/* 避免 iOS 横屏时自动放大字号 */
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.65 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1360px; margin: 0 auto; padding: 22px 22px 52px; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 60;
}
.topbar-inner {
  max-width: 1360px; margin: 0 auto; padding: 0 22px;
  height: 62px; display: flex; align-items: center; gap: 26px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16.5px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  background: linear-gradient(135deg, #4f6ef7, #8b5cf6);
  color: #fff; display: grid; place-items: center; font-size: 15px; font-weight: 800;
}
.brand small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); line-height: 1.2; }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  padding: 7px 14px; border-radius: 9px; color: var(--text-2);
  font-size: 14.5px; font-weight: 500;
}
.nav a:hover { background: var(--line-soft); text-decoration: none; }
.nav a.on { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }

.topbar .spacer { flex: 1; }

.user-chip { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text-2); }
.user-chip .nm { font-weight: 600; color: var(--text); }
.role-tag {
  font-size: 11.5px; padding: 2px 8px; border-radius: 20px; font-weight: 600;
  background: var(--primary-soft); color: var(--primary-dark);
}
.role-tag.member { background: #f2f4f8; color: #5c677d; }

.avatar {
  display: inline-grid; place-items: center; border-radius: 50%;
  color: #fff; font-weight: 600; font-size: 14px; flex: none;
  letter-spacing: 0;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--text-2); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #cfd7e6; background: #fafbfe; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { filter: brightness(.94); }
.btn.warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f6cfcb; background: #fff; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- 消息条 ---------------- */
.flash-wrap { margin: 16px 0 0; }
.flash {
  padding: 11px 16px; border-radius: 11px; font-size: 14px; margin-bottom: 10px;
  border: 1px solid transparent;
}
.flash.ok   { background: var(--ok-soft); border-color: #b7ebcd; color: #0a6c3c; }
.flash.warn { background: var(--warn-soft); border-color: #fbe0ae; color: #8a5300; }
.flash.err  { background: var(--danger-soft); border-color: #f8c9c4; color: #912018; }

/* ---------------- 统计卡 ---------------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 14px; margin: 20px 0;
}
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .lb { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .vl { font-size: 28px; font-weight: 700; letter-spacing: -.5px; margin-top: 4px; }
.stat .ex { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.stat.green .vl { color: var(--ok); }
.stat.red .vl { color: var(--danger); }
.stat.amber .vl { color: var(--warn); }
.stat.blue .vl { color: var(--primary); }

/* ---------------- 区块 ---------------- */
.section { margin: 26px 0; }
.sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.sec-head h2 { margin: 0; font-size: 17.5px; }
.sec-head .desc { color: var(--muted); font-size: 13.5px; }
.sec-head .spacer { flex: 1; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
}

/* ---------------- 工具条 ---------------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 16px; box-shadow: var(--shadow);
}
.date-nav { display: flex; align-items: center; gap: 6px; }
.date-nav input[type=date] {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px;
  font: inherit; font-size: 14px; color: var(--text); background: #fff;
}
.date-nav input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.date-label { font-weight: 600; font-size: 15px; min-width: 92px; text-align: center; }
.date-label small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.toolbar .spacer { flex: 1; }

.tabs { display: flex; gap: 4px; background: var(--line-soft); padding: 4px; border-radius: 11px; }
.tabs a {
  padding: 6px 16px; border-radius: 8px; font-size: 14px; color: var(--text-2); font-weight: 500;
}
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.on { background: #fff; color: var(--primary-dark); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.05); }

/* ---------------- 日视图 ---------------- */
.member-row {
  display: grid; grid-template-columns: 210px 1fr;
  border-bottom: 1px solid var(--line-soft);
}
.member-row:last-child { border-bottom: 0; }
.member-row .who {
  padding: 16px 18px; display: flex; align-items: center; gap: 11px;
  border-right: 1px solid var(--line-soft); background: #fcfdff;
}
.member-row .who .info { min-width: 0; }
.member-row .who .nm { font-weight: 600; font-size: 15px; }
.member-row .who .dp { font-size: 12.5px; color: var(--muted); }
.member-row .who .rate { font-size: 12px; color: var(--muted); margin-top: 2px; }
.member-row .tasks { padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; }
.empty-task { color: var(--muted); font-size: 13.5px; padding: 6px 0; }

.task-pill {
  border: 1px solid var(--line); border-radius: 11px; padding: 9px 13px;
  background: #fff; cursor: pointer; transition: .15s; max-width: 330px; min-width: 190px;
  display: flex; flex-direction: column; gap: 5px; text-align: left; font: inherit;
  color: inherit; position: relative;
}
.task-pill:hover { border-color: #c3cee6; box-shadow: 0 4px 14px rgba(27,34,51,.07); }
.task-pill .t { font-size: 14.5px; font-weight: 600; line-height: 1.45; }
.task-pill .meta { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.task-pill.is-done { border-color: #b7ebcd; background: var(--ok-soft); }
.task-pill.is-done .t { color: #0a6c3c; }
.task-pill.is-miss { border-color: #f8c9c4; background: var(--danger-soft); }
.task-pill.is-miss .t { color: #912018; }
.task-pill.is-pending:hover { border-color: var(--primary); }

/* 长期任务胶囊：虚线边框 + 淡蓝底，与每日 / 一次性任务区分 */
.task-pill.is-long { border-style: dashed; border-color: #b9cdf5; background: #f8faff; }
.task-pill.is-long:hover { border-color: var(--primary); }
.task-pill.is-long.is-miss { border-color: #f8c9c4; background: var(--danger-soft); }

/* 周期任务胶囊（当天不是执行日）：虚线灰边，提示距离下次提交要求的天数 */
.task-pill.is-upcoming { border-style: dashed; border-color: #d5dcea; background: #fcfdff; }
.task-pill.is-upcoming:hover { border-color: var(--primary); }
.task-pill.is-upcoming .t { color: #4a5568; }
.task-pill.is-upcoming .meta > span:first-child { color: #5c677d; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; padding: 2px 9px; border-radius: 20px; font-weight: 600;
  background: #f2f4f8; color: #5c677d;
}
.badge.done { background: var(--ok-soft); color: #0a6c3c; }
.badge.miss { background: var(--danger-soft); color: #912018; }
.badge.pending { background: var(--warn-soft); color: #8a5300; }
.badge.info { background: var(--primary-soft); color: var(--primary-dark); }
.badge.gray { background: #f2f4f8; color: #5c677d; }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot.green { background: var(--ok); }
.dot.red   { background: var(--danger); }
.dot.amber { background: var(--warn); }
.dot.gray  { background: #c3cad8; }

.ro { font-size: 12px; color: var(--muted); }

/* ---------------- 周视图 ---------------- */
.week-wrap { overflow-x: auto; }
table.week { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 860px; }
table.week th, table.week td { border-bottom: 1px solid var(--line-soft); padding: 10px 8px; text-align: center; }
table.week thead th {
  font-size: 13px; color: var(--text-2); font-weight: 600; background: #fcfdff;
  border-bottom: 1px solid var(--line); position: sticky; top: 62px; z-index: 5;
}
table.week thead th.today { color: var(--primary); }
table.week th.who, table.week td.who {
  text-align: left; width: 190px; border-right: 1px solid var(--line-soft);
  background: #fcfdff; position: sticky; left: 0; z-index: 2;
}
table.week td.cell { cursor: pointer; transition: .12s; }
table.week td.cell:hover { background: var(--primary-soft); }
table.week td.cell.today-col { background: #fbfcff; }
.wbox {
  display: inline-flex; flex-direction: column; align-items: center; gap: 3px;
  min-width: 56px; padding: 5px 8px; border-radius: 9px;
}
.wbox .num { font-size: 14.5px; font-weight: 700; }
.wbox .sub { font-size: 11.5px; color: var(--muted); }
.wbox.all-done { background: var(--ok-soft); }
.wbox.has-miss { background: var(--danger-soft); }
.wbox.none { background: transparent; }
.mdots { display: flex; gap: 3px; justify-content: center; margin-top: 2px; flex-wrap: wrap; }

/* ---------------- 长期任务 ---------------- */
.long-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 16px; }
.long-card { padding: 18px 20px; }
.long-card h3 { margin: 0 0 4px; font-size: 16px; }
.long-card .detail { color: var(--muted); font-size: 13.5px; margin-bottom: 12px; }
.long-card .tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

.pline { padding: 9px 0; border-top: 1px dashed var(--line); }
.pline:first-of-type { border-top: 0; }
.pline .top { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; flex-wrap: wrap; }
.pline .nm { font-weight: 600; font-size: 14px; }
.pline .spacer { flex: 1; }
.bar { height: 8px; background: #eef1f7; border-radius: 20px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 20px; transition: width .4s ease; }
.bar.ok > i { background: var(--ok); }
.bar.over > i { background: var(--danger); }

/* ---------------- 抽屉 / 详情 ---------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(23, 30, 48, .42);
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 90;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100%);
  background: #fff; box-shadow: -12px 0 40px rgba(16, 24, 40, .16);
  transform: translateX(102%); transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  z-index: 91; display: flex; flex-direction: column;
}
.drawer.show { transform: translateX(0); }
.drawer-head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 12px;
}
.drawer-head h3 { margin: 0 0 4px; font-size: 17px; }
.drawer-head .spacer { flex: 1; }
.drawer-close {
  border: 0; background: #f2f4f8; width: 30px; height: 30px; border-radius: 8px;
  cursor: pointer; color: var(--muted); font-size: 17px; line-height: 1; flex: none;
}
.drawer-close:hover { background: #e6eaf2; color: var(--text); }
.drawer-body { padding: 18px 22px 26px; overflow-y: auto; flex: 1; }

.kv { display: grid; grid-template-columns: 92px 1fr; gap: 8px 12px; font-size: 14px; margin-bottom: 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text-2); }

.shot { margin: 10px 0; }
.shot img {
  max-width: 100%; border-radius: 11px; border: 1px solid var(--line); display: block; cursor: zoom-in;
}

.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 20px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before {
  content: ''; position: absolute; left: -7px; top: 5px; width: 12px; height: 12px;
  border-radius: 50%; background: #fff; border: 2px solid var(--primary);
}
.timeline .when { font-size: 12.5px; color: var(--muted); }
.timeline .what { font-size: 14px; color: var(--text-2); margin-top: 2px; }

.form-block { background: #f8fafd; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-top: 6px; }
.form-block label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--text-2); }
.form-block input[type=file], .form-block input[type=range], .form-block textarea { width: 100%; }
.form-block textarea, .form-block input[type=text], .form-block input[type=number],
.form-block input[type=date], .form-block input[type=time], .form-block input[type=password],
.form-block select {
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; font: inherit; font-size: 14px; background: #fff;
}
.form-block textarea:focus, .form-block input:focus, .form-block select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-block .row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-block .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }

/* ---------------- 表格 ---------------- */
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: middle; }
table.data th { font-size: 13px; color: var(--muted); font-weight: 600; background: #fcfdff; border-bottom: 1px solid var(--line); }
table.data tr:last-child td { border-bottom: 0; }
table.data .acts { display: flex; gap: 6px; flex-wrap: wrap; }

/* 宽表格在窄屏只在自身容器内横滑，不撑破页面 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------------- 表单 ---------------- */
.panel-form { padding: 20px 22px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.field input[type=text], .field input[type=password], .field input[type=number],
.field input[type=date], .field input[type=time], .field input[type=datetime-local],
.field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
  font: inherit; font-size: 14px; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.field.full { grid-column: 1 / -1; }
.checkline { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.checkline label { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--text-2); }
.form-actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

.login-box { max-width: 400px; margin: 9vh auto; padding: 30px 32px; }

.pw-box {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13.5px;
  background: #f8fafd; border: 1px dashed var(--line); border-radius: 8px;
  padding: 3px 9px; display: inline-block; letter-spacing: .5px;
}

.note {
  background: var(--warn-soft); border: 1px solid #fbe0ae; color: #8a5300;
  border-radius: 11px; padding: 11px 15px; font-size: 13.5px; margin: 14px 0;
}

.toast-wrap { position: fixed; left: 50%; top: 22px; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; }
.toast {
  padding: 11px 20px; border-radius: 11px; font-size: 14px; color: #fff; font-weight: 500;
  background: #1b2233; box-shadow: 0 10px 30px rgba(16,24,40,.2);
  animation: tin .25s ease; max-width: 90vw;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }
.toast.warn { background: var(--warn); }
@keyframes tin { from { opacity: 0; transform: translateY(-10px); } }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt16 { margin-top: 16px; }
.mb12 { margin-bottom: 12px; }

/* ---------------- 出勤状态 ---------------- */
.att-panel { display: flex; flex-direction: column; }
.att-row {
  display: grid; grid-template-columns: 216px 1fr; align-items: center;
  padding: 11px 16px; border-bottom: 1px solid var(--line-soft); gap: 12px;
}
.att-row:last-child { border-bottom: 0; }
.att-row.editable { background: #fff; }
.att-row .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.att-row .who .nm { font-weight: 600; font-size: 14.5px; }
.att-row .who .dp { font-size: 12.5px; color: var(--muted); }
.att-row .periods { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.att-empty { padding: 26px; text-align: center; color: var(--muted); }

.att-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 9px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); background: #fff;
}
.att-chip i { font-style: normal; font-weight: 500; font-size: 12px; opacity: .75; }
.att-chip.sm { padding: 2px 9px; font-size: 12.5px; }
.at-ok      { background: var(--ok-soft);     color: #0a6c3c;      border-color: #b7ebcd; }
.at-warn    { background: var(--warn-soft);   color: #8a5300;      border-color: #fbe0ae; }
.at-danger  { background: var(--danger-soft); color: #912018;      border-color: #f8c9c4; }
.at-info    { background: var(--primary-soft);color: var(--primary-dark); border-color: #c9d4ff; }
.at-purple  { background: #f4efff;            color: #6d3fd4;      border-color: #e2d6fb; }
.at-none    { background: #f6f8fc;            color: #8a93a6;      border-color: var(--line); }

.att-sel-wrap { padding-right: 4px; }
select.att-sel {
  border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 600;
  color: inherit; padding: 0 2px; cursor: pointer; outline: none;
}
select.att-sel option { color: #1b2233; background: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--line-soft); color: var(--text); }

/* 抽屉里的时段选择 */
.att-edit {
  background: #f8fafd; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px;
}
.att-edit .pname { font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.att-edit .opts { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 9px; }
.att-edit .opt {
  position: relative; padding: 6px 14px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; font-size: 13.5px; font-weight: 600; color: var(--text-2);
  transition: .15s; user-select: none;
}
.att-edit .opt input { position: absolute; opacity: 0; pointer-events: none; }
.att-edit .opt:hover { border-color: #c3cee6; }
.att-edit .opt.on { color: #fff; border-color: transparent; background: var(--primary); }
.att-edit .opt.att-onduty.on  { background: var(--ok); }
.att-edit .opt.att-swap.on    { background: var(--warn); }
.att-edit .opt.att-leave.on   { background: var(--danger); }
.att-edit .opt.att-tongxiu.on { background: var(--primary); }
.att-edit .opt.att-field.on   { background: #8b5cf6; }
.att-edit input[type=text] {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 7px 11px;
  font: inherit; font-size: 13.5px; background: #fff;
}
.att-edit input[type=text]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------------- 出勤日历 ---------------- */
.cal-wrap { overflow-x: auto; }
table.cal { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 720px; }
table.cal th, table.cal td { border-bottom: 1px solid var(--line-soft); padding: 8px 6px; text-align: center; }
table.cal thead th { font-size: 12.5px; color: var(--text-2); background: #fcfdff; border-bottom: 1px solid var(--line); }
table.cal thead th.today { color: var(--primary); }
table.cal th.who, table.cal td.who {
  text-align: left; width: 180px; border-right: 1px solid var(--line-soft);
  background: #fcfdff; position: sticky; left: 0; z-index: 2;
}
table.cal td.cell { cursor: pointer; transition: .12s; }
table.cal td.cell.can-edit:hover { background: var(--primary-soft); }
table.cal td.cell.today-col { background: #fbfcff; }
table.cal td.sum, table.cal th.sum { width: 56px; background: #fcfdff; }
.mini {
  display: inline-block; min-width: 19px; height: 19px; line-height: 17px;
  border-radius: 5px; font-size: 11px; font-weight: 700; margin: 0 1px;
  border: 1px solid transparent;
}
.mini-tbl th, .mini-tbl td { padding: 7px 8px; font-size: 13px; }
.mini-select {
  border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px;
  font: inherit; font-size: 13.5px; background: #fff; color: var(--text);
}

/* ---------------- 图表 ---------------- */
.chart-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; margin: 18px 0 16px; }
.chart-grid.three { grid-template-columns: 1.35fr 1fr 1fr; }
.chart-card { padding: 16px 18px; display: flex; flex-direction: column; }
.chart-card .ch-head { min-height: 24px; }

/* 简化版出勤构成：一条占比色带 */
.att-mini-bar {
  display: flex; height: 38px; border-radius: 10px; overflow: hidden;
  background: #f1f4fa; border: 1px solid var(--line-soft);
}
.att-mini-bar > span {
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; color: #fff; overflow: hidden;
  white-space: nowrap; transition: width .35s ease; min-width: 0;
}
.att-mini-foot { margin-top: auto; padding-top: 10px; }
.ch-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.ch-head h3 { margin: 0; font-size: 15px; }
.ch-head .desc { font-size: 12.5px; color: var(--muted); }
.ch-foot { margin-top: 8px; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart-donut { width: 150px; height: 150px; flex: none; }
.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--text-2); }
.legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.legend .lg i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend .lg b { color: var(--text); font-weight: 700; }

@media (max-width: 1180px) {
  .chart-grid.three { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .chart-grid, .chart-grid.three { grid-template-columns: 1fr; }
  .att-row { grid-template-columns: 1fr; }
}

/* ---------------- 响应式 ---------------- */

/* 窄屏可横滑容器：加边缘阴影，提示「还能左右滑」 */
@media (max-width: 900px) {
  .table-wrap,
  .week-wrap,
  .cal-wrap,
  .card.table-scroll,
  .drawer-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background-image:
      linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)),
      linear-gradient(to right, rgba(255, 255, 255, 0), #fff 70%),
      radial-gradient(farthest-side at 0 50%, rgba(27, 34, 51, .14), rgba(0, 0, 0, 0)),
      radial-gradient(farthest-side at 100% 50%, rgba(27, 34, 51, .14), rgba(0, 0, 0, 0));
    background-position: 0 0, 100% 0, 0 0, 100% 0;
    background-repeat: no-repeat;
    background-size: 28px 100%, 28px 100%, 12px 100%, 12px 100%;
    background-attachment: local, local, scroll, scroll;
  }
}

/* 平板 / 小笔记本：单列布局，顶栏改为「品牌行 + 整行可横滑导航」 */
@media (max-width: 900px) {
  .container { padding: 0 14px 44px; }

  .member-row { grid-template-columns: 1fr; }
  .member-row .who { border-right: 0; border-bottom: 1px solid var(--line-soft); }

  .topbar-inner { height: auto; padding: 8px 14px; flex-wrap: wrap; gap: 6px 10px; }
  .brand { margin-right: auto; }
  .topbar .spacer { display: none; }
  .nav {
    order: 5; flex: 1 1 100%; margin: 0; gap: 2px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; -ms-overflow-style: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a {
    flex: none; min-height: 40px; display: inline-flex; align-items: center;
    padding: 8px 12px; white-space: nowrap;
  }
  .user-chip { min-width: 0; flex-wrap: wrap; justify-content: flex-end; row-gap: 3px; font-size: 13px; }
  .user-chip .nm { font-size: 13.5px; }
  .user-chip .badge { font-size: 11px; padding: 2px 7px; }
  /* 退出按钮换行时靠右，避免单独一行贴在左侧 */
  .topbar-inner > .btn.sm { margin-left: auto; }

  /* 触摸目标与间距 */
  .btn { min-height: 38px; }
  .btn.sm { min-height: 36px; padding: 8px 12px; }
  .tabs a { min-height: 36px; display: inline-flex; align-items: center; }
  /* 表格内微型控件在原设计里只有 20px 高，窄屏下加大到可点区域 */
  .mini-select { min-height: 34px; }
  select.att-sel { min-height: 34px; }
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; vertical-align: -3px; }

  /* 平板宽度下数据表中文不逐字竖排：列宽随内容，超出部分交给 .card.table-scroll 横滑承载 */
  table.data th, table.data td { word-break: keep-all; }

  table.week thead th { position: static; }
  table.cal th.who, table.cal td.who,
  table.week th.who, table.week td.who { box-shadow: 1px 0 0 var(--line-soft); }
}

/* 手机：紧凑间距，工具条换行、标签页横滑，表格字距收窄 */
@media (max-width: 700px) {
  .container { padding: 0 12px 40px; }
  .section { margin: 20px 0; }

  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 16px 0; }
  .stat { padding: 14px 15px; }
  .stat .vl { font-size: 24px; }

  .long-grid { grid-template-columns: 1fr; gap: 12px; }
  .long-card, .panel-form, .chart-card { padding: 16px 15px; }
  .long-card h3, .sec-head h2, .task-pill .t, .ch-head h3 { overflow-wrap: anywhere; }

  .toolbar { padding: 10px 12px; gap: 8px; }
  .toolbar > form { flex: 1 1 100%; min-width: 0; }
  .toolbar .spacer { flex: 1 1 100%; height: 0; }

  /* 日期导航：允许换行，日期框自适应宽度 */
  .date-nav { flex: 1 1 100%; flex-wrap: wrap; gap: 6px; }
  .date-nav input[type=date] { flex: 1 1 132px; min-width: 0; max-width: 100%; }
  .date-label { min-width: 0; }
  .mini-select { max-width: 100%; }

  /* 表单控件：16px 避免 iOS 聚焦时自动放大；下拉加大触摸目标 */
  input[type=text], input[type=password], input[type=number], input[type=date],
  input[type=time], input[type=datetime-local], select, textarea { font-size: 16px; }
  select.att-sel { font-size: 16px; min-height: 38px; padding: 6px 4px; }
  .mini-select { min-height: 40px; }
  /* 原生复选框/单选框：默认 13px 在手机上过小，放大触摸目标 */
  input[type=checkbox], input[type=radio] { width: 20px; height: 20px; vertical-align: -3px; }

  /* 标签页：一行放不下时自身横滑 */
  .tabs { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { flex: none; white-space: nowrap; }

  table.data { font-size: 13px; }
  /* 中文单元格不逐字竖排；列宽随内容，超出时由外层横滑容器承载 */
  table.data th, table.data td { padding: 9px 10px; word-break: keep-all; }
  table.data .acts { gap: 5px; }
  .mini-tbl th, .mini-tbl td { padding: 7px 8px; font-size: 12.5px; }

  .drawer-head { padding: 16px 16px; }
  .drawer-body { padding: 16px 16px 24px; }
  .kv { grid-template-columns: 78px 1fr; gap: 8px 10px; }
  .form-block { padding: 13px 13px; }
  .login-box { padding: 24px 20px; margin: 6vh auto; }
  .task-pill { min-width: 0; max-width: none; width: 100%; }
}

/* 超窄屏：进一步收窄留白 */
@media (max-width: 400px) {
  .container { padding: 0 10px 36px; }
  .topbar-inner { padding: 8px 10px; }
  .brand { font-size: 15px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .role-tag, .badge { font-size: 11px; }
}
