/* ================= 管理后台 ================= */
body.ad {
  background:
    radial-gradient(1000px 300px at 20% -160px, #dff3e7 0%, rgba(223,243,231,0) 70%),
    #f3faf5;
  padding-bottom: 40px;
}

/* ── 登录 ── */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(900px 460px at 50% -10%, #2f7d55 0%, #1b5c3d 55%, #12452d 100%);
}
.login-card {
  width: 100%; max-width: 356px;
  background: #fff; border-radius: 22px;
  padding: 30px 26px 22px;
  box-shadow: 0 30px 70px -28px rgba(4, 9, 24, .8);
  text-align: center;
  animation: pop .3s cubic-bezier(.2,.9,.3,1.05) both;
}
.login-logo {
  width: 52px; height: 52px; margin: 0 auto 14px;
  border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(150deg, #1f7a4d, #2f9e6a 55%, #57bd8b);
  color: #fff; font-size: 23px; font-weight: 700;
  box-shadow: 0 10px 24px -10px rgba(31, 58, 184, .8);
}
.login-card h1 { font-size: 19px; font-weight: 650; letter-spacing: .5px; }
.login-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.login-card .field { text-align: left; }
.login-err {
  font-size: 12.5px; color: var(--danger); margin-top: 10px;
  background: var(--danger-soft); padding: 8px 10px; border-radius: 9px;
}
.login-back {
  display: inline-block; margin-top: 16px; font-size: 12px; color: #8fa89a;
}

/* ── 顶栏 ── */
.ad-top {
  display: flex;
  align-items: center;
  gap: 11px;
  background: linear-gradient(135deg, #14523a 0%, #1b6244 55%, #237a52 100%);
  color: #fff;
  padding: calc(13px + env(safe-area-inset-top, 0px)) 18px 13px;
}
.ad-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.ad-logo {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.2);
  font-weight: 700; font-size: 15px;
}
.ad-brand h1 { font-size: 15.5px; font-weight: 600; letter-spacing: .4px; }
.ad-brand p { font-size: 11.5px; color: rgba(255,255,255,.55); margin-top: 1px; }
.ad-top-right {
  margin-left: auto; display: flex; align-items: center; gap: 10px;
}
.ad-clock {
  font-size: 14px; font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,.72); letter-spacing: .5px;
}
.ad-icon-btn {
  width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.1); color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.14);
  transition: background .18s;
}
.ad-icon-btn:active { background: rgba(255,255,255,.2); }

