:root {
  color-scheme: light;
  --canvas: #f5f4fa;
  --paper: #fff;
  --ink: #201b35;
  --muted: #655e77;
  --edge: #e8e5ef;
  --accent: #4a2ca7;
  --accent-strong: #3c1e90;
  --tint: #eee8fc;
  --shadow: 0 4px 18px #2d204608;
  --motion: cubic-bezier(.2,.75,.25,1);
  --header-size: 70px;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--canvas); color: var(--ink); min-height: 100vh; }
h1, h2, p, ul, dl { margin: 0; }
h1 { font-size: clamp(29px, 4vw, 42px); font-weight: 720; letter-spacing: -.037em; line-height: 1.18; }
h2 { font-size: 17px; font-weight: 690; line-height: 1.4; }
p { overflow-wrap: anywhere; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, .primary {
  min-height: 40px; padding: 8px 15px; border: 1px solid var(--edge); background: var(--paper);
  border-radius: 11px; font-weight: 630; cursor: pointer; text-align: center;
  transition: background-color 160ms var(--motion), border-color 160ms var(--motion), transform 180ms var(--motion);
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  button:hover { background: #f2eff8; border-color: #d8d1e7; }
  .primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
}
button:active, .primary:active { transform: scale(.975); }
button:disabled { cursor: default; opacity: .5; transform: none; }
:focus-visible { outline: 3px solid #7457cc; outline-offset: 3px; }
.primary { background: var(--accent); color: white; border-color: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.topbar {
  position: sticky; top: 0; z-index: 4; background: #faf9fd;
  border-bottom: 1px solid #ded9ea; padding-inline: max(24px, env(safe-area-inset-left)) max(24px, env(safe-area-inset-right));
}
@supports ((backdrop-filter: blur(16px)) or (-webkit-backdrop-filter: blur(16px))) {
  .topbar { background: #faf9fdeb; -webkit-backdrop-filter: saturate(145%) blur(16px); backdrop-filter: saturate(145%) blur(16px); }
}
.topbar-inner { max-width: 1352px; min-height: var(--header-size); display: flex; align-items: center; justify-content: space-between; gap: 13px; margin: auto; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); white-space: nowrap; font-size: 17px; }
.brand img, .login-card img { border: 1px solid var(--edge); border-radius: 12px; background: white; display: block; object-fit: contain; }
.session { min-width: 0; display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: 13px; }
.session span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session button { min-height: 36px; padding-inline: 11px; white-space: nowrap; }
.workspace { display: grid; grid-template-columns: 184px minmax(0, 1fr); gap: clamp(22px, 3.8vw, 50px); max-width: 1400px; margin: auto; padding: 32px 24px 55px; align-items: start; }
.navigation { display: flex; flex-direction: column; gap: 5px; position: sticky; top: calc(var(--header-size) + 32px); }
.navigation button { border: 1px solid transparent; background: transparent; min-height: 45px; text-align: left; color: var(--muted); display: flex; align-items: center; gap: 11px; font-weight: 620; white-space: nowrap; }
.navigation button[aria-current] { color: var(--accent-strong); background: var(--tint); border-color: #e6def9; font-weight: 720; }
@media (hover: hover) { .navigation button:not([aria-current]):hover { background: #eeebf6; } }
.icon { display: inline-block; color: currentColor; width: 15px; height: 15px; flex: 0 0 15px; position: relative; border: 1.5px solid currentColor; border-radius: 4px; }
.icon-grid::after { content: ""; position: absolute; inset: 0 46%; border-left: 1px solid currentColor; }
.icon-grid::before { content: ""; position: absolute; inset: 46% 0; border-top: 1px solid currentColor; }
.icon-person { border-radius: 50%; }
.icon-person::before { content: ""; position: absolute; width: 4px; height: 4px; border: 1px solid currentColor; border-radius: 50%; top: 2px; left: 4px; }
.icon-person::after { content: ""; position: absolute; width: 8px; height: 4px; border: 1px solid currentColor; border-bottom: 0; border-radius: 5px 5px 0 0; bottom: 1px; left: 2px; }
.icon-time { border-radius: 50%; }
.icon-time::after { content: ""; position: absolute; width: 5px; height: 5px; top: 2px; left: 5px; border-left: 1px solid currentColor; border-bottom: 1px solid currentColor; }
.icon-chat { height: 12px; }
.icon-chat::after { content: ""; position: absolute; width: 4px; height: 4px; border-bottom: 1px solid currentColor; border-left: 1px solid currentColor; left: 2px; bottom: -3px; background: var(--canvas); transform: skewY(-40deg); }
.icon-admin { transform: rotate(45deg) scale(.8); border-radius: 4px; }
.icon-admin::after { content: ""; position: absolute; inset: 3px; border: 1px solid currentColor; border-radius: 50%; }
.content { min-width: 0; }
.content > section:not([hidden]) { animation: surface-in 245ms var(--motion) both; }
@keyframes surface-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 21px; }
.section-heading h1 + p { margin-top: 6px; }
.section-heading > button { flex-shrink: 0; }
.sync, .muted { color: var(--muted); font-size: 13px; }
.sync::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: #827792; vertical-align: 2px; }
.sync[data-state="ready"]::before { background: #258368; }
.sync[data-state="failed"]::before { background: #a85718; }
.card { background: var(--paper); border: 1px solid var(--edge); border-radius: 19px; padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.dashboard-summary, .charts, .admin-grid, .feedback-grid { display: grid; gap: 16px; }
.dashboard-summary { grid-template-columns: minmax(235px, .85fr) minmax(0, 1.55fr); }
.charts, .admin-grid, .feedback-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.charts, .quality, .admin-block { margin-top: 16px; }
.company-card {
  background: #35236e; color: white; border-color: #35236e;
  display: flex; flex-direction: column; justify-content: space-between; gap: 10px;
}
.company-card p { color: #efe9ff; font-weight: 600; }
.company-count { font-size: clamp(42px, 7vw, 68px); line-height: .97; letter-spacing: -.055em; font-weight: 730; font-variant-numeric: tabular-nums; }
.company-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #f0eaff; }
.company-bottom button { color: white; border-color: #ab98db; background: #ffffff12; min-height: 34px; padding: 5px 9px; white-space: nowrap; }
@media (hover: hover) { .company-bottom button:hover { background: #ffffff25; } }
.company-bottom button span { margin-left: 4px; }
.chart-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.chart-heading p { margin-top: 4px; }
.accent { color: var(--accent-strong); font-weight: 680; white-space: nowrap; }
.account-card { --current: #5070bc; }
.account-bar { display: flex; align-items: stretch; height: 9px; margin: 17px 0 12px; gap: 3px; border-radius: 10px; overflow: hidden; background: #efedf4; }
.account-bar span, .status-dot { background: var(--current); }
[data-account="active"] { --current: #2b8d75; }
[data-account="pending"] { --current: #bf771d; }
[data-account="disabled"] { --current: #755cc7; }
[data-account="withdrawn"] { --current: #747487; }
.account-counts, .chart, .role-list, .history { padding: 0; list-style: none; }
.account-counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px 14px; }
.account-counts button { display: flex; align-items: center; gap: 8px; padding: 4px 8px; width: 100%; min-height: 36px; border-color: transparent; text-align: left; background: transparent; }
.account-counts strong { margin-left: auto; font-size: 16px; font-variant-numeric: tabular-nums; }
.status-dot { width: 7px; height: 7px; flex: 0 0 7px; display: inline-block; border-radius: 50%; }
.quiet { color: var(--accent-strong); min-height: 34px; padding: 5px 9px; white-space: nowrap; }
.chart { margin-top: 14px; display: grid; gap: 7px; }
.chart-button { display: block; width: 100%; padding: 3px 6px 5px; border-color: transparent; text-align: left; }
.chart-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13px; }
.chart-label b { overflow-wrap: anywhere; }
.chart-label span { font-variant-numeric: tabular-nums; }
meter { display: block; width: 100%; height: 8px; margin-top: 4px; appearance: none; }
meter::-webkit-meter-bar { background: #f1edf8; border: 0; border-radius: 10px; }
meter::-webkit-meter-optimum-value { background: #7459c2; border-radius: 10px; }
meter::-moz-meter-bar { background: #7459c2; border-radius: 10px; }
#position-counts meter::-webkit-meter-optimum-value { background: #6087a7; }
#position-counts meter::-moz-meter-bar { background: #6087a7; }
.quality { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.quality h2 { margin-right: 8px; }
.quality strong { color: var(--accent-strong); margin-left: 4px; }
label { min-width: 0; display: grid; gap: 5px; color: var(--muted); font-size: 13px; font-weight: 610; }
input, select, textarea { width: 100%; min-width: 0; padding: 9px 10px; border: 1px solid var(--edge); background: #fbfafe; border-radius: 10px; font-size: 15px; min-height: 42px; color: var(--ink); }
textarea { resize: vertical; }
.filters { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 13px; align-items: end; margin-bottom: 16px; }
.search-input { grid-column: span 3; grid-row: 1; }
.filter-actions { grid-column: 4; grid-row: 1; display: flex; justify-content: flex-end; gap: 7px; }
.archive-toggle { grid-column: 1/-1; display: inline-flex; align-items: center; gap: 8px; width: fit-content; cursor: pointer; }
.archive-toggle input { width: 17px; height: 17px; min-height: 0; accent-color: var(--accent); }
.directory { padding: 0; overflow: hidden; }
.table-scroll { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
thead { background: #faf8fd; color: var(--muted); font-size: 13px; }
th, td { border-bottom: 1px solid var(--edge); padding: 12px 16px; }
td { overflow-wrap: anywhere; }
td:first-child { font-weight: 690; }
td small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.account-chip { border: 1px solid var(--edge); border-radius: 20px; padding: 3px 8px; white-space: nowrap; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.person-button { padding: 0 2px; min-height: 31px; color: var(--accent-strong); border-color: transparent; text-align: left; }
.employee-dialog { border: 1px solid var(--edge); color: var(--ink); border-radius: 21px; width: min(500px, 100%); max-height: min(86vh, 800px); padding: 0; }
.employee-dialog[open] { animation: detail-in 240ms var(--motion) both; box-shadow: 0 18px 60px #201a3e44; }
.employee-dialog::backdrop { background: #261b435c; }
@keyframes detail-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
.dialog-heading { position: sticky; top: 0; z-index: 2; background: #fbfafe; display: flex; justify-content: space-between; gap: 9px; align-items: start; border-bottom: 1px solid var(--edge); padding: 17px 20px; }
.dialog-heading h2 { font-size: 23px; }
.dialog-tabs { padding: 8px 20px 0; display: flex; gap: 7px; }
.dialog-tabs button[aria-pressed="true"] { background: var(--tint); border-color: #e6def9; color: var(--accent-strong); }
.profile-body { padding: 8px 20px 21px; }
.profile-group { padding-top: 15px; }
.profile-group h3 { font-size: 14px; margin: 0 0 5px; color: var(--accent-strong); }
.profile-group dl > div { display: grid; grid-template-columns: minmax(88px, .36fr) minmax(0, 1fr); gap: 8px; border-bottom: 1px solid var(--edge); padding: 8px 0; }
.profile-group dt { font-size: 13px; color: var(--muted); }
.profile-group dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.profile-consent-link { font-weight: 620; }
.consent-result { background: var(--tint); padding: 9px 12px; border-radius: 10px; }
.record-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin: 8px 0; justify-content: space-between; }
.record-actions select { width: auto; max-width: 55%; }
.record-item { padding: 10px 0; }
.record-item h3 { margin: 0 0 4px; line-height: 1.35; font-size: 16px; }
.record-item .profile-group { padding-top: 4px; }
.record-item .profile-group h3 { font-size: 13px; }
.record-item > button { margin-top: 8px; }
.record-editor { padding: 14px; border: 1px solid var(--edge); border-radius: 13px; background: #faf8fe; }
.record-editor h3 { margin: 0; }
.record-form-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.record-form-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
#hr-preview { max-height: 360px; overflow: auto; }
.pagination { display: flex; align-items: center; gap: 7px; padding: 12px 16px; }
.pagination p { margin-right: auto; color: var(--muted); font-size: 13px; }
.change-controls, .single-role { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: end; gap: 10px; }
.single-role { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) auto; }
.history { padding-top: 8px; }
.history li { padding: 12px 0; border-bottom: 1px solid var(--edge); overflow-wrap: anywhere; }
.history li:last-child { border-bottom: 0; }
.timeline li { padding-inline-start: 16px; position: relative; }
.timeline li::before { content: ""; width: 6px; height: 6px; position: absolute; top: 21px; left: 0; border-radius: 50%; background: #8367d3; }
.stacked { display: grid; gap: 11px; align-content: start; }
.stacked > button { justify-self: start; }
details summary { cursor: pointer; width: fit-content; font-weight: 650; color: var(--accent-strong); }
details form { margin-top: 10px; }
.role-list { display: flex; flex-wrap: wrap; gap: 6px; }
.role-list li { border: 1px solid var(--edge); border-radius: 8px; padding: 5px 8px; overflow-wrap: anywhere; }
.multiline { white-space: pre-wrap; }
.message { margin-bottom: 13px; padding: 10px 13px; background: #fff1ea; border: 1px solid #f0d5c9; color: #783c2a; border-radius: 12px; }
.login-page { display: grid; place-items: center; padding: 20px; background: #f5f3fa; }
.login-card { width: min(100%, 400px); display: grid; justify-items: center; gap: 20px; padding: clamp(24px, 7vw, 52px); text-align: center; background: white; border: 1px solid var(--edge); border-radius: 26px; }
.login-card h1 { font-size: clamp(23px, 5.5vw, 31px); }
.login-card .primary { width: 100%; }
@media (max-width: 920px) {
  .workspace { grid-template-columns: 147px minmax(0,1fr); gap: 21px; }
  .card { padding: 15px; }
  .directory { padding: 0; }
}
@media (max-width: 720px) {
  :root { --header-size: 57px; }
  .topbar { padding-inline: max(13px, env(safe-area-inset-left)) max(13px, env(safe-area-inset-right)); }
  .brand { font-size: 15px; gap: 6px; }
  .brand img { width: 30px; height: 30px; border-radius: 8px; }
  .session { gap: 5px; }
  .session button { min-width: 44px; min-height: 44px; padding: 4px 7px; }
  .workspace { display: block; padding: 0 13px max(25px, env(safe-area-inset-bottom)); }
  .navigation { flex-direction: row; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: none; z-index: 3; background: var(--canvas); top: var(--header-size); margin: 0 -13px 15px; padding: 6px 13px; }
  .navigation::-webkit-scrollbar { display: none; }
  .navigation button { min-height: 44px; padding: 5px 10px; gap: 5px; font-size: 13px; }
  .navigation .icon { transform: scale(.85); }
  .navigation .icon-admin { transform: rotate(45deg) scale(.72); }
  .section-heading { margin-bottom: 13px; }
  .dashboard-summary, .charts, .admin-grid, .feedback-grid { gap: 10px; }
  .charts, .quality, .admin-block { margin-top: 10px; }
  .chart-button, .account-counts button { min-height: 44px; }
  .filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .search-input, .filter-actions { grid-column: 1 / -1; grid-row: auto; }
  input, select, textarea { font-size: 16px; }
  .directory table, .directory tbody { display: block; }
  .directory thead { position: absolute; clip-path: inset(50%); height: 1px; width: 1px; overflow: hidden; }
  .directory tr { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); padding: 12px; gap: 6px; border-bottom: 1px solid var(--edge); }
  .directory td { display: block; border: 0; padding: 0 3px; }
  .directory td:first-child { grid-column: 1 / -1; font-size: 16px; }
  .directory td[data-label]::before { content: attr(data-label); font-size: 12px; color: var(--muted); display: block; }
  .employee-dialog { margin: auto auto 0; max-height: 87vh; max-height: 87dvh; max-width: 100%; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .person-button { min-height: 44px; }
}
@media (max-width: 720px) and (prefers-reduced-transparency: no-preference) {
  @supports ((backdrop-filter: blur(16px)) or (-webkit-backdrop-filter: blur(16px))) {
    .navigation { background: #f5f4fae8; -webkit-backdrop-filter: saturate(140%) blur(16px); backdrop-filter: saturate(140%) blur(16px); }
  }
}
@media (max-width: 520px) {
  .dashboard-summary, .charts, .admin-grid, .feedback-grid, .single-role { grid-template-columns: minmax(0,1fr); }
  .single-role button { justify-self: start; }
  .card { border-radius: 15px; }
  .company-card { min-height: 158px; }
  .company-count { font-size: 56px; }
  .pagination { padding: 8px 10px; }
  .pagination button { padding-inline: 9px; min-height: 44px; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar { background: #faf9fd; backdrop-filter: none; -webkit-backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
