/* 贝赢AI 教培智能体 — 设计系统 */

:root {
  --surface-0: #faf9f5;
  --surface-1: #f3f2ed;
  --surface-2: #ffffff;
  --surface-3: #eceae3;
  --text-primary: #171715;
  --text-secondary: #62625b;
  --text-muted: #6f6f67;
  --border: rgba(23, 23, 21, 0.09);
  --border-strong: rgba(23, 23, 21, 0.18);
  --border-stronger: rgba(23, 23, 21, 0.32);

  --accent: #2c6b5c;
  --accent-hover: #235749;
  --text-accent: #22584a;
  --bg-accent: #eaf2ef;
  --border-accent: #c3d9d2;

  --danger: #a63a32;
  --text-danger: #94322b;
  --bg-danger: #fbeeec;
  --border-danger: #eccfcb;

  --warning: #8a6410;
  --text-warning: #7c5a0d;
  --bg-warning: #faf3e1;
  --border-warning: #ebdab2;

  --success: #2e6b4a;
  --text-success: #27603f;
  --bg-success: #eaf3ed;
  --border-success: #c6ddce;

  --font-sans: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-voice: "Noto Serif SC", "Songti SC", Georgia, serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Consolas, monospace;

  --radius: 8px;
  --radius-lg: 12px;
  --pad-sm: 8px;
  --pad-md: 12px;
  --pad-lg: 16px;
  --pad-xl: 24px;
  --gap-xs: 4px;
  --gap-sm: 8px;
  --gap-md: 12px;
  --gap-lg: 16px;
  --gap-xl: 24px;

  --sidebar-w: 228px;
  --topbar-h: 56px;
  --ring: 0 0 0 3px rgba(44, 107, 92, 0.16);
}

[data-theme="dark"] {
  --surface-0: #141412;
  --surface-1: #1b1b18;
  --surface-2: #222220;
  --surface-3: #2b2b27;
  --text-primary: #f4f3ee;
  --text-secondary: #a9a89f;
  --text-muted: #8f8e85;
  --border: rgba(244, 243, 238, 0.1);
  --border-strong: rgba(244, 243, 238, 0.2);
  --border-stronger: rgba(244, 243, 238, 0.34);

  --accent: #7ec0aa;
  --accent-hover: #96cdba;
  --text-accent: #9ed3c1;
  --bg-accent: #1c2b27;
  --border-accent: #2f4a43;

  --danger: #e08b83;
  --text-danger: #e8a29b;
  --bg-danger: #2d1e1c;
  --border-danger: #4a3130;

  --warning: #d9b168;
  --text-warning: #e0bd7d;
  --bg-warning: #2c2517;
  --border-warning: #473a22;

  --success: #8cc4a4;
  --text-success: #a0d3b6;
  --bg-success: #1c2a22;
  --border-success: #2f4638;

  --ring: 0 0 0 3px rgba(126, 192, 170, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
h1 {
  font-size: 22px;
  line-height: 1.4;
}
h2 {
  font-size: 18px;
  line-height: 1.45;
}
h3 {
  font-size: 16px;
  line-height: 1.5;
}
p {
  margin: 0;
}
a {
  color: var(--text-accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
button {
  font-family: inherit;
}
::selection {
  background: var(--bg-accent);
  color: var(--text-primary);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- 布局骨架 ---------- */

.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface-0);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 12px 12px;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  text-decoration: none;
}
.brand:hover {
  text-decoration: none;
}
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--text-primary);
  color: var(--surface-2);
  display: grid;
  place-items: center;
  font-size: 17px;
  flex: 0 0 30px;
}
.brand-name {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.25;
  letter-spacing: 0.01em;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.nav-group {
  margin-bottom: 18px;
}
.nav-label {
  font-size: 11px;
  color: var(--text-muted);
  padding: 0 10px 6px;
  letter-spacing: 0.06em;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
  text-decoration: none;
  margin-bottom: 1px;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item i {
  font-size: 17px;
  color: var(--text-muted);
  transition: color 0.12s ease;
}
.nav-item:hover {
  background: var(--surface-1);
  color: var(--text-primary);
  text-decoration: none;
}
.nav-item:hover i {
  color: var(--text-secondary);
}
.nav-item.active {
  background: var(--surface-2);
  color: var(--text-primary);
  box-shadow: 0 0 0 0.5px var(--border-strong);
  font-weight: 500;
}
.nav-item.active i {
  color: var(--accent);
}
.nav-count {
  margin-left: auto;
  font-size: 11.5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--surface-1);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-count {
  background: var(--bg-accent);
  color: var(--text-accent);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 0.5px solid var(--border);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
}
.user-card:hover {
  background: var(--surface-1);
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-accent);
  color: var(--text-accent);
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 500;
  flex: 0 0 28px;
}
.user-name {
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.3;
  font-weight: 500;
}
.user-role {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  border-bottom: 0.5px solid var(--border);
  background: color-mix(in srgb, var(--surface-0) 88%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-muted);
  min-width: 0;
}
.crumb strong {
  color: var(--text-primary);
  font-weight: 500;
}
.crumb i {
  font-size: 13px;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--bg-warning);
  color: var(--text-warning);
  border: 0.5px solid var(--border-warning);
  font-size: 11.5px;
  white-space: nowrap;
}
.demo-pill i {
  font-size: 13px;
}

.page {
  padding: 28px 28px 64px;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  flex: 1;
}

.page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.page-head > div:first-child {
  flex: 1 1 380px;
  min-width: 0;
}
.page-title {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.page-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  max-width: 76ch;
  line-height: 1.65;
}
.page-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: var(--radius);
  border: 0.5px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}
