:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-muted: #f8f9fb;
  --line: #e2e5ea;
  --text: #18202b;
  --muted: #687384;
  --accent: #1f6feb;
  --accent-dark: #1859bf;
  --success: #19754a;
  --warning: #9a6412;
  --danger: #bc3e3e;
  --shadow: 0 12px 34px rgba(25, 35, 49, .08);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.account-shell { min-height: 100vh; }
.account-topbar { height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.account-brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.account-brand > span:last-child { display: grid; gap: 2px; }
.account-brand strong { font-size: 16px; letter-spacing: 0; }
.account-brand small { color: var(--muted); font-size: 11px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; color: #fff; background: #1f6feb; }
.brand-mark svg { width: 19px; height: 19px; }
.top-actions { display: flex; align-items: center; gap: 7px; }
.icon-button, .primary-button, .secondary-button { border: 1px solid transparent; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 0 12px; transition: background .16s ease, border-color .16s ease, color .16s ease; }
.icon-button { width: 36px; padding: 0; color: var(--muted); background: transparent; }
.icon-button:hover { color: var(--text); background: #edf1f6; }
.icon-button svg { width: 17px; height: 17px; }
.primary-button { color: #fff; background: var(--accent); }
.primary-button:hover { background: var(--accent-dark); }
.secondary-button { color: var(--text); border-color: var(--line); background: var(--surface); }
.secondary-button:hover { border-color: #b7c1cf; background: var(--surface-muted); }
.primary-button:disabled, .secondary-button:disabled { opacity: .55; cursor: not-allowed; }
.button-wide { width: 100%; }

.account-main { width: min(1200px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 60px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { color: #708097; font-size: 10px; font-weight: 700; letter-spacing: .12em; }
.page-heading h1, .panel-heading h2, .auth-card h2, .forbidden-card h2, .password-form h2 { margin: 6px 0 7px; letter-spacing: 0; }
.page-heading h1 { font-size: clamp(26px, 4vw, 34px); }
.page-heading p, .panel-note, .auth-card p, .forbidden-card p, .password-form p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; }
.workspace-pill { flex: 0 0 auto; padding: 7px 11px; border: 1px solid #d7e2f5; border-radius: 999px; color: #2f5e9b; background: #eef5ff; font-size: 12px; }

.auth-card, .forbidden-card, .panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.auth-card { max-width: 480px; margin: 54px auto 0; padding: 30px; display: grid; gap: 18px; }
.auth-icon { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 8px; color: #245eac; background: #eaf2ff; }
.auth-icon svg { width: 24px; height: 24px; }
.login-form, .create-form, .password-form { display: grid; gap: 13px; }
label { display: grid; gap: 6px; color: #344152; font-size: 12px; font-weight: 600; }
input, select { width: 100%; height: 38px; padding: 0 11px; border: 1px solid #d7dce4; border-radius: 6px; outline: none; color: var(--text); background: #fff; }
input:focus, select:focus { border-color: #80aeea; box-shadow: 0 0 0 3px rgba(31,111,235,.12); }
.auth-error, .form-error { min-height: 18px; margin: 0; color: var(--danger); font-size: 12px; }
.back-link { color: var(--accent); font-size: 12px; }
.forbidden-card { max-width: 560px; margin: 54px auto 0; padding: 38px 30px; text-align: center; }
.forbidden-card > svg { width: 32px; height: 32px; color: var(--warning); }
.forbidden-actions { display: flex; justify-content: center; gap: 9px; margin-top: 22px; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-card { padding: 17px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.summary-card span, .summary-card small { display: block; color: var(--muted); font-size: 12px; }
.summary-card strong { display: block; margin: 7px 0 4px; font-size: 26px; line-height: 1; }
.account-layout { display: grid; grid-template-columns: minmax(270px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { padding: 20px; box-shadow: none; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-heading h2 { font-size: 18px; }
.panel-heading > svg { width: 20px; height: 20px; color: #6682a8; }
.panel-note { margin-bottom: 18px; font-size: 12px; }
.create-form { gap: 12px; }
.create-form .primary-button { margin-top: 5px; }
.users-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.search-box { position: relative; display: block; flex: 1; }
.search-box svg { position: absolute; left: 11px; top: 11px; width: 16px; height: 16px; color: #8b96a6; pointer-events: none; }
.search-box input { padding-left: 34px; }
.list-count { flex: 0 0 auto; color: var(--muted); font-size: 12px; }
.users-list { display: grid; gap: 8px; }
.user-row { display: grid; grid-template-columns: minmax(130px, 1.3fr) minmax(130px, .9fr) auto auto; align-items: center; gap: 11px; padding: 12px; border: 1px solid #e5e8ed; border-radius: 7px; background: #fff; }
.user-row.is-disabled { opacity: .6; background: #fafafa; }
.user-identity { min-width: 0; display: grid; gap: 4px; }
.user-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.user-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.role-select { height: 32px; min-width: 132px; font-size: 12px; }
.status-badge { display: inline-flex; justify-content: center; min-width: 48px; padding: 5px 7px; border-radius: 999px; color: var(--success); background: #eaf7f0; font-size: 11px; }
.status-badge.is-disabled { color: #7d8490; background: #eef0f3; }
.row-action { min-height: 32px; padding: 0 8px; font-size: 11px; }
.empty-state { padding: 34px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.security-note { display: flex; gap: 8px; align-items: flex-start; margin: 15px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.security-note svg { flex: 0 0 auto; width: 16px; height: 16px; color: var(--success); }

.password-dialog { width: min(430px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 8px; color: var(--text); background: var(--surface); box-shadow: 0 22px 80px rgba(20, 30, 45, .25); }
.password-dialog::backdrop { background: rgba(19, 27, 39, .42); }
.password-form { padding: 22px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.dialog-heading h2 { font-size: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 5px; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 20; max-width: min(420px, calc(100% - 28px)); padding: 10px 14px; border: 1px solid #cfe0f9; border-radius: 7px; color: #184d93; background: #f0f6ff; box-shadow: var(--shadow); font-size: 12px; transform: translate(-50%, 18px); opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 860px) {
  .account-main { width: min(100% - 28px, 680px); padding-top: 28px; }
  .account-topbar { height: 60px; padding: 0 14px; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-layout { grid-template-columns: 1fr; }
  .create-panel { order: 0; }
}

@media (max-width: 560px) {
  .page-heading { display: block; }
  .workspace-pill { display: inline-flex; margin-top: 14px; }
  .account-main { width: calc(100% - 22px); padding-bottom: 34px; }
  .auth-card, .forbidden-card { margin-top: 28px; padding: 23px 18px; }
  .panel { padding: 16px; }
  .user-row { grid-template-columns: 1fr auto; gap: 8px; }
  .role-select { width: 100%; min-width: 0; grid-column: 1 / 2; }
  .status-badge { grid-column: 2 / 3; grid-row: 2; }
  .row-action { grid-column: 1 / 3; width: 100%; }
  .users-toolbar { display: grid; grid-template-columns: 1fr; }
  .list-count { justify-self: end; }
  .top-actions .icon-button { width: 32px; }
}
