:root {
  --ink: #1f2328;
  --muted: #656d76;
  --subtle: #8c959f;
  --line: #d0d7de;
  --line-soft: #eaeef2;
  --surface: #ffffff;
  --surface-soft: #f6f8fa;
  --navy: #0d1117;
  --blue: #0969da;
  --blue-dark: #0550ae;
  --green: #1a7f37;
  --red: #cf222e;
  font-family: Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--surface-soft); }
.page-watermark {
  position: fixed;
  inset: 0;
  z-index: 45;
  padding: 22px 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  grid-auto-rows: 155px;
  align-items: center;
  justify-items: center;
  overflow: hidden;
  color: #1f2328;
  opacity: .07;
  pointer-events: none;
  user-select: none;
}
.page-watermark-item { white-space: nowrap; font-size: 13px; font-weight: 650; letter-spacing: .25px; transform: rotate(-24deg); }
@media (max-width: 700px) {
  .page-watermark { grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); grid-auto-rows: 135px; }
  .page-watermark-item { font-size: 11px; }
}
@media print { .page-watermark { opacity: .11; } }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.auth-brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.auth-brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: #fff; background: var(--blue); border-radius: 9px; box-shadow: 0 8px 20px rgba(9,105,218,.2); }
.auth-brand-mark svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.auth-brand strong, .auth-brand small { display: block; }
.auth-brand strong { font-size: 19px; letter-spacing: -.3px; }
.auth-brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.auth-brand.compact .auth-brand-mark { width: 36px; height: 36px; border-radius: 8px; box-shadow: none; }
.auth-brand.compact .auth-brand-mark svg { width: 20px; height: 20px; }
.auth-brand.compact strong { font-size: 16px; }
.auth-eyebrow { color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: 1.5px; }

