/* BANFULY 统一界面规范 v1（全浅色简洁），变量含义见 design/banfuly-tokens.css 与 docs/统一界面规范.md */
:root {
  --ink: #1d1d1f;
  --ink-soft: #424245;
  --muted: #6e6e73;
  --hint: #86868b;
  --action: #0071e3;
  --action-hover: #0077ed;
  --action-soft: #e8f1fd;
  --canvas: #f5f5f7;
  --surface: #ffffff;
  --fill: #f5f5f7;
  --fill-hover: #ebebf0;
  --border: rgba(0, 0, 0, .08);
  --border-strong: #d2d2d7;
  --primary: #1d1d1f;
  --primary-hover: #333336;
  --danger: #d70015;
  --danger-bg: #fff1f2;
  --focus: #0071e3;
  --radius-control: 10px;
  --radius-panel: 18px;
  --radius-pill: 999px;
  --header-height: 60px;
  --shadow: 0 18px 48px rgba(0, 0, 0, .12);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, .08);
  --ease: cubic-bezier(.25, .1, .25, 1);
  --tone-data-bg: #e8f1fd;  --tone-data: #0071e3;
  --tone-trend-bg: #fff1e6; --tone-trend: #e86a00;
  --tone-image-bg: #f2ebff; --tone-image: #7a3ff2;
  --tone-chart-bg: #e8f6ec; --tone-chart: #1e8e3e;
  --tone-check-bg: #e4f5f5; --tone-check: #0a7f86;
}

* { box-sizing: border-box; }
html { min-width: 0; background: var(--canvas); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Noto Sans SC", "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
body { min-width: 0; margin: 0; font-size: 15px; line-height: 1.55; }
button, input { font: inherit; }
button, a { touch-action: manipulation; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed; z-index: 100; top: 8px; left: 16px; min-height: 44px; padding: 0 16px;
  display: flex; align-items: center; border-radius: var(--radius-pill); background: var(--ink); color: white;
  text-decoration: none; transform: translateY(-140%); transition: transform .18s var(--ease);
}
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid rgba(0, 113, 227, .35); outline-offset: 2px; }

.topbar { position: sticky; z-index: 20; top: 0; height: var(--header-height); border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, .82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); }
.topbar-inner { width: min(100%, 1312px); height: 100%; margin: 0 auto; padding: 0 32px; display: flex; align-items: center; gap: 28px; }
.brand { min-height: 44px; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 15px; font-weight: 600; letter-spacing: .06em; text-decoration: none; }
.brand-mark { width: 22px; height: 22px; position: relative; border-radius: 7px; background: var(--ink); }
.brand-mark::after { content: ""; position: absolute; right: 5px; bottom: 5px; width: 6px; height: 6px; border-radius: 2px; background: white; }
.primary-navigation { display: flex; align-items: center; gap: 4px; }
.primary-navigation a { min-height: 36px; padding: 0 14px; display: inline-flex; align-items: center; border-radius: var(--radius-pill); color: var(--ink-soft); font-size: 14px; font-weight: 500; text-decoration: none; transition: background-color .18s var(--ease), color .18s var(--ease); }
.primary-navigation a:hover { background: var(--fill); color: var(--ink); }
.primary-navigation a[aria-current="page"] { background: var(--fill); color: var(--ink); }
.top-actions { min-width: 0; margin-left: auto; display: flex; align-items: center; gap: 8px; }
.account-label { max-width: 240px; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.mobile-admin-link { width: 44px; height: 44px; display: none; align-items: center; justify-content: center; border-radius: var(--radius-pill); background: var(--fill); color: var(--ink); }
.mobile-admin-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; }

.button { min-height: 44px; padding: 0 20px; border: 1px solid transparent; border-radius: var(--radius-pill); cursor: pointer; font-size: 14px; font-weight: 500; transition: background-color .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), opacity .18s var(--ease), transform .12s var(--ease); }
.button:active:not(:disabled) { transform: scale(.98); }
.button:disabled { cursor: wait; opacity: .55; }
.button-primary { background: var(--primary); color: white; }
.button-primary:hover:not(:disabled) { background: var(--primary-hover); }
.button-quiet { min-height: 36px; padding: 0 14px; background: transparent; color: var(--ink-soft); }
.button-quiet:hover:not(:disabled) { background: var(--fill); color: var(--ink); }

