/* ============================================================
   远驰云校 · 培训管理平台 — Design System v1.0
   Material 3 色彩 / Apple HIG 8pt 间距 / Pinterest 留白美学
   ============================================================ */

:root {
  /* ---- Brand & Tonal Palette ---- */
  --primary: #1F3A5F;
  --primary-600: #2A4C79;
  --primary-400: #5B7CA5;
  --primary-100: #E7EDF5;
  --primary-50: #F2F6FB;

  --accent: #E8623C;
  --accent-600: #D14E29;
  --accent-100: #FFE9E0;
  --accent-50: #FFF5F0;

  --success: #2E7D6B;
  --success-100: #DFF1EB;
  --warning: #C9862B;
  --warning-100: #FBEBD2;
  --danger: #C0392B;
  --danger-100: #F9E3E0;
  --info: #3B6FC4;
  --info-100: #E4EDFB;
  --violet: #7459C7;
  --violet-100: #EEE9FA;
  --teal: #178B92;
  --teal-100: #DDF2F2;

  /* ---- Neutral / Surface ---- */
  --bg: #F7F6F3;
  --surface: #FFFFFF;
  --surface-variant: #F2F1ED;
  --surface-sunken: #FBFBF9;
  --outline: #E4E2DC;
  --outline-strong: #CFCCC3;
  --text: #1C2430;
  --text-2: #4A5563;
  --text-muted: #838B97;
  --text-faint: #A8AEB7;
  --on-primary: #FFFFFF;

  /* ---- Spacing (8pt grid) ---- */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;
  --s12: 48px; --s16: 64px;

  /* ---- Radius ---- */
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 22px; --r-pill: 999px;

  /* ---- Elevation (restrained, 2 layers max) ---- */
  --shadow-1: 0 1px 2px rgba(28,36,48,.05), 0 2px 8px rgba(28,36,48,.04);
  --shadow-2: 0 2px 6px rgba(28,36,48,.06), 0 12px 32px rgba(28,36,48,.09);
  --shadow-3: 0 8px 24px rgba(28,36,48,.10), 0 24px 64px rgba(28,36,48,.12);

  /* ---- Typography ---- */
  --font-display: 'Outfit', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-num: 'Outfit', 'Noto Sans SC', sans-serif;
  --f-display: clamp(30px, 3.6vw, 44px)/1.14 var(--font-display);
  --f-h1: clamp(24px, 2.6vw, 32px)/1.25 var(--font-display);
  --f-h2: clamp(19px, 2vw, 23px)/1.3 var(--font-display);
  --f-h3: 16px/1.45 var(--font-display);
  --f-body: 14px/1.6 var(--font-body);
  --f-body-lg: 16px/1.6 var(--font-body);
  --f-label: 12px/1.5 var(--font-body);
  --f-small: 12.5px/1.5 var(--font-body);

  /* ---- Motion ---- */
  --ease-standard: cubic-bezier(.2, 0, 0, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-decel: cubic-bezier(0, 0, .2, 1);
  --d-fast: 150ms; --d-base: 220ms; --d-slow: 360ms;

  --sidebar-w: 240px;
  --topbar-h: 68px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: var(--f-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; }
svg { display: block; }
::selection { background: var(--accent-100); color: var(--primary); }

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

/* Scrollbars */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #D9D7D0; border-radius: 9px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #BFBCB2; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================ Boot ============================ */
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; }
.boot-mark {
  width: 54px; height: 54px; border-radius: 16px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font: 600 26px/1 var(--font-display); letter-spacing: .02em;
  box-shadow: var(--shadow-2);
}
.boot-name { font: 600 17px/1.4 var(--font-display); letter-spacing: .16em; color: var(--primary); }
.boot-line { width: 120px; height: 3px; border-radius: 3px; background: var(--primary-100); overflow: hidden; }
.boot-line i { display: block; width: 40%; height: 100%; background: var(--accent); border-radius: 3px; animation: bootSlide 1.1s var(--ease-standard) infinite; }
@keyframes bootSlide { 0% { transform: translateX(-100%); } 100% { transform: translateX(320%); } }

/* ============================ Login ============================ */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.08fr .92fr; background: var(--surface); }
.login-visual {
  position: relative; overflow: hidden; padding: clamp(32px, 4.4vw, 64px);
  background: var(--primary); color: #fff; display: flex; flex-direction: column; justify-content: space-between;
  isolation: isolate;
}
.login-visual::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(720px 520px at 88% 12%, rgba(232,98,60,.30), transparent 62%),
    radial-gradient(560px 560px at 8% 88%, rgba(91,124,165,.35), transparent 62%);
}
.login-visual::after {
  content: ''; position: absolute; z-index: -1; right: -140px; bottom: -180px;
  width: 560px; height: 560px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.10); box-shadow: 0 0 0 70px rgba(255,255,255,.035), 0 0 0 150px rgba(255,255,255,.025);
}
.brand-row { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font: 700 22px/1 var(--font-display); box-shadow: 0 6px 20px rgba(232,98,60,.34);
}
.brand-name { font: 600 18px/1.3 var(--font-display); letter-spacing: .06em; }
.brand-sub { font: 500 10px/1.5 var(--font-display); letter-spacing: .22em; color: rgba(255,255,255,.55); margin-top: 2px; }
.login-hero { max-width: 560px; }
.login-hero .eyebrow { font: 600 11px/1 var(--font-display); letter-spacing: .24em; color: var(--accent); margin-bottom: 22px; text-transform: uppercase; }
.login-hero h1 { font: 600 clamp(34px, 3.6vw, 52px)/1.22 var(--font-display); letter-spacing: -.02em; margin: 0 0 22px; }
.login-hero h1 em { font-style: normal; color: #FFB79F; }
.login-hero p { font: 400 15px/1.9 var(--font-body); color: rgba(255,255,255,.72); max-width: 470px; margin: 0 0 34px; }
.login-features { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.login-feature { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; color: rgba(255,255,255,.86); }
.login-feature i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.login-stats { display: flex; gap: clamp(20px, 3vw, 44px); margin-top: 40px; padding-top: 28px; border-top: 1px solid rgba(255,255,255,.14); }
.login-stat strong { display: block; font: 600 28px/1.2 var(--font-num); letter-spacing: -.02em; }
.login-stat span { font-size: 12px; color: rgba(255,255,255,.58); }
.login-foot { display: flex; justify-content: space-between; gap: 16px; font-size: 11.5px; color: rgba(255,255,255,.45); }

.login-form-side { display: flex; align-items: center; justify-content: center; padding: clamp(24px, 4vw, 56px); background: var(--surface); }
.login-card { width: min(100%, 396px); animation: rise .5s var(--ease-decel) both; }
.login-card h2 { font: 600 28px/1.3 var(--font-display); margin: 0 0 8px; letter-spacing: -.02em; }
.login-hint { color: var(--text-muted); font-size: 13.5px; margin: 0 0 30px; }
.login-error { display: none; padding: 11px 14px; border-radius: var(--r-sm); background: var(--danger-100); color: var(--danger); font-size: 13px; margin-bottom: 18px; }
.login-error.show { display: block; animation: shake .32s var(--ease-standard); }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-form .input { height: 50px; }
.login-submit { height: 48px; font-size: 15px; margin-top: 8px; }
.demo-accounts { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--outline); }
.demo-accounts-title { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.demo-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-chip { padding: 7px 12px; border-radius: var(--r-pill); border: 1px solid var(--outline); font-size: 12px; color: var(--text-2); transition: all var(--d-fast) var(--ease-standard); }
.demo-chip:hover { border-color: var(--primary-400); color: var(--primary); background: var(--primary-50); transform: translateY(-1px); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%,100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* ============================ Shell ============================ */
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); position: fixed; inset: 0 auto 0 0; z-index: 40;
  background: var(--surface); border-right: 1px solid var(--outline);
  display: flex; flex-direction: column; padding: 22px 14px 14px;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; }
.sidebar-brand .brand-mark { width: 38px; height: 38px; border-radius: 11px; font-size: 19px; }
.sidebar-brand .brand-name { color: var(--primary); font-size: 16px; }
.sidebar-brand .brand-sub { color: var(--text-faint); font-size: 9px; letter-spacing: .16em; }
.sidebar-nav { flex: 1; overflow-y: auto; padding-bottom: 16px; }
.nav-group { margin-bottom: 20px; }
.nav-group-title { padding: 0 12px 8px; font: 600 10px/1 var(--font-display); letter-spacing: .18em; color: var(--text-faint); text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 42px; padding: 0 12px;
  border-radius: 10px; color: var(--text-2); font-size: 13.5px; font-weight: 500;
  transition: background var(--d-fast) var(--ease-standard), color var(--d-fast) var(--ease-standard), transform var(--d-fast) var(--ease-standard);
  position: relative;
}
.nav-item svg { flex: 0 0 auto; opacity: .78; }
.nav-item:hover { background: var(--surface-variant); color: var(--primary); }
.nav-item.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.nav-item.active::before { content: ''; position: absolute; left: 0; top: 11px; bottom: 11px; width: 3px; border-radius: 3px; background: var(--accent); }
.nav-item.active svg { opacity: 1; color: var(--accent); }
.nav-item .nav-count { margin-left: auto; font: 600 11px/1 var(--font-num); background: var(--accent-100); color: var(--accent-600); padding: 4px 7px; border-radius: var(--r-pill); }
.sidebar-foot { border-top: 1px solid var(--outline); padding-top: 12px; }
.school-mini { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--surface-variant); }
.school-mini .school-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--primary-100); color: var(--primary); display: grid; place-items: center; flex: 0 0 auto; }
.school-mini b { display: block; font-size: 12px; font-weight: 600; }
.school-mini span { font-size: 10.5px; color: var(--text-muted); }

