﻿:root {
  --bg: #f7f6fc;
  --sidebar-bg: #ffffff;
  --sidebar-hover: #f0eeff;
  --sidebar-active: #eae8fe;
  --sidebar-text: #5a5676;
  --sidebar-text-active: #4f46b8;
  --sidebar-border: #eeeaf8;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 2px rgba(79,70,184,0.04), 0 4px 16px rgba(79,70,184,0.06);
  --card-shadow-hover: 0 8px 32px rgba(79,70,184,0.12);
  --border: #eae8f0;
  --text: #1a1831;
  --text-secondary: #5c5678;
  --text-muted: #9b95ad;
  --primary: #5b6cf0;
  --primary-light: #edeaff;
  --primary-dark: #4a54d8;
  --success: #34c78a;
  --success-light: #e8f9f0;
  --warning: #ebb93b;
  --warning-light: #fefbf0;
  --danger: #f25c68;
  --danger-light: #fff0f1;
  --radius: 18px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app { display: flex; min-height: 100vh; }
body.auth-loading .app,
body.auth-logged-out .app {
  display: none;
}

body.auth-logged-in .login-shell {
  display: none;
}

body.auth-session-restoring .login-shell {
  display: none;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 32px 20px 64px;
  background:
    radial-gradient(circle at top left, rgba(91, 108, 240, 0.16), transparent 32%),
    radial-gradient(circle at bottom right, rgba(52, 199, 138, 0.18), transparent 28%),
    linear-gradient(135deg, #f5f6ff 0%, #f8fcfb 100%);
}

.login-card {
  width: min(460px, 100%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(234, 232, 240, 0.9);
  border-radius: 28px;
  box-shadow: 0 24px 80px rgba(36, 45, 94, 0.12);
  padding: 30px;
  backdrop-filter: blur(18px);
}

.icp-link {
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: none;
  transition: color var(--transition);
}

.icp-link:hover {
  color: var(--primary);
}

.login-icp-link {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.login-brand-mark {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #5b6cf0 0%, #34c78a 100%);
  color: #fff;
  font-size: 24px;
  box-shadow: 0 12px 28px rgba(91, 108, 240, 0.24);
}

.login-brand h1 {
  font-size: 24px;
  margin-bottom: 4px;
}

.login-brand p {
  color: var(--text-secondary);
  font-size: 13px;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.login-form input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}

.login-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(91, 108, 240, 0.12);
}

.login-submit {
  margin-top: 8px;
  height: 46px;
  font-size: 14px;
  justify-content: center;
}

.login-status-message {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--danger-light);
  color: var(--danger);
  font-size: 12px;
}

.login-hint {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12px;
  margin: 4px 0;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.dingtalk-login-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dingtalk-login-button {
  min-height: 42px;
  justify-content: center;
  border: 1px solid #d9e7ff;
  background: #f2f7ff;
  color: #1677ff;
}

.dingtalk-login-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.dingtalk-qr-panel {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  text-align: center;
  overflow: hidden;
}

#dingtalkQrContainer {
  min-height: 300px;
}

.dingtalk-qr-tip {
  color: var(--text-muted);
  font-size: 12px;
}

.dingtalk-tab-desc {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 4px 0;
}

.dingtalk-tab-button {
  width: 100%;
  min-height: 44px;
  justify-content: center;
  font-size: 14px;
  margin-top: 4px;
}

/* LOGIN TABS */
.login-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  background: #f0f0f5;
  border-radius: 12px;
  padding: 3px;
}

.login-tab {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.login-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.login-tab:hover:not(.active) {
  color: var(--text);
}

.login-tab-panel {
  display: none;
}

.login-tab-panel.active {
  display: grid;
  gap: 10px;
}

/* SIDEBAR */
.sidebar {
  width: 228px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  box-shadow: 2px 0 24px rgba(79,70,184,0.06);
}

.sidebar-logo {
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo .icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #5b6cf0 0%, #8a7af8 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  color: #fff;
  box-shadow: 0 2px 8px rgba(91,108,240,0.3);
}

.sidebar-logo h1 {
  font-size: 14px;
  font-weight: 700;
  color: #1a1831;
  letter-spacing: 0.3px;
}

.sidebar-logo span {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  font-weight: 400;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13.5px;
  color: var(--sidebar-text);
  margin-bottom: 3px;
  user-select: none;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  font-weight: 600;
}

.nav-item .nav-icon {
  font-size: 17px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item.active .nav-icon { opacity: 1; color: var(--primary); }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--sidebar-border);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

/* MAIN CONTENT */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-left: 228px;
  padding: 28px 32px 48px;
  overflow-y: auto;
  min-height: 100vh;
  background: var(--bg);
}

.app-footer {
  margin-top: auto;
  padding-top: 32px;
  text-align: center;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 12px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.user-menu {
  position: relative;
}

.user-menu-trigger {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 999px;
  padding: 4px 8px 4px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-family: inherit;
}

.user-menu-trigger img,
.account-info-header img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--primary-light);
}

