:root {
  color-scheme: light;
  --ink: #182230;
  --ink-soft: #344054;
  --muted: #667085;
  --muted-light: #98a2b3;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --blue: #2753d7;
  --blue-dark: #1d43b8;
  --blue-soft: #eef3ff;
  --surface: #ffffff;
  --canvas: #f6f7f9;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --success: #067647;
  --success-soft: #ecfdf3;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
button, input, textarea, select { font: inherit; }
button, input, textarea, select { transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.danger-text { color: var(--danger) !important; }
.success-text { color: var(--success) !important; }

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 26px; line-height: 1.2; letter-spacing: -.035em; }
h2 { margin: 3px 0 0; font-size: 18px; line-height: 1.3; letter-spacing: -.02em; }
.eyebrow { margin: 0; color: var(--blue); font-size: 10px; font-weight: 750; letter-spacing: .12em; }
.brand-pill { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 10px; font-weight: 750; letter-spacing: .11em; }

label { display: block; margin-bottom: 6px; color: var(--ink-soft); font-size: 12px; font-weight: 650; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
input, select { min-height: 38px; padding: 7px 10px; }
textarea { min-height: 106px; padding: 9px 10px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted-light); }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39, 83, 215, .11); }

button {
  min-height: 36px;
  border: 0;
  border-radius: 7px;
  padding: 7px 13px;
  font-weight: 650;
  cursor: pointer;
}
button:focus-visible { outline: 3px solid rgba(39, 83, 215, .22); outline-offset: 1px; }
button:disabled { opacity: .55; cursor: wait; }
.primary { background: var(--blue); color: #fff; box-shadow: var(--shadow-sm); }
.primary:hover { background: var(--blue-dark); }
.secondary { background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm); }
.secondary:hover { border-color: #98a2b3; background: #fcfcfd; }
.ghost-button { background: transparent; color: var(--muted); }
.ghost-button:hover { background: #f2f4f7; color: var(--ink-soft); }
.compact-button { min-height: 32px; padding: 5px 11px; font-size: 12px; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 0, #edf2ff 0, var(--canvas) 36%); }
.login-card { position: relative; width: min(390px, 100%); padding: 30px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 20px 50px rgba(16, 24, 40, .1); }
.login-brand { position: absolute; top: 24px; right: 26px; color: #dce5ff; font-size: 52px; font-weight: 800; line-height: 1; }
.login-card h1 { margin: 18px 0 7px; font-size: 24px; }
.login-description { margin-bottom: 22px; }
.login-card label { margin-top: 14px; }
.login-card input { min-height: 42px; }
.login-card .primary { width: 100%; min-height: 42px; margin-top: 22px; }

.topbar { position: sticky; top: 0; z-index: 20; min-height: 58px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); }
.topbar-inner { width: min(1520px, 100%); min-height: 58px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 8px; background: var(--blue); color: #fff; font-weight: 800; }
.brand-lockup strong, .brand-lockup span { display: block; }
.brand-lockup strong { font-size: 13px; letter-spacing: -.01em; white-space: nowrap; }
.brand-lockup span { margin-top: 1px; color: var(--muted); font-size: 10px; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.topbar-actions button, .admin-chip { flex-shrink: 0; white-space: nowrap; }
.admin-chip { min-height: 32px; margin-right: 4px; padding: 5px 9px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 7px; background: #fcfcfd; color: var(--ink-soft); font-size: 12px; }
.admin-avatar { width: 7px; height: 7px; border-radius: 50%; background: #12b76a; box-shadow: 0 0 0 3px var(--success-soft); }
.section-nav { align-self: stretch; display: flex; align-items: stretch; gap: 2px; }
.section-nav-item { position: relative; min-height: 58px; padding: 0 14px; border-radius: 0; background: transparent; color: var(--muted); font-size: 12px; }
.section-nav-item::after { content: ""; position: absolute; right: 12px; bottom: 0; left: 12px; height: 2px; border-radius: 2px 2px 0 0; background: transparent; }
.section-nav-item:hover { color: var(--ink); background: #fafbfc; }
.section-nav-item.active { color: var(--blue); }
.section-nav-item.active::after { background: var(--blue); }

.app-shell { width: min(1520px, 100%); margin: 0 auto; padding: 22px 24px 40px; }
.page-heading { margin-bottom: 18px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.page-heading h1 { margin-top: 4px; }
.page-description { margin: 5px 0 0; font-size: 12px; }
.metrics { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-sm); }
.metric { min-width: 94px; padding: 9px 14px; display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.metric:first-child { border-left: 0; }
.metric-value { color: var(--ink); font-size: 18px; font-weight: 750; line-height: 1.1; }
.metric-label { margin-top: 3px; color: var(--muted); font-size: 10px; }

.panel { min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow-sm); }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "users tools"; align-items: start; gap: 16px; }
.client-workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 410px; align-items: start; gap: 16px; }
.client-workspace-grid > .side-stack { grid-area: auto; }
.users-panel { grid-area: users; overflow: hidden; }
.clients-panel { overflow: hidden; }
.side-stack { grid-area: tools; min-width: 0; }
.create-panel { position: sticky; top: 74px; padding: 18px; }
.client-editor-panel { position: sticky; top: 74px; padding: 18px; }
.section-heading { padding: 17px 18px 13px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.users-panel > .section-heading { padding-bottom: 11px; }
.compact-heading { padding: 0; }
.inline-heading { display: flex; align-items: center; gap: 9px; }
.count-badge { min-width: 24px; padding: 2px 7px; border-radius: 999px; background: #f2f4f7; color: var(--muted); font-size: 10px; text-align: center; }
.section-description { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.form-intro { margin: 7px 0 15px; line-height: 1.55; }

.list-toolbar { min-height: 52px; padding: 8px 12px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); background: #fcfcfd; }
.list-toolbar label { margin: 0; }
.search-control { position: relative; width: min(320px, 42%); }
.search-control input { min-height: 34px; padding-left: 32px; background: var(--surface); }
.search-icon { position: absolute; top: 10px; left: 11px; width: 11px; height: 11px; border: 1.5px solid var(--muted-light); border-radius: 50%; pointer-events: none; }
.search-icon::after { content: ""; position: absolute; right: -4px; bottom: -3px; width: 5px; height: 1.5px; transform: rotate(45deg); border-radius: 999px; background: var(--muted-light); }
.filter-control { display: flex !important; align-items: center; gap: 7px; color: var(--muted); white-space: nowrap; }
.filter-control select { width: 98px; min-height: 34px; padding: 5px 28px 5px 9px; }
.toolbar-button { min-height: 32px; margin-left: auto; padding: 5px 9px; font-size: 11px; }

.batch-form { margin-top: 0; }
.generated-fields { display: grid; grid-template-columns: minmax(0, 1fr) 78px; gap: 10px; }
.form-field { min-width: 0; }
.form-divider { height: 31px; display: flex; align-items: center; gap: 8px; color: var(--muted-light); font-size: 10px; }
.form-divider::before, .form-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.label-hint { color: var(--muted-light); font-weight: 450; }
.submit-button { width: 100%; min-height: 38px; margin-top: 12px; }
.form-footnote { margin: 9px 0 0; color: var(--muted-light); font-size: 10px; text-align: center; }
.client-form { display: grid; gap: 13px; }
.client-form label { margin-bottom: 5px; }
.client-form textarea { min-height: 82px; }
.client-form input[readonly] { background: #f2f4f7; color: var(--muted); cursor: not-allowed; }
.client-inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.editor-heading { min-height: 35px; }
.field-label-row { min-height: 19px; margin-bottom: 5px; display: flex; align-items: center; gap: 6px; }
.field-label-row label { margin: 0; }
.help-tooltip-wrap { display: inline-flex; }
.help-trigger {
  width: 17px;
  min-height: 17px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}
.help-trigger:hover, .help-trigger:focus-visible { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }
.client-type-help {
  padding: 12px 13px;
  border: 1px solid #b2c2f6;
  border-radius: 8px;
  background: #fbfcff;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 450;
  line-height: 1.55;
}
.client-type-help[hidden] { display: none; }
.client-type-help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.client-type-help strong { display: block; margin-bottom: 2px; color: var(--ink); font-size: 11px; }
.client-type-help p { margin: 0; }
.client-type-help .help-common { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--blue-dark); font-weight: 600; }
.client-type-help .help-warning { margin-top: 8px; padding: 7px 8px; border-radius: 6px; background: #fffaeb; color: #93370d; }
.scope-fieldset { margin: 0; padding: 10px 11px; display: flex; gap: 18px; border: 1px solid var(--line); border-radius: 7px; }
.scope-fieldset legend { padding: 0 5px; color: var(--ink-soft); font-size: 11px; font-weight: 650; }
.scope-option { margin: 0; display: flex; align-items: flex-start; gap: 7px; color: var(--ink); font-size: 11px; cursor: pointer; }
.scope-option input { width: 14px; min-height: 14px; margin: 2px 0 0; accent-color: var(--blue); }
.scope-option strong, .scope-option small { display: block; }
.scope-option small { margin-top: 1px; color: var(--muted); font-size: 9px; font-weight: 450; }

.table-wrap { overflow: auto; }
.accounts-table { max-height: calc(100vh - 252px); min-height: 390px; border-top: 1px solid var(--line); }
.clients-table { max-height: calc(100vh - 252px); min-height: 430px; border-top: 1px solid var(--line); }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 760px; }
th, td { height: 43px; padding: 8px 11px; border-bottom: 1px solid #f0f1f3; text-align: left; vertical-align: middle; font-size: 12px; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 2; height: 35px; background: #f9fafb; color: var(--muted); font-size: 10px; font-weight: 650; letter-spacing: .02em; }
tbody tr:hover td { background: #fafbff; }
tbody tr:last-child td { border-bottom: 0; }
td.login-cell { max-width: 270px; overflow: hidden; color: var(--ink); font-weight: 600; text-overflow: ellipsis; }
td.name-cell { max-width: 190px; overflow: hidden; color: var(--ink-soft); text-overflow: ellipsis; }
td.time-cell { color: var(--muted); font-variant-numeric: tabular-nums; }
.action-column { width: 145px; }
.client-action-column { width: 235px; }
.role { display: inline-flex; padding: 2px 6px; border-radius: 5px; background: #f2f4f7; color: var(--ink-soft); font-size: 10px; font-weight: 650; }
.role.admin { background: var(--blue-soft); color: var(--blue); }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 999px; font-size: 10px; font-weight: 650; }
.status::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.active { color: var(--success); background: var(--success-soft); }
.status.disabled { color: var(--danger); background: var(--danger-soft); }
.actions { display: flex; align-items: center; gap: 3px; }
.actions button { min-height: 28px; padding: 4px 7px; border-radius: 5px; background: transparent; color: var(--blue); font-size: 10px; }
.actions button:hover { background: var(--blue-soft); }
.actions .status-action-disabled { color: var(--danger); }
.actions .status-action-disabled:hover { background: var(--danger-soft); }
.client-actions { flex-wrap: nowrap; }
.client-identity-cell { max-width: 310px; }
.client-identity-cell strong, .client-identity-cell code { display: block; overflow: hidden; text-overflow: ellipsis; }
.client-identity-cell strong { color: var(--ink); font-size: 12px; }
.client-identity-cell code { margin-top: 2px; color: var(--muted); font-size: 10px; }
.client-type { display: inline-flex; padding: 2px 6px; border-radius: 5px; background: #f2f4f7; color: var(--ink-soft); font-size: 10px; font-weight: 650; }
.client-type.confidential { background: var(--blue-soft); color: var(--blue); }
.callback-cell { color: var(--muted); }
.empty-state td { height: 180px; color: var(--muted); text-align: center; }

.pagination-bar { min-height: 51px; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line); background: #fcfcfd; }
.pagination-summary, .page-indicator { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pagination-actions { display: flex; align-items: center; gap: 7px; }
.pagination-actions label { margin: 0 1px 0 0; color: var(--muted); font-size: 10px; white-space: nowrap; }
.pagination-actions select { width: 61px; min-height: 30px; padding: 4px 21px 4px 7px; font-size: 10px; }
.pagination-button { min-height: 30px; padding: 4px 9px; font-size: 10px; }
.pagination-button:disabled { cursor: not-allowed; }

.alert { margin: 0 0 14px; padding: 10px 12px; border: 1px solid transparent; border-radius: 8px; font-size: 12px; }
.alert.error { border-color: #fecdca; background: var(--danger-soft); color: var(--danger); }
.alert.success { border-color: #abefc6; background: var(--success-soft); color: var(--success); }
.login-card .alert { margin: 15px 0 0; }
.credential-panel { margin-bottom: 16px; overflow: hidden; border-color: #b2c2f6; background: #fbfcff; }
.credential-panel .section-heading { align-items: center; }
.credential-table { max-height: 220px; border-top: 1px solid #dce4fb; }
.credential-table td:nth-child(2) { color: var(--ink-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.secret-panel { margin-bottom: 16px; padding: 15px 18px; border-color: #b2c2f6; background: #fbfcff; }
.secret-copy { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.secret-value-row { margin-top: 13px; padding-top: 13px; display: grid; grid-template-columns: minmax(150px, .55fr) minmax(260px, 1fr) auto; align-items: end; gap: 18px; border-top: 1px solid #dce4fb; }
.secret-value-row code { display: block; margin-top: 4px; overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.secret-value-main code { color: var(--blue-dark); font-size: 13px; font-weight: 650; }
.secret-label { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }

@media (max-width: 1050px) {
  .workspace-grid { grid-template-columns: 1fr; grid-template-areas: "tools" "users"; }
	.client-workspace-grid { grid-template-columns: 1fr; }
  .create-panel { position: static; }
	.client-editor-panel { position: static; }
  .generated-fields { grid-template-columns: minmax(180px, 1fr) 100px; }
  .batch-form { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 0 16px; align-items: end; }
  .form-divider { display: none; }
  .manual-input { grid-column: 2; grid-row: 1 / span 2; }
  .manual-input textarea { min-height: 106px; }
  .submit-button { width: auto; grid-column: 1; align-self: end; }
  .form-footnote { grid-column: 1; text-align: left; }
  .accounts-table { max-height: 560px; }
	.clients-table { max-height: 560px; }
}

@media (max-width: 700px) {
  .topbar-inner { padding: 0 14px; }
  .brand-lockup span { display: none; }
	.section-nav-item { padding-right: 9px; padding-left: 9px; }
  .app-shell { padding: 16px 12px 28px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 13px; }
  .metrics { width: 100%; }
  .metric { min-width: 0; flex: 1; padding: 8px 10px; }
  .section-heading { padding-right: 14px; padding-left: 14px; }
  .list-toolbar { align-items: stretch; flex-wrap: wrap; }
  .search-control { width: 100%; }
  .filter-control { flex: 1; }
  .filter-control select { flex: 1; }
  .toolbar-button { margin-left: 0; }
  .batch-form { display: block; }
  .form-divider { display: flex; }
  .manual-input textarea { min-height: 106px; }
  .submit-button { width: 100%; }
  .form-footnote { text-align: center; }
  .accounts-table { max-height: none; min-height: 320px; overflow: visible; }
  .accounts-table table { min-width: 0; }
  .accounts-table thead { display: none; }
  .accounts-table tbody { display: block; }
  .accounts-table tbody tr { padding: 11px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; border-bottom: 1px solid #f0f1f3; }
  .accounts-table tbody tr:last-child { border-bottom: 0; }
  .accounts-table tbody td { width: auto; max-width: none; height: auto; padding: 0; border: 0; background: transparent !important; white-space: normal; }
  .accounts-table .login-cell { min-width: 0; grid-column: 1; grid-row: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .accounts-table .name-cell { grid-column: 1; grid-row: 2; color: var(--muted); font-size: 11px; }
  .accounts-table .role-cell { display: none; }
  .accounts-table .status-cell { grid-column: 2; grid-row: 1; }
  .accounts-table .time-cell { grid-column: 1; grid-row: 3; font-size: 10px; }
  .accounts-table .action-cell { grid-column: 2; grid-row: 2 / span 2; align-self: end; }
  .accounts-table .actions { justify-content: flex-end; }
  .accounts-table .empty-state { display: block; }
  .accounts-table .empty-state td { height: 140px; display: grid; place-items: center; }
	.secret-value-row { grid-template-columns: 1fr; align-items: stretch; gap: 10px; }
	.secret-value-row button { justify-self: start; }
	.clients-table { max-height: none; min-height: 320px; overflow: visible; }
	.clients-table table { min-width: 0; }
	.clients-table thead { display: none; }
	.clients-table tbody { display: block; }
	.clients-table tbody tr { padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; border-bottom: 1px solid #f0f1f3; }
	.clients-table tbody tr:last-child { border-bottom: 0; }
	.clients-table tbody td { width: auto; max-width: none; height: auto; padding: 0; border: 0; background: transparent !important; white-space: normal; }
	.clients-table .client-identity-cell { grid-column: 1; grid-row: 1 / span 2; min-width: 0; }
	.clients-table td:nth-child(2) { grid-column: 2; grid-row: 1; text-align: right; }
	.clients-table .callback-cell { grid-column: 1; grid-row: 3; font-size: 10px; }
	.clients-table td:nth-child(4) { grid-column: 2; grid-row: 2; text-align: right; }
	.clients-table .time-cell { grid-column: 1; grid-row: 4; font-size: 10px; }
	.clients-table .action-cell { margin-top: 5px; padding-top: 7px; grid-column: 1 / -1; grid-row: 5; border-top: 1px solid #f2f4f7; }
	.clients-table .client-actions { justify-content: flex-start; flex-wrap: wrap; }
	.clients-table .empty-state { display: block; }
	.clients-table .empty-state td { height: 140px; display: grid; place-items: center; }
	.pagination-bar { align-items: flex-start; flex-direction: column; gap: 7px; }
	.pagination-actions { width: 100%; }
	.pagination-actions .page-indicator { margin: 0 auto; }
}

@media (max-width: 440px) {
  .login-shell { padding: 14px; }
  .login-card { padding: 24px 20px; }
  .topbar-inner { gap: 8px; }
  .brand-lockup { gap: 7px; }
  .brand-lockup strong { font-size: 11px; }
	.section-nav { order: 3; width: 100%; height: 40px; align-self: auto; justify-content: center; border-top: 1px solid var(--line); }
	.section-nav-item { min-height: 40px; flex: 1; }
	.topbar-inner { min-height: 58px; flex-wrap: wrap; padding-top: 8px; }
  .admin-chip { max-width: 86px; overflow: hidden; text-overflow: ellipsis; }
  .topbar-actions { gap: 2px; }
  .topbar-actions button { padding-right: 8px; padding-left: 8px; }
  .page-description { max-width: 280px; }
	.client-inline-fields { grid-template-columns: 1fr; }
	.client-type-help-grid { grid-template-columns: 1fr; gap: 8px; }
	.scope-fieldset { flex-direction: column; gap: 8px; }
	.pagination-actions { display: grid; grid-template-columns: auto 56px 1fr 1fr; }
	.pagination-actions .page-indicator { grid-column: 1 / -1; grid-row: 2; margin: 0; text-align: center; }
	.pagination-actions .pagination-button { min-width: 0; }
}
