/* 刻时 · 样式：沉静极简 · 深色 */

:root {
  --bg: #0a0b0e;
  --surface: #12141a;
  --surface-2: #191c24;
  --surface-3: #20242e;
  --line: #242832;
  --line-soft: #1b1f27;
  --text: #e9eaee;
  --muted: #a2a8b8;
  --muted-2: #8b91a1;
  --brass: #d4a86d;
  --brass-soft: rgba(212, 168, 109, .13);
  --brass-line: rgba(212, 168, 109, .34);
  --danger: #e0665c;
  --danger-soft: rgba(224, 102, 92, .13);
  --warn: #e0a94a;
  --warn-soft: rgba(224, 169, 74, .13);
  --ok: #58b98c;
  --ok-soft: rgba(88, 185, 140, .13);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, .9);
  --tabbar-h: 62px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background-image:
    radial-gradient(900px 480px at 50% -12%, rgba(46, 62, 84, .38) 0%, rgba(10, 11, 14, 0) 62%),
    radial-gradient(600px 400px at 110% 8%, rgba(212, 168, 109, .07) 0%, rgba(10, 11, 14, 0) 60%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--brass); text-decoration: none; }
[hidden] { display: none !important; }

.num { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 布局 */

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px calc(var(--tabbar-h) + 30px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 0 12px;
  background: linear-gradient(180deg, rgba(10, 11, 14, .96) 62%, rgba(10, 11, 14, 0));
  backdrop-filter: blur(10px);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-glyph { width: 30px; height: 30px; color: var(--brass); flex: none; }
.brand-name { font-size: 19px; font-weight: 600; letter-spacing: .16em; }
.brand-sub { font-size: 11.5px; color: var(--muted-2); letter-spacing: .08em; margin-top: -2px; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  position: relative;
  transition: background .16s ease, border-color .16s ease, transform .12s ease;
}
.icon-btn:active { transform: scale(.96); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px;
  min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 11px; line-height: 17px; text-align: center; font-weight: 600;
}

.page-title { font-size: 24px; margin: 18px 0 4px; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; }

.section { margin-top: 22px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 10px;
}
.section-title { font-size: 15px; color: var(--text); font-weight: 600; }
.section-title .count { color: var(--muted-2); font-weight: 500; margin-left: 6px; }
.section-link { font-size: 13px; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 0; }
.section-link:hover { color: var(--brass); }

/* ---------------------------------------------------------------- 卡片与列表 */

.card {
  background: linear-gradient(180deg, var(--surface) 0%, #101218 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }

.list { display: flex; flex-direction: column; gap: 8px; }

.item-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .12s ease;
}
.item-row:active { transform: scale(.995); }
.item-row:hover { border-color: var(--line-soft); background: var(--surface-2); }
.item-row.is-done { opacity: .55; }

.item-thumb {
  width: 42px; height: 42px; flex: none;
  border-radius: 10px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  color: var(--muted-2);
}
.item-thumb img { width: 100%; height: 100%; object-fit: contain; }
.item-thumb svg { width: 20px; height: 20px; }

.item-main { flex: 1; min-width: 0; }
.item-name {
  font-weight: 550; font-size: 14.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-meta {
  font-size: 12px; color: var(--muted-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.item-side { display: flex; align-items: center; gap: 8px; flex: none; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; line-height: 1;
  padding: 5px 9px; border-radius: 999px;
  background: var(--surface-3); color: var(--muted);
  border: 1px solid transparent;
  white-space: nowrap;
}
.chip.brass { background: var(--brass-soft); color: var(--brass); border-color: var(--brass-line); }
.chip.danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(224, 102, 92, .3); }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(224, 169, 74, .3); }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(88, 185, 140, .3); }

.countdown { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.countdown.u-overdue { color: var(--danger); }
.countdown.u-today { color: var(--warn); }
.countdown.u-soon { color: var(--brass); }
.countdown.u-ok { color: var(--muted); }

/* ---------------------------------------------------------------- 统计块 */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 12px 11px;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}
.stat:hover { border-color: var(--brass-line); }
.stat-value { font-size: 23px; font-weight: 650; letter-spacing: -.02em; }
.stat-label { font-size: 11.5px; color: var(--muted-2); margin-top: 1px; }
.stat.danger .stat-value { color: var(--danger); }
.stat.warn .stat-value { color: var(--warn); }
.stat.brass .stat-value { color: var(--brass); }

/* ---------------------------------------------------------------- 批次卡 */

.batch-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 16px;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .12s ease;
}
.batch-card:active { transform: scale(.997); }
.batch-card:hover { border-color: var(--brass-line); background: var(--surface-2); }
.batch-title { display: flex; align-items: center; gap: 8px; }
.batch-name { font-size: 16px; font-weight: 600; }
.batch-note { color: var(--muted-2); font-size: 12.5px; margin-top: 3px; }
.batch-foot { display: flex; align-items: center; gap: 6px; margin-top: 11px; flex-wrap: wrap; }

.progress { height: 3px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 11px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brass), #b8863f); }

/* ---------------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 12px 18px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14.5px; font-weight: 550;
  cursor: pointer;
  transition: transform .12s ease, background .16s ease, border-color .16s ease, opacity .16s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: #d4a86d; background-image: linear-gradient(135deg, #e0b276, #c2904f); color: #17120a; border-color: transparent; font-weight: 650; }
.btn.primary:hover { background-image: linear-gradient(135deg, #e8bc83, #c9974f); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { color: var(--danger); border-color: rgba(224, 102, 92, .3); background: var(--danger-soft); }
.btn.small { padding: 8px 13px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 9px; }

/* ---------------------------------------------------------------- 表单 */

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  font-size: 16px;
  outline: none;
  transition: border-color .16s ease, background .16s ease;
  appearance: none;
}
.field textarea { resize: vertical; min-height: 74px; font-size: 15px; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brass-line);
  background: var(--surface-3);
}
.field .hint { font-size: 11.5px; color: var(--muted-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row.three { grid-template-columns: 1fr 1fr 1fr; }

.segmented {
  display: flex; gap: 4px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 13px;
}
.segmented button {
  flex: 1; padding: 9px 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted);
  font-size: 13.5px; font-weight: 550; cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.segmented button.is-on { background: var(--brass-soft); color: var(--brass); box-shadow: inset 0 0 0 1px var(--brass-line); }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.toggle-row:last-child { border-bottom: 0; }

.switch {
  width: 46px; height: 27px; border-radius: 999px;
  background: var(--surface-3); border: 1px solid var(--line);
  position: relative; cursor: pointer; flex: none;
  transition: background .18s ease, border-color .18s ease;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 21px; height: 21px; border-radius: 50%;
  background: var(--muted); transition: transform .18s ease, background .18s ease;
}
.switch.is-on { background: var(--brass-soft); border-color: var(--brass-line); }
.switch.is-on::after { transform: translateX(19px); background: var(--brass); }

.form-error {
  background: var(--danger-soft); color: #f0a49e;
  border: 1px solid rgba(224, 102, 92, .3);
  border-radius: 10px; padding: 10px 12px; font-size: 13px;
}

/* ---------------------------------------------------------------- 空状态 */

.empty {
  text-align: center;
  padding: 34px 20px;
  color: var(--muted-2);
}
.empty svg { width: 40px; height: 40px; color: var(--surface-3); margin-bottom: 10px; }
.empty-title { color: var(--muted); font-size: 14.5px; margin-bottom: 4px; }
.empty-sub { font-size: 12.5px; }

/* ---------------------------------------------------------------- 底栏 */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  background: rgba(11, 12, 16, .92);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-inner {
  max-width: 760px; margin: 0 auto; width: 100%;
  display: grid; grid-template-columns: repeat(5, 1fr);
}
.tab {
  border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 8px;
  color: var(--muted-2);
  font-size: 11px;
  transition: color .16s ease;
  position: relative;
}
.tab svg { width: 21px; height: 21px; }
.tab.is-on { color: var(--brass); }
.tab.is-on::before {
  content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 2px; border-radius: 0 0 3px 3px; background: var(--brass);
}
.tab .dot {
  position: absolute; top: 4px; right: 50%; transform: translateX(16px);
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; line-height: 17px; font-weight: 600;
}

/* ---------------------------------------------------------------- 悬浮按钮 */

.fab {
  position: fixed; right: max(18px, calc(50% - 356px));
  bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom));
  z-index: 25;
  width: 56px; height: 56px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .08);
  background: linear-gradient(140deg, #e2b478, #bf8c4a);
  color: #17120a; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 16px 32px -14px rgba(212, 168, 109, .6);
  transition: transform .14s ease;
}
.fab:active { transform: scale(.94); }
.fab svg { width: 25px; height: 25px; }