.user-menu-trigger span {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}

.user-menu-trigger strong {
  font-size: 12px;
  color: var(--text);
}

.user-menu-trigger small {
  font-size: 10px;
  color: var(--text-muted);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(36, 45, 94, 0.12);
  padding: 8px;
  z-index: 300;
}

.user-menu-dropdown button {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
}

.user-menu-dropdown button:hover {
  background: var(--primary-light);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeUp 0.3s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* PAGE HEADER */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.pm-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  background: #fff8e1;
  border: 1px solid #ffcc02;
  font-size: 12px;
  font-weight: 500;
  color: #8a6d00;
}

.page-header .subtitle {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.account-info-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.account-info-name {
  font-size: 18px;
  font-weight: 700;
}

.account-info-role {
  color: var(--text-secondary);
  font-size: 13px;
}

.account-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.account-info-grid div {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fbfbfe;
}

.account-info-grid label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.account-info-grid span {
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}

.account-info-tip {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--warning-light);
  color: var(--text-secondary);
  font-size: 12px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.stat-search-box {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 250px;
  padding: 0 12px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(79,70,184,0.06);
  transition: all var(--transition);
}

.stat-search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(91,108,240,0.10);
}

.stat-search-icon {
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
}

.stat-search-box input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}

.stat-search-box input::placeholder {
  color: var(--text-muted);
}

/* STATISTICS PERIOD SELECTOR */
.year-month-selector {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 40px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(79,70,184,0.06);
  transition: all var(--transition);
}

.year-month-selector:hover,
.year-month-selector:focus-within {
  border-color: #c4c0eb;
  box-shadow: 0 0 0 4px rgba(91,108,240,0.08);
}

