:root {
  --primary: var(--u2-accent);
  --primary-light: var(--brand-teal);
  --primary-dark: var(--u2-accent-hover);
  --secondary: var(--brand-teal);
  --accent: var(--brand-yellow);
  --success: var(--u2-success);
  --danger: var(--u2-danger);
  --bg: var(--u2-bg);
  --bg-card: var(--u2-surface);
  --bg-sidebar: var(--u2-surface);
  --text: var(--u2-fg);
  --text-secondary: var(--u2-muted);
  --text-on-dark: var(--u2-fg);
  --border: var(--u2-border);
  --shadow: none;
  --shadow-lg: var(--u2-shadow-dialog);
  --shadow-glow: none;
  --radius: var(--u2-radius-panel);
  --radius-sm: var(--u2-radius-control);
  --sidebar-w: 220px;
  --transition: var(--u2-transition);
  color-scheme: light;
}

body,
body.light-mode {
  background: var(--u2-bg);
  color: var(--u2-fg);
  font-family: var(--u2-sans);
  color-scheme: light;
}

.shell { width: 100%; min-width: 0; }
.shell-main { width: calc(100% - var(--sidebar-w)); min-width: 0; }

.shell-sidebar {
  background: var(--u2-surface);
  border-right: 1px solid var(--u2-border);
  box-shadow: none;
}

.sidebar-brand {
  min-height: 64px;
  padding: 14px 18px;
  border-color: var(--u2-border);
}

.brand-logo,
.brand-logo img { display: block; width: 36px; height: 36px; }
.brand-name {
  color: var(--u2-fg);
  background: none;
  -webkit-text-fill-color: currentColor;
  font-size: 16px;
  letter-spacing: 0;
}

.nav-section-title {
  color: var(--u2-muted);
  text-transform: none;
  letter-spacing: 0;
  font-size: 11px;
}

.nav-item {
  min-height: 44px;
  color: var(--u2-muted);
  border: 1px solid transparent;
  border-radius: var(--u2-radius-control);
}
.nav-item:hover { color: var(--u2-fg); background: oklch(94% 0.01 285); }
.nav-item.active {
  color: var(--u2-accent);
  background: oklch(94% 0.018 250);
  border-color: oklch(86% 0.025 250);
  box-shadow: none;
}
.nav-item.active::before { display: none; }
.sidebar-footer { border-color: var(--u2-border); }
.sidebar-footer a { min-height: 36px; color: var(--u2-muted); }
body[data-role="user"] .admin-only,
body[data-role="teacher"] .admin-only { display: none !important; }

.shell-topbar {
  min-height: var(--topbar-h);
  background: color-mix(in oklch, var(--u2-surface) 96%, transparent);
  border-color: var(--u2-border);
  backdrop-filter: blur(12px);
}
.search-box,
.topbar-btn,
.user-menu {
  color: var(--u2-muted) !important;
  background: var(--u2-surface) !important;
  border-color: var(--u2-border) !important;
  box-shadow: none !important;
}
.search-box input { color: var(--u2-fg); }
.search-box input::placeholder { color: var(--u2-muted); opacity: 1; }
.topbar-btn[title="通知"],
.topbar-btn[title="夜间模式"] { display: none; }

.shell-content {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 36px 28px 72px;
}