/* ── 标签 ── */
.ad-tabs {
  position: sticky; top: 0; z-index: 20;
  display: flex; gap: 4px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 6px 12px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.ad-tabs::-webkit-scrollbar { display: none; }
.ad-tab {
  flex: 0 0 auto;
  font-size: 13.5px; color: var(--ink-2);
  padding: 8px 14px; border-radius: 9px;
  font-weight: 500; white-space: nowrap;
  transition: background .16s, color .16s;
}
.ad-tab.is-on { background: var(--brand); color: #fff; font-weight: 600; box-shadow: 0 4px 12px -5px rgba(47,158,106,.7); }
.ad-tab:active { background: var(--brand-soft); }

.ad-main { max-width: 1180px; margin: 0 auto; padding: 16px 14px 0; }
.panel { display: none; animation: rise .28s ease both; }
.panel.is-on { display: block; }

/* ── 日期条 ── */
.date-bar {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 14px; border: 1px solid rgba(228,232,242,.9);
  box-shadow: var(--shadow);
  padding: 10px 12px; margin-bottom: 13px;
}
.nav-btn {
  width: 34px; height: 34px; border-radius: 10px;
  background: #f0f9f4; color: var(--ink-2);
  font-size: 19px; line-height: 1; display: grid; place-items: center;
  flex: 0 0 34px;
}
.nav-btn:active { background: var(--brand-soft); color: var(--brand); }
.date-mid { flex: 1; text-align: center; }
.date-big { font-size: 15.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.date-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.today-btn {
  font-size: 12px; padding: 7px 12px; border-radius: 9px;
  background: var(--brand-soft); color: var(--brand); font-weight: 600;
}
.today-btn:active { background: #dbefe3; }

/* ── KPI ── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi {
  background: #fff; border-radius: 13px; padding: 12px 13px;
  border: 1px solid rgba(228,232,242,.9);
  box-shadow: 0 1px 2px rgba(23,53,42,.03);
  position: relative; overflow: hidden;
}
.kpi-label { font-size: 11.5px; color: var(--muted); }
.kpi-val {
  display: block; font-size: 25px; font-weight: 650; margin-top: 2px;
  font-variant-numeric: tabular-nums; letter-spacing: -.5px; line-height: 1.15;
}
.kpi.warn .kpi-val { color: var(--danger); }
.kpi.ok .kpi-val { color: var(--ok); }

/* ── 班次总览 ── */
.ov-group {
  background: #fff; border-radius: 15px;
  border: 1px solid rgba(228,232,242,.9);
  box-shadow: var(--shadow);
  margin-bottom: 13px; overflow: hidden;
}
.ov-head {
  display: flex; align-items: center; gap: 9px;
  padding: 13px 15px 11px;
  border-bottom: 1px solid var(--line-2);
}
.ov-head h3 { font-size: 14.5px; font-weight: 650; }
.ov-head .ov-rule {
  margin-left: auto; font-size: 11px; color: var(--muted);
  background: #f0f9f4; padding: 3px 9px; border-radius: 999px;
}
.ov-body { padding: 0 15px; }
.shift-row {
  display: flex; gap: 13px; padding: 12px 0;
  border-bottom: 1px dashed var(--line-2);
  align-items: flex-start;
}
.shift-row:last-child { border-bottom: none; }
.shift-time { flex: 0 0 96px; }
.shift-time b {
  display: block; font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.shift-time i {
  display: block; font-style: normal; font-size: 10.5px;
  color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums;
}
.shift-time .st {
  display: inline-block; margin-top: 4px; font-size: 10px;
  padding: 1px 7px; border-radius: 999px; background: #eef8f2; color: var(--muted);
}
.shift-time .st.open { background: var(--ok-soft); color: #16774e; }
.shift-time .st.upcoming { background: var(--brand-soft); color: var(--brand); }

.shift-people { flex: 1; display: flex; flex-wrap: wrap; gap: 7px; min-width: 0; }
.person {
  display: flex; align-items: center; gap: 7px;
  background: #f6fcf8; border: 1px solid #e3f2e9;
  border-radius: 11px; padding: 4px 10px 4px 4px;
  max-width: 100%;
  transition: background .16s;
}
.person:active { background: #eaf7ef; }
.person img, .person .ph {
  width: 26px; height: 26px; border-radius: 8px; object-fit: cover;
  background: #e2f2e9; flex: 0 0 26px;
  display: grid; place-items: center;
  font-size: 11px; color: #7b9a8a; font-weight: 600;
}
.person b { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.person span {
  font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.person.late { background: #fef7f7; border-color: #f7dede; }
.person.late span { color: var(--danger); }
.person.voided { opacity: .5; text-decoration: line-through; }

.empty-slot {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: #b23b3b;
  background: #fdf1f1; border: 1px dashed #f2cccc;
  border-radius: 10px; padding: 6px 11px;
}
.empty-slot.calm { color: var(--muted); background: #f7fcf9; border-color: #e2f2e9; }
.need-more {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--warn);
  background: var(--warn-soft); border-radius: 9px; padding: 5px 9px;
}

/* ── 明细 ── */
.filters {
  display: flex; flex-wrap: wrap; gap: 9px; align-items: center;
  background: #fff; border-radius: 14px; padding: 11px 13px;
  border: 1px solid rgba(228,232,242,.9);
  box-shadow: var(--shadow); margin-bottom: 12px;
}
.f-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.f-group label { font-size: 12px; color: var(--muted); }
.f-dash { color: #c3d6cb; font-size: 12px; }
.filters input, .filters select {
  height: 34px; border: 1px solid var(--line); border-radius: 9px;
  padding: 0 10px; font-size: 12.5px; background: #fbfefc; color: var(--ink);
  outline: none; font-family: inherit;
}
.filters input:focus, .filters select:focus { border-color: var(--brand); background: #fff; }
.filters input[type="search"] { width: 128px; }
.f-actions { display: flex; gap: 7px; margin-left: auto; }
.btn-sm {
  height: 34px; padding: 0 14px; border-radius: 9px;
  background: var(--brand); color: #fff; font-size: 12.5px; font-weight: 600;
  box-shadow: 0 4px 10px -5px rgba(47,158,106,.6);
  white-space: nowrap;
}
.btn-sm:active { transform: scale(.98); }
.btn-sm.ghost { background: #eef8f2; color: var(--ink-2); box-shadow: none; }
.btn-sm.ghost:active { background: #e6f4ec; }
.btn-sm.danger { color: var(--danger); }
.btn-sm[disabled] { opacity: .5; pointer-events: none; }

.rec-summary { font-size: 12px; color: var(--muted); padding: 0 3px 9px; }
.rec-list { display: flex; flex-direction: column; gap: 8px; }
.rec-day {
  font-size: 12px; font-weight: 650; color: var(--ink-2);
  padding: 10px 2px 2px; display: flex; align-items: baseline; gap: 8px;
}
.rec-day small { font-weight: 400; color: var(--muted); font-size: 11px; }
.rec {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  gap: 11px; align-items: center;
  background: #fff; border-radius: 12px; padding: 9px 12px;
  border: 1px solid rgba(228,232,242,.9);
  transition: border-color .16s, box-shadow .16s;
}
.rec:hover { border-color: #d5ecdd; box-shadow: 0 6px 18px -12px rgba(23,53,42,.3); }
.rec.is-voided { opacity: .55; }
.rec-thumb {
  width: 42px; height: 42px; border-radius: 10px; object-fit: cover;
  background: #eef8f2; cursor: zoom-in; display: block;
}
.rec-thumb.empty {
  display: grid; place-items: center; color: #a8c0b4; font-size: 10px;
  cursor: default; border: 1px dashed #d9ecdf;
}
.rec-main { min-width: 0; }
.rec-name { display: flex; align-items: center; gap: 6px; }
.rec-name b { font-size: 13.5px; font-weight: 650; }
.rec-meta {
  font-size: 11.5px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rec-time { text-align: right; font-variant-numeric: tabular-nums; }
.rec-time b { font-size: 13px; font-weight: 600; display: block; }
.rec-time small { font-size: 10.5px; color: var(--muted); }
.rec-actions { display: flex; gap: 5px; justify-content: flex-end; }
.icon-btn {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: #f0f9f4; color: var(--ink-2);
}
.icon-btn:active { background: #e2f2e9; }
.icon-btn.danger { color: var(--danger); background: var(--danger-soft); }
.rec-more { text-align: center; padding: 14px 0 4px; }

.pill {
  font-size: 10.5px; padding: 1.5px 7px; border-radius: 999px;
  font-weight: 600; white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: #16774e; }
.pill.late { background: var(--danger-soft); color: var(--danger); }
.pill.early { background: var(--brand-soft); color: var(--brand); }
.pill.admin { background: #f2f0ff; color: #6b46c1; }
.pill.void { background: #edf2ef; color: #7b9a8a; }

/* ── 统计 ── */
.stats-wrap { display: flex; flex-direction: column; gap: 13px; }
.stat-card {
  background: #fff; border-radius: 15px; padding: 15px;
  border: 1px solid rgba(228,232,242,.9); box-shadow: var(--shadow);
}
.stat-card h3 { font-size: 14px; font-weight: 650; margin-bottom: 11px; }
.bar-row { display: flex; align-items: center; gap: 9px; margin-bottom: 7px; font-size: 12px; }
.bar-row .bar-name { flex: 0 0 66px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 9px; background: #f0f9f4; border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #3cb377, #2f9e6a); }
.bar-val { flex: 0 0 34px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }

.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px;
  padding: 8px 8px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: #fafdfb;
}
.data-table td { padding: 9px 8px; border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums; }
.data-table tr:last-child td { border-bottom: none; }
.data-table .num { text-align: right; }
.data-table .name-cell { font-weight: 600; color: var(--ink); }
.table-scroll { overflow-x: auto; margin: 0 -4px; }

/* ── 设置 ── */
.set-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 13px;
}
.set-card h3 { font-size: 14px; font-weight: 650; margin-bottom: 6px; }
.set-desc { font-size: 12px; color: var(--muted); line-height: 1.6; margin-bottom: 11px; }
.set-desc code { background: #eef8f2; padding: 1px 5px; border-radius: 5px; font-size: 11px; }
.lan-list { display: flex; flex-direction: column; gap: 7px; }
.lan-item {
  display: flex; align-items: center; gap: 8px;
  background: #f6fcf8; border: 1px solid #e6f3ec; border-radius: 10px;
  padding: 8px 10px; font-size: 12.5px;
}
.lan-item code { font-family: ui-monospace, Menlo, monospace; flex: 1; color: var(--brand); word-break: break-all; }
.lan-item small { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.qr-box { margin-top: 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.qr-holder {
  width: 158px; height: 158px; padding: 8px; background: #fff;
  border: 1px solid var(--line); border-radius: 13px;
  display: grid; place-items: center;
}
.qr-holder svg { width: 100%; height: 100%; display: block; }
.qr-cap { font-size: 11px; color: var(--muted); text-align: center; margin-top: 7px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack input {
  height: 38px; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 12px; font-size: 13.5px; background: #fbfefc; outline: none; font-family: inherit;
}
.stack input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(47,158,106,.08); }
.set-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px dashed var(--line-2); font-size: 12.5px;
}
.set-row span { color: var(--muted); }
.set-row:last-of-type { border-bottom: none; }
.set-btns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mini-table th, .mini-table td { padding: 6px 6px; text-align: left; border-bottom: 1px solid var(--line-2); }
.mini-table th { color: var(--muted); font-weight: 600; font-size: 11px; }
.mini-table tr:last-child td { border-bottom: none; }

/* ── 弹层 ── */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px; }
.modal-bg { position: absolute; inset: 0; background: rgba(8, 13, 28, .6); backdrop-filter: blur(5px); animation: fade .18s both; }
.modal-box {
  position: relative; width: 100%; max-width: 420px;
  background: #fff; border-radius: 18px; padding: 18px;
  box-shadow: 0 30px 70px -24px rgba(4,9,24,.7);
  animation: pop .26s cubic-bezier(.2,.9,.3,1.05) both;
  max-height: 88vh; overflow: auto;
}
.modal-box.wide { max-width: 620px; }
.modal-box h3 { font-size: 15.5px; font-weight: 650; margin-bottom: 3px; }
.modal-sub { font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.modal-close {
  position: absolute; top: 12px; right: 12px;
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: #eef8f2; color: var(--ink-2); font-size: 16px; line-height: 1;
}
.m-field { margin-bottom: 10px; }
.m-field label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.m-field input, .m-field select, .m-field textarea {
  width: 100%; height: 38px; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 11px; font-size: 13.5px; background: #fbfefc; outline: none;
  font-family: inherit; color: var(--ink);
}
.m-field textarea { height: 58px; padding: 8px 11px; resize: vertical; }
.m-field input:focus, .m-field select:focus, .m-field textarea:focus { border-color: var(--brand); background: #fff; }
.m-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.m-actions { display: flex; gap: 9px; margin-top: 14px; }
.m-actions .btn-primary { flex: 1; height: 42px; font-size: 14px; }
.m-actions .btn-sm { height: 42px; }
.photo-view { width: 100%; border-radius: 12px; background: #0d1a14; display: block; }
.photo-meta { font-size: 12px; color: var(--ink-2); margin-top: 10px; line-height: 1.8; }
.photo-meta b { color: var(--ink); }
.empty-tip { font-size: 12.5px; color: var(--muted); text-align: center; padding: 34px 0; }

@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }

@media (max-width: 760px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .ad-main { padding: 12px 10px 0; }
  .rec { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .rec-thumb { width: 38px; height: 38px; }
  .rec-time { grid-column: 2; text-align: left; margin-top: -2px; }
  .rec-time b { display: inline; font-size: 11.5px; color: var(--muted); font-weight: 500; }
  .rec-time small { display: none; }
  .rec-actions { grid-column: 3; grid-row: 1 / span 2; }
  .f-actions { margin-left: 0; width: 100%; }
  .f-actions .btn-sm { flex: 1; }
  .ad-clock { display: none; }
  .shift-time { flex: 0 0 82px; }
  .shift-row { gap: 9px; }
}


/* ── 校徽 ── */
.login-logo-corner {
  position: absolute; top: 14px; right: 14px;
  width: 38px; height: 38px; border-radius: 50%;
  object-fit: cover; background: #fff;
  border: 1px solid #e6f3ec;
}
.login-card { position: relative; }
.ad-top .school-logo { box-shadow: 0 2px 10px rgba(0,0,0,.25); border-color: rgba(255,255,255,.7); }
