/* ============================================================
   考拉智行 KoalaGo · 后台设计系统（HTML5 版）
   供 admin/public/*.html 共用；后续页面直接引用本文件即可保持视觉统一
   ============================================================ */

:root {
  /* 品牌色：主色青绿 #2F7A72 / 信任蓝 #2F7A72 / 定制暖橙 #FF8A3D
     注：青绿底上白字对比度约 2.5:1，承载白字的主色用信任蓝 */
  --brand: #2F7A72;
  --brand-deep: #1C5A54;
  --ink: #163D38;
  --ink-deep: #0F2E2A;
  --blue: #2F7A72;
  --blue-soft: #E4F5F2;
  --cyan: #4FA79D;
  --mint: #CCF1ED;
  --sun: #ffb27a;

  /* 中性色 */
  --bg: #f4f7fc;
  --surface: #ffffff;
  /* 次级底：表头、行 hover、搜索框、弹窗底栏等（随主题变，暗色下会反转） */
  --bg-soft: #fbfcfe;
  --text: #163D38;
  --text-2: #4C6B66;
  --text-3: #93A8A4;
  --line: rgba(22, 61, 56, 0.1);
  --line-strong: rgba(22, 61, 56, 0.18);

  /* 语义色 */
  --ok: #12b981;
  --warn: #f59e0b;
  --danger: #ef4444;

  /* 形状 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow-1: 0 1px 2px rgba(16, 24, 64, 0.05);
  --shadow-2: 0 4px 16px rgba(16, 24, 64, 0.08);
  --shadow-3: 0 18px 48px rgba(16, 24, 64, 0.14);

  --sidebar-w: 240px;
  --font: "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB",
    "Microsoft YaHei", system-ui, sans-serif;
}

/* ============================================================
   多主题（与后台《多主题 UI 规范》四套主题一致）
   html[data-theme] 由 shell.js 启动时按后端全局主题设置；
   未设置时沿用上方 :root（等价于 ocean），视觉零回归。
   ============================================================ */

/* 考拉智行蓝 · ocean（默认，跟随品牌主色） */
html[data-theme="ocean"] {
  --brand: #2F7A72;
  --brand-deep: #1C5A54;
  --ink: #163D38;
  --ink-deep: #0F2E2A;
  --blue: #2F7A72;
  --blue-soft: #E4F5F2;
  --cyan: #4FA79D;
  --mint: #CCF1ED;
  --sun: #ffb27a;
  --bg: #f4f7fc;
  --surface: #ffffff;
  --bg-soft: #fbfcfe;
  --text: #163D38;
  --text-2: #4C6B66;
  --text-3: #93A8A4;
  --line: rgba(22, 61, 56, 0.1);
  --line-strong: rgba(22, 61, 56, 0.18);
  --ok: #12b981;
  --warn: #f59e0b;
  --danger: #ef4444;
}

/* 高端奢华 · 墨绿金 emerald */
html[data-theme="emerald"] {
  --ink: #0b3b33;
  --ink-deep: #062721;
  --blue: #0e7c66;
  --blue-soft: #e7f4f0;
  --cyan: #c8a951;
  --mint: #CCF1ED;
  --sun: #c8a951;
  --bg: #f7f6f2;
  --surface: #ffffff;
  --bg-soft: #faf9f5;
  --text: #1f2937;
  --text-2: #57534e;
  --text-3: #a8a29e;
  --line: rgba(15, 60, 50, 0.12);
  --line-strong: rgba(15, 60, 50, 0.2);
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
}

/* 清新度假 · 洱海青 lagoon */
html[data-theme="lagoon"] {
  --ink: #0a3f3c;
  --ink-deep: #062a28;
  --blue: #0d9c93;
  --blue-soft: #E4F5F2;
  --cyan: #ff8a3d;
  --mint: #CCF1ED;
  --sun: #ff8a3d;
  --bg: #f4fbf9;
  --surface: #ffffff;
  --bg-soft: #f7fcfa;
  --text: #0f2e2a;
  --text-2: #47645f;
  --text-3: #8fa8a3;
  --line: rgba(13, 156, 147, 0.14);
  --line-strong: rgba(13, 156, 147, 0.22);
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #f43f5e;
}

/* 极简暗色 · 夜航 midnight */
html[data-theme="midnight"] {
  --ink: #0b1220;
  --ink-deep: #060b16;
  --blue: #38bdf8;
  --blue-soft: #0c2a3a;
  --cyan: #7dd3fc;
  --mint: #34d399;
  --sun: #fbbf24;
  --bg: #0f172a;
  --surface: #1e293b;
  --bg-soft: #243449;
  --text: #f1f5f9;
  --text-2: #c7d2e0;
  --text-3: #7b8ba3;
  --line: rgba(148, 163, 184, 0.22);
  --line-strong: rgba(148, 163, 184, 0.34);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.6;
}

button,
input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* 数字统一等宽，表格/统计里不会跳动 */
.num {
  font-variant-numeric: tabular-nums;
}

/* ---------- 布局：侧栏 + 主区 ---------- */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  padding: 22px 14px 16px;
  display: flex;
  flex-direction: column;
  color: #fff;
  background: linear-gradient(170deg, var(--ink) 0%, var(--ink-deep) 100%);
  overflow-y: auto;
}