/* ---------------------------------------------------------------- 扫码 */

.scan-stage {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: #05060a;
  border: 1px solid var(--line);
  aspect-ratio: 4 / 3;
  display: flex; align-items: center; justify-content: center;
}
.scan-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-placeholder { text-align: center; color: var(--muted-2); font-size: 13px; padding: 20px; }
.scan-placeholder svg { width: 34px; height: 34px; margin-bottom: 8px; color: var(--surface-3); }
.scan-reticle {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.scan-reticle::before {
  content: ""; width: 74%; height: 34%;
  border-radius: 14px;
  box-shadow: 0 0 0 2px rgba(212, 168, 109, .75), 0 0 0 2000px rgba(5, 6, 10, .38);
  animation: breathe 2.4s ease-in-out infinite;
}
.scan-reticle::after {
  content: ""; position: absolute; width: 74%; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(224, 178, 118, .95), transparent);
  animation: sweep 2.2s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes sweep { 0%, 100% { transform: translateY(-28px); } 50% { transform: translateY(28px); } }
.scan-toast {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  background: rgba(10, 11, 14, .82); color: var(--text);
  padding: 7px 13px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--line); white-space: nowrap;
}

.manual-scan { display: flex; gap: 8px; }
.manual-scan input {
  flex: 1; min-width: 0;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 13px; font-size: 16px; outline: none;
  font-variant-numeric: tabular-nums; letter-spacing: .04em;
}
.manual-scan input:focus { border-color: var(--brass-line); }

