/* 驿动网球教务 —— B/S 后台管理样式 */

:root {
  --brand: #15803d;
  --brand-dark: #166534;
  --brand-soft: #dcfce7;
  --side-bg: #1e293b;
  --side-hover: #334155;
  --side-active: #15803d;
  --bg: #f1f5f9;
  --card: #ffffff;
  --line: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --info: #2563eb;
  --info-soft: #dbeafe;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 12px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #14532d 0%, #1e293b 100%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}
.login-logo { font-size: 22px; font-weight: 700; letter-spacing: .5px; }
.login-sub { color: var(--muted); margin: 6px 0 26px; font-size: 13px; }
.login-card .field { margin-bottom: 16px; }
.login-tip {
  margin-top: 18px; padding: 12px 14px; background: var(--warn-soft);
  border-radius: 8px; font-size: 12.5px; color: #92400e; line-height: 1.7;
}
.login-code-row { display: flex; gap: 10px; }
.login-code-row input { flex: 1; }
.login-tabs {
  display: flex; gap: 4px; margin: 0 0 20px; padding: 4px;
  background: #f1f5f9; border-radius: 10px;
}
.login-tab {
  flex: 1; padding: 8px 0; border: 0; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 14px; font-weight: 600;
  transition: background .15s, color .15s;
}
.login-tab.is-active { background: #fff; color: var(--brand, #2563eb); box-shadow: 0 1px 3px rgba(15,23,42,.12); }
.login-hint { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ---------- 布局 ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex: 0 0 216px; background: var(--side-bg);
  display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0; left: 0;
}
.sidebar-brand {
  padding: 20px 18px; color: #fff; font-size: 16px; font-weight: 700;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar-brand small { display: block; font-size: 11.5px; font-weight: 400; color: #94a3b8; margin-top: 4px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.sidebar-nav a {
  display: block; padding: 10px 18px; color: #cbd5e1; text-decoration: none;
  font-size: 13.5px; border-left: 3px solid transparent;
}
.sidebar-nav a:hover { background: var(--side-hover); color: #fff; }
.sidebar-nav a.active { background: var(--side-active); color: #fff; border-left-color: #86efac; }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .08); color: #94a3b8; font-size: 12px; }

.main-wrap { flex: 1; margin-left: 216px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { margin: 0; font-size: 17px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.main { padding: 22px 24px 60px; flex: 1; min-width: 0; }

/* ---------- 通用块 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title .sub { font-size: 12.5px; font-weight: 400; color: var(--muted); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.toolbar-right { margin-left: auto; display: flex; gap: 8px; }

.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-row label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
input, select, textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; color: var(--text); width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(21, 128, 61, .12); }
input:disabled, select:disabled { background: #f8fafc; color: var(--muted); }

.btn {
  font: inherit; padding: 8px 15px; border-radius: 7px; border: 1px solid var(--line);
  background: #fff; color: var(--text); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #f8fafc; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { background: #fff; border-color: #fca5a5; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- 统计卡 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: #fff; border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  border-left: 3px solid var(--brand);
}
.stat .label { font-size: 12.5px; color: var(--muted); }
.stat .value { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -.3px; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.blue { border-left-color: var(--info); }
.stat.amber { border-left-color: var(--warn); }
.stat.red { border-left-color: var(--danger); }

/* ---------- 近 7 日柱状图 ---------- */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 8px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar { width: 100%; max-width: 44px; background: var(--brand); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart-val { font-size: 12px; color: var(--muted); }
.chart-day { font-size: 11.5px; color: var(--muted); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table { width: 100%; border-collapse: collapse; font-size: 13.2px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; background: #f8fafc; position: sticky; top: 0; }
tbody tr:hover { background: #f8fafc; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .ops { display: flex; gap: 6px; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11.5px;
  background: #f1f5f9; color: var(--muted); border: 1px solid var(--line);
}
.badge.green { background: var(--brand-soft); color: var(--brand-dark); border-color: #bbf7d0; }
.badge.blue { background: var(--info-soft); color: #1e40af; border-color: #bfdbfe; }
.badge.amber { background: var(--warn-soft); color: #92400e; border-color: #fde68a; }
.badge.red { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
.loading { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); font-size: 15.5px; font-weight: 600; }
.modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-note { background: var(--info-soft); color: #1e40af; padding: 10px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.7; }
.modal-note.warn { background: var(--warn-soft); color: #92400e; }
.modal-note.danger { background: var(--danger-soft); color: #991b1b; }

/* ---------- Toast ---------- */
.toast-box { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); max-width: 460px;
}
.toast.ok { background: var(--brand-dark); }
.toast.err { background: #991b1b; }
.toast.warn { background: #92400e; }

/* ---------- 明细抽屉 ---------- */
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv .k { color: var(--muted); }
.hidden { display: none !important; }
.text-right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
