/* ============================================================
   涂料出海 · 业务工作台  设计系统
   深蓝 #0B2C5B / 橙 #E8542F / 背景 #F5F7FA
   ============================================================ */

:root {
  --navy: #0B2C5B;
  --navy-2: #123C74;
  --navy-3: #1B4C8C;
  --orange: #E8542F;
  --orange-soft: #FFF1EC;
  --bg: #F5F7FA;
  --card: #FFFFFF;
  --line: #E3E8EF;
  --text: #1A2233;
  --muted: #6B778C;
  --green: #1E7B4F;
  --green-soft: #E8F5EE;
  --red: #C0392B;
  --red-soft: #FDECEA;
  --amber: #B7791F;
  --amber-soft: #FDF6E3;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --tab-h: 58px;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Hiragino Sans GB", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
a { color: var(--navy-3); text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- 启动页 ---------- */
.boot {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; color: var(--muted);
}
.boot-logo {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--navy); color: #fff;
  display: grid; place-items: center;
  font-size: 26px; font-weight: 800;
}

/* ---------- 顶部栏 ---------- */
.topbar {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  padding: 14px 16px calc(14px + env(safe-area-inset-top, 0px));
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  position: sticky; top: 0; z-index: 30;
}
.topbar-inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
}
.brand {
  display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(255,255,255,.14);
  display: grid; place-items: center;
  font-weight: 800; font-size: 18px; letter-spacing: .5px;
  flex: 0 0 auto;
}
.brand-text { min-width: 0; }
.brand-title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 11px; opacity: .72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; opacity: .9; flex: 0 0 auto;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--orange); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}

