/* ============================================================
   theme.css — 归因快速配置 · 共享令牌与基础组件
   冷灰石墨底 / 发丝线 / 等宽数字 / 单一信号色
   ============================================================ */

:root {
  color-scheme: light;

  /* 表面：一条冷灰中性 ramp */
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --surface-3: #e9edf2;
  --line: rgba(16, 20, 28, 0.10);
  --line-2: rgba(16, 20, 28, 0.18);

  /* 文字三档 */
  --text: #111620;
  --text-2: #4a5261;
  --text-3: #78818f;
  --text-4: #9aa3b1;

  /* 墨黑主按钮 */
  --ink: #111620;
  --ink-hover: #1d2430;

  /* 唯一强调色：仪表青，只给焦点环与执行中 */
  --accent: #0e7490;
  --accent-soft: rgba(14, 116, 144, 0.13);

  /* 语义色只带含义 */
  --ok: #15803d;
  --fail: #b42318;
  --fail-soft: #fdf2f1;
  --skip: #8b95a5;

  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system,
    "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", ui-monospace, SFMono-Regular,
    Consolas, monospace;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --r-control: 8px;
  --r-card: 14px;
}

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

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

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

h1, h2, h3, p, ul, figure {
  margin: 0;
  padding: 0;
}

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

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

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

[v-cloak] {
  display: none;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease),
    color 0.16s var(--ease), box-shadow 0.16s var(--ease),
    transform 0.12s var(--ease);
}

.btn svg {
  flex: none;
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn:active {
  transform: scale(0.985);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.btn-primary:disabled,
.btn-primary[aria-disabled="true"] {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text-3);
  box-shadow: none;
  opacity: 1;
}

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

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

.btn-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--line-2);
}

.btn-quiet {
  padding: 0 8px;
  color: var(--text-3);
}

.btn-quiet:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-block {
  width: 100%;
  height: 40px;
}

/* ---------- 字段 ---------- */

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

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 8px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--text-2);
}

.field-key {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--text-4);
}

.req {
  color: var(--text-4);
  font-weight: 400;
}

.input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background-color: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease),
    box-shadow 0.16s var(--ease);
}

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

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

.input:focus {
  outline: none;
  border-color: var(--accent);
  background-color: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.input.input-mono {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.01em;
}

.input.is-invalid {
  border-color: var(--fail);
  background-color: var(--fail-soft);
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.75 4.75 6 8l3.25-3.25' fill='none' stroke='%2378818f' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.select:focus {
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.75 4.75 6 8l3.25-3.25' fill='none' stroke='%230e7490' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.hint {
  font-size: 11px;
  line-height: 16px;
  color: var(--text-3);
}

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

.card {
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 20, 28, 0.04);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--text);
}

.card-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}

.card-sub {
  font-size: 12px;
  line-height: 18px;
  color: var(--text-3);
}

/* ---------- 状态提示 ---------- */

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #151b24;
  color: #eef1f6;
  font-size: 13px;
  line-height: 18px;
  box-shadow: 0 8px 24px rgba(16, 20, 28, 0.22);
  animation: toast-in 0.24s var(--ease) both;
}

.toast-bad {
  background: #2a1310;
  color: #ffd7d1;
}

.progress {
  position: relative;
  height: 2px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 2px;
  background: var(--surface-2);
}

.progress::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 35%;
  background: var(--accent);
  animation: progress-slide 1.1s linear infinite;
}

@keyframes progress-slide {
  from { transform: translateX(-100%); }
  to   { transform: translateX(320%); }
}

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

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

@media (max-width: 640px) {
  .card {
    padding: 16px;
    border-radius: 12px;
  }

  .toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: none;
  }
}
