:root {
  color-scheme: dark;
  --bg: #090b0f;
  --surface: #11151c;
  --surface-2: #171c25;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #edf2ff;
  --muted: #8d97a8;
  --subtle: #606a7b;
  --blue: #4c7dff;
  --blue-strong: #2f6bff;
  --green: #38c793;
  --yellow: #e9b949;
  --red: #f16f79;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 20% -10%, rgba(76, 125, 255, 0.17), transparent 34rem),
    radial-gradient(circle at 100% 100%, rgba(56, 199, 147, 0.07), transparent 28rem),
    var(--bg);
  color: var(--text);
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; text-decoration: none; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(260px, 0.82fr) minmax(420px, 1.18fr);
  min-height: 100vh;
}

.auth-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  padding: clamp(28px, 5vw, 72px);
  border-right: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(20, 26, 38, 0.96), rgba(9, 12, 18, 0.96));
}

.auth-visual::after {
  position: absolute;
  right: -16rem;
  bottom: -17rem;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  background: rgba(76, 125, 255, 0.12);
  content: "";
  filter: blur(6px);
}

.brand-lockup,
.top-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(145deg, #638eff, #2f67ec);
  box-shadow: 0 12px 30px rgba(47, 107, 255, 0.3);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.brand-lockup strong,
.top-brand strong { display: block; font-size: 15px; }
.brand-lockup small,
.top-brand small { color: var(--subtle); font-size: 11px; letter-spacing: 1.6px; }

.visual-copy {
  position: relative;
  z-index: 1;
  max-width: 520px;
}

.visual-copy h1 {
  max-width: 9em;
  margin: 0 0 18px;
  font-size: clamp(34px, 5vw, 66px);
  line-height: 1.04;
  letter-spacing: -3px;
}

.visual-copy p {
  max-width: 34em;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.visual-foot { position: relative; z-index: 1; color: var(--subtle); font-size: 11px; }

.auth-main {
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-card {
  width: min(440px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(17, 21, 28, 0.94);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
}

.auth-card h2 { margin: 0 0 8px; font-size: 25px; letter-spacing: -0.8px; }
.auth-intro { margin: 0 0 22px; color: var(--muted); font-size: 12px; line-height: 1.7; }

.form-field { display: grid; gap: 7px; margin-bottom: 15px; }
.form-field > span { color: var(--muted); font-size: 11px; }
.form-field input,
.form-field select {
  width: 100%;
  min-height: 43px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: #0c1016;
  color: var(--text);
  transition: 150ms ease;
}

.form-field input:focus,
.form-field select:focus {
  border-color: rgba(76, 125, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(76, 125, 255, 0.1);
}

.password-wrap { position: relative; }
.password-wrap input { padding-right: 58px; }
.password-toggle {
  position: absolute;
  top: 50%;
  right: 7px;
  min-height: 29px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  transform: translateY(-50%);
}

.password-toggle:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }

.primary-button,
.secondary-button,
.danger-button,
.text-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 650;
}

.primary-button { background: linear-gradient(145deg, var(--blue), var(--blue-strong)); color: #fff; box-shadow: 0 9px 24px rgba(47, 107, 255, 0.22); }
.secondary-button { border-color: var(--line); background: var(--surface-2); color: #cbd4e2; }
.danger-button { border-color: rgba(241, 111, 121, 0.22); background: rgba(241, 111, 121, 0.1); color: #f4a0a7; }
.text-button { background: transparent; color: var(--muted); }
.wide-button { width: 100%; margin-top: 5px; }
button:disabled { cursor: not-allowed; opacity: 0.52; }

.notice {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid rgba(233, 185, 73, 0.2);
  border-radius: 9px;
  background: rgba(233, 185, 73, 0.08);
  color: #d8bd76;
  font-size: 11px;
  line-height: 1.55;
}

.notice.is-error { border-color: rgba(241, 111, 121, 0.24); background: rgba(241, 111, 121, 0.08); color: #f0a0a7; }
.notice.is-success { border-color: rgba(56, 199, 147, 0.22); background: rgba(56, 199, 147, 0.08); color: #79d9b6; }
.notice[hidden] { display: none; }
.form-hint { margin: -6px 0 14px; color: var(--subtle); font-size: 12px; line-height: 1.55; }

.admin-page { min-height: 100vh; background: var(--bg); }
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 11, 15, 0.9);
  backdrop-filter: blur(16px);
}

.top-actions { display: flex; align-items: center; gap: 7px; }
.admin-main { width: min(1380px, 100%); margin: 0 auto; padding: 16px 18px 32px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.page-heading h1 { margin: 0 0 3px; font-size: 25px; letter-spacing: -0.8px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.role-badge { padding: 5px 9px; border: 1px solid rgba(76, 125, 255, 0.22); border-radius: 999px; background: rgba(76, 125, 255, 0.1); color: #9cb5ff; font-size: 12px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }
.stat-card { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 8px; font-size: 27px; line-height: 1; }

.archive-panel { margin-bottom: 10px; }
.archive-summary { display: grid; grid-template-columns: 1.5fr 1fr repeat(3, minmax(88px, 0.7fr)); gap: 1px; border-bottom: 1px solid var(--line); background: var(--line); }
.archive-summary > span { display: grid; gap: 5px; padding: 10px 12px; background: var(--surface); }
.archive-summary small, .archive-table td > small { display: block; color: var(--subtle); font-size: 11px; }
.archive-summary strong { color: #dfe6f2; font-size: 11px; }
.archive-summary .is-success { color: #79d9b6; }
.archive-summary .is-danger { color: #f0a0a7; }
.archive-table { min-width: 760px; }
.archive-file { display: block; max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-state { display: inline-flex; padding: 4px 7px; border-radius: 999px; background: rgba(148, 163, 184, 0.1); color: #aab6c8; font-size: 11px; }
.archive-state.is-completed { background: rgba(56, 199, 147, 0.1); color: #79d9b6; }
.archive-state.is-queued, .archive-state.is-processing { background: rgba(76, 125, 255, 0.1); color: #9cb5ff; }
.archive-state.is-failed { background: rgba(241, 111, 121, 0.1); color: #f0a0a7; }
.archive-error { max-width: 260px; margin-top: 4px; overflow: hidden; color: #f0a0a7 !important; text-overflow: ellipsis; white-space: nowrap; }

.admin-grid { display: grid; grid-template-columns: minmax(290px, 0.72fr) minmax(0, 1.8fr); gap: 10px; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 14px; }
.panel-body { padding: 14px; }

.user-table-wrap { overflow: auto; }
.user-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.user-table th,
.user-table td { padding: 10px 11px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; }
.user-table th { color: var(--subtle); font-size: 11px; font-weight: 650; }
.user-table tbody tr:hover { background: rgba(76, 125, 255, 0.04); }
.user-identity { display: grid; gap: 2px; }
.user-identity strong { font-size: 11px; }
.user-identity span { color: var(--muted); font-size: 11px; }
.table-select { min-height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; background: #0d1117; color: var(--text); font-size: 11px; }
.status-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.row-actions { display: flex; gap: 5px; }
.row-actions button { min-height: 29px; padding: 0 8px; }

.audit-list { display: grid; max-height: 380px; overflow: auto; }
.audit-item { display: grid; grid-template-columns: 120px 110px minmax(0, 1fr); gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12px; }
.audit-item time,
.audit-item span { color: var(--muted); }
.audit-item b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.empty { padding: 26px; color: var(--muted); font-size: 11px; text-align: center; }

.permission-modal {
  width: min(820px, calc(100vw - 24px));
  max-height: min(780px, calc(100vh - 24px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: #10151c;
  color: var(--text);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.5);
}

.permission-modal::backdrop { background: rgba(2, 4, 7, 0.74); backdrop-filter: blur(5px); }
.permission-modal form { display: flex; max-height: min(780px, calc(100vh - 24px)); flex-direction: column; }
.permission-modal-head,
.permission-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; }
.permission-modal-head { border-bottom: 1px solid var(--line); }
.permission-modal-head h2 { margin: 0; font-size: 16px; }
.permission-modal-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.permission-tip { margin: 10px 15px 0; padding: 9px 10px; border-radius: 8px; background: rgba(76, 125, 255, 0.08); color: #9bb3f7; font-size: 12px; line-height: 1.5; }
.permission-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px 15px 14px; overflow: auto; }
.permission-group { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #0c1016; }
.permission-group h3 { margin: 0; padding: 8px 10px; border-bottom: 1px solid var(--line); color: #cfd8e8; font-size: 12px; }
.permission-options { display: grid; }
.permission-option { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.035); color: var(--muted); font-size: 12px; }
.permission-option:last-child { border-bottom: 0; }
.permission-option input { accent-color: var(--blue); }
.permission-option strong { color: #d9e0ed; font-size: 12px; font-weight: 600; }
.permission-actions { border-top: 1px solid var(--line); justify-content: flex-end; }

.account-grid { display: grid; grid-template-columns: minmax(260px, 0.8fr) minmax(360px, 1.2fr); gap: 10px; }
.profile-list { display: grid; gap: 10px; }
.profile-row { display: flex; justify-content: space-between; gap: 14px; padding-bottom: 9px; border-bottom: 1px solid var(--line); font-size: 11px; }
.profile-row:last-child { padding-bottom: 0; border-bottom: 0; }
.profile-row span { color: var(--muted); }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { min-height: 210px; padding: 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .visual-copy h1 { max-width: none; margin-top: 32px; font-size: 34px; letter-spacing: -1.5px; }
  .visual-copy p, .visual-foot { display: none; }
  .auth-main { padding: 22px 16px 32px; align-items: start; }
  .auth-card { padding: 22px; }
  .admin-grid, .account-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .admin-topbar { align-items: flex-start; padding: 9px 10px; }
  .top-brand small { display: none; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; }
  .top-actions .text-button { display: none; }
  .admin-main { padding: 12px 10px 24px; }
  .page-heading { align-items: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audit-item { grid-template-columns: 1fr; gap: 3px; }
  .permission-groups { grid-template-columns: 1fr; }
  .user-table-wrap { overflow: visible; }
  .user-table,
  .archive-table { display: block; min-width: 0; }
  .user-table thead { display: none; }
  .user-table tbody { display: grid; gap: 8px; padding: 8px; }
  .user-table tbody tr { display: grid; padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px; background: #0c1118; }
  .user-table tbody td { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.045); }
  .user-table tbody td:last-child { border-bottom: 0; }
  .user-table tbody td::before { content: attr(data-label); color: var(--subtle); font-size: 11px; font-weight: 650; }
  .user-table tbody td.empty { display: block; padding: 18px 8px; }
  .user-table tbody td.empty::before { content: none; }
  .row-actions { flex-wrap: wrap; }
  .archive-file,
  .archive-error { max-width: 100%; }
}

/* Account security surface: v11, independent of protected business-shell assets. */
body.zd-account-page[data-ui-version="v11"] {
  color-scheme: light;
  --bg: #f1f6ff; --surface: #ffffff; --surface-2: #f7faff;
  --line: #e2e9f8; --line-strong: #ccd8ed;
  --text: #172544; --muted: #667da3; --subtle: #788baa;
  --blue: #7050ff; --blue-strong: #5a3fd7; --red: #b33649;
  background: radial-gradient(ellipse at 75% 0, #dceaff 0, transparent 55%), linear-gradient(115deg, #f1f6ff, #e9f3ff 55%, #eff7ff);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: 14px;
}
body.zd-account-page[data-ui-version="v11"] .account-shell { min-height: 100dvh; }
body.zd-account-page[data-ui-version="v11"] .admin-topbar {
  min-height: 76px; height: auto; gap: 16px; padding: 14px max(20px, calc((100% - 1080px) / 2));
  border-color: var(--line); background: #edf4fff2; box-shadow: none;
}
body.zd-account-page[data-ui-version="v11"] .top-brand { min-width: 0; }
body.zd-account-page[data-ui-version="v11"] .top-brand strong { color: var(--text); }
body.zd-account-page[data-ui-version="v11"] .top-brand small { color: var(--muted); }
body.zd-account-page[data-ui-version="v11"] .brand-mark {
  background: linear-gradient(140deg, #a6bcff, #7050ff); border-radius: 14px; box-shadow: 0 4px 12px #7868ff30;
}
body.zd-account-page[data-ui-version="v11"] .top-actions { flex-wrap: wrap; justify-content: flex-end; }
body.zd-account-page[data-ui-version="v11"] .admin-main { width: min(1120px, 100%); margin: 0 auto; padding: 24px 20px 32px; }
body.zd-account-page[data-ui-version="v11"] .page-heading { align-items: center; margin-bottom: 16px; }
body.zd-account-page[data-ui-version="v11"] .page-heading h1 { color: var(--text); font-size: 26px; }
body.zd-account-page[data-ui-version="v11"] .page-heading p { color: var(--muted); font-size: 13px; line-height: 1.6; }
body.zd-account-page[data-ui-version="v11"] .account-grid { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 16px; }
body.zd-account-page[data-ui-version="v11"] .panel { min-width: 0; border-color: #ffffffd9; border-radius: 16px; background: #ffffffd9; }
body.zd-account-page[data-ui-version="v11"] .panel-head { padding: 15px 18px; }
body.zd-account-page[data-ui-version="v11"] .panel-head h2 { font-size: 16px; }
body.zd-account-page[data-ui-version="v11"] .panel-body { padding: 18px; }
body.zd-account-page[data-ui-version="v11"] .profile-row { font-size: 13px; line-height: 1.65; }
body.zd-account-page[data-ui-version="v11"] .profile-row strong { min-width: 0; overflow-wrap: anywhere; text-align: right; }
body.zd-account-page[data-ui-version="v11"] .permission-chip-list { min-width: 0; }
body.zd-account-page[data-ui-version="v11"] .permission-chip { color: #5a4bb5; border-color: #ded9fb; background: #f3f0ff; }
body.zd-account-page[data-ui-version="v11"] .role-badge { flex: none; color: #5a4bb5; border-color: #ded9fb; background: #f3f0ff; }
body.zd-account-page[data-ui-version="v11"] .form-field input { min-width: 0; border-color: var(--line-strong); background: #ffffff; color: var(--text); }
body.zd-account-page[data-ui-version="v11"] .form-field span { color: var(--muted); font-size: 13px; }
body.zd-account-page[data-ui-version="v11"] .form-hint { color: var(--muted); }
body.zd-account-page[data-ui-version="v11"] .primary-button { background: linear-gradient(120deg, #8c76ff, #6545ee); }
body.zd-account-page[data-ui-version="v11"] .secondary-button { border-color: var(--line-strong); background: #ffffffb8; color: #4b5f87; }
body.zd-account-page[data-ui-version="v11"] .top-actions .text-button { display: inline-flex; align-items: center; color: #4b5f87; }
body.zd-account-page[data-ui-version="v11"] .notice { color: #825d13; border-color: #eedbb1; background: #fff7df; }
body.zd-account-page[data-ui-version="v11"] .notice.is-error { color: #9d3041; border-color: #efc7ce; background: #fff1f3; }
body.zd-account-page[data-ui-version="v11"] .notice.is-success { color: #24714e; border-color: #c4e5d4; background: #effaf3; }
@media (max-width: 900px) {
  body.zd-account-page[data-ui-version="v11"] .account-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  body.zd-account-page[data-ui-version="v11"] .admin-topbar { min-height: 68px; gap: 10px; padding: 12px; }
  body.zd-account-page[data-ui-version="v11"] .admin-main { padding: 16px 12px 24px; }
  body.zd-account-page[data-ui-version="v11"] .top-actions { gap: 5px; }
  body.zd-account-page[data-ui-version="v11"] .top-actions .secondary-button { padding-inline: 9px; font-size: 12px; }
  body.zd-account-page[data-ui-version="v11"] .panel-body { padding: 14px; }
  body.zd-account-page[data-ui-version="v11"] .page-heading h1 { font-size: 23px; }
}
