/* =========================================================
   Aster 管理台 · 样式
   纯原生 CSS，无外部依赖
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  --font-sans: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-subtle: #f7f8fc;
  --surface-hover: #f1f3f9;
  --border: #e8ebf2;
  --border-strong: #d9dee9;
  --text: #172033;
  --text-secondary: #475467;
  --muted: #8a94a6;

  --primary: #5b6cff;
  --primary-hover: #4b5cf2;
  --primary-soft: #eef0ff;
  --primary-contrast: #ffffff;

  --success: #0f9f6e;
  --success-soft: #e9f8f2;
  --warning: #d98213;
  --warning-soft: #fff5e6;
  --danger: #e5484d;
  --danger-soft: #fff0f0;
  --violet: #8a5cf6;
  --violet-soft: #f3edff;

  --sidebar-bg: #101728;
  --sidebar-panel: rgba(255, 255, 255, 0.055);
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-text: #b6c0d5;
  --sidebar-muted: #77839e;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-sm: 0 2px 8px rgba(20, 30, 60, 0.04);
  --shadow-md: 0 12px 32px rgba(20, 30, 60, 0.08);
  --shadow-lg: 0 24px 64px rgba(12, 20, 40, 0.16);
  --ring: 0 0 0 4px rgba(91, 108, 255, 0.12);

  --radius-sm: 9px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;

  --sidebar-width: 264px;
  --topbar-height: 76px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0b101c;
  --surface: #121a2a;
  --surface-subtle: #172033;
  --surface-hover: #1b263a;
  --border: #202b40;
  --border-strong: #2c3a53;
  --text: #edf1fa;
  --text-secondary: #b7c1d5;
  --muted: #7e8ca6;

  --primary: #7c8aff;
  --primary-hover: #93a0ff;
  --primary-soft: rgba(124, 138, 255, 0.13);
  --primary-contrast: #0e1422;

  --success: #45d7a4;
  --success-soft: rgba(69, 215, 164, 0.11);
  --warning: #f5b454;
  --warning-soft: rgba(245, 180, 84, 0.11);
  --danger: #ff7a7e;
  --danger-soft: rgba(255, 122, 126, 0.1);
  --violet: #b394ff;
  --violet-soft: rgba(179, 148, 255, 0.12);

  --sidebar-bg: #080d17;
  --sidebar-panel: rgba(255, 255, 255, 0.05);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.18);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.16);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 28px 70px rgba(0, 0, 0, 0.45);
  --ring: 0 0 0 4px rgba(124, 138, 255, 0.15);

  color-scheme: dark;
}

/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

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

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

[hidden] {
  display: none !important;
}

::selection {
  color: #fff;
  background: rgba(91, 108, 255, 0.75);
}

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

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

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

.dot-sep {
  display: inline-block;
  margin: 0 7px;
  color: var(--border-strong);
}

/* ---------- Shared primitives ---------- */
.brand-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  color: #fff;
  background: linear-gradient(135deg, #8c99ff 0%, #596bfa 52%, #4757ea 100%);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(72, 88, 239, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  flex: 0 0 auto;
}

.brand-symbol .icon {
  width: 19px;
  height: 19px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 15px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    box-shadow 0.18s ease, transform 0.18s ease;
}

.btn .icon {
  width: 17px;
  height: 17px;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #6878ff 0%, var(--primary) 100%);
  border-color: var(--primary);
  box-shadow: 0 5px 14px rgba(76, 92, 242, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #5c6dff 0%, var(--primary-hover) 100%);
  box-shadow: 0 7px 18px rgba(76, 92, 242, 0.28);
}

.btn-secondary {
  color: var(--text-secondary);
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-subtle);
  border-color: var(--border-strong);
}

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

.btn-danger:hover:not(:disabled) {
  filter: brightness(0.95);
}

.btn-sm {
  height: 32px;
  padding: 0 11px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-sm .icon {
  width: 15px;
  height: 15px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-subtle);
}

.icon-btn-sm {
  width: 31px;
  height: 31px;
  border-radius: 8px;
}

.icon-btn-sm .icon {
  width: 17px;
  height: 17px;
}

.text-button {
  padding: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: 0;
}

.text-button:hover {
  color: var(--primary-hover);
}

.text-button.danger {
  color: var(--danger);
}

.text-button.subtle {
  color: var(--muted);
}

.text-button.subtle:hover {
  color: var(--text-secondary);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: 0;
}

.text-link .icon {
  width: 15px;
  height: 15px;
  transition: transform 0.18s ease;
}

.text-link:hover .icon {
  transform: translateX(2px);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  color: #fff;
  background: var(--avatar-bg, var(--primary));
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
  user-select: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 12px;
}

.avatar-md {
  width: 42px;
  height: 42px;
  font-size: 15px;
}

.avatar-xl {
  width: 78px;
  height: 78px;
  font-size: 26px;
  border-radius: 24px;
}

/* Form primitives */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.required {
  color: var(--danger);
}

.input {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

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

.input:hover {
  border-color: var(--border-strong);
}

.input:focus {
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.input.is-readonly {
  color: var(--muted);
  background: var(--surface-subtle);
  cursor: not-allowed;
}

textarea.input {
  min-height: 86px;
  resize: vertical;
  line-height: 1.6;
}

.input.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.input-with-icon {
  position: relative;
}

.input-with-icon > .icon {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.input-with-icon .input {
  padding-left: 38px;
}

.field-error {
  display: none;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--danger);
}

.field-error:not(:empty) {
  display: block;
}

.field-hint {
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}

.field.has-error .input,
.input.has-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.08);
}

.field-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 20px;
  margin-top: 24px;
  border-top: 1px solid var(--border);
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.check-label input,
input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Switch */
.switch {
  position: relative;
  width: 38px;
  height: 22px;
  padding: 0;
  background: var(--border-strong);
  border: 0;
  border-radius: 999px;
  transition: background 0.2s ease;
  flex: 0 0 auto;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.22);
  transition: transform 0.22s var(--ease), width 0.15s ease;
}

.switch[aria-checked="true"] {
  background: var(--primary);
}

.switch[aria-checked="true"] .switch-thumb {
  transform: translateX(16px);
}

.switch:active .switch-thumb {
  width: 18px;
}

.switch[aria-checked="true"]:active .switch-thumb {
  transform: translateX(14px);
}

/* =========================================================
   Login
   ========================================================= */
.login-view {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(430px, 0.92fr);
  min-height: 100vh;
  background: #fbfcff;
}

.login-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 34px clamp(40px, 5vw, 76px) 30px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(110% 80% at 100% 0%, rgba(88, 105, 255, 0.2) 0%, transparent 55%),
    linear-gradient(145deg, #0a1020 0%, #0d1529 55%, #111c35 100%);
  isolation: isolate;
}

.visual-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  pointer-events: none;
  z-index: -1;
}

.visual-glow-a {
  top: -180px;
  right: -150px;
  width: 540px;
  height: 540px;
  background: radial-gradient(circle, rgba(88, 108, 255, 0.28) 0%, rgba(88, 108, 255, 0) 68%);
}

.visual-glow-b {
  bottom: -220px;
  left: -160px;
  width: 620px;
  height: 620px;
  background: radial-gradient(circle, rgba(27, 195, 158, 0.13) 0%, rgba(27, 195, 158, 0) 68%);
}

.visual-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.42;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(80% 65% at 60% 30%, #000 0%, transparent 80%);
  -webkit-mask-image: radial-gradient(80% 65% at 60% 30%, #000 0%, transparent 80%);
}

.login-brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand .brand-symbol {
  width: 36px;
  height: 36px;
  border-radius: 11px;
}

.login-brand-name {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.login-brand-name em {
  font-style: normal;
  font-weight: 450;
  color: #8d99b5;
}

.login-visual-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 590px;
  margin: auto 0;
  padding: clamp(48px, 9vh, 106px) 0 36px;
}

.visual-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  padding: 0 12px;
  margin-bottom: 24px;
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: 0.08em;
  color: #aeb9d2;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.pulse-dot {
  position: relative;
  width: 6px;
  height: 6px;
  background: #4ddbb3;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(77, 219, 179, 0.1);
}