.main-wrap { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h); position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.88); backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--outline); display: flex; align-items: center; gap: 16px; padding: 0 clamp(18px, 2.6vw, 36px);
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-title { font: 600 16px/1.3 var(--font-display); white-space: nowrap; }
.topbar-crumb { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.topbar-crumb::before { content: '/'; margin: 0 9px; color: var(--outline-strong); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.menu-toggle { display: none; width: 38px; height: 38px; border-radius: 9px; place-items: center; color: var(--text-2); }
.menu-toggle:hover { background: var(--surface-variant); }
.month-switch { display: flex; align-items: center; gap: 4px; background: var(--surface-variant); padding: 4px; border-radius: 10px; }
.month-switch button { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; color: var(--text-2); transition: background var(--d-fast); }
.month-switch button:hover { background: var(--surface); color: var(--primary); }
.month-switch b { min-width: 92px; text-align: center; font: 600 12.5px/1 var(--font-num); letter-spacing: .02em; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--text-2); transition: all var(--d-fast) var(--ease-standard); position: relative; }
.icon-btn:hover { background: var(--surface-variant); color: var(--primary); transform: translateY(-1px); }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 7px; height: 7px; background: var(--accent); border-radius: 50%; border: 2px solid var(--surface); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 10px 5px 5px; border-radius: var(--r-pill); border: 1px solid var(--outline); transition: all var(--d-fast); }
.user-chip:hover { background: var(--surface-variant); border-color: var(--outline-strong); }
.user-chip .avatar { width: 28px; height: 28px; font-size: 11px; }
.user-chip b { font-size: 12.5px; font-weight: 600; }
.user-chip small { display: block; font-size: 10px; color: var(--text-muted); line-height: 1.2; }

