/* ===========================================================
   基础设计系统 —— 纸感中性色，一个主色，无阴影、无渐变
   =========================================================== */
:root {
  --paper: #FBFAF7;
  --surface: #FFFFFF;
  --surface-2: #F5F3ED;
  --ink: #1A1A1A;
  --ink-2: #57534E;
  --ink-3: #8C877E;
  --line: #E7E3DA;
  --line-2: #D6D1C4;
  --brand: #2F6DB5;
  --brand-ink: #1F4E85;
  --brand-soft: #EAF1FA;
  --accent: #C9502F;
  --accent-soft: #FBEDE8;
  --ok: #2F7D5E;
  --ok-soft: #E9F4EE;
  --warn: #A96A0B;
  --warn-soft: #FBF1DF;
  --err: #B4342C;
  --err-soft: #FBE9E7;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --f-sans: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --f-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --header-h: 64px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }

button, input, select, textarea, a { -webkit-tap-highlight-color: transparent; }
button:focus { outline: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
a:hover { color: var(--brand-ink); }

img, svg, video { max-width: 100%; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.35; letter-spacing: -0.01em; }
p { margin: 0; }

::selection { background: #D8E5F5; }

/* ---------- 布局容器 ---------- */
.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.stack-1 > * + * { margin-top: 8px; }
.stack-2 > * + * { margin-top: 16px; }
.stack-3 > * + * { margin-top: 24px; }
.stack-4 > * + * { margin-top: 40px; }

.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.spacer { flex: 1 1 auto; }

/* ---------- 文字 ---------- */
.eyebrow {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
}
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--f-mono); font-size: 13px; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

/* ---------- 图标 ---------- */
.ico {
  width: 18px; height: 18px;
  display: inline-block;
  flex: 0 0 auto;
  vertical-align: -3px;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 22px; height: 22px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { color: var(--err); border-color: #EBC9C5; background: var(--surface); }
.btn-danger:hover { background: var(--err-soft); border-color: var(--err); color: var(--err); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; height: 34px; padding: 0; }

/* ---------- 表单 ---------- */
.field { display: block; }
.field + .field { margin-top: 16px; }
.label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2357534E' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 109, 181, .12);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; line-height: 1.5; }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }

.filedrop {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface-2);
  padding: 13px 15px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.filedrop:hover { border-color: var(--brand); background: var(--brand-soft); }
.filedrop input[type=file] { display: none; }
.fd-btn {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  flex: 0 0 auto;
}
.fd-name {
  font-size: 13px;
  color: var(--ink-3);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fd-name.has { color: var(--ink); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.card-pad { padding: 20px; }

/* ---------- 提示条 ---------- */
.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: 14px;
  line-height: 1.6;
  border: 1px solid transparent;
}
.alert .ico { margin-top: 2px; }
.alert-ok { background: var(--ok-soft); color: #1D5C43; border-color: #CBE5D8; }
.alert-err { background: var(--err-soft); color: #8A2620; border-color: #F0CFCB; }
.alert-warn { background: var(--warn-soft); color: #7A4C06; border-color: #EFDDBB; }
.alert-info { background: var(--brand-soft); color: var(--brand-ink); border-color: #CFDFF1; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
}
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge-ok { background: var(--ok-soft); color: #1D5C43; }
.badge-warn { background: var(--warn-soft); color: #7A4C06; }
.badge-err { background: var(--err-soft); color: #8A2620; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .05em;
  color: var(--ink-3);
  text-transform: uppercase;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: none; }
.modal.open { display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(26, 26, 26, .42);
  opacity: 0;
  transition: opacity .18s;
}
.modal.open .modal-mask { opacity: 1; }
.modal-box {
  position: relative;
  margin: 0;
  width: min(520px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 18px 48px rgba(26, 26, 26, .14);
  transform: translateY(-6px);
  opacity: 0;
  transition: transform .18s cubic-bezier(.32,.72,0,1), opacity .18s;
}
.modal.open .modal-box { transform: translateY(0); opacity: 1; }
.modal.wide .modal-box { width: min(680px, 100%); }

.confirm-box { width: min(430px, 100%); }
.confirm-box .btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.confirm-box .btn-danger:hover { background: #9C2B24; border-color: #9C2B24; color: #fff; }
.confirm-body { display: flex; gap: 13px; padding: 20px 18px 18px; }
.confirm-ico { flex: 0 0 auto; margin-top: 1px; display: block; }
.confirm-ico svg { width: 22px; height: 22px; display: block; }
.confirm-text { min-width: 0; }
.confirm-text h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.confirm-text p { margin: 7px 0 0; font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }
.modal-box.confirm-box .modal-foot { background: transparent; border-top: 0; padding: 0 18px 18px; }
.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.modal-head h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.modal-head .sub { font-size: 12.5px; color: var(--ink-3); }
.modal-x {
  margin-left: auto;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0; background: transparent; border-radius: var(--r-sm);
  color: var(--ink-3); cursor: pointer;
}
.modal-x:hover { background: var(--surface-2); color: var(--ink); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  flex: 0 0 auto;
}
body.modal-open { overflow: hidden; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 640px) {
  .modal.open { align-items: flex-end; padding: 0; }
  .modal-box {
    width: 100%;
    max-height: 92vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: 0;
    transform: translateY(14px);
  }
  .modal.wide .modal-box { width: 100%; }
  .modal-foot .btn { flex: 1; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ---------- 空状态 ---------- */
.empty {
  padding: 56px 20px;
  text-align: center;
  color: var(--ink-3);
}
.empty .ico { width: 32px; height: 32px; margin-bottom: 12px; color: var(--line-2); }
.empty p { font-size: 14px; }

/* ---------- 工具类 ---------- */
.hr { height: 1px; background: var(--line); border: 0; margin: 0; }
.hide { display: none !important; }
.nw { white-space: nowrap; }
.danger-text { color: var(--err); }
.danger-text:hover { color: var(--err); background: var(--err-soft); }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 40px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  body { font-size: 15px; }
}
