/* =========================================================
   智能制造学院团委 · 团务工作台
   基础设计系统 / 布局 / 组件
   ========================================================= */

:root {
  /* 色彩：以团旗红为唯一强色，纸张暖白作底 */
  --paper: #f4f1eb;
  --paper-deep: #ece7de;
  --surface: #ffffff;
  --surface-soft: #faf8f4;
  --ink: #1c2126;
  --ink-soft: #4b5157;
  --muted: #78736a;
  --faint: #9d978c;
  --line: #e6e0d6;
  --line-strong: #d5cec1;

  --red: #b5352b;
  --red-deep: #8d251e;
  --red-soft: #d96659;
  --red-wash: #fbeeeb;
  --gold: #a57d3b;
  --gold-wash: #f8f0df;
  --green: #2f7357;
  --green-wash: #eaf3ee;
  --amber: #9b6516;
  --amber-wash: #fbf0dd;
  --slate: #39576b;
  --slate-wash: #edf2f5;

  --side: #191d21;
  --side-soft: #23282d;
  --side-line: rgba(255, 255, 255, 0.08);
  --side-text: #a7adb4;
  --side-text-strong: #f3f1ec;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-xs: 0 1px 2px rgba(28, 33, 38, 0.04);
  --shadow-sm: 0 1px 2px rgba(28, 33, 38, 0.04), 0 8px 24px -18px rgba(28, 33, 38, 0.18);
  --shadow-md: 0 2px 4px rgba(28, 33, 38, 0.04), 0 18px 40px -24px rgba(28, 33, 38, 0.28);
  --shadow-lg: 0 32px 80px -32px rgba(22, 26, 30, 0.42);

  --font-sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-number: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Segoe UI", var(--font-sans);
  --font-serif: "Songti SC", "Source Han Serif SC", "Noto Serif SC", "SimSun", serif;

  --sidebar-w: 256px;
  --topbar-h: 72px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p {
  margin: 0;
}

h1, h2, h3, h4, strong {
  font-weight: 600;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

img, svg {
  display: block;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--red-wash);
  color: var(--red-deep);
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #d8d1c5;
  border: 3px solid transparent;
  border-radius: 99px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: #c3baac;
  border: 3px solid transparent;
  background-clip: padding-box;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 50%;
  z-index: 999;
  transform: translate(-50%, -160%);
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  transition: transform 0.2s ease;
}
.skip-link:focus {
  transform: translate(-50%, 0);
}

/* =========================================================
   布局
   ========================================================= */
.app-shell {
  min-height: 100vh;
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-w);
  position: relative;
}

.workspace::before {
  content: "";
  position: fixed;
  inset: 0 0 auto var(--sidebar-w);
  height: 320px;
  background:
    radial-gradient(60% 120% at 80% 0%, rgba(181, 53, 43, 0.045), transparent 70%),
    radial-gradient(40% 90% at 10% 0%, rgba(165, 125, 59, 0.04), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.main {
  position: relative;
  z-index: 1;
  max-width: 1460px;
  margin: 0 auto;
  padding: 34px 36px 64px;
  animation: view-in 0.4s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   侧边栏
   ========================================================= */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 60;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, #1c2125 0%, #171b1f 55%, #14181b 100%);
  color: var(--side-text);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.05) 0.7px, transparent 0.7px);
  background-size: 20px 20px;
  opacity: 0.3;
  pointer-events: none;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--side-line);
  flex: 0 0 auto;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 6px 14px -8px rgba(181, 53, 43, 0.8);
  flex: 0 0 auto;
}
.brand-mark::after {
  content: "";
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  border: 1.5px solid #171b1f;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.brand-text strong {
  color: var(--side-text-strong);
  font-size: 13.5px;
  letter-spacing: 0.02em;
  line-height: 1.35;
  white-space: nowrap;
}
.brand-text span {
  color: #8e959c;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  line-height: 1.5;
}

