:root {
  --ink: #1f2933;
  --ink-soft: #4a5563;
  --muted: #7b8794;
  --line: #e4e8ed;
  --bg: #f7f9fb;
  --card: #ffffff;
  --accent: #16706a;
  --accent-soft: #e6f3f2;
  --warn: #b45309;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 18px rgba(16, 24, 40, .05);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .35em; line-height: 1.3; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.02rem; }

.wrap { width: min(1080px, calc(100% - 2.5rem)); margin: 0 auto; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 64px; }
.brand { display: flex; align-items: center; gap: .6rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 34px; height: 34px; border-radius: 9px; object-fit: cover; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 1.02rem; letter-spacing: .01em; }
.brand-text small { color: var(--muted); font-size: .72rem; }

.nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.nav a { color: var(--ink-soft); font-size: .92rem; }
.nav a:hover { color: var(--accent); text-decoration: none; }
.nav-divider { width: 1px; height: 18px; background: var(--line); }
.nav-user { font-weight: 600; }
.nav-quiet { color: var(--muted) !important; }
.nav-admin { position: relative; }
.nav-admin .dot {
  display: inline-block; min-width: 17px; height: 17px; margin-left: 4px; padding: 0 4px;
  background: var(--danger); color: #fff; border-radius: 9px;
  font-size: .68rem; line-height: 17px; text-align: center;
}

.main { padding: 2.2rem 0 3.5rem; min-height: 60vh; }

/* ---------- 首页 ---------- */
.hero { padding: 2.6rem 0 2rem; }
.hero h1 { font-size: 2.15rem; letter-spacing: -.02em; }
.lead { color: var(--ink-soft); font-size: 1.05rem; max-width: 46ch; margin: .6rem 0 1.6rem; }
.hero-actions { display: flex; gap: .7rem; flex-wrap: wrap; }

.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.4rem; }
.feature { display: flex; flex-direction: column; gap: .3rem; color: inherit; padding: 1.4rem; }
.feature:hover { text-decoration: none; transform: translateY(-2px); border-color: #cfe0de; }
.feature { transition: transform .16s ease, border-color .16s ease; }
.feature-icon { font-size: 1.6rem; line-height: 1; margin-bottom: .4rem; }
.feature p { color: var(--ink-soft); font-size: .92rem; margin: .1rem 0 .5rem; }
.feature-meta { color: var(--muted); font-size: .8rem; }

.notice { padding: 1.3rem 1.5rem; }
.notice p { margin: 0; color: var(--ink-soft); }

/* ---------- 卡片与布局 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.1rem;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; }
.card-head h3 { margin: 0; }
.link { font-size: .88rem; white-space: nowrap; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.grid-2 > .card { margin-bottom: 0; height: 100%; }
.grid-2 { margin-bottom: 1.1rem; }

.page-head { margin-bottom: 1.4rem; }
.page-head h1 { margin-bottom: .15rem; }
.page-head .muted { margin: 0; }

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.badge { font-size: .8rem; color: var(--warn); }
.badge.ok { color: var(--accent); }
.badge.err { color: var(--danger); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .55rem 1.05rem; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: #fff; font-size: .92rem; font-weight: 550;
  cursor: pointer; font-family: inherit; line-height: 1.4;
  transition: filter .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { filter: brightness(.95); }
.btn-sm { padding: .34rem .7rem; font-size: .84rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-ghost { background: #fff; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { border-color: #c9d2da; color: var(--ink); }
.btn-danger { background: transparent; color: var(--danger); border-color: #f0d0d0; }
.btn-danger:hover { background: #fdf2f2; }
.btn.off { opacity: .55; }
.btn.active { background: #0e5a55; }
.link-danger { background: none; border: 0; color: var(--danger); font-size: .8rem; cursor: pointer; padding: 0; font-family: inherit; }
.link-danger:hover { text-decoration: underline; }

.row-actions { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.form { display: flex; flex-direction: column; gap: .9rem; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; color: var(--ink-soft); font-weight: 500; }
.form input[type=text], .form input[type=tel], .form input[type=password],
.form input[type=search], .form input[type=file], .form select, .form textarea {
  width: 100%; padding: .58rem .75rem; border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: .93rem; color: var(--ink); background: #fff;
}
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.form textarea { resize: vertical; }
.form-inline { display: grid; grid-template-columns: 1.2fr 1.4fr 1.2fr auto; gap: .8rem; align-items: end; }
.form-inline label { min-width: 0; }
.check { flex-direction: row !important; align-items: center; gap: .45rem !important; font-weight: 400; }
.check input { width: auto; }
.form-actions { display: flex; gap: .6rem; margin-top: .4rem; }
.search { display: flex; gap: .45rem; align-items: center; }
.search input, .search select {
  padding: .42rem .6rem; border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: .86rem; background: #fff;
}

/* ---------- 登录卡 ---------- */
.auth { display: flex; justify-content: center; padding: 1.5rem 0; }
.auth-card { width: min(420px, 100%); padding: 1.9rem 1.9rem 1.5rem; }
.auth-card h2 { margin-bottom: .1rem; }
.auth-card > .muted { margin-top: 0; }
.auth-card .center { margin-bottom: 0; }

/* ---------- 提示条 ---------- */
.alert { padding: .65rem .9rem; border-radius: 10px; font-size: .88rem; margin-bottom: 1rem; }
.alert-err { background: #fdf2f2; border: 1px solid #f3d2d2; color: #9b1c1c; }
.alert-ok { background: var(--accent-soft); border: 1px solid #cbe6e3; color: #0f5e59; }

/* ---------- 列表 ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 0; border-bottom: 1px solid #eef1f4;
}
.list li:last-child { border-bottom: 0; }
.list-main { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.list-main a { font-weight: 550; }
.list.plain li { justify-content: space-between; }
.list.plain li span:last-child { text-align: right; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem;
  padding: .5rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: .68rem .6rem; border-bottom: 1px solid #eef1f4; vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table-tight td, .table-tight th { padding: .45rem .55rem; }
.actions { display: flex; gap: .35rem; flex-wrap: wrap; }
.actions form { margin: 0; }

.tabs { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a {
  padding: .35rem .85rem; border-radius: 999px; font-size: .88rem;
  color: var(--ink-soft); border: 1px solid var(--line); background: #fff;
}
.tabs a:hover { text-decoration: none; border-color: #c9d2da; }
.tabs a.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.tag {
  display: inline-block; padding: .1rem .5rem; border-radius: 6px;
  font-size: .78rem; background: #eef1f4; color: var(--ink-soft);
}
.tag-admin { background: #efe7fb; color: #6b3fa0; }
.tag-teacher { background: var(--accent-soft); color: #0f5e59; }
.tag-student { background: #eef1f4; color: var(--ink-soft); }
.tag-pending { background: #fdf3e3; color: var(--warn); }
.tag-ok { background: var(--accent-soft); color: #0f5e59; }
.tag-off { background: #f3f4f6; color: var(--muted); }

.pager { display: flex; gap: 1rem; align-items: center; justify-content: center; padding-top: 1rem; font-size: .88rem; }

/* ---------- 统计 ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 1.2rem; }
.stat { display: flex; flex-direction: column; gap: .1rem; padding: 1rem 1.1rem; margin: 0; color: inherit; }
.stat:hover { text-decoration: none; }
.stat-num { font-size: 1.45rem; font-weight: 650; letter-spacing: -.02em; }
.stat-label { color: var(--muted); font-size: .82rem; }
.stat-warn { border-color: #f0d9b5; background: #fffdf8; }
.stat-warn .stat-num { color: var(--warn); }

/* ---------- 相册 ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.photo { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.photo img { display: block; width: 100%; height: 190px; object-fit: cover; background: #f0f2f5; }
.photo figcaption { padding: .6rem .8rem .7rem; display: flex; flex-direction: column; gap: .15rem; font-size: .86rem; }
.photo figcaption form { margin: 0; }
.thumb-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: .5rem; }
.thumb img { width: 100%; height: 62px; object-fit: cover; border-radius: 8px; display: block; }

.logo-box { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; }
.logo-preview { width: 88px; height: 88px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
.logo-empty {
  width: 88px; height: 88px; border-radius: 14px; border: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: center; text-align: center;
  font-size: .72rem; color: var(--muted); padding: .5rem;
}

/* ---------- 视频课堂 ---------- */
.room-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.room-head h1 { font-size: 1.35rem; }
.room-grid { display: grid; grid-template-columns: 1fr 300px; gap: 1rem; align-items: start; }
.videos { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.video-box {
  position: relative; background: #10151a; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center;
}
.video-box video { width: 100%; height: 100%; object-fit: cover; background: #10151a; }
.video-tag {
  position: absolute; left: .55rem; bottom: .5rem; padding: .1rem .5rem;
  background: rgba(0, 0, 0, .55); color: #fff; border-radius: 6px; font-size: .76rem;
}
.room-side { display: flex; flex-direction: column; gap: .8rem; }
.controls { display: flex; flex-direction: column; gap: .5rem; }
.chat { margin: 0; padding: .8rem; display: flex; flex-direction: column; gap: .5rem; height: 320px; }
.chat-log { flex: 1; overflow-y: auto; font-size: .86rem; display: flex; flex-direction: column; gap: .3rem; }
.chat-item { color: var(--ink-soft); word-break: break-word; }
.chat-item.mine { color: var(--accent); }
.chat-form { display: flex; gap: .4rem; }
.chat-form input {
  flex: 1; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: .88rem;
}
.toast {
  position: fixed; left: 50%; bottom: 2rem; transform: translate(-50%, 1rem);
  background: #1f2933; color: #fff; padding: .6rem 1.1rem; border-radius: 10px;
  font-size: .88rem; opacity: 0; pointer-events: none; transition: all .22s ease; z-index: 60;
  max-width: 80vw;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 页脚 ---------- */
.footer { border-top: 1px solid var(--line); padding: 1.6rem 0 2rem; font-size: .84rem; color: var(--ink-soft); }
.footer p { margin: .1rem 0; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .features { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .form-inline { grid-template-columns: 1fr; }
  .room-grid { grid-template-columns: 1fr; }
  .videos { grid-template-columns: 1fr; }
  .thumb-row { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .wrap { width: calc(100% - 1.6rem); }
  .topbar-inner { height: auto; padding: .7rem 0; flex-direction: column; align-items: flex-start; }
  .nav { gap: .8rem; font-size: .88rem; }
  .hero { padding: 1.4rem 0 1rem; }
  .hero h1 { font-size: 1.6rem; }
  h1 { font-size: 1.35rem; }
  .card { padding: 1.1rem 1rem; }
  .table { display: block; overflow-x: auto; white-space: nowrap; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .photo img { height: 130px; }
}
