/* ===== EasyTrace 基础样式（蓝紫渐变卡片风） ===== */
:root {
  --primary: #4f46e5;
  --primary-2: #7c3aed;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --bg: #f4f5fb;
  --card: #ffffff;
  --text: #1f2333;
  --muted: #8a8fa3;
  --line: #e6e8f2;
  --warn: #d97706;
  --danger: #dc2626;
  --ok: #16a34a;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(79, 70, 229, .10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---- 顶栏 ---- */
.topbar {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 2px 10px rgba(79, 70, 229, .25);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.logo { font-size: 22px; font-weight: 800; letter-spacing: .5px; }
.tagline { font-size: 13px; color: rgba(255, 255, 255, .82); }
.status-box { display: flex; align-items: center; gap: 10px; }
.status-text { font-size: 14px; padding: 5px 12px; border-radius: 999px; background: rgba(255,255,255,.16); }
.status-text.ok { background: rgba(34,197,94,.28); }
.status-text.warn { background: rgba(251,191,36,.3); color: #fff; }

/* ---- 布局 ---- */
.container {
  max-width: 1180px;
  margin: 24px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 24px;
  align-items: start;
}
.container-narrow { grid-template-columns: 1fr; max-width: 760px; }

/* ---- 卡片 ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card-title { margin: 0 0 18px; font-size: 18px; font-weight: 700; }

/* ---- 类别按钮 ---- */
.cat-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.cat-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  font-size: 14px; color: var(--text); transition: all .15s;
}
.cat-btn:hover { border-color: var(--primary); }
.cat-btn.active { background: var(--grad); color: #fff; border-color: transparent; }
.cat-icon { font-size: 16px; }
.cat-name { font-weight: 600; }

/* ---- 表单 ---- */
.form-fields { display: flex; flex-direction: column; gap: 16px; }
.fixed-fields, .dynamic-fields { display: flex; flex-direction: column; gap: 14px; }
.form-item { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 14px; font-weight: 600; color: var(--text); }
.req { color: var(--danger); }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.input, textarea.input, select.input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; background: #fff; color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.input-file { font-size: 14px; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--grad); color: #fff; border-color: transparent; }
.btn-primary:hover { color: #fff; filter: brightness(1.05); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; padding: 12px; margin-top: 4px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---- 资产列表 ---- */
.asset-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px; border: 1px solid var(--line); border-radius: 12px;
  margin-bottom: 12px; background: #fff; transition: box-shadow .15s;
}
.asset-item:hover { box-shadow: var(--shadow); }
.asset-icon { font-size: 26px; flex-shrink: 0; }
.asset-main { flex: 1; min-width: 0; }
.asset-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.asset-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.pill {
  background: var(--grad); color: #fff; font-size: 12px;
  padding: 2px 10px; border-radius: 999px; font-weight: 600;
}
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.asset-time { font-size: 12px; }
.asset-actions { display: flex; gap: 8px; flex-shrink: 0; }
.empty { color: var(--muted); text-align: center; padding: 30px 10px; }
.muted { color: var(--muted); }

/* ---- 详情页（扫码） ---- */
.detail-head { display: flex; gap: 16px; align-items: center; margin-bottom: 20px; }
.detail-icon { font-size: 40px; }
.sub-title { font-size: 16px; font-weight: 700; margin: 24px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.kv-list { display: flex; flex-direction: column; gap: 8px; }
.kv { display: flex; justify-content: space-between; gap: 20px; padding: 8px 12px; background: #fafbff; border-radius: 8px; }
.kv-label { color: var(--muted); font-size: 14px; }
.kv-value { font-size: 14px; font-weight: 600; text-align: right; word-break: break-all; }
.attach-list { display: flex; flex-direction: column; gap: 8px; }
.attach-link { color: var(--primary); text-decoration: none; font-size: 14px; }
.attach-link:hover { text-decoration: underline; }

/* ---- 模态框 ---- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 18, 40, .55);
  display: none; align-items: center; justify-content: center; z-index: 100;
  padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; padding: 26px;
  width: 100%; max-width: 420px; position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close {
  position: absolute; top: 12px; right: 14px; border: none; background: none;
  font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted);
}
.modal-close:hover { color: var(--text); }
.modal-title { margin: 0 0 12px; font-size: 18px; font-weight: 700; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; }

/* 登录/注册面板（最高层级，强制使用） */
#authModal { z-index: 200; }
#authModal .modal { max-width: 400px; }
.auth-error { min-height: 18px; font-size: 13px; color: #dc2626; margin: 2px 0 8px; }
.auth-switch { margin-top: 10px; }
.auth-switch .btn-ghost { color: var(--primary); }

/* 二维码模态 */
.qr-body { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.qr-body img { width: 240px; height: 240px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.qr-info .qr-title { font-size: 16px; font-weight: 700; }
.qr-info .qr-code { font-family: ui-monospace, monospace; color: var(--primary); font-weight: 700; margin: 3px 0; }
.qr-info .qr-cat { color: var(--muted); font-size: 13px; }

/* 付费墙 */
.paywall-badge {
  display: inline-block; background: #fef3c7; color: #b45309;
  font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; margin-bottom: 10px;
}
.paywall-text { font-size: 14px; color: var(--text); margin: 0 0 12px; }
.trial-info { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.trial-row { margin: 2px 0; }
.paywall-hint { font-size: 12px; color: var(--muted); text-align: center; margin: 12px 0 0; }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%) translateY(20px);
  background: #1f2333; color: #fff; padding: 12px 22px; border-radius: 10px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 200;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }

/* ---- 底部注脚 ---- */
.footer {
  text-align: center; color: var(--muted); font-size: 13px;
  padding: 30px 16px 34px;
}

/* 打印区域默认隐藏（屏幕） */
#printArea { display: none; }

/* ---- 响应式：窄屏单栏 ---- */
@media (max-width: 860px) {
  .container { grid-template-columns: 1fr; }
  .status-box .status-text { font-size: 12px; }
  .asset-item { flex-wrap: wrap; }
  .asset-actions { width: 100%; justify-content: flex-end; }
}

/* ---- 打印专用 ---- */
@media print {
  body { background: #fff; }
  .topbar, .footer, .modal-mask, .toast, #detailSection, .status-box, #scanPrintBtn {
    display: none !important;
  }
  .container, .container-narrow { max-width: none; margin: 0; padding: 0; border: none; }
  #printArea { display: block !important; }
  .print-head { text-align: center; font-family: inherit; }
  .print-head h2 {
    font-size: 30px; margin: 6px 0; font-weight: 800;
    text-transform: uppercase; letter-spacing: 1px;
  }
  .print-meta { color: #444; font-size: 16px; margin: 6px 0 18px; }
  .print-meta span { margin: 0 8px; }
  #printQr { width: 220px; height: 220px; }
}