/* ============================================================
   启航云课堂 · 共享基础样式（三端共用）
   ============================================================ */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --line: #e8edf6;
  --line-2: #dfe6f2;
  --text: #1a2233;
  --text-2: #48536a;
  --muted: #8592a6;
  --primary: #3b6ef6;
  --primary-dark: #2d5ae0;
  --primary-soft: #eef3ff;
  --success: #12b76a;
  --success-soft: #e7f8f0;
  --warn: #f79009;
  --warn-soft: #fff6e6;
  --danger: #f04438;
  --danger-soft: #feecea;
  --purple: #7c5cf5;
  --cyan: #06b6d4;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(23, 43, 77, 0.05);
  --shadow: 0 6px 22px rgba(23, 43, 77, 0.07);
  --shadow-lg: 0 18px 48px rgba(23, 43, 77, 0.16);
  --sidebar-w: 226px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }
img { display: block; max-width: 100%; }
::selection { background: #d8e3ff; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d3dbe9; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #bcc7da; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------ 图标 ------------------ */
.ico { width: 18px; height: 18px; display: inline-block; vertical-align: -3px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico-lg { width: 22px; height: 22px; }
.ico-sm { width: 15px; height: 15px; }

/* ------------------ 按钮 ------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 15px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; white-space: nowrap;
  border: 1px solid transparent;
  transition: all .16s ease;
  color: var(--text-2); background: #fff; border-color: var(--line-2);
}
.btn:hover { border-color: #c9d4e6; color: var(--text); background: #fbfcfe; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, #4a7bf7, #3b6ef6);
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px rgba(59, 110, 246, .28);
}
.btn-primary:hover { background: linear-gradient(135deg, #3f6ff0, #2d5ae0); color: #fff; box-shadow: 0 6px 16px rgba(59, 110, 246, .34); }
.btn-danger { background: #fff; color: var(--danger); border-color: #ffd9d5; }
.btn-danger:hover { background: var(--danger-soft); border-color: #ffc4be; color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #eef2fa; color: var(--text); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; border-radius: 11px; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* 文字操作按钮 */
.link-btn { color: var(--primary); font-size: 13px; padding: 2px 4px; border-radius: 6px; }
.link-btn:hover { background: var(--primary-soft); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: var(--danger-soft); }
.op-cell { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; }

/* ------------------ 表单 ------------------ */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 7px; font-weight: 500; }
.field .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: #fff; outline: none; transition: all .16s;
  font-size: 13.5px;
}
.textarea { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.7; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 110, 246, .13);
}
.input::placeholder, .textarea::placeholder { color: #a9b4c6; }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238592a6' stroke-width='2' stroke-linecap='round'><polyline points='6 9 12 15 18 9'/></svg>"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 30px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.form-tip { font-size: 12px; color: var(--muted); margin-top: 6px; }
.form-row-inline { display: flex; gap: 10px; }
.radio-group { display: flex; gap: 16px; flex-wrap: wrap; padding-top: 6px; }
.radio-group label { display: flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; color: var(--text-2); }
input[type=radio], input[type=checkbox] { accent-color: var(--primary); width: 15px; height: 15px; cursor: pointer; }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; background: #cfd8e6; border-radius: 22px; transition: .2s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }

/* ------------------ 标签 / 徽标 ------------------ */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 23px; padding: 0 9px; border-radius: 6px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: #f1f4fa; color: var(--text-2);
}
.tag.blue { background: var(--primary-soft); color: var(--primary); }
.tag.green { background: var(--success-soft); color: #0b9a5b; }
.tag.orange { background: var(--warn-soft); color: #c2740a; }
.tag.red { background: var(--danger-soft); color: #d92d20; }
.tag.purple { background: #f2eeff; color: #6b46f0; }
.tag.gray { background: #f1f4fa; color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ------------------ 卡片 ------------------ */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line); gap: 12px;
}
.card-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title .sub { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.card-body { padding: 18px 20px; }
.card-body.tight { padding: 8px 0; }

/* ------------------ 表格 ------------------ */
.table-wrap { width: 100%; overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tb th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px;
  padding: 11px 14px; background: var(--surface-2); white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.tb th:first-child { padding-left: 20px; }
table.tb th:last-child, table.tb td:last-child { padding-right: 20px; }
table.tb td { padding: 13px 14px; border-bottom: 1px solid #f2f5fa; vertical-align: middle; }
table.tb td:first-child { padding-left: 20px; }
table.tb tbody tr:hover { background: #fafcff; }
table.tb tbody tr:last-child td { border-bottom: none; }
table.tb .cell-main { font-weight: 500; color: var(--text); }
table.tb .cell-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tb-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.tb-actions .link-btn { white-space: nowrap; padding: 2px 3px; }
.tb-center { text-align: center; }

/* 头像 */
.avatar {
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 600; flex: none;
  letter-spacing: .5px; background: #c7d2e4;
}
.avatar.round { border-radius: 50%; }
.avatar-sm { width: 26px; height: 26px; border-radius: 8px; font-size: 11px; }
.avatar-lg { width: 52px; height: 52px; border-radius: 15px; font-size: 18px; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell .name { font-weight: 500; }
.user-cell .sub { font-size: 12px; color: var(--muted); }

/* 进度条 */
.progress { height: 6px; border-radius: 6px; background: #eef2f8; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #5b8def, #7c5cf5); }
.progress.sm { height: 4px; }
.progress-text { display: flex; align-items: center; gap: 8px; }
.progress-text .progress { flex: 1; min-width: 56px; }
.progress-text span { font-size: 12px; color: var(--muted); width: 34px; text-align: right; }

/* 空状态 */
.empty { padding: 54px 20px; text-align: center; color: var(--muted); }
.empty .ico { width: 42px; height: 42px; stroke-width: 1.2; color: #c3cddd; margin-bottom: 10px; }
.empty p { font-size: 13px; }
.empty .btn { margin-top: 14px; }

/* ------------------ 弹窗 ------------------ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 29, 46, .45);
  backdrop-filter: blur(2px); z-index: 900; display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px 24px; overflow-y: auto;
  animation: fadeIn .16s ease;
}
.modal {
  width: 560px; max-width: 100%; background: #fff; border-radius: 16px;
  box-shadow: var(--shadow-lg); animation: modalIn .2s cubic-bezier(.2,.8,.3,1);
  display: flex; flex-direction: column; max-height: 88vh;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-head .close { color: var(--muted); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.modal-head .close:hover { background: #f1f4fa; color: var(--text); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-12px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }

/* ------------------ 轻提示 ------------------ */
#toast-root { position: fixed; top: 22px; left: 50%; transform: translateX(-50%); z-index: 1200; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; background: #fff;
  box-shadow: 0 10px 30px rgba(20, 30, 50, .16); font-size: 13.5px; font-weight: 500;
  animation: toastIn .22s ease; border: 1px solid var(--line);
}
.toast .ico { color: var(--success); }
.toast.error .ico { color: var(--danger); }
.toast.info .ico { color: var(--primary); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ------------------ 分页 ------------------ */
.pager { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; gap: 12px; flex-wrap: wrap; }
.pager .info { font-size: 12.5px; color: var(--muted); }
.pager .pages { display: flex; gap: 6px; align-items: center; }
.pager button {
  min-width: 32px; height: 32px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line-2); background: #fff; font-size: 13px; color: var(--text-2);
}
.pager button:hover:not([disabled]) { border-color: var(--primary); color: var(--primary); }
.pager button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager button[disabled] { opacity: .45; cursor: not-allowed; }

/* ------------------ 图表（原生 SVG） ------------------ */
.chart { width: 100%; height: 100%; overflow: visible; }
.chart line.grid { stroke: #eef2f8; stroke-width: 1; }
.chart text { fill: #93a0b4; font-size: 11px; }
.chart .axis-label { fill: #8592a6; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.chart-legend i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; margin-right: 6px; }
.chart-empty { height: 100%; display: grid; place-items: center; color: var(--muted); font-size: 13px; }

/* ------------------ 其他 ------------------ */
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.hidden { display: none !important; }

.skeleton { background: linear-gradient(90deg, #eef2f8 25%, #f6f9fd 37%, #eef2f8 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0 } 100% { background-position: 0 0 } }
.spinner { width: 18px; height: 18px; border: 2px solid #d9e3f5; border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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