/* 南暄記员工 App（HR / 市场部）
 * 设计：像一叠摆在柜台上的“单据”。每一份投递、每一条线索都是一张票，左边盖着一枚方章表示处理到哪一步；
 * 待处理的是实心章，处理中的是空心章，办完的是绿章，作废的是灰章。除此之外尽量安静。
 * 印章红 = 市场部，墨绿 = HR，与桌面图标同色。 */
:root {
  --paper: #f1f0ec;
  --card: #fffdf9;
  --ink: #1a1816;
  --ink-2: #5a554f;
  --ink-3: #85807a;
  --line: #dcd8cf;
  --line-soft: #e8e5de;
  --accent: #245a4a;
  --accent-ink: #ffffff;
  --accent-soft: #dfece6;
  --ok: #2c6b4f;
  --danger: #b3261e;
  --warn-soft: #f4e9d2;
  --warn-ink: #7a5412;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --top-h: 52px;
  --tab-h: 60px;
  --col: 480px;
}
html[data-app="market"] {
  --accent: #a8232a;
  --accent-soft: #f6e2e0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131211;
    --card: #1d1b19;
    --ink: #f0ece4;
    --ink-2: #bab3a8;
    --ink-3: #8c867c;
    --line: #38342f;
    --line-soft: #2a2724;
    --accent: #66b89f;
    --accent-ink: #0d1a15;
    --accent-soft: #1d2f29;
    --ok: #66b89f;
    --danger: #ef7a72;
    --warn-soft: #33290f;
    --warn-ink: #e3c27a;
  }
  html[data-app="market"] {
    --accent: #e4636a;
    --accent-ink: #1e0c0d;
    --accent-soft: #3a1e20;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
@media (min-width: 560px) {
  body { background: #e3e1da; }
  @media (prefers-color-scheme: dark) { body { background: #0b0a0a; } }
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
a { color: inherit; }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
svg.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---- 外壳 ---- */
#app { min-height: 100vh; min-height: 100dvh; }
.shell {
  max-width: var(--col);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
}
@media (min-width: 560px) {
  .shell { box-shadow: 0 0 0 1px var(--line); }
}
.shell { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 12px); }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  height: calc(var(--top-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 8px 0 16px;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; font: 700 17px/1 var(--serif); letter-spacing: .04em; }
.topbar-brand img { width: 26px; height: 26px; }
.topbar-brand small { font: 500 13px/1 var(--sans); color: var(--ink-2); letter-spacing: 0; padding-left: 10px; border-left: 1px solid var(--line); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-2); }
.icon-btn:active { background: var(--line-soft); }
.icon-btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabbar {
  position: fixed; bottom: 0; left: 50%; z-index: 20;
  width: min(100%, var(--col)); transform: translateX(-50%);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  background: var(--card);
  border-top: 1px solid var(--line);
}
.tab {
  position: relative; height: var(--tab-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 12px; color: var(--ink-3);
}
.tab svg.i { width: 23px; height: 23px; }
.tab[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.tab[aria-selected="true"]::before { content: ""; position: absolute; top: -1px; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.tab .badge {
  position: absolute; top: 6px; left: calc(50% + 8px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink);
  font: 600 11px/18px var(--sans); text-align: center;
}

/* ---- 页面 ---- */
.page { padding: 20px 16px 8px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-head > div:first-child { flex: 1; min-width: 0; }
.page-head > .btn, .page-head > .link-btn { flex: none; }
.page-head h1 { font: 700 30px/1.2 var(--serif); letter-spacing: .06em; }
.page-head p { margin-top: 2px; color: var(--ink-2); font-size: 13.5px; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 4px; color: var(--accent); font-size: 14px; font-weight: 600; text-decoration: none; }

.chips { display: flex; gap: 8px; margin: 0 -16px 12px; padding: 2px 16px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 19px;
  background: transparent; color: var(--ink-2); font-size: 14px; white-space: nowrap;
}
.chip b { margin-left: 6px; font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip[aria-pressed="true"] b { color: inherit; opacity: .85; }

.search { position: relative; margin-bottom: 14px; }
.search svg.i { position: absolute; left: 14px; top: 14px; width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.search input[type="search"] { padding-left: 42px; }

/* 票据 */
.tickets { display: grid; gap: 10px; }
.ticket {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 14px 14px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px;
}
.ticket:active { background: var(--line-soft); }
.ticket-main { flex: 1; min-width: 0; display: grid; gap: 2px; padding-left: 14px; border-left: 1px dashed var(--line); }
.ticket-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.ticket-top b { font-size: 16.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-top time { flex: none; font-size: 12px; color: var(--ink-3); }
.ticket-line { font-size: 14px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.ticket-meta svg.i { width: 15px; height: 15px; }

/* 印章：处理状态 */
.stamp {
  position: relative; flex: none; width: 46px; height: 46px; display: grid; place-items: center;
  border: 2px solid currentColor; border-radius: 6px; color: var(--accent);
  font: 700 15px/1 var(--serif); letter-spacing: -.02em; transform: rotate(-4deg);
}
.stamp::after { content: ""; position: absolute; inset: 3px; border: 1px solid currentColor; border-radius: 3px; opacity: .5; }
.stamp.solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stamp.ok { color: var(--ok); }
.stamp.dead { color: var(--ink-3); transform: rotate(3deg); }
.stamp.big { width: 56px; height: 56px; font-size: 18px; }

.empty { padding: 36px 20px; text-align: center; color: var(--ink-2); }
.empty .stamp { margin: 0 auto 14px; color: var(--ink-3); }
.empty b { display: block; margin-bottom: 4px; color: var(--ink); font-size: 16px; }
.empty .btn { margin-top: 16px; }

/* ---- 卡片 / 表单 ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.card + .card, .card + .tickets, .tickets + .card { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.row + .row { border-top: 1px solid var(--line-soft); }
.row-text { flex: 1; min-width: 0; }
.row-text b { display: block; font-weight: 600; }
.row-text small { display: block; margin-top: 1px; color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.row.tap { width: 100%; }
.row.tap:active { background: var(--line-soft); }
.row .chev { color: var(--ink-3); width: 18px; height: 18px; }

.switch { flex: none; position: relative; width: 52px; height: 32px; border-radius: 16px; background: var(--line); transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .18s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

.notice { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn-ink); font-size: 13.5px; line-height: 1.55; }
.notice .btn { flex: none; align-self: center; }
.notice + .card, .notice + .tickets, .card + .notice { margin-top: 12px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: 12.5px; }
input[type="text"], input[type="password"], input[type="search"], input[type="email"], input[type="tel"], textarea {
  width: 100%; min-height: 48px; padding: 11px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  font-size: 16px; line-height: 1.5; -webkit-appearance: none; appearance: none;
}
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
textarea { resize: vertical; min-height: 96px; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
::placeholder { color: var(--ink-3); }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 14px; color: var(--ink-2); }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.form-error { min-height: 22px; margin-bottom: 8px; color: var(--danger); font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-weight: 600; text-decoration: none; white-space: nowrap;
}
.btn:active { filter: brightness(.94); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ---- 详情页（从右下滑入的整页） ---- */
.sheet {
  position: fixed; inset: 0; z-index: 30; margin: 0 auto; max-width: var(--col);
  display: flex; flex-direction: column; background: var(--paper);
  transform: translateY(100%); visibility: hidden;
  transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s .28s;
}
.sheet.open { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2, .8, .2, 1), visibility 0s; }
.sheet-head {
  display: flex; align-items: center; gap: 4px; flex: none;
  height: calc(var(--top-h) + env(safe-area-inset-top, 0px)); padding: env(safe-area-inset-top, 0px) 8px 0 4px;
  border-bottom: 1px solid var(--line-soft);
}
.sheet-head h2 { flex: 1; font: 700 17px/1.3 var(--serif); letter-spacing: .04em; }
.sheet-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 20px 16px 28px; }
.sheet-foot {
  flex: none; display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--card); border-top: 1px solid var(--line);
}
.sheet-foot .btn { flex: 1; }
.sheet-foot .btn.danger { flex: none; }

.who { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.who h3 { font: 700 26px/1.25 var(--serif); letter-spacing: .04em; }
.who p { color: var(--ink-2); font-size: 14px; }
.block-title { margin: 22px 0 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.kv { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.kv + .kv { border-top: 1px solid var(--line-soft); }
.kv > span { flex: none; width: 4.4em; color: var(--ink-3); font-size: 13.5px; line-height: 1.35; }
.kv > b { flex: 1; min-width: 0; font-weight: 500; word-break: break-all; }
.kv .btn { flex: none; }
.kv.has-actions { flex-wrap: wrap; }
.kv.has-actions > b { flex: 1 1 calc(100% - 4em); font-size: 17px; font-variant-numeric: tabular-nums; }
.kv-actions { flex: 1 1 100%; display: flex; gap: 10px; }
.kv-actions .btn { flex: 1; min-height: 42px; }
.prose { padding: 14px 16px; white-space: pre-wrap; word-break: break-word; }
.prose.muted { color: var(--ink-3); }
.resume { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.resume svg.i { width: 26px; height: 26px; color: var(--accent); }
.resume-actions { display: flex; gap: 10px; padding: 0 16px 14px; }
.resume-actions .btn { flex: 1; }
.status-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.status-chips .chip { min-height: 42px; }

/* ---- 合作资料 ---- */
.fold { background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.fold + .fold { margin-top: 10px; }
.fold > summary { display: flex; align-items: center; justify-content: space-between; min-height: 54px; padding: 0 16px; font-weight: 650; list-style: none; cursor: pointer; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg) translateY(-2px); transition: transform .2s; }
.fold[open] > summary::after { transform: rotate(-135deg); }
.fold-body { padding: 0 16px 16px; }
.fold-body > p { color: var(--ink-2); margin-bottom: 10px; }
.points { display: grid; gap: 12px; }
.points li { padding-left: 14px; border-left: 2px solid var(--accent); }
.points li b { display: block; }
.points li span { color: var(--ink-2); font-size: 14px; }
.steps { display: grid; gap: 12px; counter-reset: step; }
.steps li { position: relative; padding-left: 38px; counter-increment: step; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: 1px; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--accent); color: var(--accent); font: 700 13px/23px var(--serif); text-align: center; }
.steps li b { display: block; }
.steps li span { color: var(--ink-2); font-size: 14px; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.facts li { padding: 12px 8px; text-align: center; border: 1px solid var(--line-soft); border-radius: 8px; }
.facts strong { display: block; font: 700 26px/1.2 var(--serif); color: var(--accent); }
.facts strong small { font: 500 13px var(--sans); color: var(--ink-2); margin-left: 1px; }
.facts span { display: block; font-size: 12.5px; color: var(--ink-2); line-height: 1.4; }
.qa { display: grid; gap: 14px; }
.qa li { display: grid; gap: 4px; }
.qa li b { font-weight: 650; }
.qa li p { color: var(--ink-2); font-size: 14px; }
.qa .btn { justify-self: start; }
.status-card { padding: 16px; }
.status-card .big { display: flex; align-items: center; gap: 12px; font: 700 20px/1.3 var(--serif); }
.status-card p { margin-top: 8px; color: var(--ink-2); font-size: 14px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }

/* ---- 我的 ---- */
.me-card { display: flex; align-items: center; gap: 16px; padding: 18px 16px; }
.me-card h2 { font: 700 21px/1.3 var(--serif); letter-spacing: .04em; }
.me-card p { color: var(--ink-2); font-size: 13.5px; }
.guide { padding: 14px 16px; color: var(--ink-2); font-size: 14px; }
.guide li { padding: 3px 0; }
.guide b { color: var(--ink); }
.foot-note { padding: 20px 0 4px; text-align: center; font-size: 12.5px; color: var(--ink-3); }

/* ---- 启动画面 ---- */
.boot { display: grid; place-items: center; }
.boot-mark img { animation: stamp .5s cubic-bezier(.2, .9, .3, 1) both; }
.boot-note { padding: 20px; text-align: center; }
@keyframes stamp { 0% { opacity: 0; transform: scale(1.35) rotate(-9deg); } 60% { opacity: 1; transform: scale(.97) rotate(1deg); } 100% { opacity: 1; transform: none; } }

/* ---- 登录（v1.16.0）：深漆底 + 灯火光晕 + 品牌 logo + 纸质登录单 ----
 * 登录、首次设置新密码、没有权限，三个整页画面共用一套：
 *   .login-scene  背景（装饰）　　.login-mark  品牌区（logo / 部门章 / 口号）　　.login-slip > .login-card  纸质登录单（四角委角）
 * 手机：单列居中；平板竖屏：更大的 logo 与登录单；横屏手机：左右两栏；≥ 980：左品牌右登录单。 */
html[data-view="login"], html[data-view="login"] body { background: #140d0b; }
html[data-view="login"] { color-scheme: dark; }
body { transition: background-color .45s ease; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

.login-card {
  --corners:
    radial-gradient(circle var(--n) at 0 0, #0000 calc(var(--n) - .6px), #000 var(--n)) 0 0 / 51% 51% no-repeat,
    radial-gradient(circle var(--n) at 100% 0, #0000 calc(var(--n) - .6px), #000 var(--n)) 100% 0 / 51% 51% no-repeat,
    radial-gradient(circle var(--n) at 0 100%, #0000 calc(var(--n) - .6px), #000 var(--n)) 0 100% / 51% 51% no-repeat,
    radial-gradient(circle var(--n) at 100% 100%, #0000 calc(var(--n) - .6px), #000 var(--n)) 100% 100% / 51% 51% no-repeat;
  -webkit-mask: var(--corners); mask: var(--corners);
}
.login-card { --n: 14px; }
.login, .center-screen {
  --scene: #140d0b; --cream: #f5eddf; --ember: #e2ac6b; --glow: 45, 122, 99; --stamp: #2d7a63; --out: cubic-bezier(.16, 1, .3, 1);
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; justify-items: center; align-content: center; gap: 26px;
  width: 100%; min-height: 100vh; min-height: 100dvh;
  padding: max(28px, env(safe-area-inset-top, 0px)) 16px max(28px, env(safe-area-inset-bottom, 0px));
  color: var(--cream); text-align: left; animation: scene-in .6s ease both;
}
html[data-app="market"] .login, html[data-app="market"] .center-screen { --glow: 179, 38, 43; --stamp: #b3262b; }

/* 背景：上方一盏暖灯、右下一抹部门色（HR 玉绿 / 市场部印章红）、左下一个极淡的“南”字 */
.login-scene {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(72% 56% at 50% -8%, rgba(226, 172, 107, .24), transparent 70%),
    radial-gradient(66% 52% at 104% 104%, rgba(var(--glow), .46), transparent 72%),
    radial-gradient(48% 40% at -4% 74%, rgba(226, 172, 107, .09), transparent 70%),
    var(--scene);
  animation: login-breathe 9s ease-in-out infinite;
}
.login-scene::before, .login-scene > i {
  content: ""; position: absolute; left: -26vmin; bottom: -34vmin; width: 92vmin; height: 92vmin; border: 1px solid rgba(226, 172, 107, .13); border-radius: 7%;
}
.login-scene > i { transform: rotate(45deg) scale(.84); border-color: rgba(226, 172, 107, .1); }
.login-scene::after { content: ""; position: absolute; inset: 14px; border: 1px solid rgba(226, 172, 107, .14); display: none; }

/* 品牌区 */
.login-mark { display: grid; justify-items: center; gap: 14px; text-align: center; animation: login-rise .9s var(--out) both; }
.login-logo { display: block; width: clamp(190px, 56vw, 246px); height: auto; filter: drop-shadow(0 8px 28px rgba(0, 0, 0, .5)); }
.login-mark h1 { font: 700 26px/1.3 var(--serif); letter-spacing: .12em; color: var(--cream); }
.login-mark p { max-width: 22em; color: rgba(245, 237, 223, .84); font-size: 14px; line-height: 1.7; }
.login-mark .login-role { display: inline-flex; align-items: center; gap: 16px; text-align: left; }
.login-slogan { display: none; color: var(--ember); font: 600 clamp(22px, 2.3vw, 32px)/1.5 var(--serif); letter-spacing: .42em; text-shadow: 0 2px 22px rgba(0, 0, 0, .45); }
.login-slogan::before { content: ""; display: block; width: 56px; height: 1px; margin-bottom: 20px; background: var(--ember); }
/* 部门章：横向匾额（矢量，源头是 tools/dept_seal.py）。四角委角、渐变漆面、炭火金内框；周围一圈部门色的暖光，像店招 */
.dept-seal { display: block; flex: none; height: 48px; aspect-ratio: 2 / 1; filter: drop-shadow(0 6px 16px rgba(var(--glow), .42)); }
.dept-seal svg { display: block; width: 100%; height: 100%; overflow: visible; }
.role-text { display: grid; gap: 4px; justify-items: start; }
.role-text b { font: 700 17px/1.25 var(--serif); letter-spacing: .14em; color: var(--cream); }
.role-text small { font-size: 13px; line-height: 1.5; letter-spacing: .1em; color: rgba(245, 237, 223, .82); }

/* 纸质登录单：外层负责投影（mask 会把自己的阴影切掉），里层负责委角 */
.login-slip { width: min(100%, 440px); filter: drop-shadow(0 26px 36px rgba(0, 0, 0, .5)) drop-shadow(0 1px 0 rgba(226, 172, 107, .3)); animation: login-rise .85s var(--out) .12s both; }
.login-card {
  --ink: #1a1816; --ink-2: #5a554f; --ink-3: #655e53; --line: #c9bc9f; --card: #fffdf8; --accent: #245a4a; --accent-ink: #fbf4e6; --danger: #b3261e;
  position: relative; padding: 30px 24px 22px; background: #f6efe2; color: var(--ink); color-scheme: light;
}
html[data-app="market"] .login-card { --accent: #a8232a; }
.login-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: var(--accent); }
@media (prefers-color-scheme: dark) { .login-card { background: #eee5d3; } }

.login-card .field { margin: 0; gap: 8px; }
.login-card .field > label, .login-card .field > span { font-size: 13px; font-weight: 600; letter-spacing: .12em; color: var(--ink-2); }
.login-card .field-wrap { position: relative; display: block; }
.login-card input[type="text"], .login-card input[type="password"] {
  min-height: 50px; padding: 11px 14px 11px 44px; background: #fffdf8; border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.login-card .field-wrap input[name="password"], .login-card .field-wrap input[name="current"], .login-card .field-wrap input[name="next"], .login-card .field-wrap input[name="again"] { padding-right: 50px; }
.login-card input[type="text"]:hover, .login-card input[type="password"]:hover { border-color: #b3a483; }
.login-card input[type="text"]:focus, .login-card input[type="password"]:focus { outline: 0; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.login-card input:-webkit-autofill { -webkit-text-fill-color: var(--ink); box-shadow: 0 0 0 40px #fffdf8 inset; }
.login-card ::placeholder { color: var(--ink-3); }
.field-ico { position: absolute; left: 14px; bottom: 15px; width: 20px; height: 20px; color: #9a8f79; pointer-events: none; transition: color .2s; }
.field-wrap:focus-within .field-ico { color: var(--accent); }
.pw-toggle { position: absolute; right: 2px; bottom: 3px; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; color: #8a7f6c; transition: color .2s, background-color .2s; }
.pw-toggle:hover { color: var(--ink); background: rgba(26, 24, 22, .06); }
.login-card .pw-toggle:focus-visible, .login-card .check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.login-card .check { min-height: 44px; gap: 12px; margin-top: -4px; color: var(--ink-2); cursor: pointer; }
.login-card .check input {
  -webkit-appearance: none; appearance: none; display: grid; place-items: center; flex: none; width: 22px; height: 22px; margin: 0;
  background: #fffdf8; border: 1.5px solid #a89a7c; border-radius: 6px; cursor: pointer; transition: background-color .15s, border-color .15s;
}
.login-card .check input::after { content: ""; width: 10px; height: 5.5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: translateY(-1px) rotate(-45deg) scale(0); transition: transform .15s var(--out); }
.login-card .check input:checked { background: var(--accent); border-color: var(--accent); }
.login-card .check input:checked::after { transform: translateY(-1px) rotate(-45deg) scale(1); }

.login-card .form-error { min-height: 0; margin: 2px 0 0; font-size: 13.5px; line-height: 1.55; }
.login-card .form-error:empty { height: 0; margin: 0; }
.login-card .form-error:not(:empty) { margin: 6px 0 12px; padding: 9px 12px; border-left: 3px solid var(--danger); border-radius: 8px; background: #f8e3df; color: #9b1f17; }
.login-card.shake { animation: login-shake .42s cubic-bezier(.36, .07, .19, .97); }
.login-card .field small { display: block; margin-top: 2px; font-size: 12.5px; }
.login-card form > .field { margin-bottom: 16px; }

.login-card .btn.primary {
  position: relative; min-height: 52px; border: 0; border-radius: 10px; color: #fbf4e6; font-size: 16px; letter-spacing: .34em; text-indent: .34em;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent));
  box-shadow: 0 14px 24px -14px color-mix(in srgb, var(--accent) 90%, transparent), inset 0 1px 0 rgba(255, 255, 255, .2);
  transition: transform .15s, filter .2s, box-shadow .2s;
}
.login-card .btn.primary:hover { filter: brightness(1.07); }
.login-card .btn.primary:active { transform: translateY(1px); filter: brightness(.96); box-shadow: 0 8px 16px -12px color-mix(in srgb, var(--accent) 90%, transparent), inset 0 1px 0 rgba(255, 255, 255, .2); }
.login-card .btn.primary[disabled] { opacity: .82; }
.login-card .btn.primary[disabled]::after { content: ""; flex: none; width: 16px; height: 16px; margin-left: 10px; border: 2px solid rgba(251, 244, 230, .4); border-top-color: #fbf4e6; border-radius: 50%; animation: spin .8s linear infinite; }
.login-card .btn:not(.primary) { border-color: var(--line); background: #fffdf8; border-radius: 10px; color: var(--ink); }
.login-card .link-btn { color: var(--accent); }

.login-foot { margin-top: 18px; padding-top: 16px; border-top: 1px dashed #cdbf9f; text-align: center; font-size: 13px; line-height: 1.7; color: var(--ink-3); }

/* “没有权限”：同一块登录单里放一枚灰章 + 说明 + 按钮 */
.center-screen { text-align: center; }
.center-card { display: grid; justify-items: center; gap: 12px; padding: 30px 24px 26px; text-align: center; }
.center-card h1 { font: 700 22px/1.4 var(--serif); color: var(--ink); }
.center-card p { max-width: 24em; color: var(--ink-2); }
.center-card .btn { width: 100%; max-width: 280px; }
.center-card .btn.primary { letter-spacing: .06em; text-indent: 0; }

@keyframes scene-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes login-rise { from { opacity: 0; transform: translate3d(0, 18px, 0); } to { opacity: 1; transform: none; } }
@keyframes login-shake { 0%, 100% { transform: none; } 18% { transform: translateX(-7px); } 38% { transform: translateX(6px); } 58% { transform: translateX(-4px); } 78% { transform: translateX(2px); } }
@keyframes login-breathe { 0%, 100% { opacity: .9; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .login, .center-screen, .login-scene, .login-mark, .login-slip, .login-card.shake { animation: none; }
  body { transition: none; }
}

/* 首次设置新密码：表单更长，logo 收小一点 */
.login.is-force .login-logo { width: clamp(150px, 44vw, 190px); }
.login.is-force .login-mark h1 { font-size: 24px; }

/* 平板竖屏、小桌面：logo 和登录单都放大一点 */
@media (min-width: 700px) {
  .login, .center-screen { gap: 34px; padding-block: 48px; }
  .login-logo { width: 270px; }
  .login.is-force .login-logo { width: 210px; }
  .login-card { padding: 34px 34px 26px; }
  .center-card { padding: 34px 34px 30px; }
  .login-scene::after { display: block; }
}
/* 平板竖屏：整体再放大一档，别让登录单显得缩在屏幕中间 */
@media (min-width: 700px) and (max-width: 979px) and (min-height: 760px) {
  .login, .center-screen { gap: 44px; }
  .login-logo { width: 340px; }
  .login.is-force .login-logo { width: 250px; }
  .login-mark { gap: 18px; }
  .login-mark h1 { font-size: 30px; }
  .login-mark p { font-size: 16px; }
  .dept-seal { height: 58px; }
  .login-mark .login-role { gap: 20px; }
  .role-text b { font-size: 20px; }
  .role-text small { font-size: 15px; }
  .login-slip { width: min(100%, 540px); }
  .login-card { padding: 42px 44px 32px; }
  .center-card { padding: 42px 44px 38px; }
  .login-card .field > label, .login-card .field > span { font-size: 14px; }
  .login-card input[type="text"], .login-card input[type="password"] { min-height: 56px; padding-left: 48px; }
  .field-ico { left: 16px; bottom: 17px; }
  .pw-toggle { bottom: 6px; right: 6px; }
  .login-card .check { font-size: 15px; }
  .login-card .btn.primary { min-height: 58px; font-size: 17px; }
  .login-foot { font-size: 14px; }
}
/* 横屏手机（矮屏）：左品牌、右登录单，登录单压紧到一屏之内 */
@media (max-height: 520px) and (min-width: 600px) and (max-width: 979px) {
  .login { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); column-gap: 28px; align-content: center; padding: 14px 24px; }
  .login-mark { justify-items: start; align-self: center; gap: 14px; text-align: left; }
  .login-logo { width: 190px; }
  .login-slogan { display: block; order: 2; font-size: 16px; letter-spacing: .3em; }
  .login-slogan::before { width: 40px; margin-bottom: 12px; }
  .login-mark .login-role { order: 3; gap: 12px; }
  .dept-seal { height: 40px; }
  .role-text b { font-size: 15px; }
  .role-text small { font-size: 12px; }
  .login-slip { align-self: center; width: 100%; }
  .login-card { padding: 16px 20px 10px; }
  .login-card .field { gap: 4px; }
  .login-card .field > label, .login-card .field > span { font-size: 12px; }
  .login-card form > .field { margin-bottom: 8px; }
  .login-card input[type="text"], .login-card input[type="password"] { min-height: 44px; padding-top: 9px; padding-bottom: 9px; }
  .field-ico { bottom: 12px; }
  .pw-toggle { width: 44px; height: 44px; bottom: 0; }
  .login-card .check { min-height: 44px; margin-top: 0; }
  .login-card .btn.primary { min-height: 44px; }
  .login-foot { margin-top: 8px; padding-top: 8px; font-size: 12px; line-height: 1.5; }
  .center-card { padding: 20px 22px 18px; gap: 8px; }
  .login-scene::after { display: none; }
}
/* 桌面：左品牌（logo + 口号 + 部门）、右登录单 */
@media (min-width: 980px) {
  .login { grid-template-columns: minmax(0, 1fr) minmax(420px, 470px); column-gap: clamp(48px, 8vw, 150px); justify-items: stretch; padding: 56px max(56px, calc((100vw - 1240px) / 2)); }
  .login-mark { justify-items: start; align-self: center; gap: 22px; text-align: left; }
  .login-logo, .login.is-force .login-logo { width: clamp(280px, 26vw, 380px); }
  .login.is-force .login-mark h1 { font-size: 30px; }
  .login-mark p { font-size: 15px; }
  .dept-seal { height: 56px; }
  .login-mark .login-role { gap: 20px; }
  .role-text b { font-size: 19px; }
  .role-text small { font-size: 14px; }
  .login-slogan { display: block; order: 2; }
  .login-mark .login-role { order: 3; }
  .login-slip { justify-self: end; width: 100%; }
  .login-card { padding: 38px 38px 28px; }
}
@media (max-width: 380px) {
  .login, .center-screen { padding-inline: 12px; }
  .login-card { padding: 26px 18px 18px; }
}

/* ---- 提示、确认 ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 18px); z-index: 60;
  max-width: calc(min(100%, var(--col)) - 32px); padding: 11px 18px; border-radius: 22px;
  background: var(--ink); color: var(--paper); font-size: 14.5px; text-align: center;
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); color: #fff; }
.dialog-back {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(10, 8, 7, .5);
}
.dialog {
  width: min(100%, var(--col)); padding: 22px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  background: var(--card); border-radius: 16px 16px 0 0;
  animation: rise .22s cubic-bezier(.2, .8, .2, 1);
}
.dialog h2 { font: 700 19px/1.4 var(--serif); }
.dialog p { margin-top: 6px; color: var(--ink-2); }
.dialog-actions { display: grid; gap: 10px; margin-top: 20px; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* 跟进记录时间线 */
.flog { margin: 0; padding: 4px 16px 6px; list-style: none; }
.flog li { position: relative; padding: 10px 0 10px 16px; border-top: 1px solid var(--line-soft); font-size: 14px; line-height: 1.6; word-break: break-word; }
.flog li:first-child { border-top: 0; }
.flog li::before { content: ""; position: absolute; left: 0; top: 18px; width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.flog li:first-child::before { background: var(--accent); }
.flog time { display: block; color: var(--ink-3); font-size: 12.5px; }
.flog b { font-weight: 600; }