.login-visual h1 {
  font-size: clamp(42px, 4.3vw, 62px);
  font-weight: 650;
  line-height: 1.14;
  letter-spacing: -0.045em;
  color: #f4f6ff;
}

.login-visual h1 span {
  color: transparent;
  background: linear-gradient(100deg, #e2e6ff 5%, #9dacff 58%, #7e91ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.visual-description {
  max-width: 470px;
  margin-top: 22px;
  font-size: 14px;
  line-height: 1.85;
  color: #8996b0;
}

.visual-preview {
  position: relative;
  width: min(535px, 100%);
  margin-top: clamp(34px, 6vh, 58px);
  padding: 21px 22px 17px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.068), rgba(255, 255, 255, 0.025));
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 20px;
  box-shadow: 0 32px 70px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(18px);
}

.preview-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.preview-eyebrow {
  display: block;
  margin-bottom: 6px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: #8794ae;
}

.preview-value {
  font-size: 27px;
  font-weight: 650;
  letter-spacing: -0.03em;
  color: #f2f5ff;
}

.preview-value small {
  margin-left: 6px;
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0;
  color: #7e8ba5;
}

.preview-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  font-size: 10px;
  color: #aab4c9;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
}

.preview-live span {
  width: 5px;
  height: 5px;
  background: #4ddbb3;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(77, 219, 179, 0.1);
}

.preview-chart {
  height: 118px;
  margin: 14px -4px 4px;
}

.preview-chart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.preview-line {
  fill: none;
  stroke: #96a6ff;
  stroke-width: 2;
  stroke-linecap: round;
  filter: drop-shadow(0 3px 8px rgba(119, 137, 255, 0.28));
}

.preview-area {
  opacity: 0.85;
}

.preview-footer {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-top: 13px;
  font-size: 10.5px;
  color: #7d89a3;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.preview-footer strong {
  color: #76dfc0;
  font-weight: 600;
}

.avatar-stack {
  display: flex;
  padding-left: 3px;
}

.mini-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 23px;
  margin-left: -5px;
  font-size: 8px;
  font-weight: 600;
  color: #fff;
  background: var(--avatar-bg, #6376ff);
  border: 2px solid #131d32;
  border-radius: 50%;
}

.mini-avatar.more {
  font-size: 7.5px;
  color: #8f9bb4;
  background: #202b43;
}

.preview-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  white-space: nowrap;
}

.preview-legend i {
  width: 13px;
  height: 2px;
  background: #96a6ff;
  border-radius: 2px;
}

.preview-float-card {
  position: absolute;
  right: -30px;
  bottom: -30px;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 190px;
  padding: 13px 14px;
  background: rgba(20, 29, 49, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 15px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(14px);
}

.float-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 33px;
  height: 33px;
  color: #8f9cff;
  background: rgba(124, 138, 255, 0.13);
  border-radius: 10px;
}

.float-icon .icon {
  width: 17px;
  height: 17px;
}

.preview-float-card > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.preview-float-card > div > span {
  font-size: 9px;
  color: #7e8aa2;
}

.preview-float-card strong {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #f5f7ff;
}

.preview-float-card strong small {
  font-size: 9px;
  font-weight: 400;
  color: #707d96;
}

.float-badge {
  align-self: flex-start;
  padding: 2px 6px;
  margin-left: auto;
  font-size: 8.5px;
  color: #4ddbb3;
  background: rgba(77, 219, 179, 0.09);
  border-radius: 5px;
}

.login-visual-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 13px;
  padding-top: 24px;
  font-size: 10px;
  color: #5f6b84;
}

.visual-footer-divider {
  width: 1px;
  height: 11px;
  background: rgba(255, 255, 255, 0.12);
}

.visual-trust {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  color: #77839c;
}

.visual-trust .icon {
  width: 12px;
  height: 12px;
}

/* Login form side */
.login-main {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 30px clamp(32px, 4.8vw, 72px) 24px;
  background:
    radial-gradient(80% 55% at 100% 0%, rgba(91, 108, 255, 0.045), transparent 70%),
    #fbfcff;
}

.login-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-height: 32px;
  font-size: 12px;
  color: #7b8497;
}

.login-topbar a {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 600;
  color: #4c5bea;
}

.login-topbar a .icon {
  width: 13px;
  height: 13px;
}

.auth-panel {
  width: min(408px, 100%);
  margin: auto;
  padding: 40px 0 26px;
}

.auth-mobile-brand {
  display: none;
}

.auth-kicker {
  display: block;
  margin-bottom: 12px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.17em;
  color: #6675f0;
}

.auth-panel h2 {
  margin-bottom: 10px;
  font-size: clamp(32px, 3vw, 39px);
  font-weight: 680;
  line-height: 1.2;
  letter-spacing: -0.04em;
  color: #141b2d;
}

.auth-subtitle {
  font-size: 13.5px;
  color: #7c8698;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 32px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.auth-field > label {
  font-size: 12.5px;
  font-weight: 600;
  color: #3e4859;
}

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: 52px;
  background: #fff;
  border: 1px solid #e1e5ee;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(20, 30, 50, 0.02);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.auth-input-wrap:hover {
  border-color: #ced4e0;
}

.auth-input-wrap:focus-within {
  border-color: #6878f6;
  box-shadow: 0 0 0 4px rgba(91, 108, 255, 0.1);
}

.auth-input-wrap > .icon {
  position: absolute;
  left: 15px;
  width: 18px;
  height: 18px;
  color: #a1aab9;
  pointer-events: none;
}

.auth-input-wrap input {
  width: 100%;
  height: 100%;
  padding: 0 48px 0 44px;
  font-size: 13.5px;
  color: #172033;
  background: transparent;
  border: 0;
  border-radius: 12px;
  outline: 0;
}

.auth-input-wrap input::placeholder {
  color: #abb3c1;
}

.auth-input-wrap.has-error {
  border-color: #e5484d;
  box-shadow: 0 0 0 4px rgba(229, 72, 77, 0.08);
}

.password-visibility {
  position: absolute;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: #9ba5b5;
  background: transparent;
  border: 0;
  border-radius: 8px;
}

.password-visibility:hover {
  color: #596273;
  background: #f4f6fa;
}

.password-visibility .icon {
  width: 18px;
  height: 18px;
}

.password-visibility .eye-closed {
  display: none;
}

.password-visibility.is-visible .eye-open {
  display: none;
}

.password-visibility.is-visible .eye-closed {
  display: block;
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -3px;
}

.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin-top: -4px;
  font-size: 12px;
  line-height: 1.55;
  color: #c8393e;
  background: #fff1f1;
  border: 1px solid #ffe0e0;
  border-radius: 9px;
  animation: shake 0.35s ease;
}

.form-alert .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
}

.login-submit {
  width: 100%;
  height: 52px;
  margin-top: 2px;
  font-size: 14px;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(73, 89, 238, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.login-submit:hover {
  transform: translateY(-1px);
}

.login-submit.is-loading {
  transform: none;
  cursor: wait;
  opacity: 0.82;
}

.login-submit.is-loading .login-submit-arrow {
  display: none;
}

.login-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

.login-submit.is-loading .login-spinner {
  display: block;
}

.login-submit-arrow {
  width: 18px;
  height: 18px;
  margin-left: 3px;
}

.demo-credentials {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  margin-top: 24px;
  background: #f7f8fc;
  border: 1px solid #ebedf3;
  border-radius: 11px;
}

.demo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: #6878f6;
  background: #eceeff;
  border-radius: 9px;
}

.demo-icon .icon {
  width: 16px;
  height: 16px;
}

.demo-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.demo-copy > span {
  font-size: 10px;
  color: #959eac;
}

.demo-copy > div {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: #687284;
}

.demo-copy code {
  padding: 1px 5px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 10.5px;
  color: #3f4859;
  background: #fff;
  border: 1px solid #e8ebf1;
  border-radius: 4px;
}

.demo-copy .dot-sep {
  margin: 0;
  color: #c3c9d3;
}

.demo-fill {
  padding: 5px 8px;
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 600;
  color: #5a6af3;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.demo-fill:hover {
  background: #eceefe;
}

.demo-note {
  margin-top: 9px;
  font-size: 10px;
  text-align: center;
  color: #a3abb8;
}

.login-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 10px;
  color: #a1a9b6;
}