.state-panel { min-height: calc(100vh - var(--header-height)); padding: 40px 20px; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.loading-mark { width: 22px; height: 22px; border: 2px solid var(--fill-hover); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
.state-panel p { margin: 14px 0 0; font-size: 14px; }

.login-main { min-height: calc(100vh - var(--header-height)); padding: 48px 20px; display: grid; place-items: center; }
.login-panel { width: min(400px, 100%); padding: 40px 36px 36px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-hover); animation: rise .4s var(--ease) both; }
.login-panel::before { content: ""; width: 44px; height: 44px; margin-bottom: 22px; display: block; border-radius: 13px; background: var(--ink) radial-gradient(circle at 70% 70%, white 0 4px, transparent 4.5px); }
.login-panel h1 { margin: 0 0 6px; font-size: 26px; font-weight: 600; line-height: 1.3; letter-spacing: -.02em; }
.login-panel > p { margin: 0 0 28px; color: var(--muted); font-size: 14px; }
.field { display: grid; gap: 6px; margin-bottom: 6px; }
.field > label { color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.field input { width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid transparent; border-radius: 12px; background: var(--fill); color: var(--ink); outline: none; transition: background-color .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease); }
.field input:hover { background: var(--fill-hover); }
.field input:focus { border-color: var(--action); background: white; box-shadow: 0 0 0 4px rgba(0, 113, 227, .14); }
.field input[aria-invalid="true"] { border-color: var(--danger); background: white; }
.password-field { position: relative; }
.password-field input { padding-right: 72px; }
.password-toggle { position: absolute; top: 2px; right: 2px; min-width: 64px; min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px; background: transparent; color: var(--action); cursor: pointer; font-size: 13px; font-weight: 500; }
.password-toggle:hover { color: var(--action-hover); }
.field-error { min-height: 16px; margin: 0; color: var(--danger); font-size: 12px; }
.form-error { min-height: 0; margin: 4px 0 16px; padding: 0; color: var(--danger); font-size: 13px; }
.form-error:not(:empty) { padding: 10px 12px; border-radius: 10px; background: var(--danger-bg); }
.login-button { width: 100%; min-height: 48px; font-size: 15px; }
a.login-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.login-hint { margin: 10px 0 20px; color: var(--muted); font-size: 13px; text-align: center; }
.password-login > summary { margin: 4px 0 16px; color: var(--ink-soft); font-size: 13px; cursor: pointer; text-align: center; }
.password-login:not([open]) > summary { margin-bottom: 0; }

.workspace-main { width: min(100%, 1312px); margin: 0 auto; padding: 48px 32px 64px; }
.page-heading { margin-bottom: 28px; }
.page-heading h1 { margin: 0 0 6px; font-size: 32px; font-weight: 600; line-height: 1.2; letter-spacing: -.025em; }
.page-heading p { margin: 0; color: var(--muted); font-size: 15px; }
.navigation-status { min-height: 0; margin: 0 0 16px; color: var(--muted); }
.navigation-status:empty { display: none; }
.navigation-status.error { max-width: 640px; padding: 12px 16px; border-radius: 12px; background: var(--danger-bg); color: var(--danger); }
.work-band { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; padding-top: 36px; }
.entry-card { min-width: 0; min-height: 236px; position: relative; padding: 24px; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--shadow-card); transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s var(--ease); }
.entry-card:hover { border-color: transparent; box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.entry-card.group-start::before { content: attr(data-group-label); position: absolute; top: -36px; left: 0; width: calc(200% + 16px); height: 24px; padding-right: 10px; display: flex; align-items: center; border-bottom: 1px solid var(--border); color: var(--hint); font-size: 12px; font-weight: 500; letter-spacing: .04em; }
.entry-glyph { width: 44px; height: 44px; margin-bottom: 20px; display: grid; place-items: center; border-radius: 12px; background: var(--tone-data-bg); color: var(--tone-data); }
.entry-card[data-tone="trend"] .entry-glyph { background: var(--tone-trend-bg); color: var(--tone-trend); }
.entry-card[data-tone="image"] .entry-glyph { background: var(--tone-image-bg); color: var(--tone-image); }
.entry-card[data-tone="chart"] .entry-glyph { background: var(--tone-chart-bg); color: var(--tone-chart); }
.entry-card[data-tone="check"] .entry-glyph { background: var(--tone-check-bg); color: var(--tone-check); }
.entry-card[data-tone="open"] .entry-glyph { background: var(--fill); color: var(--ink-soft); }
.entry-glyph svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.entry-card h2 { margin: 0 0 6px; font-size: 17px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; }
.entry-card p { margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.entry-status { margin: -8px 0 14px; align-self: flex-start; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--fill); color: var(--hint); font-size: 12px; font-weight: 500; }
.entry-open { min-height: 44px; margin-top: auto; padding: 0; align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; border: 0; background: transparent; color: var(--action); cursor: pointer; font-size: 14px; font-weight: 500; }
.entry-open:hover:not(:disabled) { color: var(--action-hover); }
.entry-open:hover:not(:disabled) svg { transform: translateX(3px); }
.entry-open:disabled { display: none; }
.entry-card:has(.entry-open:disabled) { background: #fbfbfd; box-shadow: none; }
.entry-card:has(.entry-open:disabled):hover { border-color: var(--border); box-shadow: none; transform: none; }
.entry-card:has(.entry-open:disabled) .entry-glyph { filter: grayscale(1); opacity: .55; }
.entry-card:has(.entry-open:disabled) .entry-status { margin: auto 0 10px; }
.entry-open svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform .2s var(--ease); }
.entry-open[aria-busy="true"] svg { animation: nudge .8s ease-in-out infinite alternate; }
.empty-workspace { grid-column: 1 / -1; min-height: 200px; padding: 32px; display: grid; place-content: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-panel); background: var(--surface); text-align: center; }
.empty-workspace h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.empty-workspace p { margin: 0; color: var(--muted); }
.toast { position: fixed; z-index: 30; right: 24px; bottom: 24px; max-width: 420px; padding: 14px 20px; border-radius: 14px; background: rgba(29, 29, 31, .92); color: white; font-size: 14px; box-shadow: var(--shadow); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); animation: rise .3s var(--ease) both; }
.toast.error { background: var(--danger); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes nudge { to { transform: translateX(3px); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 1023px) {
  .topbar-inner, .workspace-main { padding-left: 24px; padding-right: 24px; }
  .work-band { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 0; }
  .entry-card { min-height: 212px; }
  .entry-card.group-start { margin-top: 36px; }
  .entry-card.group-start::before { width: calc(200% + 16px); }
}

@media (max-width: 767px) {
  :root { --header-height: 56px; }
  .topbar-inner { padding: 0 16px; gap: 8px; }
  .primary-navigation, .account-label { display: none; }
  .mobile-admin-link:not([hidden]) { display: inline-flex; }
  .workspace-main { padding: 28px 16px 40px; }
  .page-heading h1 { font-size: 26px; }
  .work-band { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .entry-card { min-height: 0; padding: 20px; }
  .entry-card.group-start::before { width: 100%; }
  .entry-glyph { margin-bottom: 14px; }
  .entry-open { margin-top: 2px; }
  .login-main { padding: 28px 16px; align-items: start; }
  .login-panel { padding: 32px 24px 28px; }
  .toast { right: 16px; bottom: 16px; left: 16px; }
}

@media (max-width: 359px) {
  .brand { gap: 7px; letter-spacing: .03em; }
  .topbar-inner { padding: 0 12px; }
  .workspace-main, .login-main { padding-left: 12px; padding-right: 12px; }
}

/* 在线人员（仅管理员可见），与 design/banfuly-tokens.css 同一套变量 */
.presence { position: relative; }
.presence-button { min-height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; background: #e8f6ec; color: #1e8e3e; cursor: pointer; font: inherit; font-size: 13px; font-weight: 500; transition: background-color .18s ease; }
.presence-button:hover, .presence-button[aria-expanded="true"] { background: #d7efdf; }
.presence-dot { width: 7px; height: 7px; border-radius: 50%; background: #1e8e3e; box-shadow: 0 0 0 3px rgba(30, 142, 62, .18); }
.presence-panel { position: absolute; z-index: 40; top: calc(100% + 10px); right: 0; width: 340px; max-height: min(70vh, 480px); overflow: auto; padding: 10px 14px 6px; border: 1px solid var(--border); border-radius: 16px; background: #fff; box-shadow: 0 18px 48px rgba(0, 0, 0, .12); }
.presence-head { padding: 2px 0 8px; display: flex; justify-content: space-between; gap: 12px; color: #86868b; font-size: 12px; }
.presence-list { margin: 0; padding: 0; list-style: none; }
.presence-item { padding: 9px 0; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; border-top: 1px solid rgba(0, 0, 0, .06); }
.presence-avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #f5f5f7; color: #424245; font-size: 13px; font-weight: 600; }
.presence-text { min-width: 0; display: grid; }
.presence-text strong { overflow: hidden; color: #1d1d1f; font-size: 13px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.presence-text small { overflow: hidden; color: #86868b; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.presence-system { color: #424245; }
.presence-system[data-tone="data"] { color: #0071e3; }
.presence-system[data-tone="trend"] { color: #e86a00; }
.presence-system[data-tone="image"] { color: #7a3ff2; }
.presence-system[data-tone="chart"] { color: #1e8e3e; }
.presence-system[data-tone="check"] { color: #0a7f86; }
.presence-time { color: #86868b; font-size: 12px; white-space: nowrap; }
.presence-empty { padding: 14px 0; border-top: 1px solid rgba(0, 0, 0, .06); color: #86868b; font-size: 13px; text-align: center; }
@media (max-width: 767px) {
  .presence-button { padding: 0 10px; }
  .presence-panel { position: fixed; top: 64px; right: 12px; left: 12px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.downloads { margin-top: 48px; }
.downloads-head h2 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.downloads-head p { margin: 0; color: var(--muted); font-size: 13px; }
.downloads-list { display: grid; gap: 12px; margin-top: 16px; }
.download-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: start; padding: 20px 24px; border: 1px solid var(--border); border-radius: var(--radius-panel); background: var(--surface); box-shadow: var(--shadow-card); }
.download-main { min-width: 0; overflow-wrap: anywhere; }
.download-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.download-title h3 { margin: 0; font-size: 16px; font-weight: 600; }
.download-kind, .download-system { padding: 2px 8px; border-radius: var(--radius-pill); background: var(--fill); color: var(--ink-soft); font-size: 12px; }
.download-meta, .download-audience { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.download-purpose { margin: 10px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.6; }
.download-steps { margin-top: 10px; font-size: 13px; }
.download-steps summary { cursor: pointer; color: var(--action); }
.download-steps ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; color: var(--ink-soft); }
.download-button { min-width: 96px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
@media (max-width: 640px) {
  .download-item { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .download-button { width: 100%; }
}
