/* ==========================================================================
   DSH Portal — 统一界面样式
   纯 CSS，无外部字体 / 图片 / CDN。设计基调：浅灰背景、白色卡片、蓝色主色。
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f3f5f9;
  --bg-soft: #eef2f7;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-soft: #334155;
  --muted: #64748b;
  --muted-soft: #94a3b8;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;
  --accent: #0e7490;
  --success: #15803d;
  --success-soft: #f0fdf4;
  --success-border: #bbf7d0;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --info-soft: #f0f9ff;
  --info-border: #bae6fd;
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 18px 42px -28px rgba(15, 23, 42, 0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC",
    sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3,
h4,
p,
dl,
dd,
figure {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font: inherit;
}

input,
select,
textarea {
  font: inherit;
}

code,
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.muted {
  color: var(--muted);
}

.nowrap {
  white-space: nowrap;
}

.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;
}

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* --------------------------------------------------------------- 加载状态 */

.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13.5px;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: dsh-spin 0.7s linear infinite;
  flex: none;
  vertical-align: -2px;
}

.spinner-lg {
  width: 28px;
  height: 28px;
  border-width: 3px;
  color: var(--primary);
}

@keyframes dsh-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------------ 顶栏 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  flex: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, #0ea5e9 100%);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 0 6px 14px -8px rgba(37, 99, 235, 0.9);
  flex: none;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-tag {
  font-size: 10.5px;
  color: var(--muted-soft);
  letter-spacing: 0.08em;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.topnav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.topnav-link:hover {
  background: var(--surface-muted);
  color: var(--text);
  text-decoration: none;
}

.topnav-link.is-active {
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-weight: 600;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  min-width: 0;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 700;
  flex: none;
  text-transform: uppercase;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-role {
  font-size: 11px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ 页面 */

.page {
  padding-top: 30px;
  padding-bottom: 64px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.page-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13.5px;
}

.page-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px -12px rgba(37, 99, 235, 0.9);
}

.btn.primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.btn.ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-soft);
}

.btn.ghost:hover {
  background: var(--surface-muted);
  border-color: var(--muted-soft);
}

.btn.subtle {
  background: transparent;
  color: var(--primary-strong);
}

.btn.subtle:hover {
  background: var(--primary-soft);
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn.danger:hover {
  background: #991b1b;
  border-color: #991b1b;
}

.btn.danger-ghost {
  background: transparent;
  border-color: var(--danger-border);
  color: var(--danger);
}

.btn.danger-ghost:hover {
  background: var(--danger-soft);
}

.btn.sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: 8px;
  gap: 4px;
}