.year-month-selector select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  outline: 0;
  height: 32px;
  padding: 0 23px 0 8px;
  border-radius: 8px;
  background:
    linear-gradient(45deg, transparent 50%, #8179b5 50%) calc(100% - 10px) 14px / 4px 4px no-repeat,
    linear-gradient(135deg, #8179b5 50%, transparent 50%) calc(100% - 6px) 14px / 4px 4px no-repeat;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}

.year-month-selector select:hover {
  background-color: var(--primary-light);
}

.year-month-selector select:focus {
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

.year-month-selector #statMonth,
.year-month-selector #specialInfoMonth {
  min-width: 184px;
}

.ym-divider {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}

.stat-export-btn {
  height: 40px;
  padding: 0 17px;
  border-color: #dcd9f0;
  color: var(--primary-dark);
  font-weight: 600;
}

.stat-export-btn span {
  font-size: 15px;
  transition: transform var(--transition);
}

.stat-export-btn:hover {
  background: var(--primary-light);
  border-color: #c9c4ef;
  color: var(--primary-dark);
  box-shadow: 0 3px 10px rgba(91,108,240,0.12);
  transform: translateY(-1px);
}

.stat-export-btn:hover span {
  transform: translateY(1px);
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 20px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: 0.1px;
}

.btn-primary {
  background: linear-gradient(135deg, #5b6cf0 0%, #4a54d8 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(91,108,240,0.3);
}
.btn-primary:hover { background: linear-gradient(135deg, #4a54d8 0%, #3d44b8 100%); box-shadow: 0 4px 14px rgba(91,108,240,0.4); }

.btn:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.btn-secondary:hover { background: #f7f6ff; border-color: #d4d0ee; }

.btn-success {
  background: linear-gradient(135deg, #34c78a 0%, #2ab076 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(52,199,138,0.25);
}
.btn-success:hover { background: linear-gradient(135deg, #2ab076 0%, #229a64 100%); }

.btn-danger {
  background: linear-gradient(135deg, #f25c68 0%, #d94450 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(242,92,104,0.25);
}
.btn-danger:hover { background: linear-gradient(135deg, #d94450 0%, #c03842 100%); }

.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 5px; }
.btn-xs { padding: 3px 9px; font-size: 11px; border-radius: 5px; }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 14px;
  color: var(--text-secondary);
}
.btn-icon:hover { background: #f7f6ff; color: var(--text); }

/* CARDS */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--card-shadow-hover); }

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-header h3 {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--text);
}

.card-body { padding: 20px; }

/* TABLES */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: #f7f6ff;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.3px;
  border-bottom: 2px solid #eae8f0;
  white-space: nowrap;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f0eef5;
  font-size: 12px;
}

.data-table tbody tr:hover { background: #f7f6ff; }

/* TAGS */
.tag {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 500;
}

.tag-blue { background: #edeaff; color: #5b6cf0; }
.tag-purple { background: #f3e8ff; color: #7c3aed; }
.tag-green { background: #e8f9f0; color: #2d9d5a; }
.tag-amber { background: #fefbf0; color: #d4960a; }
.tag-red { background: #fff0f1; color: #f25c68; }
.tag-gray { background: #f5f4fa; color: #6b5e50; }

/* AUDIT PAGINATION */
.audit-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.audit-pagination-info {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.audit-pagination-pages {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}

.audit-pagination-btn {
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  transition: all 0.15s;
}

.audit-pagination-btn:hover:not(:disabled):not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}

.audit-pagination-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.audit-pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.audit-pagination-ellipsis {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 12px;
  color: var(--text-muted);
}

/* FORMS */
.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-group label .required { color: var(--danger); margin-left: 2px; }

.form-group input,
.form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text);
  background: #fff;
  transition: all var(--transition);
  font-family: inherit;
  outline: none;
}

.form-group input::placeholder { color: var(--text-muted); }

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91,108,240,0.08);
}

.form-group input.field-invalid {
  border-color: var(--danger);
  background: var(--danger-light);
  box-shadow: 0 0 0 3px rgba(242,92,104,0.08);
}

.field-validation-message {
  margin-top: 4px;
  color: var(--danger);
  font-size: 11px;
  line-height: 1.4;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(26,24,49,0.3);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.modal {
  background: var(--card-bg);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(26,24,49,0.14);
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}

.modal.modal-lg { width: 720px; }
.modal.modal-xl { width: 900px; }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-10px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
  width: 30px; height: 30px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 17px;
  color: var(--text-muted);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.modal-close:hover { background: #f3f4f8; color: var(--text); }

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

/* TOAST */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  animation: toastIn 0.2s ease;
  max-width: 320px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* FILTER BAR */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-bar input,
.filter-bar select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text);
  background: #fff;
  font-family: inherit;
  outline: none;
}

.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91,108,240,0.08);
}

/* GROUP FILTER DROPDOWN (DOM-based, avoids native select popup lag) */
.group-filter-dropdown {
  position: relative;
  font-size: 13px;
  user-select: none;
}
.group-filter-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text);
  background: #fff;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  box-sizing: border-box;
}
.group-filter-trigger:hover { border-color: #d4cfee; }
.group-filter-dropdown.open .group-filter-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91,108,240,0.08);
}
.group-filter-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-filter-text.placeholder { color: var(--text-muted); }
.group-filter-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 10px;
  transition: transform 0.2s ease;
  opacity: 0.6;
}
.group-filter-dropdown.open .group-filter-arrow {
  transform: rotate(180deg);
  color: var(--primary);
  opacity: 1;
}
.group-filter-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #ece9f5;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03), 0 8px 24px rgba(36,40,90,0.08);
  z-index: 210;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
}
.group-filter-item {
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  transition: background 0.12s ease;
}
.group-filter-item:hover { background: #f2f0fc; }
.group-filter-item.selected {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

.project-assignee-trigger {
  width: 100%;
  min-width: 110px;
  min-height: 30px;
  padding: 5px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.3;
  box-sizing: border-box;
}
.project-assignee-trigger:hover,
.project-assignee-trigger.open {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91,108,240,0.08);
}
.project-assignee-trigger.is-empty {
  color: var(--text-muted);
}
.project-assignee-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-assignee-arrow {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: 10px;
  opacity: 0.7;
}
.project-assignee-trigger.open .project-assignee-arrow {
  transform: rotate(180deg);
  color: var(--primary);
  opacity: 1;
}
.project-assignee-panel {
  background: #fff;
  border: 1px solid #ece9f5;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.03), 0 8px 24px rgba(36,40,90,0.08);
  z-index: 810;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
}
.project-assignee-option,
.project-assignee-empty {
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}
.project-assignee-option {
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.project-assignee-option:hover {
  background: #f2f0fc;
}
.project-assignee-option.selected {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}
.project-assignee-empty {
  color: var(--text-muted);
}

/* PAGINATION */
.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.pagination button {
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  transition: all var(--transition);
}

.pagination button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* SCHEDULE VIEW */
.schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #f3f4f8;
  border-radius: 8px;
  padding: 3px;
}

.toggle-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}

.toggle-btn:hover { background: #e8e6f0; color: var(--text); }
.toggle-btn.active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.1); }

.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-nav .date-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  min-width: 160px;
  text-align: center;
}

/* CALENDAR GRID */
.calendar-container {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.calendar-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.calendar-table th {
  background: #f7f6ff;
  padding: 10px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid #eae8f0;
  text-align: center;
  white-space: nowrap;
}

.calendar-table th.emp-col {
  width: 140px;
  text-align: left;
  padding-left: 14px;
  position: sticky;
  left: 0;
  background: #f7f6ff;
  z-index: 2;
}

.calendar-table td {
  border: 1px solid #f0eef5;
  padding: 0;
  min-height: 82px;
  height: auto;
  vertical-align: top;
  position: relative;
}

.calendar-table td.emp-cell {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  position: sticky;
  left: 0;
  z-index: 1;
  border-right: 2px solid var(--border);
  height: auto;
  vertical-align: middle;
}

.calendar-table td.day-cell {
  cursor: pointer;
  transition: background var(--transition);
  min-width: 120px;
  vertical-align: top;
}

.calendar-table tr.anchor-section-divider td {
  padding: 8px 14px;
  background: #f5f5f7;
  color: #8f8f98;
  font-size: 12px;
  font-weight: 700;
  border-top: 2px dashed #d9d9e3;
  border-bottom: 2px dashed #d9d9e3;
  text-align: center;
}

.calendar-table tr.departed-anchor-row td.emp-cell {
  background: #fafafa;
  color: #666;
}

.calendar-table tr.departed-anchor-row td.day-cell {
  background: #fcfcfc;
}

.calendar-table td.day-cell:hover { background: #f7f6ff; }

.calendar-table td.day-cell.weekend { background: #faf9ff; }


.calendar-table td.day-cell.today {
  background: #edeaff;
  box-shadow: inset 0 0 0 2px var(--primary);
}

.calendar-table td.day-cell.single-selected {
  background: #dfe7ff;
  box-shadow: inset 0 0 0 2px var(--primary-dark);
}

.calendar-table td.day-cell.range-selected {
  background: #e8edff;
  box-shadow: inset 0 0 0 2px rgba(91, 108, 240, 0.45);
}

.calendar-table td.day-cell.other-month { background: #f8f8fc; }

.calendar-table td.day-cell.readonly-cell {
  cursor: not-allowed;
  position: relative;
}
.calendar-table td.day-cell.readonly-cell::after {
  content: '🔒';
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 8px;
  opacity: 0.35;
}

.day-cell .shift-badges {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 5px 10px;
}

.day-cell .shift-badge {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 5px;
  color: #fff;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  text-align: left;
}

/* SHIFT MODAL TIMELINE */
.timeline-container {
  margin-top: 16px;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.timeline-header h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.project-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.project-tab {
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  transition: all var(--transition);
  white-space: nowrap;
}

.project-tab:hover { border-color: var(--primary); color: var(--primary); }
.project-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.timeline-track {
  position: relative;
  height: 110px;
  background: #fafbfe;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  user-select: none;
}

.timeline-track::-webkit-scrollbar { height: 6px; }
.timeline-track::-webkit-scrollbar-thumb { background: #d4d2e0; border-radius: 3px; }

.timeline-hours {
  display: flex;
  height: 24px;
  border-bottom: 1px solid var(--border);
  width: max-content;
  min-width: 100%;
}

.timeline-hour {
  width: 80px;
  flex-shrink: 0;
  text-align: left;
  padding-left: 4px;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 24px;
  border-right: 1px solid #f0eef5;
  box-sizing: border-box;
}

.timeline-slots {
  display: flex;
  height: 86px;
  position: relative;
  width: max-content;
  min-width: 100%;
}

.timeline-slot {
  width: 20px;
  flex-shrink: 0;
  border-right: 1px dashed #e8e6f0;
  cursor: crosshair;
  position: relative;
}

.timeline-slot.half-border { border-right-style: solid; border-right-color: #d4d2e0; }

.timeline-block {
  position: absolute;
  top: 6px;
  bottom: 6px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
  padding: 4px 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  z-index: 2;
  gap: 2px;
}

.timeline-block:hover {
  filter: brightness(1.08);
  z-index: 10;
  overflow: visible;
}

.timeline-block .block-name {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.timeline-block .block-time {
  font-size: 10px;
  opacity: 0.9;
  white-space: nowrap;
}

.timeline-block .block-duration {
  font-size: 10px;
  opacity: 0.85;
  white-space: nowrap;
}

/* Narrow block (< 80px): hide duration, smaller fonts */
.timeline-block.narrow { gap: 1px; padding: 2px 4px; }
.timeline-block.narrow .block-name { font-size: 11px; }
.timeline-block.narrow .block-time { font-size: 9px; }
.timeline-block.narrow .block-duration { display: none; }

/* Very narrow block (< 40px): only show time */
.timeline-block.very-narrow { justify-content: center; gap: 0; padding: 1px 2px; }
.timeline-block.very-narrow .block-name,
.timeline-block.very-narrow .block-duration,
.timeline-block.very-narrow .emp-label { display: none; }
.timeline-block.very-narrow .block-time { font-size: 9px; }

.timeline-block:hover { filter: brightness(1.1); }

.timeline-block .block-delete {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0,0,0,0.35);
  color: #fff;
  border: none;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
  cursor: pointer;
  display: none;
  padding: 0;
  z-index: 3;
}
.timeline-block:hover .block-delete { display: block; }
.timeline-block .block-delete:hover { background: var(--danger, #e74c3c); }

.timeline-drag-highlight {
  position: absolute;
  top: 8px;
  bottom: 8px;
  background: rgba(91,74,224,0.25);
  border: 1px dashed var(--primary);
  border-radius: 6px;
  pointer-events: none;
  z-index: 1;
}

/* ERASER MODE */
.eraser-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  transition: all var(--transition);
  white-space: nowrap;
}
.eraser-btn:hover { border-color: var(--danger); color: var(--danger); }
.eraser-btn.active {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
  box-shadow: 0 2px 8px rgba(239,68,68,0.3);
}
.eraser-btn .eraser-icon { font-size: 15px; }

.project-status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 72px;
  padding: 2px 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.project-status-toggle:hover {
  opacity: 0.9;
}

.project-status-switch {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: #d4d2e0;
  transition: background var(--transition);
  flex-shrink: 0;
}

.project-status-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform var(--transition), background var(--transition);
}

.project-status-toggle.is-live {
  color: var(--success);
}

.project-status-toggle.is-live .project-status-switch {
  background: #34c78a;
}

.project-status-toggle.is-stopped {
  color: var(--danger);
}

.project-status-toggle.is-live .project-status-toggle-knob {
  transform: translateX(14px);
}

.project-status-toggle.is-stopped .project-status-switch {
  background: #f25c68;
}

.project-status-toggle-text {
  line-height: 1;
  min-width: 24px;
  text-align: left;
}

body.eraser-mode .calendar-table td.day-cell { cursor: not-allowed; }
body.eraser-mode .calendar-table td.day-cell:hover { background: #fff0f0 !important; box-shadow: inset 0 0 0 2px var(--danger); }
body.eraser-mode .calendar-table td.day-cell.weekend:hover { background: #fff0f0 !important; }
body.eraser-mode .calendar-table td.day-cell.today:hover { background: #fff0f0 !important; box-shadow: inset 0 0 0 2px var(--danger); }
body.eraser-mode .day-cell .shift-badge { cursor: crosshair; }
body.eraser-mode .day-cell .shift-badge:hover { filter: brightness(0.7); outline: 2px solid var(--danger); outline-offset: 1px; }
body.eraser-mode .timeline-block { cursor: crosshair !important; }
body.eraser-mode .timeline-block:hover { filter: brightness(0.7); outline: 2px solid var(--danger); outline-offset: -2px; }
body.eraser-mode .timeline-slot { cursor: crosshair; }
body.eraser-mode .timeline-slot:hover { background: rgba(245,91,108,0.08); }

/* CONTEXT MENU */
.context-menu {
  position: absolute;
  background: #fff;
  border-radius: var(--radius-xs);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  border: 1px solid var(--border);
  z-index: 250;
  min-width: 120px;
  overflow: hidden;
}

.context-menu-item {
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition);
  color: var(--text);
}

.context-menu-item:hover { background: #f8f9fd; }

.context-menu-item.danger { color: var(--danger); }
.context-menu-item.danger:hover { background: var(--danger-light); }

/* STATS TABLE */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.special-info-summary {
  grid-template-columns: repeat(2, minmax(220px, 260px)) minmax(360px, 1fr);
}

.pm-hide { display: none; }

.stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all var(--transition);
}
.stat-card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-1px); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.blue { background: #edeaff; color: #5b6cf0; }
.stat-icon.green { background: #e8f9f0; color: #34c78a; }
.stat-icon.amber { background: #fefbf0; color: #d4960a; }
.stat-icon.purple { background: #edeaff; color: #5b6cf0; }

.stat-label { font-size: 11.5px; color: var(--text-secondary); margin-bottom: 1px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text); letter-spacing: -0.5px; }

.special-cycle-card {
  min-width: 0;
}

.special-cycle-info {
  min-width: 0;
}

.special-cycle-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  white-space: normal;
  word-break: break-word;
}

/* PROJECT COLOR DOT */
.color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.empty-state .empty-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state .empty-desc {
  font-size: 13px;
}

/* SECTION TITLE IN MODAL */
.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin: 20px 0 12px;
  padding-left: 10px;
  border-left: 3px solid #5b6cf0;
}

.section-title:first-child { margin-top: 0; }

/* ROLE SELECTOR */
.role-selector {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.role-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: #faf9ff;
  cursor: pointer;
  transition: all var(--transition);
  min-width: 220px;
  user-select: none;
  position: relative;
}

.role-card:hover {
  border-color: #c4bcf5;
  background: #f7f6ff;
  box-shadow: 0 2px 8px rgba(91,108,240,0.1);
}

.role-card.active {
  border-color: var(--primary);
  background: #edeaff;
  box-shadow: 0 2px 12px rgba(91,108,240,0.15);
}

.role-card-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #5b6cf0 0%, #8a7af8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(91,108,240,0.25);
}

.role-card.active .role-card-icon {
  background: linear-gradient(135deg, #4a54d8 0%, #6a5ce0 100%);
  box-shadow: 0 3px 10px rgba(91,108,240,0.35);
}

.role-card-info {
  flex: 1;
  min-width: 0;
}

.role-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.role-card.active .role-card-name { color: var(--primary); }

.role-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.role-card-count {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  margin-top: 1px;
}

.role-card-add {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(91,108,240,0.3);
  line-height: 1;
  padding: 0;
}

.role-card-add:hover {
  background: var(--primary-dark);
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(91,108,240,0.4);
}

.role-card-check {
  display: none;
}

/* RESPONSIVE */
@media (max-width: 1280px) {
  .special-info-summary {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

  .special-cycle-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .special-info-summary { grid-template-columns: 1fr; }
  .special-cycle-card { grid-column: auto; }
  .header-actions { width: 100%; flex-wrap: wrap; }
  .stat-search-box { min-width: 100%; }
  .year-month-selector { max-width: 100%; }
  .year-month-selector #statMonth,
  .year-month-selector #specialInfoMonth { min-width: 150px; }
  .app-topbar { flex-direction: column; align-items: stretch; }
  .user-menu-trigger { width: 100%; justify-content: space-between; }
  .account-info-grid { grid-template-columns: 1fr; }
  .login-card { padding: 24px 18px; }
}

/* ============================== 主播排班 ============================== */
.anchor-schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.anchor-proj-select-group {
  position: relative;
  display: flex;
  align-items: center;
}
.anchor-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  box-shadow: var(--card-shadow);
  z-index: 200;
  max-height: 240px;
  overflow-y: auto;
  min-width: 200px;
  margin-top: 4px;
}
.anchor-dropdown-item {
  padding: 8px 14px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition);
}
.anchor-dropdown-item:hover {
  background: var(--sidebar-hover);
}
.anchor-dropdown-item.selected {
  background: var(--primary-light);
  font-weight: 600;
}
.anchor-proj-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.anchor-proj-tag .remove-proj {
  cursor: pointer;
  opacity: 0.7;
  font-size: 16px;
  line-height: 1;
  margin-left: 4px;
}
.anchor-proj-tag .remove-proj:hover { opacity: 1; }
.anchor-lib-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition);
  margin-bottom: 4px;
}
.anchor-lib-item:hover { background: var(--sidebar-hover); }
.anchor-lib-item.checked { background: var(--primary-light); }
.anchor-lib-item .check-box {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
  color: transparent;
  transition: all var(--transition);
}
.anchor-lib-item.checked .check-box {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.conflict-badge {
  display: inline-block;
  background: var(--danger-light);
  color: var(--danger);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 2px;
  font-weight: 500;
  line-height: 1.3;
}
.admin-only { display: none !important; }
.admin-sidebar-only { display: none; }
body.admin-identity .nav-item.admin-only { display: flex !important; }
body.admin-identity button.admin-only { display: inline-flex !important; }
body.admin-identity .admin-sidebar-only { display: block; }
.backend-connection-blocker {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(22, 24, 35, 0.72);
  backdrop-filter: blur(4px);
}
.backend-connection-blocker.visible { display: flex; }
.backend-connection-card {
  width: min(460px, calc(100vw - 32px));
  padding: 28px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.25);
  text-align: center;
}

#floatingLayerRoot {
  position: fixed;
  inset: 0;
  z-index: 800;
  pointer-events: none;
}

#floatingLayerRoot .group-filter-panel,
#floatingLayerRoot .cascader-panel,
#floatingLayerRoot .cascader-subpanel,
#floatingLayerRoot .project-assignee-panel {
  pointer-events: auto;
}

#floatingLayerRoot .group-filter-panel,
#floatingLayerRoot .project-assignee-panel,
#floatingLayerRoot .cascader-level {
  overscroll-behavior: contain;
}

/* ============================== CASCADER 级联选择器 ============================== */
.cascader {
  position: relative;
  width: 100%;
  font-family: inherit;
}

/* ——— 触发器 ——— */
.cascader-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  min-height: 37px;
  box-sizing: border-box;
}
.cascader-trigger:hover {
  border-color: #d4cfee;
}
.cascader.open .cascader-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91,108,240,0.10);
}

.cascader-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}
.cascader-text.placeholder { color: var(--text-muted); }

