:root {
  --blue: #155eef;
  --blue-hover: #004eeb;
  --blue-light: #eff4ff;
  --blue-border: #c2d6ff;
  --ink: #101828;
  --ink-secondary: #344054;
  --muted: #667085;
  --subtle: #98a2b3;
  --line: #eaecf0;
  --border: #d0d5dd;
  --bg: #f4f7fb;
  --card: #ffffff;
  --surface: #f9fafb;
  --header-bg: rgba(255, 255, 255, 0.85);
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 2px 8px -2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 10px 28px -6px rgba(16, 24, 40, 0.1), 0 2px 6px -1px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 20px 44px -12px rgba(16, 24, 40, 0.18);
  --radius-sm: 9px;
  --radius-md: 14px;
  --radius-lg: 18px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

/* ====== 深色模式变量 ====== */
body.dark {
  --blue: #3b82f6;
  --blue-hover: #2563eb;
  --blue-light: rgba(59, 130, 246, 0.15);
  --blue-border: rgba(59, 130, 246, 0.35);
  --ink: #f2f4f7;
  --ink-secondary: #d0d5dd;
  --muted: #98a2b3;
  --subtle: #667085;
  --line: #1f2937;
  --border: #374151;
  --bg: #0b1120;
  --card: #111827;
  --surface: #1e293b;
  --header-bg: rgba(17, 24, 39, 0.85);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 12px 28px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100svh;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--bg);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  transition: background-color 0.2s ease, color 0.2s ease;
}

button, input, textarea, select {
  font: inherit;
  touch-action: manipulation;
  transition: all 0.18s ease;
}

button {
  cursor: pointer;
  min-height: 40px;
  user-select: none;
}

button:active:not(:disabled) {
  transform: scale(0.97);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--blue) !important;
  box-shadow: 0 0 0 3px rgba(21, 94, 239, 0.18);
}

.hide {
  display: none !important;
}

.muted, small {
  color: var(--muted);
}

small {
  font-size: 12px;
}

.blue {
  color: var(--blue);
  font-weight: 800;
  letter-spacing: 1.5px;
}

/* ====== 通用按钮 ====== */
.primary, .secondary {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.primary {
  background: linear-gradient(180deg, #2970ff 0%, var(--blue) 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(21, 94, 239, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #155eef 0%, var(--blue-hover) 100%);
  box-shadow: 0 4px 14px rgba(21, 94, 239, 0.35);
}

.primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--ink-secondary);
  box-shadow: var(--shadow-xs);
}

.secondary:hover {
  background: var(--surface);
}

.wide {
  width: 100%;
  padding: 13px;
  font-size: 15px;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, #3b82f6, #155eef);
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(21, 94, 239, 0.28), inset 0 1px 1px rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}

/* ====== 登录与注册页 ====== */
.auth {
  min-height: 100svh;
  background: var(--card);
  display: grid;
  grid-template-columns: 1.08fr 1fr;
}