.brand-en {
  position: absolute;
  right: 18px;
  bottom: 12px;
  font-family: var(--font-number);
  font-size: 7.5px;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.22);
  writing-mode: vertical-rl;
  line-height: 1;
}

.side-nav {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  padding: 20px 14px 24px;
}

.nav-group + .nav-group {
  margin-top: 20px;
}

.nav-label {
  padding: 0 12px;
  margin-bottom: 7px;
  color: #6f767d;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--side-text);
  font-size: 13px;
  letter-spacing: 0.01em;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-item::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  width: 3px;
  height: 18px;
  border-radius: 0 2px 2px 0;
  background: var(--red-soft);
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.18s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.045);
  color: #e6e8ea;
}

.nav-item.active {
  background: #262b30;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.nav-item.active::before {
  opacity: 1;
}
.nav-item.active .nav-icon {
  color: #e0705f;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #8f969d;
  flex: 0 0 auto;
  transition: color 0.18s ease;
}
.nav-icon svg {
  width: 18px;
  height: 18px;
}

.nav-text {
  white-space: nowrap;
}

.nav-badge {
  margin-left: auto;
  min-width: 19px;
  height: 19px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 99px;
  background: rgba(214, 89, 76, 0.16);
  color: #f0a69d;
  font-family: var(--font-number);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
}

.nav-dot {
  margin-left: auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(165, 125, 59, 0.12);
}

.sidebar-foot {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 16px 20px 18px;
  border-top: 1px solid var(--side-line);
}

.sync-note {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #7d848b;
  font-size: 10.5px;
  letter-spacing: 0.03em;
}
.sync-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #6f9f86;
  box-shadow: 0 0 0 3px rgba(111, 159, 134, 0.1);
}

.sidebar-foot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.sidebar-foot-row p {
  color: #666d74;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  line-height: 1.5;
}

.seal {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 1px solid rgba(165, 125, 59, 0.55);
  border-radius: 50%;
  color: #b28f55;
  font-family: var(--font-serif);
  font-size: 10px;
  transform: rotate(-8deg);
  opacity: 0.8;
  flex: 0 0 auto;
}

.nav-scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(22, 26, 30, 0.4);
  backdrop-filter: blur(2px);
}

/* =========================================================
   顶部栏
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: var(--topbar-h);
  padding: 0 36px 0 34px;
  background: rgba(244, 241, 235, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(140%);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.crumb {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
}
.crumb #crumbCurrent {
  color: var(--ink-soft);
  font-weight: 600;
}
.crumb-sep {
  color: #c4bcae;
}

.menu-btn {
  display: none;
}

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  transition: background 0.18s ease, color 0.18s ease;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 258px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.58);
  color: var(--faint);
  font-size: 12px;
  text-align: left;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.search-trigger:hover {
  border-color: var(--line-strong);
  background: #fff;
}
.search-trigger svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}
.search-trigger-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.search-trigger kbd {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbfaf7;
  color: var(--faint);
  font-family: var(--font-number);
  font-size: 10px;
  line-height: 1;
  flex: 0 0 auto;
}

.bell-btn {
  margin-left: 2px;
}
.bell-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 2px var(--paper);
}
.bell-dot.is-read {
  display: none;
}

.topbar-divider {
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: var(--line);
}

.role-switch {
  position: relative;
}

.role-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 4px 6px 4px 4px;
  border-radius: 10px;
  transition: background 0.18s ease;
}
.role-btn:hover {
  background: rgba(255, 255, 255, 0.6);
}

.role-avatar {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  background: var(--red-wash);
  border: 1px solid rgba(181, 53, 43, 0.18);
  color: var(--red-deep);
  font-family: var(--font-serif);
  font-size: 13px;
  font-weight: 700;
  flex: 0 0 auto;
}

.role-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.25;
}
.role-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.role-title {
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.role-btn .chev {
  display: grid;
  place-items: center;
  color: var(--faint);
  transition: transform 0.2s ease;
}
.role-btn .chev svg {
  width: 14px;
  height: 14px;
}
.role-btn[aria-expanded="true"] .chev {
  transform: rotate(180deg);
}

/* =========================================================
   弹出层
   ========================================================= */
.popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 70;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  animation: pop-in 0.18s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.role-popover {
  width: 326px;
  padding: 8px;
}

.popover-head {
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.popover-head p {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.05em;
}
.popover-head strong {
  display: block;
  font-size: 13.5px;
  color: var(--ink);
  margin-bottom: 2px;
}

.role-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background 0.16s ease;
}
.role-option:hover {
  background: var(--surface-soft);
}
.role-option.active {
  background: var(--red-wash);
}
.role-option .role-avatar {
  width: 32px;
  height: 32px;
  font-size: 12px;
}
.role-option-text {
  min-width: 0;
  flex: 1;
}
.role-option-text strong {
  display: block;
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.4;
}
.role-option-text span {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.5;
}
.role-option .check-tr {
  color: var(--red);
  opacity: 0;
}
.role-option .check-tr svg {
  width: 15px;
  height: 15px;
}
.role-option.active .check-tr {
  opacity: 1;
}

.role-popover-foot {
  margin: 6px 2px 0;
  padding: 10px 12px 6px;
  border-top: 1px solid var(--line);
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--muted);
}

.bell-popover {
  width: 366px;
  right: 152px;
  padding: 8px;
}

.bell-item {
  display: flex;
  gap: 11px;
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background 0.16s ease;
}
.bell-item:hover {
  background: var(--surface-soft);
}
.bell-item-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--red-wash);
  color: var(--red);
  flex: 0 0 auto;
}
.bell-item-icon svg {
  width: 15px;
  height: 15px;
}
.bell-item-icon.tone-gold {
  background: var(--gold-wash);
  color: var(--gold);
}
.bell-item-icon.tone-green {
  background: var(--green-wash);
  color: var(--green);
}
.bell-item-body strong {
  display: block;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink);
}
.bell-item-body span {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.5;
}
.bell-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 6px 4px 2px;
  padding: 10px 8px 4px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--red);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 2px;
}
.link-btn svg {
  width: 13px;
  height: 13px;
}
.link-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* =========================================================
   页面标题 / 通用布局
   ========================================================= */
.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  color: var(--faint);
  font-family: var(--font-number);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.16em;
}
.eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--red);
  opacity: 0.75;
}

.view-head h1 {
  font-size: clamp(24px, 2.3vw, 31px);
  line-height: 1.22;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.view-sub {
  max-width: 720px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
  padding-bottom: 2px;
}

.page-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  margin-bottom: 18px;
  border: 1px solid var(--gold-wash);
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--gold-wash), #fcfaf6);
  color: #77684a;
  font-size: 11.5px;
  line-height: 1.65;
}
.page-note svg {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  color: var(--gold);
  flex: 0 0 auto;
}
.page-note strong {
  color: #66542f;
}

.subnav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 20px;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
  overflow-x: auto;
}
.subnav button {
  position: relative;
  height: 32px;
  padding: 0 15px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  transition: color 0.18s ease, background 0.18s ease;
}
.subnav button:hover {
  color: var(--ink);
}
.subnav button.active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  box-shadow: var(--shadow-xs), inset 0 0 0 1px rgba(28, 33, 38, 0.04);
}
.subnav .count {
  margin-left: 6px;
  font-family: var(--font-number);
  font-size: 10px;
  color: var(--faint);
}

.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));
}
.span-7 { grid-column: span 7; }
.span-5 { grid-column: span 5; }
.span-8 { grid-column: span 8; }
.span-4 { grid-column: span 4; }
.span-12 { grid-column: span 12; }

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

/* =========================================================
   卡片
   ========================================================= */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid #eee9e1;
}
.card-head.no-border {
  border-bottom: 0;
  padding-bottom: 4px;
}
.card-head h2,
.card-head h3 {
  font-size: 15px;
  line-height: 1.4;
  letter-spacing: -0.012em;
  color: var(--ink);
}
.card-head .card-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.02em;
}
.card-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.card-body {
  padding: 22px;
}
.card-body.flush {
  padding: 0;
}
.card-body.tight {
  padding: 14px 16px;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 22px;
  border-top: 1px solid #eee9e1;
  color: var(--muted);
  font-size: 11px;
}