.login-footer > div {
  display: flex;
  gap: 16px;
}

.login-footer a:hover {
  color: #687284;
}

/* =========================================================
   App layout & sidebar
   ========================================================= */
.app-shell {
  min-height: 100vh;
  background: var(--bg);
}

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  padding: 22px 14px 16px;
  overflow: hidden;
  color: var(--sidebar-text);
  background:
    radial-gradient(135% 70% at 0% 0%, rgba(79, 96, 255, 0.15) 0%, transparent 58%),
    var(--sidebar-bg);
}

.sidebar::after {
  position: absolute;
  right: -150px;
  bottom: -180px;
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, rgba(36, 201, 162, 0.06) 0%, transparent 70%);
  content: "";
  pointer-events: none;
}

.sidebar-brand {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 8px;
  margin-bottom: 24px;
  min-height: 38px;
}

.sidebar-brand .brand-symbol {
  width: 35px;
  height: 35px;
  border-radius: 10px;
}

.sidebar-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.sidebar-brand-copy strong {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: #f2f5ff;
}

.sidebar-brand-copy small {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: #72809b;
}

.sidebar-brand-version {
  padding: 2px 5px;
  margin-left: auto;
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: #71809a;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 4px;
}

.workspace-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin: 0 2px 25px;
  background: var(--sidebar-panel);
  border: 1px solid var(--sidebar-border);
  border-radius: 13px;
}

.workspace-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 12px;
  font-weight: 650;
  color: #dfe4ff;
  background: linear-gradient(135deg, rgba(107, 123, 255, 0.45), rgba(72, 86, 210, 0.25));
  border: 1px solid rgba(147, 161, 255, 0.22);
  border-radius: 9px;
  flex: 0 0 auto;
}

.workspace-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}

.workspace-copy strong {
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 550;
  color: #dce2f0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-copy span {
  overflow: hidden;
  font-size: 9.5px;
  color: #707d98;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-plan {
  padding: 2px 5px;
  margin-left: auto;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #8d9cff;
  background: rgba(111, 128, 255, 0.11);
  border: 1px solid rgba(111, 128, 255, 0.15);
  border-radius: 4px;
}

.side-nav {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  padding: 0 2px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.side-nav::-webkit-scrollbar {
  width: 4px;
}

.side-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.nav-label {
  padding: 0 11px;
  margin: 2px 0 8px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #55627b;
}

.nav-label-spaced {
  margin-top: 24px;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  margin-bottom: 3px;
  font-size: 13px;
  font-weight: 500;
  color: #aab5ca;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.nav-item:hover {
  color: #eef2ff;
  background: rgba(255, 255, 255, 0.045);
}

.nav-item.is-active {
  color: #f5f7ff;
  background: linear-gradient(90deg, rgba(99, 114, 255, 0.22) 0%, rgba(99, 114, 255, 0.07) 100%);
  border-color: rgba(127, 140, 255, 0.12);
}

.nav-icon {
  width: 18px;
  height: 18px;
  color: #7e8aa4;
  transition: color 0.18s ease;
}

.nav-item.is-active .nav-icon,
.nav-group.has-active .nav-group-toggle .nav-icon {
  color: #aab5ff;
}

.nav-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-active-bar {
  width: 5px;
  height: 5px;
  margin-left: auto;
  background: #b5c0ff;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(181, 192, 255, 0.08);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.nav-item.is-active .nav-active-bar {
  opacity: 1;
}

.nav-group-toggle {
  font-family: inherit;
  cursor: pointer;
}

.nav-group.has-active .nav-group-toggle {
  color: #e5eaff;
}

.nav-chevron {
  width: 15px;
  height: 15px;
  margin-left: auto;
  color: #65718a;
  transition: transform 0.24s var(--ease);
}

.nav-group.is-expanded .nav-chevron {
  transform: rotate(180deg);
}

.nav-submenu {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.26s var(--ease);
}

.nav-group.is-expanded .nav-submenu {
  grid-template-rows: 1fr;
}

.nav-submenu-inner {
  min-height: 0;
  overflow: hidden;
}

.nav-subitem {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 37px;
  padding: 8px 11px 8px 19px;
  margin: 2px 0 4px 21px;
  font-size: 12px;
  color: #8f9bb3;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0 8px 8px 0;
  transition: color 0.18s ease, background 0.18s ease;
}

.nav-subitem:hover {
  color: #eef2ff;
  background: rgba(255, 255, 255, 0.035);
}

.nav-subitem.is-active {
  color: #f0f3ff;
  background: rgba(108, 123, 255, 0.09);
}

.subitem-marker {
  width: 4px;
  height: 4px;
  background: #67738d;
  border-radius: 50%;
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.nav-subitem.is-active .subitem-marker {
  background: #aab6ff;
  box-shadow: 0 0 0 3px rgba(170, 182, 255, 0.09);
}

.sidebar-footer {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  padding: 16px 4px 0;
  margin-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.065);
}

.system-status {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 7px;
}

.status-pulse {
  position: relative;
  width: 7px;
  height: 7px;
  background: #40d6a4;
  border-radius: 50%;
  flex: 0 0 auto;
}

.status-pulse::after {
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(64, 214, 164, 0.23);
  border-radius: 50%;
  content: "";
  animation: statusPulse 2.6s ease-out infinite;
}

.system-status > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.system-status strong {
  font-size: 10px;
  font-weight: 550;
  color: #99a5ba;
}

.system-status span:not(.status-pulse):not(.status-uptime) {
  font-size: 8.5px;
  color: #5d6981;
}

.status-uptime {
  margin-left: auto;
  font-size: 8.5px;
  font-variant-numeric: tabular-nums;
  color: #5a6680;
}

.sidebar-help {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 8px;
  margin-top: 7px;
  font-size: 11px;
  color: #7f8ca5;
  background: transparent;
  border: 0;
  border-radius: 8px;
  transition: color 0.18s ease, background 0.18s ease;
}

.sidebar-help:hover {
  color: #dfe5f2;
  background: rgba(255, 255, 255, 0.045);
}

.sidebar-help .icon {
  width: 15px;
  height: 15px;
}

.sidebar-help .help-arrow {
  width: 13px;
  height: 13px;
  margin-left: auto;
  opacity: 0.55;
}

.sidebar-overlay {
  display: none;
}

.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

/* =========================================================
   Topbar
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--topbar-height);
  padding: 0 clamp(22px, 2.6vw, 36px);
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.mobile-menu-btn {
  display: none;
}

.breadcrumb {
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 13px;
}

.breadcrumb-current {
  overflow: hidden;
  font-weight: 600;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb-parent {
  color: var(--muted);
  white-space: nowrap;
}

.breadcrumb-sep {
  width: 14px;
  height: 14px;
  margin: 0 7px;
  color: var(--border-strong);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.global-search {
  display: flex;
  align-items: center;
  width: 242px;
  height: 37px;
  padding: 0 9px 0 11px;
  margin-right: 5px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.global-search:focus-within {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.global-search .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.global-search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0 8px;
  font-size: 12px;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.global-search input::placeholder {
  color: var(--muted);
}

.global-search input::-webkit-search-cancel-button {
  display: none;
}

.global-search kbd {
  padding: 2px 5px;
  font-family: inherit;
  font-size: 8.5px;
  line-height: 1.4;
  color: var(--muted);
  white-space: nowrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--border);
}

.theme-icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-icon-sun {
  display: block;
}

.popover-wrap {
  position: relative;
}

.notification-trigger {
  position: relative;
}

.notification-dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 6px;
  height: 6px;
  background: #f05a5f;
  border: 1.5px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--surface);
}

.notification-dot.is-read {
  display: none;
}

.topbar-divider {
  width: 1px;
  height: 22px;
  margin: 0 4px;
  background: var(--border);
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 7px 4px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.profile-trigger:hover {
  background: var(--surface-subtle);
  border-color: var(--border);
}

.profile-trigger-copy {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 70px;
  text-align: left;
  line-height: 1.4;
}

.profile-trigger-copy strong {
  overflow: hidden;
  max-width: 100px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-trigger-copy small {
  overflow: hidden;
  max-width: 100px;
  font-size: 9.5px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chevron {
  width: 13px;
  height: 13px;
  color: var(--muted);
}

/* Popovers */
.popover {
  position: absolute;
  top: calc(100% + 11px);
  right: 0;
  z-index: 70;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: popIn 0.17s var(--ease);
}

.notification-popover {
  width: 376px;
  overflow: hidden;
}

.popover-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 18px 13px;
}

