:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  --ink: #172334;
  --subtle: #53677f;
  --muted: #62748a;
  --blue: #235fd1;
  --blue-dark: #17499f;
  --blue-soft: #eaf2ff;
  --border: #dce5f0;
  --surface: #fff;
  --background: #f5f8fc;
  --danger: #a6312b;
  --danger-soft: #fff1ef;
  --radius: 16px;
  color: var(--ink);
  background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .64; }
:focus-visible { outline: 3px solid #3976e4; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.5rem, 5vw, 2rem); letter-spacing: -.025em; line-height: 1.24; }
h2 { font-size: 1.12rem; line-height: 1.32; }
h3 { font-size: 1rem; }
p, small, time, span, dd { overflow-wrap: anywhere; }
p { line-height: 1.55; }
small, .muted { color: var(--muted); font-size: .88rem; }
.shell { width: min(100%, 1140px); margin: 0 auto; min-height: 100dvh; }
.app-bar {
  min-height: 64px; padding: calc(.68rem + env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) .68rem max(1rem, env(safe-area-inset-left, 0px));
  display: flex; justify-content: space-between; align-items: center; gap: .625rem;
}
.brand { color: var(--ink); display: flex; align-items: center; gap: .6rem; font-weight: 730; min-width: 0; }
.brand img { border-radius: 9px; }
.bar-actions { display: flex; gap: .3rem; }
.layout { display: grid; align-items: start; }
main { min-width: 0; padding: 0 max(1rem, env(safe-area-inset-right, 0px)) calc(84px + env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px)); }
main:focus { outline: none; }
.screen { display: grid; gap: .85rem; animation: arrive .2s ease-out both; }
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: .75rem; min-height: 42px; }
.page-heading h1 { min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; min-width: 0; }
.login-card { max-width: 400px; margin: clamp(12px, 10vh, 100px) auto 0; padding: clamp(1.15rem, 5vw, 1.6rem); display: grid; gap: 1rem; }
.login-card .login-icon { border-radius: 16px; }
.login-card h1 { margin-top: .1rem; }
.navigation {
  position: fixed; inset: auto 0 0; z-index: 2; display: grid; grid-template-columns: repeat(4,minmax(0,1fr));
  gap: .28rem; padding: .38rem max(.55rem, env(safe-area-inset-right, 0px)) calc(.45rem + env(safe-area-inset-bottom, 0px)) max(.55rem, env(safe-area-inset-left, 0px));
  border-top: 1px solid var(--border); background: #fffffffa;
}
.navigation button, .tabs button { min-height: 44px; padding: .45rem .65rem; border: 1px solid transparent; border-radius: 11px; color: var(--subtle); background: transparent; font-weight: 640; transition: background .16s ease,color .16s ease,transform .13s ease; }
.navigation button { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: .18rem; padding: .35rem .2rem; line-height: 1.15; font-size: .84rem; }
.nav-icon { flex: none; width: 19px; height: 19px; }
.navigation button[aria-current="page"], .tabs button[aria-pressed="true"] { background: var(--blue-soft); color: var(--blue-dark); }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: .56rem .85rem; border-radius: 10px; border: 1px solid transparent; background: var(--blue); color: #fff; font-weight: 660; text-align: center; line-height: 1.25; text-decoration: none; transition: transform .14s ease, background .16s ease, border-color .16s ease, opacity .16s ease; }
.button:not(:disabled):active, .navigation button:active, .tabs button:active, .list-button:active { transform: scale(.975); }
.button.subtle { color: var(--blue-dark); background: var(--blue-soft); }
.button.secondary { background: var(--surface); border-color: var(--border); color: var(--ink); }
.button.danger { background: var(--danger); color: white; }
.button.danger-outline { background: var(--danger-soft); color: var(--danger); }
.button.compact { min-width: 44px; padding-inline: .65rem; }
.button.block { width: 100%; }
@media (hover:hover) {
  .button:not(:disabled):hover { filter: brightness(.96); }
  .navigation button:hover,.tabs button:hover,.list-button:hover { background: var(--blue-soft); }
}
.stats { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .65rem; margin: 0; }
.stat { display: grid; gap: .35rem; padding: .9rem 1rem; min-width: 0; }
.stat dt { color: var(--subtle); font-size: .89rem; }
.stat dd { margin: 0; font-weight: 730; font-size: clamp(1.25rem, 7vw, 1.85rem); font-variant-numeric: tabular-nums; }
.field { display: grid; min-width: 0; gap: .35rem; }
.field > span { font-size: .88rem; color: var(--subtle); font-weight: 630; }
input:not([type=checkbox]),select,textarea {
  width: 100%; min-width: 0; max-width: 100%; color: var(--ink); background: var(--surface);
  min-height: 44px; padding: .56rem .68rem; border: 1px solid #cbd8e7; border-radius: 9px;
  font-size: 16px; transition: border-color .15s ease, box-shadow .15s ease;
}
input:not([type=checkbox]):focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #dceaff; outline: none; }
textarea { resize: vertical; min-height: 88px; }
input::placeholder, textarea::placeholder { color: #6e7e8e; }
.stack, .form { display: grid; gap: .8rem; min-width: 0; }
.field-row, .action-row { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; }
.action-row.inline { display: flex; flex-wrap: wrap; }
.search { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: .55rem; align-items: stretch; }
.tabs { display: flex; align-items: center; flex-wrap: wrap; gap: .32rem; }
.tabs button { border-color: var(--border); background: var(--surface); min-width: 54px; }
.tabs button[aria-pressed="true"] { border-color: #b8d0fa; }
.flow { display: flex; gap: .45rem; align-items: center; flex-wrap: wrap; min-width: 0; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.list-button { width: 100%; text-align: left; padding: .7rem .8rem; min-height: 63px; display: flex; align-items: center; justify-content: space-between; gap: .65rem; color: var(--ink); background: var(--surface); border-radius: 12px; border: 1px solid var(--border); transition: transform .14s ease, background .16s ease; }
.row-main { display: grid; gap: .22rem; min-width: 0; }
.list-button .row-main strong { white-space: normal; overflow-wrap: anywhere; }
.chevron { flex: none; width: .46rem; height: .46rem; margin-right: .18rem; transform: rotate(-45deg); border-bottom: 2px solid #637d9b; border-right: 2px solid #637d9b; }
.record-row { display: grid; gap: .38rem; }
.record-title { display: flex; align-items: center; justify-content: space-between; gap: .45rem; min-width: 0; }
.record-title > :first-child { min-width: 0; }
.record-row .button { justify-self: start; }
.chip { display: inline-flex; align-items: center; padding: .2rem .44rem; border-radius: 6px; font-size: .74rem; line-height: 1.2; color: var(--subtle); background: #edf2f8; }
.chip.bad { color: var(--danger); background: var(--danger-soft); }
.chip.active { color: var(--blue-dark); background: var(--blue-soft); }
.caption-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .8rem; margin: 0; }
.caption-grid div { min-width: 0; }
.caption-grid dt { font-size: .8rem; color: var(--muted); margin-bottom: .2rem; }
.caption-grid dd { margin: 0; font-size: .94rem; font-weight: 630; font-variant-numeric: tabular-nums; }
.status-box { padding: .75rem; border-radius: 10px; background: var(--background); display: grid; gap: .25rem; }
.status-box.bad, .error { color: var(--danger); background: var(--danger-soft); }
.error { padding: .65rem .75rem; border-radius: 9px; font-size: .9rem; }
.empty { color: var(--subtle); padding-block: 1.2rem; }
.check { display: flex; align-items: center; gap: .4rem; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
.check { min-height: 44px; color: var(--subtle); cursor: pointer; }
.reward-box { border: 1px solid var(--border); padding: .65rem; border-radius: 10px; display: grid; gap: .65rem; }
.reward-row { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) auto; gap: .4rem; align-items: end; }
.reward-row input { min-width: 0; }
dialog { max-height: calc(100dvh - 2rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); margin: auto; padding: 0; width: min(calc(100% - 1.6rem), 470px); border: 1px solid var(--border); color: var(--ink); background: var(--surface); border-radius: var(--radius); box-shadow: 0 18px 50px #162b4530; overflow: auto; }
dialog[open] { animation: arrive .18s ease-out both; }
dialog::backdrop { background: #14233773; }
.dialog-content { padding: 1.15rem; display: grid; gap: .8rem; }
.dialog-content ul { padding-inline-start: 1.3rem; margin-block: 0; line-height: 1.6; }
.toast { position: fixed; z-index: 3; inset: auto auto calc(70px + env(safe-area-inset-bottom, 0px)) 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 2rem); padding: .7rem .85rem; background: #172e4c; color: #fff; border-radius: 10px; box-shadow: 0 4px 20px #172e4c35; font-size: .9rem; transition: opacity .19s ease; }
.toast.error-tone { background: #862926; }
.toast.fading { opacity: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (min-width: 760px) {
  .app-bar { min-height: 76px; padding-inline: 1.5rem; }
  .layout:has(.navigation:not([hidden])) { grid-template-columns: 155px minmax(0,1fr); gap: 1.1rem; padding-inline: 1.5rem; }
  .navigation { position: sticky; top: 1rem; inset-inline: auto; inset-block-end: auto; border: 1px solid var(--border); border-radius: var(--radius); padding: .42rem; grid-template-columns: 1fr; }
  .navigation button { justify-content: flex-start; flex-direction: row; gap: .6rem; padding-inline: .7rem; font-size: .92rem; }
  .layout:has(.navigation:not([hidden])) main { padding: 0 0 2rem; }
  .stats { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .screen { gap: 1rem; }
  .toast { bottom: 1rem; }
}
@media (max-width: 355px) {
  main { padding-inline: .7rem; }
  .card { padding: .72rem; }
  .brand img { width: 30px; height: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
