:root {
  --primary: #0b3a6f;
  --primary-light: #1c5ea8;
  --accent: #e8a13a;
  --bg: #f2f5f9;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #6b7683;
  --line: #e2e8f0;
  --ok: #1c8a5a;
  --warn: #c05621;
  --danger: #c0392b;
  --radius: 12px;
  --shadow: 0 1px 4px rgba(11, 58, 111, .08);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; }
a { color: var(--primary-light); }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, #0b3a6f 0%, #123f7a 45%, #1c5ea8 100%); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 16px; padding: 32px 26px; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.login-logo { text-align: center; margin-bottom: 18px; }
.login-logo .plane { font-size: 44px; }
.login-logo h1 { font-size: 20px; color: var(--primary); margin-top: 6px; }
.login-logo p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary-light); border-color: transparent; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border: none; border-radius: 10px; font-size: 15px; font-weight: 600;
  background: var(--primary); color: #fff; transition: opacity .15s;
}
.btn:hover { opacity: .9; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: #eef2f7; color: var(--primary); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.warn { background: var(--warn); color: #fff; }
.msg { padding: 10px 12px; border-radius: 9px; margin-bottom: 12px; font-size: 14px; display: none; }
.msg.show { display: block; }
.msg.err { background: #fdecea; color: var(--danger); }
.msg.ok { background: #e6f6ee; color: var(--ok); }

/* ---------- 应用布局 ---------- */
.app { max-width: 960px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--primary); color: #fff;
  padding: 10px 14px; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.topbar .t-title { font-size: 16px; font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .t-back { font-size: 20px; padding: 2px 8px; background: none; border: none; color: #fff; }
.topbar .t-user { font-size: 12px; opacity: .85; white-space: nowrap; }
.topbar .t-logout { background: rgba(255,255,255,.15); border: none; color: #fff; border-radius: 8px; padding: 5px 10px; font-size: 12px; }
.content { flex: 1; padding: 14px; padding-bottom: 84px; }
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav .nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px; font-size: 11px; color: var(--muted); background: none; border: none;
}
.bottomnav .nav-item .ic { font-size: 20px; line-height: 1; }
.bottomnav .nav-item.active { color: var(--primary); font-weight: 700; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h3 { font-size: 15px; color: var(--primary); margin-bottom: 10px; }
.card .hint { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; background: #eef2f7; color: var(--primary); }
.tag.ok { background: #e6f6ee; color: var(--ok); }
.tag.warn { background: #fdf1e3; color: var(--warn); }
.tag.danger { background: #fdecea; color: var(--danger); }
.tag.accent { background: #fdf3e0; color: #96640a; }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 12px; background: #f8fafc; position: sticky; top: 0; }
.tbl tr:last-child td { border-bottom: none; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- 排班矩阵 ---------- */
.slot-block { margin-bottom: 12px; }
.slot-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--primary); color: #fff; border-radius: 9px 9px 0 0; font-size: 14px; font-weight: 600; }
.slot-head .period { font-size: 11px; padding: 2px 8px; border-radius: 12px; background: rgba(255,255,255,.2); }
.matrix { display: grid; grid-template-columns: repeat(7, minmax(88px, 1fr)); gap: 6px; padding: 10px; background: #f8fafc; border: 1px solid var(--line); border-top: none; border-radius: 0 0 9px 9px; overflow-x: auto; }
.m-cell { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; min-height: 58px; font-size: 12px; position: relative; }
.m-cell .name { font-weight: 700; color: var(--primary); }
.m-cell .code { color: var(--muted); font-size: 11px; }
.m-cell .pno { display: inline-block; margin-top: 3px; font-size: 11px; background: #eef4fb; color: #123f7a; padding: 1px 6px; border-radius: 6px; }
.m-cell .sup { font-size: 10px; color: var(--ok); margin-top: 3px; }
.m-cell.empty { background: #f2f4f7; }
.m-cell.off { background: #fdf3e0; }
.m-head { font-size: 11px; color: var(--muted); text-align: center; font-weight: 600; }
.m-grid { display: grid; grid-template-columns: repeat(7, minmax(88px, 1fr)); gap: 6px; padding: 0 10px 8px; background: #f8fafc; border: 1px solid var(--line); border-top: none; }
.m-grid .m-head { padding: 4px 0; }

/* ---------- 表单/选择 ---------- */
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg .seg-btn { padding: 7px 14px; border: 1px solid var(--line); border-radius: 20px; background: #fff; font-size: 13px; color: var(--muted); }
.seg .seg-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 20px; background: #fff; font-size: 13px; }
.chip input { accent-color: var(--primary); }
.chip.off { opacity: .55; text-decoration: line-through; }
.num-input { width: 76px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; }
.time-input { width: 110px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; }

/* ---------- 我的排班 ---------- */
.my-group { margin-bottom: 14px; }
.my-group h4 { font-size: 14px; color: var(--primary); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; text-align: center; }
.stat .v { font-size: 24px; font-weight: 800; color: var(--primary); }
.stat .k { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- 其他 ---------- */
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.muted { color: var(--muted); font-size: 13px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.loading { text-align: center; color: var(--muted); padding: 30px; }
dialog { border: none; border-radius: 14px; padding: 0; max-width: 92vw; box-shadow: 0 12px 40px rgba(0,0,0,.25); }
.dialog-body { padding: 20px; }
.dialog-body h3 { color: var(--primary); margin-bottom: 12px; font-size: 16px; }
.dialog-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }
.list-item .li-main { flex: 1; }
.list-item .li-title { font-weight: 600; }
.list-item .li-sub { font-size: 12px; color: var(--muted); }
.badge { display: inline-block; min-width: 22px; text-align: center; padding: 1px 6px; border-radius: 12px; background: var(--primary); color: #fff; font-size: 12px; }
.toast { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 99; background: #1c2733; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: fadein .2s; }
.toast.err { background: var(--danger); }
@keyframes fadein { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
