/* ===== Site Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center;
  height: 56px; padding: 0 20px; gap: 0;
  background: #0c1a3a;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 16px rgba(0,0,0,0.28);
}

/* Brand */
.hd-brand {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0; margin-right: 24px;
  text-decoration: none;
}
.hd-logo { height: 30px; border-radius: 6px; object-fit: contain; }
.hd-logo-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.hd-brand-text { display: flex; flex-direction: column; gap: 1px; }
.hd-title {
  font-size: 15px; font-weight: 800; color: #fff;
  letter-spacing: -0.3px; line-height: 1; white-space: nowrap;
}
.hd-sub { font-size: 10px; color: rgba(255,255,255,0.38); line-height: 1; white-space: nowrap; padding-top: 8px; }

/* Nav */
.hd-nav { display: flex; align-items: center; gap: 1px; flex: 1; }
.hd-link {
  color: rgba(255,255,255,0.58);
  text-decoration: none; font-size: 13px; font-weight: 500;
  padding: 6px 11px; border-radius: 8px; white-space: nowrap;
  transition: color .15s, background .15s;
}
.hd-link:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* Admin Dropdown */
.hd-dropdown { position: relative; }
.hd-dropdown-btn {
  display: inline-flex; align-items: center; gap: 5px;
  color: rgba(255,255,255,0.58); background: none; border: none;
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 6px 11px; border-radius: 8px; cursor: pointer;
  transition: color .15s, background .15s;
}
.hd-dropdown-btn:hover { color: #fff; background: rgba(255,255,255,0.08); opacity: 1; }
.hd-dropdown-menu {
  display: none; flex-direction: column;
  position: absolute; top: 100%; left: 0;
  padding-top: 8px;
  background: transparent;
  min-width: 156px;
  z-index: 200;
}
.hd-dropdown-menu-inner {
  background: #fff; border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.06);
  padding: 6px; display: flex; flex-direction: column;
}
.hd-dropdown:hover .hd-dropdown-menu { display: flex; }
.hd-menu-item {
  color: #1e293b; font-size: 13px; font-weight: 500;
  padding: 8px 12px; border-radius: 8px;
  text-decoration: none; display: block;
  transition: background .12s;
}
.hd-menu-item:hover { background: #f1f5f9; color: #0f172a; }
.hd-menu-divider { height: 1px; background: #f1f5f9; margin: 4px 6px; }

/* Right */
.hd-right { display: flex; align-items: center; gap: 12px; margin-left: auto; flex-shrink: 0; }
.hd-phone { font-size: 12px; color: rgba(255,255,255,0.38); white-space: nowrap; }
.hd-user { display: flex; align-items: center; gap: 8px; }
.hd-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #3b82f6);
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; text-transform: uppercase;
}
.hd-username { font-size: 13px; color: rgba(255,255,255,0.7); font-weight: 500; }
.hd-logout {
  font-size: 12px; color: rgba(255,255,255,0.4);
  text-decoration: none; padding: 5px 10px; border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.12); font-weight: 500;
  transition: color .15s, border-color .15s, background .15s;
}
.hd-logout:hover { color: #fff; border-color: rgba(255,255,255,0.3); background: rgba(255,255,255,0.07); }

/* Site Footer */
.site-footer {
  text-align: center; padding: 14px; font-size: 12px;
  color: #94a3b8; border-top: 1px solid #e2e8f0;
  background: #f8fafc; margin-top: 8px;
}

/* ===== import tags ===== */
.import-tags { display:flex; flex-wrap:wrap; gap:5px; margin-bottom:12px; }

* { box-sizing: border-box; }
:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --sub: #64748b;
  --primary: #1d4ed8;
  --primary-2: #1e40af;
  --line: #e2e8f0;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at 15% -10%, #e2ecff, var(--bg) 40%);
  color: var(--text);
}

h1 { margin: 0 0 10px; font-size: 20px; font-weight: 700; }
h2 { margin: 0 0 12px; font-size: 21px; }
h3 { margin: 0 0 10px; }

main { padding: 20px; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}
.page-head p { margin: 0; color: var(--sub); font-size: 13px; }

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

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.card {
  background: linear-gradient(155deg, #ffffff, #f8fbff);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0; font-size: 13px; color: var(--sub); font-weight: 600; }
.card p { margin: 10px 0 0; font-size: 28px; font-weight: 700; letter-spacing: 0.2px; }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.kpi {
  background: #f8fbff;
  border: 1px dashed #c8dcff;
  border-radius: 12px;
  padding: 10px;
}
.kpi-label { color: var(--sub); font-size: 12px; }
.kpi-value { margin-top: 6px; font-size: 22px; font-weight: 700; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}
.form-grid.wide { grid-template-columns: repeat(5, minmax(140px, 1fr)); }

input, select {
  font: inherit;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 0 10px;
  height: 38px;
  box-sizing: border-box;
  line-height: 38px;
  vertical-align: middle;
  display: block;
  width: 100%;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

input[type="date"] {
  font-variant-numeric: tabular-nums;
  letter-spacing: .2px;
  line-height: normal;
  padding-left: 10px;
  padding-right: 10px;
}
input[type="date"]::-webkit-datetime-edit {
  padding: 0;
  height: 100%;
  display: flex;
  align-items: center;
}
input[type="date"]::-webkit-datetime-edit-fields-wrapper {
  height: 100%;
  display: inline-flex;
  align-items: center;
}
input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  display: inline-flex;
  align-items: center;
  height: 100%;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: .65;
  cursor: pointer;
}

@supports (-webkit-touch-callout: none) {
  input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    background-clip: padding-box;
    line-height: normal;
  }
  input[type="date"]::-webkit-date-and-time-value {
    margin: 0;
    min-height: 100%;
  }
}

.filter-field input[type="date"],
.drawer-field input[type="date"],
.sas-field input[type="date"] {
  height: 38px;
  line-height: normal;
  padding-top: 0;
  padding-bottom: 0;
}
textarea {
  font: inherit;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 9px 10px;
  height: auto;
  box-sizing: border-box;
  display: block;
  width: 100%;
}
button {
  font: inherit;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 9px 10px;
  box-sizing: border-box;
  line-height: 1.4;
}
input:focus, select:focus {
  outline: none;
  border-color: #7aa2ff;
  box-shadow: 0 0 0 3px rgba(84, 132, 255, 0.16);
}

button {
  cursor: pointer;
  border: none;
  background: linear-gradient(120deg, var(--primary), var(--primary-2));
  color: #fff;
  font-weight: 600;
}
button:hover { opacity: 0.94; }
.btn-light { background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe; }

.filter-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  min-width: 600px;
}
.three-col table { min-width: 0; width: 100%; }
th, td {
  border-bottom: 1px solid #eef2f7;
  padding: 10px;
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
  white-space: nowrap;
}
th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #334155;
  font-weight: 700;
}
tr:hover td { background: #f8fbff; }

a { color: #1d4ed8; font-weight: 600; }

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
}
.tag-ok { background: #dcfce7; color: #166534; }
.tag-warn { background: #ffedd5; color: #9a3412; }
.tag-info { background: #dbeafe; color: #1e40af; }
.tag-danger { background: #fee2e2; color: #991b1b; }

/* Dashboard Cards */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.dash-card {
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow);
  transition: transform 0.15s;
}
.dash-card:hover { transform: translateY(-2px); }
.dash-card-blue   { background: linear-gradient(135deg, #1d4ed8, #3b82f6); color: #fff; }
.dash-card-green  { background: linear-gradient(135deg, #059669, #10b981); color: #fff; }
.dash-card-purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); color: #fff; }
.dash-card-orange { background: linear-gradient(135deg, #d97706, #fbbf24); color: #fff; }
.dash-card-icon { font-size: 32px; opacity: 0.9; flex-shrink: 0; }
.dash-card-label { font-size: 12px; opacity: 0.85; font-weight: 500; }
.dash-card-value { font-size: 30px; font-weight: 800; line-height: 1.2; margin: 2px 0; }
.dash-card-sub { font-size: 11px; opacity: 0.75; }

/* Month bar chart */
.month-list { display: flex; flex-direction: column; gap: 10px; }
.month-row { display: flex; align-items: center; gap: 10px; }
.month-label { font-size: 12px; color: #475569; width: 60px; flex-shrink: 0; }
.month-bar-wrap { flex: 1; background: #f1f5f9; border-radius: 99px; height: 10px; overflow: hidden; }
.month-bar { height: 100%; background: linear-gradient(90deg, #1d4ed8, #60a5fa); border-radius: 99px; min-width: 4px; transition: width 0.4s ease; }
.month-bar.bar-green { background: linear-gradient(90deg, #059669, #34d399); }
.month-bar.bar-orange { background: linear-gradient(90deg, #d97706, #fbbf24); }
.month-bar.bar-red { background: linear-gradient(90deg, #dc2626, #f87171); }
.month-count { font-size: 12px; font-weight: 700; color: #1e40af; width: 40px; text-align: right; flex-shrink: 0; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* Back button */
.btn-back {
  display: inline-flex; align-items: center;
  padding: 7px 14px; border-radius: 10px;
  background: #f1f5f9; color: #334155;
  text-decoration: none; font-size: 13px; font-weight: 600;
  border: 1px solid #e2e8f0;
}
.btn-back:hover { background: #e2e8f0; color: #0f172a; }

/* Small button */
.btn-sm {
  font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 8px;
  background: linear-gradient(120deg, var(--primary), var(--primary-2));
  color: #fff; border: none; cursor: pointer;
}
.btn-sm:hover { opacity: 0.88; }

/* Timeline (new) */
.tl-wrap { display: flex; flex-direction: column; position: relative; padding-left: 24px; }
.tl-item { display: flex; gap: 14px; position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content:''; position:absolute; left:-17px; top:18px; bottom:0; width:2px; background:#e2e8f0; }
.tl-item:last-child::before { display:none; }
.tl-dot { width:12px; height:12px; border-radius:50%; position:absolute; left:-22px; top:4px; border:2px solid #fff; }
.tl-dot-0 { background:#1d4ed8; box-shadow:0 0 0 2px #1d4ed8; }
.tl-dot-1 { background:#059669; box-shadow:0 0 0 2px #059669; }
.tl-dot-2 { background:#d97706; box-shadow:0 0 0 2px #d97706; }
.tl-dot-3 { background:#7c3aed; box-shadow:0 0 0 2px #7c3aed; }
.tl-body { flex:1; }
.tl-label { font-size:14px; font-weight:700; color:#0f172a; display:flex; align-items:center; gap:8px; }
.tl-type { font-size:11px; font-weight:600; padding:2px 8px; border-radius:99px; background:#f1f5f9; color:#64748b; }
.tl-desc { font-size:13px; color:#475569; margin-top:3px; }
.tl-date { font-size:11px; color:#94a3b8; margin-top:4px; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}
.detail-item {
  background: #f8fbff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
}
.detail-item .k { color: var(--sub); font-size: 12px; }
.detail-item .v { margin-top: 4px; font-size: 14px; font-weight: 600; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 10px; margin-bottom: 10px; }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; background: #1d4ed8; margin-top: 5px; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.danger { background: var(--danger) !important; }

/* Panel head */
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel-head h3 { margin: 0; }

/* Page head actions */
.page-head-actions { display: flex; gap: 8px; align-items: center; }

/* Filter dot indicator */
.filter-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #ef4444; vertical-align: middle; margin-left: 4px; }

/* Table link button */
.btn-table-link { font-size: 12px; color: #1d4ed8; font-weight: 600; text-decoration: none; padding: 3px 8px; border-radius: 6px; background: #eff6ff; }
.btn-table-link:hover { background: #dbeafe; }

/* ===== Drawer ===== */
.drawer-mask {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,0.35); z-index: 100;
}
.drawer-mask.open { display: block; }
.drawer {
  position: fixed; top: 0; right: -540px; width: min(480px, 100vw);
  height: 100vh; background: #fff; z-index: 101;
  box-shadow: -8px 0 40px rgba(15,23,42,0.15);
  transition: right 0.28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  border-radius: 20px 0 0 20px;
}
.drawer.open { right: 0; }
.drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 24px 26px 18px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(135deg, #f0fdf4, #fff);
  border-radius: 20px 0 0 0;
  font-size: 18px; font-weight: 800; color: #0f172a;
  flex-shrink: 0;
}
.drawer-close {
  background: #f1f5f9; border: none; width: 32px; height: 32px;
  border-radius: 8px; font-size: 16px; color: #64748b;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; line-height: 1;
}
.drawer-close:hover { background: #e2e8f0; color: #0f172a; }
.drawer-form {
  padding: 22px 26px;
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
}
.drawer-field { display: flex; flex-direction: column; gap: 5px; }
.drawer-field label { font-size: 12px; color: #475569; font-weight: 700; }
.drawer-field input, .drawer-field select { width: 100%; }
.drawer-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 26px; border-top: 1px solid #f1f5f9;
  background: #fafbfc; flex-shrink: 0;
}

/* ===== Modal ===== */
.modal-mask {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,0.4); z-index: 200;
}
.modal-mask.open { display: block; }
.modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(720px, 95vw); max-height: 88vh;
  background: #fff; border-radius: 18px; z-index: 201;
  box-shadow: 0 24px 64px rgba(15,23,42,0.2);
  display: flex; flex-direction: column;
  transition: transform 0.2s ease, opacity 0.2s ease;
  opacity: 0; pointer-events: none;
}
.modal.open { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 22px 16px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(135deg, #f0fdf4, #fff);
  font-size: 17px; font-weight: 800; flex-shrink: 0;
}
.modal-close {
  background: #f1f5f9; border: none; width: 32px; height: 32px;
  border-radius: 8px; font-size: 16px; color: #64748b;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.modal-close:hover { background: #e2e8f0; color: #0f172a; }
.modal-form { display: flex; flex-direction: column; overflow: hidden; }
.modal-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px 16px; padding: 20px 22px; overflow-y: auto;
}
.modal-field { display: flex; flex-direction: column; gap: 5px; }
.modal-field label { font-size: 12px; color: #475569; font-weight: 600; }
.modal-field input, .modal-field select, .modal-field textarea { width: 100%; }
.modal-field textarea { font: inherit; border-radius: 10px; border: 1px solid #cbd5e1; background: #fff; padding: 9px 10px; }
.modal-field textarea:focus { outline: none; border-color: #059669; box-shadow: 0 0 0 3px rgba(5,150,105,0.12); }
.modal-field-full { grid-column: span 3; }
.req { color: #ef4444; margin-left: 2px; }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 22px; border-top: 1px solid #f1f5f9;
  background: #fafbfc; flex-shrink: 0;
}
.modal-footer button { min-width: 90px; }

@media (max-width: 600px) {
  .modal-grid { grid-template-columns: 1fr 1fr; }
  .drawer { width: 100vw; }
}

/* ===== Student Sheet (新增学员侧边表单) ===== */
.student-sheet {
  position: fixed; top: 0; right: -600px; width: min(560px, 100vw);
  height: 100vh; background: #fff; z-index: 201;
  box-shadow: -6px 0 32px rgba(15,23,42,0.15);
  transition: right 0.28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  border-radius: 16px 0 0 16px;
}
.student-sheet.open { right: 0; }
.sheet-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 22px 24px 16px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
  background: linear-gradient(135deg, #f8faff, #fff);
  border-radius: 16px 0 0 0;
}
.sheet-form { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.sheet-body { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 20px; }
.sheet-section-title {
  font-size: 11px; font-weight: 800; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 1px;
  padding-bottom: 8px; border-bottom: 1px solid #f1f5f9;
  margin-bottom: 4px;
}
.sheet-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.sheet-field { display: flex; flex-direction: column; gap: 5px; }
.sheet-field label { font-size: 12px; color: #475569; font-weight: 600; }
.sheet-field input, .sheet-field select { width: 100%; }
.sheet-field-full { grid-column: span 2; }
.sheet-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 24px; border-top: 1px solid #e2e8f0;
  flex-shrink: 0; background: #fafbfc;
  border-radius: 0 0 0 16px;
}

@media (max-width: 600px) {
  .student-sheet { width: 100vw; border-radius: 0; }
  .sheet-grid { grid-template-columns: 1fr; }
  .sheet-field-full { grid-column: span 1; }
}

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 520px at -12% -20%, rgba(56,189,248,0.18), transparent 62%),
    radial-gradient(1000px 520px at 112% 120%, rgba(99,102,241,0.22), transparent 63%),
    linear-gradient(145deg, #07142e 0%, #112a56 45%, #1d4ed8 100%);
}
.login-shell {
  width: min(1080px, 94vw);
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 360px);
  background: rgba(255,255,255,0.97);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 28px 76px rgba(2, 8, 23, 0.36);
  border: 1px solid rgba(255,255,255,0.42);
}
.login-banner {
  background:
    radial-gradient(380px 180px at 95% 15%, rgba(147,197,253,0.18), transparent 70%),
    linear-gradient(160deg, #0b1f46 0%, #173a7a 58%, #1d4ed8 100%);
  color: #fff;
  padding: 34px 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-brand-row { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.login-brand-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.login-logo {
  width: 58px; height: 58px; border-radius: 13px;
  object-fit: contain; background: rgba(255,255,255,0.95);
  padding: 6px; box-shadow: 0 8px 22px rgba(15,23,42,0.24);
  flex: 0 0 auto;
  margin-top: 2px;
}
.login-logo-fallback {
  width: 58px; height: 58px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.34);
  flex: 0 0 auto;
  margin-top: 2px;
}
.login-kicker { font-size: 11px; letter-spacing: 1.6px; font-weight: 800; color: rgba(255,255,255,0.72); line-height: 1.1; }
.login-banner h1 { margin: 0; font-size: 24px; line-height: 1.28; text-shadow: 0 8px 24px rgba(2,8,23,0.32); }
.login-slogan { margin: 0 0 0 70px; color: rgba(229,239,255,0.96); line-height: 1.72; font-size: 15px; max-width: 95%; }
.login-card {
  padding: 34px 28px;
  background: linear-gradient(180deg,#ffffff,#f8fbff);
  border-left: 1px solid #ebf1fb;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}
.login-card h2 { margin: 0 0 16px; color: #0f2b5c; font-size: 42px; letter-spacing: -.2px; }
.login-form { display: grid; gap: 10px; }
.login-form-group { display: grid; gap: 6px; }
.login-form label { font-size: 13px; color: #334155; font-weight: 700; }
.login-form input {
  border: 1.5px solid #d4deef;
  border-radius: 12px;
  padding: 11px 12px;
  transition: border-color .16s, box-shadow .16s, background .16s;
  background: #f8fbff;
}
.login-form input:focus {
  border-color: #4f7cf5;
  box-shadow: 0 0 0 4px rgba(79,124,245,0.14);
  outline: none;
  background: #fff;
}
.login-form button {
  margin-top: 7px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(125deg, #1d4ed8, #3b82f6);
  color: #fff;
  padding: 12px;
  font-weight: 800;
  letter-spacing: .4px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform .14s, box-shadow .14s, filter .14s;
}
.login-form button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -130%;
  width: 60%;
  height: 100%;
  background: linear-gradient(110deg, transparent 0%, rgba(255,255,255,0.08) 35%, rgba(255,255,255,0.46) 50%, rgba(255,255,255,0.08) 65%, transparent 100%);
  transform: skewX(-18deg);
  pointer-events: none;
}
.login-form button:hover::before { animation: loginBtnSheen .4s ease-out forwards; }
.login-form button:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(37,99,235,0.32); filter: brightness(1.03); }
.login-form button:active { transform: translateY(0); filter: brightness(.98); }
.error-text { color: #dc2626; background: #fee2e2; border-radius: 10px; padding: 9px 11px; margin-bottom: 10px; }
.help-text { margin-top: 10px; color: #64748b; font-size: 12px; }
.login-footer {
  position: static;
  width: min(1080px, 94vw);
  margin: 10px auto 0;
  border-top: none;
  background: transparent;
  color: rgba(255,255,255,0.82);
  font-size: 12px;
  padding: 0 8px calc(8px + env(safe-area-inset-bottom));
  text-align: center;
}
.login-banner img { max-width: 100%; height: auto; }

@keyframes loginBtnSheen {
  from { left: -130%; }
  to { left: 150%; }
}

@media (max-width: 960px) {
  .cards, .kpis { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .form-grid, .form-grid.wide { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .user-chip { margin-left: 0; }
  .three-col { grid-template-columns: 1fr !important; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .page-head-actions { flex-wrap: wrap; }
}

@media (max-width: 600px) {
  :root { --shadow: 0 8px 24px rgba(15, 23, 42, 0.08); }

  body {
    background:
      radial-gradient(120% 70% at 50% -20%, #eaf1ff 0%, rgba(234,241,255,0) 70%),
      linear-gradient(180deg, #f8fafd 0%, #f1f5f9 100%);
    -webkit-font-smoothing: antialiased;
  }

  main {
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .cards, .kpis, .form-grid, .form-grid.wide, .detail-grid { grid-template-columns: 1fr; }

  /* Header */
  .site-header {
    padding: 8px 10px;
    gap: 8px;
    height: auto;
    flex-wrap: wrap;
    background: rgba(12, 26, 58, 0.9);
    border-bottom: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .hd-brand { margin-right: 0; flex: 1; min-width: 0; }
  .hd-brand-text { min-width: 0; }
  .hd-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hd-sub { display: none; }
  .hd-right { margin-left: 0; gap: 8px; }
  .hd-phone, .hd-username { display: none; }

  .hd-nav {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .hd-nav::-webkit-scrollbar { display: none; }
  .hd-link, .hd-dropdown-btn {
    padding: 6px 11px;
    font-size: 12px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.92);
    border: 1px solid rgba(255,255,255,0.16);
  }

  /* 手机端把“管理”下拉展开成可滚动导航项，避免 hover 不可用 */
  .hd-dropdown-btn { display: none; }
  .hd-dropdown-menu {
    display: flex;
    position: static;
    padding-top: 0;
    min-width: auto;
  }
  .hd-dropdown-menu-inner {
    background: transparent;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
    display: flex;
    flex-direction: row;
    gap: 6px;
  }
  .hd-menu-item {
    color: rgba(255,255,255,0.92);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 11px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.16);
    white-space: nowrap;
  }
  .hd-menu-item:hover { background: rgba(255,255,255,0.16); color: #fff; }
  .hd-menu-divider { display: none; }

  /* Common blocks */
  .panel,
  .table-wrap,
  .card,
  .kpi,
  .detail-item {
    border-radius: 14px;
  }
  .panel { padding: 12px; }
  .panel-head { flex-wrap: wrap; gap: 8px; }

  /* Form controls */
  input, select, textarea,
  button, .btn-sm, .btn-light, .btn-back {
    min-height: 40px;
    border-radius: 11px;
  }

  /* Tables */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 520px; }

  /* Modal / sheet */
  .modal {
    width: 100vw !important;
    max-height: 92vh;
    border-radius: 16px 16px 0 0;
    top: auto !important;
    bottom: 0;
    left: 0 !important;
    transform: none !important;
  }
  .modal.open { transform: none !important; }
  .modal-grid { grid-template-columns: 1fr !important; }
  .modal-field-full { grid-column: span 1 !important; }

  .drawer,
  .fee-sheet,
  .student-add-sheet {
    width: 100vw !important;
    max-width: 100vw !important;
    border-radius: 16px 16px 0 0 !important;
  }

  .sf-grid { grid-template-columns: 1fr !important; }
  .sf-field-full { grid-column: span 1 !important; }

  /* Hero cards */
  .students-hero, .coaches-hero, .staff-hero, .payroll-hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 14px;
  }
  .students-kpi-row, .coaches-kpi-row, .staff-kpi-row, .payroll-hero-actions { width: 100%; }

  /* Login */
  .login-page {
    min-height: 100dvh;
    padding: 12px;
    align-items: center;
    justify-content: center;
  }
  .login-shell {
    width: 100%;
    max-width: 560px;
    grid-template-columns: 1fr;
    border-radius: 16px;
  }
  .login-banner {
    display: block;
    padding: 18px 14px;
  }
  .login-banner h1 { font-size: 22px; }
  .login-brand-row { gap: 10px; margin-bottom: 10px; }
  .login-logo, .login-logo-fallback { width: 50px; height: 50px; border-radius: 12px; font-size: 22px; }
  .login-slogan { font-size: 13px; line-height: 1.55; margin-left: 0; }
  .login-card {
    border-left: none;
    border-top: 1px solid #ebf1fb;
    padding: 18px 14px;
  }
  .login-card h2 { font-size: 20px; margin-bottom: 14px; }
  .login-footer {
    position: static;
    margin-top: 8px;
    padding: 6px 4px 0;
    text-align: center;
    color: rgba(255,255,255,0.72);
  }
}

/* ===== Shared Sheet (right-side drawer) styles ===== */
.fee-sheet-mask {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,0.38); z-index: 200;
  backdrop-filter: blur(2px);
}
.fee-sheet-mask.open { display: block; }
.fee-sheet {
  position: fixed; top: 0; right: -540px; width: min(500px,100vw);
  height: 100vh; background: #fff; z-index: 201;
  box-shadow: -8px 0 40px rgba(15,23,42,0.15);
  transition: right 0.28s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
  border-radius: 20px 0 0 20px;
}
.fee-sheet.open { right: 0; }
.fee-sheet-head {
  padding: 24px 26px 18px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(135deg, #f8faff, #fff);
  border-radius: 20px 0 0 0; flex-shrink: 0;
}
.fee-sheet-head-top { display: flex; justify-content: space-between; align-items: flex-start; }
.fee-sheet-title { font-size: 18px; font-weight: 800; color: #0f172a; margin: 0 0 4px; }
.fee-sheet-sub { font-size: 12px; color: #94a3b8; margin: 0; }
.fee-sheet-close {
  background: #f1f5f9; border: none; width: 32px; height: 32px;
  border-radius: 8px; font-size: 16px; color: #64748b;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; line-height: 1;
}
.fee-sheet-close:hover { background: #e2e8f0; color: #0f172a; }
.fee-sheet-body {
  flex: 1; overflow-y: auto; padding: 22px 26px;
  display: flex; flex-direction: column; gap: 20px;
}
.fee-sheet-footer {
  padding: 16px 26px; border-top: 1px solid #f1f5f9;
  background: #fafbfc; flex-shrink: 0;
  border-radius: 0 0 0 20px;
  display: flex; gap: 10px; justify-content: flex-end;
}
.sf-section {
  font-size: 11px; font-weight: 800; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 1px;
  padding-bottom: 8px; border-bottom: 1px solid #f1f5f9;
}
.sf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.sf-field { display: flex; flex-direction: column; gap: 5px; }
.sf-field label { font-size: 12px; color: #475569; font-weight: 700; }
.sf-field input, .sf-field select {
  width: 100%; border-radius: 10px;
  border: 1.5px solid #e2e8f0; background: #f8fafc;
  padding: 10px 12px; font: inherit; font-size: 13px; color: #0f172a;
  height: 38px; box-sizing: border-box;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.sf-field select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 30px;
}
.sf-field input:focus, .sf-field select:focus {
  outline: none; border-color: #6366f1; background: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.sf-field textarea {
  width: 100%; border-radius: 10px;
  border: 1.5px solid #e2e8f0; background: #f8fafc;
  padding: 9px 12px; font: inherit; font-size: 13px; color: #0f172a;
  resize: vertical; box-sizing: border-box; height: auto;
}
.sf-field textarea:focus {
  outline: none; border-color: #6366f1; background: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.sf-field-full { grid-column: span 2; }
/* student combo */
.student-combo { position: relative; }
.student-combo-input {
  width: 100%; border-radius: 10px;
  border: 1.5px solid #e2e8f0; background: #f8fafc;
  padding: 10px 12px; font: inherit; font-size: 13px; color: #0f172a;
  height: 38px; box-sizing: border-box;
}
.student-combo-input:focus { outline: none; border-color: #6366f1; background: #fff; box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.student-combo-list {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15,23,42,0.12);
  z-index: 400; max-height: 200px; overflow-y: auto; padding: 4px;
}
.student-combo-list.open { display: block; }
.student-combo-item { padding: 9px 12px; border-radius: 8px; font-size: 13px; cursor: pointer; color: #0f172a; }
.student-combo-item:hover { background: #f0f4ff; color: #1d4ed8; }
.student-combo-item.no-result { color: #94a3b8; cursor: default; }
.student-combo-item.no-result:hover { background: none; }
.selected-student-badge {
  display: none; align-items: center; gap: 8px;
  background: #eff6ff; border: 1.5px solid #bfdbfe;
  border-radius: 10px; padding: 8px 12px; margin-top: 6px;
}
.selected-student-badge.show { display: flex; }
.selected-student-badge span { font-size: 13px; font-weight: 700; color: #1e40af; flex: 1; }
.selected-student-badge button { background: none; border: none; color: #94a3b8; font-size: 15px; cursor: pointer; padding: 0; line-height: 1; }
.selected-student-badge button:hover { color: #ef4444; }
/* status/result pills */
.status-pills, .result-pills { display: flex; gap: 8px; }
.status-pill, .result-pill {
  flex: 1; text-align: center; padding: 9px 10px;
  border-radius: 10px; border: 1.5px solid #e2e8f0;
  background: #f8fafc; font-size: 12px; font-weight: 700;
  cursor: pointer; color: #64748b; transition: all .15s; user-select: none;
}
.status-pill.active-ok, .result-pill.active-ok  { background: #dcfce7; border-color: #86efac; color: #166534; }
.status-pill.active-warn { background: #ffedd5; border-color: #fdba74; color: #9a3412; }
.result-pill.active-fail { background: #fef2f2; border-color: #fca5a5; color: #991b1b; }

/* ===== Student Add Sheet ===== */
.student-sheet-mask {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,0.38); z-index: 200;
  backdrop-filter: blur(2px);
}
.student-sheet-mask.open { display: block; }
.student-add-sheet {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(600px, 95vw);
  max-height: 88vh;
  height: auto;
  background: #fff; z-index: 201;
  box-shadow: 0 24px 64px rgba(15,23,42,0.22);
  transition: transform 0.2s ease, opacity 0.2s ease;
  display: flex; flex-direction: column;
  border-radius: 20px;
  opacity: 0; pointer-events: none;
}
.student-add-sheet.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1; pointer-events: auto;
}
.sas-head {
  padding: 24px 26px 18px; border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(135deg, #f0fdf9, #fff);
  border-radius: 20px 0 0 0; flex-shrink: 0;
}
.sas-head-top { display: flex; justify-content: space-between; align-items: flex-start; }
.sas-title { font-size: 18px; font-weight: 800; color: #0f172a; margin: 0 0 4px; }
.sas-sub { font-size: 12px; color: #94a3b8; margin: 0; }
.sas-close {
  background: #f1f5f9; border: none; width: 32px; height: 32px;
  border-radius: 8px; font-size: 16px; color: #64748b;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; line-height: 1;
}
.sas-close:hover { background: #e2e8f0; color: #0f172a; }
.sas-body { flex: 1; overflow-y: auto; padding: 22px 26px; display: flex; flex-direction: column; gap: 20px; max-height: calc(88vh - 140px); }
.sas-footer {
  padding: 16px 26px; border-top: 1px solid #f1f5f9;
  background: #fafbfc; flex-shrink: 0;
  border-radius: 0 0 0 20px;
  display: flex; gap: 10px; justify-content: flex-end;
}
.sas-section {
  font-size: 11px; font-weight: 800; color: #94a3b8;
  text-transform: uppercase; letter-spacing: 1px;
  padding-bottom: 8px; border-bottom: 1px solid #f1f5f9;
}
.sas-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.sas-field { display: flex; flex-direction: column; gap: 5px; }
.sas-field label { font-size: 12px; color: #475569; font-weight: 700; }
.sas-field input, .sas-field select {
  width: 100%; border-radius: 10px; border: 1.5px solid #e2e8f0; background: #f8fafc;
  padding: 0 12px; height: 38px; line-height: 38px;
  font: inherit; font-size: 13px; color: #0f172a; box-sizing: border-box;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.sas-field select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 30px; cursor: pointer; background-color: #f8fafc;
}
.sas-field input:focus, .sas-field select:focus {
  outline: none; border-color: #059669; background: #fff;
  box-shadow: 0 0 0 3px rgba(5,150,105,0.12);
}
.sas-field textarea {
  width: 100%; border-radius: 10px; border: 1.5px solid #e2e8f0; background: #f8fafc;
  padding: 9px 12px; font: inherit; font-size: 13px; color: #0f172a;
  resize: vertical; min-height: 72px; box-sizing: border-box;
}
.sas-field textarea:focus { outline: none; border-color: #059669; background: #fff; box-shadow: 0 0 0 3px rgba(5,150,105,0.12); }
.sas-field-full { grid-column: span 2; }
/* drawer field overrides */
.drawer-field input, .drawer-field select {
  border: 1.5px solid #e2e8f0; background: #f8fafc; height: 38px;
  padding: 0 12px; box-sizing: border-box; line-height: 38px;
}
.drawer-field select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 30px; cursor: pointer; background-color: #f8fafc;
}
.drawer-field input:focus, .drawer-field select:focus {
  outline: none; border-color: #059669; background: #fff;
  box-shadow: 0 0 0 3px rgba(5,150,105,0.12);
}