.popover-header h3 {
  margin-bottom: 2px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--text);
}

.popover-header span {
  font-size: 10.5px;
  color: var(--muted);
}

.notification-list {
  max-height: 332px;
  overflow-y: auto;
}

.notification-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  padding: 12px 18px;
  text-align: left;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  transition: background 0.16s ease;
}

.notification-item:hover {
  background: var(--surface-subtle);
}

.notification-item.unread {
  background: color-mix(in srgb, var(--primary-soft) 45%, var(--surface));
}

.notification-item.unread:hover {
  background: var(--primary-soft);
}

.notification-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 9px;
  flex: 0 0 auto;
}

.notification-item-icon.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.notification-item-icon.success {
  color: var(--success);
  background: var(--success-soft);
}

.notification-item-icon .icon {
  width: 15px;
  height: 15px;
}

.notification-item-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.notification-item-copy strong {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
}

.notification-item-copy span {
  overflow: hidden;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notification-item-time {
  margin-left: auto;
  font-size: 9px;
  white-space: nowrap;
  color: var(--muted);
}

.notification-item .unread-dot {
  width: 5px;
  height: 5px;
  margin-top: 6px;
  background: var(--primary);
  border-radius: 50%;
  flex: 0 0 auto;
}

.notification-item.read .unread-dot {
  visibility: hidden;
}

.popover-footer {
  display: flex;
  justify-content: center;
  padding: 10px;
  border-top: 1px solid var(--border);
}

.notification-empty {
  padding: 34px 20px;
  font-size: 11.5px;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.profile-popover {
  width: 260px;
  padding: 7px;
}

.profile-popover-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-bottom: 4px;
  background: var(--surface-subtle);
  border-radius: 11px;
}

.profile-popover-head > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.profile-popover-head strong {
  font-size: 12.5px;
  font-weight: 600;
}

.profile-popover-head span {
  overflow: hidden;
  font-size: 10px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popover-menu {
  padding: 3px 0;
}

.popover-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 8px;
  transition: background 0.16s ease, color 0.16s ease;
}

.popover-menu-item:hover {
  color: var(--text);
  background: var(--surface-subtle);
}

.popover-menu-item .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.popover-menu-item.danger {
  color: var(--danger);
}

.popover-menu-item.danger .icon {
  color: var(--danger);
}

.popover-menu-item.danger:hover {
  background: var(--danger-soft);
}

.popover-menu-divider {
  height: 1px;
  margin: 4px 8px;
  background: var(--border);
}

.popover-version {
  padding: 7px 10px 4px;
  font-size: 8.5px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* =========================================================
   Page shell & shared cards
   ========================================================= */
.main-content {
  width: 100%;
  max-width: 1560px;
  padding: clamp(24px, 2.6vw, 34px) clamp(22px, 2.6vw, 36px) 44px;
  margin: 0 auto;
}

.page {
  display: none;
}

.page.is-active {
  display: block;
  animation: pageIn 0.36s var(--ease);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.page-title-group {
  min-width: 0;
}

.page-kicker {
  display: block;
  margin-bottom: 7px;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.16em;
  color: var(--primary);
}

.page-title-group h1 {
  margin-bottom: 7px;
  font-size: clamp(24px, 2.3vw, 29px);
  font-weight: 680;
  line-height: 1.2;
  letter-spacing: -0.035em;
  color: var(--text);
}

.page-subtitle {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

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

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.card-heading h2 {
  margin-bottom: 4px;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card-heading p {
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 20px;
  padding: 0 7px;
  margin-left: 5px;
  font-size: 10px;
  font-weight: 600;
  vertical-align: 2px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 6px;
}

.muted-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  font-size: 9.5px;
  color: var(--muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
}

.muted-badge .icon {
  width: 12px;
  height: 12px;
}

/* Tones */
.tone-indigo {
  color: var(--primary);
  background: var(--primary-soft);
}

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

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

.tone-violet {
  color: var(--violet);
  background: var(--violet-soft);
}

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

/* =========================================================
   Dashboard
   ========================================================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}

.kpi-card {
  position: relative;
  min-height: 164px;
  padding: 19px 20px 17px;
  overflow: hidden;
  transition: transform 0.22s var(--ease), box-shadow 0.22s ease, border-color 0.22s ease;
}

.kpi-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 15px;
}

.kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 35px;
  height: 35px;
  border-radius: 10px;
}

.kpi-icon .icon {
  width: 17px;
  height: 17px;
}

.delta-pill {
  padding: 3px 7px;
  font-size: 9px;
  font-weight: 550;
  border-radius: 5px;
  white-space: nowrap;
}

.delta-pill.up {
  color: var(--success);
  background: var(--success-soft);
}

.delta-pill.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.delta-pill.neutral {
  color: var(--text-secondary);
  background: var(--surface-subtle);
}

.kpi-label {
  margin-bottom: 3px;
  font-size: 11px;
  color: var(--muted);
}

.kpi-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 7px;
}

.kpi-value strong {
  font-size: 29px;
  font-weight: 680;
  line-height: 1.15;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.kpi-value span {
  font-size: 9.5px;
  color: var(--muted);
}

.kpi-foot {
  position: relative;
  z-index: 1;
  font-size: 9.5px;
  color: var(--muted);
}

.kpi-spark {
  position: absolute;
  right: -2px;
  bottom: 0;
  width: 112px;
  height: 38px;
  color: var(--primary);
  opacity: 0.34;
  pointer-events: none;
}

.kpi-spark path {
  stroke-width: 2;
}

.kpi-spark.green {
  color: var(--success);
}

.kpi-spark.amber {
  color: var(--warning);
}

.kpi-spark.violet {
  color: var(--violet);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.72fr) minmax(284px, 0.84fr);
  gap: 17px;
  margin-top: 17px;
}

.chart-card {
  min-width: 0;
  padding: 22px 23px 15px;
}

.segmented-control {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.segmented-control button {
  height: 25px;
  padding: 0 10px;
  font-size: 10px;
  font-weight: 550;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.segmented-control button:hover {
  color: var(--text-secondary);
}

.segmented-control button.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(20, 30, 50, 0.09);
}

.chart-summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 5px;
}

.chart-average {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.chart-average span:first-child {
  margin-right: 3px;
  font-size: 10px;
  color: var(--muted);
}

.chart-average strong {
  font-size: 27px;
  font-weight: 680;
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.chart-average span:last-child {
  font-size: 9.5px;
  color: var(--muted);
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px;
  font-size: 9px;
  font-weight: 600;
  border-radius: 5px;
}

.trend-badge.up {
  color: var(--success);
  background: var(--success-soft);
}

.trend-badge.down {
  color: var(--danger);
  background: var(--danger-soft);
}

.trend-badge .icon {
  width: 11px;
  height: 11px;
}

.trend-badge small {
  margin-left: 2px;
  font-size: 8.5px;
  font-weight: 400;
  opacity: 0.78;
}

.chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 9.5px;
  color: var(--muted);
}

.chart-legend i {
  width: 14px;
  height: 3px;
  background: var(--primary);
  border-radius: 3px;
}

.chart-canvas {
  width: 100%;
  min-height: 222px;
}

.chart-canvas svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-grid-line {
  stroke: var(--border);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.chart-axis-text {
  fill: var(--muted);
  font-family: var(--font-sans);
  font-size: 9px;
}

.chart-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 8px color-mix(in srgb, var(--primary) 20%, transparent));
}

.chart-area {
  fill: url(#activityFill);
  pointer-events: none;
}

.chart-dot {
  fill: var(--surface);
  stroke: var(--primary);
  stroke-width: 2.2;
  transition: r 0.15s ease;
}

.chart-dot-group:hover .chart-dot {
  r: 5;
}

.chart-dot-group:hover .chart-dot-halo {
  opacity: 1;
}

.chart-dot-halo {
  fill: var(--primary);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

/* Security card */
.security-card {
  display: flex;
  flex-direction: column;
  padding: 22px 21px 17px;
}

.score-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 13px 0 17px;
}

.score-ring {
  display: grid;
  place-items: center;
  width: 126px;
  height: 126px;
  padding: 9px;
  background: conic-gradient(
    var(--primary) 0% var(--score, 92%),
    var(--surface-subtle) var(--score, 92%) 100%
  );
  border-radius: 50%;
  transition: background 0.5s ease;
}

.score-ring-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--border);
}

.score-ring-inner strong {
  font-size: 30px;
  font-weight: 680;
  line-height: 1.1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.score-ring-inner span {
  margin-top: 1px;
  font-size: 9px;
  color: var(--muted);
}

.score-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 9.5px;
  font-weight: 550;
  color: var(--success);
}

.score-state i {
  width: 4px;
  height: 4px;
  background: var(--success);
  border-radius: 50%;
}

.score-state.is-warning {
  color: var(--warning);
}

.score-state.is-warning i {
  background: var(--warning);
}

.security-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.security-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.security-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  flex: 0 0 auto;
}

.security-item-icon.ok {
  color: var(--success);
  background: var(--success-soft);
}

.security-item-icon.warn {
  color: var(--warning);
  background: var(--warning-soft);
}

.security-item-icon .icon {
  width: 14px;
  height: 14px;
}

.security-item-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.security-item-copy strong {
  font-size: 10.5px;
  font-weight: 550;
  color: var(--text-secondary);
}

.security-item-copy span {
  overflow: hidden;
  font-size: 9px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-status {
  padding: 2px 6px;
  margin-left: auto;
  font-size: 8.5px;
  border-radius: 4px;
  white-space: nowrap;
}

.mini-status.ok {
  color: var(--success);
  background: var(--success-soft);
}

.mini-status.warn {
  color: var(--warning);
  background: var(--warning-soft);
}

.security-review-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  padding: 9px;
  margin-top: auto;
  font-size: 10px;
  font-weight: 550;
  color: var(--text-secondary);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: color 0.18s ease, background 0.18s ease;
}

.security-review-btn:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.security-review-btn .icon {
  width: 13px;
  height: 13px;
}

/* Dashboard bottom */
.dashboard-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(290px, 0.75fr);
  gap: 17px;
  margin-top: 17px;
}

