* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f3f5f8;
  color: #1f2329;
  font-size: 14px;
}
button, input, select, textarea { font: inherit; }
[hidden] { display: none !important; }

.brand-dot {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #ffb400, #ff7a00);
  display: inline-block; flex: none;
}
.brand-dot.small { width: 22px; height: 22px; border-radius: 6px; }

/* 登录 */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 20% -10%, #ffe9bf 0%, transparent 55%),
              radial-gradient(900px 500px at 110% 10%, #dbe8ff 0%, transparent 50%), #f3f5f8;
  padding: 24px;
}
.login-card {
  width: 380px; background: #fff; border-radius: 14px; padding: 30px 30px 24px;
  box-shadow: 0 18px 50px rgba(20, 30, 50, 0.10);
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 24px; }
.brand h1 { font-size: 19px; margin: 0 0 3px; }
.brand p { margin: 0; font-size: 12px; color: #8a94a6; letter-spacing: 0.3px; }
.login-card label { display: block; margin-bottom: 14px; font-size: 13px; color: #4b5563; }
.login-card input {
  width: 100%; margin-top: 6px; height: 40px; padding: 0 12px;
  border: 1px solid #d8dee8; border-radius: 8px; outline: none; background: #fbfcfe;
}
.login-card input:focus { border-color: #ffb400; box-shadow: 0 0 0 3px rgba(255, 180, 0, 0.16); }

/* 顶栏 */
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid #e9edf3;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-info { color: #5b6472; font-size: 13px; }

.container { max-width: 1320px; margin: 0 auto; padding: 20px 24px 40px; }

/* 统计 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat {
  background: #fff; border: 1px solid #e9edf3; border-radius: 12px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 8px;
}
.stat-label { color: #7b8494; font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: 0.5px; }
.stat-value.ok { color: #16a34a; }
.stat-value.bad { color: #e5484d; }

/* 工具栏 */
.toolbar {
  background: #fff; border: 1px solid #e9edf3; border-radius: 12px;
  padding: 12px 14px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* 按钮 */
.btn {
  height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid #d8dee8;
  background: #fff; color: #303642; cursor: pointer; white-space: nowrap;
  transition: all 0.15s ease;
}
.btn:hover { border-color: #ffb400; color: #b26a00; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: #ffb400; border-color: #ffb400; color: #3a2a00; font-weight: 600; }
.btn-primary:hover { background: #ffa800; border-color: #ffa800; color: #3a2a00; }
.btn-ghost { border-color: transparent; background: transparent; color: #5b6472; }
.btn-ghost:hover { background: #f5f7fa; }
.btn-danger { color: #d92d20; }
.btn-danger:hover { border-color: #f04438; color: #d92d20; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; border-radius: 6px; }
.btn-block { width: 100%; height: 40px; margin-top: 4px; }

.input, .textarea, select.input {
  border: 1px solid #d8dee8; border-radius: 8px; background: #fff; outline: none;
  padding: 0 10px; height: 34px; min-width: 0;
}
.input:focus, .textarea:focus { border-color: #ffb400; box-shadow: 0 0 0 3px rgba(255, 180, 0, 0.14); }
.toolbar input[type='search'] { width: 220px; }
.select-sm { height: 28px; font-size: 13px; padding: 0 6px; max-width: 140px; }

/* 表格 */
.table-wrap {
  background: #fff; border: 1px solid #e9edf3; border-radius: 12px; overflow: auto;
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
.table th {
  background: #f8fafc; color: #6b7280; font-weight: 600; font-size: 12.5px;
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
.table tbody tr:hover { background: #fffdf5; }
.table tbody tr:last-child td { border-bottom: none; }
.store-name { font-weight: 600; color: #1f2329; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: #8b94a5; }
.nowrap { white-space: nowrap; }
.actions { display: flex; gap: 6px; align-items: center; }

/* 标签 */
.tag {
  display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12.5px;
  font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.tag.green { background: #e8f8ee; color: #14914b; }
.tag.red { background: #ffecec; color: #d92d20; }
.tag.gray { background: #f0f2f6; color: #7b8494; }

.empty { padding: 60px 20px; text-align: center; color: #98a1b2; }
.table-status { margin-top: 10px; color: #8b94a5; font-size: 12.5px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.42);
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 20px 20px; z-index: 50;
}
.modal {
  width: 640px; max-width: 100%; background: #fff; border-radius: 14px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28); overflow: hidden;
}
.modal-wide { width: 860px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid #eef1f5;
}
.modal-header h2 { font-size: 17px; margin: 0; }
.icon-btn {
  border: none; background: transparent; font-size: 22px; line-height: 1;
  color: #8b94a5; cursor: pointer; width: 30px; height: 30px; border-radius: 6px;
}
.icon-btn:hover { background: #f4f6f9; color: #303642; }
.modal-body { padding: 20px 22px; max-height: 66vh; overflow: auto; }
.modal-footer { padding: 14px 22px; border-top: 1px solid #eef1f5; display: flex; justify-content: flex-end; gap: 10px; }

.field-row { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.field-row.column { flex-direction: column; align-items: stretch; gap: 8px; }
.field-label { width: 96px; color: #4b5563; font-size: 13px; flex: none; }
.field-row.column .field-label { width: auto; }
.required { color: #e5484d; margin-right: 4px; }
.textarea {
  width: 100%; padding: 10px 12px; resize: vertical; min-height: 120px;
  line-height: 1.5; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px;
}
.hint { color: #8b94a5; font-size: 12.5px; margin: 0 0 10px; }
.form-error { color: #d92d20; font-size: 13px; min-height: 18px; margin-top: 8px; white-space: pre-wrap; }
.progress-text { color: #5b6472; font-size: 13px; margin-top: 10px; }

.agent-create { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.agent-create .input { flex: 1; min-width: 140px; }
.inner-table { border: 1px solid #eef1f5; border-radius: 10px; overflow: hidden; }
.inner-table th { position: static; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: #1f2329; color: #fff; padding: 10px 18px; border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.28); z-index: 90; font-size: 13.5px;
  opacity: 0; transition: opacity 0.18s ease;
}
.toast.show { opacity: 1; }
.toast.error { background: #c62828; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .toolbar input[type='search'] { width: 100%; }
  .table th, .table td { padding: 10px 10px; }
  .modal-mask { padding-top: 3vh; }
}