.btn.block {
  width: 100%;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn .spinner {
  width: 13px;
  height: 13px;
  border-width: 2px;
}

.btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ 卡片 */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad {
  padding: 24px;
}

/* --------------------------------------------------------------- 提示区域 */

.alert {
  display: block;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.alert.error {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}

.alert.success {
  background: var(--success-soft);
  border-color: var(--success-border);
  color: var(--success);
}

.alert.info {
  background: var(--info-soft);
  border-color: var(--info-border);
  color: #0c4a6e;
}

.alert.warning {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  color: var(--warning);
}

.panel-alert {
  margin-bottom: 16px;
}

.panel-alert .alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------- 空 / 错误 */

.empty-state,
.forbidden,
.fatal {
  text-align: center;
  padding: 48px 24px;
}

.empty-icon {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.empty-title,
.forbidden h2,
.fatal h1 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}

.empty-text,
.forbidden p,
.fatal p {
  max-width: 460px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 13.5px;
}

.empty-state .btn,
.forbidden .btn,
.fatal .btn {
  margin-top: 18px;
}

.empty-state {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.6);
}

.fatal {
  margin-top: 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.fatal .empty-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

/* --------------------------------------------------------------- 工作区卡 */

.ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.ws-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ws-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.ws-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ws-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #dbeafe, #e0f2fe);
  color: var(--primary-strong);
  font-size: 16px;
  font-weight: 700;
  flex: none;
}

.ws-card:nth-child(3n + 2) .ws-icon {
  background: linear-gradient(135deg, #ccfbf1, #e0f2fe);
  color: #0f766e;
}

.ws-card:nth-child(3n + 3) .ws-icon {
  background: linear-gradient(135deg, #ede9fe, #e0e7ff);
  color: #5b21b6;
}

.ws-title {
  flex: 1;
  min-width: 0;
}

.ws-title h2 {
  font-size: 15.5px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.ws-slug {
  display: inline-block;
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
}

.ws-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}

.ws-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12.5px;
}

.ws-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ws-meta-label {
  color: var(--muted-soft);
}

.ws-error {
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ws-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

/* ------------------------------------------------------------------ 状态 */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  flex: none;
}

.status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.status-running {
  color: var(--success);
  background: var(--success-soft);
  border-color: var(--success-border);
}

.status-starting {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: var(--warning-border);
}

.status-stopped,
.status-unknown {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.status-failed {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

/* ------------------------------------------------------------------ 账号 */

.account-grid {
  display: grid;
  grid-template-columns: minmax(0, 330px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.account-card {
  padding: 24px;
}

.account-identity {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary) 0%, #0ea5e9 100%);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  flex: none;
}

.account-name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.account-username {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
  margin-top: 2px;
}

.account-list {
  display: grid;
  gap: 0;
  margin-top: 8px;
}

.account-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.account-list > div:last-child {
  border-bottom: 0;
}

.account-list dt {
  color: var(--muted);
  font-size: 12.5px;
  flex: none;
}

.account-list dd {
  font-size: 13px;
  font-weight: 500;
  text-align: right;
  overflow-wrap: anywhere;
}

.account-stack {
  display: grid;
  gap: 18px;
}

.section-card {
  padding: 24px;
}

.section-head {
  margin-bottom: 18px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
}

.section-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

/* --------------------------------------------------------------- 强制改密 */

.force-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  background: radial-gradient(900px 480px at 15% -10%, #dbeafe 0%, transparent 60%),
    radial-gradient(760px 420px at 100% 0%, #ccfbf1 0%, transparent 55%), var(--bg);
}

.force-card {
  width: 100%;
  max-width: 460px;
  padding: 32px;
}

.force-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.force-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.force-sub {
  margin: 6px 0 20px;
  color: var(--muted);
  font-size: 13.5px;
}

/* ------------------------------------------------------------------ 表单 */

.form {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  align-content: start;
}

.field > label,
.field > .label-text,
.field > span.label-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) calc(50% - 1px), calc(100% - 12px) calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.field select[multiple] {
  appearance: auto;
  padding: 6px;
  background-image: none;
  min-height: 120px;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted-soft);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  background: var(--surface-muted);
  color: var(--muted);
  cursor: not-allowed;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
  overflow-wrap: anywhere;
}

.fieldset {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-width: 0;
}

.fieldset legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px 10px;
}

.checkbox-list {
  display: grid;
  gap: 4px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.checkbox,
.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
  line-height: 1.5;
}

.checkbox input,
.check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--primary);
  flex: none;
  cursor: pointer;
}

.checkbox:has(input:disabled),
.check:has(input:disabled) {
  color: var(--muted-soft);
  cursor: not-allowed;
}

.check-card {
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
}

.check-card span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.check-card strong {
  font-size: 13px;
  font-weight: 600;
}

.check-card small {
  color: var(--muted);
  font-size: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.select-sm {
  width: auto;
  max-width: 110px;
  padding: 5px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background-color: var(--surface);
  color: var(--text-soft);
  font-size: 12.5px;
}

.select-sm:disabled {
  background: var(--surface-muted);
  color: var(--muted);
  cursor: not-allowed;
}

.select-sm:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

/* --------------------------------------------------------------- 登录页面 */

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background: radial-gradient(1000px 520px at 12% -12%, #dbeafe 0%, transparent 60%),
    radial-gradient(900px 480px at 100% 0%, #ccfbf1 0%, transparent 55%), var(--bg);
}

.login-shell {
  width: 100%;
  max-width: 860px;
}

.login-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 30px 70px -40px rgba(2, 32, 71, 0.55);
}

.login-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 38px 36px;
  color: #eaf2ff;
  background: linear-gradient(160deg, #1e40af 0%, #1d4ed8 48%, #0e7490 100%);
}

.login-aside-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.login-aside .brand-mark {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.login-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.login-brand-sub {
  margin-top: 2px;
  font-size: 11px;
  color: rgba(234, 242, 255, 0.72);
  letter-spacing: 0.06em;
}

.login-aside-copy h1 {
  font-size: 25px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: #fff;
}

.login-aside-copy p {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(234, 242, 255, 0.82);
}

.login-features {
  list-style: none;
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.login-features li {
  position: relative;
  padding-left: 18px;
  font-size: 12.5px;
  color: rgba(234, 242, 255, 0.88);
}

.login-features li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
}

.login-aside-foot {
  font-size: 11.5px;
  color: rgba(234, 242, 255, 0.6);
  letter-spacing: 0.04em;
}

.login-main {
  padding: 38px 40px 30px;
  display: flex;
  flex-direction: column;
}

.login-head h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.login-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13.5px;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.login-form .field input {
  padding: 10px 13px;
}

.remember-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -2px;
  font-size: 13px;
}

.login-notice {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}

.login-foot {
  margin-top: auto;
  padding-top: 24px;
  color: var(--muted-soft);
  font-size: 11.5px;
}

/* --------------------------------------------------------------- 管理端 */

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat {
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stat-value {
  font-size: 21px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.stat-label {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.stat.is-danger .stat-value {
  color: var(--danger);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tab:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.tab.is-active {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.tab.is-active .tab-count {
  background: var(--surface);
  color: var(--primary-strong);
}

.panel {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
}

.panel-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
}

.page-info {
  color: var(--muted);
  font-size: 12.5px;
}

.pager {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --------------------------------------------------------------- 表格 */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  padding: 10px 14px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: #f9fbfd;
}

.table .th-actions {
  text-align: right;
}

.table .td-actions {
  text-align: right;
}

.cell-title {
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.cell-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.cell-sub .badge {
  margin-left: 6px;
}

.cell-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  flex-wrap: nowrap;
}

.table .loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 26px 12px;
  color: var(--muted);
  font-size: 13px;
}

.truncate {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.chips {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  max-width: 260px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-soft);
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.badge.blue {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--primary-strong);
}

.badge.green {
  background: var(--success-soft);
  border-color: var(--success-border);
  color: var(--success);
}

.badge.amber {
  background: var(--warning-soft);
  border-color: var(--warning-border);
  color: var(--warning);
}

.badge.red {
  background: var(--danger-soft);
  border-color: var(--danger-border);
  color: var(--danger);
}

.badge.gray {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

/* --------------------------------------------------------------- 临时口令 */

.callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--success-soft);
  border: 1px solid var(--success-border);
  border-radius: 12px;
}

.callout-main {
  min-width: 0;
}

.callout-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--success);
}

.callout-sub {
  margin-top: 2px;
  color: #3f6212;
  font-size: 12.5px;
  line-height: 1.5;
}

.temp-password {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border: 1px solid var(--success-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  user-select: all;
  overflow-wrap: anywhere;
}

.callout-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------- 设置 */

.settings-form {
  display: grid;
  gap: 18px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.settings-section {
  padding: 20px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.settings-section-head {
  margin-bottom: 16px;
}

.settings-section-head h3 {
  font-size: 14.5px;
  font-weight: 700;
}

.settings-section-head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.ams-test {
  margin-top: 12px;
}

/* --------------------------------------------------------------- 弹窗 */

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
}

.modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(600px, 100%);
  max-height: min(86vh, 860px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 40px 90px -30px rgba(2, 6, 23, 0.55);
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  flex: 1;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex: none;
}

.modal-close:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  min-height: 0;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: var(--surface-muted);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.confirm-text {
  color: var(--text-soft);
  font-size: 13.5px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.confirm-extra {
  margin-top: 12px;
}

.modal .alert + .form,
.modal .form .alert {
  margin-bottom: 0;
}

/* --------------------------------------------------------------- Toast */

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(380px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 44px -22px rgba(15, 23, 42, 0.5);
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  pointer-events: auto;
  animation: toast-in 0.18s ease-out;
}

.toast::before {
  content: "";
  width: 3px;
  align-self: stretch;
  flex: none;
  border-radius: 999px;
  background: var(--primary);
}

.toast.success::before {
  background: var(--success);
}

.toast.error::before {
  background: var(--danger);
}

.toast.warning::before {
  background: var(--warning);
}

.toast.leaving {
  opacity: 0;
  transition: opacity 0.18s ease;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --------------------------------------------------------------- 响应式 */

@media (max-width: 1024px) {
  .settings-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .account-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .login-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-aside {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 26px;
  }

  .login-aside-copy,
  .login-aside-foot {
    display: none;
  }

  .login-main {
    padding: 28px 26px 24px;
  }
}

@media (max-width: 720px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar-inner {
    flex-wrap: wrap;
    gap: 8px 12px;
    padding-top: 9px;
    padding-bottom: 9px;
    min-height: 0;
  }

  .brand {
    order: 1;
  }

  .topbar-user {
    order: 2;
  }

  .topnav {
    order: 3;
    flex-basis: 100%;
  }

  .brand-tag {
    display: none;
  }

  .topbar-user {
    gap: 8px;
  }

  .user-meta {
    display: none;
  }

  .topnav-link {
    padding: 6px 9px;
    font-size: 13px;
  }

  .page {
    padding-top: 22px;
    padding-bottom: 48px;
  }

  .page-head {
    margin-bottom: 16px;
  }

  .page-head h1 {
    font-size: 21px;
  }

  .ws-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .form-grid,
  .form-grid.cols-3 {
    grid-template-columns: minmax(0, 1fr);
  }

  .panel {
    padding: 16px;
  }

  .table {
    min-width: 760px;
  }

  .modal-root {
    padding: 0;
    place-items: end center;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
  }

  .modal-foot {
    border-radius: 0;
  }

  .toast-region {
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
  }

  .section-card,
  .account-card {
    padding: 18px;
  }

  .force-card {
    padding: 24px 20px;
  }

  .login-body {
    padding: 18px 12px;
  }

  .login-main {
    padding: 24px 20px 20px;
  }

  .hide-sm {
    display: none !important;
  }

  .callout {
    align-items: flex-start;
  }
}

@media (max-width: 460px) {
  .topbar-user .btn {
    padding: 0 8px;
  }

  .brand-name {
    font-size: 14px;
  }

  .stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tabs {
    padding: 3px;
  }

  .tab {
    padding: 7px 11px;
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