.recent-logins-card {
  padding: 21px 23px 13px;
}

.recent-logins {
  margin-top: 12px;
}

.login-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.login-row:first-child {
  border-top: 0;
}

.person-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.person-cell .avatar {
  width: 31px;
  height: 31px;
  font-size: 11px;
}

.person-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.person-copy strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-copy span {
  overflow: hidden;
  font-size: 9px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-device {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: 90px;
  font-size: 9.5px;
  color: var(--muted);
}

.login-device .icon {
  width: 13px;
  height: 13px;
}

.login-time {
  width: 80px;
  font-size: 9.5px;
  color: var(--muted);
  text-align: right;
}

.status-pill {
  display: inline-block;
  padding: 3px 6px;
  font-size: 8.5px;
  border-radius: 4px;
}

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

.quick-card {
  padding: 21px 19px 17px;
}

.quick-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 11px;
}

.quick-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 8px;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 9px;
  transition: background 0.18s ease, transform 0.18s ease;
}

.quick-item:hover {
  background: var(--surface-subtle);
  transform: translateX(2px);
}

.quick-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  flex: 0 0 auto;
}

.quick-icon .icon {
  width: 15px;
  height: 15px;
}

.quick-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.quick-copy strong {
  font-size: 10.5px;
  font-weight: 550;
  color: var(--text-secondary);
}

.quick-copy small {
  font-size: 8.5px;
  color: var(--muted);
}

.quick-arrow {
  width: 13px;
  height: 13px;
  margin-left: auto;
  color: var(--border-strong);
}

/* =========================================================
   Account settings
   ========================================================= */
.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.82fr);
  gap: 17px;
  align-items: start;
}

.profile-editor {
  padding: 23px 24px 24px;
}

.avatar-editor {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  margin: 20px 0 24px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 13px;
}

.avatar-editor .avatar-xl {
  border: 4px solid var(--surface);
  box-shadow: 0 4px 16px rgba(20, 30, 60, 0.1);
}

.avatar-editor-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.avatar-editor-copy > strong {
  margin-bottom: 2px;
  font-size: 12px;
  font-weight: 600;
}

.avatar-editor-copy > p {
  font-size: 9.5px;
  color: var(--muted);
}

.avatar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 9px;
}

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

.field-full {
  grid-column: 1 / -1;
}

.settings-side {
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.settings-card {
  padding: 21px 20px 18px;
}

.security-shield {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 9px;
}

.security-shield .icon {
  width: 16px;
  height: 16px;
}

.setting-list {
  margin-top: 13px;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.setting-row:first-child {
  border-top: 0;
}

.setting-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  color: var(--muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex: 0 0 auto;
}

.setting-icon .icon {
  width: 15px;
  height: 15px;
}

.setting-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.setting-copy strong {
  font-size: 10.5px;
  font-weight: 550;
  color: var(--text-secondary);
}

.setting-copy span {
  font-size: 9px;
  line-height: 1.5;
  color: var(--muted);
}

.security-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 9px 10px;
  margin-top: 10px;
  color: var(--muted);
  background: var(--surface-subtle);
  border-radius: 8px;
}

.security-note .icon {
  width: 13px;
  height: 13px;
  margin-top: 1px;
  color: var(--primary);
  flex: 0 0 auto;
}

.security-note p {
  font-size: 9px;
  line-height: 1.6;
}

/* =========================================================
   Account management
   ========================================================= */
.account-stats {
  display: flex;
  align-items: center;
  min-height: 76px;
  padding: 14px 22px;
  margin-bottom: 17px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xs);
}

.account-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.account-stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  flex: 0 0 auto;
}

.account-stat-icon .icon {
  width: 17px;
  height: 17px;
}

.account-stat > div {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.account-stat > div span {
  font-size: 9.5px;
  color: var(--muted);
}

.account-stat > div strong {
  font-size: 17px;
  font-weight: 650;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.account-stat-divider {
  width: 1px;
  height: 27px;
  margin: 0 22px;
  background: var(--border);
}

.accounts-card {
  overflow: hidden;
}

.accounts-card-head {
  padding: 21px 23px 0;
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 16px 23px;
  flex-wrap: wrap;
}

.table-search {
  display: flex;
  align-items: center;
  width: 272px;
  height: 36px;
  padding: 0 11px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 9px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.table-search:focus-within {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.table-search .icon {
  width: 15px;
  height: 15px;
  color: var(--muted);
}

.table-search input {
  width: 100%;
  height: 100%;
  padding: 0 7px;
  font-size: 11.5px;
  background: transparent;
  border: 0;
  outline: 0;
}

.table-search input::placeholder {
  color: var(--muted);
}

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

.select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 36px;
  min-width: 112px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
}

.select-wrap > .icon:first-child {
  width: 14px;
  height: 14px;
  margin-left: 10px;
  color: var(--muted);
  pointer-events: none;
}

.select-wrap select {
  width: 100%;
  height: 100%;
  padding: 0 27px 0 10px;
  font-size: 11px;
  color: var(--text-secondary);
  background: transparent;
  border: 0;
  outline: 0;
  appearance: none;
  cursor: pointer;
}

.select-wrap .select-chevron {
  position: absolute;
  right: 8px;
  width: 13px;
  height: 13px;
  color: var(--muted);
  pointer-events: none;
}

.select-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: var(--ring);
}

.filter-reset {
  margin-left: 3px;
  font-weight: 500;
  color: var(--muted);
}

.filter-reset:hover {
  color: var(--text-secondary);
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 9px 23px;
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--primary-soft);
  border-top: 1px solid color-mix(in srgb, var(--primary) 12%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--primary) 12%, transparent);
}

.bulk-bar strong {
  color: var(--primary);
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 13px;
}

.bulk-actions .text-button {
  font-size: 10.5px;
  font-weight: 550;
}

.bulk-divider {
  width: 1px;
  height: 13px;
  background: color-mix(in srgb, var(--primary) 20%, transparent);
}

