:root {
  --bg: #f3f6fb;
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --card-solid: #ffffff;
  --card-tint-blue: #e8f1ff;
  --card-tint-violet: #e8f1ff;
  --text: #1a2332;
  --muted: #5c6b80;
  --line: #e4eaf2;
  --line-strong: #d3dce8;
  --primary: #1677ff;
  --primary-hover: #0958d9;
  --primary-soft: #e8f1ff;
  --cyan: #1677ff;
  --violet: #1677ff;
  --violet-soft: #e8f1ff;
  --danger: #b42318;
  --ok: #0f766e;
  --warn: #b45309;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 0 0 1px rgba(22, 49, 92, .06), 0 1px 2px rgba(22, 49, 92, .04);
  --shadow-lg: 0 0 0 1px rgba(22, 49, 92, .08), 0 12px 32px rgba(22, 49, 92, .08);
  --header-h: 64px;
  --sidebar-w: 240px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --vv-bottom: 0px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: light; min-height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { min-height: 100%; }
html body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(22, 119, 255, .18); }

a { color: var(--primary); text-decoration: none; }

/* ——— Sidebar ——— */
.app-sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 80;
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  transform: translateX(-100%);
  transition: transform .28s var(--ease);
}
.app-sidebar-brand {
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 20px;
  font-size: 15px; font-weight: 650; letter-spacing: -.03em;
  white-space: nowrap; flex-shrink: 0;
}
.brand-mark {
  width: 22px; height: 22px; flex-shrink: 0;
  border-radius: 6px;
  background: #1677ff;
  color: #fff;
  font-size: 12px; font-weight: 600; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-mark::after { display: none; }
.nav-ico {
  width: 16px; height: 16px; display: block; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.app-sidebar-brand small {
  margin-left: auto;
  color: var(--muted); font-weight: 500; font-size: 11px;
  padding: 3px 8px; border-radius: 999px;
  background: var(--bg);
}
.app-nav-primary {
  display: flex; flex-direction: column;
  flex: 1; min-height: 0;
  padding: 8px 12px 24px; gap: 0;
  overflow-y: auto;
}
.app-sidebar-account {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: #fff;
}
.app-sidebar-account .nested,
.app-sidebar-account .acc-now,
.app-sidebar-account .acc-bot {
  display: flex; align-items: center; gap: 8px;
  width: calc(100% - 12px);
  margin: 1px 0 1px 12px;
  padding: 7px 12px 7px 20px;
  border: none; background: transparent;
  color: var(--muted);
  font-family: inherit; font-size: 13px; font-weight: 500;
  text-align: left; border-radius: 10px; cursor: pointer;
}
.app-sidebar-account .acc-now { cursor: default; color: var(--text); }
.app-sidebar-account .acc-bot { cursor: default; }
.app-sidebar-account .acc-logout { color: #cf1322; }
.app-sidebar-account .user-av { width: 22px; height: 22px; font-size: 11px; }
.app-sidebar-account a.nested:hover,
.app-sidebar-account .acc-logout:hover { background: #f2f7ff; color: var(--text); }
.app-nav-sec + .app-nav-sec {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.app-nav-sec-label {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px 6px;
  font-size: 12px; font-weight: 500; color: var(--muted);
}
.app-nav-sec-label .step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  font-size: 10px; font-weight: 700;
}
.app-nav-block.collapsed a.nested,
.app-nav-block.collapsed button.nested,
.app-nav-block.collapsed .acc-now,
.app-nav-block.collapsed .acc-bot { display: none; }
.app-nav-block.current .app-nav-toggle {
  color: var(--text);
}
.app-nav-toggle {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  color: var(--text); font-size: 14px; font-weight: 500;
  padding: 9px 12px; border-radius: 10px;
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; text-align: left;
  transition: background .15s var(--ease);
}
.app-nav-toggle:hover { background: #f2f7ff; }
.app-nav-block:not(.collapsed) .app-nav-toggle { background: #f2f7ff; }
.app-nav-toggle .ico { width: 16px; height: 16px; color: var(--muted); display: flex; flex-shrink: 0; }
.app-nav-toggle .chev {
  margin-left: auto;
  width: 7px; height: 7px; flex-shrink: 0;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-135deg);
  transition: transform .18s var(--ease);
}
.app-nav-block.collapsed .app-nav-toggle .chev { transform: rotate(45deg); }
.app-nav-label {
  display: flex; align-items: center; gap: 10px;
  color: var(--muted); font-size: 12px; font-weight: 650;
  padding: 8px 12px 4px;
}
.app-nav-label .ico { font-size: 16px; line-height: 1; width: 22px; text-align: center; }
.app-nav-primary a.nested {
  margin: 1px 0 1px 12px;
  padding: 7px 12px 7px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  position: relative;
}
.app-nav-primary a.nested::before {
  content: "";
  position: absolute;
  left: 8px; top: 10px; bottom: 10px;
  width: 2px; border-radius: 2px;
  background: var(--line);
}
.app-nav-primary a.nested .ico { width: 18px; font-size: 14px; }
.app-nav-primary a.nested.active { color: var(--text); }
.app-nav-primary a {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); font-size: 14px; font-weight: 500;
  padding: 9px 12px; border-radius: 10px;
  transition: background .15s var(--ease);
}
.app-nav-primary a .ico { width: 16px; height: 16px; color: var(--muted); display: flex; flex-shrink: 0; }
.app-nav-primary a.active,
.app-nav-block.current .app-nav-toggle { color: var(--primary); }
.app-nav-primary a.active .ico,
.app-nav-block.current .app-nav-toggle .ico { color: var(--primary); }
.app-nav-primary a.active,
.app-nav-block.current .app-nav-toggle {
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: none;
}
.app-nav-primary a:hover,
.app-nav-toggle:hover { background: #f2f7ff; color: var(--text); }

.app-sidebar-mask {
  display: none; position: fixed; inset: 0; z-index: 70;
  background: rgba(15, 23, 42, .28);
}
body.sidebar-open { overflow: hidden; }
body.sidebar-open .app-sidebar { transform: translateX(0); }
body.sidebar-open .app-sidebar-mask { display: block; }

/* ——— Header ——— */
html body .app-header,
html body header.app-header {
  position: sticky; top: 0; z-index: 50;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0 16px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.app-menu-btn {
  display: inline-flex; flex-direction: row; align-items: center; justify-content: center;
  gap: 8px; width: auto; min-width: 44px; height: 40px; padding: 0 12px;
  border: none; background: var(--primary); color: #fff;
  border-radius: 12px; cursor: pointer; flex-shrink: 0;
  font-family: inherit; font-size: 14px; font-weight: 650;
  box-shadow: 0 2px 8px rgba(76, 110, 245, .32);
}
.app-menu-btn:active { transform: scale(.98); }
body.sidebar-open .app-menu-btn { background: var(--primary-hover); }
.app-menu-ico {
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  width: 16px;
}
.app-menu-ico span {
  display: block; height: 2px; background: #fff; border-radius: 2px;
}
.app-menu-txt { line-height: 1; }
.app-header-title {
  flex: 1; min-width: 0;
  font-size: 16px; font-weight: 650; letter-spacing: -.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-sidebar-close {
  display: none;
  margin-left: 8px;
  height: 36px; padding: 0 12px; flex-shrink: 0;
  border: none; background: var(--bg); color: var(--text);
  border-radius: 10px; cursor: pointer;
  font-size: 13px; font-weight: 650; line-height: 1; font-family: inherit;
}
.app-sidebar-back-ico {
  display: none;
  width: 10px; height: 10px; flex-shrink: 0;
  border-left: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  transform: rotate(45deg);
  margin-right: 4px;
}
.app-sidebar-name { white-space: nowrap; }
.app-sidebar-name-m { display: none; }
.app-nav-more,
.app-tabbar,
.app-subbar,
.app-sheet-mask { display: none; }
.app-sidebar-ws { display: none; }
.app-nav-sub {
  display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.app-nav-sub::-webkit-scrollbar { display: none; }
.app-header .app-nav-sub a {
  color: var(--muted); font-size: 13px; font-weight: 500;
  padding: 7px 12px; border-radius: 10px;
  white-space: nowrap; flex-shrink: 0;
}
.app-header .app-nav-sub a.active,
.app-header .app-nav-sub a:hover {
  color: var(--text); background: #fff;
}
.app-header-mid { flex: 1; min-width: 0; }
.app-header .right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.app-header .user {
  font-size: 13px; color: var(--muted);
  max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-chip { display: inline-flex; align-items: center; gap: 8px; }
.user-av {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
  background: #1677ff;
}

.ws-tabs { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ws-tabs a {
  font-size: 13px; font-weight: 600; color: var(--muted);
  padding: 7px 12px; border-radius: 10px; white-space: nowrap;
}
.ws-tabs a:hover { color: var(--text); background: #fff; }
.ws-now {
  font-size: 12px; color: var(--muted); margin-left: 6px;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

body.pick-shell .app-sidebar, body.pick-shell .app-sidebar-mask,
body.pick-shell .app-tabbar, body.pick-shell .app-subbar { display: none !important; }
body.pick-shell .app-header,
body.pick-shell .app-main { margin-left: 0 !important; }
html body .pick-header {
  background: rgba(255, 255, 255, .9) !important;
  color: var(--text);
  border-bottom: 1px solid var(--line) !important;
}
.pick-header .app-sidebar-brand { padding: 0 8px 0 0; height: auto; }
.pick-header .user { color: var(--muted) !important; }
.pick-header .btn.ghost { background: var(--bg); color: var(--text); }
.pick-tabs { display: flex; align-items: center; gap: 4px; flex: 1; }
.pick-tabs a {
  color: var(--muted); font-size: 14px; font-weight: 600;
  padding: 8px 16px; border-radius: 10px; white-space: nowrap;
}
.pick-tabs a.active, .pick-tabs a:hover {
  color: var(--text); background: var(--bg);
  box-shadow: none;
}
.pick-acc { color: var(--muted); font-size: 13px; margin-right: 8px; }
.pick-acc:hover { color: var(--text); }

.app-main {
  margin: 0;
  padding: 20px 20px calc(28px + env(safe-area-inset-bottom));
  max-width: none;
}

.page-head { margin: 0 0 24px; grid-column: 1 / -1; }
.page-head .crumb {
  font-size: 13px; color: var(--muted); font-weight: 500;
  letter-spacing: 0; text-transform: none;
  margin-bottom: 8px;
}
.page-head h1 {
  font-size: 24px; font-weight: 700; letter-spacing: -.03em;
  line-height: 1.2; color: var(--text);
}
.page-head .lede {
  font-size: 14px; color: var(--muted); margin-top: 8px;
  line-height: 1.6; max-width: 46em;
}

.page-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.page-tabs [data-tab] {
  appearance: none; border: none; background: #fff;
  color: var(--muted); font-size: 13px; font-weight: 600;
  padding: 8px 16px; border-radius: 10px; cursor: pointer; font-family: inherit;
}
.page-tabs [data-tab].active {
  color: #fff; background: var(--primary); border-color: transparent;
  box-shadow: none;
}
.page-panel { display: none; }
.page-panel.active { display: block; }

[id^="sec-"] { scroll-margin-top: calc(var(--header-h) + 12px); }

/* ——— Surfaces ——— */
html body .card,
html body section.card {
  background: var(--card);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: none;
  padding: 22px 22px;
  margin-bottom: 16px;
  color: var(--text);
}
.card h2,
section h2 {
  font-size: 16px; font-weight: 650; margin-bottom: 16px;
  display: flex; align-items: center; justify-content: flex-start; gap: 8px; flex-wrap: wrap;
  color: var(--text); border: none; padding-bottom: 0;
}
.card h2 > .btn,
.card h2 > button,
.card h2 > span:last-child,
section h2 > .btn,
section h2 > button,
section h2 > span:last-child { margin-left: auto; }
.card h2 > .btn ~ .btn,
.card h2 > button ~ button,
section h2 > .btn ~ .btn,
section h2 > button ~ button { margin-left: 0; }

/* ——— Buttons ——— */
html body .btn,
html body button.btn,
html body button.ok,
html body .save,
html body .footer-actions .save {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  border-radius: 10px; border: none; cursor: pointer;
  background: var(--primary); color: #fff;
  font-family: inherit;
  box-shadow: none;
  white-space: nowrap;
  transition: transform .12s var(--ease), background .15s var(--ease);
}
html body .btn:hover, html body .save:hover { background: var(--primary-hover); }
html body .btn:active { transform: scale(.98); }
html body .btn.primary { background: var(--primary); color: #fff; border: none; }
html body .btn.ghost,
html body header .btn.ghost,
html body .footer-actions .reset,
html body .modal .btns .cancel,
html body .tier-add {
  background: var(--bg);
  color: var(--text);
  border: none;
  box-shadow: none;
}
html body .btn.danger,
html body .actions button.danger,
html body button.danger,
html body .danger,
html body .danger-box button {
  background: #fff5f5;
  color: var(--danger);
  border: none;
  box-shadow: none;
}
html body .danger-box button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  border-radius: 10px; cursor: pointer; font-family: inherit;
  white-space: nowrap;
}
html body .btn.warn {
  background: #fff9db;
  color: #c48100;
  border: none;
  box-shadow: none;
}
html body .btn.ok {
  background: #e6fcf5;
  color: var(--ok);
  border: none;
  box-shadow: none;
}
html body .btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

html body .actions button,
html body table button,
html body .pending button,
html body .role-list button,
html body .role-slot button {
  margin: 2px 4px 2px 0; padding: 5px 10px; font-size: 12px;
  background: var(--bg);
  border: none;
  border-radius: 8px; cursor: pointer;
  color: var(--text); font-family: inherit;
}
html body .actions button.grant {
  background: #e6fcf5; color: var(--ok); border: none;
}
html body .actions button.revoke,
html body .actions button.danger {
  background: #fff5f5; color: var(--danger); border: none;
}

/* ——— Fields ——— */
html body input,
html body select,
html body textarea {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); font-family: inherit;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
html body input:focus,
html body select:focus,
html body textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(76, 110, 245, .15);
}
html body input::placeholder, html body textarea::placeholder { color: #adb5bd; }
html body label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
html body input[type="checkbox"],
html body input[type="radio"] {
  width: auto; height: auto; min-height: 0;
  padding: 0; margin: 0;
  border: none; background: none; border-radius: 0; box-shadow: none;
  accent-color: var(--primary);
}
option { background: #fff; color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8dee6; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #c5ccd6; }
::-webkit-scrollbar-track { background: transparent; }

html body .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
html body table {
  width: 100%; border-collapse: collapse; min-width: 560px;
  background: transparent; box-shadow: none; border-radius: 0;
}
html body th, html body td {
  padding: 12px 10px; text-align: left; font-size: 13px;
  border-bottom: 1px solid var(--line); color: var(--text);
}
html body th {
  color: var(--muted); font-weight: 500; font-size: 12px;
  background: transparent; letter-spacing: 0;
}
html body tbody tr:hover, html body tr:hover td, html body tr.row-link:hover {
  background: var(--bg);
}

html body .badge,
html body .mode-badge,
html body .status,
html body .type-badge,
html body .tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
html body .badge.on, html body .status.running, html body .badge.lite, html body .mode-badge.lite {
  background: #e6fcf5; color: var(--ok);
}
html body .badge.off, html body .status.stopped, html body .status.draft, html body .status.ended {
  background: var(--bg); color: var(--muted);
}
html body .badge.warn, html body .status.error, html body .status.cancelled {
  background: #fff5f5; color: var(--danger);
}
html body .badge.full, html body .mode-badge.full, html body .badge.daily, html body .type-badge {
  background: var(--primary-soft); color: var(--primary);
}
html body .badge.weekly {
  background: var(--violet-soft); color: var(--violet);
}

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.filters .field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 140px; min-width: 0; }
.lite-note { font-size: 13px; color: var(--muted); line-height: 1.6; margin-bottom: 12px; }
.modal .sec { font-size: 13px; font-weight: 650; margin: 14px 0 8px; color: var(--text); }
.weekdays { display: flex; flex-wrap: wrap; gap: 8px; }
.weekdays label { font-size: 13px; display: flex; align-items: center; gap: 4px; color: var(--text); }

.empty { text-align: center; color: var(--muted); padding: 48px 8px; font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.6; }

html body .modal-mask,
html body .modal-bg {
  display: none; position: fixed; inset: 0; z-index: 100;
  background: transparent;
  align-items: flex-end; justify-content: center;
}
html body .modal-mask::before,
html body .modal-bg::before {
  content: "";
  position: absolute; inset: 0; z-index: 0;
  background: rgba(15, 23, 42, .28);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  pointer-events: none;
}
html body .modal-mask.show, html body .modal-bg.show { display: flex; }
html body .modal {
  background: #fff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  position: relative; z-index: 1;
  pointer-events: auto;
  width: 100%; max-width: 520px;
  border-radius: 20px 20px 0 0;
  padding: 24px 22px calc(22px + max(env(safe-area-inset-bottom, 0px), var(--vv-bottom)));
  max-height: 90vh; overflow: auto;
  border: none;
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
html body .modal input,
html body .modal select,
html body .modal textarea {
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}
html body .modal-bg .modal {
  width: min(720px, calc(100vw - 32px));
  max-width: min(720px, calc(100vw - 32px));
}
html body .modal.wide {
  width: min(640px, calc(100vw - 32px));
  max-width: min(640px, calc(100vw - 32px));
}
html body .modal.xl {
  width: min(760px, calc(100vw - 32px));
  max-width: min(760px, calc(100vw - 32px));
}
html body .modal-mask.nested { z-index: 120; }
html body .modal-mask.nested2 { z-index: 130; }
.form-kv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px 12px; align-items: center; margin-bottom: 14px; }
.form-kv label { margin: 0; font-size: 13px; color: var(--text); }
.form-kv .req { color: var(--danger); margin-right: 2px; }
.style-swatches { display: flex; gap: 10px; align-items: center; }
.style-swatches .swatch {
  width: 36px; height: 22px; border-radius: 6px; border: 2px solid transparent;
  cursor: pointer; padding: 0;
}
.style-swatches .swatch.selected { border-color: var(--primary); }
.style-swatches .swatch.gray { background: #d9d9d9; }
.style-swatches .swatch.red { background: #ff4d4f; }
.style-swatches .swatch.blue { background: #4c6ef5; }
.style-swatches .swatch.green { background: #52c41a; }
.icon-line { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.icon-line a { color: var(--primary); cursor: pointer; }
.btn-chip { cursor: pointer; }
.btn-chip.style-red { background: #fff1f0; color: #cf1322; }
.btn-chip.style-blue { background: var(--primary-soft); color: var(--primary); }
.btn-chip.style-green { background: #f6ffed; color: #389e0d; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 12px;
}
.modal-head h3 { margin-bottom: 0; }
.modal-x {
  width: 32px; height: 32px; border: none; background: var(--bg); color: var(--muted);
  border-radius: 8px; cursor: pointer; font-size: 18px; line-height: 1;
}
.modal-tabs {
  display: flex; gap: 4px; margin: 0 0 18px; border-bottom: 1px solid var(--line);
}
.modal-tabs button {
  appearance: none; border: none; background: none; cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 600;
  color: var(--muted); padding: 8px 12px 10px; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
}
.modal-tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.modal-pane { display: none; }
.modal-pane.active { display: block; }
.kw-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  min-height: 42px; padding: 6px 8px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: #fff;
}
.kw-tags .tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-soft); color: var(--primary);
  border-radius: 8px; padding: 2px 8px; font-size: 13px;
}
.kw-tags .tag button { border: none; background: none; cursor: pointer; color: inherit; font-size: 14px; padding: 0; }
.kw-tags input { border: none !important; box-shadow: none !important; flex: 1; min-width: 80px; padding: 4px !important; }
.notice-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; }
.notice-row span { font-size: 13px; }
.cond-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin: 8px 0 16px; }
.cond-grid label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); margin: 0; }
.status-on { color: var(--ok); font-weight: 600; }
.status-off { color: var(--muted); }
.more-menu { position: relative; display: inline-block; }
.more-menu summary { list-style: none; cursor: pointer; color: var(--primary); font-size: 13px; }
.more-menu summary::-webkit-details-marker { display: none; }
.more-menu .drop {
  position: absolute; right: 0; top: 100%; z-index: 30;
  background: #fff; border-radius: 10px; box-shadow: var(--shadow-lg);
  min-width: 100px; padding: 6px;
}
.more-menu .drop button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 8px 10px; cursor: pointer; font-size: 13px; color: var(--text); }
.btn-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.btn-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg); border-radius: 8px; padding: 6px 10px; font-size: 13px;
}
.dash-add {
  border: 1px dashed var(--line-strong); background: none; color: var(--muted);
  border-radius: 10px; padding: 10px; width: 100%; cursor: pointer; font-family: inherit;
}
.var-hint { font-size: 12px; color: var(--muted); line-height: 1.6; margin-top: 8px; }
.preview-box {
  background: var(--bg); border-radius: 12px; padding: 14px; white-space: pre-wrap;
  font-size: 14px; line-height: 1.6; min-height: 80px;
}
html body .modal h3, html body .modal h2 { font-size: 17px; margin-bottom: 16px; font-weight: 650; }
html body .modal .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
html body .modal .btns .ok {
  background: var(--primary); color: #fff; border: none;
  padding: 8px 16px; border-radius: 10px; cursor: pointer;
  box-shadow: none;
}
html body .modal fieldset {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 14px;
}
html body .modal fieldset legend { padding: 0 6px; font-size: 12px; color: var(--muted); }

html body .toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  padding: 10px 18px; border-radius: 10px; color: #fff; font-size: 13px;
  display: none; z-index: 200; max-width: 90%;
  box-shadow: var(--shadow-lg);
}
html body .toast.ok { background: var(--ok); }
html body .toast.err { background: var(--danger); }

@keyframes ios-sheet-in {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
@keyframes ios-sheet-out {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}
@keyframes ios-dim-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes ios-dim-out {
  from { opacity: 1; }
  to { opacity: 0; }
}
body.modal-open { overflow: hidden; }

@media (max-width: 859px) {
  :root {
    --header-h: 44px;
    --tabbar-h: 0px;
    --subbar-h: 0px;
    --bg: #f2f2f7;
    --line: rgba(60, 60, 67, .18);
    --primary: #e09a2b;
    --primary-hover: #c7861c;
    --primary-soft: rgba(224, 154, 43, .16);
    --danger: #ff3b30;
    --ok: #34c759;
  }
  body.has-tabbar { --tabbar-h: 58px; }
  body.has-subbar { --subbar-h: 44px; }

  .app-header .user,
  .app-header .ws-tabs,
  .app-header .right,
  .app-header .app-nav-sub,
  .app-header-mid,
  .app-menu-txt { display: none !important; }

  html body .app-header,
  html body header.app-header {
    position: sticky;
    flex-wrap: nowrap;
    height: calc(44px + env(safe-area-inset-top));
    min-height: calc(44px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 2px 0;
    gap: 0;
    background: rgba(255, 255, 255, .86);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid rgba(60, 60, 67, .18);
    overflow: visible;
  }

  .app-menu-btn {
    position: relative; z-index: 2;
    width: 44px; min-width: 44px; height: 44px; padding: 0;
    background: none; color: #000;
    border-radius: 0; box-shadow: none;
  }
  .app-menu-btn:active { transform: none; opacity: .5; }
  body.sidebar-open .app-menu-btn { background: none; }
  .app-menu-ico { width: 18px; gap: 4px; }
  .app-menu-ico span { height: 1.5px; background: #000; border-radius: 1px; }
  .app-menu-btn svg { width: 6px; height: 10px; display: block; }

  .app-header-title {
    display: block;
    position: absolute;
    left: 48px; right: 48px;
    top: env(safe-area-inset-top);
    height: 44px; line-height: 44px;
    text-align: center;
    font-size: 17px; font-weight: 600; color: #000;
    pointer-events: none;
  }

  .app-nav-more {
    display: inline-flex; align-items: center; justify-content: center;
    position: absolute; right: 0; top: env(safe-area-inset-top); z-index: 2;
    width: 44px; height: 44px; margin: 0; flex-shrink: 0;
    border: none; background: none; cursor: pointer;
    padding: 0; color: #1c1c1e;
    font-size: 22px; font-weight: 700; letter-spacing: 1px;
    font-family: inherit; line-height: 1;
  }
  .app-nav-more:active { opacity: .5; }

  .app-subbar {
    display: flex; align-items: stretch;
    position: sticky;
    top: calc(44px + env(safe-area-inset-top));
    z-index: 45;
    height: 44px;
    padding: 0 6px;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid var(--line);
  }
  .app-subbar[hidden] { display: none !important; }
  .app-subbar::-webkit-scrollbar { display: none; }
  .app-subbar a {
    flex: 0 0 auto;
    display: flex; align-items: center;
    padding: 0 12px;
    font-size: 15px; font-weight: 500; color: var(--muted);
    white-space: nowrap; position: relative;
  }
  .app-subbar a.active {
    color: var(--text); font-weight: 650;
  }
  .app-subbar a.active::after {
    content: "";
    position: absolute; left: 10px; right: 10px; bottom: 0;
    height: 2px; border-radius: 2px 2px 0 0;
    background: var(--primary);
  }

  .app-tabbar[hidden] { display: none !important; }
  .app-tabbar {
    display: flex;
    flex-wrap: nowrap;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(58px + env(safe-area-inset-bottom));
    padding: 0 0 env(safe-area-inset-bottom);
    background: #fff;
    border-top: 1px solid rgba(0, 0, 0, .06);
    justify-content: space-around;
    align-items: stretch;
    overflow: hidden;
    transition: transform .22s var(--ease);
  }
  .app-tab {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 0;
    color: #9a8fa0;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }
  .app-tab.active { color: #e09a2b; }
  .app-tab.active .app-tab-lab { font-weight: 700; }
  .app-tab:active { opacity: .55; }
  .app-tab svg { width: 20px; height: 20px; display: block; }
  .app-menu-btn,
  .app-nav-more,
  .app-tab,
  .app-subbar a,
  .app-sheet-btn { touch-action: manipulation; }
  .app-tab-ico { font-size: 20px; line-height: 1; display: flex; align-items: center; justify-content: center; height: 20px; }
  .app-tab-lab {
    font-size: 13px; font-weight: 500; line-height: 1.2;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    padding: 0 2px;
  }
  body:has(.modal-mask.show) .app-tabbar,
  body:has(.modal-bg.show) .app-tabbar,
  body:has(.app-sheet-mask.show) .app-tabbar,
  body:has(.dtp-mask.show) .app-tabbar,
  body.sidebar-open .app-tabbar,
  body.modal-open .app-tabbar {
    transform: translateY(110%);
    pointer-events: none;
  }

  .app-sheet-mask {
    display: none;
    position: fixed; inset: 0; z-index: 180;
    background: rgba(0, 0, 0, .4);
    align-items: flex-end; justify-content: center;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .app-sheet-mask.show { display: flex; animation: ios-dim-in .22s ease; }
  .app-sheet-mask.show.ios-out { animation: ios-dim-out .22s ease forwards; }
  .app-sheet-mask.show .app-sheet { animation: ios-sheet-in .36s cubic-bezier(.32, .72, 0, 1); }
  .app-sheet-mask.show.ios-out .app-sheet { animation: ios-sheet-out .26s ease-in forwards; }
  .app-sheet { width: 100%; max-width: 500px; position: relative; z-index: 1; }
  .app-sheet-group {
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 8px;
  }
  .app-sheet-btn {
    display: block; width: 100%; height: 56px;
    border: none; border-bottom: 0.5px solid var(--line);
    background: none; cursor: pointer;
    font-family: inherit; font-size: 17px; font-weight: 400;
    color: var(--primary); text-align: center; text-decoration: none;
    line-height: 56px;
  }
  .app-sheet-btn:last-child { border-bottom: none; }
  .app-sheet-btn:active { background: #e5e5ea; }
  .app-sheet-btn.danger { color: var(--danger); }
  .app-sheet-btn.cancel { font-weight: 650; color: var(--primary); }

  .app-sidebar {
    width: 100%;
    transform: translateX(-100%);
    transition: transform .34s cubic-bezier(.32, .72, 0, 1);
    box-shadow: none;
    border-right: none;
    background: var(--bg);
    overflow: hidden;
  }
  body.sidebar-open .app-sidebar-mask { display: none; }
  html body .app-sidebar-brand {
    position: relative;
    flex: 0 0 auto;
    height: calc(44px + env(safe-area-inset-top));
    min-height: calc(44px + env(safe-area-inset-top));
    justify-content: flex-start;
    padding: env(safe-area-inset-top) 8px 0;
    background: rgba(255, 255, 255, .86);
    border-bottom: 0.5px solid rgba(60, 60, 67, .18);
  }
  .app-sidebar-brand .brand-mark,
  .app-sidebar-brand .app-sidebar-name,
  .app-sidebar-brand small { display: none; }
  .app-sidebar-name-m {
    display: block;
    position: absolute; left: 0; right: 0;
    text-align: center; pointer-events: none;
    font-size: 17px; font-weight: 600; color: #000;
  }
  .app-sidebar-close {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0 0 0 2px; margin: 0;
    background: none; color: #000;
    border-radius: 0; font-size: 17px; font-weight: 400;
    z-index: 1;
  }
  .app-sidebar-close svg { width: 6px; height: 10px; display: block; }
  .app-sidebar-back-ico,
  .app-sidebar-close-txt { display: none; }
  html body .app-sidebar-ws {
    display: block;
    flex: 0 0 auto;
    margin: 12px 16px 8px;
    padding: 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
  }
  html body .app-sidebar-ws .ws-now {
    display: block;
    max-width: none;
    margin: 0;
    padding: 10px 16px;
    font-size: 13px; font-weight: 500; color: var(--muted);
    border-bottom: 0.5px solid var(--line);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  html body .app-sidebar-ws .ws-tabs {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start;
    gap: 0 !important;
    width: 100%;
  }
  html body .app-sidebar-ws .ws-tabs a {
    display: flex !important;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
    width: 100% !important;
    max-width: none !important;
    min-height: 44px;
    margin: 0;
    font-size: 17px !important;
    font-weight: 400 !important;
    color: var(--text) !important;
    background: #fff !important;
    padding: 11px 16px !important;
    border-radius: 0 !important;
    border-bottom: 0.5px solid var(--line);
    text-align: left;
    white-space: nowrap;
  }
  html body .app-sidebar-ws .ws-tabs a:last-child { border-bottom: none; }
  html body .app-sidebar-ws .ws-tabs a::after {
    content: "";
    margin-left: auto;
    width: 8px; height: 8px; flex-shrink: 0;
    border-right: 2px solid #c7c7cc;
    border-bottom: 2px solid #c7c7cc;
    transform: rotate(-45deg);
  }
  html body .app-sidebar-ws .ws-tabs a:active { background: #e5e5ea !important; }
  html body .app-nav-primary {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 16px 12px;
    gap: 14px;
  }
  html body .app-sidebar-account {
    margin: 0 16px calc(12px + env(safe-area-inset-bottom));
    padding: 0;
    border-top: none;
    border-radius: 12px;
    overflow: hidden;
  }
  html body .app-sidebar-account .nested,
  html body .app-sidebar-account .acc-now,
  html body .app-sidebar-account .acc-bot {
    width: 100%;
    min-height: 44px;
    margin: 0;
    padding: 10px 16px 10px 44px;
    font-size: 17px;
    border-radius: 0;
    border-bottom: 0.5px solid var(--line);
  }
  html body .app-sidebar-account .acc-now,
  html body .app-sidebar-account .acc-bot { padding-left: 16px; }
  html body .app-sidebar-account .acc-logout { border-bottom: none; }
  .app-nav-sec {
    background: #fff; border-radius: 12px; overflow: hidden;
    padding: 0;
    flex: 0 0 auto;
  }
  .app-nav-sec + .app-nav-sec {
    margin-top: 0; padding-top: 0; border-top: none;
  }
  .app-nav-sec-label {
    padding: 8px 16px 0;
    font-size: 13px; color: var(--muted); font-weight: 500;
  }
  .app-nav-toggle,
  .app-nav-primary a {
    min-height: 44px;
    padding: 11px 16px;
    font-size: 17px;
    border-radius: 0;
    color: var(--text);
    border-bottom: 0.5px solid var(--line);
  }
  .app-nav-sec > *:last-child,
  .app-nav-sec > .app-nav-block:last-child > *:last-child,
  .app-nav-primary a.nested:last-child {
    border-bottom: none;
  }
  .app-nav-toggle:hover,
  .app-nav-block:not(.collapsed) .app-nav-toggle,
  .app-nav-primary a:hover,
  .app-nav-primary a.active {
    background: transparent;
  }
  .app-nav-primary a:active,
  .app-nav-toggle:active { background: #e5e5ea; }
  .app-nav-primary a.active { color: var(--primary); font-weight: 650; }
  .app-nav-primary a:not(.nested)::after,
  .app-nav-primary a.nested::after {
    content: "";
    margin-left: auto;
    width: 8px; height: 8px; flex-shrink: 0;
    border-right: 2px solid #c7c7cc;
    border-bottom: 2px solid #c7c7cc;
    transform: rotate(-45deg);
  }
  .app-nav-primary a.nested {
    min-height: 44px;
    margin: 0;
    padding: 10px 16px 10px 44px;
    font-size: 17px;
    color: var(--text);
  }
  .app-nav-primary a.nested::before { display: none; }
  .app-nav-primary a.nested.active { color: var(--primary); }
  .app-nav-block.current .app-nav-toggle { color: var(--text); font-weight: 500; }

  .page-head { margin: 0 0 12px; }
  .page-head .crumb,
  .page-head h1 { display: none; }
  .page-head .lede {
    margin: 0;
    padding: 10px 12px;
    background: #fff;
    border-radius: 12px;
    font-size: 13px;
  }
  .page-head:not(:has(.lede)) { display: none; }

  .page-tabs {
    background: var(--bg);
    border-radius: 10px;
    padding: 2px;
    gap: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
  }
  .page-tabs [data-tab] {
    flex: 1 0 auto;
    min-height: 32px;
    padding: 6px 12px;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-align: center;
  }
  .page-tabs [data-tab].active {
    background: #fff;
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  }

  html body .btn,
  html body button.btn,
  html body button.ok,
  html body .save,
  html body .footer-actions .save,
  html body .modal .btns .ok,
  html body .danger-box button {
    min-height: 44px;
    padding: 11px 16px;
    font-size: 17px;
    font-weight: 600;
    border-radius: 12px;
    letter-spacing: -.02em;
    white-space: nowrap;
  }
  html body .app-main .btns {
    display: flex; flex-direction: column; gap: 10px;
    margin-top: 16px;
  }
  html body .app-main .btns > button {
    width: 100%;
    flex: none;
    min-height: 50px;
  }
  html body .field-row.inline {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    gap: 12px;
    cursor: pointer;
  }
  html body .field-row.inline > span,
  html body .field-row.inline > label {
    margin: 0;
    flex: 1;
    font-size: 16px;
    color: var(--text);
  }
  html body .app-main .card > button.ok,
  html body .app-main .card > button.save,
  html body .app-main p > button.save {
    width: 100%;
  }
  html body .danger-box button {
    display: flex;
    width: 100%;
    min-height: 50px;
    background: #ff3b30;
    color: #fff;
    border-radius: 14px;
  }
  html body .tier-row button {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 8px 14px;
    background: #ff3b30;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
  }
  html body .lv-row {
    grid-template-columns: minmax(0, 1fr) minmax(72px, 90px) auto !important;
    gap: 6px;
  }
  html body .lv-row input { min-width: 0; }
  html body .lv-row button {
    min-width: 52px;
    min-height: 44px;
    padding: 0 8px;
    background: none !important;
    color: #ff3b30 !important;
    border: none !important;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    white-space: nowrap;
  }
  html body .btn:active,
  html body button.btn:active,
  html body button.ok:active,
  html body .save:active,
  html body .danger-box button:active,
  html body .tier-row button:active { opacity: .55; transform: none; }
  html body .btn.ghost,
  html body header .btn.ghost,
  html body .footer-actions .reset,
  html body .modal .btns .cancel,
  html body .tier-add {
    background: #f2f2f7 !important;
    color: var(--text) !important;
    border: none !important;
  }
  html body .btn.danger,
  html body .actions button.danger,
  html body button.danger,
  html body .danger-box button {
    background: #ff3b30;
    color: #fff;
  }
  html body .app-sheet-btn.danger {
    background: none;
    color: #ff3b30;
  }
  html body .btn,
  html body button.btn,
  html body .save,
  html body .modal .btns button,
  html body .footer-actions button,
  html body .create-actions button {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  html body .actions button,
  html body table button,
  html body .pending button,
  html body .role-list button,
  html body .role-slot button {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 15px;
    font-weight: 500;
    background: none;
    color: var(--primary);
    border-radius: 8px;
  }
  html body .actions button.danger,
  html body table button.danger,
  html body .pending button.danger {
    background: none;
    color: #ff3b30;
  }
  html body .actions button.grant {
    background: none;
    color: var(--ok);
  }
  html body .card h2 > .btn,
  html body .card h2 > button,
  html body section h2 > .btn,
  html body section h2 > button {
    min-height: 32px;
    padding: 6px 14px;
    font-size: 15px;
    border-radius: 999px;
  }

  .card h2 > .btn,
  .card h2 > button,
  section h2 > .btn,
  section h2 > button {
    margin-left: 0;
  }
  .pick-header .pick-acc {
    margin-right: 0;
    padding: 8px 10px;
    background: #fff;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 650;
  }
  html body .pick-header {
    padding-bottom: 10px;
    height: auto;
    min-height: calc(44px + env(safe-area-inset-top));
    flex-wrap: wrap;
  }
  .pick-header .user-chip,
  .pick-header .user { display: none !important; }
  .pick-tabs {
    flex: 1 1 100%;
    order: 5;
    background: var(--bg);
    border-radius: 10px;
    padding: 2px;
    gap: 0;
  }
  .pick-tabs a {
    flex: 1;
    justify-content: center;
    text-align: center;
    padding: 8px 10px;
  }
  .pick-tabs a.active {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
  }
  .pick-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .grid, .grid-2, .page-split { grid-template-columns: 1fr !important; }
  .grid > *, .grid-2 > * { grid-column: 1 / -1 !important; min-width: 0; }
  html body .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: min(92dvh, 92vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 10px 16px 0;
  }
  html body .modal:not(:has(.btns)) {
    padding-bottom: calc(16px + max(env(safe-area-inset-bottom, 0px), var(--vv-bottom)));
  }
  html body .modal-mask.show::before,
  html body .modal-bg.show::before { animation: ios-dim-in .22s ease; }
  html body .modal-mask.show .modal,
  html body .modal-bg.show .modal {
    animation: ios-sheet-in .38s cubic-bezier(.32, .72, 0, 1);
    border-radius: 14px 14px 0 0;
  }
  html body .modal-mask.show.ios-out::before,
  html body .modal-bg.show.ios-out::before { animation: ios-dim-out .22s ease forwards; }
  html body .modal-mask.show.ios-out .modal,
  html body .modal-bg.show.ios-out .modal { animation: ios-sheet-out .26s ease-in forwards; }
  html body .modal::before {
    content: "";
    display: block;
    width: 36px; height: 5px;
    margin: 2px auto 12px;
    background: #c7c7cc;
    border-radius: 99px;
  }
  html body #createModal,
  html body #modalDetail {
    align-items: stretch;
  }
  html body #createModal .modal,
  html body #modalDetail .modal {
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    padding-top: env(safe-area-inset-top);
  }
  html body #createModal .modal::before,
  html body #modalDetail .modal::before { display: none; }
  html body .modal-head {
    position: sticky; top: 0; z-index: 2;
    min-height: 44px;
    margin: -4px -16px 14px;
    padding: 0 16px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
  }
  html body .modal-head h3,
  html body .modal h3 {
    font-size: 17px;
    font-weight: 650;
    letter-spacing: -.02em;
    text-align: center;
    flex: 1;
  }
  html body .modal-x {
    width: 30px; height: 30px; border-radius: 50%;
    background: #f2f2f7; color: #8e8e93;
    font-size: 17px; font-weight: 500;
  }
  html body .modal-x:active { opacity: .5; }
  html body .modal .btns {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: stretch;
    gap: 10px;
    position: sticky;
    bottom: 0;
    z-index: 3;
    margin: 16px -16px 0;
    padding: 12px 16px calc(12px + max(env(safe-area-inset-bottom, 0px), var(--vv-bottom)));
    border-top: 0.5px solid rgba(60, 60, 67, .18);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: saturate(180%) blur(16px);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
  }
  html body .modal .btns:has(:nth-child(3)) {
    flex-direction: column;
    gap: 8px;
  }
  html body .modal .btns .btn,
  html body .modal .btns button {
    flex: 1;
    width: auto;
    margin: 0;
    min-height: 50px;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 600;
    background: #f2f2f7;
    color: var(--text);
  }
  html body .modal .btns:has(:nth-child(3)) .btn,
  html body .modal .btns:has(:nth-child(3)) button {
    flex: none;
    width: 100%;
  }
  html body .modal .btns .ok,
  html body .modal .btns .btn:not(.ghost):not(.cancel):not(.danger) {
    background: var(--primary);
    color: #fff;
  }
  html body .modal .btns .cancel,
  html body .modal .btns .btn.ghost {
    background: #f2f2f7 !important;
    color: var(--text) !important;
  }
  html body .modal .btns button.danger,
  html body .modal .btns .btn.danger {
    background: #f2f2f7;
    color: #ff3b30;
  }
  html body .modal .btns button:active,
  html body .modal .btns .btn:active { opacity: .55; transform: none; }
  html body .modal-tabs {
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  html body .modal-tabs button {
    font-size: 15px;
    padding: 10px 14px;
    white-space: nowrap;
  }
  html body input:not([type="checkbox"]):not([type="radio"]),
  html body select,
  html body textarea {
    min-height: 44px;
    border-radius: 10px;
    background: #f2f2f7;
    border: 1px solid transparent;
  }
  html body textarea { min-height: 88px; }
  html body input:focus,
  html body select:focus,
  html body textarea:focus {
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(224, 154, 43, .28);
  }
  html body .modal input:not([type="checkbox"]):not([type="radio"]),
  html body .modal select,
  html body .modal textarea {
    background: #fff;
    border: 0.5px solid rgba(60, 60, 67, .18);
  }
  html body .modal input:focus,
  html body .modal select:focus,
  html body .modal textarea:focus {
    background: #fff;
    border-color: var(--primary);
  }
  html body .modal .kw-box,
  html body .modal .kw-tags {
    background: #fff;
    border: 0.5px solid rgba(60, 60, 67, .18);
  }
  html body .modal .kw-box input,
  html body .modal .kw-tags input {
    background: transparent;
    border: none;
    min-height: 32px;
    padding: 4px 8px;
  }
  html body .radio-group {
    flex-direction: column;
    gap: 0;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
  }
  html body .radio-group label {
    min-width: 0;
    border: none;
    border-radius: 0;
    border-bottom: 0.5px solid var(--line);
    background: #fff;
    padding: 14px 16px;
  }
  html body .radio-group label:last-child { border-bottom: none; }
  html body .radio-group label:has(input:checked) {
    background: #fff;
    box-shadow: none;
  }
  html body .radio-group label:has(input:checked) .name { color: var(--primary); }
  html body .app-sheet-btn:active { background: #e5e5ea; }
  html body .toast {
    border-radius: 20px;
    padding: 12px 18px;
    font-size: 14px;
    background: rgba(28, 28, 30, .9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  .modal .row, .modal .row-3,
  .create-form .row, .create-form .row-3 { grid-template-columns: 1fr !important; }
  html body .form-kv,
  html body .cond-grid {
    grid-template-columns: 1fr !important;
    gap: 6px;
    align-items: stretch;
  }
  html body .form-kv > label,
  html body .form-kv.top > label {
    padding-top: 0 !important;
    font-size: 13px;
    color: #8e8e93;
  }
  .app-main {
    padding: 12px 16px calc(24px + var(--tabbar-h) + env(safe-area-inset-bottom));
  }
  html body.has-tabbar .app-main {
    padding-bottom: calc(24px + var(--tabbar-h) + env(safe-area-inset-bottom)) !important;
  }
  html body .card, html body section.card {
    padding: 14px 16px;
    border-radius: 18px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
  }
  .app-nav-primary .ico,
  .app-nav-toggle .ico,
  .app-nav-label .ico { display: none; }
  html body .app-main .card:has(.table-wrap),
  html body .app-main section.card:has(.table-wrap) {
    background: transparent;
    box-shadow: none;
    padding: 4px 0 0;
  }
  html body .app-main .card:has(.table-wrap) > h2,
  html body .app-main section.card:has(.table-wrap) > h2 {
    padding: 0 4px 10px;
  }
  .filters .field { flex: 1 1 100%; }
  .filters select, .filters input { min-width: 0 !important; width: 100%; }
  .stat-row { flex-wrap: wrap; }
  .stat-row input[type="text"],
  .stat-row input[type="number"] { width: 100% !important; max-width: none; }
  .pending li, .role-list li, .role-slot {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .pending .actions, .role-list .actions, .role-slot .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }
  .pending .actions select { flex: 1 1 140px; min-width: 0; }
  .tier-row { flex-wrap: wrap; }
  .tier-row input { width: auto; flex: 1 1 88px; min-width: 0; }
  .btn-editor-btn { flex-wrap: wrap; }
  .btn-editor-btn input[data-f="text"],
  .btn-editor-btn input[data-f="url"] { flex: 1 1 100%; min-width: 0; }
  .notice-row { flex-wrap: wrap; }
  #critBox .prize-row, .create-form .prize-row, .prize-grid { grid-template-columns: 1fr; }
  section.disabled::after { white-space: normal; max-width: calc(100% - 32px); text-align: center; }
  .code { font-size: 32px; letter-spacing: .16em; padding-left: .16em; }

  html body .app-main .table-wrap,
  html body .modal .table-wrap {
    overflow: visible;
    margin: 0;
  }
  html body .app-main .table-wrap table,
  html body .modal .table-wrap table,
  html body #userTable {
    display: block;
    min-width: 0 !important;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
    background: transparent;
  }
  html body .app-main .table-wrap tbody,
  html body .modal .table-wrap tbody {
    display: block;
    width: 100%;
  }
  html body .app-main .table-wrap thead,
  html body .modal .table-wrap thead { display: none; }
  html body .app-main .table-wrap tbody tr,
  html body .modal .table-wrap tbody tr {
    display: block;
    background: #fff;
    border-radius: 12px;
    box-shadow: none;
    padding: 4px 0;
    margin: 0 0 10px;
    overflow: visible;
    max-width: 100%;
  }
  html body .app-main .table-wrap tbody tr:has(details[open]),
  html body .modal .table-wrap tbody tr:has(details[open]) {
    position: relative;
    z-index: 8;
  }
  html body .app-main .table-wrap tbody td,
  html body .modal .table-wrap tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border: none;
    border-bottom: 0.5px solid var(--line);
    padding: 11px 16px;
    font-size: 15px;
    min-width: 0;
  }
  html body .app-main .table-wrap tbody tr > td:last-child,
  html body .modal .table-wrap tbody tr > td:last-child { border-bottom: none; }
  html body .app-main .table-wrap tbody td.actions,
  html body .modal .table-wrap tbody td.actions {
    justify-content: flex-end;
  }
  html body .app-main .table-wrap tbody td.actions::before,
  html body .modal .table-wrap tbody td.actions::before { display: none; }
  html body .app-main .table-wrap tbody td.actions .td-val,
  html body .modal .table-wrap tbody td.actions .td-val {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    text-align: right;
  }
  html body .app-main .table-wrap tbody td.actions .more-menu summary,
  html body .modal .table-wrap tbody td.actions .more-menu summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 6px 10px;
    font-size: 15px;
    border-radius: 8px;
  }
  html body .app-main .table-wrap tbody td::before,
  html body .modal .table-wrap tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    white-space: nowrap;
  }
  html body .app-main .table-wrap tbody td .td-val,
  html body .modal .table-wrap tbody td .td-val {
    flex: 1 1 0;
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  html body .app-main .table-wrap tbody td > *,
  html body .modal .table-wrap tbody td > * {
    min-width: 0;
  }
  html body .app-main .table-wrap tbody td:not([data-label])::before,
  html body .modal .table-wrap tbody td:not([data-label])::before { display: none; }
  html body .app-main .table-wrap tbody td[colspan],
  html body .modal .table-wrap tbody td[colspan] {
    display: block;
    text-align: center;
    justify-content: center;
  }
  html body .app-main .table-wrap tbody td[colspan]::before,
  html body .modal .table-wrap tbody td[colspan]::before { display: none; }
  html body .app-main .table-wrap tbody td .actions,
  html body .modal .table-wrap tbody td .actions {
    display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px;
  }

  html body .footer-actions,
  html body .create-actions {
    position: sticky;
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    z-index: 8;
    display: flex;
    gap: 8px;
    margin: 8px -16px 0;
    padding: 10px 16px;
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 0.5px solid var(--line);
    text-align: left;
    background-image: none;
  }
  html body .footer-actions button,
  html body .create-actions button {
    flex: 1;
    margin: 0;
  }

  html body .toast {
    bottom: calc(12px + var(--tabbar-h) + env(safe-area-inset-bottom));
  }

  html body input.ios-switch {
    appearance: none !important; -webkit-appearance: none !important;
    width: 51px !important; height: 31px !important;
    margin: 0 !important; padding: 0 !important; flex-shrink: 0;
    border: none !important; border-radius: 999px !important; cursor: pointer;
    background-color: #d1d1d6 !important;
    background-image: radial-gradient(circle closest-side, #fff 0, #fff 11px, transparent 12px) !important;
    background-size: 27px 27px !important;
    background-position: 2px 50% !important;
    background-repeat: no-repeat !important;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.08) !important;
    transition: background-color .2s ease, background-position .2s ease;
  }
  html body input.ios-switch::before,
  html body input.ios-switch::after { content: none !important; display: none !important; }
  html body input.ios-switch:checked {
    background-color: #34c759 !important;
    background-position: calc(100% - 2px) 50% !important;
  }
  html body input.ios-switch:focus { box-shadow: inset 0 0 0 1px rgba(0,0,0,.08) !important; }

  html body .card.filters {
    display: block;
    padding: 0;
    overflow: hidden;
  }
  html body .card.filters .field,
  html body .card.filters .q-row {
    flex: none;
    width: 100%;
    margin: 0;
    padding: 8px 16px 10px;
    border-bottom: 0.5px solid rgba(60, 60, 67, .18);
    gap: 4px;
  }
  html body .card.filters .field:last-child,
  html body .card.filters .q-row:last-child { border-bottom: none; }
  html body .card.filters label,
  html body .card .field-row > label,
  html body .card .field > label {
    font-size: 13px;
    font-weight: 400;
    color: #8e8e93;
  }
  html body .card.filters select,
  html body .card.filters input:not([type="checkbox"]):not([type="radio"]) {
    min-height: 36px;
    padding-left: 0;
    padding-right: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    font-size: 17px;
  }
  html body .card.filters select:focus,
  html body .card.filters input:focus {
    background: transparent;
    border: none;
    box-shadow: none;
  }
  html body .card .field-row {
    padding: 4px 0 12px;
    border-bottom: 0.5px solid rgba(60, 60, 67, .12);
  }
  html body .card .field-row:last-child { border-bottom: none; padding-bottom: 0; }
  html body .app-main > p,
  html body .hint,
  html body .tip {
    background: transparent;
    border: none;
    color: #8e8e93;
    border-radius: 0;
    font-size: 13px;
    line-height: 1.45;
  }
  html body .tip { margin: 0 0 12px; padding: 0 4px; }
  html body .detail-grid { grid-template-columns: 1fr !important; gap: 12px; }
  html body .msg-sum { grid-template-columns: 1fr 1fr !important; }
  html body .pager { justify-content: center; }
  html body .card h2,
  html body section h2 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -.02em;
  }
  html body .empty {
    color: #8e8e93;
    font-size: 15px;
    padding: 28px 12px;
  }

  html body #listPanel .card > h2 {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  html body #listPanel .card > h2 .btn,
  html body #listPanel .card > h2 select.toolbar-select {
    width: 100%;
    margin-left: 0;
    min-height: 44px;
  }

  /* 手机表格保持原列，横向滑动。不再把每一行拆成一叠标签。 */
  html body .app-main .card:has(.table-wrap),
  html body .app-main section.card:has(.table-wrap) {
    background: #fff;
    padding: 12px 0 8px;
    overflow: hidden;
  }
  html body .app-main .table-wrap,
  html body .modal .table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    margin: 0;
  }
  html body .app-main .table-wrap table,
  html body .modal .table-wrap table,
  html body #userTable {
    display: table !important;
    width: max-content;
    min-width: 100% !important;
    border-collapse: collapse;
    border-spacing: 0;
    background: #fff;
  }
  html body .app-main .table-wrap thead,
  html body .modal .table-wrap thead { display: table-header-group !important; }
  html body .app-main .table-wrap tbody,
  html body .modal .table-wrap tbody { display: table-row-group !important; }
  html body .app-main .table-wrap tr,
  html body .modal .table-wrap tr {
    display: table-row !important;
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
  }
  html body .app-main .table-wrap th,
  html body .app-main .table-wrap td,
  html body .modal .table-wrap th,
  html body .modal .table-wrap td {
    display: table-cell !important;
    width: auto;
    padding: 10px 12px;
    font-size: 13px;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--line);
    justify-content: flex-start;
  }
  html body .app-main .table-wrap td::before,
  html body .modal .table-wrap td::before { content: none !important; display: none !important; }
  html body .app-main .table-wrap td .td-val,
  html body .modal .table-wrap td .td-val {
    display: inline;
    text-align: left;
  }
  html body .app-main .table-wrap td.actions,
  html body .modal .table-wrap td.actions { white-space: nowrap; }
  html body table button,
  html body .actions button,
  html body .more-menu summary {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
  }
  html body .app-main input:not([type="checkbox"]):not([type="radio"]):not(.ios-switch),
  html body .app-main select,
  html body .app-main textarea,
  html body .modal input:not([type="checkbox"]):not([type="radio"]):not(.ios-switch),
  html body .modal select,
  html body .modal textarea {
    background: #fff;
    border: 1px solid rgba(60, 60, 67, .28);
    border-radius: 10px;
    font-size: 16px;
    min-height: 44px;
  }
  html body .card.filters input:not([type="checkbox"]):not([type="radio"]),
  html body .card.filters select {
    font-size: 16px;
    min-height: 44px;
    background: transparent;
    border: none;
    border-radius: 0;
  }
  html body button:focus-visible,
  html body a:focus-visible,
  html body input:focus-visible,
  html body select:focus-visible,
  html body textarea:focus-visible,
  html body summary:focus-visible {
    outline: 2px solid #e09a2b;
    outline-offset: 2px;
  }
  html body .app-main .card,
  html body .app-main section.card {
    border-radius: 12px;
    box-shadow: none;
  }
  html body .app-nav-sec {
    background: transparent;
    border-radius: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  html body .app-nav-block {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
  }
  html body .app-nav-primary > .app-nav-sec > a {
    background: #fff;
    border-radius: 12px;
    border-bottom: none;
  }
  html body .app-nav-toggle,
  html body .app-nav-primary a,
  html body .app-sidebar-close,
  html body .app-menu-btn,
  html body .app-nav-more {
    min-height: 44px;
    min-width: 44px;
  }
  html body table button,
  html body .actions button,
  html body .more-menu summary {
    min-height: 44px;
    padding: 8px 12px;
    font-size: 15px;
  }
  html body .modal,
  html body .app-sheet-mask,
  html body .app-sidebar {
    overscroll-behavior: contain;
  }
}

@media (min-width: 860px) {
  .app-sidebar { transform: none; }
  body.has-app-shell .app-header { display: none !important; }
  .app-sidebar-mask,
  .app-menu-btn,
  .app-header-title,
  .app-sidebar-close,
  .app-sidebar-ws,
  .app-nav-more,
  .app-tabbar,
  .app-subbar,
  .app-sidebar-name-m,
  .app-sheet-mask { display: none !important; }
  body.sidebar-open { overflow: auto; }
  .app-header,
  .app-main { margin-left: var(--sidebar-w); }
  html body .app-header { padding: 0 28px; height: var(--header-h); }
  .app-header .user { max-width: 140px; display: inline; }
  .app-main { padding: 28px 32px 56px; }
  html body .modal-mask, html body .modal-bg { align-items: center; }
  html body .modal { border-radius: var(--radius); padding: 28px; }
  .toast { bottom: 30px; }
}

/* ——— Auth ——— */
.auth-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: #fff;
  backdrop-filter: none;
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: none;
  padding: 32px 28px;
  position: relative;
}
.auth-card::before { display: none; }
.auth-brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
  position: relative;
}
.auth-card h1 {
  font-size: 24px; font-weight: 700; margin-bottom: 0; letter-spacing: -.03em;
}
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; position: relative; }
.auth-card .form-group { margin-bottom: 16px; position: relative; }
html body a.btn { text-decoration: none; }
.auth-card .btn { width: 100%; padding: 12px; font-size: 16px; }
.auth-card .btn.ghost { width: 100%; margin-top: 12px; }
.msg { padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; display: none; position: relative; }
.msg.err { background: #fff5f5; color: var(--danger); display: block; }
.msg.ok { background: #e6fcf5; color: var(--ok); display: block; }

.code-wrap { text-align: center; padding: 12px 0 8px; position: relative; }
.code {
  font-size: 42px; font-weight: 700; letter-spacing: .28em;
  font-variant-numeric: tabular-nums; color: var(--primary);
  padding-left: .28em;
  text-shadow: none;
}
.ttl { margin-top: 16px; font-size: 13px; color: var(--muted); }

/* ——— Layout helpers ——— */
.page-split { display: grid; grid-template-columns: 1fr; gap: 16px; }
.grid, .grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.field-row { display: flex; flex-direction: column; gap: 6px; }
.field-row label { font-size: 13px; color: var(--muted); }
.field-row.inline { flex-direction: row; align-items: center; gap: 8px; }
.field-row input:not([type="checkbox"]):not([type="radio"]),
.field-row select,
.field-row textarea { width: 100%; }
.field-row input[type="checkbox"],
.field-row input[type="radio"] {
  width: auto;
  flex-shrink: 0;
  margin: 0;
}

ul.group-list { list-style: none; }
ul.group-list li {
  padding: 12px 12px; border-radius: 12px; cursor: pointer; margin-bottom: 4px;
  display: flex; justify-content: space-between; align-items: center;
  transition: background .15s var(--ease);
}
ul.group-list li:hover { background: var(--bg); }
ul.group-list li.active {
  background: var(--primary-soft); color: var(--text);
  box-shadow: none;
}
ul.group-list li .name { font-weight: 600; }
ul.group-list li .meta { font-size: 12px; color: var(--muted); }
ul.group-list li.active .meta { color: var(--primary); }

.radio-group { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.radio-group label {
  flex: 1; min-width: 180px; border: 1px solid var(--line);
  padding: 14px; border-radius: 14px; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.radio-group label:has(input:checked) {
  border-color: transparent; background: var(--primary-soft);
  box-shadow: none;
}
.radio-group label .name { font-weight: 600; color: var(--text); }
.radio-group label .desc { font-size: 12px; color: var(--muted); }

.modal .check { display: flex; align-items: center; margin-bottom: 14px; font-size: 13px; gap: 8px; color: var(--text); }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal .row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 6px; }
.modal .field { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.modal textarea { min-height: 60px; resize: vertical; }
.modal .actions { text-align: right; margin-top: 16px; }
.modal.sm { width: min(440px, calc(100vw - 32px)); }
.modal-err { color: var(--danger); font-size: 13px; margin: 0 0 10px; white-space: pre-wrap; }
.disabled-fs { opacity: .4; pointer-events: none; }
.create-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.create-form .row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 8px; align-items: end; margin-bottom: 6px; }
.create-form textarea { min-height: 60px; resize: vertical; }
.rsv-form { display: flex; flex-direction: column; gap: 8px; }
.rsv-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.follow-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.pub-chip { display: inline-block; margin: 0 6px 6px 0; color: var(--muted); }

@media (min-width: 860px) {
  .page-split { grid-template-columns: 280px 1fr; }
  .grid, .grid-2 { grid-template-columns: 1fr 1fr; }
}

.footer-actions {
  position: sticky; bottom: 0; z-index: 5;
  background: linear-gradient(to bottom, transparent, var(--bg) 36%);
  padding: 20px 0 calc(8px + env(safe-area-inset-bottom));
  text-align: right;
}
.footer-actions button { margin-left: 8px; }
.danger-box {
  border: none;
  background: #fff5f5;
  padding: 16px 18px; border-radius: 14px;
}
.danger-box h3 { color: var(--danger); font-size: 14px; margin-bottom: 8px; }
.lite-banner {
  background: #e6fcf5;
  border: none;
  color: var(--ok);
  padding: 12px 16px; border-radius: 12px; margin-bottom: 20px; font-size: 13px;
}
section.disabled { opacity: .5; pointer-events: none; position: relative; }
section.disabled::after {
  content: "此设置不生效";
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: #fff; padding: 8px 20px; border-radius: 10px;
  font-weight: 500; color: var(--muted);
  box-shadow: var(--shadow-lg); pointer-events: none; white-space: nowrap;
}

.tier-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.tier-row { display: flex; gap: 8px; align-items: center; }
.tier-row input { width: 100px; }
.tier-row button {
  padding: 4px 10px; background: #fff5f5; color: var(--danger);
  border: none; border-radius: 8px; cursor: pointer;
}

.btn-editor-hint {
  font-size: 12px; color: var(--muted);
  background: var(--bg);
  border-radius: 12px; padding: 12px 14px; line-height: 1.5;
}
.btn-editor-row {
  margin-top: 12px; padding: 14px;
  border: none; border-radius: 12px;
  background: var(--bg);
}
.btn-editor-row-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.btn-editor-row-hd span { font-size: 13px; font-weight: 600; color: var(--text); }
.btn-editor-del-row { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 13px; padding: 0; }
.btn-editor-btn { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.btn-editor-btn input { width: auto; margin-bottom: 0; }
.btn-editor-btn input[data-f="text"] { flex: 0 0 140px; min-width: 100px; }
.btn-editor-btn input[data-f="url"] { flex: 1; min-width: 0; }
.btn-editor-x {
  width: 32px; height: 32px; flex-shrink: 0; border: none; border-radius: 8px;
  background: #fff5f5; color: var(--danger); cursor: pointer; font-size: 16px; line-height: 1;
}
.btn-editor-add-in {
  width: 100%; padding: 8px;
  border: 1px dashed #b8c0f0;
  background: var(--primary-soft); color: var(--primary);
  border-radius: 10px; cursor: pointer; font-size: 13px;
}
.btn-editor-add-row {
  width: 100%; margin-top: 12px; padding: 10px;
  border: 1px dashed var(--line-strong);
  background: #fff; color: var(--muted);
  border-radius: 10px; cursor: pointer; font-size: 13px;
}

.kw-box {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  min-height: 40px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px;
  background: #fff;
}
.kw-box input { width: auto; flex: 1; min-width: 140px; border: none; margin: 0; padding: 4px; box-shadow: none; background: transparent; }
.kw-box input:focus { box-shadow: none; }
.kw-tag {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary-soft); color: var(--primary);
  border-radius: 999px; padding: 2px 8px; font-size: 12px;
}
.kw-tag button { border: none; background: none; color: var(--primary); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.ph-list { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.ph-list button {
  border: none; background: var(--bg);
  border-radius: 999px; padding: 2px 8px; font-size: 12px; cursor: pointer; color: var(--muted);
}
.preview-box {
  background: var(--bg); border-radius: 12px;
  padding: 12px 14px; font-size: 13px; white-space: pre-wrap; margin-bottom: 10px;
}

.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-top: 12px; }
.type-card {
  appearance: none; font: inherit; text-align: left; width: 100%;
  border: none; border-radius: 14px; padding: 18px; cursor: pointer;
  background: var(--bg); color: inherit;
  transition: background .15s var(--ease), box-shadow .15s var(--ease);
}
.type-card:hover { border-color: transparent; background: var(--primary-soft); }
.type-card.selected {
  border-color: transparent; background: var(--primary-soft);
  box-shadow: inset 0 0 0 2px var(--primary);
}
.type-card .emoji { font-size: 22px; line-height: 1; }
.type-card h3 { font-size: 15px; margin: 8px 0 4px; color: var(--text); }
.type-card p { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 0; }
.type-card:disabled { opacity: .4; pointer-events: none; }

.dl-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 4px 0 12px; margin: 0 0 16px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: -24px; z-index: 3;
  background: var(--card-solid);
}
.dl-tab {
  appearance: none; border: 0; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 500;
  padding: 6px 12px; border-radius: 10px;
  cursor: pointer; font-family: inherit;
}
.dl-tab.active, .dl-tab:hover { background: var(--primary-soft); color: var(--primary); }
.dl-tab.active { font-weight: 600; }
.dl-pane { display: none; }
.dl-pane.active { display: block; }
.dl-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; font-size: 13px; color: var(--muted); }
.dl-block {
  background: var(--bg);
  border: none; border-radius: 14px;
  padding: 16px 18px; margin-bottom: 14px;
}
.dl-block h3 { font-size: 13px; font-weight: 600; color: var(--text); margin: 0 0 10px; }
.dl-block h3 small { font-weight: 500; color: var(--muted); margin-left: 6px; }
.dl-check { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--text); margin-bottom: 8px; cursor: pointer; }
.dl-prize, .rsv-card, .follow-card, .pub-chip {
  background: #fff;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; margin-bottom: 8px;
}
.dl-prize-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dl-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.dl-pill.empty { background: var(--bg); color: var(--muted); }
.dl-pill.points { background: #e6fcf5; color: var(--ok); }
.dl-used { font-size: 12px; color: var(--muted); }
.dl-prize-fields { display: grid; grid-template-columns: 1fr 110px 110px; gap: 8px; }
.dl-prize-fields label { font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.dl-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.rsv-add { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
.follow-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.follow-card .name { font-size: 14px; font-weight: 600; color: var(--text); }
.follow-card .sub { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.follow-empty { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.create-form .field { margin-bottom: 12px; display: flex; flex-direction: column; gap: 4px; }
.create-form label { font-size: 12px; color: var(--muted); }
.create-form fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 14px; }
.create-form fieldset legend { padding: 0 6px; font-size: 12px; color: var(--muted); }
.create-actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 0 calc(8px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 28%);
}
.checkbox-list {
  display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto;
  border: 1px solid var(--line); padding: 8px; border-radius: 10px;
}
.checkbox-list label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.group-pick {
  display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto;
  padding: 8px; border: 1px solid var(--line); border-radius: 10px;
}
.group-pick label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); margin: 0; }

.create-form div.prize-row {
  border: none;
  background: var(--bg);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
}
#critBox .prize-row, .create-form .prize-row, .prize-grid {
  display: grid; grid-template-columns: 1.4fr 90px 80px 70px 80px 52px; gap: 6px; align-items: center; margin-bottom: 8px;
}
#critBox .prize-row button, .create-form .prize-row button, .prize-row .del {
  padding: 4px 8px; background: #fff5f5; color: var(--danger);
  border: none; border-radius: 8px; cursor: pointer;
}

.pick-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 12px; }
.role-slot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.role-slot.empty .slot-name { color: var(--muted); }
.role-slot .slot-title { font-size: 13px; font-weight: 650; }
.role-slot .slot-name { font-size: 14px; margin-top: 2px; }
.role-slot .slot-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.role-sec { margin: 16px 0 4px; font-size: 13px; font-weight: 650; }
.role-sec span { font-weight: 400; color: var(--muted); }
.role-list { list-style: none; }
.role-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.pending { margin-top: 16px; }
.pending li {
  list-style: none; padding: 10px 0; border-bottom: 1px solid var(--line);
  font-size: 13px; display: flex; justify-content: space-between; gap: 12px; align-items: center;
}

.dtp-wrap {
  display: block;
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 44px;
}
html body .dtp-src {
  position: absolute; left: 0; top: 0;
  width: 1px; height: 1px; opacity: 0;
  pointer-events: none; border: 0; padding: 0; margin: 0;
}
.dtp-face {
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.dtp-hit {
  position: absolute;
  inset: 0;
  z-index: 3;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.dtp-mask {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 399;
  background: rgba(15, 23, 42, .4);
  touch-action: none;
}
.dtp-mask.show { display: block; }
.dtp-panel {
  position: fixed;
  z-index: 400;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .12);
  padding: 8px 8px 0;
  display: none;
  user-select: none;
  width: 348px;
  box-sizing: border-box;
  overflow: visible;
  overflow-anchor: none;
  overscroll-behavior: contain;
}
.dtp-panel.show { display: block; }
.dtp-body {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
}
.dtp-cal { width: 236px; flex: 0 0 236px; }
.dtp-head {
  display: flex; align-items: center; gap: 0;
  padding: 0 0 6px;
}
.dtp-head .dtp-ym {
  flex: 1; text-align: center;
  font-size: 13px; font-weight: 650; color: var(--text);
}
.dtp-head button {
  width: 22px; height: 24px; border: none; background: none;
  cursor: pointer; color: #8c8c8c; font-size: 12px; line-height: 24px;
  font-family: inherit; padding: 0;
}
.dtp-dows, .dtp-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.dtp-dows span, .dtp-day {
  height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
}
.dtp-dows span { color: var(--muted); }
.dtp-day {
  border: 1px solid transparent; background: none; cursor: pointer;
  border-radius: 4px; color: var(--text); font-family: inherit; padding: 0;
}
.dtp-day.out { color: #d1d5db; }
.dtp-day.today:not(.sel) { background: var(--primary-soft); color: var(--primary); font-weight: 650; }
.dtp-day.sel {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}
.dtp-time {
  display: flex;
  flex: 0 0 96px;
  border-left: 1px solid var(--line);
  margin-left: 4px;
  min-height: 0;
  position: relative;
}
.dtp-time-pane {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.dtp-col-lab {
  display: none;
  text-align: center;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  padding: 4px 0 2px;
  flex: 0 0 auto;
}
.dtp-col {
  flex: 1 1 0;
  height: 226px;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
.dtp-col::-webkit-scrollbar { width: 6px; }
.dtp-col::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 3px; }
.dtp-now { display: none; }
.dtp-num {
  display: block; width: 100%; height: 28px; line-height: 28px;
  text-align: center; border: none; background: none;
  cursor: pointer; font-size: 13px; border-radius: 4px;
  font-family: inherit; padding: 0; color: var(--text);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.dtp-num.sel {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}
.dtp-foot {
  display: flex; justify-content: flex-end;
  padding: 8px 0;
  margin-top: 4px;
  border-top: 1px solid var(--line);
}
.dtp-foot .dtp-ok {
  margin: 0;
  background: #fff; color: rgba(0, 0, 0, .85);
  border: 1px solid #d9d9d9;
  padding: 3px 14px; border-radius: 4px;
  font-size: 13px; font-family: inherit; font-weight: 400;
  cursor: pointer;
}

@media (max-width: 640px) {
  .dl-prize-fields, .rsv-add { grid-template-columns: 1fr; }
  #critBox .prize-row, .create-form .prize-row, .prize-grid { grid-template-columns: 1fr; }
}

/* 手机时间选择：只要 JS 加上 .sheet，就按底部面板排，不依赖 media query */
.dtp-panel.sheet {
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  border-radius: 16px 16px 0 0;
  padding: 8px 16px calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 28px rgba(15, 23, 42, .18);
  overflow: hidden;
}
.dtp-panel.sheet::before {
  content: "";
  display: block;
  width: 36px; height: 5px;
  margin: 2px auto 8px;
  background: #c7c7cc;
  border-radius: 99px;
  flex: 0 0 auto;
}
.dtp-panel.sheet.show {
  display: flex !important;
  flex-direction: column;
}
.dtp-panel.sheet .dtp-body {
  display: block;
  min-height: 0;
  flex: 1 1 auto;
  overflow: auto;
}
.dtp-panel.sheet .dtp-cal {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}
.dtp-panel.sheet .dtp-dows span,
.dtp-panel.sheet .dtp-day { height: 34px; font-size: 15px; }
.dtp-panel.sheet .dtp-now {
  display: block;
  flex: 0 0 auto;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--primary);
  padding: 6px 0 4px;
}
.dtp-panel.sheet .dtp-time {
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
  max-height: none;
  background: #fff;
  border-left: none;
  border-top: 0.5px solid var(--line);
  margin-left: 0;
  margin-top: 0;
}
.dtp-panel.sheet .dtp-col-lab { display: block; padding: 6px 0 2px; font-size: 13px; }
.dtp-panel.sheet .dtp-col {
  height: 112px;
  flex: 0 0 112px;
  min-height: 112px;
  max-height: 112px;
}
.dtp-panel.sheet .dtp-col::-webkit-scrollbar { width: 0; height: 0; }
.dtp-panel.sheet .dtp-num {
  height: 36px;
  line-height: 36px;
  font-size: 17px;
  border-radius: 8px;
}
.dtp-panel.sheet .dtp-num.sel {
  background: var(--primary);
  color: #fff;
  box-shadow: none;
}
.dtp-panel.sheet .dtp-foot {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  justify-content: stretch;
  background: #fff;
  position: relative;
  z-index: 2;
}
.dtp-panel.sheet .dtp-cancel,
.dtp-panel.sheet .dtp-ok {
  flex: 1;
  width: auto;
  padding: 12px 14px;
  border-radius: 14px;
  border: none;
  font-size: 17px;
  font-weight: 650;
  font-family: inherit;
  min-height: 50px;
}
.dtp-panel.sheet .dtp-cancel {
  background: #f2f2f7;
  color: var(--text);
}
.dtp-panel.sheet .dtp-ok {
  background: var(--primary);
  color: #fff;
  border: none;
}
.dtp-panel.sheet .dtp-cancel:active,
.dtp-panel.sheet .dtp-ok:active { opacity: .55; }

@media (max-width: 860px), (pointer: coarse) {
  html body input,
  html body select,
  html body textarea { font-size: 16px; }
  .dtp-face { font-size: 16px; }
}

@media (max-width: 859px) {
  html body.has-tabbar .app-main {
    padding-bottom: calc(24px + var(--tabbar-h) + env(safe-area-inset-bottom)) !important;
  }
  html body .footer-actions,
  html body .create-actions {
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: 10px;
    z-index: 8;
  }
  html body .footer-actions button,
  html body .create-actions button {
    min-height: 50px;
    border-radius: 14px;
    font-size: 17px;
  }
  html body .toast {
    bottom: calc(12px + var(--tabbar-h) + env(safe-area-inset-bottom));
  }
  html body .modal:has(.btns) {
    padding-bottom: 0;
  }
  [id^="sec-"] {
    scroll-margin-top: calc(var(--header-h) + var(--subbar-h, 0px) + env(safe-area-inset-top) + 12px);
  }
  .dl-tabs { top: 0; }
  body.has-tabbar .leaflet-bottom {
    bottom: 8px;
  }
}

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

/* 手机兜底：不依赖 .sheet 类（旧 JS 也能变成底部面板）；侧栏禁止压扁裁切 */
@media (max-width: 859px) {
  html body .app-sidebar {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
  }
  html body .app-sidebar-brand,
  html body .app-sidebar-ws {
    flex: 0 0 auto !important;
  }
  html body .app-sidebar-ws {
    overflow: visible;
  }
  html body .app-sidebar-ws .ws-tabs {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
  }
  html body .app-sidebar-ws .ws-tabs a {
    display: flex !important;
    width: 100% !important;
    min-height: 44px !important;
    justify-content: flex-start !important;
    text-align: left !important;
    border-radius: 0 !important;
  }
  html body .app-nav-primary {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
  }
  html body .app-nav-sec {
    flex: 0 0 auto !important;
    overflow: visible;
  }
  html body .dtp-mask.show { z-index: 590 !important; }
  html body .dtp-panel.show {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    width: auto !important;
    max-width: none !important;
    border-radius: 0 !important;
    padding: 12px 16px 8px !important;
    display: flex !important;
    flex-direction: column !important;
    z-index: 600 !important;
    background: #f2f2f7 !important;
    box-shadow: none !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }
  body:has(.dtp-panel.show) .modal .btns { visibility: hidden !important; }
  html body .dtp-panel.show .dtp-body {
    display: block !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: auto !important;
    width: auto !important;
    background: #fff !important;
    border-radius: 16px !important;
    padding: 8px 8px 4px !important;
  }
  html body .dtp-panel.show .dtp-head button {
    width: 36px !important;
    height: 36px !important;
    min-height: 0 !important;
    padding: 0 !important;
    border-radius: 8px !important;
    background: #f2f2f7 !important;
    color: #8e8e93 !important;
    font-size: 18px !important;
    line-height: 36px !important;
  }
  html body .dtp-panel.show .dtp-cal {
    width: 100% !important;
    flex: none !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  html body .dtp-panel.show .dtp-dows span,
  html body .dtp-panel.show .dtp-day {
    height: 36px !important;
    min-height: 0 !important;
    padding: 0 !important;
    font-size: 16px !important;
  }
  html body .dtp-panel.show .dtp-day {
    width: 36px !important;
    justify-self: center !important;
    border-radius: 50% !important;
  }
  html body .dtp-panel.show .dtp-day.sel {
    background: #e09a2b !important;
    color: #fff !important;
    border-color: transparent !important;
  }
  html body .dtp-panel.show .dtp-now {
    display: block !important;
    flex: 0 0 auto !important;
    background: transparent !important;
    color: #e09a2b !important;
    text-align: center !important;
    font-size: 22px !important;
    font-weight: 700 !important;
    padding: 10px 0 6px !important;
  }
  html body .dtp-panel.show .dtp-time {
    display: flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    background: #fff !important;
    border: none !important;
    border-radius: 16px !important;
    margin: 10px 0 0 !important;
    padding: 6px 8px 8px !important;
  }
  html body .dtp-panel.show .dtp-col-lab { display: block !important; color: #8e8e93 !important; }
  html body .dtp-panel.show .dtp-col {
    height: 180px !important;
    flex: 0 0 180px !important;
    min-height: 180px !important;
    max-height: 180px !important;
    overflow-y: auto !important;
    border-radius: 10px !important;
    background-color: transparent !important;
    background-image: linear-gradient(to bottom, transparent calc(50% - 18px), rgba(224, 154, 43, .18) calc(50% - 18px), rgba(224, 154, 43, .18) calc(50% + 18px), transparent calc(50% + 18px)) !important;
  }
  html body .dtp-panel.show .dtp-num {
    height: 36px !important;
    min-height: 0 !important;
    padding: 0 !important;
    line-height: 36px !important;
    background: transparent !important;
    color: #8e8e93 !important;
    font-size: 18px !important;
    border-radius: 0 !important;
  }
  html body .dtp-panel.show .dtp-num.sel {
    background: transparent !important;
    color: #1c1c1e !important;
    font-weight: 700 !important;
    font-size: 22px !important;
    box-shadow: none !important;
  }
  html body .dtp-panel.show .dtp-foot {
    display: flex !important;
    gap: 8px !important;
    flex: 0 0 auto !important;
    justify-content: stretch !important;
    position: relative !important;
    z-index: 2 !important;
    margin: 0 !important;
    padding: 12px 0 calc(8px + env(safe-area-inset-bottom)) !important;
    background: transparent !important;
    border: none !important;
  }
  html body .dtp-panel.show .dtp-ok,
  html body .dtp-panel.show .dtp-cancel {
    flex: 1 !important;
    width: auto !important;
    min-height: 50px !important;
    padding: 12px 14px !important;
    border: none !important;
    border-radius: 14px !important;
    font-size: 17px !important;
    font-weight: 650 !important;
  }
  html body .dtp-panel.show .dtp-cancel {
    background: #fff !important;
    color: #1c1c1e !important;
  }
  html body .dtp-panel.show .dtp-ok {
    background: #e09a2b !important;
    color: #fff !important;
  }
}

body.panel-home {
  background: #f2f2f7;
  min-height: 100%;
}
body.panel-home .ph-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  height: calc(44px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid rgba(60, 60, 67, .18);
}
body.panel-home .ph-top h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 44px;
}
body.panel-home .ph-back {
  position: absolute;
  left: 4px;
  top: env(safe-area-inset-top);
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
body.panel-home .ph-back svg { width: 6px; height: 10px; display: block; }
html.embed-mini body.panel-home .ph-top { display: none; }
html.embed-mini body .app-header,
html.embed-mini body header.app-header { display: none !important; }
html.embed-mini .app-nav-more { display: none !important; }
html.embed-mini body .app-subbar,
html.embed-mini body .app-tabbar { display: none !important; }
html.embed-mini body .card,
html.embed-mini body section.card {
  border-radius: 12px;
  box-shadow: none;
}
html.embed-mini,
html.embed-mini body {
  height: 100%;
  overflow: hidden;
  touch-action: pan-y;
}
html.embed-mini body {
  display: flex;
  flex-direction: column;
}
html.embed-mini body .app-header,
html.embed-mini body .ph-top {
  flex: none;
}
html.embed-mini body .app-main,
html.embed-mini body.panel-home #phList {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}
body.panel-home #phList { padding: 4px 16px calc(28px + env(safe-area-inset-bottom)); }
body.panel-home .ph-sec { padding-top: 22px; }
body.panel-home .ph-sec:first-child { padding-top: 16px; }
body.panel-home .ph-sec h2 {
  margin: 0 16px 8px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.2;
  color: #8e8e93;
}
body.panel-home .ph-block {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}
body.panel-home .ph-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 11px 16px;
  color: #1c1c1e;
  text-decoration: none;
  background: #fff;
  -webkit-tap-highlight-color: transparent;
}
body.panel-home .ph-block > .ph-row + .ph-row {
  box-shadow: inset 0 0.5px 0 rgba(60, 60, 67, .18);
}
body.panel-home .ph-row:active { background: rgba(60, 60, 67, .08); }
body.panel-home .ph-label {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
body.panel-home .ph-name {
  font-size: 17px;
  font-weight: 400;
  line-height: 1.25;
}
body.panel-home .ph-label small {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  color: #8e8e93;
}
body.panel-home .ph-chev {
  width: 7px;
  height: 7px;
  margin-right: 2px;
  border-right: 1.5px solid #c7c7cc;
  border-bottom: 1.5px solid #c7c7cc;
  transform: rotate(-45deg);
  flex: none;
}
body.panel-home .ph-back:focus-visible,
body.panel-home .ph-row:focus-visible {
  outline: 2px solid #e09a2b;
  outline-offset: -2px;
}
html.embed-mini .card h2 > button,
html.embed-mini section h2 > button,
html.embed-mini .pending button,
html.embed-mini .role-list button,
html.embed-mini .role-slot button {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 15px;
}
html.embed-mini body .app-main input:not([type="checkbox"]):not([type="radio"]):not(.ios-switch):not(.dtp-src):not(.dtp-native-input),
html.embed-mini body .app-main select,
html.embed-mini body .app-main textarea,
html.embed-mini body .modal input:not([type="checkbox"]):not([type="radio"]):not(.ios-switch):not(.dtp-src):not(.dtp-native-input),
html.embed-mini body .modal select,
html.embed-mini body .modal textarea,
html.embed-mini body .dtp-face {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;
  border: none;
  border-radius: 12px;
  background-color: #f2f2f7;
  color: #1c1c1e;
  font-size: 17px;
  line-height: 1.3;
  box-shadow: none;
}
html.embed-mini body .app-main select,
html.embed-mini body .modal select,
html.embed-mini body .dtp-face {
  padding-right: 40px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%238e8e93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
}
html.embed-mini body .app-main textarea,
html.embed-mini body .modal textarea {
  min-height: 96px;
  padding-top: 12px;
  resize: vertical;
}
html.embed-mini body .app-main input::placeholder,
html.embed-mini body .modal input::placeholder,
html.embed-mini body .dtp-face::placeholder {
  color: #8e8e93;
}
html.embed-mini body .app-main input:focus,
html.embed-mini body .app-main select:focus,
html.embed-mini body .app-main textarea:focus,
html.embed-mini body .modal input:focus,
html.embed-mini body .modal select:focus,
html.embed-mini body .modal textarea:focus {
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(224, 154, 43, .28);
}
html.embed-mini body .card.filters input:not([type="checkbox"]):not([type="radio"]),
html.embed-mini body .card.filters select {
  min-height: 44px;
  padding: 8px 0;
  border: none;
  border-radius: 0;
  background-color: transparent;
  background-image: none;
  box-shadow: none;
  font-size: 17px;
}
html.embed-mini body .field-row,
html.embed-mini body .form-kv {
  gap: 6px;
  margin-bottom: 14px;
}
html.embed-mini body .field-row > label,
html.embed-mini body .form-kv > label {
  font-size: 13px;
  font-weight: 600;
  color: #8e8e93;
}
html.embed-mini {
  --bg: #f2f2f7;
  --card: #fff;
  --text: #1c1c1e;
  --muted: #8e8e93;
  --line: rgba(60, 60, 67, .18);
  --primary: #e09a2b;
  --primary-hover: #c7861c;
  --primary-soft: rgba(224, 154, 43, .16);
  --danger: #ff3b30;
  --ok: #34c759;
  --shadow: 0 2px 8px rgba(0, 0, 0, .05);
}
html.embed-mini body {
  background: #f2f2f7;
  color: #1c1c1e;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
html.embed-mini body .app-sidebar,
html.embed-mini body .sidebar-mask { display: none !important; }
html.embed-mini body .app-main {
  margin: 0 !important;
  padding: 12px 16px 28px;
  background: #f2f2f7;
}
html.embed-mini body .page-head h1,
html.embed-mini body .page-head .crumb { display: none; }
html.embed-mini body .page-head .lede,
html.embed-mini body .app-main > p,
html.embed-mini body .lite-note,
html.embed-mini body .hint {
  margin: 0 0 12px;
  padding: 0 4px;
  background: none;
  color: #8e8e93;
  font-size: 13px;
  line-height: 1.45;
}
html.embed-mini body .card,
html.embed-mini body section.card {
  background: #fff;
  border: none;
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
  padding: 6px 0 8px;
  margin: 0 0 12px;
}
html.embed-mini body .card > h2,
html.embed-mini body section.card > h2,
html.embed-mini body section > h2 {
  margin: 0;
  padding: 10px 16px 6px;
  font-size: 13px;
  font-weight: 600;
  color: #8e8e93;
  letter-spacing: 0;
}
html.embed-mini body .card > h2 .btn,
html.embed-mini body section > h2 .btn,
html.embed-mini body .card > h2 > button,
html.embed-mini body section > h2 > button {
  width: auto;
  min-height: 32px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
}
html.embed-mini body .btn:not(.ghost):not(.danger):not(.warn),
html.embed-mini body button.ok:not(.ghost),
html.embed-mini body .save {
  background: #e09a2b;
  color: #fff;
  border: none;
  border-radius: 12px;
  min-height: 48px;
  font-size: 17px;
  font-weight: 700;
}
html.embed-mini body .btn.ghost,
html.embed-mini body .modal .btns .cancel {
  background: #f2f2f7;
  color: #1c1c1e;
  border: none;
  border-radius: 12px;
  min-height: 48px;
  font-size: 17px;
  font-weight: 600;
}
html.embed-mini body .btn.danger {
  background: #fff;
  color: #ff3b30;
}
html.embed-mini body .footer-actions,
html.embed-mini body .create-actions {
  position: sticky;
  bottom: 0;
  z-index: 8;
  display: flex;
  gap: 8px;
  margin: 8px -16px 0;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(242, 242, 247, .94);
  border-top: 0.5px solid rgba(60, 60, 67, .18);
}
html.embed-mini body .footer-actions button,
html.embed-mini body .create-actions button { flex: 1; }
html.embed-mini body .modal {
  background: #f2f2f7;
}
html.embed-mini body .modal .field-row,
html.embed-mini body .create-form .field-row,
html.embed-mini body .modal .form-kv {
  background: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 14px 12px;
  margin: 0 0 10px;
}
html.embed-mini body .app-main .table-wrap,
html.embed-mini body .modal .table-wrap {
  overflow: visible !important;
  margin: 0 !important;
}
html.embed-mini body .app-main .table-wrap table,
html.embed-mini body .modal .table-wrap table,
html.embed-mini body #userTable {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  border-collapse: separate;
  border-spacing: 0;
  background: transparent !important;
}
html.embed-mini body .app-main .table-wrap thead,
html.embed-mini body .modal .table-wrap thead { display: none !important; }
html.embed-mini body .app-main .table-wrap tbody,
html.embed-mini body .modal .table-wrap tbody { display: block !important; width: 100%; }
html.embed-mini body .app-main .table-wrap tbody tr,
html.embed-mini body .modal .table-wrap tbody tr {
  display: block !important;
  background: #fff;
  border-radius: 12px;
  box-shadow: none;
  padding: 2px 0;
  margin: 0 0 10px;
  overflow: visible;
}
html.embed-mini body .app-main .table-wrap th,
html.embed-mini body .app-main .table-wrap td,
html.embed-mini body .modal .table-wrap th,
html.embed-mini body .modal .table-wrap td {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: auto;
  white-space: normal;
  text-align: left;
  border: none;
  border-bottom: 0.5px solid rgba(60, 60, 67, .18);
  padding: 11px 16px;
  font-size: 16px;
}
html.embed-mini body .app-main .table-wrap tbody tr > td:last-child,
html.embed-mini body .modal .table-wrap tbody tr > td:last-child { border-bottom: none; }
html.embed-mini body .app-main .table-wrap td[colspan],
html.embed-mini body .modal .table-wrap td[colspan] {
  display: block !important;
  text-align: center;
  border-bottom: none;
  color: #8e8e93;
}
html.embed-mini body .app-main .table-wrap td::before,
html.embed-mini body .modal .table-wrap td::before {
  content: attr(data-label) !important;
  display: block !important;
  flex: 0 1 auto;
  max-width: 46%;
  color: #8e8e93;
  font-size: 13px;
  font-weight: 400;
  text-align: left;
}
html.embed-mini body .app-main .table-wrap td:not([data-label])::before,
html.embed-mini body .modal .table-wrap td:not([data-label])::before,
html.embed-mini body .app-main .table-wrap td[colspan]::before,
html.embed-mini body .modal .table-wrap td[colspan]::before,
html.embed-mini body .app-main .table-wrap td.actions::before,
html.embed-mini body .modal .table-wrap td.actions::before {
  content: none !important;
  display: none !important;
}
html.embed-mini body .app-main .table-wrap td .td-val,
html.embed-mini body .modal .table-wrap td .td-val {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}
html.embed-mini body .app-main .table-wrap td.actions,
html.embed-mini body .modal .table-wrap td.actions,
html.embed-mini body .app-main .table-wrap td.actions .td-val,
html.embed-mini body .modal .table-wrap td.actions .td-val {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 12px;
  white-space: normal;
  text-align: right;
}
html.embed-mini body .table-wrap td button,
html.embed-mini body .table-wrap td .btn,
html.embed-mini body td .actions button,
html.embed-mini body .op-link {
  width: auto !important;
  min-height: 32px !important;
  padding: 4px 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: none !important;
  color: #e09a2b !important;
  font-size: 16px !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}
html.embed-mini body .table-wrap td button.danger,
html.embed-mini body .table-wrap td .btn.danger,
html.embed-mini body td .actions button.danger,
html.embed-mini body .op-link.danger {
  background: none !important;
  color: #ff3b30 !important;
}
html.embed-mini body .app-main .card:has(.table-wrap),
html.embed-mini body section.card:has(.table-wrap) {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  overflow: visible !important;
}
html.embed-mini .kpi-card {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
  overflow: hidden;
  padding: 0 !important;
}
html.embed-mini .kpi-col { padding: 16px !important; }
html.embed-mini .kpi-col + .kpi-col { border: none !important; }
html.embed-mini .kpi-value { font-size: 28px !important; font-weight: 800 !important; }
html.embed-mini .kpi-value.accent { color: #e09a2b !important; }
html.embed-mini body .page-tabs {
  background: #fff;
  border-radius: 12px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}
html.embed-mini body .page-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
html.embed-mini body .page-tabs [data-tab] {
  flex: 0 0 auto;
}
html.embed-mini body .page-tabs [data-tab].active {
  background: #fff4e5;
  color: #e09a2b;
  box-shadow: none;
}
html.embed-mini .modal-mask::before,
html.embed-mini .modal-bg::before,
html.embed-mini .footer-actions,
html.embed-mini .create-actions,
html.embed-mini .modal .btns {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html.embed-mini .filters select,
html.embed-mini .filters input,
html.embed-mini .q-row {
  min-width: 0 !important;
  max-width: 100%;
}
html.embed-mini .q-row {
  width: 100%;
}
html.embed-mini .q-row input { flex: 1 1 auto; min-width: 0; }
html.embed-mini .q-row .btn,
html.embed-mini .toolbar-end .btn {
  flex: 0 0 auto;
  width: auto;
  min-height: 36px;
  padding: 6px 14px;
}
html.embed-mini .toolbar,
html.embed-mini .toolbar-end {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  margin-left: 0;
}
html.embed-mini .kpi-col:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}
html.embed-mini .row,
html.embed-mini .row-3,
html.embed-mini .detail-grid {
  grid-template-columns: 1fr !important;
}
html.embed-mini .msg-sum { grid-template-columns: 1fr 1fr !important; }
html.embed-mini .pager {
  justify-content: space-between;
  gap: 8px;
}
html.embed-mini .pager button {
  min-height: 36px;
  padding: 6px 14px;
}
@media (min-width: 860px) {
  body.panel-home #phList { max-width: 480px; margin: 0 auto; }
}
html.embed-mini .dtp-native {
  position: relative;
  display: block;
  width: 100%;
  min-height: 48px;
}
html.embed-mini .dtp-native-text {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f2f2f7;
  color: #1c1c1e;
  font-size: 17px;
  line-height: 1.3;
  pointer-events: none;
}
html.embed-mini .dtp-native-text.is-ph { color: #8e8e93; }
html body #chatsModal .modal-head h3 {
  text-align: left;
  flex: 1;
  margin-bottom: 0;
}
html body #chatsModal .chats-lead {
  margin: -4px 0 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
html body #chatsModal .chats-sec + .chats-sec { margin-top: 18px; }
html body #chatsModal .chats-sec-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 28px;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
}
html body #chatsModal .chats-list {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}
html body #chatsModal .chats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}
html body #chatsModal .chats-row:first-child { border-top: 0; }
html body #chatsModal .chats-row-copy { min-width: 0; flex: 1; }
html body #chatsModal .chats-row-kicker {
  margin-bottom: 2px;
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted);
}
html body #chatsModal .chats-row-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html body #chatsModal .chats-row-meta {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}
html body #chatsModal .chats-status {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
html body #chatsModal .chats-row-ops {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
html body #chatsModal .chats-act,
html body #chatsModal .chats-remove {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border: none;
  border-radius: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
html body #chatsModal .chats-act:hover { background: #d7e7ff; }
html body #chatsModal .chats-remove {
  background: transparent;
  color: var(--danger);
}
html body #chatsModal .chats-remove:hover { background: #fdecec; }
html body #chatsModal .chats-act:focus-visible,
html body #chatsModal .chats-remove:focus-visible,
html body #chatsModal .modal-x:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
html body #chatsModal .chats-join {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
html body #chatsModal .chats-empty {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}
html body #chatsModal .chats-note {
  margin: 12px 2px 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
html.embed-mini .dtp-native-input {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 48px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 12px !important;
  opacity: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-appearance: auto !important;
  appearance: auto !important;
  font-size: 16px !important;
  z-index: 2;
}
