/* 版式：顶栏承载导航（手机改为底部标签栏）；主体限宽居中；细线分隔，小圆角，选中时段用荧光黄标记 */
:root {
  --paper: #f3f4f6;
  --surface: #ffffff;
  --sunken: #eceef2;
  --ink: #12151c;
  --ink-2: #4a5161;
  --ink-3: #8b91a1;
  --rule: #e1e4ea;
  --rule-2: #c9ced8;
  --navy: #1c2949;
  --navy-fg: #ffffff;
  --navy-soft: #e6eaf3;
  --mark: #ffd43b;
  --mark-soft: #fff3c4;
  --mark-ink: #3b2f00;
  --taken: #d3d8e1;
  --taken-ink: #5b6375;
  --ok: #1f7a57;
  --ok-bg: #e2f2ea;
  --warn: #a5650c;
  --warn-bg: #fbefd9;
  --bad: #bd3a2b;
  --bad-bg: #fbe5e1;
  --scrim: rgba(12, 15, 22, .48);
  --shadow-1: 0 1px 2px rgba(18, 21, 28, .06);
  --shadow-2: 0 12px 40px rgba(18, 21, 28, .16), 0 2px 6px rgba(18, 21, 28, .06);

  --font-ui: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", system-ui, sans-serif;
  --font-num: "Barlow Condensed", "Bahnschrift SemiCondensed", "Bahnschrift", "DIN Condensed", "Arial Narrow", sans-serif;

  --r-1: 4px;
  --r-2: 8px;
  --r-3: 14px;
  --bar-h: 60px;
  --tab-h: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1016; --surface: #151922; --sunken: #1c212b; --ink: #e8ebf1; --ink-2: #a8afbe; --ink-3: #6c7486;
    --rule: #252b37; --rule-2: #353d4c; --navy: #d6ddef; --navy-fg: #0f131b; --navy-soft: #222a3b;
    --mark: #f2c933; --mark-soft: #3a3214; --mark-ink: #261e00; --taken: #2c3341; --taken-ink: #98a1b4;
    --ok: #5cc79a; --ok-bg: #15302a; --warn: #e2a74c; --warn-bg: #33270f; --bad: #f08a7a; --bad-bg: #3a1d19;
    --scrim: rgba(0, 0, 0, .6);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-2: 0 12px 40px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0d1016; --surface: #151922; --sunken: #1c212b; --ink: #e8ebf1; --ink-2: #a8afbe; --ink-3: #6c7486;
  --rule: #252b37; --rule-2: #353d4c; --navy: #d6ddef; --navy-fg: #0f131b; --navy-soft: #222a3b;
  --mark: #f2c933; --mark-soft: #3a3214; --mark-ink: #261e00; --taken: #2c3341; --taken-ink: #98a1b4;
  --ok: #5cc79a; --ok-bg: #15302a; --warn: #e2a74c; --warn-bg: #33270f; --bad: #f08a7a; --bad-bg: #3a1d19;
  --scrim: rgba(0, 0, 0, .6);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 12px 40px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
:root {
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }

/* 顶栏 */
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 40; background: var(--surface);
}
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  background: var(--surface); border-bottom: 1px solid var(--rule);
}
.topbar-in {
  max-width: 1280px; margin: 0 auto; height: var(--bar-h);
  display: flex; align-items: center; gap: 28px;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark { width: 28px; height: 28px; color: var(--navy); flex: none; }
.brand-name { font-size: 16px; font-weight: 600; letter-spacing: .08em; }

.nav-top { display: flex; align-self: stretch; gap: 4px; }
.nav-top button {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 0 14px;
  color: var(--ink-2); font-size: 14px;
}
.nav-top button:hover { color: var(--ink); }
.nav-top button[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav-top button[aria-current="page"]::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--ink);
}
.count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--bad); color: #fff;
  font-family: var(--font-num); font-size: 12px; font-weight: 600; line-height: 1;
}

.me { margin-left: auto; position: relative; }
.me-btn { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 4px; border-radius: 20px; }
.me-btn:hover { background: var(--sunken); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--navy); color: var(--navy-fg); font-size: 13px; font-weight: 600; flex: none;
}
.me-name { font-size: 14px; padding-right: 6px; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 180px; z-index: 35;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-2); box-shadow: var(--shadow-2);
  padding: 6px;
}
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--rule); margin-bottom: 6px; }
.menu-head b { display: block; font-size: 14px; }
.menu-head span { font-size: 12px; color: var(--ink-3); }
.menu button { width: 100%; text-align: left; padding: 8px 10px; border-radius: var(--r-1); font-size: 14px; }
.menu button:hover { background: var(--sunken); }