.hero {
  background:
    radial-gradient(circle at 85% 15%, rgba(96, 165, 250, 0.38) 0%, transparent 45%),
    radial-gradient(circle at 12% 88%, rgba(30, 64, 175, 0.65) 0%, transparent 50%),
    linear-gradient(145deg, #0c2563 0%, #155eef 62%, #2e90fa 100%);
  color: #ffffff;
  padding: 9vh 8vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.hero-badge span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #b2ccff;
}

.hero h1 {
  font-size: 44px;
  letter-spacing: 2px;
  margin: 22px 0 10px;
  font-weight: 800;
}

.hero > p {
  color: #d1e0ff;
  font-size: 16px;
}

.hero-list {
  margin: 32px 0 48px;
  display: grid;
  gap: 14px;
  font-weight: 600;
  font-size: 15px;
}

.hero-list p {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 11px 16px;
  border-radius: 12px;
  backdrop-filter: blur(6px);
  max-width: 380px;
}

.hero-list p span {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
}

.hero small {
  color: #b2ccff;
  letter-spacing: 0.8px;
}

.authbox {
  width: min(420px, calc(100% - 40px));
  margin: auto;
  display: grid;
  gap: 18px;
  padding: 36px 0;
}

.authbox h2 {
  font-size: 26px;
  margin: 4px 0 0;
  letter-spacing: -0.3px;
}

.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.tabs button {
  background: none;
  border: 0;
  padding: 0 4px 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 15px;
  min-height: auto;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs .selected {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

label {
  display: grid;
  gap: 7px;
  font-weight: 600;
  color: var(--ink-secondary);
  font-size: 13px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group input {
  padding-right: 44px !important;
}

.icon-inside {
  position: absolute;
  right: 6px;
  background: transparent;
  border: 0;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 15px;
  display: grid;
  place-items: center;
}

.icon-inside:hover {
  background: var(--surface);
  color: var(--ink);
}

.authbox input,
#dialog input,
#dialog textarea,
#dialog select {
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 100%;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.authbox input::placeholder,
#dialog input::placeholder,
#dialog textarea::placeholder,
.toolbar input::placeholder,
.ask textarea::placeholder {
  color: var(--subtle);
}

.hint {
  font-size: 12px;
  color: var(--subtle);
  line-height: 1.7;
  text-align: center;
}

.mobile {
  display: none;
}

/* ====== Toast 全局提示 ====== */
.toast {
  position: fixed;
  z-index: 100;
  top: calc(18px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%) translateY(-14px);
  background: rgba(16, 24, 40, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(16, 24, 40, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ====== 侧边栏导航 ====== */
#sidebar {
  width: 246px;
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  padding-top: max(24px, env(safe-area-inset-top, 24px));
  padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
  display: flex;
  flex-direction: column;
  z-index: 30;
}

.sidebrand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px 28px;
}

.sidebrand > div:last-child {
  display: grid;
  gap: 2px;
}

.sidebrand b {
  font-size: 17px;
  letter-spacing: 0.5px;
}

.sidebrand small {
  font-size: 10px;
  letter-spacing: 1.2px;
  color: var(--subtle);
  font-weight: 600;
}

.navcaption {
  padding: 0 12px 8px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
}

.nav {
  border: 0;
  background: none;
  text-align: left;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  color: var(--ink-secondary);
  font-weight: 500;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav span {
  font-size: 16px;
  width: 22px;
  text-align: center;
}

.nav:hover {
  background: var(--surface);
  color: var(--ink);
}

.nav.active {
  background: var(--blue-light);
  color: var(--blue);
  font-weight: 700;
}

.nav-badge {
  margin-left: auto;
  background: #f04438;
  color: #ffffff;
  font-style: normal;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}

.sidebottom {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.sidebottom p {
  background: var(--blue-light);
  border: 1px solid var(--blue-border);
  padding: 12px 14px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.65;
  color: var(--blue);
}

.sidebottom p small {
  color: var(--muted);
  font-weight: 400;
}

.sidebottom button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  text-align: left;
  font-weight: 600;
}

.sidebottom button:hover {
  background: #fef3f2;
  color: #b42318;
}

/* ====== 主内容与顶栏 ====== */
main {
  margin-left: 246px;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

header {
  min-height: 70px;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 15;
  padding-top: env(safe-area-inset-top, 0px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* 桌面端默认隐藏汉堡菜单按钮 */
#menu {
  display: none;
}

header p {
  font-size: 12px;
  color: var(--subtle);
  margin: 2px 0 0;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-secondary);
  display: grid;
  place-items: center;
  font-size: 16px;
  box-shadow: var(--shadow-xs);
}

.icon-btn:hover {
  background: var(--blue-light);
  border-color: var(--blue-border);
  color: var(--blue);
}

.user {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 12px 4px 5px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.user > span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #3b82f6, #155eef);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
}

.user > div {
  display: grid;
  gap: 1px;
}

.user b {
  font-size: 13px;
  line-height: 1.2;
}

.user small {
  font-size: 11px;
  line-height: 1.2;
}

.wrap {
  width: 100%;
  max-width: 1280px;
  padding: 28px 32px 24px;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page {
  flex: 1;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ====== 页面头部与欢迎区 ====== */
.welcome, .pagehead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 0 0 22px;
}

.welcome h1, .page h1 {
  font-size: 26px;
  font-weight: 800;
  margin: 5px 0;
  letter-spacing: -0.3px;
}

.welcome p, .pagehead p {
  margin: 0;
  font-size: 13px;
}

.date {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: grid;
  gap: 4px;
  text-align: right;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.date b {
  font-size: 20px;
  color: var(--blue);
  font-weight: 800;
}

/* ====== 统计卡片 ====== */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.stats article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 4px 14px;
  align-items: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.clickable-card {
  cursor: pointer;
}

.stats article:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--blue-border);
}

.stats article span {
  grid-row: span 2;
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: var(--blue-light);
  color: var(--blue);
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
}

.stats article span.amber {
  background: #fffaeb;
  color: #dc6803;
}

.stats article span.green {
  background: #ecfdf3;
  color: #039855;
}

.stats article small {
  font-size: 12px;
  font-weight: 500;
}

.stats article b {
  font-size: 27px;
  font-weight: 800;
  line-height: 1.1;
}

/* ====== 面板与分栏 ====== */
.cols {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 20px;
  align-items: start;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 22px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}

.panel h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 3px;
}

.panelhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.panelhead > div {
  display: grid;
  gap: 2px;
}

.link {
  border: 0;
  background: var(--blue-light);
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 999px;
  min-height: auto;
}

.link:hover {
  background: var(--blue);
  color: #ffffff;
}

/* ====== 首页最新通知列表 ====== */
.notice-row {
  display: flex;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 15px 0;
}

.notice-row:first-child {
  border-top: 0;
  padding-top: 4px;
}

.notice-row:last-child {
  padding-bottom: 4px;
}

.bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  margin-top: 7px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--blue-light);
}

.notice-row h4 {
  margin: 0 0 5px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.notice-row p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
  margin: 0;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  font-size: 11px;
  color: var(--subtle);
  margin-top: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* ====== 快捷入口与高频胶囊 ====== */
.quick {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  padding: 12px 16px;
  margin-top: 10px;
  color: var(--ink-secondary);
  font-weight: 600;
  font-size: 13px;
}

.quick i {
  font-style: normal;
  transition: transform 0.18s ease;
}

.quick:hover {
  background: var(--blue-light);
  border-color: var(--blue-border);
  color: var(--blue);
}

.quick:hover i {
  transform: translateX(4px);
}

.quick-tags {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.mini-chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.mini-chips button {
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
}

.mini-chips button:hover {
  border-color: var(--blue-border);
  background: var(--blue-light);
  color: var(--blue);
}

.tip {
  background: var(--blue-light);
  border: 1px solid var(--blue-border);
  padding: 13px 14px;
  border-radius: 11px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--blue);
}

.tip p {
  color: var(--muted);
  line-height: 1.6;
  margin-top: 4px;
  margin-bottom: 0;
}

/* ====== 通知公告页 ====== */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 220px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-box input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 36px 10px 14px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.clear-btn {
  position: absolute;
  right: 8px;
  width: 26px;
  height: 26px;
  min-height: 26px;
  border-radius: 50%;
  border: 0;
  background: var(--line);
  color: var(--muted);
  font-size: 15px;
  display: grid;
  place-items: center;
}

.toolbar select,
.panelhead select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--card);
  color: var(--ink-secondary);
  font-weight: 500;
  max-width: 170px;
  box-shadow: var(--shadow-xs);
}

.cat-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.cat-pills::-webkit-scrollbar {
  display: none;
}

.pill-btn {
  min-height: 34px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pill-btn.active,
.pill-btn:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.stack {
  display: grid;
  gap: 14px;
}

.notice-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.notice-card:hover {
  border-color: var(--blue-border);
  box-shadow: var(--shadow-md);
}

.notice-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.tag {
  background: var(--blue-light);
  color: var(--blue);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.outline {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  min-height: 34px;
  box-shadow: var(--shadow-xs);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.outline:hover:not(:disabled) {
  background: var(--blue-light);
  border-color: var(--blue-border);
  color: var(--blue);
}

.outline.added {
  background: #ecfdf3;
  border-color: #abefc6;
  color: #027a48;
}

.ai-btn {
  border: 1px solid #d9d6fe;
  background: #f4f3ff;
  color: #5925dc;
  border-radius: var(--radius-sm);
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  min-height: 34px;
}

.ai-btn:hover {
  background: #ebe9fe;
}

.notice-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 12px 0 8px;
  color: var(--ink);
}

.notice-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ====== 我的待办页 ====== */
.taskstats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.taskstats div {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 15px 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.taskstats b {
  display: block;
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
  margin-top: 4px;
}

.progress-card {
  padding: 15px 20px;
  margin-bottom: 16px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.progress-head b {
  color: var(--blue);
}

.progress-track {
  height: 8px;
  background: var(--surface);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #2970ff, #039855);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.task-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.mini-input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  background: var(--card);
  color: var(--ink);
  font-size: 12px;
  width: 170px;
}

.taskrow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 6px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
  border-radius: 8px;
}

.taskrow:first-child {
  border-top: 0;
}

.taskrow:hover {
  background: var(--surface);
}

.taskrow input[type="checkbox"] {
  accent-color: var(--blue);
  width: 19px;
  height: 19px;
  cursor: pointer;
  flex-shrink: 0;
}

.tasktext {
  flex: 1;
  min-width: 160px;
}

.tasktext b {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 3px;
  color: var(--ink);
}

.tasktext small {
  font-size: 11px;
}

.taskrow.done .tasktext b {
  text-decoration: line-through;
  color: var(--subtle);
}

.taskrow.done .tag {
  background: #ecfdf3;
  color: #027a48;
}

.pill {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.pill.ready {
  background: #ecfdf3;
  color: #027a48;
  border-color: #abefc6;
}

/* ====== 文理智办（AI 聊天） ====== */
.chat {
  max-width: 980px;
  display: flex;
  flex-direction: column;
}

.chatintro {
  display: flex;
  gap: 14px;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.chatintro p {
  font-size: 12px;
  margin-top: 2px;
}

.aiicon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f4f3ff 0%, #ebe9fe 100%);
  color: #6938ef;
  display: grid;
  place-items: center;
  font-size: 22px;
  flex-shrink: 0;
  border: 1px solid #d9d6fe;
}

.ai-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 14px;
  margin: 12px 0 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
}

.ai-options label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 12px;
  min-height: 34px;
}

.ai-options select {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  background: var(--card);
  color: var(--ink-secondary);
  font-size: 12px;
  max-width: 240px;
}

.ai-options input[type="checkbox"] {
  accent-color: var(--blue);
  width: 16px;
  height: 16px;
}

.ai-sources {
  padding: 10px 14px;
  background: var(--blue-light);
  border: 1px solid var(--blue-border);
  border-radius: 10px;
  line-height: 1.7;
  justify-self: start;
  max-width: 90%;
  font-size: 12px;
}

.ai-sources b {
  display: block;
  margin-bottom: 4px;
  color: var(--blue);
}

.ai-sources a {
  color: var(--blue);
  word-break: break-all;
  text-decoration: none;
}

.ai-sources a:hover {
  text-decoration: underline;
}

.suggestions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0 12px;
}

.suggestions button {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12px;
  color: var(--ink-secondary);
  min-height: 32px;
  box-shadow: var(--shadow-xs);
}

.suggestions button:hover {
  border-color: var(--blue-border);
  background: var(--blue-light);
  color: var(--blue);
}

.messages {
  min-height: 240px;
  max-height: 50vh;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  padding: 18px 4px;
  display: grid;
  align-content: start;
  gap: 14px;
  overscroll-behavior: contain;
}

.bubble-wrap {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.bubble-wrap.user {
  justify-items: end;
}

.bubble {
  justify-self: start;
  max-width: 88%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 4px 15px 15px 15px;
  padding: 13px 16px;
  font-size: 13.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow-xs);
}

.bubble.user,
.bubble.msg-user {
  justify-self: end;
  background: linear-gradient(135deg, #2970ff 0%, var(--blue) 100%);
  border: 0;
  color: #ffffff !important;
  border-radius: 15px 4px 15px 15px;
  box-shadow: 0 3px 10px rgba(21, 94, 239, 0.22);
  display: block !important;
}


.bubble-tools {
  display: flex;
  gap: 6px;
}

.bubble-tools button {
  min-height: 26px;
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
}

.bubble-tools button:hover {
  color: var(--blue);
  border-color: var(--blue-border);
}

.ask {
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  align-items: flex-end;
}

.ask textarea {
  flex: 1;
  min-height: 54px;
  max-height: 150px;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 11px 14px;
  resize: vertical;
  min-width: 0;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
}

.ask button {
  align-self: stretch;
  min-height: 46px;
  padding: 0 22px;
  flex-shrink: 0;
}

/* ====== 页脚 ====== */
footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--subtle);
  font-size: 11px;
  padding: 28px 2px 8px;
  margin-top: auto;
  flex-wrap: wrap;
}

/* ====== 移动端底部导航栏（桌面端隐藏） ====== */
.mobile-tabbar {
  display: none;
}

/* ====== 弹窗 Dialog ====== */
dialog {
  margin: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  width: min(560px, calc(100vw - 24px));
  max-height: 88svh;
  padding: 24px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(16, 24, 40, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

#noticeForm {
  display: grid;
  gap: 16px;
}

.dialoghead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.dialoghead h2 {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 800;
}

.dialoghead button {
  border: 0;
  background: var(--surface);
  color: var(--ink-secondary);
  border-radius: 8px;
  font-size: 20px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
}

.twocol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.check input {
  width: 17px !important;
  height: 17px !important;
  accent-color: var(--blue);
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 6px;
}

.taskrow select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  background: var(--card);
  color: var(--ink-secondary);
  font-weight: 500;
  max-width: 125px;
}

.empty {
  color: var(--subtle);
  text-align: center;
  padding: 36px 12px;
  font-size: 13px;
}

.notice-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.danger {
  border: 1px solid #fecdca !important;
  background: #ffffff !important;
  color: #b42318 !important;
  border-radius: var(--radius-sm);
  padding: 6px 12px !important;
  cursor: pointer;
  font-size: 12px !important;
  font-weight: 600;
  min-height: 34px;
}

.danger:hover:not(:disabled) {
  background: #fef3f2 !important;
  border-color: #f04438 !important;
}

.user-row {
  gap: 12px;
  flex-wrap: wrap;
}

.user-row .tasktext {
  flex: 1;
  min-width: 150px;
}

/* =========================================================
   平板与手机端响应式优化（小于 1000px）
   ========================================================= */
@media (max-width: 1000px) {
  /* 防止 iOS 点击输入框放大页面 */
  input, select, textarea {
    font-size: 16px !important;
  }

  /* 登录页移动端重构 */
  .auth {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    background: var(--bg);
  }

  .hero {
    display: flex;
    padding: 28px 20px 48px;
    text-align: center;
    align-items: center;
  }

  .hero h1 {
    font-size: 28px;
    margin: 10px 0 4px;
  }

  .hero > p {
    font-size: 13px;
  }

  .hero-list,
  .hero > small:last-child {
    display: none;
  }

  .authbox {
    width: min(440px, calc(100% - 28px));
    margin: -26px auto 28px;
    background: var(--card);
    padding: 24px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 2;
    gap: 15px;
  }

  .authbox h2 {
    font-size: 22px;
  }

  /* 侧边栏抽屉动效 */
  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: none;
    width: 260px;
  }

  #sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 0 100vmax rgba(16, 24, 40, 0.48), 12px 0 32px rgba(16, 24, 40, 0.22);
  }

  main {
    margin-left: 0;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  header {
    min-height: 60px;
    padding: 0 14px;
    padding-top: env(safe-area-inset-top, 0px);
    gap: 8px;
  }

  #menu {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    color: var(--ink);
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
  }

  header .user {
    padding: 3px;
    border: 0;
    background: transparent;
  }

  header .user > div {
    display: none;
  }


  .wrap {
    padding: 16px 14px 20px;
  }

  .welcome,
  .pagehead {
    align-items: flex-start;
    margin-bottom: 14px;
  }

  .welcome h1,
  .pagehead h1 {
    font-size: 21px;
  }

  .date {
    padding: 8px 12px;
  }

  .date b {
    font-size: 16px;
  }

  .cols {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* 统计卡片移动端紧凑排列 */
  .stats {
    gap: 9px;
    margin-bottom: 14px;
  }

  .stats article {
    padding: 12px 8px;
    grid-template-columns: 1fr;
    gap: 5px;
    text-align: center;
    justify-items: center;
  }

  .stats article span {
    grid-row: auto;
    width: 34px;
    height: 34px;
    font-size: 15px;
    border-radius: 9px;
  }

  .stats article small {
    font-size: 11px;
  }

  .stats article b {
    font-size: 20px;
  }

  .panel {
    padding: 15px;
  }

  .toolbar {
    gap: 8px;
  }

  .search-box {
    min-width: 0;
  }

  .toolbar select {
    max-width: 122px;
    font-size: 13px !important;
  }

  .task-controls {
    width: 100%;
  }

  .mini-input {
    flex: 1;
  }

  /* AI 助手选项栏 2x2 网格 */
  .ai-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
  }

  .ai-options label {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-height: auto;
  }

  .ai-options label.ai-toggle {
    flex-direction: row;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--line);
    padding: 7px 10px;
    border-radius: 8px;
    width: 100%;
  }

  .ai-options select {
    max-width: none;
    width: 100%;
    font-size: 13px !important;
  }

  .suggestions {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .suggestions::-webkit-scrollbar {
    display: none;
  }

  .suggestions button {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .messages {
    max-height: 44svh;
  }

  .bubble {
    max-width: 94%;
  }

  .twocol {
    grid-template-columns: 1fr;
  }

  footer {
    flex-direction: column;
    text-align: center;
    gap: 4px;
    padding-top: 16px;
  }

  /* 移动端底部常驻导航栏 */
  .mobile-tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(60px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    z-index: 25;
  }

  .tab-item {
    border: 0;
    background: transparent;
    color: var(--muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
    position: relative;
    min-height: auto;
  }

  .tab-item i {
    font-style: normal;
    font-size: 18px;
    line-height: 1.1;
  }

  .tab-item.active {
    color: var(--blue);
  }

  .mob-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 20px);
    background: #f04438;
    color: #ffffff;
    font-style: normal;
    font-size: 10px;
    font-weight: 700;
    padding: 0 5px;
    border-radius: 999px;
    min-width: 16px;
    text-align: center;
  }
}
/* ========================================================
   文理智办：移动端消息显形与防遮挡终极修复补丁
   ======================================================== */

/* 1. 彻底解决“气泡被吞”：无论此前怎么设置，强制显示用户发送的气泡 */
.bubble.user,
.bubble.msg-user,
.bubble-wrap.user,
.bubble-wrap.msg-user {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.bubble.user,
.bubble.msg-user {
  justify-self: end !important;
  background: linear-gradient(135deg, #2970ff 0%, #155eef 100%) !important;
  color: #ffffff !important;
  margin-left: auto !important;
  max-width: 88% !important;
}

/* 仅隐藏顶栏右侧的文字，绝不影响聊天气泡 */
header .user > div {
  display: none !important;
}

/* 2. 彻底解决“被底部栏挡住”：为消息滚动区域扩充空间并增加底部安全垫 */
.messages {
  min-height: 280px !important;
  max-height: 52vh !important;
  padding-bottom: 30px !important; /* 预留充足安全距离，防止滑入底部 */
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

/* 3. 手机端紧凑化处理：瘦身输入栏与选项栏，把屏幕高度还给聊天窗口 */
@media (max-width: 1000px) {
  .ai-options {
    padding: 8px 10px !important;
    gap: 6px !important;
  }
  .suggestions {
    margin: 6px 0 10px !important;
  }
  .ask {
    padding-top: 10px !important;
    gap: 8px !important;
  }
  .ask textarea {
    min-height: 44px !important;
    max-height: 90px !important;
    padding: 8px 12px !important;
  }
  .ask button {
    min-height: 44px !important;
    padding: 0 16px !important;
  }
}
/* ========================================================
   跨浏览器（Safari / 微信 / 移动端浏览器）兼容性修复
   ======================================================== */

/* 1. 彻底解决 WebKit 宽度塌陷：锁死 100% 宽度，改用全平台通用的 Flex 布局 */
.bubble-wrap {
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  box-sizing: border-box !important;
}

/* 用户消息：靠右侧对齐 */
.bubble-wrap.msg-user,
.bubble-wrap.user {
  align-items: flex-end !important;
}

/* AI 消息：靠左侧对齐 */
.bubble-wrap.msg-ai {
  align-items: flex-start !important;
}

/* 2. 气泡本体加固：杜绝宽度被压成 0，保证文字必然显示 */
.bubble {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  max-width: 85% !important;
  min-width: 32px !important;
  box-sizing: border-box !important;
  word-break: break-word !important;
  overflow-wrap: break-word !important;
}

.bubble.msg-user,
.bubble.user {
  background: linear-gradient(135deg, #2970ff 0%, #155eef 100%) !important;
  color: #ffffff !important;
}

/* 3. 防止顶栏样式误伤聊天容器 */
header .user > div {
  display: none !important;
}
