/* ============================================================
   签到点名系统 · 样式表（PC / 移动端自适应）
   ============================================================ */
:root {
  --bg: #f4f6fb;
  --bg-soft: #eaeef7;
  --card: #ffffff;
  --card-2: #f8fafc;
  --text: #17203a;
  --muted: #6b7691;
  --line: #e3e8f2;
  --primary: #2563eb;
  --primary-soft: #e8efff;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --success-soft: #e7f7ed;
  --warn: #d97706;
  --warn-soft: #fdf3e3;
  --danger: #dc2626;
  --danger-soft: #fdeaea;
  --shadow: 0 1px 2px rgba(23, 32, 58, .06), 0 8px 24px rgba(23, 32, 58, .06);
  --shadow-lg: 0 12px 40px rgba(23, 32, 58, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 62px;
  --top-h: 54px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
[data-theme="dark"] {
  --bg: #0f1424;
  --bg-soft: #161d33;
  --card: #171f36;
  --card-2: #1d2740;
  --text: #e8edf9;
  --muted: #98a3c0;
  --line: #27314d;
  --primary-soft: #1b2a4d;
  --success-soft: #14301f;
  --warn-soft: #35270f;
  --danger-soft: #3a1a1c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .45);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  overscroll-behavior-y: none;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 15px; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: .2px; }
code { background: var(--bg-soft); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

/* ------------------------------------------------------------- 启动页 */
.boot { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 14px;
  align-items: center; justify-content: center; background: var(--bg); z-index: 100;
  padding: 24px; overflow-y: auto; }
.boot-logo { font-size: 46px; animation: pop .8s ease infinite alternate; }
.boot-text { color: var(--muted); }
.boot-hint { color: var(--muted); font-size: 12.5px; max-width: 420px; text-align: center; }
.boot code { background: var(--bg-soft); padding: 1px 5px; border-radius: 5px; font-size: 12.5px; }
@media (prefers-reduced-motion: reduce) { .boot-logo { animation: none; } }
@keyframes pop { from { transform: scale(.9); } to { transform: scale(1.06); } }

/* ------------------------------------------------------------- 布局 */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar {
  width: 236px; flex: 0 0 236px; background: var(--card); border-right: 1px solid var(--line);
  padding: 18px 12px calc(18px + var(--safe-b)); display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: grid; place-items: center; color: #fff; font-size: 20px; flex: 0 0 auto; }
.brand-title { font-size: 16px; font-weight: 700; }
.brand-sub { font-size: 11.5px; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text); cursor: pointer; border: 0; background: transparent; text-align: left; width: 100%;
  font-size: 14.5px; transition: background .15s;
}
.nav-item:hover { background: var(--bg-soft); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
[data-theme="dark"] .nav-item.active { color: #9ec1ff; }
.nav-item .ico { width: 20px; text-align: center; font-size: 16px; }
.nav-item .nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px;
  min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; }
.sidebar-foot { margin-top: auto; padding: 10px; font-size: 12px; color: var(--muted); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--radius-sm);
  background: var(--card-2); cursor: pointer; border: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.avatar.admin { background: linear-gradient(135deg, #f59e0b, #d97706); }
.avatar.inspector { background: linear-gradient(135deg, #10b981, #047857); }

.main { flex: 1; min-width: 0; padding: 22px 26px 40px; max-width: 1180px; }
.topbar { display: none; }

/* 移动端顶栏 & 底部导航 */
@media (max-width: 899px) {
  .sidebar { display: none; }
  .main { padding: calc(var(--top-h) + var(--safe-t) + 12px) 12px calc(var(--nav-h) + var(--safe-b) + 18px); max-width: none; }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: fixed; top: 0; left: 0; right: 0; z-index: 40;
    height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) 14px 0;
    background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .tb-title { font-weight: 650; font-size: 16px; }
  .topbar .tb-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
  .bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: flex;
    background: color-mix(in srgb, var(--card) 95%, transparent); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
  }
  .bottomnav button {
    flex: 1; border: 0; background: transparent; padding: 8px 2px 7px; display: flex; flex-direction: column;
    align-items: center; gap: 2px; color: var(--muted); font-size: 10.5px; cursor: pointer;
  }
  .bottomnav button .ico { font-size: 19px; line-height: 1; }
  .bottomnav button.active { color: var(--primary); font-weight: 600; }
  .bottomnav .nav-badge { position: absolute; transform: translate(14px, -6px); background: var(--danger);
    color: #fff; font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px; display: grid;
    place-items: center; padding: 0 4px; }
  .bottomnav button { position: relative; }
}
@media (min-width: 900px) { .bottomnav { display: none; } }

/* ------------------------------------------------------------- 通用块 */
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h2 { font-size: 21px; }
.page-head .sub { color: var(--muted); font-size: 13px; }
.page-head .spacer { margin-left: auto; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.card.tight { padding: 12px; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 650; margin-bottom: 12px; font-size: 15.5px; }
.card-title .spacer { margin-left: auto; }
.grid { display: grid; gap: 12px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 899px) {
  .grid.c3, .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c2 { grid-template-columns: 1fr; }
}
@media (max-width: 420px) { .grid.c3, .grid.c4 { grid-template-columns: 1fr 1fr; } }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { margin-left: auto; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.mb0 { margin-bottom: 0; }
.hide { display: none !important; }

/* ------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 15px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--card); cursor: pointer; font-weight: 550; transition: .15s; white-space: nowrap;
}
.btn:hover { background: var(--bg-soft); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { filter: brightness(.94); }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.xs { padding: 3px 8px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn.lg { padding: 13px 20px; font-size: 16px; border-radius: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------- 表单 */
.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 550; }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--card); outline: none; transition: .15s; -webkit-appearance: none; appearance: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.textarea { min-height: 76px; resize: vertical; }
.select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.inline-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .inline-2 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------- 标签 */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--bg-soft); color: var(--muted); white-space: nowrap;
}
.badge.inspector { background: var(--success-soft); color: #0f7a3d; }
[data-theme="dark"] .badge.inspector { color: #62d999; }
.badge.admin { background: var(--warn-soft); color: #b45309; }
.badge.primary { background: var(--primary-soft); color: var(--primary-dark); }
[data-theme="dark"] .badge.primary { color: #9ec1ff; }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.success { background: var(--success-soft); color: #0f7a3d; }
[data-theme="dark"] .badge.success { color: #62d999; }
.badge.lg { font-size: 13px; padding: 3px 11px; }

/* 名字下方「监察」标识（需求：监察员登录后名字下方显示监察二字） */
.name-block { display: inline-flex; flex-direction: column; line-height: 1.25; }
.name-block .nm { font-weight: 650; }
.name-block .under { font-size: 11.5px; color: #0f7a3d; font-weight: 700; letter-spacing: 2px; }
[data-theme="dark"] .name-block .under { color: #62d999; }

/* ------------------------------------------------------------- 列表 */
.list { display: flex; flex-direction: column; gap: 9px; }
.item {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--card-2); cursor: pointer; transition: .15s;
}
.item:hover { border-color: var(--primary); background: var(--card); }
.item.static { cursor: default; }
.item.static:hover { border-color: var(--line); background: var(--card-2); }
.item .grow { flex: 1; min-width: 0; }
.item .t { font-weight: 600; }
.item .s { font-size: 12.5px; color: var(--muted); }
.item .chev { color: var(--muted); font-size: 18px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; font-size: 13.5px; }
.empty .big { font-size: 30px; display: block; margin-bottom: 6px; opacity: .7; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }

/* ------------------------------------------------------------- 统计卡 */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px; box-shadow: var(--shadow); }
.stat .k { font-size: 12.5px; color: var(--muted); }
.stat .v { font-size: 23px; font-weight: 700; letter-spacing: .4px; }
.stat .v small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.stat.primary .v { color: var(--primary); }
.stat.danger .v { color: var(--danger); }
.stat.success .v { color: var(--success); }
.stat.warn .v { color: var(--warn); }

/* ------------------------------------------------------------- Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: transparent; padding: 10px 13px; cursor: pointer; color: var(--muted);
  font-weight: 550; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ------------------------------------------------------------- 任务/签到 */
.task-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card-2); padding: 13px; }
.task-card.open { border-color: var(--success); background: color-mix(in srgb, var(--success-soft) 55%, var(--card)); }
.task-card.closed { opacity: .82; }
.task-head { display: flex; align-items: flex-start; gap: 10px; }
.task-head .t { font-weight: 650; font-size: 15.5px; }
.countdown { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px; }
.countdown.big { font-size: 34px; letter-spacing: 1px; text-align: center; }
.countdown.danger { color: var(--danger); }
.countdown.success { color: var(--success); }
.progress { height: 7px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; margin-top: 9px; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .4s linear; }
.progress > i.success { background: var(--success); }
.progress > i.danger { background: var(--danger); }

.geo-box { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 12px; background: var(--card-2); }
.geo-ring { display: flex; align-items: center; gap: 12px; }
.geo-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 5px color-mix(in srgb, var(--muted) 18%, transparent); }
.geo-dot.ok { background: var(--success); box-shadow: 0 0 0 5px var(--success-soft); }
.geo-dot.bad { background: var(--danger); box-shadow: 0 0 0 5px var(--danger-soft); }
.geo-dot.wait { background: var(--warn); box-shadow: 0 0 0 5px var(--warn-soft); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.records { display: flex; flex-direction: column; gap: 7px; }
.record { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: var(--radius-sm);
  background: var(--card-2); border: 1px solid var(--line); }
.record.absent { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: var(--danger-soft); }
.record.present { border-color: color-mix(in srgb, var(--success) 30%, var(--line)); }
.record.late, .record.leave { border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.record .nm { font-weight: 600; }
.record .acts { margin-left: auto; display: flex; gap: 5px; flex-wrap: wrap; }

/* ------------------------------------------------------------- 点名 */
.roll-panel { text-align: center; padding: 8px 0 4px; }
.roll-stage {
  min-height: 138px; display: grid; place-items: center; border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 80%, var(--card)), var(--card-2));
  border: 1px solid var(--line); padding: 16px; margin: 10px 0;
}
.roll-name { font-size: 34px; font-weight: 800; letter-spacing: 3px; animation: pop .3s ease; }
.roll-name.small { font-size: 23px; letter-spacing: 1px; }
.roll-sub { color: var(--muted); margin-top: 6px; }
.roll-spin { font-size: 30px; font-weight: 800; letter-spacing: 2px; color: var(--primary); }
@media (max-width: 480px) { .roll-name { font-size: 27px; } }
.call-item { border-left: 3px solid var(--primary); padding: 8px 12px; background: var(--card-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 8px; }

/* ------------------------------------------------------------- 通知 */
.notif { display: flex; gap: 11px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--card-2); cursor: pointer; }
.notif.unread { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 35%, var(--line)); }
.notif .ico { font-size: 19px; }
.notif .t { font-weight: 600; }
.notif .b { font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.notif .tm { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.notif.danger { border-left: 3px solid var(--danger); }
.notif.warn { border-left: 3px solid var(--warn); }
.notif.success { border-left: 3px solid var(--success); }

/* ------------------------------------------------------------- 表格 */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 520px; }
table.tbl th, table.tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.tbl th { color: var(--muted); font-weight: 600; font-size: 12.5px; background: var(--card-2); }
table.tbl tr:hover td { background: var(--card-2); }
.bar { height: 6px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; min-width: 52px; }
.bar > i { display: block; height: 100%; background: var(--success); }
.bar.mid > i { background: var(--warn); }
.bar.low > i { background: var(--danger); }

/* ------------------------------------------------------------- 弹层 */
.modal-mask { position: fixed; inset: 0; background: rgba(15, 20, 36, .48); z-index: 90; display: flex;
  align-items: center; justify-content: center; padding: 16px; animation: fade .16s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lg); width: 100%; max-width: 480px;
  max-height: 88vh; display: flex; flex-direction: column; animation: rise .2s ease; }
@keyframes rise { from { transform: translateY(14px) scale(.98); opacity: .6; } }
.modal-head { padding: 15px 17px; border-bottom: 1px solid var(--line); font-weight: 650; display: flex; align-items: center; }
.modal-body { padding: 16px 17px; overflow-y: auto; }
.modal-foot { padding: 13px 17px; border-top: 1px solid var(--line); display: flex; gap: 9px; justify-content: flex-end; }
@media (max-width: 520px) {
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 18px 18px 0 0; max-height: 92vh; padding-bottom: var(--safe-b); }
}
.toasts { position: fixed; z-index: 120; top: calc(12px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; width: min(94vw, 420px); pointer-events: none; }
.toast { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--primary);
  border-radius: 12px; padding: 11px 14px; box-shadow: var(--shadow-lg); animation: rise .18s ease; font-size: 14px; }
.toast.success { border-left-color: var(--success); }
.toast.warn { border-left-color: var(--warn); }
.toast.danger { border-left-color: var(--danger); }
.toast .tt { font-weight: 650; }
.toast .tb { font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------- 登录页 */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 22px 16px calc(22px + var(--safe-b)); }
.auth-card { width: 100%; max-width: 430px; background: var(--card); border-radius: 20px; border: 1px solid var(--line);
  box-shadow: var(--shadow-lg); padding: 26px 24px; }
.auth-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-logo .brand-logo { width: 46px; height: 46px; font-size: 24px; border-radius: 14px; }
.auth-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; background: var(--bg-soft);
  padding: 5px; border-radius: 12px; margin-bottom: 18px; }
.auth-tabs button { border: 0; background: transparent; padding: 9px 4px; border-radius: 9px; cursor: pointer;
  color: var(--muted); font-weight: 600; font-size: 14px; }
.auth-tabs button.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.auth-switch { text-align: center; margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.auth-note { background: var(--card-2); border: 1px dashed var(--line); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }

/* ------------------------------------------------------------- 点名弹窗动画 */
.called-flash { text-align: center; }
.called-flash .big { font-size: 30px; font-weight: 800; letter-spacing: 3px; margin: 12px 0 4px; color: var(--primary); }
.called-flash .ico { font-size: 52px; animation: pop .5s ease infinite alternate; }