/* 侧栏底纹：细网格，呼应「地图/线路」的产品属性，不抢内容 */
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
}
.sidebar > * {
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 20px;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #fff;
  flex-shrink: 0;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.2;
}

.brand-sub {
  font-size: 9px;
  letter-spacing: 2.6px;
  opacity: 0.62;
  font-weight: 500;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-label {
  font-size: 10px;
  letter-spacing: 1.6px;
  opacity: 0.45;
  padding: 16px 10px 6px;
  font-weight: 600;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  height: 42px;
  border-radius: var(--r-md);
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 13.5px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav a.active {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--cyan);
}

.nav a svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav a.muted {
  opacity: 0.38;
  pointer-events: none;
}

.side-foot {
  margin-top: auto;
  padding: 14px 10px 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.7;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.side-foot .logout {
  margin-top: 10px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  gap: 6px;
}

.side-foot .logout:hover {
  color: var(--sun);
}

/* ---------- 主区 ---------- */

.main {
  grid-column: 2;
  min-width: 0;
  padding: 26px 30px 130px;
}

/* 主区顶部光晕：让浅色页面有层次，不是一块死白 */
.main::before {
  content: "";
  position: fixed;
  top: -180px;
  right: -120px;
  width: 560px;
  height: 420px;
  background: radial-gradient(circle at 30% 30%, rgba(28, 90, 84, 0.13), transparent 62%),
    radial-gradient(circle at 70% 60%, rgba(18, 194, 224, 0.1), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.main > * {
  position: relative;
  z-index: 1;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-title {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.25;
}

.page-desc {
  color: var(--text-2);
  font-size: 13px;
  margin-top: 5px;
  max-width: 640px;
}

/* ---------- 统计卡 ---------- */

.stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stat {
  min-width: 108px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

.stat b {
  display: block;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.stat span {
  font-size: 11.5px;
  color: var(--text-2);
}

.stat.accent b {
  color: var(--blue);
}
.stat.mint b {
  color: #0f9f72;
}

/* ---------- 卡片 / 工具条 ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-1);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.search {
  position: relative;
  flex: 0 1 280px;
}

.search input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg-soft);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.search input:focus {
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(28, 90, 84, 0.13);
}

.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-3);
}

.spacer {
  flex: 1;
}

/* ---------- 按钮 ---------- */

.btn {
  height: 38px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
  transition: transform 0.14s ease, box-shadow 0.18s ease, background 0.18s ease,
    border-color 0.18s ease, opacity 0.18s ease;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(47, 122, 114, 0.28);
}

.btn.primary:hover {
  color: #fff;
  box-shadow: 0 6px 20px rgba(28, 90, 84, 0.36);
}

.btn.sm {
  height: 30px;
  padding: 0 11px;
  font-size: 12.5px;
  border-radius: 8px;
}

.btn svg {
  width: 15px;
  height: 15px;
}

/* ---------- 空 / 加载 / 错误态 ---------- */

.state {
  padding: 70px 20px;
  text-align: center;
  color: var(--text-2);
}

.state .title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.spinner {
  width: 26px;
  height: 26px;
  margin: 0 auto 14px;
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- 提示条 / Toast ---------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  line-height: 1.55;
  background: var(--blue-soft);
  color: #2b3a72;
  border: 1px solid rgba(28, 90, 84, 0.16);
}

.notice svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--blue);
}

#toasts {
  position: fixed;
  top: 22px;
  right: 26px;
  /* 必须高于 .login-mask(100) / .mask，否则登录失败提示被遮罩盖住，表现为「点登录没反应」 */
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.toast::before {
  content: "";
  width: 4px;
  height: 22px;
  border-radius: 3px;
  background: var(--blue);
  flex-shrink: 0;
}

.toast.ok::before {
  background: var(--ok);
}
.toast.warn::before {
  background: var(--warn);
}
.toast.err::before {
  background: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(24px) scale(0.97);
  }
}

/* ---------- 保存条 ---------- */

.savebar {
  position: fixed;
  left: calc(var(--sidebar-w) + 30px);
  right: 30px;
  bottom: 24px;
  z-index: 60;
  display: none;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-3);
  animation: bar-up 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

.savebar.show {
  display: flex;
}

.savebar .txt {
  font-size: 13px;
  color: var(--text-2);
}

.savebar .txt b {
  color: var(--text);
}

@keyframes bar-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

/* ---------- 登录覆盖层 ---------- */

.login-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--ink), var(--ink-deep));
}

/* display:flex 会盖掉 hidden 属性自带的 display:none，必须显式声明 */
.login-mask[hidden] {
  display: none;
}

.login-box {
  width: 340px;
  padding: 30px;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
}

.login-box h2 {
  font-size: 19px;
  margin-bottom: 4px;
}

.login-box p {
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 18px;
}

.field {
  margin-bottom: 12px;
}

.field input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  outline: none;
}