.page { padding: clamp(20px, 2.6vw, 34px) clamp(18px, 2.6vw, 36px) 60px; max-width: 1560px; width: 100%; margin: 0 auto; animation: pageIn .34s var(--ease-decel) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 26px; }
.page-title { font: var(--f-h1); font-weight: 600; letter-spacing: -.02em; margin: 0 0 6px; }
.page-sub { color: var(--text-muted); font-size: 13.5px; margin: 0; max-width: 720px; line-height: 1.7; }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stagger > * { animation: rise .42s var(--ease-decel) both; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .06s; }
.stagger > *:nth-child(3) { animation-delay: .10s; }
.stagger > *:nth-child(4) { animation-delay: .14s; }
.stagger > *:nth-child(5) { animation-delay: .18s; }
.stagger > *:nth-child(6) { animation-delay: .22s; }

/* ============================ Grid / Card ============================ */
.grid { display: grid; gap: 18px; }
.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-side { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.span-2 { grid-column: span 2; }
.card {
  background: var(--surface); border: 1px solid var(--outline); border-radius: var(--r-md);
  box-shadow: var(--shadow-1); transition: box-shadow var(--d-base) var(--ease-standard), transform var(--d-base) var(--ease-standard);
  min-width: 0;
}
.card.hoverable:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--outline); }
.card-head.no-border { border-bottom: 0; padding-bottom: 8px; }
.card-title { font: 600 15px/1.4 var(--font-display); margin: 0; display: flex; align-items: center; gap: 9px; }
.card-title .title-mark { width: 3px; height: 15px; border-radius: 2px; background: var(--accent); }
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.card-body { padding: 20px 24px; }
.card-foot { padding: 14px 24px; border-top: 1px solid var(--outline); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-flat { background: var(--surface-variant); border: 0; box-shadow: none; }
.section-title { font: 600 16px/1.4 var(--font-display); margin: 0 0 14px; }
.divider { height: 1px; background: var(--outline); margin: 18px 0; }

/* ============================ KPI ============================ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.kpi-grid.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1360px) { .kpi-grid.six { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .kpi-grid.six { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi {
  background: var(--surface); border: 1px solid var(--outline); border-radius: var(--r-md); padding: 20px 22px;
  box-shadow: var(--shadow-1); position: relative; overflow: hidden;
  transition: box-shadow var(--d-base) var(--ease-standard), transform var(--d-base) var(--ease-standard);
}
.kpi:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
.kpi::after { content: ''; position: absolute; left: 0; top: 0; width: 100%; height: 3px; background: var(--kpi-color, var(--primary)); opacity: .85; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--kpi-bg, var(--primary-50)); color: var(--kpi-color, var(--primary)); }
.kpi-value { font: 600 clamp(25px, 2.4vw, 32px)/1.15 var(--font-num); letter-spacing: -.03em; margin: 14px 0 8px; }
.kpi-value .unit { font-size: 13px; font-weight: 500; color: var(--text-muted); margin-left: 4px; letter-spacing: 0; }
.kpi-delta { font-size: 11.5px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.kpi-delta .up { color: var(--danger); font-weight: 600; }
.kpi-delta .down { color: var(--success); font-weight: 600; }
.kpi-delta .flat { color: var(--text-muted); }

/* ============================ Buttons ============================ */
.btn {
  height: 40px; padding: 0 16px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: all var(--d-fast) var(--ease-standard);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .48; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 2px 8px rgba(31,58,95,.16); }
.btn-primary:hover { background: var(--primary-600); box-shadow: 0 5px 16px rgba(31,58,95,.22); transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(232,98,60,.20); }
.btn-accent:hover { background: var(--accent-600); box-shadow: 0 5px 16px rgba(232,98,60,.28); transform: translateY(-1px); }
.btn-tonal { background: var(--primary-50); color: var(--primary); }
.btn-tonal:hover { background: var(--primary-100); }
.btn-outline { background: var(--surface); color: var(--text-2); border: 1px solid var(--outline-strong); }
.btn-outline:hover { border-color: var(--primary-400); color: var(--primary); background: var(--primary-50); }
.btn-text { color: var(--text-2); background: transparent; padding: 0 10px; }
.btn-text:hover { color: var(--primary); background: var(--surface-variant); }
.btn-danger { background: var(--danger-100); color: var(--danger); }
.btn-danger:hover { background: #F4D2CE; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 9px; color: var(--text-muted); }
.btn-icon:hover { background: var(--surface-variant); color: var(--primary); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-ghost-light { color: #fff; border: 1px solid rgba(255,255,255,.3); }
.btn-ghost-light:hover { background: rgba(255,255,255,.12); }

/* ============================ Badge / Chip / Tag ============================ */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 600; line-height: 1.55; white-space: nowrap; }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.no-dot::before { display: none; }
.badge-gray { background: #F0EFEC; color: #6F7783; }
.badge-blue { background: var(--info-100); color: var(--info); }
.badge-green { background: var(--success-100); color: var(--success); }
.badge-amber { background: var(--warning-100); color: var(--warning); }
.badge-red { background: var(--danger-100); color: var(--danger); }
.badge-orange { background: var(--accent-100); color: var(--accent-600); }
.badge-violet { background: var(--violet-100); color: var(--violet); }
.badge-teal { background: var(--teal-100); color: var(--teal); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: var(--r-pill); background: var(--surface-variant); color: var(--text-2); font-size: 12.5px; font-weight: 500; border: 1px solid transparent; transition: all var(--d-fast) var(--ease-standard); }
.chip:hover { border-color: var(--outline-strong); color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11px; background: var(--surface-variant); color: var(--text-2); margin: 2px 4px 2px 0; }
.tag-orange { background: var(--accent-100); color: var(--accent-600); }

/* ============================ Forms ============================ */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field > label .req { color: var(--accent); margin-left: 3px; }
.field-hint { font-size: 11.5px; color: var(--text-muted); }
.input, .select, .textarea {
  width: 100%; min-height: 42px; padding: 10px 13px; border-radius: 9px;
  border: 1.5px solid var(--outline); background: var(--surface); font-size: 13.5px;
  transition: border-color var(--d-fast) var(--ease-standard), box-shadow var(--d-fast) var(--ease-standard), background var(--d-fast);
  outline: none;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--outline-strong); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary-400); box-shadow: 0 0 0 3px rgba(91,124,165,.13); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.textarea { resize: vertical; min-height: 88px; line-height: 1.7; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23838B97' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.input[type=date], .input[type=datetime-local] { min-height: 42px; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.form-grid { display: flex; flex-direction: column; gap: 17px; }
.form-section-title { font: 600 12px/1 var(--font-display); letter-spacing: .1em; color: var(--text-muted); text-transform: uppercase; margin: 4px 0 -4px; }
.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-2); }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--primary); }

