/* 快速录入：手机上单手录入为主。深青绿 = 门店招牌色；琥珀 = 来源标签（像贴在手机背面的编号贴纸） */
:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --ink: #17221f;
  --muted: #5d6b67;
  --line: #d6dedb;
  --brand: #1f5f5b;
  --brand-ink: #ffffff;
  --brand-soft: #e1eeec;
  --tag: #f2c14e;
  --tag-ink: #3b2a00;
  --ok: #1d7a46;
  --ok-soft: #e3f3e8;
  --warn: #9a5b00;
  --warn-soft: #fbefd9;
  --err: #b3261e;
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111715; --surface: #1a2220; --ink: #e8efec; --muted: #9aaba6; --line: #2d3a36;
    --brand: #5fb3aa; --brand-ink: #06201d; --brand-soft: #1f3431;
    --tag: #f2c14e; --tag-ink: #2a1e00;
    --ok: #6fd39a; --ok-soft: #173325; --warn: #f0b35a; --warn-soft: #3a2b12; --err: #ff8a80;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--tag); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.app { max-width: 640px; margin: 0 auto; padding-inline: 16px; }

.boot { padding-block: 40vh; text-align: center; color: var(--muted); }

/* 登录 */
.login { min-height: 100vh; display: grid; align-items: center; padding-block: 32px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px 22px; display: grid; gap: 10px; }
.login-card h1 { margin: 0; font-size: 28px; letter-spacing: .02em; }
.login-card p { margin: 0; }
.login-card form { display: grid; gap: 8px; margin-top: 10px; }
.eyebrow { font-size: 13px; letter-spacing: .12em; color: var(--brand); font-weight: 600; }

label { font-size: 14px; font-weight: 600; }
input, textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 12px 12px; min-height: 48px; font-size: 17px;
}
textarea { resize: vertical; min-height: 84px; }
input:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }

.btn-primary {
  background: var(--brand); color: var(--brand-ink); border: 0; border-radius: var(--radius);
  min-height: 52px; font-size: 18px; font-weight: 700; width: 100%;
}
.btn-primary:disabled { opacity: .55; cursor: progress; }
.btn-ghost { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; color: var(--muted); }
.form-error { color: var(--err); margin: 0; min-height: 1.5em; font-size: 15px; }

/* 顶栏 */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 3;
  display: flex; align-items: center; gap: 12px; padding-block: 10px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: 13px; }
.today { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.today span { font-size: 22px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; }
.today small { font-size: 11px; color: var(--muted); }

.tabs { display: flex; gap: 4px; padding-block: 10px; }
.tabs button {
  flex: 1; border: 0; background: none; padding: 8px 4px; border-radius: 8px; color: var(--muted); font-weight: 600;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: inset 0 -3px 0 var(--brand); }

.panel { display: grid; gap: 14px; padding-bottom: 40px; }

/* 来源条 */
.source {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
}
.source .label { font-weight: 700; font-size: 14px; }
.source-no { width: 96px; text-transform: uppercase; letter-spacing: .04em; min-height: 40px; text-align: center; font-size: 18px; font-weight: 700; padding: 6px; }
.source-tag {
  margin-left: auto; background: var(--tag); color: var(--tag-ink); font-weight: 800; border-radius: 6px;
  padding: 4px 10px; font-size: 15px; letter-spacing: .03em; transform: rotate(-1.5deg);
}
.source-tag.unset { background: none; color: var(--err); transform: none; border: 1px dashed var(--err); }

/* 分段按钮与选项 */
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: none; border-radius: 7px; padding: 6px 12px; min-height: 36px; color: var(--muted); font-weight: 600; }
.seg button[aria-checked="true"] { background: var(--brand); color: var(--brand-ink); }
.seg-wide { display: flex; }
.seg-wide button { flex: 1; min-height: 44px; }
.seg-small button { padding: 6px 10px; }

fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
legend { font-size: 14px; font-weight: 600; padding: 0; margin-bottom: 8px; }
.entry { display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.field { display: grid; gap: 6px; }
.req { font-size: 11px; font-weight: 600; color: var(--err); margin-left: 4px; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.hint.bad { color: var(--err); }
.phone-row { display: flex; gap: 8px; align-items: stretch; }
.phone-row input { flex: 1; min-width: 0; }
.hire-only { display: grid; gap: 16px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; min-height: 40px; font-weight: 600;
}
.chips button[aria-checked="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.chips-sub button { min-height: 34px; padding: 4px 12px; font-size: 14px; font-weight: 500; }
.chips-sub:empty { display: none; }

.btn-save { margin-top: 4px; }

/* 结果 */
.result { border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; border: 1px solid transparent; }
.result.ok { background: var(--ok-soft); border-color: var(--ok); }
.result.warn { background: var(--warn-soft); border-color: var(--warn); }
.result strong { font-size: 16px; }
.code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; letter-spacing: .04em; }

.section-title { font-size: 15px; margin: 8px 0 0; }
.entries { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.entries:empty::before { content: "还没有录入记录"; display: block; background: var(--surface); padding: 14px; color: var(--muted); }
.entries li { background: var(--surface); padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.entries .n { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.entries .t { color: var(--muted); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
.entries .meta { grid-column: 1 / -1; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.pill { font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.pill.new { background: var(--ok-soft); color: var(--ok); }
.pill.dup { background: var(--warn-soft); color: var(--warn); }

.filter { display: flex; }
.by-source { display: flex; flex-wrap: wrap; gap: 8px; }
.by-source span { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 14px; }
.by-source b { font-variant-numeric: tabular-nums; }

.totals { display: flex; gap: 12px; }
.totals div { flex: 1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.totals b { display: block; font-size: 26px; font-variant-numeric: tabular-nums; color: var(--brand); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.progress { border-collapse: collapse; width: 100%; font-size: 14px; }
.progress th, .progress td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.progress th { font-size: 12px; color: var(--muted); font-weight: 600; }
.progress .num { text-align: right; font-variant-numeric: tabular-nums; }
.progress tr:last-child td { border-bottom: 0; }

@media (prefers-reduced-motion: no-preference) {
  .result { animation: pop .25s ease-out; }
  @keyframes pop { from { transform: translateY(-4px); opacity: .4; } to { transform: none; opacity: 1; } }
}
