/* 中介门户：手机优先，浅色深色跟随系统。 */
:root {
  color-scheme: light;
  --bg: #f1f1f1; --surface: #ffffff; --muted-bg: #f7f7f7; --border: #e3e3e3; --text: #303030; --text-2: #616161; --text-3: #8a8a8a;
  --primary: #303030; --on-primary: #ffffff; --link: #005bd3; --focus: #005bd3;
  --ok-bg: #affebf; --ok-fg: #014b40; --info-bg: #d5ebff; --info-fg: #003a5a; --warn-bg: #ffd6a4; --warn-fg: #5e4200;
  --bad-bg: #fed1d7; --bad-fg: #8e0b21; --neutral-bg: rgba(0, 0, 0, .06); --done: #29845a; --now: #2c6ecb; --fail: #e0364d;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111214; --surface: #1b1c1f; --muted-bg: #222326; --border: #313236; --text: #e9e9eb; --text-2: #a9aaae; --text-3: #7f8085;
    --primary: #e9e9eb; --on-primary: #1b1c1f; --link: #79b0ff; --focus: #4d93ff;
    --ok-bg: rgba(52, 199, 123, .16); --ok-fg: #7ee2a8; --info-bg: rgba(77, 147, 255, .18); --info-fg: #a3c8ff;
    --warn-bg: rgba(255, 170, 51, .18); --warn-fg: #ffc978; --bad-bg: rgba(255, 92, 112, .18); --bad-fg: #ffa8b2;
    --neutral-bg: rgba(255, 255, 255, .08); --done: #3dbb7d; --now: #4d93ff; --fail: #ff6b7d;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 15px/22px -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
h1, h2, h3, p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.shell { width: 100%; max-width: 640px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.muted { color: var(--text-2); }
.small { font-size: 13px; line-height: 19px; }
.brand { color: var(--text-3); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
h1 { font-size: 22px; line-height: 30px; font-weight: 700; }
.login-card { display: flex; flex-direction: column; gap: 10px; margin-top: 12vh; padding: 24px 20px; border-radius: 16px; background: var(--surface); }
.form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.form label { display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 13px; }
input, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font-size: 16px;
}
textarea { min-height: 80px; resize: vertical; }
button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--neutral-bg); font-weight: 600; cursor: pointer; }
button:disabled { opacity: .55; }
.primary { background: var(--primary); color: var(--on-primary); }
.ghost { background: transparent; color: var(--text-2); }
.error { color: var(--bad-fg); font-size: 13px; line-height: 19px; }
.error:empty { display: none; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.tabs {
  position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  margin: 0 -4px 12px; padding: 6px; border-radius: 14px; background: var(--bg);
}
.tabs button { min-height: 40px; background: var(--surface); color: var(--text-2); }
.tabs button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.cards { display: flex; flex-direction: column; gap: 10px; }
.card { display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 14px; border: 0; border-radius: 14px; background: var(--surface); text-align: left; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card-title { font-size: 16px; font-weight: 700; letter-spacing: .01em; }
.card-meta, .note { color: var(--text-2); font-size: 13px; line-height: 19px; }
.card-need {
  display: -webkit-box; overflow: hidden; color: var(--text-2); font-size: 13px; line-height: 19px;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 12px;
  background: var(--neutral-bg); color: var(--text-2); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.pill[data-tone="warning"] { background: var(--warn-bg); color: var(--warn-fg); }
.pill[data-tone="info"] { background: var(--info-bg); color: var(--info-fg); }
.pill[data-tone="success"] { background: var(--ok-bg); color: var(--ok-fg); }
.pill[data-tone="critical"] { background: var(--bad-bg); color: var(--bad-fg); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.step { display: flex; flex-direction: column; gap: 4px; color: var(--text-3); font-size: 12px; }
.step i { height: 4px; border-radius: 2px; background: var(--border); }
.step[data-state="done"] { color: var(--done); }
.step[data-state="done"] i { background: var(--done); }
.step[data-state="current"] { color: var(--now); font-weight: 600; }
.step[data-state="current"] i { background: var(--now); }
.step[data-state="failed"] { color: var(--fail); font-weight: 600; }
.step[data-state="failed"] i { background: var(--fail); }
.empty { padding: 40px 16px; color: var(--text-2); text-align: center; }
.sheet { width: 100%; max-width: 640px; height: 100%; max-height: 100%; margin: 0 auto; padding: 0; border: 0; background: var(--bg); color: var(--text); }
.sheet::backdrop { background: rgba(0, 0, 0, .4); }
.sheet[open] { display: flex; flex-direction: column; }
.sheet-head { position: sticky; top: 0; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.sheet-head h2 { font-size: 17px; font-weight: 700; }
.sheet-body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 12px; overflow: auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
.box { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 14px; background: var(--surface); }
.box h3 { font-size: 15px; font-weight: 700; }
.status { padding: 12px 14px; border-radius: 12px; background: var(--info-bg); color: var(--info-fg); }
.status[data-tone="critical"] { background: var(--bad-bg); color: var(--bad-fg); }
.status[data-tone="success"] { background: var(--ok-bg); color: var(--ok-fg); }
.status[data-tone="warning"] { background: var(--warn-bg); color: var(--warn-fg); }
.status[data-tone="neutral"] { background: var(--neutral-bg); color: var(--text-2); }
.rows { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px 12px; margin: 0; }
.rows dt { color: var(--text-3); font-size: 13px; }
.rows dd { margin: 0; overflow-wrap: anywhere; }
.shot { display: block; width: 100%; max-width: 280px; border: 1px solid var(--border); border-radius: 10px; }
.upload { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.upload img { width: 96px; height: 72px; border: 1px solid var(--border); border-radius: 8px; object-fit: cover; }
.refund { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border); }
.refund:first-of-type { border-top: 0; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 85%; padding: 8px 12px; border-radius: 12px; background: var(--muted-bg); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; background: var(--info-bg); color: var(--info-fg); }
.msg small { display: block; color: var(--text-3); font-size: 12px; }
.msg.mine small { color: inherit; opacity: .8; }
a { color: var(--link); overflow-wrap: anywhere; }

/* 电脑上：版面放宽，单子排成多列，点开一单是居中的大窗口。 */
@media (min-width: 900px) {
  .shell { max-width: 1180px; padding: 32px 32px 48px; }
  .login-card { width: 420px; margin: 14vh auto 0; }
  .top { margin-bottom: 16px; }
  .tabs { position: static; display: inline-grid; grid-template-columns: repeat(3, 140px); margin: 0 0 16px; padding: 0; }
  .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; gap: 14px; }
  .card { height: 100%; transition: box-shadow .12s ease; }
  .card:hover { box-shadow: 0 0 0 1px var(--border), 0 6px 16px rgba(0, 0, 0, .06); }
  .sheet { width: min(760px, calc(100vw - 64px)); height: min(860px, calc(100vh - 64px)); margin: auto; border-radius: 16px; }
  .sheet-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-content: start; }
  .sheet-body > .status, .sheet-body > .steps, .sheet-body > .box:has(.chat), .sheet-body > form:last-child { grid-column: 1 / -1; }
}
