/* ==========================================================================
   打工人实用工具集 · 基础样式（设计系统）
   风格：简洁、专业、办公风，浅色为主
   ========================================================================== */

:root {
  /* 主色 */
  --wt-primary: #1f6feb;
  --wt-primary-hover: #1a5fd0;
  --wt-primary-soft: #eaf1fe;
  --wt-primary-border: #c3d8fb;

  /* 中性色 */
  --wt-bg: #f4f6f9;
  --wt-surface: #ffffff;
  --wt-surface-2: #fafbfc;
  --wt-border: #e2e6ed;
  --wt-border-strong: #cfd6e0;
  --wt-text: #1f2733;
  --wt-text-2: #4b5563;
  --wt-muted: #7c8798;
  --wt-disabled: #b8c0cc;

  /* 语义色 */
  --wt-danger: #d92d20;
  --wt-danger-soft: #fef3f2;
  --wt-success: #12805c;
  --wt-success-soft: #ecfdf3;
  --wt-warn: #b54708;
  --wt-warn-soft: #fffaeb;
  --wt-info-soft: #eff8ff;

  /* 阴影 / 圆角 */
  --wt-shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --wt-shadow: 0 2px 8px rgba(16, 24, 40, .07);
  --wt-shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --wt-radius-sm: 6px;
  --wt-radius: 10px;
  --wt-radius-lg: 14px;

  /* 尺寸 */
  --wt-header-h: 60px;
  --wt-maxw: 1440px;

  --wt-font: "Segoe UI", system-ui, -apple-system, "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --wt-mono: "Cascadia Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

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

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; line-height: 1.35; }
p { margin: 0; }
a { color: var(--wt-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶部导航 ---------- */
.wt-header {
  height: var(--wt-header-h);
  background: var(--wt-surface);
  border-bottom: 1px solid var(--wt-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--wt-shadow-sm);
}
.wt-header-inner {
  max-width: var(--wt-maxw);
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.wt-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--wt-text);
  white-space: nowrap;
}
.wt-logo:hover { text-decoration: none; }
.wt-logo-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #1f6feb, #4f9cf9);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
  flex: none;
}
.wt-header-sep { color: var(--wt-border-strong); }
.wt-header-sub { font-size: 14px; font-weight: 600; color: var(--wt-text-2); }
.wt-header-spacer { flex: 1; }
.wt-header-actions { display: flex; align-items: center; gap: 10px; }

/* ---------- 按钮 ---------- */
.wt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 500;
  color: var(--wt-text);
  background: var(--wt-surface);
  border: 1px solid var(--wt-border-strong);
  border-radius: var(--wt-radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  user-select: none;
}
.wt-btn:hover:not(:disabled) { background: var(--wt-surface-2); border-color: var(--wt-muted); }
.wt-btn:active:not(:disabled) { transform: translateY(1px); }
.wt-btn:disabled { opacity: .5; cursor: not-allowed; }
.wt-btn:focus-visible { outline: 2px solid var(--wt-primary); outline-offset: 1px; }

.wt-btn-primary {
  background: var(--wt-primary);
  border-color: var(--wt-primary);
  color: #fff;
}
.wt-btn-primary:hover:not(:disabled) { background: var(--wt-primary-hover); border-color: var(--wt-primary-hover); }