.welcome-section {
  padding: 0 0 28px;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.workbench-heading,
.task-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.workbench-all-link,
.text-action { min-height: 40px; display: inline-flex; align-items: center; color: var(--u2-accent); font-weight: 700; font-size: 13px; }
.text-action { border: 0; background: transparent; }
.welcome-greeting { color: var(--u2-fg); font-size: 24px; letter-spacing: -0.02em; }
.welcome-sub { color: var(--u2-muted); }
.quick-stats {
  gap: 0;
  margin-top: 22px;
  overflow: hidden;
  background: var(--u2-surface);
  border: 1px solid var(--u2-border);
  border-radius: var(--u2-radius-panel);
}
.stat-card {
  min-width: 0;
  margin: 0;
  border: 0;
  border-right: 1px solid var(--u2-border);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.stat-card:last-child { border-right: 0; }
.stat-card:hover { transform: none; box-shadow: none; }
.stat-num { color: var(--u2-fg); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; }
.stat-label { color: var(--u2-muted); }
.stat-icon { background: oklch(94% 0.018 250) !important; color: var(--u2-accent) !important; }
.skeleton-text,
.task-skeleton { background: oklch(92% 0.008 285); color: transparent; }
.skeleton-text { width: 52px; height: 24px; border-radius: 6px; }

.task-section { margin-bottom: 28px; }
.task-section-head { margin-bottom: 14px; }
.task-section-head h2 { margin: 0 0 4px; color: var(--u2-fg); font-size: 18px; }
.task-section-head p,
.section-copy { margin: 0; color: var(--u2-muted); font-size: 13px; }
.task-list { overflow: hidden; border: 1px solid var(--u2-border); border-radius: var(--u2-radius-panel); background: var(--u2-surface); }
.task-item { display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 14px 18px; border-bottom: 1px solid var(--u2-border); }
.task-item:last-child { border-bottom: 0; }
.task-item:hover { background: oklch(98.5% 0.004 285); }
.task-marker { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; background: oklch(94% 0.018 250); color: var(--u2-accent); }
.task-copy { min-width: 0; flex: 1; }
.task-title { color: var(--u2-fg); font-weight: 700; }
.task-meta { margin-top: 2px; color: var(--u2-muted); font-size: 12.5px; }
.task-link { min-height: 40px; display: inline-flex; align-items: center; color: var(--u2-accent); font-size: 13px; font-weight: 700; white-space: nowrap; }
.task-empty { padding: 26px 18px; color: var(--u2-muted); text-align: center; }
.task-skeleton { height: 72px; border-bottom: 1px solid var(--u2-border); opacity: .55; }
.task-skeleton:last-child { border-bottom: 0; }

.gateway-grid { max-width: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.gw-card {
  min-height: 122px;
  border: 1px solid var(--u2-border);
  border-radius: var(--u2-radius-panel);
  background: var(--u2-surface);
  box-shadow: none;
}
.gw-card::before,
.gw-light { display: none; }
.gw-card:hover { transform: translateY(-2px); border-color: var(--u2-accent); box-shadow: 0 6px 8px oklch(22% 0.025 285 / 0.08); }
.gw-name { color: var(--u2-fg); }
.gw-desc { color: var(--u2-muted); }
.gw-arrow { color: var(--u2-accent); }
.gw-icon { background: oklch(94% 0.018 250) !important; color: var(--u2-accent) !important; }
.gw-card.courses .gw-icon { background: oklch(94% 0.018 160) !important; color: var(--u2-success) !important; }

.feed-section {
  border: 1px solid var(--u2-border);
  border-radius: var(--u2-radius-panel);
  background: var(--u2-surface);
  box-shadow: none;
}
.section-header { border-color: var(--u2-border); }
.section-title { color: var(--u2-fg); }
.tab { color: var(--u2-muted); }
.tab.active { color: var(--u2-accent); background: oklch(94% 0.018 250); }
.feed-card,
.post-card {
  background: var(--u2-surface) !important;
  border-color: var(--u2-border) !important;
  box-shadow: none !important;
}

.btn,
.sh-btn,
button { border-radius: var(--u2-radius-control); box-shadow: none !important; }
.btn1,
.sh-btn-pri { background: var(--u2-accent) !important; color: #fff !important; }
input,
textarea,
select {
  color: var(--u2-fg);
  background: var(--u2-surface);
  border-color: var(--u2-border);
  border-radius: var(--u2-radius-control);
}

.modal-overlay { z-index: var(--u2-z-backdrop); background: oklch(18% 0.02 285 / 0.45); backdrop-filter: none; }
.modal { border: 0; border-radius: var(--u2-radius-panel); background: var(--u2-surface); box-shadow: var(--u2-shadow-dialog); }
.toast { z-index: var(--u2-z-toast); }
.fab { background: var(--u2-accent); box-shadow: 0 4px 8px oklch(22% 0.025 285 / 0.18); }
.shell-footer { color: var(--u2-muted); border-color: var(--u2-border); background: var(--u2-bg); }
.shell-footer a { color: var(--u2-muted); }

@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .shell-main { width: 100%; min-width: 0; margin-left: 0; }
  .shell-content { padding: 28px 18px 80px; }
  .gateway-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .shell-topbar { padding: 0 14px; }
  .search-box { display: none; }
  .topbar-right { margin-left: auto; }
  .user-name { display: none; }
  .shell-content { padding: 22px 14px 84px; }
  .welcome-greeting { font-size: 21px; }
  .workbench-heading,
  .task-section-head { align-items: stretch; flex-direction: column; gap: 8px; }
  .workbench-all-link { align-self: flex-start; }
  .quick-stats { display: grid; grid-template-columns: 1fr; }
  .stat-card { border-right: 0; border-bottom: 1px solid var(--u2-border); }
  .stat-card:last-child { border-bottom: 0; }
  .gw-card { min-width: 0; padding: 18px 16px; }
  .gw-desc { overflow-wrap: anywhere; }
  .task-item { align-items: flex-start; padding: 14px; }
  .task-link { align-self: center; }
  .section-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .section-title { width: 100%; }
  .section-header .tabs { width: 100%; overflow: visible; }
  .section-header .tab { flex: 1 1 0; min-height: 40px; padding: 8px 10px; justify-content: center; white-space: nowrap; }
  .shell-footer { gap: 10px; }
  .shell-footer > span { min-width: 0; overflow-wrap: anywhere; }
}

@media (prefers-reduced-motion: reduce) {
  .gw-card:hover { transform: none; }
}