.bulk-close {
  margin-left: auto;
  color: var(--muted);
}

.table-wrap {
  position: relative;
  overflow-x: auto;
  border-top: 1px solid var(--border);
}

.data-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  height: 39px;
  padding: 0 14px;
  font-size: 9.5px;
  font-weight: 550;
  color: var(--muted);
  white-space: nowrap;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 23px;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 20px;
}

.data-table td {
  height: 65px;
  padding: 10px 14px;
  font-size: 11px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.16s ease;
}

.data-table tbody tr:hover {
  background: var(--surface-subtle);
}

.data-table tbody tr.is-selected {
  background: color-mix(in srgb, var(--primary-soft) 42%, var(--surface));
}

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

.checkbox-cell {
  width: 42px;
}

.accounts-table .account-cell {
  min-width: 205px;
}

.account-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.account-identity > div {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.account-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.account-name {
  overflow: hidden;
  max-width: 150px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.self-tag {
  padding: 1px 5px;
  font-size: 7.5px;
  font-weight: 500;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 3px;
}

.account-openid {
  overflow: hidden;
  max-width: 190px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 9.5px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-source-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 145px;
}

.data-table th .th-sub {
  display: block;
  margin-top: 1px;
  font-size: 8.5px;
  font-weight: 400;
  color: var(--muted);
  opacity: 0.85;
  letter-spacing: 0.02em;
}

.login-quota {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-variant-numeric: tabular-nums;
}

.login-quota .quota-set {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
}

.login-quota .quota-sep {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.7;
}

.login-quota .quota-live {
  font-size: 11px;
  color: var(--muted);
}

.login-quota.is-over .quota-live {
  font-weight: 600;
  color: #c2410c;
}

/* ---------- 设备管理 ---------- */
.device-account-select-wrap {
  min-width: 250px;
  max-width: 330px;
}

#video-table .actions-cell {
  width: 104px;
}

.device-account-select-wrap select {
  padding-right: 30px;
  font-size: 10.5px;
}

.device-code {
  overflow: hidden;
  display: inline-block;
  max-width: 210px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 9.5px;
  color: var(--muted);
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.device-expiry {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.35;
  white-space: nowrap;
}

.device-expiry-time {
  font-size: 10px;
  color: var(--text);
}

.device-expiry small {
  font-size: 9px;
  color: var(--muted);
}

.device-expiry.is-warning small {
  color: var(--warning);
}

.device-expiry.is-expired small {
  color: var(--danger);
  font-weight: 600;
}

.device-expiry.is-none {
  color: var(--muted);
  font-size: 10px;
}

.device-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.device-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  font-size: 9px;
  font-weight: 550;
  color: var(--muted);
  background: var(--surface-subtle);
  border-radius: 999px;
  white-space: nowrap;
}

.device-tag.is-main {
  color: var(--primary);
  background: var(--primary-soft);
}

.device-tag.is-current {
  color: var(--success);
  background: var(--success-soft);
}

.device-tag.is-removable {
  color: var(--warning, #b45309);
  background: var(--warning-soft, #fef3c7);
}

.device-tag.is-protected {
  color: var(--danger, #b42318);
  background: var(--danger-soft, #fee4e2);
}

.token-output {
  width: 100%;
  min-height: 132px;
  padding: 11px 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 9.5px;
  line-height: 1.65;
  color: var(--text-secondary);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  word-break: break-all;
}

.token-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 10px 0 0;
  font-size: 9.5px;
  color: var(--muted);
}

.token-meta strong {
  font-weight: 600;
  color: var(--text-secondary);
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
}

.device-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 16px;
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.device-detail-grid .kv {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.device-detail-grid .k {
  font-size: 9px;
  color: var(--muted);
}

.device-detail-grid .v {
  overflow: hidden;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 9.5px;
  color: var(--text-secondary);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .device-account-select-wrap {
    width: 100%;
    max-width: none;
  }

  .device-detail-grid {
    grid-template-columns: 1fr;
  }
}


.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  font-size: 9px;
  font-weight: 550;
  border-radius: 5px;
  white-space: nowrap;
}

.role-super {
  color: var(--violet);
  background: var(--violet-soft);
}

.role-admin {
  color: var(--primary);
  background: var(--primary-soft);
}

.role-operator {
  color: var(--success);
  background: var(--success-soft);
}

.role-guest {
  color: var(--muted);
  background: var(--surface-subtle);
}

.department-text,
.date-text {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.status-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  background: transparent;
  border: 0;
}

.status-track {
  position: relative;
  display: inline-block;
  width: 26px;
  height: 15px;
  background: var(--border-strong);
  border-radius: 999px;
  transition: background 0.2s ease;
}

.status-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.16);
  transition: transform 0.2s var(--ease);
}

.status-label {
  font-size: 9.5px;
  white-space: nowrap;
}

.status-toggle.is-active .status-track {
  background: var(--success);
}

.status-toggle.is-active .status-thumb {
  transform: translateX(11px);
}

.status-toggle.is-active .status-label {
  color: var(--success);
}

.status-toggle.is-pending .status-track {
  background: color-mix(in srgb, var(--warning) 40%, var(--border-strong));
}

.status-toggle.is-pending .status-label {
  color: var(--warning);
}

.status-toggle.is-inactive .status-label {
  color: var(--muted);
}

.status-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.actions-cell {
  width: 80px;
  text-align: right;
}

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

.row-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  transition: color 0.16s ease, background 0.16s ease;
}

.row-action-btn:hover {
  color: var(--text-secondary);
  background: var(--surface-hover);
}

.row-action-btn .icon {
  width: 15px;
  height: 15px;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 23px;
  border-top: 1px solid var(--border);
}

.table-summary {
  font-size: 10px;
  color: var(--muted);
}

.pagination {
  display: flex;
  align-items: center;
  gap: 3px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  font-size: 10px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.page-btn:hover:not(:disabled):not(.is-active) {
  background: var(--surface-subtle);
  border-color: var(--border);
}

.page-btn.is-active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.page-btn:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.page-btn .icon {
  width: 13px;
  height: 13px;
}

.page-ellipsis {
  min-width: 20px;
  font-size: 10px;
  text-align: center;
  color: var(--muted);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  color: var(--muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.empty-icon .icon {
  width: 20px;
  height: 20px;
}

.empty-state h3 {
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 600;
}

.empty-state p {
  margin-bottom: 14px;
  font-size: 10.5px;
  color: var(--muted);
}

/* =========================================================
   Modal
   ========================================================= */
body.modal-open {
  overflow: hidden;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 12, 24, 0.56);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(540px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.26s var(--ease);
}

.modal-panel.modal-lg {
  width: min(640px, 100%);
}

.modal-panel.modal-sm {
  width: min(420px, 100%);
}

.modal-layer.is-closing .modal-backdrop {
  animation: fadeOut 0.16s ease forwards;
}

.modal-layer.is-closing .modal-panel {
  animation: modalOut 0.17s ease forwards;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 23px 15px;
}

.modal-title-group {
  min-width: 0;
}

.modal-eyebrow {
  display: block;
  margin-bottom: 4px;
  font-size: 8.5px;
  font-weight: 650;
  letter-spacing: 0.14em;
  color: var(--primary);
}

.modal-header h2 {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.modal-header p {
  margin-top: 4px;
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--muted);
}

.modal-close {
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
}

.modal-body {
  padding: 5px 23px 23px;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 23px;
  background: var(--surface-subtle);
  border-top: 1px solid var(--border);
}

.modal-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin-top: 16px;
  font-size: 9.5px;
  line-height: 1.6;
  color: var(--muted);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.modal-note .icon {
  width: 14px;
  height: 14px;
  margin-top: 1px;
  color: var(--primary);
  flex: 0 0 auto;
}

.video-source-preview {
  padding: 12px 14px;
  margin-top: 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.video-source-preview .account-identity {
  align-items: center;
}

.video-source-reason {
  padding-top: 8px;
  margin: 8px 0 0;
  font-size: 9.5px;
  line-height: 1.6;
  color: var(--muted);
  border-top: 1px dashed var(--border);
}

#video-create-form > .field + .field {
  margin-top: 12px;
}

#video-create-form .select-wrap,
#video-status-form .select-wrap {
  display: flex;
  width: 100%;
  height: 43px;
}

#video-create-form .select-wrap select,
#video-status-form .select-wrap select {
  padding-left: 12px;
  font-size: 12px;
}

#video-status-form .field {
  margin-top: 12px;
}

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

.modal-form-grid .field-full {
  grid-column: 1 / -1;
}

.confirm-content {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 5px 0 3px;
}

.confirm-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 11px;
  flex: 0 0 auto;
}