.wt-btn-danger { color: var(--wt-danger); border-color: #f2c5c1; background: #fff; }
.wt-btn-danger:hover:not(:disabled) { background: var(--wt-danger-soft); border-color: var(--wt-danger); }

.wt-btn-ghost { border-color: transparent; background: transparent; color: var(--wt-text-2); }
.wt-btn-ghost:hover:not(:disabled) { background: #eef1f5; border-color: transparent; color: var(--wt-text); }

.wt-btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.wt-btn-lg { height: 40px; padding: 0 20px; font-size: 14.5px; }
.wt-btn-block { width: 100%; }
.wt-btn-icon { width: 28px; height: 28px; padding: 0; font-size: 14px; line-height: 1; }

/* ---------- 表单 ---------- */
.wt-field { margin-bottom: 14px; }
.wt-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--wt-text-2);
  margin-bottom: 6px;
}
.wt-hint { font-size: 12px; color: var(--wt-muted); line-height: 1.5; }
.wt-input, .wt-select {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--wt-text);
  background: var(--wt-surface);
  border: 1px solid var(--wt-border-strong);
  border-radius: var(--wt-radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
.wt-input:focus, .wt-select:focus {
  outline: none;
  border-color: var(--wt-primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, .13);
}
.wt-input[type="number"] { -moz-appearance: textfield; }
.wt-input::-webkit-outer-spin-button,
.wt-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.wt-select { cursor: pointer; }

.wt-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
  color: var(--wt-text-2);
  cursor: pointer;
  line-height: 1.5;
}
.wt-check input[type="checkbox"] { margin: 3px 0 0; width: 15px; height: 15px; accent-color: var(--wt-primary); cursor: pointer; flex: none; }

/* 分段选择器 */
.wt-seg {
  display: inline-flex;
  padding: 2px;
  background: #eef1f5;
  border-radius: var(--wt-radius-sm);
  width: 100%;
}
.wt-seg button {
  flex: 1;
  height: 26px;
  padding: 0 8px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--wt-text-2);
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.wt-seg button:hover { color: var(--wt-text); }
.wt-seg button.active {
  background: var(--wt-surface);
  color: var(--wt-primary);
  font-weight: 600;
  box-shadow: var(--wt-shadow-sm);
}

/* 四位边距输入栅格 */
.wt-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wt-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

/* ---------- 卡片 ---------- */
.wt-card {
  background: var(--wt-surface);
  border: 1px solid var(--wt-border);
  border-radius: var(--wt-radius);
  box-shadow: var(--wt-shadow-sm);
}
.wt-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--wt-border);
  font-size: 13.5px;
  font-weight: 600;
}
.wt-card-head .wt-header-spacer { flex: 1; }
.wt-card-body { padding: 16px; }

/* ---------- 徽标 ---------- */
.wt-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 4px;
  background: #eef1f5;
  color: var(--wt-text-2);
  white-space: nowrap;
}
.wt-tag-primary { background: var(--wt-primary-soft); color: var(--wt-primary); }
.wt-tag-success { background: var(--wt-success-soft); color: var(--wt-success); }
.wt-tag-warn { background: var(--wt-warn-soft); color: var(--wt-warn); }
.wt-tag-danger { background: var(--wt-danger-soft); color: var(--wt-danger); }

/* ---------- Toast ---------- */
#wt-toast-root {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.wt-toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 220px;
  max-width: min(560px, 92vw);
  padding: 10px 14px;
  background: var(--wt-surface);
  border: 1px solid var(--wt-border);
  border-left: 3px solid var(--wt-primary);
  border-radius: var(--wt-radius-sm);
  box-shadow: var(--wt-shadow-lg);
  font-size: 13.5px;
  color: var(--wt-text);
  pointer-events: auto;
  animation: wt-toast-in .18s ease-out;
}
.wt-toast.leaving { animation: wt-toast-out .18s ease-in forwards; }
.wt-toast-icon { flex: none; font-size: 14px; line-height: 1.4; }
.wt-toast-body { flex: 1; word-break: break-word; }
.wt-toast-sub { font-size: 12px; color: var(--wt-muted); margin-top: 2px; }
.wt-toast-success { border-left-color: var(--wt-success); }
.wt-toast-success .wt-toast-icon { color: var(--wt-success); }
.wt-toast-error { border-left-color: var(--wt-danger); }
.wt-toast-error .wt-toast-icon { color: var(--wt-danger); }
.wt-toast-warn { border-left-color: var(--wt-warn); }
.wt-toast-warn .wt-toast-icon { color: var(--wt-warn); }
.wt-toast-info .wt-toast-icon { color: var(--wt-primary); }

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