.search-box { position: relative; display: flex; align-items: center; }
.search-box svg { position: absolute; left: 12px; color: var(--text-faint); pointer-events: none; }
.search-box .input { padding-left: 36px; height: 38px; min-height: 38px; width: 220px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.toolbar .select { width: auto; min-width: 128px; height: 38px; min-height: 38px; padding-top: 7px; padding-bottom: 7px; }
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-variant); border-radius: 10px; gap: 2px; }
.segmented button { height: 32px; padding: 0 14px; border-radius: 8px; font-size: 12.5px; font-weight: 500; color: var(--text-muted); transition: all var(--d-fast) var(--ease-standard); }
.segmented button:hover { color: var(--primary); }
.segmented button.active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: var(--shadow-1); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--outline); margin-bottom: 20px; overflow-x: auto; }
.tab { padding: 11px 16px; font-size: 13.5px; font-weight: 500; color: var(--text-muted); border-bottom: 2px solid transparent; transition: all var(--d-fast); white-space: nowrap; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--accent); }
.tab .tab-count { margin-left: 6px; font: 600 11px/1 var(--font-num); background: var(--surface-variant); padding: 2px 6px; border-radius: var(--r-pill); }

/* ============================ Table ============================ */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; font-size: 13px; }
.table th {
  text-align: left; padding: 12px 14px; background: var(--surface-sunken); color: var(--text-muted);
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
  border-bottom: 1px solid var(--outline); position: sticky; top: 0; z-index: 1;
}
.table td { padding: 13px 14px; border-bottom: 1px solid #F0EFEB; vertical-align: middle; }
.table tbody tr { transition: background var(--d-fast); }
.table tbody tr:hover { background: var(--primary-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 600; color: var(--text); }
.table .sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.table .center { text-align: center; }
.table .right { text-align: right; }
.table .date-hot { color: var(--accent-600); font-weight: 600; font-family: var(--font-num); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.table-compact th, .table-compact td { padding: 9px 11px; }
.table tbody tr.row-group-start td { border-top: 2px solid var(--outline); }
.cell-note { font-size: 11.5px; color: var(--text-2); line-height: 1.6; }

/* ============================ Lists / Timeline ============================ */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid #F0EFEB; }
.list-item:last-child { border-bottom: 0; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; }
.list-item .li-extra { text-align: right; white-space: nowrap; }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font: 600 12px/1 var(--font-display); background: var(--primary-100); color: var(--primary); flex: 0 0 auto; }
.avatar-sm { width: 28px; height: 28px; font-size: 10.5px; border-radius: 8px; }
.avatar.warm { background: var(--accent-100); color: var(--accent-600); }
.avatar.green { background: var(--success-100); color: var(--success); }
.avatar.violet { background: var(--violet-100); color: var(--violet); }
.avatar.teal { background: var(--teal-100); color: var(--teal); }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 1.5px; background: var(--outline); }
.timeline-item { position: relative; padding: 0 0 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot { position: absolute; left: -23.5px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary-400); }
.timeline-item.hot .timeline-dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-100); }
.timeline-date { font: 600 11px/1 var(--font-num); color: var(--accent-600); letter-spacing: .03em; }
.timeline-title { font-size: 13.5px; font-weight: 600; margin-top: 6px; }
.timeline-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 3px; line-height: 1.6; }