.cascader-arrow {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  color: var(--text-muted);
  transition: transform 0.2s ease, color 0.15s;
  font-size: 10px;
  opacity: 0.6;
}
.cascader.open .cascader-arrow {
  transform: rotate(180deg);
  color: var(--primary);
  opacity: 1;
}

/* ——— 下拉面板（一级） ——— */
.cascader-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #fff;
  border: 1px solid #ece9f5;
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.02),
    0 2px 4px rgba(0,0,0,0.03),
    0 8px 24px rgba(36,40,90,0.08);
  z-index: 210;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  transform-origin: top left;
  animation: cascaderIn 0.15s ease-out;
  overflow: visible;
}
@keyframes cascaderIn {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to   { opacity: 1; transform: scale(1)     translateY(0); }
}

/* ——— 子面板（二级浮层，HeroUI 风格） ——— */
.cascader-subpanel {
  position: absolute;
  z-index: 211;
  background: #fff;
  border: 1px solid #ece9f5;
  border-radius: 10px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.02),
    0 4px 8px rgba(0,0,0,0.04),
    0 12px 28px rgba(36,40,90,0.09);
  animation: cascaderSubIn 0.12s ease-out;
  overflow: visible;
}
@keyframes cascaderSubIn {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ——— 列（通用） ——— */
.cascader-level {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: none;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  scrollbar-width: thin;
}

/* 滚动条 */
.cascader-level::-webkit-scrollbar { width: 5px; }
.cascader-level::-webkit-scrollbar-track { background: transparent; }
.cascader-level::-webkit-scrollbar-thumb { background: #e8e4f0; border-radius: 3px; }
.cascader-level::-webkit-scrollbar-thumb:hover { background: #d5cfe4; }

/* ——— 选项 ——— */
.cascader-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  white-space: nowrap;
  text-align: left;
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cascader-item + .cascader-item { margin-top: 1px; }

/* hover — 半透明主色背景 */
.cascader-item:hover {
  background: rgba(91,108,240,0.08);
  color: var(--primary-dark);
}

/* 展开态 — 稍深色背景 */
.cascader-item.hover {
  background: rgba(91,108,240,0.12);
  color: var(--primary-dark);
  font-weight: 500;
}

/* ——— 箭头 ——— */
.cascader-item-arrow {
  font-size: 11px;
  color: #c8c2d8;
  margin-left: auto;
  flex-shrink: 0;
  transition: transform 0.15s ease, color 0.15s;
}
.cascader-item:hover .cascader-item-arrow,
.cascader-item.hover .cascader-item-arrow {
  color: var(--primary);
}

/* ——— “不选子组” ——— */
.cascader-item.cascader-skip {
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 4px;
  border-radius: 7px 7px 4px 4px;
}
.cascader-item.cascader-skip::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10px;
  right: 10px;
  height: 1px;
  background: #f1eef7;
}
.cascader-item.cascader-skip:hover {
  background: rgba(91,108,240,0.06);
  color: var(--text-secondary);
}

/* ——— 二级子面板选项 ——— */
.cascader-subpanel .cascader-item:not(.cascader-skip)::before {
  content: '';
  width: 4px; height: 4px;
  border-radius: 50%;
  background: #d5d0e8;
  margin-right: 6px;
  flex-shrink: 0;
  transition: background 0.15s;
}
.cascader-subpanel .cascader-item:not(.cascader-skip):hover::before {
  background: var(--primary);
}

/* ===== 表格内联级联器 ===== */
.cascader-inline {
  display: inline-block;
  width: 100%;
}
.cascader-inline .cascader-trigger {
  padding: 5px 8px;
  min-height: 30px;
  font-size: 12px;
  border-radius: 6px;
  gap: 4px;
}
.cascader-inline .cascader-arrow {
  width: 14px; height: 14px;
  font-size: 9px;
  opacity: 0.5;
}
.cascader-inline .cascader-panel {
  top: calc(100% + 2px);
  left: 0;
  right: auto;
  border-radius: 8px;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
}
.cascader-inline .cascader-subpanel {
  border-radius: 8px;
}
.cascader-inline .cascader-level {
  width: 100%;
  min-width: 0;
  max-width: none;
  max-height: 192px;
  padding: 0;
}
.cascader-inline .cascader-subpanel .cascader-level {
  width: 176px;
  min-width: 176px;
  max-width: 176px;
}
.cascader-inline .cascader-item {
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 5px;
}
.cascader-inline .cascader-item-arrow { font-size: 10px; }
.cascader-inline .cascader-item.cascader-skip { font-size: 11px; }