/* ---------- 模态框 ---------- */
.wt-mask {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(16, 24, 40, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: wt-fade-in .15s ease-out;
}
@keyframes wt-fade-in { from { opacity: 0; } to { opacity: 1; } }
.wt-modal {
  width: 100%;
  max-width: 460px;
  background: var(--wt-surface);
  border-radius: var(--wt-radius-lg);
  box-shadow: var(--wt-shadow-lg);
  overflow: hidden;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.wt-modal-head {
  padding: 16px 20px 0;
  font-size: 15px;
  font-weight: 600;
}
.wt-modal-body { padding: 12px 20px 20px; overflow: auto; font-size: 13.5px; color: var(--wt-text-2); }
.wt-modal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--wt-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--wt-surface-2);
}

/* ---------- 进度条 ---------- */
.wt-progress {
  height: 6px;
  background: #eef1f5;
  border-radius: 999px;
  overflow: hidden;
}
.wt-progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--wt-primary);
  border-radius: 999px;
  transition: width .2s ease;
}
.wt-progress.is-indeterminate > i {
  width: 40%;
  animation: wt-indet 1.1s ease-in-out infinite;
}
@keyframes wt-indet {
  0% { margin-left: -40%; }
  100% { margin-left: 100%; }
}

/* ---------- 空状态 / 分隔 ---------- */
.wt-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--wt-muted);
  font-size: 13px;
}
.wt-empty-icon { font-size: 30px; opacity: .55; margin-bottom: 8px; }
.wt-divider { height: 1px; background: var(--wt-border); margin: 14px 0; }

/* ---------- 工具类 ---------- */
.wt-row { display: flex; align-items: center; gap: 8px; }
.wt-col { display: flex; flex-direction: column; gap: 8px; }
.wt-muted { color: var(--wt-muted); }
.wt-small { font-size: 12px; }
.wt-mono { font-family: var(--wt-mono); font-variant-numeric: tabular-nums; }
.wt-nowrap { white-space: nowrap; }
.wt-hidden { display: none !important; }
.wt-text-right { text-align: right; }
.wt-tabular { font-variant-numeric: tabular-nums; }

/* 滚动条（浅色、克制） */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccd3dd; border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #aab4c2; background-clip: content-box; }

/* ---------- 统一文件上传拖拽区 ---------- */
.wt-dd {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 26px 18px;
  text-align: center;
  background: var(--wt-surface-2);
  border: 1.5px dashed var(--wt-border-strong);
  border-radius: var(--wt-radius);
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.wt-dd:hover { border-color: var(--wt-primary-border); background: #f7faff; }
.wt-dd:focus-visible { outline: 2px solid var(--wt-primary); outline-offset: 2px; }
.wt-dd.is-over {
  border-color: var(--wt-primary);
  background: var(--wt-primary-soft);
  box-shadow: inset 0 0 0 3px rgba(31, 111, 235, .07);
}
.wt-dd-icon { font-size: 26px; line-height: 1; opacity: .75; }
.wt-dd-title { font-size: 14px; font-weight: 600; color: var(--wt-text); }
.wt-dd-title em { font-style: normal; color: var(--wt-primary); }
.wt-dd-sub { font-size: 12px; color: var(--wt-muted); }
.wt-dd.is-compact { padding: 14px 12px; }
.wt-dd.is-compact .wt-dd-icon { font-size: 18px; }
.wt-dd.is-compact .wt-dd-title { font-size: 13px; }

/* 旋转 loading */
.wt-spin {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid rgba(0, 0, 0, .18);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: wt-spin .7s linear infinite;
  vertical-align: -2px;
}
@keyframes wt-spin { to { transform: rotate(360deg); } }