.auth-page { min-height: 100vh; background: var(--navy); }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(430px, .95fr); }
.login-intro { min-height: 100vh; padding: clamp(32px, 5vw, 72px); display: flex; flex-direction: column; color: #fff; background: radial-gradient(circle at 85% 10%, rgba(9,105,218,.32), transparent 30%), linear-gradient(145deg, #0d1117 0%, #161b22 62%, #0b2e55 100%); }
.login-intro .auth-brand small { color: #8c959f; }
.intro-copy { margin: auto 0; max-width: 650px; }
.intro-copy h1 { margin: 16px 0 20px; font-size: clamp(34px, 4.4vw, 62px); line-height: 1.13; letter-spacing: -2px; }
.intro-copy p { max-width: 570px; margin: 0; color: #b1bac4; font-size: 15px; line-height: 1.8; }
.login-feature-list { display: flex; flex-wrap: wrap; gap: 8px; }
.login-feature-list span { padding: 7px 11px; color: #b6e3ff; background: rgba(9,105,218,.16); border: 1px solid rgba(84,174,255,.28); border-radius: 20px; font-size: 11px; }
.login-panel { padding: 34px; display: grid; place-items: center; align-content: center; background: #f6f8fa; }
.login-card { width: min(420px, 100%); padding: 38px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 50px rgba(27,31,36,.1); }
.login-card h2 { margin: 9px 0 5px; font-size: 26px; letter-spacing: -.5px; }
.login-subtitle { margin: 0 0 26px; color: var(--muted); font-size: 13px; }
.auth-field { display: grid; gap: 7px; margin-bottom: 16px; color: var(--ink); font-size: 12px; font-weight: 700; }
.auth-field input, .form-stack input, .form-stack select, .admin-search input, .project-search input { width: 100%; height: 42px; padding: 0 12px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 7px; outline: none; }
.auth-field input:focus, .form-stack input:focus, .form-stack select:focus, .admin-search input:focus, .project-search input:focus { border-color: #54aeff; box-shadow: 0 0 0 3px rgba(84,174,255,.22); }
.auth-button { width: 100%; height: 42px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 7px; font-size: 13px; font-weight: 700; cursor: pointer; }
.auth-button.primary { color: #fff; background: var(--blue); border: 1px solid var(--blue); }
.auth-button.primary:hover { background: var(--blue-dark); }
.auth-button.wecom { color: #087d38; background: #fff; border: 1px solid #2da44e; }
.auth-button.wecom:hover { background: #dafbe1; }
.auth-button:disabled { opacity: .62; cursor: wait; }
.wecom-dot { width: 10px; height: 10px; background: #07c160; border-radius: 50%; box-shadow: 0 0 0 4px #dafbe1; }
.auth-divider { height: 39px; display: flex; align-items: center; color: var(--subtle); font-size: 10px; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--line-soft); }
.auth-divider span { padding: 0 12px; }
.auth-message { min-height: 32px; padding-top: 13px; color: var(--red); font-size: 12px; line-height: 1.5; }
.auth-message.info { color: var(--blue); }
.login-footnote { margin: 18px 0 0; color: var(--subtle); font-size: 10px; text-align: center; }

.admin-page { min-height: 100vh; background: var(--surface-soft); }
.admin-topbar { height: 66px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: #fff; border-bottom: 1px solid var(--line); }
.admin-nav { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 12px; }
.admin-nav a, .admin-nav button { color: var(--blue); background: transparent; border: 0; text-decoration: none; cursor: pointer; }
.admin-nav span { padding-left: 16px; border-left: 1px solid var(--line); }
.admin-main { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 60px; }
.admin-heading { margin-bottom: 22px; display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.admin-heading h1 { margin: 8px 0 5px; font-size: 27px; letter-spacing: -.6px; }
.admin-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.heading-actions { display: flex; gap: 8px; }
.settings-content { display: grid; gap: 14px; }
.settings-tabs { padding: 4px; display: inline-flex; justify-self: start; gap: 3px; background: #eaeef2; border-radius: 8px; }
.settings-tabs button { min-height: 34px; padding: 0 16px; color: var(--muted); background: transparent; border: 0; border-radius: 6px; font-size: 12px; font-weight: 700; cursor: pointer; }
.settings-tabs button.active { color: var(--ink); background: #fff; box-shadow: 0 1px 3px rgba(27,31,36,.12); }
.admin-primary, .admin-secondary, .admin-danger, .dialog-close { min-height: 34px; padding: 0 13px; border-radius: 6px; font-size: 12px; font-weight: 700; cursor: pointer; }
.admin-primary { color: #fff; background: var(--blue); border: 1px solid var(--blue); }
.admin-primary:hover { background: var(--blue-dark); }
.admin-secondary { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.admin-secondary:hover { background: var(--surface-soft); }
.admin-danger { color: var(--red); background: #fff; border: 1px solid #ff8182; }
.admin-danger:hover:not(:disabled) { color: #fff; background: var(--red); }
.admin-danger:disabled { color: var(--subtle); background: var(--surface-soft); border-color: var(--line); cursor: not-allowed; opacity: .68; }
.link-button { display: inline-flex; align-items: center; text-decoration: none; }
.admin-notice { margin-bottom: 16px; padding: 11px 13px; color: #116329; background: #dafbe1; border: 1px solid #aceebb; border-radius: 7px; font-size: 12px; }
.admin-notice.error { color: #a40e26; background: #ffebe9; border-color: #ff8182; }
.admin-card { background: #fff; border: 1px solid var(--line); border-radius: 9px; box-shadow: 0 1px 0 rgba(27,31,36,.03); }
.admin-card-head { padding: 18px 20px; display: flex; align-items: end; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.admin-card-head h2, .forbidden-card h2 { margin: 0 0 4px; font-size: 16px; }
.admin-card-head p, .forbidden-card p { margin: 0; color: var(--muted); font-size: 11px; }
.category-create { display: flex; align-items: end; gap: 8px; }
.category-create label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; }
.category-create input, .category-name-input { height: 35px; padding: 0 10px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; outline: none; }
.category-create input { width: 250px; }
.category-create input:focus, .category-name-input:focus { border-color: #54aeff; box-shadow: 0 0 0 3px rgba(84,174,255,.22); }
.category-name-input { width: min(320px, 100%); font-size: 12px; }
.category-order-actions { display: flex; gap: 4px; }
.category-order-actions button { width: 29px; height: 29px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
.category-order-actions button:hover:not(:disabled) { color: var(--blue); background: #ddf4ff; border-color: #b6d7f6; }
.category-order-actions button:disabled { opacity: .35; cursor: default; }
.category-status { white-space: nowrap; }
.category-usage { color: var(--muted); white-space: nowrap; }
.category-save { min-width: 62px; }
.category-actions { display: flex; align-items: center; gap: 7px; }
.settings-footnote { margin: 0; padding: 11px 20px; color: var(--muted); background: #fbfcfd; border-top: 1px solid var(--line-soft); font-size: 10px; }
.user-card-actions { display: flex; align-items: end; gap: 8px; }
.admin-search, .project-search { display: grid; gap: 5px; color: var(--muted); font-size: 10px; }
.admin-search input { width: 230px; height: 35px; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.admin-table th, .admin-table td { padding: 12px 20px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.admin-table th { color: var(--muted); background: #fbfcfd; font-size: 10px; font-weight: 800; letter-spacing: .4px; }
.admin-table tr:last-child td { border-bottom: 0; }
.user-table { min-width: 1320px; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.user-avatar { width: 32px; height: 32px; display: grid; place-items: center; color: #fff; background: var(--blue); border-radius: 50%; font-size: 11px; font-weight: 800; }
.user-cell strong, .user-cell small { display: block; }
.user-cell small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.user-name-input { width: 180px; height: 34px; padding: 0 9px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-size: 11px; }
.user-name-input:focus { border-color: #54aeff; box-shadow: 0 0 0 3px rgba(84,174,255,.2); outline: 0; }
.user-name-input:disabled { color: var(--muted); background: #f6f8fa; }
.user-email { display: block; min-width: 190px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.department-badge { display: inline-flex; min-height: 26px; padding: 4px 8px; align-items: center; color: #57606a; background: #f6f8fa; border: 1px solid #d8dee4; border-radius: 13px; font-size: 10px; white-space: nowrap; }
.role-select { height: 33px; padding: 0 8px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; }
.status-toggle { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); }
.status-toggle input { width: 15px; height: 15px; accent-color: var(--green); }
.project-access-button { min-height: 32px; padding: 0 10px; color: var(--blue); background: #fff; border: 1px solid #b6d7f6; border-radius: 6px; font-size: 11px; cursor: pointer; }
.project-access-button:hover { background: #ddf4ff; }
.password-button { white-space: nowrap; }
.project-all-badge { padding: 4px 8px; color: #116329; background: #dafbe1; border-radius: 14px; font-size: 10px; font-weight: 700; }
.forbidden-card { padding: 30px; }
.forbidden-card p { margin-bottom: 18px; }

.admin-dialog { width: min(560px, calc(100vw - 28px)); padding: 0; color: var(--ink); background: #fff; border: 1px solid #57606a; border-radius: 10px; box-shadow: 0 22px 70px rgba(1,4,9,.35); }
.admin-dialog::backdrop { background: rgba(1,4,9,.55); backdrop-filter: blur(2px); }
.admin-dialog.project-dialog { width: min(760px, calc(100vw - 28px)); }
.admin-dialog header { min-height: 70px; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.admin-dialog header h2 { margin: 5px 0 0; font-size: 18px; }
.dialog-close { width: 34px; padding: 0; color: var(--muted); background: #fff; border: 1px solid var(--line); font-size: 20px; font-weight: 400; }
.dialog-body { padding: 18px; }
.admin-dialog footer { min-height: 60px; padding: 12px 18px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.admin-dialog footer > span { margin-right: auto; color: var(--muted); font-size: 11px; }
.form-stack { display: grid; gap: 14px; }
.form-stack label { display: grid; gap: 6px; color: var(--ink); font-size: 11px; font-weight: 700; }
.dialog-message { min-height: 18px; color: var(--red); font-size: 11px; }
.dialog-message.saving { color: var(--blue); }
.dialog-message.success { color: var(--green); }
.project-toolbar { display: grid; grid-template-columns: 1fr auto auto; align-items: end; gap: 8px; }
.project-search input { height: 36px; }
.project-help { margin: 10px 0; color: var(--muted); font-size: 10px; }
.project-list { max-height: 430px; overflow: auto; border: 1px solid var(--line); border-radius: 7px; }
.scope-save-message { min-height: 18px; margin: 9px 0 -8px; color: var(--muted); font-size: 11px; }
.scope-save-message.saving { color: var(--blue); }
.scope-save-message.success { color: var(--green); }
.scope-save-message.error { color: var(--red); }
.project-option { min-height: 42px; padding: 8px 11px; display: grid; grid-template-columns: 18px minmax(110px, .45fr) 1fr; align-items: center; gap: 8px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.project-option:last-child { border-bottom: 0; }
.project-option:hover { background: var(--surface-soft); }
.project-option input { width: 15px; height: 15px; accent-color: var(--blue); }
.project-option strong { font-size: 11px; }
.project-option span { color: var(--muted); font-size: 10px; }
.project-empty { padding: 34px; color: var(--muted); text-align: center; font-size: 12px; }
.notification-group-preview { display: block; max-width: 560px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.notification-group-editor { gap: 11px; }
.notification-member-list { max-height: 320px; }
.notification-member-option { grid-template-columns: 18px minmax(150px, .55fr) 1fr; }
.notification-member-selected { min-height: 36px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.notification-member-chip { min-height: 28px; padding: 4px 5px 4px 9px; display: inline-flex; align-items: center; gap: 5px; color: #0969da; background: #ddf4ff; border: 1px solid #b6d7f6; border-radius: 14px; font-size: 10px; font-weight: 700; }
.notification-member-chip button { width: 18px; height: 18px; padding: 0; color: #57606a; background: rgba(255,255,255,.72); border: 0; border-radius: 50%; font-size: 14px; line-height: 18px; cursor: pointer; }
.notification-member-chip button:hover { color: var(--red); background: #ffebe9; }
.notification-member-empty { color: var(--muted); font-size: 10px; }

@media (max-width: 820px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-intro { min-height: auto; padding: 28px 24px 34px; }
  .intro-copy { margin: 52px 0 42px; }
  .intro-copy h1 { font-size: 34px; letter-spacing: -1px; }
  .login-panel { padding: 28px 18px 40px; }
  .login-card { padding: 28px 22px; }
  .admin-topbar { height: auto; padding: 12px 16px; align-items: flex-start; }
  .admin-nav { flex-wrap: wrap; justify-content: flex-end; gap: 8px 12px; }
  .admin-nav span { width: 100%; padding: 0; border: 0; text-align: right; }
  .admin-main { width: min(100% - 24px, 1160px); padding-top: 24px; }
  .admin-heading { align-items: flex-start; }
  .admin-card-head { align-items: stretch; flex-direction: column; }
  .category-create, .user-card-actions { align-items: stretch; flex-wrap: wrap; }
  .category-create label, .user-card-actions .admin-search { flex: 1; }
  .category-create input { width: 100%; }
  .admin-search input { width: 100%; }
  .admin-table th, .admin-table td { padding: 10px 12px; }
  .project-toolbar { grid-template-columns: 1fr 1fr; }
  .project-search { grid-column: 1 / -1; }
  .project-option { grid-template-columns: 18px 100px minmax(140px, 1fr); }
}

@media (max-width: 520px) {
  .login-intro { display: none; }
  .login-layout { min-height: 100vh; }
  .login-panel { min-height: 100vh; }
  .admin-heading { flex-direction: column; }
  .settings-tabs { width: 100%; }
  .settings-tabs button { flex: 1; }
  .heading-actions { width: 100%; }
  .heading-actions > button { flex: 1; }
  .project-toolbar { grid-template-columns: 1fr; }
  .project-search { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