.confirm-icon.warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.confirm-icon .icon {
  width: 20px;
  height: 20px;
}

.confirm-copy h3 {
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 600;
}

.confirm-copy p {
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}

.confirm-copy strong {
  font-weight: 600;
  color: var(--text-secondary);
}

/* Password modal */
.password-form {
  padding-top: 6px;
}

.strength-meter {
  display: flex;
  gap: 4px;
  margin-top: 7px;
}

.strength-meter span {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  transition: background 0.2s ease;
}

.strength-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 9px;
  color: var(--muted);
}

.strength-label strong {
  font-weight: 550;
  color: var(--muted);
}

.strength-meter[data-score="1"] span:nth-child(1) {
  background: var(--danger);
}

.strength-meter[data-score="2"] span:nth-child(-n + 2) {
  background: var(--warning);
}

.strength-meter[data-score="3"] span:nth-child(-n + 3) {
  background: var(--success);
}

.strength-meter[data-score="4"] span {
  background: var(--success);
}

/* Sessions modal */
.session-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-top: 7px;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.session-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 33px;
  height: 33px;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex: 0 0 auto;
}

.session-icon .icon {
  width: 16px;
  height: 16px;
}

.session-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.session-copy strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 550;
  color: var(--text-secondary);
}

.session-copy span {
  font-size: 9px;
  color: var(--muted);
}

.current-badge {
  padding: 1px 5px;
  font-size: 7.5px;
  font-weight: 500;
  color: var(--success);
  background: var(--success-soft);
  border-radius: 3px;
}

.session-revoke {
  margin-left: auto;
  font-size: 9.5px;
}

/* =========================================================
   Toast
   ========================================================= */
.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 130;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(344px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 11px;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toastIn 0.28s var(--ease);
}

.toast.is-leaving {
  animation: toastOut 0.2s ease forwards;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.warning {
  border-left-color: var(--warning);
}

.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 7px;
  flex: 0 0 auto;
}

.toast.success .toast-icon {
  color: var(--success);
  background: var(--success-soft);
}

.toast.error .toast-icon {
  color: var(--danger);
  background: var(--danger-soft);
}

.toast.warning .toast-icon {
  color: var(--warning);
  background: var(--warning-soft);
}

.toast-icon .icon {
  width: 14px;
  height: 14px;
}

.toast-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.toast-copy strong {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.toast-copy p {
  font-size: 10px;
  line-height: 1.55;
  color: var(--muted);
}

.toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 21px;
  height: 21px;
  margin-top: 1px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
}

.toast-close:hover {
  background: var(--surface-subtle);
}

.toast-close .icon {
  width: 12px;
  height: 12px;
}

/* =========================================================
   Row menu & misc
   ========================================================= */
.row-menu {
  position: fixed;
  z-index: 110;
  width: 186px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.14s var(--ease);
}

.row-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 9px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 7px;
  transition: background 0.15s ease, color 0.15s ease;
}

.row-menu-item:hover {
  color: var(--text);
  background: var(--surface-subtle);
}

.row-menu-item .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.row-menu-item.danger {
  color: var(--danger);
}

.row-menu-item.danger .icon {
  color: var(--danger);
}

.row-menu-item.danger:hover {
  background: var(--danger-soft);
}

.row-menu-item:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.row-menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--border);
}

.noscript-warning {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  font-size: 14px;
  color: #fff;
  text-align: center;
  background: #101728;
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1320px) {
  .global-search {
    width: 208px;
  }

  .preview-float-card {
    right: -12px;
  }

  .main-content {
    padding-right: 26px;
    padding-left: 26px;
  }
}

@media (max-width: 1180px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kpi-card {
    min-height: 150px;
  }

  .dashboard-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.85fr);
  }

  .security-card {
    padding-right: 18px;
    padding-left: 18px;
  }

  .score-ring {
    width: 112px;
    height: 112px;
  }

  .score-ring-inner strong {
    font-size: 27px;
  }

  .settings-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  }

  .profile-editor {
    padding-right: 20px;
    padding-left: 20px;
  }

  .account-stat-divider {
    margin: 0 14px;
  }
}

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

  .security-card {
    padding: 22px;
  }

  .score-wrap {
    flex-direction: row;
    justify-content: center;
    gap: 18px;
    padding: 15px 0;
  }

  .score-state {
    flex-direction: column;
    gap: 4px;
  }

  .security-card .security-list {
    max-width: 100%;
  }

  .recent-logins-card {
    padding-bottom: 9px;
  }

  .quick-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .quick-item {
    flex-direction: column;
    align-items: flex-start;
    padding: 13px;
    background: var(--surface-subtle);
    border: 1px solid var(--border);
  }

  .quick-copy {
    margin-top: 3px;
  }

  .quick-arrow {
    display: none;
  }

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