.staged {
  border: 1px dashed var(--brass-line);
  background: var(--brass-soft);
  border-radius: var(--radius);
  padding: 13px 14px;
}
.staged-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.staged-count { font-size: 13px; color: var(--brass); font-weight: 600; }
.staged-list { display: flex; flex-direction: column; gap: 6px; max-height: 210px; overflow-y: auto; }
.staged-item {
  display: flex; align-items: center; gap: 9px;
  background: rgba(10, 11, 14, .5); border-radius: 9px; padding: 8px 10px; font-size: 13px;
}
.staged-item .grow { min-width: 0; }
.staged-item .x {
  border: 0; background: none; color: var(--muted-2); cursor: pointer;
  padding: 2px 4px; font-size: 15px; line-height: 1;
}
.staged-item .x:hover { color: var(--danger); }

/* ---------------------------------------------------------------- 提醒页 */

.reminder-row {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.reminder-icon {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--brass);
}
.reminder-icon svg { width: 17px; height: 17px; }
.reminder-icon.overdue { background: var(--danger-soft); color: var(--danger); }
.reminder-body { flex: 1; min-width: 0; }
.reminder-title { font-size: 14px; font-weight: 550; }
.reminder-sub { font-size: 12px; color: var(--muted-2); margin-top: 2px; }

.tabs {
  display: flex; gap: 6px; margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.tabs button {
  border: 0; background: none; cursor: pointer;
  padding: 9px 4px 10px; margin-right: 14px;
  color: var(--muted-2); font-size: 14px; font-weight: 550;
  border-bottom: 2px solid transparent;
}
.tabs button.is-on { color: var(--text); border-bottom-color: var(--brass); }

/* ---------------------------------------------------------------- 抽屉与提示 */

.sheet-host {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(4, 5, 8, .62);
  backdrop-filter: blur(3px);
  animation: fade .18s ease;
}
.sheet {
  width: 100%; max-width: 620px;
  max-height: 92vh;
  overflow-y: auto;
  background: #101219;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
  animation: slide-up .24s cubic-bezier(.22, .8, .28, 1);
  box-shadow: 0 -22px 60px -20px rgba(0, 0, 0, .9);
}
.sheet-grip {
  width: 40px; height: 4px; border-radius: 999px;
  background: var(--surface-3); margin: 2px auto 14px;
}
.sheet-title { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.sheet-sub { font-size: 12.5px; color: var(--muted-2); margin-bottom: 16px; }
.sheet-actions { display: flex; gap: 9px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(28px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }

.toast-host {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none; width: max-content; max-width: 90vw;
}
.toast {
  background: rgba(24, 27, 35, .96);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 16px; border-radius: 999px;
  font-size: 13px; box-shadow: var(--shadow);
  animation: toast-in .22s ease;
}
.toast.err { border-color: rgba(224, 102, 92, .4); color: #f3b3ad; }
.toast.ok { border-color: rgba(88, 185, 140, .4); color: #a6e2c6; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- 登录 */

.auth-wrap {
  min-height: 100vh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 40px 4px 60px;
  max-width: 420px; margin: 0 auto;
}
.auth-hero { text-align: center; margin-bottom: 26px; }
.auth-glyph { width: 58px; height: 58px; color: var(--brass); margin-bottom: 12px; }
.auth-title { font-size: 30px; letter-spacing: .3em; font-weight: 600; margin-left: .3em; }
.auth-tagline { color: var(--muted-2); font-size: 13px; letter-spacing: .06em; margin-top: 6px; }

/* ---------------------------------------------------------------- 杂项 */

.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }

.kv { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.kv:last-child { border-bottom: 0; }
.kv-k { font-size: 13.5px; color: var(--text); }
.kv-v { font-size: 13.5px; color: var(--muted); }

.plan-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.plan-chip {
  border: 1px solid var(--line); background: var(--surface-2);
  color: var(--muted); border-radius: 999px;
  padding: 9px 13px; font-size: 13px; cursor: pointer;
  transition: all .16s ease;
  min-height: 38px;
}
.plan-chip.is-on { background: var(--brass-soft); border-color: var(--brass-line); color: var(--brass); }

.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 37%, var(--surface) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
  border-radius: var(--radius-sm);
  height: 62px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

@media (min-width: 720px) {
  .page-title { font-size: 26px; }
  .stats { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
