/* =========================================================
 * 丫丫日程 · H5 v3.2 设计系统
 * 品牌：丫丫日程 OPC    主色 #005A53    点缀 #B81F24
 * ========================================================= */

:root {
  --brand: #005A53;
  --brand-2: #0B7F74;
  --brand-soft: #E6F2F0;
  --brand-line: #D3E6E2;
  --accent: #B81F24;
  --accent-soft: #FCECEC;
  --ink: #2F4540;
  --ink-2: #5C716C;
  --muted: #8A9A96;
  --line: #E4EDEA;
  --bg: #F4F8F7;
  --card: #FFFFFF;
  --amber: #A9691A;
  --amber-soft: #FFF4E2;
  --green: #0F766E;
  --green-soft: #E4F3F0;
  --gray-soft: #EEF2F1;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 6px 22px rgba(0, 90, 83, .08);
  --shadow-lg: 0 18px 44px rgba(0, 60, 55, .14);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #DCE8E5;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--brand); text-decoration: none; }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 0; height: 0; }

/* ---------- 手机壳 ---------- */
.shell {
  width: 100%; max-width: 440px; height: 100vh; margin: 0 auto;
  background: linear-gradient(180deg, #EDF5F3 0%, #F7FBFA 42%, #F1F7F6 100%);
  position: relative; display: flex; flex-direction: column;
  box-shadow: 0 0 60px rgba(0, 50, 45, .14);
  overflow-x: hidden;
}
/* 视口高度用 dvh（移动端地址栏收展时不跳动）；不支持 dvh 的内核回退 100vh */
@supports (height: 100dvh) { .shell { height: 100dvh; } }
@media (min-width: 900px) {
  body.mobile-role { padding: 26px 0 40px; }
  body.mobile-role .shell { height: calc(100vh - 66px); border-radius: 28px; overflow: hidden; }
}
@supports (height: 100dvh) {
  @media (min-width: 900px) { body.mobile-role .shell { height: calc(100dvh - 66px); } }
}
.view { display: none; flex: 1; flex-direction: column; min-height: 0; }
.view.active { display: flex; animation: viewIn .26s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.scroll { flex: 1; overflow-y: auto; padding: 14px 18px 26px; overscroll-behavior: contain; }
.scroll.tight { padding-top: 8px; }

/* ---------- 通用文本 ---------- */
.h1 { font-size: 22px; font-weight: 800; letter-spacing: .3px; }
.h2 { font-size: 17px; font-weight: 750; }
.h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); font-size: 12.5px; }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- 品牌 ---------- */
.brand-mark { display: flex; align-items: center; gap: 9px; }
.brand-mark img { width: 34px; height: 34px; object-fit: contain; }
.brand-name { font-size: 17px; font-weight: 850; letter-spacing: 2px; color: var(--brand); }
.brand-opc { font-size: 11px; font-weight: 700; color: var(--brand-2); letter-spacing: 1px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 16px; border-radius: 12px; font-size: 14px; font-weight: 700;
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  transition: transform .12s ease, opacity .12s;
  white-space: nowrap;
}
.btn:active { transform: scale(.975); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(0, 90, 83, .22); }
.btn-primary:hover { background: #006B62; }
.btn-ghost { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.btn-line { background: #fff; border-color: var(--brand-line); color: var(--brand); }
.btn-danger { background: #fff; border-color: #F0CDCD; color: var(--accent); }
.btn-block { display: flex; width: 100%; }
.btn-lg { height: 48px; font-size: 15px; border-radius: 14px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn-icon { width: 38px; height: 38px; padding: 0; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; color: var(--brand); }
.btn-icon svg { width: 18px; height: 18px; display: block; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-icon:active { background: var(--brand-soft); }
.btn-icon.spin svg { animation: yy-spin .62s cubic-bezier(.4, 0, .2, 1); }
@keyframes yy-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; border: 1px solid rgba(0, 90, 83, .05);
}
.card.flush { padding: 0; overflow: hidden; }
.card + .card { margin-top: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.bar { width: 4px; height: 15px; border-radius: 2px; background: var(--brand); display: inline-block; margin-right: 8px; vertical-align: -2px; }
.soft-block { background: var(--brand-soft); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; color: var(--brand); }
.warn-block { background: var(--amber-soft); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; color: var(--amber); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 12px; }
.label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.label .req { color: var(--accent); margin-left: 2px; }
.input, .textarea, .select {
  width: 100%; background: #F7FAF9; border: 1.5px solid transparent; border-radius: 11px;
  padding: 11px 13px; font-size: 14.5px; outline: none; transition: border-color .15s, background .15s;
  color: var(--ink);
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--brand-2); background: #fff; }
.input.err, .textarea.err { border-color: var(--accent); background: #fff8f8; }
.textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%238A9A96' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }
.counter { text-align: right; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.help { font-size: 12px; color: var(--muted); margin-top: 5px; }
.checkline { display: flex; align-items: flex-start; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.checkline input { width: 16px; height: 16px; accent-color: var(--brand); margin-top: 2px; flex: none; }
.checkline a { font-weight: 700; }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.code-btn { flex: none; height: auto; padding: 0 14px; border-radius: 11px; background: var(--brand-soft); color: var(--brand); font-size: 13px; font-weight: 700; border: 0; }
.code-btn[disabled] { opacity: .55; }

/* ---------- 登录 ---------- */
.login-wrap { padding: 0 22px 30px; display: flex; flex-direction: column; min-height: 100%; }
.login-hero { text-align: center; padding: 54px 0 26px; }
.login-hero .mark { width: 66px; height: 66px; margin: 0 auto 12px; object-fit: contain; }
.login-hero .nm { font-size: 25px; font-weight: 850; letter-spacing: 5px; color: var(--brand); }
.login-hero .nm small { font-size: 13px; letter-spacing: 1px; color: var(--brand-2); }
.login-hero .sub { font-size: 12.5px; color: var(--muted); letter-spacing: 1.2px; margin-top: 7px; }
.login-card { background: #fff; border-radius: 20px; padding: 20px 18px; box-shadow: var(--shadow-lg); }
.entry-badge { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-soft); color: var(--brand); font-size: 11.5px; font-weight: 750; padding: 4px 10px; border-radius: 20px; margin-bottom: 12px; }
.form-err { display: none; background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 9px 11px; font-size: 12.5px; margin-bottom: 10px; line-height: 1.5; }
.form-err.show { display: block; }
.demo-tip { margin-top: 12px; padding: 10px 12px; background: #F7FAF9; border: 1px dashed var(--brand-line); border-radius: 11px; font-size: 12px; color: var(--ink-2); }
.demo-tip b { color: var(--brand); }
.demo-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.demo-head span:last-child { color: var(--brand); font-weight: 750; }
.demo-row { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 6px; padding: 8px 10px; background: #fff; border: 1px solid var(--brand-line); border-radius: 10px; font: inherit; color: var(--ink); text-align: left; cursor: pointer; transition: background .12s, border-color .12s; }
.demo-row:active, .demo-row:hover { background: var(--brand-soft); border-color: var(--brand-2); }
.demo-row .who { flex: none; font-size: 11px; font-weight: 750; color: var(--brand); background: var(--brand-soft); border-radius: 6px; padding: 2px 7px; }
.demo-row .ph { font-size: 13.5px; font-weight: 750; letter-spacing: .4px; }
.demo-row .nm { font-size: 11.5px; color: var(--muted); }
.demo-row .act { margin-left: auto; flex: none; font-size: 11.5px; font-weight: 750; color: var(--brand); }
.demo-note { margin-top: 8px; font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.demo-note b { color: var(--brand); }
.login-foot { margin-top: auto; padding-top: 22px; text-align: center; font-size: 11.5px; color: var(--muted); line-height: 1.8; }

/* ---------- 顶部栏 ---------- */
.topbar { padding: 16px 18px 10px; display: flex; align-items: center; gap: 10px; }
.topbar .grow { min-width: 0; }
.topbar-title { font-size: 17px; font-weight: 800; }
.topbar-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.back-btn { width: 34px; height: 34px; border-radius: 11px; background: #fff; box-shadow: var(--shadow); display: grid; place-items: center; flex: none; color: var(--ink); }
.back-btn svg { width: 19px; height: 19px; display: block; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.back-btn:active { background: var(--brand-soft); color: var(--brand); }

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 26px 20px 18px; }
.hero .logo { width: 52px; height: 52px; margin: 0 auto 10px; object-fit: contain; }
.hero .nm { font-size: 22px; font-weight: 850; letter-spacing: 4px; color: var(--brand); }
.hero .sub { font-size: 12px; color: var(--muted); letter-spacing: 1px; margin-top: 5px; }
.hero .hello { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; background: #fff; border-radius: 20px; padding: 6px 14px; font-size: 12.5px; color: var(--ink-2); box-shadow: var(--shadow); }
.svc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.svc-card {
  background: #fff; border-radius: 18px; padding: 16px 13px; box-shadow: var(--shadow);
  border: 1.5px solid transparent; transition: transform .14s, border-color .14s;
  position: relative; overflow: hidden; text-align: left;
}
.svc-card:hover { border-color: var(--brand-line); transform: translateY(-2px); }
.svc-card:active { transform: scale(.975); }
.svc-ico { width: 38px; height: 38px; border-radius: 12px; background: var(--brand-soft); display: grid; place-items: center; margin-bottom: 10px; color: var(--brand); }
.svc-card h3 { font-size: 15.5px; font-weight: 800; letter-spacing: .3px; }
.svc-card p { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.svc-card .num { position: absolute; right: 12px; top: 12px; font-size: 10.5px; color: var(--brand-2); background: var(--brand-soft); padding: 2px 7px; border-radius: 20px; }

/* ---------- 顾问卡 ---------- */
.person { display: flex; gap: 12px; align-items: flex-start; }
.avatar { width: 46px; height: 46px; border-radius: 14px; background: linear-gradient(135deg, #D9EDE9, #EAF5F2); display: grid; place-items: center; color: var(--brand); font-weight: 800; font-size: 17px; flex: none; }
.avatar.lg { width: 54px; height: 54px; border-radius: 16px; font-size: 19px; }
.avatar.img { background: #fff; overflow: hidden; padding: 0; }
.avatar.img img { width: 100%; height: 100%; object-fit: cover; }
.tagline { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tag { font-size: 10.5px; padding: 2px 8px; border-radius: 6px; background: #F2F6F5; color: var(--ink-2); }
.tag.brand { background: var(--brand-soft); color: var(--brand); }
.avail-line { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--brand); margin-top: 10px; background: var(--brand-soft); padding: 8px 10px; border-radius: 10px; }
.avail-line.full { color: var(--muted); background: var(--gray-soft); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- 日历 ---------- */
.cal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 12px 10px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; padding: 0 4px; }
.cal-head .ym { font-size: 15px; font-weight: 800; }
.cal-nav { width: 30px; height: 30px; border-radius: 9px; background: #F2F7F6; display: grid; place-items: center; color: var(--ink-2); }
.cal-nav[disabled] { opacity: .3; pointer-events: none; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
.cal-week span { text-align: center; font-size: 11px; color: var(--muted); padding: 3px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-cell { position: relative; aspect-ratio: 1; border-radius: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13.5px; color: var(--ink); }
.cal-cell.blank { visibility: hidden; }
.cal-cell.past { color: #C3CDCA; pointer-events: none; }
.cal-cell.today { color: var(--brand); font-weight: 800; }
.cal-cell.has::after { content: ''; position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: var(--brand-2); }
.cal-cell.sel { background: var(--brand); color: #fff; font-weight: 800; }
.cal-cell.sel::after { background: #fff; }
.cal-cell:not(.past):not(.blank):hover { background: var(--brand-soft); }
.cal-cell.sel:hover { background: var(--brand); }
.cal-cell.occupied-day::after { background: var(--accent); }
.cal-legend { display: flex; gap: 14px; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--muted); }
.cal-legend i { width: 5px; height: 5px; border-radius: 50%; background: var(--brand-2); display: inline-block; margin-right: 4px; vertical-align: 1px; }
.cal-legend i.red { background: var(--accent); }

/* ---------- 时段 ---------- */
.period { margin-top: 14px; }
.period-title { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); font-weight: 700; margin-bottom: 8px; }
.period-title span { font-size: 11px; color: var(--muted); font-weight: 400; }
.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot {
  height: 44px; border-radius: 11px; background: #fff; border: 1.5px solid var(--line);
  font-size: 14px; font-weight: 700; color: var(--ink); display: grid; place-items: center;
  transition: all .14s; position: relative;
}
.slot small { position: absolute; top: -7px; right: 5px; font-size: 9px; background: var(--gray-soft); color: var(--muted); padding: 0 4px; border-radius: 4px; font-weight: 500; }
.slot.off { background: #F6F9F8; color: #C0CBC8; border-color: transparent; pointer-events: none; }
.slot.taken { background: var(--gray-soft); color: #AAB6B3; border-color: transparent; pointer-events: none; text-decoration: line-through; }
.slot.mine { background: var(--amber-soft); color: var(--amber); border-color: #F2DFC0; pointer-events: none; }
.slot.sel { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(0, 90, 83, .24); }
.slot:not(.off):not(.taken):not(.mine):hover { border-color: var(--brand-2); }
.slot.locked { background: var(--green-soft); border-color: #BFE0DA; color: var(--green); }
.slot.open { background: var(--brand-soft); border-color: #BFDDD8; }
/* 顾问端日程面板：时段可单点开关 / 按住拖动，禁掉触摸滚动干扰 */
#sch-panel .slot { touch-action: none; -webkit-user-select: none; user-select: none; cursor: pointer; }
.slot.saved { background: var(--brand); border-color: var(--brand); color: #fff; }

/* ---------- 状态 ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 750; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.pill.pending { background: var(--amber-soft); color: var(--amber); }
.pill.confirmed { background: var(--green-soft); color: var(--green); }
.pill.done { background: var(--gray-soft); color: var(--muted); }
.pill.cancelled { background: #F3F5F4; color: #9BA7A4; }
.pill.ghost { background: var(--brand-soft); color: var(--brand); }

/* ---------- 筛选 ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; }
.chip { flex: none; height: 32px; padding: 0 13px; border-radius: 20px; background: #fff; color: var(--ink-2); font-size: 12.5px; border: 1px solid var(--line); font-weight: 600; }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip .n { font-size: 10.5px; opacity: .7; margin-left: 3px; }

/* ---------- 列表条目 ---------- */
.list-item { display: flex; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.list-item:last-child { border-bottom: 0; padding-bottom: 2px; }
.list-item .t { font-size: 13.5px; font-weight: 700; }
.list-item .s { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.avatar.sm { width: 34px; height: 34px; border-radius: 11px; font-size: 13px; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); font-size: 13px; }
.empty .big { font-size: 34px; margin-bottom: 8px; opacity: .5; }

/* ---------- 底部标签 ---------- */
.tabbar {
  display: flex; background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 7px 6px calc(7px + var(--safe-b));
  position: sticky; bottom: 0; z-index: 20;
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; color: #9AA8A5; font-size: 10.5px; font-weight: 650; }
.tab svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.tab.on { color: var(--brand); }
.tab .badge { position: absolute; transform: translate(14px, -4px); background: var(--accent); color: #fff; font-size: 9px; min-width: 15px; height: 15px; border-radius: 8px; display: grid; place-items: center; padding: 0 3px; }
.tab { position: relative; }

/* ---------- 预约详情 ---------- */
.status-hero { text-align: center; padding: 20px 16px 6px; }
.status-hero .ico { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 10px; font-size: 26px; }
.status-hero .ico.pending { background: var(--amber-soft); color: var(--amber); }
.status-hero .ico.confirmed { background: var(--green-soft); color: var(--green); }
.status-hero .ico.done, .status-hero .ico.cancelled { background: var(--gray-soft); color: var(--muted); }
.status-hero h2 { font-size: 19px; font-weight: 800; }
.status-hero p { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); flex: none; }
.kv .v { text-align: right; font-weight: 600; word-break: break-all; }
.meeting { background: linear-gradient(160deg, #F0F8F6, #E8F4F1); border: 1px solid var(--brand-line); border-radius: 14px; padding: 14px; }
.meeting .num { font-size: 21px; font-weight: 800; letter-spacing: 1.5px; color: var(--brand); font-family: ui-monospace, Menlo, monospace; margin: 4px 0 2px; }
.qr-box { width: 92px; height: 92px; border-radius: 10px; background: #fff; padding: 4px; flex: none; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.timeline { padding-left: 4px; }
.tl-item { position: relative; padding: 0 0 14px 18px; border-left: 1.5px solid var(--line); }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 2px; }
.tl-item::before { content: ''; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-line); border: 2px solid #fff; }
.tl-item.hot::before { background: var(--brand); }
.tl-item .who { font-size: 11px; color: var(--brand); font-weight: 700; }
.tl-item .txt { font-size: 12.5px; margin-top: 2px; line-height: 1.55; }
.tl-item .at { font-size: 10.5px; color: var(--muted); margin-top: 3px; }

/* ---------- 统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.stat { background: #fff; border-radius: 14px; padding: 12px 10px; box-shadow: var(--shadow); text-align: center; }
.stat .n { font-size: 23px; font-weight: 850; color: var(--brand); line-height: 1.2; }
.stat .l { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.stat.warn .n { color: var(--amber); }
.stat.plain .n { color: var(--ink); }

/* ---------- 开关 ---------- */
.switch { width: 44px; height: 26px; border-radius: 20px; background: #D8E2DF; position: relative; transition: background .18s; flex: none; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .18s; }
.switch.on { background: var(--brand); }
.switch.on::after { transform: translateX(18px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.switch-row .t { font-size: 13.5px; font-weight: 650; }
.switch-row .s { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ---------- 分段 ---------- */
.seg { display: flex; background: #F1F6F5; border-radius: 11px; padding: 3px; gap: 3px; }
.seg button { flex: 1; height: 32px; border-radius: 9px; font-size: 12.5px; color: var(--ink-2); font-weight: 650; }
.seg button.on { background: #fff; color: var(--brand); box-shadow: 0 1px 4px rgba(0,0,0,.08); font-weight: 750; }

/* ---------- 底部操作条 ---------- */
.action-bar {
  position: sticky; bottom: 0; background: rgba(255,255,255,.97); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); padding: 10px 16px calc(10px + var(--safe-b)); display: flex; gap: 9px; z-index: 15;
}
.action-bar .btn { flex: 1; }

/* ---------- 弹层 ---------- */
.mask { position: fixed; inset: 0; background: rgba(20, 40, 37, .42); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .2s; }
.mask.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 102%); width: 100%; max-width: 440px;
  background: #fff; border-radius: 20px 20px 0 0; z-index: 100; transition: transform .26s cubic-bezier(.2,.8,.3,1);
  max-height: 88vh; display: flex; flex-direction: column; padding-bottom: var(--safe-b);
}
.sheet.show { transform: translate(-50%, 0); }
.sheet-head { padding: 16px 18px 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: none; }
.sheet-head h3 { font-size: 16px; font-weight: 800; }
.sheet-body { padding: 4px 18px 18px; overflow-y: auto; }
.sheet-grab { width: 38px; height: 4px; border-radius: 3px; background: #E1EAE7; margin: 8px auto 0; }
.close-x { width: 30px; height: 30px; border-radius: 50%; background: #F3F7F6; display: grid; place-items: center; color: var(--ink-2); font-size: 15px; }
.dialog {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -46%) scale(.96); width: calc(100% - 48px); max-width: 360px;
  background: #fff; border-radius: 18px; z-index: 100; padding: 20px 18px 16px; opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s; box-shadow: var(--shadow-lg);
}
.dialog.show { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.dialog h3 { font-size: 16.5px; font-weight: 800; margin-bottom: 6px; }
.dialog p { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.dialog .acts { display: flex; gap: 9px; margin-top: 16px; }
.dialog .acts .btn { flex: 1; }

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 16px); z-index: 200;
  background: rgba(30, 50, 46, .94); color: #fff; font-size: 13px; padding: 10px 16px; border-radius: 11px;
  max-width: 84vw; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  line-height: 1.5;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: rgba(0, 90, 83, .96); }
.toast.err { background: rgba(155, 32, 36, .96); }

/* ---------- 二维码 ---------- */
.qr { width: 100%; height: 100%; border-radius: 7px; overflow: hidden; }
.qr svg { width: 100%; height: 100%; display: block; }

/* =========================================================
 * 管理后台（桌面）
 * ========================================================= */
body.admin { background: #F2F6F5; display: block; }
.admin-wrap { display: flex; min-height: 100vh; }
.sidebar { width: 216px; flex: none; background: #063F3A; color: #CFE3DE; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 18px; }
.sidebar .brand img { width: 30px; height: 30px; }
.sidebar .brand b { color: #fff; font-size: 14.5px; letter-spacing: 1.5px; }
.sidebar .brand span { display: block; font-size: 9.5px; color: #8FB5AD; letter-spacing: .5px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; font-size: 13.5px; color: #BFD6D1; font-weight: 600; text-align: left; width: 100%; }
.nav-item svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.on { background: #0B6B60; color: #fff; }
.side-foot { margin-top: auto; font-size: 10.5px; color: #7FA49D; line-height: 1.7; padding: 10px 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.main { flex: 1; min-width: 0; padding: 22px 26px 40px; }
.admin-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.admin-top h1 { font-size: 21px; font-weight: 850; }
.admin-top .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.admin-sec { display: none; }
.admin-sec.active { display: block; animation: viewIn .2s ease; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border-radius: 14px; padding: 16px; box-shadow: 0 2px 10px rgba(0,60,55,.05); border: 1px solid #EDF3F1; }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi .n { font-size: 27px; font-weight: 850; color: var(--brand); margin-top: 4px; line-height: 1.15; }
.kpi .n small { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.kpi .d { font-size: 11px; color: var(--muted); margin-top: 5px; }
.panel { background: #fff; border-radius: 14px; padding: 16px; border: 1px solid #EDF3F1; box-shadow: 0 2px 10px rgba(0,60,55,.05); }
.panel + .panel { margin-top: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head h3 { font-size: 14.5px; font-weight: 800; }
.panel-head .hint { font-size: 11.5px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
table.tb { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tb th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FAFCFB; }
table.tb td { padding: 10px; border-bottom: 1px solid #F2F6F5; vertical-align: middle; }
table.tb tr:last-child td { border-bottom: 0; }
table.tb tbody tr:hover { background: #FAFCFB; }
.tb-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid #EDF3F1; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.bar-row .nm { width: 68px; font-size: 12.5px; flex: none; color: var(--ink-2); }
.bar-row .track { flex: 1; height: 8px; border-radius: 5px; background: #F0F5F4; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, #0B7F74, #62B3A8); }
.bar-row .val { width: 34px; text-align: right; font-size: 12px; color: var(--muted); flex: none; }
.trend { display: flex; align-items: flex-end; gap: 8px; height: 128px; padding-top: 8px; }
.trend .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.trend .v { font-size: 10.5px; color: var(--brand); font-weight: 700; }
.trend .b { width: 100%; max-width: 26px; background: linear-gradient(180deg, #62B3A8, #0B7F74); border-radius: 5px 5px 3px 3px; min-height: 3px; transition: height .3s; }
.trend .d { font-size: 10px; color: var(--muted); }
.cons-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.cons-card { background: #fff; border-radius: 14px; padding: 15px; border: 1px solid #EDF3F1; }
.cons-card.off { background: #FBFCFC; border-style: dashed; }
.cons-card .nm { font-size: 14.5px; font-weight: 800; }
.cons-card .rl { font-size: 11.5px; color: var(--muted); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .input, .toolbar .select { width: auto; min-width: 130px; padding: 8px 12px; font-size: 12.5px; }
.toolbar .grow { flex: 1; }
.tag.on-off { background: #F3F5F4; color: #9BA7A4; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.mini-label { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }

/* 管理端登录 */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #E9F4F1, #F6FAF9 55%, #EDF5F3); }
.gate-card { width: 100%; max-width: 372px; background: #fff; border-radius: 20px; padding: 26px 22px; box-shadow: var(--shadow-lg); }
.gate-card .mark { width: 52px; height: 52px; margin-bottom: 12px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .admin-wrap { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; flex-direction: row; overflow-x: auto; padding: 10px; gap: 6px; align-items: center; }
  .sidebar .brand { padding: 0 8px 0 4px; flex: none; }
  .sidebar .brand span { display: none; }
  .nav-item { width: auto; white-space: nowrap; padding: 8px 12px; }
  .side-foot { display: none; }
  .main { padding: 16px 14px 40px; }
  .admin-top h1 { font-size: 18px; }
}