/* 底部标签栏（手机） */
.tabbar {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--rule);
  padding: 0 max(8px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(8px, env(safe-area-inset-left, 0px));
}
.tabbar-in { display: flex; height: var(--tab-h); }
.tabbar button {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-3); font-size: 11px; position: relative;
}
.tabbar button[aria-current="page"] { color: var(--ink); font-weight: 600; }
.tabbar .count { position: absolute; top: 6px; left: calc(50% + 6px); }

/* 主体 */
.main {
  max-width: 1280px; margin: 0 auto;
  padding-block: 28px 64px;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.page { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-height: 36px; }
.page-title { font-size: 20px; font-weight: 600; letter-spacing: .02em; }
.grow { flex: 1; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: var(--r-2);
  border: 1px solid var(--rule-2); background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background-color .12s, border-color .12s;
}
.btn:hover { background: var(--sunken); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: var(--navy-fg); }
.btn-primary:hover { background: var(--navy); opacity: .9; }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn-text { border-color: transparent; background: transparent; padding: 0 8px; color: var(--ink-2); }
.btn-text:hover { background: var(--sunken); color: var(--ink); }
.btn-lg { height: 46px; font-size: 15px; padding: 0 22px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn {
  width: 36px; height: 36px; border-radius: var(--r-2); display: inline-grid; place-items: center; color: var(--ink-2); flex: none;
}
.icon-btn:hover { background: var(--sunken); color: var(--ink); }

/* 分段控件 */
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-2); background: var(--sunken); }
.seg button { height: 30px; padding: 0 14px; border-radius: 6px; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-1); }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-size: 13px; color: var(--ink-2); }
.input, .select, .textarea {
  width: 100%; min-width: 0; height: 42px; padding: 0 12px; border-radius: var(--r-2);
  border: 1px solid var(--rule-2); background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 17px) 18px, calc(100% - 12px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-soft); }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.field-error { font-size: 12px; color: var(--bad); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--rule-2); border-radius: var(--r-2); height: 42px; overflow: hidden; background: var(--surface); }
.stepper button { width: 42px; height: 100%; display: grid; place-items: center; color: var(--ink-2); }
.stepper button:hover { background: var(--sunken); }
.stepper input { width: 56px; height: 100%; border: 0; border-left: 1px solid var(--rule); border-right: 1px solid var(--rule); text-align: center; background: transparent; font-family: var(--font-num); font-size: 18px; font-weight: 600; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: none; background: var(--sunken); }

.switch { position: relative; width: 40px; height: 24px; flex: none; display: inline-block; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 12px; background: var(--rule-2); transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--navy); outline-offset: 2px; }

/* 状态文字：圆点加文字，不用色块胶囊 */
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.state.pending { color: var(--warn); }
.state.approved { color: var(--ok); }
.state.rejected { color: var(--bad); }
.state.cancelled, .state.done, .state.expired { color: var(--ink-3); }

/* 弹层：电脑为右侧抽屉，手机为整屏面板 */
.scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); animation: fade .16s ease-out; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51; width: min(460px, 100%);
  background: var(--surface); box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; animation: slide-in .2s ease-out;
  padding-top: env(safe-area-inset-top, 0px);
}
.drawer-head {
  display: flex; align-items: center; gap: 8px; height: 60px; flex: none;
  padding: 0 12px 0 24px; border-bottom: 1px solid var(--rule);
}
.drawer-head h2 { font-size: 16px; font-weight: 600; }
.drawer-body { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.drawer-foot {
  flex: none; display: flex; gap: 10px; padding: 16px 24px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--rule);
}
.drawer-foot .btn { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

.toast {
  position: fixed; left: 0; right: 0; margin-inline: auto; width: max-content; max-width: calc(100% - 32px);
  bottom: calc(32px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  background: var(--ink); color: var(--paper); border-radius: var(--r-2);
  padding: 11px 18px; font-size: 14px; box-shadow: var(--shadow-2); animation: rise .18s ease-out;
}

.ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); }
.empty { padding: 56px 16px; text-align: center; color: var(--ink-3); font-size: 14px; }

/* 平板 */
@media (max-width: 1023px) {
  .topbar-in, .main { padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
  .topbar-in { gap: 16px; }
  .me-name { display: none; }
}

/* 手机 */
@media (max-width: 699px) {
  :root { --bar-h: 52px; }
  .topbar-in, .main { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .nav-top { display: none; }
  .tabbar { display: block; }
  .main { padding-block: 16px calc(var(--tab-h) + 32px + env(safe-area-inset-bottom, 0px)); }
  .page { gap: 16px; }
  .page-title { font-size: 18px; }
  .drawer { width: 100%; animation: rise .2s ease-out; }
  .drawer-head { padding-left: 16px; height: 54px; }
  .drawer-body { padding: 20px 16px; }
  .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .toast { bottom: calc(var(--tab-h) + 20px + env(safe-area-inset-bottom, 0px)); }
  body.no-tabbar .tabbar { display: none; }
  body.no-tabbar .main { padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