.stat-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--outline); font-size: 13px; }
.stat-row:last-child { border-bottom: 0; }
.stat-label { color: var(--text-2); }
.stat-value { font: 600 14px/1 var(--font-num); }
.progress { height: 7px; background: var(--surface-variant); border-radius: var(--r-pill); overflow: hidden; }
.progress-bar { height: 100%; border-radius: var(--r-pill); background: var(--primary); transition: width .6s var(--ease-decel); }
.progress-bar.accent { background: var(--accent); }
.progress-bar.green { background: var(--success); }
.progress-bar.amber { background: var(--warning); }
.progress.thin { height: 5px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); }
.legend-item i { width: 9px; height: 9px; border-radius: 3px; }

/* ============================ Charts ============================ */
.chart-svg { width: 100%; height: auto; overflow: visible; }
.chart-svg text { font-family: var(--font-num); fill: var(--text-muted); }
.funnel { display: flex; flex-direction: column; gap: 9px; }
.funnel-step { position: relative; border-radius: 9px; padding: 11px 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #fff; font-size: 12.5px; transition: transform var(--d-fast); }
.funnel-step:hover { transform: translateX(3px); }
.funnel-step b { font: 600 16px/1 var(--font-num); }
.funnel-step .funnel-pct { opacity: .82; font-size: 11.5px; }
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }

/* ============================ Modal / Drawer ============================ */
.modal-backdrop, .drawer-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(24,32,44,.42); backdrop-filter: blur(3px); display: flex; animation: fadeIn .2s var(--ease-standard) both; }
.modal-backdrop { align-items: center; justify-content: center; padding: 20px; }
.drawer-backdrop { justify-content: flex-end; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(100%, 560px); max-height: min(88vh, 860px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3); animation: modalIn .28s var(--ease-spring) both; overflow: hidden; }
.modal.wide { width: min(100%, 780px); }
.modal.narrow { width: min(100%, 420px); }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-head { padding: 20px 24px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--outline); }
.modal-head h3 { font: 600 17px/1.4 var(--font-display); margin: 0 0 3px; }
.modal-head p { font-size: 12px; color: var(--text-muted); margin: 0; }
.modal-body { padding: 22px 24px; overflow-y: auto; flex: 1; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--outline); display: flex; align-items: center; justify-content: flex-end; gap: 10px; background: var(--surface-sunken); }
.drawer { width: min(100%, 480px); height: 100%; background: var(--surface); display: flex; flex-direction: column; box-shadow: var(--shadow-3); animation: drawerIn .3s var(--ease-decel) both; }
@keyframes drawerIn { from { transform: translateX(100%); } to { transform: none; } }
.drawer-head { padding: 22px 24px 18px; border-bottom: 1px solid var(--outline); display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 24px; }
.drawer-foot { padding: 16px 24px; border-top: 1px solid var(--outline); display: flex; gap: 10px; justify-content: flex-end; }

