/* ============================================================
   代理商价格审批系统 · 云端版 —— 共用样式
   浅色主题；移动端以 480px 竖屏为基准，管理端以桌面栅格为基准。
   ============================================================ */

:root {
  --c-bg: #f4f6fa;
  --c-surface: #ffffff;
  --c-surface-2: #f8fafc;
  --c-border: #e2e8f0;
  --c-border-strong: #cbd5e1;
  --c-text: #1e293b;
  --c-text-2: #64748b;
  --c-text-3: #94a3b8;
  --c-primary: #2563eb;
  --c-primary-d: #1d4ed8;
  --c-primary-l: #eff6ff;
  --c-ok: #16a34a;
  --c-ok-l: #f0fdf4;
  --c-warn: #d97706;
  --c-warn-l: #fffbeb;
  --c-danger: #dc2626;
  --c-danger-l: #fef2f2;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-2: 0 4px 16px rgba(15, 23, 42, .08);
  --shadow-3: 0 12px 32px rgba(15, 23, 42, .16);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5em; font-weight: 600; line-height: 1.35; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 .8em; }

code, pre, .mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: .88em;
}
code { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: 4px; padding: 1px 5px; }

/* ---------------- 通用布局 ---------------- */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.row { display: flex; gap: 10px; align-items: center; }
.row-wrap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }
.muted { color: var(--c-text-2); }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field > label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--c-text-2); margin-bottom: 6px;
}
.field .req { color: var(--c-danger); margin-left: 2px; }
.field .hint { font-size: 12px; color: var(--c-text-3); margin-top: 4px; }

input[type=text], input[type=password], input[type=tel], input[type=number],
input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; font-size: 15px; color: var(--c-text);
  background: var(--c-surface); border: 1px solid var(--c-border-strong);
  border-radius: var(--r-sm); font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
input[readonly], input[disabled], select[disabled], textarea[readonly], textarea[disabled] {
  background: var(--c-surface-2); color: var(--c-text-2); cursor: not-allowed;
}
textarea { min-height: 76px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; font-size: 15px; font-weight: 600; font-family: inherit;
  border: 1px solid var(--c-border-strong); border-radius: var(--r-sm);
  background: var(--c-surface); color: var(--c-text); cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--c-surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-d); border-color: var(--c-primary-d); }
.btn-danger { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }
.btn-danger:hover { filter: brightness(.94); }
.btn-ok { background: var(--c-ok); border-color: var(--c-ok); color: #fff; }
.btn-ok:hover { filter: brightness(.94); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-link {
  background: none; border: none; color: var(--c-primary);
  padding: 2px 4px; cursor: pointer; font-size: 13px; font-family: inherit;
}
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--c-danger); }