/* ---------- 全局上下文条 ---------- */
.ctxbar {
  background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.ctxbar-inner {
  max-width: 1080px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; overflow-x: auto; scrollbar-width: none;
}
.ctxbar-inner::-webkit-scrollbar { display: none; }
.ctx-group { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.ctx-label { font-size: 11px; color: var(--muted); }
.seg {
  display: inline-flex; border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; background: #fff;
}
.seg button {
  border: 0; background: transparent; color: var(--muted);
  padding: 4px 10px; font-size: 12px; white-space: nowrap;
}
.seg button.on { background: var(--navy); color: #fff; }
.ctx-fx { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.ctx-fx input {
  width: 74px; padding: 4px 6px; border: 1px solid var(--line);
  border-radius: 8px; text-align: right;
}

/* ---------- 主内容 ---------- */
.main {
  max-width: 1080px; margin: 0 auto;
  padding: 16px 16px calc(var(--tab-h) + 24px + env(safe-area-inset-bottom, 0px));
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px;
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.card-title { font-size: 14px; font-weight: 700; color: var(--navy); flex: 1; }
.card-sub { font-size: 11px; color: var(--muted); }

/* ---------- 四句话 ---------- */
.speech {
  border-left: 4px solid var(--orange);
  background: #FFFBF9; border-radius: 0 10px 10px 0;
  padding: 12px 14px; margin-bottom: 10px;
  font-size: 13.5px; line-height: 1.75;
}
.speech:last-child { margin-bottom: 0; }
.speech b { color: var(--navy); }

/* ---------- 漏斗 ---------- */
.funnel { display: grid; gap: 8px; }
.funnel-row {
  display: grid; grid-template-columns: 1fr 80px 78px;
  align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 10px;
  background: #F8FAFC; border: 1px solid transparent;
  cursor: pointer; transition: .15s;
}
.funnel-row:hover { border-color: var(--navy-3); background: #F1F6FD; }
.funnel-row:active { transform: scale(.995); }
.funnel-name { font-size: 13px; font-weight: 600; }
.funnel-bar {
  height: 6px; border-radius: 3px; background: #E6EBF2; margin-top: 5px;
  overflow: hidden;
}
.funnel-bar > i { display: block; height: 100%; background: var(--navy-3); border-radius: 3px; }
.funnel-num { text-align: right; font-size: 18px; font-weight: 800; color: var(--navy); }
.funnel-rate { text-align: right; font-size: 12px; color: var(--muted); }
.funnel-rate.bad { color: var(--red); font-weight: 700; }

/* ---------- 卡点排行 ---------- */
.blocker-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
}
.blocker-row:hover { background: #F8FAFC; }
.blocker-name { flex: 1; font-size: 13px; }
.blocker-count { font-weight: 700; color: var(--navy); }
.blocker-bar {
  width: 70px; height: 6px; background: #EDF1F6; border-radius: 3px; overflow: hidden;
}
.blocker-bar > i { display: block; height: 100%; background: var(--orange); }

/* ---------- 宫格入口 ---------- */
.menu-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 640px) { .menu-grid { grid-template-columns: repeat(4, 1fr); } }
.menu-item {
  background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 6px;
  text-align: left; transition: .15s; box-shadow: var(--shadow);
}
.menu-item:hover { border-color: var(--navy-3); transform: translateY(-1px); }
.menu-item.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.menu-item.active .menu-desc { color: rgba(255,255,255,.7); }
.menu-icon { font-size: 20px; }
.menu-title { font-size: 13px; font-weight: 700; }
.menu-desc { font-size: 11px; color: var(--muted); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--navy-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn-orange { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn-orange:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--navy-3); }
.btn-danger { color: var(--red); border-color: #F3C6C0; background: var(--red-soft); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ---------- 表单 ---------- */
.form { display: grid; gap: 12px; }
.field { display: grid; gap: 5px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field .hint { font-size: 11px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--navy-3);
  box-shadow: 0 0 0 3px rgba(27, 76, 140, .12);
}
.textarea { min-height: 76px; resize: vertical; }
.row2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }

/* ---------- 标签 ---------- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; line-height: 1.6;
  background: #EEF2F7; color: var(--muted); white-space: nowrap;
}
.badge.a { background: var(--orange-soft); color: var(--orange); }
.badge.b { background: var(--amber-soft); color: var(--amber); }
.badge.c { background: #EEF2F7; color: var(--muted); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.navy { background: #E8EEF7; color: var(--navy); }

/* ---------- 列表 ---------- */
.list { display: grid; gap: 8px; }
.list-item {
  background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px;
  display: flex; gap: 12px; align-items: flex-start;
  transition: .15s;
}
.list-item:hover { border-color: var(--navy-3); }
.list-item.overdue { border-left: 3px solid var(--red); }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.li-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.li-meta { font-size: 11px; color: var(--muted); margin-top: 6px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 表格（桌面） ---------- */
.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; background: #fff; }
table.data th {
  background: #F7F9FC; color: var(--muted); font-weight: 600;
  text-align: left; padding: 9px 10px; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
table.data td { padding: 9px 10px; border-bottom: 1px solid #F1F4F8; vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover { background: #F8FAFC; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty-icon { font-size: 34px; margin-bottom: 8px; opacity: .5; }
.empty p { font-size: 13px; margin-bottom: 12px; }

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255,255,255,.96);
  backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.tabbar button {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 4px 9px; font-size: 10.5px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabbar button .ti { font-size: 18px; line-height: 1; }
.tabbar button.on { color: var(--navy); font-weight: 700; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(11, 44, 91, .38);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0;
}
@media (min-width: 640px) { .modal-mask { align-items: center; padding: 24px; } }
.modal {
  background: #fff; width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto;
  border-radius: 16px 16px 0 0;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom, 0px));
  animation: slideUp .18s ease-out;
}
@media (min-width: 640px) { .modal { border-radius: 16px; } }
@keyframes slideUp { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 15px; font-weight: 800; color: var(--navy); margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + 18px);
  z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  background: rgba(26, 34, 51, .94); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 13px;
  max-width: 86vw; animation: fadeIn .18s ease-out;
}
.toast.error { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* ---------- 提示条 ---------- */
.alert {
  border-radius: 10px; padding: 10px 12px; font-size: 12.5px;
  display: flex; gap: 8px; align-items: flex-start; line-height: 1.6;
}
.alert.red { background: var(--red-soft); color: var(--red); }
.alert.green { background: var(--green-soft); color: var(--green); }
.alert.amber { background: var(--amber-soft); color: var(--amber); }
.alert.navy { background: #EEF3FA; color: var(--navy); }

/* ---------- 登录 / 引导 ---------- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px 18px;
  background: linear-gradient(160deg, var(--navy) 0%, #071B39 100%);
}
.auth-card {
  width: 100%; max-width: 400px; background: #fff;
  border-radius: 18px; padding: 26px 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .28);
}
.auth-logo {
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--navy); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 22px;
  margin-bottom: 14px;
}
.auth-title { font-size: 19px; font-weight: 800; color: var(--navy); margin-bottom: 4px; }
.auth-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 20px; }
.auth-switch { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 16px; }
.auth-switch button { background: none; border: 0; color: var(--navy-3); font-weight: 700; padding: 2px 4px; }

/* ---------- 工具类 ---------- */
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.bold { font-weight: 700; }
.navy { color: var(--navy); }
.orange { color: var(--orange); }
.red { color: var(--red); }
.green { color: var(--green); }
.nowrap { white-space: nowrap; }
.scroll-x { overflow-x: auto; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  padding: 5px 11px; border-radius: 999px; font-size: 12px; white-space: nowrap;
}
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.section-title { font-size: 13px; font-weight: 800; color: var(--navy); margin: 4px 0 10px; }

@media (max-width: 640px) {
  .card { padding: 13px; }
  .funnel-row { grid-template-columns: 1fr 62px 64px; }
  .funnel-num { font-size: 16px; }
  .hide-mobile { display: none !important; }
}