.card-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.08em;
}
.card-label::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--red);
  transform: rotate(45deg);
}

/* =========================================================
   按钮
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}
.btn svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
  box-shadow: 0 10px 20px -14px rgba(181, 53, 43, 0.65);
}
.btn-primary:hover {
  background: var(--red-deep);
  border-color: var(--red-deep);
}
.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn-secondary:hover {
  background: var(--surface-soft);
  border-color: #c4bbac;
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}
.btn-dark {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.btn-dark:hover {
  background: #2b3238;
  border-color: #2b3238;
}
.btn-danger {
  background: var(--red-wash);
  border-color: rgba(181, 53, 43, 0.18);
  color: var(--red-deep);
}
.btn-danger:hover {
  background: #f7dfdb;
}
.btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: 11.5px;
  border-radius: 7px;
}
.btn-sm svg {
  width: 13px;
  height: 13px;
}
.btn-xs {
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
  border-radius: 5px;
  gap: 5px;
}
.btn-xs svg {
  width: 12px;
  height: 12px;
}
.btn-block {
  width: 100%;
}
.btn[disabled],
.btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.btn[disabled]:hover,
.btn.is-disabled:hover {
  transform: none;
}

.icon-action {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--muted);
  transition: background 0.16s ease, color 0.16s ease;
}
.icon-action:hover {
  background: var(--paper);
  color: var(--ink);
}
.icon-action svg {
  width: 14px;
  height: 14px;
}
.icon-action.danger:hover {
  background: var(--red-wash);
  color: var(--red);
}

/* =========================================================
   表单
   ========================================================= */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.form-grid .full {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field > label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
.req {
  color: var(--red);
  font-size: 11px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.input::placeholder,
.textarea::placeholder {
  color: #aaa49a;
}
.input:hover,
.select:hover,
.textarea:hover {
  border-color: #c6bdaf;
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(181, 53, 43, 0.1);
}
.textarea {
  min-height: 112px;
  resize: vertical;
}
.select {
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2378736a' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}
.form-hint {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}
.form-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.choice {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 11.5px;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice:hover {
  border-color: var(--line-strong);
}
.choice:has(input:checked) {
  border-color: rgba(181, 53, 43, 0.35);
  background: var(--red-wash);
  color: var(--red-deep);
  font-weight: 600;
}
.choice:has(input:focus-visible) {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.switch-track {
  position: relative;
  width: 38px;
  height: 21px;
  border-radius: 99px;
  background: #ddd6ca;
  transition: background 0.18s ease;
  flex: 0 0 auto;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
  transition: transform 0.18s ease;
}
.switch input:checked + .switch-track {
  background: var(--red);
}
.switch input:checked + .switch-track::after {
  transform: translateX(17px);
}
.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}
.switch-label {
  font-size: 12px;
  color: var(--ink-soft);
}

.upload-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 28px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}
.upload-zone:hover,
.upload-zone.is-dragging {
  border-color: var(--red);
  background: var(--red-wash);
}
.upload-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.upload-zone svg {
  width: 22px;
  height: 22px;
  color: var(--red);
  margin-bottom: 2px;
}
.upload-zone strong {
  font-size: 12.5px;
}
.upload-zone span {
  font-size: 10.5px;
  color: var(--muted);
}

/* =========================================================
   表格
   ========================================================= */
.table-wrap {
  overflow-x: auto;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
table.data {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}
table.data th {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbf9f5;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: left;
  white-space: nowrap;
}
table.data th:first-child,
table.data td:first-child {
  padding-left: 22px;
}
table.data th:last-child,
table.data td:last-child {
  padding-right: 22px;
}
table.data td {
  padding: 13px 14px;
  border-bottom: 1px solid #f1ede5;
  color: var(--ink-soft);
  font-size: 12px;
  vertical-align: middle;
}
table.data tbody tr:last-child td {
  border-bottom: 0;
}
table.data tbody tr {
  transition: background 0.14s ease;
}
table.data tbody tr:hover td {
  background: #fdfcf9;
}
table.data .ta-r {
  text-align: right;
}
table.data .ta-c {
  text-align: center;
}
table.data .nowrap {
  white-space: nowrap;
}
table.data .row-alert td {
  background: #fdf4f2;
}
table.data .row-alert td:first-child {
  box-shadow: inset 3px 0 0 var(--red);
}
table.data .row-ok td {
  background: #fbfdfb;
}

.t-strong {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
}
.t-muted {
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}
.t-num {
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.t-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
}
.cell-person {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  border-top: 1px solid #eee9e1;
  font-size: 10.5px;
  color: var(--muted);
}
.pager {
  display: flex;
  align-items: center;
  gap: 3px;
}
.pager button {
  min-width: 27px;
  height: 27px;
  padding: 0 7px;
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-number);
  font-size: 11px;
  transition: background 0.16s ease, color 0.16s ease;
}
.pager button:hover:not([disabled]) {
  background: var(--paper);
  color: var(--ink);
}
.pager button.active {
  background: var(--ink);
  color: #fff;
}
.pager button[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}
.pager svg {
  width: 13px;
  height: 13px;
}

/* =========================================================
   徽章 / 标签 / 进度
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1;
  background: var(--paper);
  color: var(--ink-soft);
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}
.badge.no-dot::before {
  display: none;
}
.badge-red {
  background: var(--red-wash);
  color: var(--red-deep);
}
.badge-gold {
  background: var(--gold-wash);
  color: #836129;
}
.badge-green {
  background: var(--green-wash);
  color: var(--green);
}
.badge-amber {
  background: var(--amber-wash);
  color: var(--amber);
}
.badge-slate {
  background: var(--slate-wash);
  color: var(--slate);
}
.badge-gray {
  background: #f0ede7;
  color: #726d64;
}
.badge-ink {
  background: var(--ink);
  color: #fff;
}
.badge-outline {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.dot-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #c5bdaf;
  flex: 0 0 auto;
}

.progress {
  position: relative;
  height: 5px;
  border-radius: 99px;
  background: #efeae1;
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.progress.green > i { background: var(--green); }
.progress.amber > i { background: var(--amber); }
.progress.slate > i { background: var(--slate); }
.progress.gold > i { background: var(--gold); }
.progress-lg {
  height: 7px;
}
.progress-line {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 116px;
}
.progress-line .progress {
  flex: 1;
}
.progress-line span {
  min-width: 34px;
  font-family: var(--font-number);
  font-size: 10.5px;
  color: var(--ink-soft);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* 头像 */
.avatar {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-family: var(--font-serif);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  flex: 0 0 auto;
  background: #eee9e0;
  color: #5b574f;
  border: 1px solid rgba(28, 33, 38, 0.06);
}
.avatar-sm {
  width: 26px;
  height: 26px;
  font-size: 10px;
}
.avatar-lg {
  width: 44px;
  height: 44px;
  font-size: 15px;
}
.av-0 { background: #f6e7e3; color: #92352b; }
.av-1 { background: #eaf0ea; color: #3a614d; }
.av-2 { background: #f4eee1; color: #7e6128; }
.av-3 { background: #e8edf1; color: #3a5768; }
.av-4 { background: #efe9f0; color: #624f67; }
.av-5 { background: #f1ece4; color: #665b49; }
.av-6 { background: #e9eeed; color: #3d5e59; }
.av-7 { background: #f7e9e9; color: #8c3d42; }

.avatar-stack {
  display: flex;
  align-items: center;
}
.avatar-stack .avatar {
  margin-left: -7px;
  box-shadow: 0 0 0 2px #fff;
}
.avatar-stack .avatar:first-child {
  margin-left: 0;
}
.avatar-stack .more {
  display: grid;
  place-items: center;
  height: 26px;
  padding: 0 7px;
  margin-left: -6px;
  border-radius: 99px;
  background: var(--paper);
  color: var(--muted);
  font-family: var(--font-number);
  font-size: 9.5px;
  box-shadow: 0 0 0 2px #fff;
  z-index: 1;
}

/* =========================================================
   工具栏 / 筛选
   ========================================================= */
.toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.search-field {
  position: relative;
  min-width: 210px;
}
.search-field svg {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 14px;
  height: 14px;
  color: var(--faint);
  transform: translateY(-50%);
  pointer-events: none;
}
.search-field .input {
  height: 34px;
  padding-left: 31px;
  font-size: 12px;
  background: var(--surface);
}
.select-sm {
  height: 34px;
  min-height: 34px;
  width: auto;
  min-width: 112px;
  padding-top: 4px;
  padding-bottom: 4px;
  font-size: 11.5px;
}
.filter-chip {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  font-size: 11px;
  transition: all 0.16s ease;
}
.filter-chip:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}
.filter-chip.active {
  border-color: rgba(181, 53, 43, 0.28);
  background: var(--red-wash);
  color: var(--red-deep);
  font-weight: 600;
}

/* =========================================================
   空状态
   ========================================================= */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 44px 24px;
  text-align: center;
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--paper);
  color: var(--faint);
  margin-bottom: 12px;
}
.empty-icon svg {
  width: 22px;
  height: 22px;
}
.empty strong {
  font-size: 13px;
  color: var(--ink-soft);
}
.empty p {
  margin-top: 4px;
  max-width: 360px;
  color: var(--muted);
  font-size: 11.5px;
}
.empty .btn {
  margin-top: 14px;
}
.empty.sm {
  padding: 28px 18px;
}

/* =========================================================
   弹窗
   ========================================================= */
.modal-root[hidden] {
  display: none;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px;
  background: rgba(20, 24, 27, 0.46);
  backdrop-filter: blur(3px);
  overflow-y: auto;
  animation: fade-in 0.18s ease both;
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  position: relative;
  width: 580px;
  max-width: 100%;
  margin: auto 0;
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.24s cubic-bezier(0.2, 0.85, 0.3, 1) both;
  overflow: hidden;
}
.modal-lg { width: 780px; }
.modal-sm { width: 440px; }
.modal-xl { width: 920px; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid #f0ece4;
}
.modal-title-wrap {
  min-width: 0;
}
.modal-kicker {
  margin-bottom: 5px;
  color: var(--faint);
  font-family: var(--font-number);
  font-size: 9.5px;
  letter-spacing: 0.15em;
}
.modal-head h3 {
  font-size: 18px;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--ink);
}
.modal-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.55;
}
.modal-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--muted);
  flex: 0 0 auto;
  transition: background 0.16s ease, color 0.16s ease;
}
.modal-close:hover {
  background: var(--paper);
  color: var(--ink);
}
.modal-close svg {
  width: 17px;
  height: 17px;
}
.modal-body {
  padding: 22px 24px;
  max-height: min(66vh, 620px);
  overflow-y: auto;
}
.modal-body.flush {
  padding: 0;
}
.modal-body.tight {
  padding: 16px 24px;
}
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 15px 24px 19px;
  border-top: 1px solid #f0ece4;
  background: var(--surface-soft);
}
.modal-foot .foot-start {
  margin-right: auto;
  color: var(--muted);
  font-size: 10.5px;
}
.modal-note {
  padding: 10px 12px;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
}

/* =========================================================
   Toast
   ========================================================= */
.toast-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 230px;
  max-width: 360px;
  padding: 11px 14px;
  border-radius: 10px;
  background: #1e2327;
  color: #f2f0ec;
  font-size: 12px;
  line-height: 1.55;
  box-shadow: 0 18px 36px -18px rgba(0, 0, 0, 0.6);
  animation: toast-in 0.3s cubic-bezier(0.2, 0.85, 0.3, 1) both;
  pointer-events: auto;
}
.toast.is-out {
  animation: toast-out 0.24s ease both;
}
.toast-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  background: rgba(111, 159, 134, 0.18);
  color: #8ec5a9;
  flex: 0 0 auto;
}
.toast-icon svg {
  width: 12px;
  height: 12px;
}
.toast.tone-error .toast-icon {
  background: rgba(214, 89, 76, 0.16);
  color: #efa49a;
}
.toast.tone-info .toast-icon {
  background: rgba(165, 125, 59, 0.16);
  color: #d7b477;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(6px); }
}

/* =========================================================
   通用小组件
   ========================================================= */
.muted {
  color: var(--muted);
}
.small {
  font-size: 10.5px;
}
.mono {
  font-family: var(--font-number);
  font-variant-numeric: tabular-nums;
}
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-gold { color: var(--gold); }
.flex {
  display: flex;
  align-items: center;
  gap: 8px;
}
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.flex-wrap {
  flex-wrap: wrap;
}
.ml-auto {
  margin-left: auto;
}
.divider {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
}
.hide {
  display: none !important;
}

.code-card {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  font-family: var(--font-number);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
}

.copy-btn {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  color: var(--faint);
  transition: background 0.15s ease, color 0.15s ease;
}
.copy-btn:hover {
  background: var(--red-wash);
  color: var(--red);
}
.copy-btn svg {
  width: 13px;
  height: 13px;
}

/* 骨架屏 / 启动 */
.boot-screen {
  min-height: 62vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}
.boot-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(181, 53, 43, 0.3);
  color: var(--red);
  font-family: var(--font-serif);
  font-size: 19px;
  animation: breathe 1.6s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.06); opacity: 1; }
}