/* ---------------- 卡片 / 面板 ---------------- */
.card {
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-md); box-shadow: var(--shadow-1);
  padding: 16px; margin-bottom: 14px;
}
.card-tight { padding: 12px 14px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-h h3 { margin: 0; }

/* ---------------- 徽标 ---------------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.7;
  background: var(--c-surface-2); color: var(--c-text-2); border: 1px solid var(--c-border);
}
.badge-ok { background: var(--c-ok-l); color: #15803d; border-color: #bbf7d0; }
.badge-warn { background: var(--c-warn-l); color: #b45309; border-color: #fde68a; }
.badge-danger { background: var(--c-danger-l); color: #b91c1c; border-color: #fecaca; }
.badge-info { background: var(--c-primary-l); color: var(--c-primary-d); border-color: #bfdbfe; }

/* ---------------- 提示条 ---------------- */
.notice {
  border-radius: var(--r-sm); padding: 10px 12px; font-size: 13px;
  border: 1px solid var(--c-border); background: var(--c-surface-2); margin-bottom: 12px;
}
.notice-info { background: var(--c-primary-l); border-color: #bfdbfe; color: #1e40af; }
.notice-warn { background: var(--c-warn-l); border-color: #fde68a; color: #92400e; }
.notice-danger { background: var(--c-danger-l); border-color: #fecaca; color: #991b1b; }
.notice-ok { background: var(--c-ok-l); border-color: #bbf7d0; color: #166534; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--c-border); border-radius: var(--r-md); background: var(--c-surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th, table.tbl td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--c-border); vertical-align: top; }
table.tbl th { background: var(--c-surface-2); font-weight: 600; color: var(--c-text-2); white-space: nowrap; font-size: 12.5px; }
table.tbl tbody tr:hover { background: #fbfdff; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl td.ops { white-space: nowrap; }
table.tbl .empty { text-align: center; color: var(--c-text-3); padding: 28px 12px; }

/* ---------------- 定义列表 ---------------- */
.dl { display: grid; grid-template-columns: 112px 1fr; gap: 8px 12px; font-size: 14px; }
.dl dt { color: var(--c-text-2); font-weight: 500; }
.dl dd { margin: 0; word-break: break-word; }

/* ---------------- 弹窗 ---------------- */
.mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100;
}
.mask.hidden { display: none; }
.modal {
  background: var(--c-surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
}
.modal-h { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--c-border); }
.modal-h h3 { margin: 0; flex: 1; font-size: 16px; }
.modal-b { padding: 16px 18px; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--c-border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-x { background: none; border: none; font-size: 22px; line-height: 1; color: var(--c-text-3); cursor: pointer; padding: 0 4px; }
/* 营业执照预览：宽度撑满弹窗、允许内部滚动，避免长图把弹窗顶出去 */
.license-view { max-height: 62vh; overflow: auto; border: 1px solid var(--c-border); border-radius: var(--r-md); background: #fff; }
.license-view img { display: block; width: 100%; height: auto; }

/* ---------------- Toast ---------------- */
#toast {
  position: fixed; left: 50%; bottom: 76px; transform: translateX(-50%);
  background: rgba(15, 23, 42, .92); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: 14px; z-index: 200; max-width: 88vw;
  text-align: center; opacity: 0; pointer-events: none; transition: opacity .22s;
}
#toast.show { opacity: 1; }
#toast.err { background: rgba(185, 28, 28, .95); }

/* ---------------- 变更轨迹 ---------------- */
.track { list-style: none; margin: 0; padding: 0; }
.track li { position: relative; padding: 0 0 14px 18px; border-left: 2px solid var(--c-border); font-size: 13.5px; }
.track li:last-child { border-left-color: transparent; padding-bottom: 0; }
.track li::before {
  content: ''; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--c-surface); border: 2px solid var(--c-primary);
}
.track .t-time { color: var(--c-text-3); font-size: 12px; }
.track .t-body { margin-top: 2px; }
.track .t-old { color: var(--c-text-3); text-decoration: line-through; }
.track .t-new { color: var(--c-primary-d); font-weight: 600; }

/* ============================================================
   移动 H5 端
   ============================================================ */
.h5-page { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--c-bg); padding-bottom: 76px; }
.h5-top {
  position: sticky; top: 0; z-index: 20; background: var(--c-primary);
  color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-2);
}
.h5-top h1 { font-size: 17px; margin: 0; flex: 1; font-weight: 600; }
.h5-top .who { font-size: 12px; opacity: .88; }
.h5-top button {
  background: rgba(255, 255, 255, .16); border: none; color: #fff;
  border-radius: var(--r-sm); padding: 6px 10px; font-size: 13px; cursor: pointer; font-family: inherit;
}
.h5-body { padding: 14px; }

.h5-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--c-surface); border-top: 1px solid var(--c-border);
  max-width: 480px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom, 0);
}
.h5-nav button {
  flex: 1; background: none; border: none; padding: 8px 2px 9px; cursor: pointer;
  color: var(--c-text-3); font-size: 11px; font-family: inherit; line-height: 1.5;
}
.h5-nav button .ic { display: block; font-size: 19px; line-height: 1.2; }
.h5-nav button.on { color: var(--c-primary); font-weight: 600; }