.btn i {
  font-size: 16px;
  color: var(--text-secondary);
}
.btn:hover {
  background: var(--surface-1);
  border-color: var(--border-stronger);
}
.btn:active {
  transform: translateY(0.5px);
}
.btn[disabled],
.btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-primary {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--surface-2);
  font-weight: 500;
}
.btn-primary i {
  color: inherit;
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--text-primary) 86%, var(--surface-0));
  border-color: transparent;
}
.btn-accent {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}
.btn-accent i {
  color: inherit;
}
.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
[data-theme="dark"] .btn-accent {
  color: #10201c;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--surface-1);
  color: var(--text-primary);
  border-color: transparent;
}
.btn-danger {
  color: var(--text-danger);
  border-color: var(--border-danger);
  background: var(--surface-2);
}
.btn-danger:hover {
  background: var(--bg-danger);
  border-color: var(--border-danger);
}
.btn-sm {
  height: 28px;
  padding: 0 9px;
  font-size: 12.5px;
  border-radius: 6px;
}
.btn-sm i {
  font-size: 14px;
}
.btn-lg {
  height: 40px;
  padding: 0 18px;
  font-size: 14.5px;
}
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 7px;
  border-color: transparent;
  background: transparent;
  color: var(--text-secondary);
}
.btn-icon i {
  font-size: 17px;
  color: inherit;
}
.btn-icon:hover {
  background: var(--surface-1);
  border-color: transparent;
  color: var(--text-primary);
}
.btn-block {
  width: 100%;
}

/* ---------- 卡片 ---------- */

