/* =========================================================================
   AuthCenter 基础样式：设计变量（浅色/深色）、重置、排版、工具类
   业务样式只引用这里定义的变量。
   ========================================================================= */

:root {
  color-scheme: light dark;

  /* 字体 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 18px;
  --fs-2xl: 22px;
  --lh: 1.55;

  /* 中性色：页面底 < 卡片 < 浮层 */
  --bg: #f7f7f8;
  --bg-subtle: #f1f1f3;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --surface-3: #f2f2f4;
  --overlay: #ffffff;
  --border: #e7e7ea;
  --border-strong: #d6d6db;
  --border-hover: #c4c4cb;
  --divider: #eeeef1;
  --text: #18181b;
  --text-2: #3f3f46;
  --text-3: #6f6f78;
  --text-4: #a1a1aa;
  --hover: rgba(24, 24, 27, 0.045);
  --press: rgba(24, 24, 27, 0.08);
  --row-hover: #fafafb;
  --scrollbar: rgba(24, 24, 27, 0.18);
  --scrollbar-hover: rgba(24, 24, 27, 0.32);

  /* 主色：只用在主按钮、链接、选中态和焦点上 */
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-press: #3730a3;
  --accent-soft: #eef0ff;
  --accent-soft-2: #e0e3ff;
  --accent-text: #4338ca;
  --on-accent: #ffffff;
  --ring: rgba(79, 70, 229, 0.22);

  /* 状态色：浅底 + 彩色文字 */
  --success: #16a34a;
  --success-text: #15803d;
  --success-soft: #ecfdf3;
  --success-border: #bbe5c9;
  --warning: #d97706;
  --warning-text: #a35c06;
  --warning-soft: #fff8eb;
  --warning-border: #f3d9a8;
  --danger: #dc2626;
  --danger-hover: #c81e1e;
  --danger-press: #a91a1a;
  --danger-text: #b91c1c;
  --danger-soft: #fef2f2;
  --danger-border: #f5c2c2;
  --danger-ring: rgba(220, 38, 38, 0.2);
  --info: #2563eb;
  --info-text: #1d4ed8;
  --info-soft: #eff5ff;
  --info-border: #c3d6fb;
  --neutral-soft: #f0f0f2;
  --neutral-text: #52525b;

  --switch-off: #d4d4d8;
  --flash: rgba(79, 70, 229, 0.1);
  --tooltip-bg: #1f1f23;
  --tooltip-fg: #f4f4f5;
  --backdrop: rgba(17, 17, 20, 0.36);
  --skeleton: #ededf0;
  --skeleton-shine: #f6f6f8;
  --chart-allow: #4f46e5;
  --chart-deny: #e5484d;
  --chart-grid: #ececef;

  /* 阴影只给浮层 */
  --pop-border: #e4e4e8;
  --shadow-pop: 0 12px 32px -10px rgba(16, 16, 22, 0.18), 0 4px 10px -4px rgba(16, 16, 22, 0.08);
  --shadow-sm: 0 1px 2px rgba(16, 16, 22, 0.06);

  /* 圆角与间距：小控件小圆角，卡片和弹窗稍大 */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;

  /* 控件尺寸 */
  --control-h: 34px;
  --control-h-sm: 28px;
  --control-h-lg: 42px;

  /* 动效：进入稍慢，退出更快 */
  --dur-1: 120ms;
  --dur-2: 180ms;
  --dur-3: 260ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.75, 0);
  --m: 1; /* 位移系数：减少动态效果时为 0，只保留淡入淡出 */

  /* 布局 */
  --sidebar-w: 232px;
  --rail-w: 60px;
  --topbar-h: 56px;
  --mobile-bar-h: 52px;
  --page-pad: 24px;

  --z-sticky: 5;
  --z-nav: 30;
  --z-menu: 70;
  --z-toast: 80;
  --z-tooltip: 90;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f11;
    --bg-subtle: #131316;
    --surface: #17171a;
    --surface-2: #1b1b1f;
    --surface-3: #222227;
    --overlay: #1f1f24;
    --border: #2a2a31;
    --border-strong: #37373f;
    --border-hover: #4a4a54;
    --divider: #232329;
    --text: #ececef;
    --text-2: #c9c9cf;
    --text-3: #92929c;
    --text-4: #61616b;
    --hover: rgba(255, 255, 255, 0.055);
    --press: rgba(255, 255, 255, 0.09);
    --row-hover: #1c1c21;
    --scrollbar: rgba(255, 255, 255, 0.16);
    --scrollbar-hover: rgba(255, 255, 255, 0.28);

    --accent: #5e59ee;
    --accent-hover: #6c67f5;
    --accent-press: #504ad8;
    --accent-soft: rgba(110, 104, 255, 0.14);
    --accent-soft-2: rgba(110, 104, 255, 0.24);
    --accent-text: #a5a8ff;
    --ring: rgba(124, 119, 255, 0.35);

    --success: #22c55e;
    --success-text: #4ade80;
    --success-soft: rgba(34, 197, 94, 0.12);
    --success-border: rgba(74, 222, 128, 0.25);
    --warning: #f59e0b;
    --warning-text: #fbbf24;
    --warning-soft: rgba(245, 158, 11, 0.12);
    --warning-border: rgba(251, 191, 36, 0.25);
    --danger: #e5484d;
    --danger-hover: #ec5d61;
    --danger-press: #d13a3f;
    --danger-text: #ff8589;
    --danger-soft: rgba(229, 72, 77, 0.13);
    --danger-border: rgba(255, 133, 137, 0.28);
    --danger-ring: rgba(229, 72, 77, 0.3);
    --info: #3b82f6;
    --info-text: #7ab0ff;
    --info-soft: rgba(59, 130, 246, 0.13);
    --info-border: rgba(122, 176, 255, 0.28);
    --neutral-soft: #26262c;
    --neutral-text: #b6b6bf;

    --switch-off: #3d3d46;
    --flash: rgba(124, 119, 255, 0.16);
    --tooltip-bg: #2e2e35;
    --tooltip-fg: #ececef;
    --backdrop: rgba(0, 0, 0, 0.58);
    --skeleton: #212126;
    --skeleton-shine: #2a2a30;
    --chart-allow: #7a75ff;
    --chart-deny: #f2555a;
    --chart-grid: #26262c;

    /* 深色下阴影几乎看不见，浮层改用细边框勾勒 */
    --pop-border: #34343c;
    --shadow-pop: 0 16px 40px -12px rgba(0, 0, 0, 0.65);
    --shadow-sm: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --m: 0;
  }
}