@media (max-width: 960px) {
  .sidebar {
    z-index: 80;
    box-shadow: 16px 0 50px rgba(5, 10, 22, 0.3);
    transform: translateX(-102%);
    transition: transform 0.3s var(--ease);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 75;
    display: block;
    background: rgba(7, 12, 24, 0.48);
    opacity: 0;
    visibility: hidden;
    backdrop-filter: blur(2px);
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  body.sidebar-open .sidebar-overlay {
    opacity: 1;
    visibility: visible;
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .app-main {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: inline-flex;
    margin-right: 2px;
  }

  .topbar {
    height: 68px;
  }

  .login-view {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .login-main {
    min-height: 100vh;
    background:
      radial-gradient(80% 60% at 50% 0%, rgba(91, 108, 255, 0.08), transparent 70%),
      #f8f9fd;
  }

  .login-topbar {
    justify-content: flex-end;
  }

  .auth-panel {
    padding: 24px 0;
  }

  .auth-mobile-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 38px;
    font-size: 16px;
    font-weight: 650;
    color: #172033;
  }

  .auth-mobile-brand .brand-symbol {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .auth-mobile-brand em {
    font-style: normal;
    font-weight: 400;
    color: #9099a9;
  }

  .login-footer {
    padding-top: 14px;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 0 18px;
  }

  .global-search {
    width: 188px;
    margin-right: 1px;
  }

  .global-search kbd {
    display: none;
  }

  .profile-trigger-copy {
    display: none;
  }

  .profile-trigger {
    padding: 3px;
  }

  .profile-chevron {
    display: none;
  }

  .topbar-divider {
    margin: 0 1px;
  }

  .main-content {
    padding: 22px 18px 36px;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
  }

  .page-actions {
    width: 100%;
  }

  .page-actions .btn {
    flex: 1;
  }

  .kpi-grid {
    gap: 12px;
  }

  .kpi-card {
    min-height: 146px;
    padding: 16px;
  }

  .kpi-top {
    margin-bottom: 12px;
  }

  .kpi-icon {
    width: 32px;
    height: 32px;
  }

  .delta-pill {
    font-size: 8px;
  }

  .kpi-value strong {
    font-size: 26px;
  }

  .kpi-spark {
    width: 86px;
    opacity: 0.25;
  }

  .chart-card,
  .security-card,
  .recent-logins-card,
  .quick-card {
    padding: 18px 17px 15px;
  }

  .chart-card .card-head {
    align-items: center;
  }

  .chart-summary-row {
    margin-top: 16px;
  }

  .chart-canvas {
    min-height: 190px;
  }

  .trend-badge small {
    display: none;
  }

  .quick-list {
    grid-template-columns: 1fr;
  }

  .quick-item {
    flex-direction: row;
    align-items: center;
    padding: 10px;
  }

  .quick-arrow {
    display: block;
  }

  .login-row {
    gap: 8px;
  }

  .login-device {
    display: none;
  }

  .login-time {
    width: auto;
    margin-left: auto;
    padding-left: 10px;
  }

  .settings-side {
    grid-template-columns: 1fr;
  }

  .profile-editor {
    padding: 19px 17px 20px;
  }

  .avatar-editor {
    align-items: flex-start;
    margin: 17px 0 20px;
    padding: 14px;
  }

  .avatar-editor .avatar-xl {
    width: 66px;
    height: 66px;
    font-size: 22px;
    border-radius: 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .form-actions {
    margin-top: 20px;
  }

  .account-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 8px;
    padding: 16px;
  }

  .account-stat-divider {
    display: none;
  }

  .accounts-card-head {
    padding: 18px 17px 0;
  }

  .table-toolbar {
    padding: 14px 17px;
  }

  .table-search {
    width: 100%;
  }

  .filter-group {
    width: 100%;
    flex-wrap: wrap;
  }

  .select-wrap {
    flex: 1;
    min-width: 100px;
  }

  .filter-reset {
    margin-left: 0;
    padding: 7px 0;
  }

  .bulk-bar {
    gap: 10px;
    padding-right: 14px;
    padding-left: 17px;
  }

  .bulk-actions {
    gap: 9px;
  }

  .data-table th:first-child,
  .data-table td:first-child {
    padding-left: 17px;
  }

  .table-footer {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 17px;
  }

  .pagination {
    width: 100%;
    justify-content: flex-end;
  }

  .notification-popover {
    position: fixed;
    top: 74px;
    right: 14px;
    left: 14px;
    width: auto;
  }

  .profile-popover {
    right: 0;
  }

  .modal-layer {
    align-items: flex-end;
    padding: 12px;
  }

  .modal-panel {
    max-height: calc(100vh - 24px);
    border-radius: 20px;
  }

  .modal-header {
    padding: 19px 18px 13px;
  }

  .modal-body {
    padding: 5px 18px 19px;
  }

  .modal-footer {
    padding: 13px 18px;
  }

  .modal-form-grid {
    grid-template-columns: 1fr;
  }

  .toast-region {
    right: 16px;
    bottom: 16px;
  }
}

@media (max-width: 520px) {
  .topbar-right {
    gap: 1px;
  }

  .global-search {
    display: none;
  }

  .icon-btn {
    width: 35px;
    height: 35px;
  }

  .theme-toggle {
    display: none;
  }

  .breadcrumb {
    font-size: 12.5px;
  }

  .kpi-grid {
    gap: 10px;
  }

  .kpi-card {
    min-height: 138px;
    padding: 14px;
  }

  .kpi-top {
    align-items: flex-start;
  }

  .delta-pill {
    display: none;
  }

  .kpi-value strong {
    font-size: 24px;
  }

  .kpi-value span {
    font-size: 8.5px;
  }

  .kpi-foot {
    max-width: 100px;
    font-size: 8.5px;
    line-height: 1.45;
  }

  .kpi-spark {
    display: none;
  }

  .chart-card .card-head {
    align-items: flex-start;
  }

  .chart-summary-row {
    flex-wrap: wrap;
    gap: 7px;
  }

  .chart-legend {
    margin-left: 0;
  }

  .page-subtitle {
    font-size: 11.5px;
  }

  .page-actions .btn span {
    font-size: 12px;
  }

  .score-wrap {
    flex-direction: column;
    gap: 9px;
    padding: 12px 0;
  }

  .score-state {
    flex-direction: row;
  }

  .avatar-editor {
    flex-direction: column;
  }

  .avatar-actions {
    flex-wrap: wrap;
  }

  .form-actions {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
  }

  .form-actions .btn {
    width: 100%;
  }

  .account-stat > div strong {
    font-size: 15px;
  }

  .account-stat-icon {
    width: 33px;
    height: 33px;
  }

  .account-stats {
    min-height: 0;
  }

  .bulk-bar > span {
    font-size: 10px;
  }

  .bulk-actions .text-button {
    font-size: 9.5px;
  }

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

  .login-topbar {
    font-size: 10.5px;
  }

  .auth-mobile-brand {
    margin-bottom: 30px;
  }

  .auth-panel {
    padding: 14px 0 20px;
  }

  .auth-panel h2 {
    font-size: 31px;
  }

  .auth-form {
    gap: 15px;
    margin-top: 25px;
  }

  .auth-input-wrap {
    height: 50px;
  }

  .demo-credentials {
    margin-top: 18px;
  }

  .login-footer {
    flex-direction: column;
    gap: 8px;
  }

  .login-footer > div {
    order: -1;
  }

  .notification-popover {
    top: 66px;
  }

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

@media (max-height: 720px) and (min-width: 961px) {
  .login-visual {
    padding-top: 26px;
    padding-bottom: 24px;
  }

  .login-visual-content {
    padding-top: 34px;
    padding-bottom: 24px;
  }

  .login-visual h1 {
    font-size: 43px;
  }

  .visual-description {
    margin-top: 16px;
  }

  .visual-preview {
    margin-top: 28px;
    padding: 17px 18px 13px;
  }

  .preview-chart {
    height: 88px;
    margin-top: 8px;
  }

  .login-visual-footer {
    padding-top: 16px;
  }

  .auth-panel {
    padding-top: 16px;
    padding-bottom: 12px;
  }
}

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

/* ---------- Keyframes ---------- */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes statusPulse {
  0% {
    opacity: 0.8;
    transform: scale(0.7);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  50% {
    transform: translateX(4px);
  }
  75% {
    transform: translateX(-2px);
  }
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(-5px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modalOut {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(9px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(12px);
  }
}

/* ---------- 工作台模块概况 ---------- */
.chart-legend i.is-accounts {
  background: #165dff;
}

.chart-legend i.is-video {
  background: #12b76a;
}

.chart-legend i.is-cards {
  background: #f79009;
}

.chart-line.series-accounts {
  stroke: #165dff;
  filter: drop-shadow(0 4px 8px rgba(22, 93, 255, 0.18));
}

.chart-line.series-video {
  stroke: #12b76a;
  filter: drop-shadow(0 4px 8px rgba(18, 183, 106, 0.18));
}

.chart-line.series-cards {
  stroke: #f79009;
  filter: drop-shadow(0 4px 8px rgba(247, 144, 9, 0.18));
}

.chart-dot.series-accounts {
  stroke: #165dff;
}

.chart-dot.series-video {
  stroke: #12b76a;
}

.chart-dot.series-cards {
  stroke: #f79009;
}

.chart-dot-halo.series-accounts {
  fill: #165dff;
}

.chart-dot-halo.series-video {
  fill: #12b76a;
}

.chart-dot-halo.series-cards {
  fill: #f79009;
}

.module-card {
  display: flex;
  flex-direction: column;
}

.module-list {
  display: flex;
  flex-direction: column;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.module-list li {
  border-bottom: 1px solid var(--border);
}

.module-list li:last-child {
  border-bottom: 0;
}

.module-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  color: inherit;
  text-decoration: none;
  border-radius: 7px;
  transition: background 0.15s ease;
}

.module-item:hover {
  background: var(--surface-subtle);
}

.module-item .security-item-copy {
  flex: 1;
  min-width: 0;
}

.module-value {
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.module-arrow {
  width: 13px;
  height: 13px;
  color: var(--muted);
  opacity: 0.65;
}

.card-inventory {
  display: flex;
  flex-direction: column;
}

.card-type-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.card-type-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.card-type-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 9.5px;
  color: var(--muted);
}

.card-type-head span:first-child {
  font-weight: 600;
  color: var(--text-secondary);
}

.card-type-track {
  overflow: hidden;
  display: flex;
  height: 7px;
  background: var(--surface-subtle);
  border-radius: 999px;
}

.card-type-used {
  height: 100%;
  background: var(--primary);
}

.card-type-unused {
  height: 100%;
  background: color-mix(in srgb, var(--primary) 22%, transparent);
}

.video-recent-row .login-device {
  width: 74px;
  font-variant-numeric: tabular-nums;
}

.video-recent-row .login-time {
  width: 118px;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .chart-summary-row {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .chart-legend {
    margin-left: 0;
  }

  .video-recent-row .login-time {
    display: none;
  }
}

.video-recent-row .login-device {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .video-recent-row .login-device {
    width: auto;
    font-size: 9px;
  }
}
