/* 凯云外贸助手 · 「港口航线」主题
   深海墨蓝做导航，云白做工作区，太阳金做主要操作，印章红只用于提醒和审批。 */
:root {
  --ink: #0B2A4A; --ink-2: #12395F; --ink-3: #1C4A78;
  --sea: #1F6FD1; --gold: #F2A516; --gold-d: #C98400; --gold-l: #FFF3D6;
  --seal: #D7263D; --seal-l: #FDE7EA; --ok: #1E8E5A; --ok-l: #E3F5EC;
  --bg: #EEF2F7; --card: #FFFFFF; --line: #D9E1EC; --line-2: #E8EDF4;
  --text: #13233A; --muted: #5B6B8C; --faint: #8A97B0;
  --r-s: 6px; --r: 10px; --r-l: 16px;
  --shadow: 0 1px 2px rgba(11,42,74,.06), 0 4px 16px rgba(11,42,74,.06);
  --font: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1626; --card: #10223A; --line: #23395A; --line-2: #1A2E4A; --text: #E6EDF7; --muted: #9AABC6; --faint: #6F82A3;
    --gold-l: #3A2D0C; --seal-l: #3B1219; --ok-l: #0F3326; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1626; --card: #10223A; --line: #23395A; --line-2: #1A2E4A; --text: #E6EDF7; --muted: #9AABC6; --faint: #6F82A3;
  --gold-l: #3A2D0C; --seal-l: #3B1219; --ok-l: #0F3326; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.55 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
a { color: var(--sea); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 800; letter-spacing: .2px; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 8px; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; } .nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; } .row.end { justify-content: flex-end; } .row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; } .stack > * + * { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
@media (max-width: 900px) { .grid3, .grid4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 560px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- 外壳 */
.shell { display: grid; grid-template-columns: 236px minmax(0,1fr); min-height: 100vh; }
.side { background: var(--ink); color: #C9D6EA; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; }
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.brand b { font-size: 16px; display: block; letter-spacing: 1px; } .brand span { font-size: 11px; color: #8FA6C8; }
.nav-group { padding: 10px 10px 4px; }
.nav-group > div { font-size: 12px; color: #7F97BB; padding: 0 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #C9D6EA; font-weight: 500; position: relative; }
.nav a:hover { background: var(--ink-2); text-decoration: none; color: #fff; }
.nav a.on { background: var(--ink-3); color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--gold); }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding: 14px 18px; font-size: 12px; color: #8FA6C8; border-top: 1px solid var(--ink-2); }
.side-foot .plan { display: flex; justify-content: space-between; align-items: center; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 10px; padding: 12px 24px; border-bottom: 1px solid var(--line-2); }
.top h1 { font-size: 18px; } .top .grow { display: flex; align-items: center; gap: 10px; min-width: 0; }
.content { padding: 20px 24px 96px; max-width: 1280px; width: 100%; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot { position: absolute; top: -4px; right: -4px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--ink-3); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; position: relative; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.avatar .on { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: #2BC17A; border: 2px solid var(--card); }
.tabbar { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .side.open { display: flex; position: fixed; inset: 0 25% 0 0; z-index: 60; height: 100%; box-shadow: 0 0 0 100vmax rgba(5,15,30,.45); }
  .top { padding: 10px 16px; } .content { padding: 16px 16px 96px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card);
    border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; font-size: 11px; color: var(--muted); position: relative; }
  .tabbar a.on { color: var(--ink-3); font-weight: 700; } .tabbar a:hover { text-decoration: none; }
  .tabbar svg { width: 22px; height: 22px; } .tabbar .badge { position: absolute; top: 2px; left: 55%; }
  .hide-m { display: none !important; }
}
@media (min-width: 901px) { .show-m { display: none !important; } }

/* ---------------------------------------------------------------- 组件 */
.card { background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-l); padding: 18px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; } .card.tight { padding: 12px; }
.card > header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
@media (max-width: 560px) { .card { overflow-x: auto; } .card > header .btn { margin-left: auto; } } .card > header h2 { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn.primary { background: var(--gold); border-color: var(--gold); color: #1B1300; }
.btn.primary:hover { background: #F7B532; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: var(--seal); border-color: color-mix(in srgb, var(--seal) 40%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--seal); color: #fff; font-size: 11px; font-weight: 700; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.tag.gold { background: var(--gold-l); color: var(--gold-d); } .tag.red { background: var(--seal-l); color: var(--seal); } .tag.ok { background: var(--ok-l); color: var(--ok); }
.tag.blue { background: color-mix(in srgb, var(--sea) 14%, transparent); color: var(--sea); }
/* 审批印章：报价单「待审批 / 已批准」 */
.stamp { display: inline-block; padding: 2px 8px; border: 2px solid currentColor; border-radius: 4px; transform: rotate(-4deg); font-weight: 800; letter-spacing: 1px; color: var(--seal); font-size: 12px; }
.stamp.ok { color: var(--ok); }

label.f { display: block; } label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
input, select, textarea { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); font: inherit; }
textarea { height: auto; min-height: 84px; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sea); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sea) 20%, transparent); }
input[type=checkbox], input[type=radio] { width: auto; height: auto; accent-color: var(--ink-3); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.search { position: relative; } .search input { padding-left: 34px; } .search svg { position: absolute; left: 10px; top: 10px; width: 18px; height: 18px; color: var(--faint); }

table.t { width: 100%; border-collapse: collapse; }
.t th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.t tr.click { cursor: pointer; } .t tr.click:hover td { background: color-mix(in srgb, var(--gold) 6%, transparent); }
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
@media (max-width: 700px) { .t.cards thead { display: none; } .t.cards tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
  .t.cards td { display: flex; justify-content: space-between; border: 0; padding: 3px 0; } .t.cards td::before { content: attr(data-l); color: var(--muted); font-size: 12px; } }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 12px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text); border-bottom-color: var(--gold); }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi b { font-size: 26px; font-weight: 800; letter-spacing: -.5px; } .kpi span { color: var(--muted); font-size: 13px; }
.kpi.alert b { color: var(--seal); }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.bar { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--gold); border-radius: 4px; }
.list > * + * { border-top: 1px solid var(--line-2); }
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; }

/* ---------------------------------------------------------------- 航线：订单进度（签名元素）
   中国港口（印章红）→ 7 个节点 → 非洲港口（太阳金），集装箱船停在当前节点 */
.route { position: relative; padding: 26px 8px 8px; }
.route .line { position: absolute; left: 22px; right: 22px; top: 44px; height: 4px; background: repeating-linear-gradient(90deg, var(--line) 0 10px, transparent 10px 16px); border-radius: 2px; }
.route .done { position: absolute; left: 22px; top: 44px; height: 4px; background: var(--ink-3); border-radius: 2px; transition: width .6s ease; }
.route ol { position: relative; display: flex; justify-content: space-between; list-style: none; margin: 0; padding: 0; }
.route li { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 0; flex: 1; text-align: center; font-size: 12px; color: var(--muted); }
.route li i { width: 14px; height: 14px; border-radius: 50%; background: var(--card); border: 3px solid var(--line); margin-top: 11px; }
.route li.ok i { border-color: var(--ink-3); background: var(--ink-3); } .route li.now { color: var(--text); font-weight: 700; }
.route li.now i { border-color: var(--gold); background: var(--gold); box-shadow: 0 0 0 5px var(--gold-l); }
.route li:first-child i { border-radius: 3px; border-color: var(--seal); } .route li:last-child i { border-color: var(--gold-d); }
.route .ship { position: absolute; top: 4px; width: 30px; height: 22px; transform: translateX(-50%); transition: left .6s ease; color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .route .done, .route .ship { transition: none; } }
@media (max-width: 560px) { .route li span { display: none; } .route li.now span { display: block; position: absolute; top: 72px; white-space: nowrap; } .route { padding-bottom: 28px; } }

/* ---------------------------------------------------------------- 弹窗、提示 */
.modal-back { position: fixed; inset: 0; z-index: 80; background: rgba(5,15,30,.5); display: grid; place-items: center; padding: 16px; animation: fade .15s ease; }
.modal { background: var(--card); border-radius: var(--r-l); width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.wide { width: min(920px, 100%); }
.modal > header { display: flex; align-items: center; gap: 8px; padding: 16px 18px; border-bottom: 1px solid var(--line-2); } .modal > header h2 { flex: 1; }
.modal > .body { padding: 18px; overflow-y: auto; } .modal > footer { padding: 12px 18px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 560px) { .modal-back { place-items: end stretch; padding: 0; } .modal { border-radius: var(--r-l) var(--r-l) 0 0; max-height: 92vh; } }
.toasts { position: fixed; z-index: 90; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); animation: up .2s ease; display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.toast.err { background: var(--seal); } .toast b { display: block; } .toast small { opacity: .8; }
@media (max-width: 900px) { .toasts { bottom: 76px; right: 12px; left: 12px; max-width: none; } }
@keyframes fade { from { opacity: 0; } } @keyframes up { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
.pop { position: absolute; z-index: 50; right: 0; top: 46px; width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 12px 40px rgba(11,42,74,.18); }
.pop .list-item { padding: 10px 14px; cursor: pointer; } .pop .list-item.unread { background: var(--gold-l); }

/* ---------------------------------------------------------------- 登录 / 注册 */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 1fr); }
.auth-art { background: var(--ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art h1 { font-size: 34px; line-height: 1.25; max-width: 14em; } .auth-art p { color: #B7C7E0; max-width: 32em; font-size: 15px; }
.auth-art .lanes { display: grid; gap: 10px; margin-top: 28px; max-width: 30em; }
.auth-art .lane { display: flex; gap: 12px; align-items: center; color: #D7E2F2; }
.auth-art .lane i { flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--ink-3); display: grid; place-items: center; font-style: normal; }
.auth-form { padding: 40px; display: flex; flex-direction: column; justify-content: center; max-width: 480px; width: 100%; margin: 0 auto; }
.auth-form h2 { font-size: 22px; margin-bottom: 4px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 12px; margin: 14px 0; } .or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.wx-btn { background: #07C160; border-color: #07C160; color: #fff; }
.auth-form .stack > .btn, .auth-form .stack > #g-btn { width: 100%; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-art { padding: 28px 20px; } .auth-art h1 { font-size: 24px; } .auth-art .lanes { display: none; } .auth-form { padding: 24px 16px 48px; } }
.steps-dots { display: flex; gap: 6px; } .steps-dots i { width: 22px; height: 4px; border-radius: 2px; background: var(--line); } .steps-dots i.on { background: var(--gold); }

/* ---------------------------------------------------------------- 快速上手 */
.guide { border: 1px solid color-mix(in srgb, var(--gold) 50%, var(--line)); background: linear-gradient(0deg, var(--card), var(--card)); }
.guide-steps { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 12px; }
.guide-step { display: flex; gap: 10px; padding: 12px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--bg); color: var(--text); }
.guide-step:hover { text-decoration: none; border-color: var(--gold); }
.guide-step .n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--card); border: 2px solid var(--line); }
.guide-step.done { opacity: .65; } .guide-step.done .n { background: var(--ok); border-color: var(--ok); color: #fff; }
.guide-step b { display: block; font-size: 13px; } .guide-step small { color: var(--muted); font-size: 12px; line-height: 1.4; display: block; }
/* 聚光灯式功能引导 */
.coach-hole { position: fixed; z-index: 95; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(5,15,30,.55); pointer-events: none; transition: all .25s ease; }
.coach { position: fixed; z-index: 96; width: min(320px, calc(100vw - 24px)); background: var(--card); border-radius: var(--r); padding: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.3); border-top: 4px solid var(--gold); }
.coach p { margin: 6px 0 10px; }

/* ---------------------------------------------------------------- 聊天 */
.chat { display: grid; grid-template-columns: 300px minmax(0,1fr); height: calc(100vh - 140px); min-height: 420px; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--r-l); overflow: hidden; }
.chat-list { border-right: 1px solid var(--line-2); overflow-y: auto; }
.chat-list .ch { display: flex; gap: 10px; padding: 12px 14px; cursor: pointer; align-items: center; } .chat-list .ch:hover { background: var(--bg); } .chat-list .ch.on { background: var(--gold-l); }
.chat-list .ch .grow small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; gap: 10px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.msg { display: flex; gap: 8px; max-width: 78%; } .msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble { background: var(--card); border: 1px solid var(--line-2); padding: 8px 12px; border-radius: 14px 14px 14px 4px; white-space: pre-wrap; word-break: break-word; }
.msg.me .bubble { background: var(--ink-3); color: #fff; border-color: var(--ink-3); border-radius: 14px 14px 4px 14px; }
.msg .meta { font-size: 11px; color: var(--faint); margin-top: 2px; } .msg.me .meta { text-align: right; }
.msg img { max-width: 240px; max-height: 240px; border-radius: 10px; display: block; }
.msg.sys { align-self: center; max-width: 90%; font-size: 12px; color: var(--muted); background: var(--line-2); padding: 4px 10px; border-radius: 999px; }
.msg.pending .bubble { opacity: .6; }
.chat-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line-2); align-items: flex-end; }
.chat-input textarea { min-height: 40px; height: 40px; max-height: 140px; }
.typing { font-size: 12px; color: var(--muted); padding: 0 16px 6px; height: 18px; }
@media (max-width: 900px) { .chat { grid-template-columns: 1fr; height: calc(100vh - 150px); } .chat.has-ch .chat-list { display: none; } .chat:not(.has-ch) .chat-main { display: none; } }

/* ---------------------------------------------------------------- 打印 */
@media print { .side, .top, .tabbar, .no-print { display: none !important; } .content { padding: 0; } .card { box-shadow: none; border: 0; } }