.list-item {
  background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md);
  padding: 13px 14px; margin-bottom: 10px; box-shadow: var(--shadow-1); cursor: pointer;
  transition: box-shadow .15s, transform .1s;
}
.list-item:active { transform: scale(.995); }
.list-item .li-h { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.list-item .li-no { font-weight: 600; font-size: 14px; }
.list-item .li-model { font-size: 14px; margin-bottom: 4px; }
.list-item .li-meta { font-size: 12.5px; color: var(--c-text-2); display: flex; flex-wrap: wrap; gap: 4px 12px; }

.seg { display: flex; gap: 6px; margin-bottom: 12px; }
.seg button {
  flex: 1; padding: 7px 4px; font-size: 13px; border: 1px solid var(--c-border-strong);
  background: var(--c-surface); border-radius: var(--r-sm); cursor: pointer;
  font-family: inherit; color: var(--c-text-2);
}
.seg button.on { background: var(--c-primary); border-color: var(--c-primary); color: #fff; font-weight: 600; }

.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px 0; font-size: 13px; color: var(--c-text-2); }

.big-link {
  display: block; background: var(--c-primary); color: #fff !important; text-align: center;
  padding: 13px; border-radius: var(--r-md); font-weight: 600; margin-bottom: 10px;
}
.big-link.alt { background: #0f766e; }
.big-link.ghost { background: var(--c-surface); color: var(--c-primary) !important; border: 1px solid var(--c-primary); }

/* ============================================================
   管理端
   ============================================================ */
.adm-shell { display: flex; min-height: 100vh; }
.adm-side {
  width: 208px; flex: 0 0 208px; background: #0f172a; color: #cbd5e1;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.adm-brand { padding: 18px 16px; border-bottom: 1px solid #1e293b; }
.adm-brand b { color: #fff; font-size: 15px; display: block; }
.adm-brand span { font-size: 11.5px; color: #64748b; }
.adm-menu { padding: 10px 8px; overflow-y: auto; flex: 1; }
.adm-menu button {
  display: block; width: 100%; text-align: left; padding: 9px 12px; margin-bottom: 2px;
  background: none; border: none; color: #cbd5e1; font-size: 14px; font-family: inherit;
  border-radius: var(--r-sm); cursor: pointer;
}
.adm-menu button:hover { background: #1e293b; color: #fff; }
.adm-menu button.on { background: var(--c-primary); color: #fff; font-weight: 600; }
.adm-menu .grp { font-size: 11px; color: #475569; padding: 12px 12px 4px; letter-spacing: .04em; }
.adm-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.adm-top {
  background: var(--c-surface); border-bottom: 1px solid var(--c-border);
  padding: 12px 20px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 10;
}
.adm-top h2 { margin: 0; font-size: 17px; flex: 1; }
.adm-content { padding: 18px 20px 40px; flex: 1; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 14px 16px; }
.kpi .k { font-size: 12.5px; color: var(--c-text-2); margin-bottom: 4px; }
.kpi .v { font-size: 24px; font-weight: 700; line-height: 1.2; }
.kpi .v.ok { color: var(--c-ok); }
.kpi .v.warn { color: var(--c-warn); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input, .toolbar select { width: auto; min-width: 130px; padding: 7px 10px; font-size: 13.5px; }
.toolbar .grow { flex: 1 1 180px; min-width: 180px; }

.pwd-box { position: relative; }
.pwd-box input { padding-right: 42px; }
.pwd-box .tog {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px 6px; color: var(--c-text-3);
}

/* 登录页 */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #eff6ff 0%, #f4f6fa 45%, #eef2f7 100%); padding: 20px;
}
.login-card { width: 100%; max-width: 380px; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); box-shadow: var(--shadow-2); padding: 26px 24px; }
.login-card .logo { text-align: center; margin-bottom: 18px; }
.login-card .logo .m { font-size: 34px; }
.login-card .logo h1 { font-size: 19px; margin: 8px 0 2px; }
.login-card .logo p { font-size: 12.5px; color: var(--c-text-3); margin: 0; }

@media (max-width: 760px) {
  .adm-shell { flex-direction: column; }
  .adm-side { width: 100%; flex: none; height: auto; position: static; }
  .adm-menu { display: flex; overflow-x: auto; padding: 6px; }
  .adm-menu .grp { display: none; }
  .adm-menu button { white-space: nowrap; margin: 0 4px 0 0; }
  .adm-content { padding: 14px; }
  .dl { grid-template-columns: 96px 1fr; }
}