/* =========================================================
   响应式
   ========================================================= */
@media (max-width: 1240px) {
  :root { --sidebar-w: 240px; }
  .main { padding: 30px 28px 56px; }
  .topbar { padding: 0 28px; }
  .search-trigger { width: 220px; }
}

@media (max-width: 1060px) {
  .span-7, .span-5, .span-8, .span-4 { grid-column: span 12; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-trigger { width: 190px; }
  .search-trigger-text { display: none; }
  .search-trigger kbd { margin-left: auto; }
}

@media (max-width: 960px) {
  :root { --sidebar-w: 256px; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
    box-shadow: 30px 0 60px -20px rgba(0, 0, 0, 0.4);
  }
  .sidebar.is-open {
    transform: translateX(0);
  }
  .workspace {
    margin-left: 0;
  }
  .workspace::before {
    left: 0;
  }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 18px; }
  .main { padding: 24px 20px 52px; }
  .brand { padding: 0 18px; }
  .bell-popover { right: 0; }
  .role-meta { display: none; }
  .role-btn { padding-right: 4px; }
  .role-btn .chev { display: none; }
  .role-avatar { width: 32px; height: 32px; }
  .topbar-divider { display: none; }
}

@media (max-width: 720px) {
  .main { padding: 20px 14px 48px; }
  .topbar { height: 62px; padding: 0 12px; }
  :root { --topbar-h: 62px; }
  .view-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
  }
  .view-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .view-actions .btn { flex: 1 1 auto; }
  .grid { gap: 12px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .card-head { padding: 15px 16px; }
  .card-body { padding: 16px; }
  .card-foot { padding: 12px 16px; }
  table.data th:first-child, table.data td:first-child { padding-left: 16px; }
  table.data th:last-child, table.data td:last-child { padding-right: 16px; }
  .modal-root { padding: 14px 10px; align-items: flex-end; }
  .modal { border-radius: 16px; }
  .modal-head { padding: 18px 18px 13px; }
  .modal-body { padding: 18px; max-height: 64vh; }
  .modal-foot { padding: 13px 18px 16px; flex-wrap: wrap; }
  .subnav { width: 100%; }
  .subnav button { flex: 0 0 auto; }
  .search-trigger { width: 36px; padding: 0; justify-content: center; border: 0; background: transparent; }
  .search-trigger kbd { display: none; }
  .search-trigger svg { width: 18px; height: 18px; }
  .toast-root { right: 12px; left: 12px; bottom: 12px; }
  .toast { max-width: none; width: 100%; }
  .pagination { padding: 11px 16px; flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .crumb { display: none; }
  .role-switch { margin-left: auto; }
  .view-head h1 { font-size: 23px; }
  .eyebrow { margin-bottom: 8px; }
  .modal-foot .btn { flex: 1; }
  .modal-foot .foot-start { width: 100%; margin-bottom: 4px; }
}

[hidden] { display: none !important; }

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

/* =========================================================
   头像图片 / 身份编辑
   ========================================================= */
.avatar.avatar-photo,
.role-avatar.is-photo {
  padding: 0;
  overflow: hidden;
  background: #eee9e0;
  color: transparent;
}
.avatar.avatar-photo img,
.role-avatar.is-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-editor {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.avatar-preview {
  flex: 0 0 auto;
  display: inline-flex;
}
.avatar-preview .avatar {
  width: 64px;
  height: 64px;
  font-size: 22px;
  box-shadow: 0 0 0 3px #fff, 0 0 0 4px rgba(28, 33, 38, 0.05);
}
.avatar-editor-body {
  min-width: 0;
}
.avatar-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.avatar-editor-hint {
  margin-top: 8px;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.6;
}

/* =========================================================
   登录页
   ========================================================= */
body.login-open {
  overflow: hidden;
}
body.login-open .app-shell {
  display: none;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
  background:
    radial-gradient(70% 90% at 20% 0%, rgba(181, 53, 43, 0.28), transparent 60%),
    radial-gradient(60% 80% at 100% 100%, rgba(165, 125, 59, 0.16), transparent 65%),
    linear-gradient(160deg, #1c2125 0%, #14181b 60%, #101316 100%);
}
.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.06) 0.7px, transparent 0.7px);
  background-size: 22px 22px;
  opacity: 0.35;
  pointer-events: none;
}