/* ============================ Toast / Empty / Skeleton ============================ */
.toast-stack { position: fixed; top: 20px; right: 20px; z-index: 120; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { min-width: 240px; max-width: 380px; padding: 13px 16px; border-radius: 11px; background: var(--surface); box-shadow: var(--shadow-3); border-left: 3px solid var(--primary); display: flex; align-items: center; gap: 10px; font-size: 13px; animation: toastIn .3s var(--ease-spring) both; pointer-events: auto; }
.toast.out { animation: toastOut .25s var(--ease-standard) both; }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 52px 20px; text-align: center; color: var(--text-muted); }
.empty-icon { width: 56px; height: 56px; border-radius: 17px; background: var(--surface-variant); display: grid; place-items: center; color: var(--text-faint); margin-bottom: 16px; }
.empty-title { font-size: 14px; font-weight: 600; color: var(--text-2); }
.empty-desc { font-size: 12.5px; margin-top: 6px; max-width: 320px; line-height: 1.7; }
.skeleton { background: linear-gradient(90deg, #F0EFEB 25%, #F7F6F3 50%, #F0EFEB 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; border-radius: 6px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ============================ Calendar ============================ */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; background: var(--outline); border: 1px solid var(--outline); border-radius: var(--r-md); overflow: hidden; }
.calendar-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface-sunken); border-bottom: 1px solid var(--outline); }
.calendar-head span { padding: 10px 4px; text-align: center; font-size: 11.5px; font-weight: 600; color: var(--text-muted); }
.calendar-cell { background: var(--surface); min-height: 96px; padding: 8px; }
.calendar-cell.outside { background: var(--surface-sunken); }
.calendar-cell.today { box-shadow: inset 0 0 0 2px var(--accent-100); }
.calendar-day { font: 600 12px/1 var(--font-num); color: var(--text-2); margin-bottom: 6px; display: flex; align-items: center; justify-content: space-between; }
.calendar-cell.today .calendar-day { color: var(--accent-600); }
.calendar-cell.outside .calendar-day { color: var(--text-faint); }
.calendar-event { display: block; width: 100%; text-align: left; padding: 4px 7px; border-radius: 5px; font-size: 10.5px; line-height: 1.45; margin-bottom: 4px; border-left: 2px solid; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: transform var(--d-fast); }
.calendar-event:hover { transform: translateX(2px); filter: brightness(.97); }

/* ============================ Plan sheet (print-friendly) ============================ */
.plan-table { width: 100%; font-size: 12px; border: 1px solid var(--outline-strong); }
.plan-table th { background: var(--primary-50); border: 1px solid var(--outline-strong); padding: 9px 8px; text-align: center; font-size: 11.5px; font-weight: 600; color: var(--primary); white-space: nowrap; }
.plan-table td { border: 1px solid var(--outline); padding: 8px; text-align: center; vertical-align: middle; }
.plan-table td.subject { font-weight: 600; text-align: center; background: var(--surface-sunken); white-space: nowrap; }
.plan-table td.hot { color: var(--accent-600); font-weight: 600; font-family: var(--font-num); }
.plan-table td.fee { color: var(--accent-600); font-weight: 700; font-family: var(--font-num); }
.plan-table td.note { text-align: left; font-size: 11px; line-height: 1.6; color: var(--text-2); }
.plan-table tr:hover td { background: var(--primary-50); }
.plan-caption { text-align: center; font: 600 18px/1.5 var(--font-display); margin: 0 0 4px; }
.plan-caption-sub { text-align: center; font-size: 12px; color: var(--text-muted); margin-bottom: 18px; }
.plan-footer { margin-top: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 26px; font-size: 12px; }
.plan-footer div { padding: 8px 0; border-bottom: 1px dashed var(--outline); }
.plan-footer b { color: var(--primary); }

