/**
 * Payfo 后台设计系统。
 *
 * 所有页面共用：字体、字号阶梯、控件状态、焦点环、骨架屏。
 * 页面只写结构，不再各写一套 text-[Npx]。
 */

:root {
  /* 字号阶梯：只用这 7 档 */
  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 20px;
  --fs-2xl: 26px;
  --fs-num: 24px;

  --font-ui: 'Inter', -apple-system, 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-num: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
}

body {
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 数据一律等宽 + 表格数字对齐，避免数字跳动 */
.num,
td.num,
.font-code-sm,
.font-code-md,
.font-metric-md,
.font-metric-lg {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* 覆盖零散像素字号，收敛到阶梯 */
.text-\[11px\] { font-size: var(--fs-2xs); }
.text-\[12px\] { font-size: var(--fs-xs); }
.text-\[13px\] { font-size: var(--fs-sm); }
.text-\[14px\] { font-size: var(--fs-md); }
.text-\[16px\] { font-size: var(--fs-lg); }
.text-\[18px\] { font-size: var(--fs-lg); }
.text-\[20px\] { font-size: var(--fs-xl); }
.text-\[22px\],
.text-\[24px\] { font-size: var(--fs-2xl); }

/* 表头：半粗 + 正字距，取代一味的全大写 */
thead th {
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #565e74;
}

h1, .font-headline-lg { letter-spacing: -0.018em; text-wrap: balance; }
h2, h3 { letter-spacing: -0.01em; }

/* 控件：统一过渡 + 按压反馈 */
button,
a[data-path],
select,
input[type='checkbox'] {
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    transform 0.12s ease, box-shadow 0.18s ease;
}

button:not(:disabled):active { transform: translateY(1px); }

button:disabled { opacity: 0.55; cursor: default; }

/* 键盘焦点环，鼠标点击不出现 */
:focus-visible {
  outline: 2px solid #b8450a;
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: #b8450a;
  box-shadow: 0 0 0 3px rgba(0, 40, 142, 0.12);
}

/* 表格行悬停 */
tbody tr { transition: background-color 0.12s ease; }
tbody tr:hover { background: #f4f7ff; }

/* 骨架屏 */
@keyframes pg-shimmer {
  0% { background-position: -320px 0; }
  100% { background-position: 320px 0; }
}

.skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, #eef2fa 25%, #e2e9f7 37%, #eef2fa 63%);
  background-size: 640px 100%;
  animation: pg-shimmer 1.3s linear infinite;
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 16px;
  color: #757684;
  font-size: var(--fs-sm);
}

.empty-state .material-symbols-outlined {
  font-size: 30px;
  opacity: 0.45;
}

/* 轻提示，取代 window.alert */
.pg-toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
}

.pg-toast {
  min-width: 220px;
  max-width: 360px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: var(--fs-sm);
  color: #fff;
  background: #1f2937;
  box-shadow: 0 8px 24px rgba(10, 22, 44, 0.24);
  animation: pg-toast-in 0.18s ease;
}

.pg-toast.ok { background: #17794a; }
.pg-toast.err { background: #a3312b; }

@keyframes pg-toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* 侧栏折叠 */
@media (max-width: 1024px) {
  aside.app-sidebar { transform: translateX(-100%); }
  aside.app-sidebar.is-open { transform: none; }
  .app-main { padding-left: 0 !important; }
  header.app-header { left: 0 !important; }
}

aside.app-sidebar { transition: transform 0.22s ease; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