.card {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}
.card-tight {
  padding: 14px 16px;
}
.card-flush {
  padding: 0;
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  min-height: 24px;
}
.card-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 7px;
}
.card-title i {
  font-size: 16px;
  color: var(--text-muted);
}
.card-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}
.card-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.grid {
  display: grid;
  gap: 16px;
}
.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.grid-auto {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.spacer {
  flex: 1;
}

/* ---------- 文字工具 ---------- */

.t-xs {
  font-size: 11.5px;
}
.t-sm {
  font-size: 12.5px;
}
.t-md {
  font-size: 13.5px;
}
.t-secondary {
  color: var(--text-secondary);
}
.t-muted {
  color: var(--text-muted);
}
.t-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: -0.01em;
}
.nowrap {
  white-space: nowrap;
}
.t-num {
  font-variant-numeric: tabular-nums;
}
.t-medium {
  font-weight: 500;
}
.t-danger {
  color: var(--text-danger);
}
.t-success {
  color: var(--text-success);
}
.t-warning {
  color: var(--text-warning);
}
.t-accent {
  color: var(--text-accent);
}
.t-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 徽章 / 状态 ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 21px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 11.5px;
  line-height: 1;
  white-space: nowrap;
  border: 0.5px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.badge i {
  font-size: 12px;
}
.badge-dot::before {
  content: "";
  width: 4.5px;
  height: 4.5px;
  border-radius: 50%;
  background: currentColor;
  margin-right: 3px;
}
.badge-accent {
  background: var(--bg-accent);
  border-color: var(--border-accent);
  color: var(--text-accent);
}
.badge-success {
  background: var(--bg-success);
  border-color: var(--border-success);
  color: var(--text-success);
}
.badge-warning {
  background: var(--bg-warning);
  border-color: var(--border-warning);
  color: var(--text-warning);
}
.badge-danger {
  background: var(--bg-danger);
  border-color: var(--border-danger);
  color: var(--text-danger);
}
.badge-plain {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
[data-theme="dark"] .badge-plain {
  color: var(--text-secondary);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  border: 0.5px solid var(--border);
  background: var(--surface-1);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.chip.active {
  background: var(--bg-accent);
  border-color: var(--border-accent);
  color: var(--text-accent);
}
.chip i {
  font-size: 13px;
}

/* ---------- 表格 ---------- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
.table th {
  text-align: left;
  font-weight: 400;
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--border);
  white-space: nowrap;
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 1;
}
.table td {
  padding: 11px 14px;
  border-bottom: 0.5px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table tbody tr {
  transition: background 0.1s ease;
}
.table tbody tr:hover {
  background: var(--surface-1);
}
.table tbody tr.is-clickable {
  cursor: pointer;
}
.table td.strong {
  color: var(--text-primary);
  font-weight: 500;
}
.table .cell-actions {
  text-align: right;
  white-space: nowrap;
}

/* ---------- 表单 ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.field-label .req {
  color: var(--text-danger);
}
.field-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.55;
}
.input,
.select,
.textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--surface-2);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px 10px;
  line-height: 1.5;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input {
  height: 36px;
}
.select {
  height: 36px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2396968d' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 9px center;
  padding-right: 30px;
}
.textarea {
  min-height: 96px;
  resize: vertical;
}
.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--border-stronger);
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--text-muted);
}
.input[disabled],
.select[disabled] {
  background: var(--surface-1);
  color: var(--text-muted);
  cursor: not-allowed;
}
.input-invalid {
  border-color: var(--border-danger);
  background: var(--bg-danger);
}
.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.form-grid .full {
  grid-column: 1 / -1;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.55;
}
.check input {
  margin: 3px 0 0;
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-1);
  border-radius: 7px;
  border: 0.5px solid var(--border);
  gap: 2px;
}
.segmented button {
  border: none;
  background: transparent;
  height: 26px;
  padding: 0 10px;
  border-radius: 5px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}
.segmented button.active {
  background: var(--surface-2);
  color: var(--text-primary);
  box-shadow: 0 0 0 0.5px var(--border-strong);
}

/* ---------- 统计 ---------- */

.stat {
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 15px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.stat-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-label i {
  font-size: 14px;
  color: var(--text-muted);
}
.stat-value {
  font-size: 26px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.stat-value span {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0;
}
.stat-value .stat-den {
  margin-left: -2px;
}
.stat-foot {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}
.stat-foot i {
  font-size: 12px;
}

/* ---------- 进度 ---------- */

.progress {
  height: 4px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
  width: 100%;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.35s ease;
}
.progress-lg {
  height: 6px;
}
.progress-warn > span {
  background: var(--warning);
}
.progress-danger > span {
  background: var(--danger);
}

/* ---------- 空态 / 提示条 ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 44px 24px;
  gap: 6px;
}
.empty-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-1);
  display: grid;
  place-items: center;
  margin-bottom: 6px;
}
.empty-icon i {
  font-size: 20px;
  color: var(--text-muted);
}
.empty-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}
.empty-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  max-width: 42ch;
  line-height: 1.6;
}

.notice {
  display: flex;
  gap: 9px;
  padding: 11px 13px;
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
  background: var(--surface-1);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.notice i {
  font-size: 16px;
  margin-top: 1px;
  flex: 0 0 16px;
  color: var(--text-muted);
}
.notice strong {
  font-weight: 500;
  color: var(--text-primary);
}
.notice-warning {
  background: var(--bg-warning);
  border-color: var(--border-warning);
  color: var(--text-warning);
}
.notice-warning i {
  color: var(--text-warning);
}
.notice-danger {
  background: var(--bg-danger);
  border-color: var(--border-danger);
  color: var(--text-danger);
}
.notice-danger i {
  color: var(--text-danger);
}
.notice-accent {
  background: var(--bg-accent);
  border-color: var(--border-accent);
  color: var(--text-accent);
}
.notice-accent i {
  color: var(--text-accent);
}
.notice-success {
  background: var(--bg-success);
  border-color: var(--border-success);
  color: var(--text-success);
}
.notice-success i {
  color: var(--text-success);
}

/* ---------- 分段标题 ---------- */

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.section-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.section-title i {
  font-size: 15px;
  color: var(--text-muted);
}
.section-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
}

.divider {
  height: 0.5px;
  background: var(--border);
  width: 100%;
  margin: 16px 0;
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 12.5px;
}
.kv dt {
  color: var(--text-muted);
  white-space: nowrap;
}
.kv dd {
  margin: 0;
  color: var(--text-secondary);
}

.avatar-sm {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size:11px;
  background: var(--surface-1);
  color: var(--text-secondary);
  flex: 0 0 22px;
  font-weight: 500;
}

/* ---------- 弹层 ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 18, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: fade 0.12s ease;
}
[data-theme="dark"] .overlay {
  background: rgba(0, 0, 0, 0.55);
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.995);
  }
}
.modal {
  background: var(--surface-2);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  animation: pop 0.14s ease;
}
.modal-lg {
  max-width: 720px;
}
.modal-head {
  padding: 18px 20px 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.modal-title {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
}
.modal-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 3px;
  line-height: 1.6;
}
.modal-body {
  padding: 2px 20px 8px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 14px 20px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 0.5px solid var(--border);
  margin-top: 14px;
}

.toast-wrap {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--text-primary);
  color: var(--surface-2);
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  animation: pop 0.16s ease;
  max-width: 520px;
}
.toast i {
  font-size: 16px;
}
.toast-danger {
  background: var(--danger);
  color: #fff;
}
.toast-success {
  background: var(--success);
  color: #fff;
}

/* ---------- 抽屉 ---------- */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 18, 0.28);
  z-index: 90;
  animation: fade 0.12s ease;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(460px, 92vw);
  background: var(--surface-2);
  border-left: 0.5px solid var(--border-strong);
  z-index: 91;
  display: flex;
  flex-direction: column;
  animation: slide 0.18s ease;
}
@keyframes slide {
  from {
    transform: translateX(16px);
    opacity: 0.6;
  }
}
.drawer-head {
  padding: 16px 18px;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.drawer-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1;
}
.drawer-foot {
  padding: 12px 18px;
  border-top: 0.5px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ---------- 时间线 ---------- */

.timeline {
  position: relative;
  padding-left: 22px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 0.5px;
  background: var(--border-strong);
}
.tl-item {
  position: relative;
  padding-bottom: 22px;
}
.tl-item:last-child {
  padding-bottom: 0;
}
.tl-dot {
  position: absolute;
  left: -22px;
  top: 6px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1.5px solid var(--border-stronger);
}
.tl-dot.done {
  background: var(--accent);
  border-color: var(--accent);
}
.tl-dot.warn {
  background: var(--warning);
  border-color: var(--warning);
}
.tl-date {
  font-size: 11.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- 文本片段选择 ---------- */

.pick {
  border: 0.5px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 9px 11px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  display: block;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.pick:hover {
  border-color: var(--border-strong);
  background: var(--surface-1);
}
.pick.selected {
  border-color: var(--border-accent);
  background: var(--bg-accent);
}
.pick-title {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.55;
}
.pick-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.link-btn {
  border: none;
  background: none;
  padding: 0;
  color: var(--text-accent);
  font-size: inherit;
  cursor: pointer;
  font-family: inherit;
}
.link-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- 滚动条 ---------- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- 响应式 ---------- */

.mobile-only {
  display: none;
}

/* 超窄屏（≤620px）切换文案：only-xs 只在小屏显示，not-xs 只在大屏显示 */
.only-xs {
  display: none;
}

@media (max-width: 620px) {
  .only-xs {
    display: inline;
  }
  .not-xs {
    display: none;
  }
}

@media (max-width: 1080px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  :root {
    --topbar-h: 52px;
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    background: var(--surface-0);
    width: 260px;
    flex-basis: 260px;
  }
  .sidebar.open {
    transform: none;
  }
  .sidebar-scrim {
    position: fixed;
    inset: 0;
    background: rgba(20, 20, 18, 0.3);
    z-index: 29;
  }
  .mobile-only {
    display: inline-flex;
  }
  .page {
    padding: 18px 16px 80px;
  }
  .topbar {
    padding: 0 14px;
  }
  .page-head {
    margin-bottom: 18px;
  }
  .page-title {
    font-size: 20px;
  }
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .hide-sm {
    display: none !important;
  }
  .page-actions {
    margin-left: 0;
    width: 100%;
  }
  .page-actions .btn {
    flex: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- 组件补充：折叠区 / 三选一 / 吸底栏 / 名单状态 ---------- */

.fold {
  border: 0.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  overflow: hidden;
}

.fold-head {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  background: none;
  border: 0;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
}

.fold-head:hover {
  background: var(--surface-1);
}

.fold-head > .ti-chevron-down {
  font-size: 15px;
  color: var(--text-muted);
  transition: transform 0.16s ease;
  flex: 0 0 auto;
}

.fold.open .fold-head > .ti-chevron-down {
  transform: rotate(180deg);
}

.fold-body {
  padding: 0 14px 14px;
}

.fold:not(.open) .fold-body {
  display: none;
}

.fold-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-left: auto;
  padding-right: 2px;
}

.choice-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

/* 三个选项时，最后一个（通常是「无法判断」）独占一行，避免出现半格空位 */
.choice-group > .choice:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.choice {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  min-height: 38px;
  padding: 5px 10px;
  border: 0.5px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12.5px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

/* 勾选图标常驻占位，选中时只切透明度，避免文字左右跳动 */
.choice .tick {
  font-size: 13px;
  flex: 0 0 auto;
  opacity: 0;
}

.choice[aria-pressed='true'] .tick {
  opacity: 1;
}

.choice:hover {
  background: var(--surface-1);
  color: var(--text-primary);
}

.choice[aria-pressed='true'] {
  background: var(--bg-accent);
  border-color: var(--accent);
  color: var(--text-accent);
}

.choice:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.choice i {
  font-size: 14px;
}

.action-bar {
  position: static;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-top: 14px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 12px;
}

.action-bar .bar-hint {
  flex: 1;
  min-width: 140px;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.page.has-bar {
  padding-bottom: 34px;
}

.roster {
  display: flex;
  flex-direction: column;
}

.roster-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 8px 12px;
  border: 0;
  border-top: 0.5px solid var(--border);
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.roster-row:first-child {
  border-top: 0;
}

.roster-row:hover {
  background: var(--surface-1);
}

.roster-row.is-current {
  background: var(--bg-accent);
}

.roster-row.is-current .roster-name {
  color: var(--text-accent);
}

.roster-body {
  flex: 1;
  min-width: 0;
}

.roster-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.roster-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roster-go {
  font-size: 15px;
  color: var(--text-muted);
  flex: 0 0 auto;
}

.id-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: 12px;
}

.id-strip .id-main {
  flex: 1;
  min-width: 0;
}

.id-strip .id-name {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.id-strip .id-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.id-strip .id-file {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  min-width: 0;
}

.id-strip .id-file i {
  font-size: 12px;
  flex: 0 0 auto;
}

.id-strip .id-file span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.id-strip .btn-sm {
  flex: 0 0 auto;
}

.kv {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 9px 12px;
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.kv dt {
  color: var(--text-muted);
}

.kv dd {
  margin: 0;
  color: var(--text-primary);
}

.practice-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
  align-items: start;
}

.practice-grid .full {
  grid-column: 1 / -1;
}

.minutes-field {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 9px;
  border: 0.5px solid var(--border);
  border-radius: 6px;
  background: var(--surface-0);
}

.minutes-field:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.minutes-field .fb-input {
  padding-right: 0;
  text-align: center;
}

.minutes-field .fb-input:hover,
.minutes-field .fb-input:focus {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.minutes-unit {
  font-size: 11.5px;
  color: var(--text-muted);
  flex: 0 0 auto;
}

.practice-preview {
  border: 0.5px solid var(--border-accent);
  background: var(--bg-accent);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-primary);
}

.practice-preview .t-xs {
  color: var(--text-accent);
}

@media (max-width: 900px) {
  .action-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    padding: 9px 14px calc(9px + env(safe-area-inset-bottom, 0px));
    gap: 7px;
  }
  .action-bar .bar-hint {
    display: none;
  }
  .action-bar .btn {
    flex: 1;
    min-height: 40px;
  }
  .page.has-bar {
    padding-bottom: 92px;
  }
  .id-strip {
    position: sticky;
    top: var(--topbar-h);
    z-index: 11;
    margin: -6px -16px 12px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 9px 16px;
  }
  .fold-head {
    min-height: 48px;
  }
  .practice-grid {
    grid-template-columns: minmax(0, 1fr) 92px;
  }
  /* ---- 触控目标下限 40px ---- */
  .btn {
    min-height: 40px;
  }
  .btn-sm {
    min-height: 36px;
  }
  .btn-icon {
    width: 40px;
    height: 40px;
  }
  .choice {
    min-height: 42px;
    font-size: 13px;
    padding: 6px 10px;
  }
  .input,
  .select,
  .textarea,
  input.input,
  select.select {
    min-height: 40px;
  }
  .nav-item {
    min-height: 44px;
  }
  .sidebar-foot .btn {
    min-height: 40px;
  }
  /* 表格在窄屏改为横向滚动，而不是把每格文字压成竖排 */
  .table {
    min-width: 600px;
  }
  .table th,
  .table td {
    padding: 10px 12px;
  }
  .table-wrap {
    -webkit-overflow-scrolling: touch;
    border: 0.5px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
  }
  /* 页头只有一个次要动作时，不要占满整行 */
  .page-actions {
    justify-content: flex-end;
  }
  .page-actions .btn:only-child {
    flex: 0 0 auto;
    padding: 0 14px;
  }
  /* 提示条让开吸底操作栏 */
  .toast-wrap {
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    transform: none;
    align-items: center;
  }
  .toast {
    max-width: 100%;
    font-size: 12.5px;
  }
}

.cap-bar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.cap-bar .bar-hint {
  flex: 0 0 auto;
  min-width: 0;
}

.bar-btns {
  display: flex;
  gap: 8px;
  width: 100%;
}

.bar-btns .btn {
  flex: 1;
  min-height: 38px;
}

@media (max-width: 900px) {
  .bar-btns .btn {
    min-height: 44px;
  }
  /* 卡片头部的独立文字操作，撑到 32px 便于点按；正文内联链接保持原样 */
  .card-head .link-btn,
  .card-actions .link-btn,
  .card-head > .t-xs:last-child {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
  }
}