.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(28, 90, 84, 0.13);
}

.login-box .btn {
  width: 100%;
  justify-content: center;
  height: 42px;
  margin-top: 4px;
}

/* ---------- 载入动画 ---------- */

.rise {
  animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.3, 1) backwards;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* ============================================================
   通用组件：表格 / 弹窗 / 表单 / 标签
   ============================================================ */

.table-wrap {
  overflow-x: auto;
}

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tbl th {
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.6px;
  color: var(--text-2);
  padding: 11px 14px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}

.tbl td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.tbl tbody tr {
  transition: background 0.15s ease;
}

.tbl tbody tr:hover {
  background: var(--bg-soft);
}

.tbl tbody tr:last-child td {
  border-bottom: none;
}

.tbl .id {
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.tbl .strong {
  font-weight: 600;
  color: var(--text);
}

.tbl .dim {
  color: var(--text-2);
}

.tbl .nowrap {
  white-space: nowrap;
}

.row-actions {
  display: flex;
  gap: 4px;
}

.row-actions .btn {
  height: 27px;
  padding: 0 9px;
  font-size: 12px;
}

/* ---------- 状态标签 ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  height: 21px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: #eef1f8;
  color: var(--text-2);
  white-space: nowrap;
}

.badge.blue {
  background: var(--blue-soft);
  color: var(--blue);
}
.badge.ok {
  background: #e6f9f1;
  color: #0f9f72;
}
.badge.warn {
  background: #fef4e2;
  color: #b9760a;
}
.badge.ink {
  background: #e8ecf8;
  color: var(--ink);
}

/* ---------- 弹窗 ---------- */

.mask {
  position: fixed;
  inset: 0;
  z-index: 120;
  /* 这里不能用 backdrop-filter：它会让遮罩成为独立合成层，Chrome 把原生日期
     面板画到另一层上，弹窗里的 <input type="date"> 就变成「日历弹出来却点不中
     / 选不进框」。半透明底色已经够，不要再加毛玻璃。 */
  background: rgba(14, 27, 84, 0.42);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 20px;
  overflow-y: auto;
  animation: fade 0.2s ease;
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

.modal {
  width: 100%;
  max-width: 620px;
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-3);
  animation: rise 0.28s cubic-bezier(0.2, 0.8, 0.3, 1);
  overflow: hidden;
}

.modal.wide {
  max-width: 860px;
}

.modal-head {
  display: flex;
  align-items: center;
  padding: 17px 22px;
  border-bottom: 1px solid var(--line);
}

.modal-head h3 {
  font-size: 16px;
  font-weight: 700;
}

.modal-head .x {
  margin-left: auto;
  cursor: pointer;
  color: var(--text-3);
  font-size: 20px;
  line-height: 1;
  background: none;
  border: none;
}

.modal-head .x:hover {
  color: var(--text);
}

.modal-body {
  padding: 20px 22px;
  max-height: 66vh;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}

/* ---------- 表单 ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.f {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.f > label {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}

.f input,
.f select,
.f textarea {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--bg-soft);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.f textarea {
  height: auto;
  min-height: 76px;
  padding: 9px 12px;
  resize: vertical;
  line-height: 1.6;
}

.f input:focus,
.f select:focus,
.f textarea:focus {
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(28, 90, 84, 0.13);
}

.check {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
  cursor: pointer;
}

/* 多选 chip（省份 / 等级筛选等） */
.pick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pick button {
  height: 29px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.pick button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.pick button.on {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-weight: 500;
}

/* ---------- 其它 ---------- */

.section {
  padding: 18px 20px;
}

.section + .section {
  border-top: 1px solid var(--line);
}

.section h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 3px;
}

.section .desc {
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 14px;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}


.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
}

.tabs button {
  padding: 12px 14px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  transition: color 0.16s ease, border-color 0.16s ease;
}

.tabs button.on {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

.progress {
  height: 8px;
  border-radius: 999px;
  background: #eef1f8;
  overflow: hidden;
}

.progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--blue));
  transition: width 0.4s ease;
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .main {
    grid-column: 1;
    padding: 20px 16px 130px;
  }
  .savebar {
    left: 16px;
    right: 16px;
  }
}