.login-panel {
  position: relative;
  z-index: 1;
  width: min(432px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 28px 30px 20px;
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: login-in 0.36s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}
@keyframes login-in {
  from { opacity: 0; transform: translateY(16px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}
.login-brand > div {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}
.login-brand strong {
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0.02em;
}
.login-brand span {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.08em;
}

.login-heading {
  padding: 22px 0 18px;
}
.login-heading h1 {
  font-family: var(--font-serif);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.3;
}
.login-heading p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
}

.login-form {
  display: grid;
  gap: 13px;
}
.login-password {
  position: relative;
}
.login-password .input {
  padding-right: 58px;
}
.login-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 11px;
  transform: translateY(-50%);
}
.login-eye:hover {
  background: var(--surface-soft);
  color: var(--red);
}

.login-error {
  min-height: 17px;
  margin-top: -3px;
  color: var(--red);
  font-size: 11.5px;
  line-height: 1.5;
}
.login-error.is-shake {
  animation: login-shake 0.34s ease;
}
@keyframes login-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  45% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
}

.login-submit {
  width: 100%;
  height: 44px;
  justify-content: center;
  font-size: 13px;
}

.login-accounts {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}
.login-accounts-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.08em;
}
.login-account-list {
  display: grid;
  gap: 4px;
}
.login-account {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease;
}
.login-account:hover {
  background: var(--surface-soft);
  border-color: var(--line);
}
.login-account-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}
.login-account-text strong {
  color: var(--ink);
  font-size: 12.5px;
}
.login-account-text span {
  color: var(--muted);
  font-size: 10px;
}

.login-foot {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.7;
  text-align: center;
}

@media (max-width: 520px) {
  .login-screen {
    padding: 0;
    align-items: stretch;
  }
  .login-panel {
    width: 100%;
    min-height: 100vh;
    max-height: none;
    border-radius: 0;
    padding: 26px 20px 20px;
  }
  .avatar-editor {
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
  }
}