/* ============================ Utilities ============================ */
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 600; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.flex { display: flex; } .flex-col { flex-direction: column; } .items-center { align-items: center; } .justify-between { justify-content: space-between; } .flex-1 { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.pill-note { background: var(--accent-50); border: 1px solid var(--accent-100); border-radius: 10px; padding: 12px 15px; font-size: 12.5px; color: var(--accent-600); line-height: 1.7; }

/* ============================ Responsive ============================ */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .login-page { grid-template-columns: 1fr; }
  .login-visual { min-height: 340px; padding: 32px; }
  .login-hero h1 { font-size: 34px; }
  .login-stats { display: none; }
  .login-form-side { padding: 48px 28px; }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 240px; --topbar-h: 60px; }
  .sidebar { transform: translateX(-100%); transition: transform var(--d-slow) var(--ease-standard); box-shadow: var(--shadow-3); }
  .app-shell.nav-open .sidebar { transform: none; }
  .main-wrap { margin-left: 0; }
  .menu-toggle { display: grid; }
  .nav-scrim { position: fixed; inset: 0; z-index: 39; background: rgba(24,32,44,.35); }
  .topbar-crumb { display: none; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: span 1; }
  .page { padding: 20px 16px 48px; }
  .calendar-cell { min-height: 68px; padding: 5px; }
  .calendar-event { font-size: 9px; padding: 3px 4px; }
}
@media (max-width: 640px) {
  .grid-4, .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 15px 16px; }
  .kpi-value { font-size: 23px; margin: 10px 0 6px; }
  .kpi-icon { width: 30px; height: 30px; }
  .card-head, .card-body, .card-foot { padding-left: 16px; padding-right: 16px; }
  .card-pad { padding: 16px; }
  .page-title { font-size: 23px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .field-row, .field-row-3 { grid-template-columns: minmax(0, 1fr); }
  .search-box .input { width: 100%; }
  .toolbar { align-items: stretch; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .toolbar .select { flex: 1; min-width: 0; }
  .user-chip b, .user-chip small { display: none; }
  .user-chip { padding: 4px; border: 0; }
  .month-switch b { min-width: 78px; font-size: 11.5px; }
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: 18px 18px 0 0; }
  .drawer { width: 100%; }
  .toast-stack { left: 12px; right: 12px; top: 12px; }
  .toast { min-width: 0; max-width: none; }
  .login-visual { min-height: 280px; }
  .login-hero h1 { font-size: 28px; }
  .login-hero p { font-size: 13px; }
  .login-features { gap: 8px 14px; }
  .login-foot { display: none; }
  .plan-footer { grid-template-columns: 1fr; }
}

/* ---- 版本信息 / 自动升级提示 ---- */
.version-chip {
  display: block; width: 100%; margin-top: 8px; padding: 6px 8px;
  border: 1px solid rgba(255,255,255,.18); border-radius: 8px;
  background: rgba(255,255,255,.06); color: rgba(255,255,255,.74);
  font: 500 10.5px/1.4 var(--font-num); letter-spacing: .02em;
  cursor: pointer; transition: all var(--d-fast) var(--ease-standard);
}
.version-chip:hover { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.36); }
#update-banner-root {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 120;
  pointer-events: none; padding: 0 20px 20px; display: flex; justify-content: center;
}
.update-banner {
  pointer-events: auto; display: flex; align-items: center; gap: 14px;
  max-width: 640px; width: 100%; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--outline); border-left: 4px solid var(--accent);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  animation: banner-in var(--d-slow) var(--ease-standard) both;
}
@keyframes banner-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.update-banner-icon { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center; background: var(--accent-100); color: var(--accent-600); }
.update-banner-text { flex: 1; min-width: 0; }
.update-banner-text .strong { font-size: 13.5px; color: var(--text); }
.update-banner-text .small { margin-top: 3px; line-height: 1.45; }
.update-banner-actions { display: flex; gap: 6px; flex: 0 0 auto; }
@media (max-width: 640px) {
  #update-banner-root { padding: 0 12px 12px; }
  .update-banner { flex-wrap: wrap; gap: 10px; padding: 12px 14px; }
  .update-banner-actions { width: 100%; justify-content: flex-end; }
}

@media print {
  .sidebar, .topbar, .page-actions, .toolbar, .toast-stack, .modal-backdrop, .drawer-backdrop, #update-banner-root { display: none !important; }
  .main-wrap { margin-left: 0; }
  .page { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; }
  body { background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