/* ------------------------------------------------------------------ reset */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

body {
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

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

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: inherit;
}

a {
  color: var(--accent-text);
  text-decoration: none;
  text-underline-offset: 2px;
}

@media (hover: hover) {
  a:hover {
    text-decoration: underline;
  }
}

h1,
h2,
h3,
h4 {
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

p,
h1,
h2,
h3,
h4,
li,
dd {
  overflow-wrap: break-word;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--accent-soft-2);
}

:focus {
  outline: none;
}

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

/* 滚动条：细、跟随主题 */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar);
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-hover);
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}

/* 覆盖 Chrome 自动填充的黄色/浅蓝底色 */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out 0s;
}

/* 数字框的上下箭头、搜索框自带的 × */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

/* ------------------------------------------------------------------ utilities */

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.93em;
  letter-spacing: 0;
}

.num {
  font-variant-numeric: tabular-nums;
}

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

.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-2 {
  color: var(--text-2);
}

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

.faint {
  color: var(--text-4);
}

.nowrap {
  white-space: nowrap;
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

.row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.text-sm {
  font-size: var(--fs-sm);
}

.text-xs {
  font-size: var(--fs-xs);
}

.fw-500 {
  font-weight: 500;
}

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

.success-text {
  color: var(--success-text);
}

.warning-text {
  color: var(--warning-text);
}

.skip-link {
  position: fixed;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--on-accent);
  transition: top var(--dur-2) var(--ease-out);
}

.skip-link:focus-visible {
  top: 12px;
}
