/* ============= 基础 ============= */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  color: #333;
  background: #f5f7fa;
  line-height: 1.5;
}
a { color: #2b8fd6; text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: "SF Mono", Consolas, monospace; background: #f0f0f0; padding: 1px 6px; border-radius: 3px; font-size: 12px; color: #d63384; }
hr { border: 0; border-top: 1px solid #e5e5e5; margin: 20px 0; }
.muted { color: #888; font-size: 12px; }
.empty { text-align: center; color: #999; padding: 30px !important; }
.danger { color: #d9534f; }
.text-warn { color: #e08a00; }
.form-row.row-error { background: #fff7f7; }
.form-row.row-error .label { color: #c9302c; }
button[disabled], .btn[disabled], .btn:disabled { opacity: .45; cursor: not-allowed; }

/* ============= 顶栏 ============= */
.topbar {
  background: linear-gradient(to bottom, #4ab6e8 0%, #3a9bd1 100%);
  color: #fff;
  height: 60px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.topbar-inner {
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  color: #fff;
  font-size: 22px;
  font-weight: bold;
  text-decoration: none;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-info { font-size: 13px; }
.btn-link { color: #fff; font-size: 13px; background: none; border: 0; cursor: pointer; padding: 0; }
.btn-link:hover { text-decoration: underline; }

/* ============= 布局 ============= */
.layout { display: flex; min-height: calc(100vh - 60px); }

/* ============= 侧边栏 ============= */
.sidebar {
  width: 200px;
  background: #fff;
  border-right: 1px solid #e5e5e5;
  padding: 15px 0;
}
.menu { list-style: none; padding: 0; margin: 0; }
.menu li { margin: 0; }
.menu li a, .menu-btn {
  display: block;
  padding: 10px 20px;
  color: #555;
  font-size: 13px;
  border-bottom: 1px dotted #e0e0e0;
  background: none;
  border-left: 3px solid transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.menu li a:hover, .menu-btn:hover { background: #f0f7fd; color: #2b8fd6; text-decoration: none; }
.menu li a.active {
  background: #e7f3fb;
  color: #2b8fd6;
  border-left-color: #4ab6e8;
  font-weight: bold;
}
.menu-group {
  padding: 15px 20px 5px !important;
  color: #888 !important;
  font-size: 12px !important;
  font-weight: bold;
  background: #fafafa;
  border-bottom: 1px solid #eee !important;
}

/* ============= 主区 ============= */
.main { flex: 1; padding: 15px 20px; }

/* ============= 面包屑 ============= */
.breadcrumb {
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 3px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #666;
}

/* ============= 卡片 ============= */
.card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 3px;
  margin-bottom: 15px;
  overflow: hidden;
}
.card-header {
  padding: 8px 15px;
  background: #f5f9fc;
  border-bottom: 1px solid #e5e5e5;
  color: #2b8fd6;
  font-size: 14px;
}
.card-body { padding: 20px; }
.card-footer {
  padding: 8px 15px;
  background: #fafafa;
  border-top: 1px solid #e5e5e5;
  color: #888;
  font-size: 12px;
  text-align: center;
}
.card-inner { background: #f9f9f9; padding: 15px; border-radius: 3px; margin-bottom: 15px; }

/* ============= 表格 ============= */
.info-table, .data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
}
.info-table td {
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  font-size: 13px;
}
.info-table .label {
  background: #f5f9fc;
  width: 18%;
  font-weight: bold;
  color: #555;
}
.data-table th {
  background: #f5f9fc;
  text-align: left;
  padding: 10px;
  border: 1px solid #e0e0e0;
  font-size: 13px;
  color: #555;
}
.data-table td {
  padding: 8px 10px;
  border: 1px solid #e0e0e0;
  font-size: 13px;
}
.data-table tr:hover { background: #fafafa; }

/* ============= 按钮 ============= */
.btn {
  display: inline-block;
  padding: 6px 14px;
  background: #f0f0f0;
  border: 1px solid #ccc;
  border-radius: 3px;
  color: #333;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn:hover { background: #e0e0e0; text-decoration: none; }
.btn-primary { background: #4ab6e8; border-color: #3a9bd1; color: #fff; }
.btn-primary:hover { background: #3a9bd1; color: #fff; }
.btn-block { display: block; width: 100%; padding: 10px; font-size: 14px; }

/* ============= 表单 ============= */
.form-vertical .form-row { margin-bottom: 12px; display: flex; align-items: flex-start; gap: 10px; }
.form-vertical .label {
  width: 110px;
  text-align: right;
  color: #555;
  font-size: 13px;
  padding-top: 6px;
  flex-shrink: 0;
}
.form-vertical input[type=text],
.form-vertical input[type=password],
.form-vertical input[type=number],
.form-vertical input[type=file],
.form-vertical select,
.form-vertical textarea {
  flex: 1;
  max-width: 500px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
  font-family: inherit;
}
.form-vertical textarea { resize: vertical; min-height: 60px; }
.form-vertical input:focus, .form-vertical select:focus, .form-vertical textarea:focus {
  border-color: #4ab6e8;
  outline: none;
  box-shadow: 0 0 0 2px rgba(74,182,232,0.2);
}
.form-vertical small { flex-basis: 100%; padding-left: 120px; }
.form-actions { padding-left: 110px; margin-top: 20px; }

.form-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-inline input, .form-inline select { padding: 6px 10px; border: 1px solid #ccc; border-radius: 3px; font-size: 13px; }

.filter-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 15px; }
.filter-bar input, .filter-bar select { padding: 6px 10px; border: 1px solid #ccc; border-radius: 3px; font-size: 13px; }
.filter-bar input { flex: 1; max-width: 300px; }

.upload-inline { display: flex; gap: 10px; align-items: center; flex: 1; }
.image-preview { margin-top: 8px; }

/* ============= Tag ============= */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
}
.tag-success { background: #d4edda; color: #155724; }
.tag-info { background: #d1ecf1; color: #0c5460; }
.tag-danger { background: #f8d7da; color: #721c24; }
.tag-default { background: #e2e3e5; color: #383d41; }

/* ============= Flash 提示 ============= */
.flash {
  padding: 10px 15px;
  border-radius: 3px;
  margin-bottom: 15px;
  font-size: 13px;
}
.flash-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.flash-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.flash-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ============= 分页 ============= */
.pagination { margin: 15px 0; text-align: center; }
.pagination a, .pagination .current {
  display: inline-block;
  padding: 5px 10px;
  margin: 0 2px;
  border: 1px solid #ddd;
  border-radius: 3px;
  font-size: 13px;
  color: #2b8fd6;
}
.pagination .current { background: #4ab6e8; color: #fff; border-color: #3a9bd1; }

/* ============= Logo 网格 ============= */
.logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 15px; }
.logo-item { border: 1px solid #e0e0e0; padding: 10px; text-align: center; background: #fafafa; border-radius: 3px; }
.logo-item img { max-width: 100%; max-height: 60px; }
.logo-item p { margin: 5px 0; font-size: 12px; }

/* ============= 模态 ============= */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 999; align-items: center; justify-content: center; }
.modal-content { background: #fff; padding: 25px; border-radius: 5px; min-width: 360px; }

/* 二维码大图弹窗 */
.qr-modal-content { min-width: 380px; max-width: 90vw; padding: 0; overflow: hidden; }
.qr-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px; background: #2b8fd6; color: #fff; font-size: 15px; }
.qr-modal-close { color: #fff; font-size: 22px; text-decoration: none; line-height: 1; padding: 0 4px; }
.qr-modal-close:hover { color: #ffeb3b; }
.qr-modal-body { padding: 20px; text-align: center; }
.qr-modal-body img { width: 260px; height: 260px; border: 1px solid #eee; padding: 6px; background: #fff; }
.qr-modal-info { margin-top: 14px; font-size: 13px; color: #555; line-height: 1.9; text-align: left; display: inline-block; min-width: 280px; }
.qr-modal-info code { background: #f5f5f5; padding: 1px 6px; border-radius: 3px; color: #d9534f; font-family: 'Consolas', monospace; }
.qr-modal-tip { margin-top: 8px; padding-top: 8px; border-top: 1px dashed #eee; color: #999; font-size: 12px; text-align: center; }

/* 表格里的二维码小图 */
.qr-thumb { display: inline-block; line-height: 0; cursor: pointer; }
.qr-thumb img { width: 36px; height: 36px; border: 1px solid #ddd; padding: 2px; background: #fff; transition: all .15s; }
.qr-thumb:hover img { border-color: #2b8fd6; box-shadow: 0 0 0 2px rgba(43,143,214,0.2); transform: scale(1.05); }
.link-add { color: #2b8fd6; text-decoration: none; font-size: 12px; }
.link-add:hover { text-decoration: underline; }

/* ============= 登录 ============= */
.auth-wrap { min-height: 100vh; background: linear-gradient(135deg, #4ab6e8, #2a7fb5); display: flex; align-items: center; justify-content: center; }
.auth-box { background: #fff; padding: 40px; border-radius: 5px; width: 360px; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
.auth-box h1 { margin: 0 0 5px; text-align: center; color: #2b8fd6; font-size: 24px; }
.auth-box .muted { text-align: center; margin-bottom: 20px; }
.auth-box label { display: block; margin-bottom: 15px; font-size: 13px; color: #555; }
.auth-box input { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 3px; font-size: 14px; margin-top: 5px; }
.auth-box .hint { text-align: center; margin-top: 15px; font-size: 12px; color: #999; }

/* ============= 错误页 ============= */
.error-page { text-align: center; padding: 100px 20px; }
.error-page h1 { font-size: 80px; color: #d9534f; margin: 0; }
.error-page p { color: #666; }

/* ============= 表单 - 虚线分隔版 ============= */
/* 参考站点风格：整行贯通虚线 / 标签左 110px / 输入框统一 360px / 占位提示靠右 */
.form-lined { padding: 0; margin: 0; background: #fff; }
.form-lined .form-row {
  display: flex;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px dashed #d8d8d8;
  gap: 16px;
  min-height: 52px;
}
.form-lined .form-row:first-child { border-top: 1px dashed #d8d8d8; }
.form-lined .form-row:last-child { border-bottom: 1px dashed #d8d8d8; }
.form-lined .form-row:focus-within { background: #fafcff; box-shadow: inset 3px 0 0 #4ab6e8; }
.form-lined .label {
  width: 110px;
  flex-shrink: 0;
  text-align: right;
  color: #555;
  font-size: 13px;
  font-weight: normal;
  line-height: 1.4;
}
.form-lined .label.required::after { content: ' *'; color: #d9534f; margin-left: 2px; }
/* 条件必填（进口商信息、含氯警示语…）：星号照显示，但不参与前端拦截，
   判定规则只有服务端 lib/fields.js 一份 */
.form-lined .label.required-when::after { content: ' *'; color: #d9534f; margin-left: 2px; opacity: .55; }

/* ============ 主题色选择（产品表单 · 扫码页主题色） ============ */
.theme-pick { flex: 1; }
.theme-swatches { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.theme-sw {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  padding: 0;
  border: 2px solid transparent;
  cursor: pointer;
}
.theme-sw.on { border-color: #333; box-shadow: 0 0 0 2px #fff inset; }
.theme-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.theme-line .theme-native { width: 40px; height: 32px; padding: 2px; cursor: pointer; }
.theme-line .theme-hex { width: 110px; font-family: Consolas, Menlo, monospace; }
.theme-preview { color: #fff; font-size: 12px; padding: 6px 10px; border-radius: 4px; }
.form-lined .label-stack {
  width: 110px;
  flex-shrink: 0;
  text-align: right;
  color: #555;
  font-size: 13px;
  padding-top: 8px;
  align-self: flex-start;
}
.form-lined .field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.form-lined input[type=text],
.form-lined input[type=password],
.form-lined input[type=number],
.form-lined input[type=url],
.form-lined input[type=email],
.form-lined select,
.form-lined textarea {
  width: 360px;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid #cfd6dd;
  border-radius: 2px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  height: 34px;
  box-sizing: border-box;
}
.form-lined input[type=text]:focus,
.form-lined input[type=number]:focus,
.form-lined input[type=url]:focus,
.form-lined select:focus,
.form-lined textarea:focus {
  border-color: #4ab6e8;
  outline: none;
  box-shadow: 0 0 0 2px rgba(74,182,232,0.15);
}
.form-lined textarea {
  height: auto;
  min-height: 80px;
  resize: vertical;
}
.form-lined input[type=file] {
  font-size: 13px;
  width: 360px;
  max-width: 100%;
}
.form-lined .hint {
  color: #999;
  font-size: 12px;
  flex-shrink: 0;
}
.form-lined .placeholder {
  color: #aaa;
  font-size: 12px;
  flex-shrink: 0;
  padding-left: 4px;
}
.form-lined .checkbox-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #555;
}
.form-lined .preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.form-lined .preview img {
  max-width: 200px;
  max-height: 200px;
  border: 1px solid #eee;
  background: #fafafa;
}
.form-lined .preview .logo-img {
  max-width: 160px;
  max-height: 80px;
  border: 1px solid #ddd;
  background: #f5f5f5;
  padding: 4px;
}
.form-lined .actions {
  padding: 18px 28px;
  background: #f7f9fb;
  border-top: 1px solid #e5e5e5;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ============= 表格 - 紧凑型 ============= */
.data-table.compact th,
.data-table.compact td { padding: 5px 8px; font-size: 12px; }
.data-table .row-actions { white-space: nowrap; }
.data-table .row-actions a { margin-right: 8px; }
.data-table .row-actions .btn-link { font-size: 12px; margin-right: 8px; }

/* ============= 进度条（导出任务） ============= */
.progress {
  height: 14px;
  background: #eef0f2;
  border-radius: 7px;
  overflow: hidden;
  border: 1px solid #e2e5e8;
}
.progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 7px 0 0 7px;
  background: linear-gradient(90deg, #4ab6e8, #2b8fd6);
  transition: width .4s ease;
}

/* ============= 「地址还是本机/内网」的警告 =============
 * 为什么写成这么重：码一印上包装就锁死了。site_public_url 没填时拼出来的是
 * http://127.0.0.1:3000/s/xxx —— 文件本身完全合法、看不出异常，印上去等于作废。
 * 这一条属于「看起来一切正常、代价却不可逆」的那类问题，所以视觉上必须显眼。
 * 用琥珀底 + 深红字（不跟主题色走，否则客户把主题色设成黄，警告就消失了）。 */
.warn-local {
  display: inline-block;
  background: #fff4e0;
  border: 1px solid #f0c37a;
  color: #8a4b00;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
}
.warn-local u { text-decoration-thickness: 2px; }
