:root {
  --ink: #102a3c;
  --ink-2: #16384e;
  --teal: #0f8f8a;
  --teal-2: #0b736f;
  --sky: #3aa3c7;
  --paper: #f3efe6;
  --card: #fffcf7;
  --line: #e2d9cc;
  --text: #1a2b36;
  --muted: #6b7a86;
  --danger: #c2453a;
  --ok: #2a7d55;
  --warn: #c47a1a;
  --shadow: 0 12px 40px rgba(16, 42, 60, 0.12);
  --header-h: 56px;
  --bottom-h: 60px;
  --side-w: 248px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--paper);
  font-size: 14px;
  line-height: 1.55;
}
button, input, select, textarea { font: inherit; }
a { color: var(--teal-2); text-decoration: none; }
button { cursor: pointer; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.toast {
  position: fixed; z-index: 80; left: 50%; bottom: 88px; transform: translateX(-50%);
  background: var(--ink); color: #f7f1e6; padding: 10px 16px; border-radius: 999px;
  max-width: min(92vw, 420px); box-shadow: var(--shadow); font-size: 13px;
}
.toast[hidden] { display: none; }

.ico { width: 18px; height: 18px; display: block; flex: none; }
.ico-lg { width: 22px; height: 22px; }

/* —— 登录 —— */
.login-page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  background:
    radial-gradient(1200px 600px at -10% -20%, rgba(58, 163, 199, .28), transparent 55%),
    radial-gradient(900px 500px at 110% 120%, rgba(15, 143, 138, .22), transparent 50%),
    linear-gradient(160deg, #17364c 0%, #102a3c 42%, #1c4a55 100%);
}
.login-stage {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  background: var(--card);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(8, 24, 36, .35);
  min-height: 520px;
}
.login-brand {
  position: relative;
  padding: 40px 36px;
  color: #f4f7f4;
  background:
    linear-gradient(165deg, rgba(16, 42, 60, .2), rgba(15, 143, 138, .18)),
    #12384a;
  overflow: hidden;
}
.login-brand::before,
.login-brand::after {
  content: "";
  position: absolute;
  border: 18px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
  pointer-events: none;
}
.login-brand::before { width: 280px; height: 280px; right: -90px; top: -70px; }
.login-brand::after { width: 180px; height: 180px; left: -70px; bottom: 40px; border-width: 12px; }
.login-brand .mark {
  width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center;
  background: #f3c15c; color: #102a3c;
  font-size: 28px; font-weight: 700; letter-spacing: .04em;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
}
.login-brand h1 { margin: 28px 0 8px; font-size: 32px; font-weight: 650; position: relative; }
.login-brand .lead { margin: 0; opacity: .82; position: relative; }
.login-brand ul {
  margin: 36px 0 0; padding: 0; list-style: none; position: relative;
  display: grid; gap: 10px; font-size: 13px; color: #d7ecea;
}
.login-brand li {
  display: flex; align-items: center; gap: 10px;
}
.login-brand li::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: #f3c15c; box-shadow: 0 0 0 4px rgba(243, 193, 92, .18);
}
.login-card {
  padding: 44px 40px 36px;
  display: flex; flex-direction: column; justify-content: center;
}
.login-card h2 { margin: 0 0 6px; font-size: 24px; color: var(--ink); }
.login-card .sub { margin: 0 0 28px; color: var(--muted); }

.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; color: #5d6d78; font-size: 13px; }
.field input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]) {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]):focus {
  outline: 0; border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 143, 138, .14);
}
.field input[type="radio"],
.field input[type="checkbox"],
.checks input[type="checkbox"],
.checks-inline input[type="checkbox"],
.radios input[type="radio"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  flex: none;
  accent-color: var(--teal);
}
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { flex: 1; }
.captcha-row img {
  width: 124px; height: 46px; border-radius: 12px; border: 1px solid var(--line);
  background: #eef6f5; cursor: pointer; flex: none;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent;
  background: var(--teal); color: #fff; font-weight: 600;
  transition: background .15s, border-color .15s, color .15s, transform .1s, opacity .15s;
}
.btn:hover:not(:disabled):not([disabled]) { background: var(--teal-2); }
.btn:active:not(:disabled):not([disabled]) { transform: translateY(1px); }
.btn.block { width: 100%; min-height: 48px; font-size: 15px; }
.btn.sm { min-height: 34px; padding: 0 10px; border-radius: 9px; font-size: 13px; font-weight: 500; }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; filter: grayscale(.12); }
/* 主操作：查询 / 保存 / 新增 / 提交（默认 .btn 即主色） */
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover:not(:disabled):not([disabled]) { background: var(--teal-2); }
/* 次要：查看 / 返回 / 取消 / 展开收起 / 分页 */
.btn-ghost, .btn.ghost, .btn-muted {
  background: #fff; color: var(--ink); border-color: var(--line); font-weight: 500;
}
.btn-ghost:hover:not(:disabled):not([disabled]),
.btn.ghost:hover:not(:disabled):not([disabled]),
.btn-muted:hover:not(:disabled):not([disabled]) { background: #f7f3ea; }
.btn-ghost.active, .btn.ghost.active {
  background: #e7f4f3; color: var(--teal-2); border-color: #b7ddd9; font-weight: 650;
}
.btn.soft { background: #e7f4f3; color: var(--teal-2); border-color: transparent; }
/* 修改 / 编辑：青蓝，区别于主色青绿 */
.btn-edit { background: #1f6f8b; color: #fff; }
.btn-edit:hover:not(:disabled):not([disabled]) { background: #185a72; }
/* 启用：绿 */
.btn-enable, .btn-success { background: var(--ok); color: #fff; }
.btn-enable:hover:not(:disabled):not([disabled]),
.btn-success:hover:not(:disabled):not([disabled]) { background: #226346; }
/* 停用：琥珀 */
.btn-disable, .btn-warning { background: var(--warn); color: #fff; }
.btn-disable:hover:not(:disabled):not([disabled]),
.btn-warning:hover:not(:disabled):not([disabled]) { background: #a36514; }
/* 删除：红 */
.btn-danger, .btn.danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled):not([disabled]),
.btn.danger:hover:not(:disabled):not([disabled]) { background: #a33830; }
/* 下载 / 导出：蓝绿，区别于主色 */
.btn-info { background: #2a8aa3; color: #fff; }
.btn-info:hover:not(:disabled):not([disabled]) { background: #227388; }
.err { color: var(--danger); min-height: 20px; margin: 4px 0 10px; font-size: 13px; }

/* —— 壳：侧栏通高 —— */
.shell {
  min-height: 100%;
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  grid-template-areas: "side top" "side main";
  background: var(--paper);
}
.sidebar {
  grid-area: side;
  background: linear-gradient(180deg, #12384a 0%, #102a3c 100%);
  color: #e7eef1;
  padding: 18px 12px 12px;
  display: flex; flex-direction: column;
  min-width: 0;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  position: sticky; top: 0;
  overflow-x: hidden;
  overflow-y: hidden;
}
.side-brand {
  display: flex; align-items: center; gap: 12px;
  flex: none;
  padding: 4px 10px 14px; border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 8px;
}
.logo-mark {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center;
  background: #f3c15c; color: #102a3c; font-weight: 700; font-size: 18px;
}
.side-brand strong { display: block; font-size: 15px; }
.side-brand em { display: block; font-style: normal; font-size: 12px; color: #9db4bf; }
.side-nav {
  flex: 1 1 0;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(231, 238, 241, .28) #12384a;
}
.side-nav::-webkit-scrollbar { width: 6px; height: 0; }
.side-nav::-webkit-scrollbar-track { background: #12384a; }
.side-nav::-webkit-scrollbar-thumb {
  background: rgba(231, 238, 241, .28);
  border-radius: 99px;
}
.side-nav::-webkit-scrollbar-corner { background: #12384a; }
.nav-group {
  padding: 2px 0;
  max-width: 100%;
  overflow: hidden;
}
.nav-children { max-width: 100%; overflow: hidden; }
.nav-group.is-collapsible:not(.is-open) > .nav-children { display: none; }
.nav-title,
.nav-item-link {
  appearance: none;
  -webkit-appearance: none;
}
.nav-title {
  width: 100%; max-width: 100%;
  text-align: left; background: transparent; border: 0; color: inherit;
  display: flex; align-items: center; gap: 10px;
  border-radius: 12px;
  padding: 10px 10px 10px 12px; min-height: 44px; font-weight: 650; color: #f2f7f8;
}
.nav-title-text {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-caret {
  flex: none;
  width: 7px; height: 7px;
  margin-left: 2px;
  border-right: 2px solid rgba(242, 247, 248, .5);
  border-bottom: 2px solid rgba(242, 247, 248, .5);
  transform: rotate(-45deg);
  transition: transform .16s ease;
}
.nav-group.is-open > .nav-title .nav-caret {
  transform: translateY(-2px) rotate(45deg);
}
.nav-item {
  position: relative;
  display: flex; align-items: center;
  margin: 2px 0 2px 8px;
  width: calc(100% - 8px);
  max-width: calc(100% - 8px);
  border-radius: 0 10px 10px 0;
  color: #b7c7d0; font-size: 13px;
}
.nav-item-link {
  flex: 1; min-width: 0;
  text-align: left; background: transparent; border: 0; color: inherit;
  padding: 8px 12px 8px 32px; min-height: 40px;
  border-radius: 0 10px 10px 0;
  font: inherit;
}
.nav-title:hover { background: rgba(255,255,255,.06); }
.nav-item:hover { background: rgba(255,255,255,.06); }

/* 一级选中：实心青绿胶囊 */
.nav-group.is-on > .nav-title,
.nav-title.is-on {
  background: #0f8f8a;
  color: #fff;
}
.nav-group.is-on > .nav-title:hover,
.nav-title.is-on:hover {
  background: #12a39d;
  color: #fff;
}
.nav-group.is-on > .nav-title .nav-caret {
  border-color: #fff;
}

/* 二级选中：浅青绿条 + 左边框，不是实心大胶囊 */
.nav-item.is-on {
  background: rgba(167, 232, 226, .16);
  box-shadow: inset 3px 0 0 #8ee0d8;
  color: #d8f6f1;
}
.nav-item.is-on:hover {
  background: rgba(167, 232, 226, .24);
  color: #ecfffb;
}
.nav-item:not(.is-on) .nav-item-link { color: #b7c7d0; }

.nav-ico { opacity: .9; }
.help-fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  top: auto;
  z-index: 25;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f3c15c;
  color: #102a3c;
  box-shadow: 0 8px 22px rgba(16, 42, 60, .18);
  cursor: pointer;
}
.help-fab .ico { width: 20px; height: 20px; }
.help-fab:hover,
.help-fab:focus-visible {
  background: #ffd27a;
}

.topbar {
  grid-area: top;
  background: rgba(255, 252, 247, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; position: sticky; top: 0; z-index: 20;
}
.crumb {
  margin: 0; color: var(--muted); font-size: 13px;
}
.topbar .right { display: flex; align-items: center; gap: 6px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: #d7efe9; color: var(--teal-2); font-weight: 700; font-size: 13px;
}
.who { color: var(--ink); font-weight: 600; margin-right: 4px; }
.topbar button.linkish {
  color: var(--muted); background: transparent; border: 0; min-height: 40px; padding: 0 10px; border-radius: 10px;
  display: inline-flex; align-items: center; gap: 6px;
}
.topbar button.linkish .ico { width: 16px; height: 16px; }
.topbar button.linkish:hover { background: #efe8da; color: var(--ink); }
.menu-btn {
  display: none; color: var(--ink); background: #efe8da; border: 0;
  width: 40px; height: 40px; border-radius: 10px; place-items: center;
}

.main {
  grid-area: main;
  padding: 22px 24px 32px;
  min-width: 0;
}
.mask, .sheet, .bottom-nav { grid-area: main; }
.page-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 24px; color: var(--ink); letter-spacing: .02em; }
.hello { margin: 0 0 4px; color: var(--muted); font-size: 13px; }

.welcome {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  margin-bottom: 18px;
}
.date-chip {
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px; color: var(--muted); font-size: 12px;
}

.bottom-nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--bottom-h) + env(safe-area-inset-bottom));
  padding: 6px 8px env(safe-area-inset-bottom);
  background: rgba(255,252,247,.94);
  border-top: 1px solid var(--line);
  grid-template-columns: repeat(4, 1fr);
  backdrop-filter: blur(10px);
}
.bottom-nav button {
  border: 0; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; min-height: 44px; border-radius: 10px;
}
.bottom-nav button.active { color: var(--teal-2); font-weight: 700; background: #e7f4f3; }

.sheet {
  position: fixed; inset: 0; z-index: 40; background: rgba(16, 42, 60, .45);
  display: flex; align-items: flex-end;
}
.sheet[hidden] { display: none; }
.sheet-body {
  background: var(--card); width: 100%; max-height: 80vh; overflow: auto;
  border-radius: 20px 20px 0 0; padding: 8px 12px 24px;
}
.sheet-handle { width: 42px; height: 4px; border-radius: 4px; background: #d7cfc2; margin: 8px auto 12px; }
.sheet-body h3 { margin: 0 12px 8px; }
.sheet-body .nav-title { color: var(--ink); }
.sheet-body .nav-title:hover { background: #efe8da; }

.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 18px 16px; box-shadow: var(--shadow);
  position: relative; overflow: hidden; cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(16,42,60,.14); }
.stat .num { font-size: 32px; font-weight: 720; color: var(--ink); letter-spacing: -.03em; }
.stat .lab { color: var(--muted); margin-top: 6px; }
.stat .go { position: absolute; right: 14px; bottom: 14px; color: var(--teal); font-size: 12px; }
.stat.t-teal { background: linear-gradient(180deg, #f3fbfa, var(--card)); }
.stat.t-sky { background: linear-gradient(180deg, #eef7fb, var(--card)); }
.stat.t-gold { background: linear-gradient(180deg, #fff8ea, var(--card)); }
.stat.t-rose { background: linear-gradient(180deg, #fdf2f0, var(--card)); }
.stat.t-ink { background: linear-gradient(180deg, #eef3f6, var(--card)); }
.stat::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--teal);
}
.stat.t-sky::before { background: var(--sky); }
.stat.t-gold::before { background: #e2b04a; }
.stat.t-rose::before { background: #d46a5e; }
.stat.t-ink::before { background: var(--ink); }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; box-shadow: var(--shadow);
}
.panel.wide { max-width: none; width: 100%; }
.hint { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.req { color: var(--danger); margin-right: 2px; font-weight: 700; }

.form-split {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(280px, .88fr);
  gap: 16px;
  align-items: start;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}
.form-grid > .field { margin-bottom: 0; }
.form-grid > .span-2,
.form-grid > .form-section-title { grid-column: 1 / -1; }
.form-section-title {
  margin: 4px 0 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: .02em;
}
.form-actions, .form-actions-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.form-actions-bar {
  position: sticky;
  bottom: 0;
  z-index: 6;
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.field.num input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.field input[type="date"] {
  padding-right: 10px;
  min-width: 0;
}
.field .field-note { margin-top: 6px; color: var(--muted); font-size: 12px; }
.field .field-note em { color: var(--danger); font-style: normal; font-weight: 650; }
.radios-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}
.radios-compact label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  min-height: 32px;
}
.table-wrap { overflow: hidden; background: var(--card); border: 1px solid #cfc4b3; border-radius: 16px; box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; min-width: 0; border: 1px solid #cfc4b3; }
table.data th, table.data td {
  padding: 10px 12px;
  border: 1px solid #cfc4b3;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
}
table.data td { white-space: normal; word-break: break-word; }
table.data th { background: #f7f1e6; color: var(--ink); font-weight: 600; position: sticky; top: 0; z-index: 1; }
table.data tbody tr:hover { background: #fbf7ef; }
table.data tbody tr.row-main.is-expanded { background: #eef6fb; }
table.data tbody tr.row-detail,
table.data tbody tr.row-detail:hover { background: transparent; }
table.data .ops { justify-content: center; align-items: center; }
table.data td:has(.ops) { white-space: normal; }
table.data tr.row-detail,
table.data tr.row-detail[hidden] { display: none !important; }
table.data tr.row-detail.is-open { display: table-row !important; }
table.data tr.row-detail > td {
  padding: 10px 12px;
  background: #d6ebf6;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
}
table.data tr.row-detail:hover > td { background: #d6ebf6; }
.detail-grid {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.detail-grid th, .detail-grid td {
  border: 1px solid #cfc4b3;
  padding: 8px 10px;
  text-align: center;
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
}
.detail-grid th {
  background: #eef3f6;
  color: var(--ink);
  font-weight: 600;
  width: 12%;
  white-space: nowrap;
}
.detail-grid td { background: #fff; width: 21%; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.tag.on { background: #e6f4ec; color: var(--ok); }
.tag.off { background: #fdecea; color: var(--danger); }

.search { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search input, .search select {
  height: 42px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; min-width: 200px; background: #fff;
}
.search select { min-width: 140px; }

.user-cards { display: none; gap: 10px; }
.user-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px;
  box-shadow: var(--shadow);
}
.user-card .name { font-weight: 650; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.user-card .meta { color: var(--muted); font-size: 13px; margin: 8px 0; }
.hs-note { display: flex; gap: 6px; align-items: center; justify-content: center; }
.hs-note input {
  width: 148px; max-width: 100%; height: 34px; border: 1px solid var(--line);
  border-radius: 9px; padding: 0 8px; background: #fff; text-align: left;
}
.user-card .hs-note { justify-content: stretch; margin-bottom: 8px; }
.user-card .hs-note input { flex: 1; width: auto; min-width: 0; }
.ops { display: flex; gap: 8px; flex-wrap: wrap; }

.dialog {
  position: fixed; inset: 0; z-index: 50; background: rgba(16, 42, 60, .48);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.dialog[hidden] { display: none; }
.dialog-body {
  background: var(--card); width: min(100%, 520px); max-height: 90vh; overflow: auto;
  border-radius: 18px; padding: 22px;
  box-shadow: var(--shadow);
}
.dialog-body.wide { width: min(100%, 760px); }
.dialog-body h2 { margin: 0 0 14px; font-size: 20px; color: var(--ink); }
.rule-picker { position: relative; margin-top: 8px; }
.rule-picker-search { width: 100%; }
.rule-picker-options { position: absolute; z-index: 2; left: 0; right: 0; max-height: 190px; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.rule-picker-option { display: block; width: 100%; padding: 8px 10px; border: 0; background: transparent; text-align: left; color: var(--text); cursor: pointer; }
.rule-picker-option:hover { background: var(--soft); }
.rule-picker-empty { padding: 8px 10px; color: var(--muted); }
.rule-picker-selected { display: grid; gap: 6px; margin-top: 8px; }
.rule-picker-tag { display: inline-flex; align-items: center; gap: 6px; width: fit-content; padding: 4px 8px; border-radius: 8px; background: var(--soft); color: var(--text); font-size: 12px; cursor: pointer; }
.rule-picker-tag input { margin: 0; }
.rule-picker-values { display: none; }
.checks { display: grid; gap: 2px; margin: 4px 0 14px; }
.checks label { display: flex; align-items: center; gap: 8px; min-height: 28px; color: var(--text); }
.field select, .field textarea, .filters select {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff;
  padding: 10px 12px; min-height: 42px;
}
.field textarea { min-height: 76px; resize: vertical; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.filters select { width: auto; min-width: 140px; }
.app-version-filters { display: flex; align-items: end; gap: 10px; flex-wrap: nowrap; }
.app-version-filters .field { width: 150px; flex: 0 0 150px; }
.app-version-filters .field input,
.app-version-filters .field select { min-height: 36px; height: 36px; padding: 6px 10px; }
@media (max-width: 760px) { .app-version-filters { flex-wrap: wrap; } }
#av-search, #ar-search { display: flex; align-items: end; gap: 10px; flex-wrap: nowrap; }
#av-search .field, #ar-search .field { width: 150px; flex: 0 0 150px; margin-bottom: 0; }
#av-search .field input, #av-search .field select, #ar-search .field input, #ar-search .field select { min-height: 36px; height: 36px; padding: 6px 10px; }
@media (max-width: 760px) { #av-search, #ar-search { flex-wrap: wrap; } }
.ss-wrap {
  position: relative;
  display: inline-block;
  min-width: 140px;
  vertical-align: middle;
  max-width: 100%;
}
.field .ss-wrap,
.field.span-2 .ss-wrap {
  display: block;
  width: 100%;
}
.search .ss-wrap { min-width: 140px; }
.filter-lab .ss-wrap { min-width: 140px; }
.ss-native {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}
.ss-input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  background: #fff;
  box-sizing: border-box;
  font: inherit;
  color: var(--text);
}
.ss-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 143, 138, .15);
}
.ss-input:disabled { background: #f4f1ea; color: var(--muted); }
.ss-menu {
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.ss-opt {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 12px;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}
.ss-opt:hover,
.ss-opt.is-on { background: #eef7f6; color: var(--teal-2); }
.ss-opt:disabled { color: var(--muted); cursor: default; }
.ss-empty { margin: 0; padding: 10px 12px; color: var(--muted); font-size: 13px; }
.school-filters { align-items: center; }
.school-filters .filter-lab {
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
  color: var(--muted); font-size: 13px;
}
.school-filters .filter-pager { margin-left: auto; }
.school-filters .pager { margin-top: 0; }
.tabs { display: flex; gap: 0; margin: 0 0 14px; flex-wrap: wrap; }
.tabs button {
  min-height: 40px; padding: 0 16px; border: 1px solid var(--line);
  background: #f4eee3; color: var(--muted); border-radius: 0; font-weight: 600;
}
.tabs button.active { background: #fff; color: var(--ink); border-bottom-color: #fff; }
.tab-panel[hidden] { display: none; }
.checks-inline { align-items: center; }
.checks-inline label { display: flex; align-items: center; gap: 6px; min-height: 28px; white-space: nowrap; }
.suggest { position: relative; }
.suggest-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 4;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  max-height: 220px; overflow: auto; box-shadow: var(--shadow);
}
.suggest-list[hidden] { display: none; }
.suggest-list button {
  display: block; width: 100%; text-align: left; padding: 8px 12px;
  background: #fff; border: 0; border-bottom: 1px solid #eee; color: var(--text);
}
.suggest-list button:hover { background: #f7f1e6; }
.dict-box {
  width: 100%; min-height: 88px; margin: 0 0 14px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; resize: vertical;
}
.linkish { background: none; border: 0; color: var(--teal); cursor: pointer; padding: 0; }
.radios {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
}
.radios label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  white-space: nowrap;
}
.pager { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: var(--muted); flex-wrap: wrap; }
.section-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 10px; }
.section-h h3 { margin: 0; font-size: 16px; color: var(--ink); }
.filters input {
  height: 42px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; min-width: 160px; background: #fff;
}
.placeholder {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 36px 24px; text-align: center; box-shadow: var(--shadow);
}
.placeholder .illus {
  width: 72px; height: 72px; margin: 0 auto 14px; border-radius: 20px;
  display: grid; place-items: center; background: #e7f4f3; color: var(--teal);
}
.mask { position: fixed; inset: 0; z-index: 25; background: rgba(16,42,60,.35); }
.mask[hidden] { display: none; }

@media (max-width: 1023px) {
  .form-split { grid-template-columns: 1fr; }
}

@media (max-width: 1199px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "top" "main"; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 28; width: min(80vw, 280px);
    transform: translateX(-105%); transition: transform .2s; min-height: 0;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .menu-btn { display: grid; }
}

@media (max-width: 767px) {
  .login-stage { grid-template-columns: 1fr; min-height: 0; }
  .login-brand { min-height: 180px; padding: 28px 24px; }
  .login-brand h1 { margin-top: 16px; font-size: 26px; }
  .login-brand ul { display: none; }
  .login-card { padding: 28px 22px 24px; }
  .main { padding: 16px 14px calc(var(--bottom-h) + 20px); }
  .bottom-nav { display: grid; }
  .sidebar { bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom)); }
  table.data { display: none; }
  .desk-only { display: none; }
  .user-cards { display: grid; }
  .cards { grid-template-columns: 1fr 1fr; }
  .who { display: none; }
  .toast { bottom: calc(var(--bottom-h) + 16px); }
  .help-fab {
    top: auto;
    bottom: calc(var(--bottom-h) + 18px);
    right: 16px;
  }
  .welcome { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .form-actions-bar {
    bottom: calc(var(--bottom-h) + env(safe-area-inset-bottom));
    border-radius: 12px 12px 0 0;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .main { padding: 18px; }
}

.sale-picker {
  display: flex;
  border: 1px solid #cfc4b3;
  height: 196px;
  background: #fff;
  overflow: hidden;
}
.sale-picker-cats {
  width: 22%;
  min-width: 88px;
  overflow: auto;
  border-right: 1px solid #cfc4b3;
}
.sale-picker-head {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid #cfc4b3;
  font-weight: 600;
  background: #f7f3ec;
}
.sale-picker-cats button,
.sale-picker-items button {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #cfc4b3;
  background: #fff;
  padding: 8px 6px;
  text-align: center;
  color: var(--text);
}
.sale-picker-cats button.is-on { background: #eef7f6; color: var(--teal-2); font-weight: 600; }
.sale-picker-items { flex: 1; overflow: auto; }
.sale-picker-q {
  position: sticky;
  top: 0;
  z-index: 1;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #cfc4b3;
  padding: 8px 12px;
  background: #fffcf7;
  box-sizing: border-box;
  font: inherit;
}
.sale-picker-items button { text-align: left; padding: 8px 12px; }
.sale-picker-items button[hidden],
.sale-picker-items button.is-filtered-out,
.sale-picker-empty.is-filtered-out { display: none !important; }
.sale-picker-items button.is-on { color: #c0392b; font-weight: 600; background: #fff6f4; }
.profit-panel {
  background: #f8f8ff;
  border: 1px solid #cfc4b3;
  padding: 12px;
  margin: 0 0 18px;
}
.profit-panel h3 { margin: 0 0 8px; text-align: center; }
.table-section-title { text-align: center; font-weight: 700; background: #d9d9d9; }
table.data tfoot td { font-weight: 650; background: #f3f3f3; }
.contract-edit-actions { justify-content: center; margin: 0 0 18px; }

.deploy-sheet { margin-bottom: 16px; }
.deploy-sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.deploy-sheet-head h3 { margin: 0 0 6px; }
.deploy-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
}
.deploy-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fffcf7;
}
.deploy-card .k { color: var(--muted); font-size: 12px; }
.deploy-card .v { font-weight: 650; margin-top: 6px; word-break: break-all; }
.deploy-card .s { font-size: 12px; color: var(--muted); margin-top: 4px; word-break: break-all; }
.deploy-hint { margin: 0 0 10px; color: var(--muted); }
.deploy-hint.is-danger { color: var(--danger); }
.deploy-log {
  max-height: 280px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #1b2430;
  color: #d6e4f0;
  font-size: 12px;
  white-space: pre-wrap;
}
.deploy-log.is-ok { box-shadow: inset 0 0 0 1px #1a7f4b; }
.deploy-log.is-fail { box-shadow: inset 0 0 0 1px #c0392b; }
.deploy-badge.success { color: #1a7f4b; }
.deploy-badge.failed { color: #c0392b; }
.deploy-badge.running { color: #c47b18; }
.deploy-secret { color: var(--danger); font-size: 12px; font-weight: 600; }
@media (max-width: 900px) {
  .deploy-cards { grid-template-columns: 1fr; }
}
.cf-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
}
.cf-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.cf-list { display: grid; gap: 8px; }
.cf-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffcf7;
}
.cf-thumb {
  flex: none;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}
.cf-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cf-meta { min-width: 0; }
.cf-meta strong { display: block; word-break: break-all; }
.cf-meta span { color: var(--muted); font-size: 12px; }
.cf-ops { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
.cf-preview {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(16, 42, 60, .55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.cf-preview[hidden] { display: none; }
.cf-preview-body {
  width: min(100%, 960px);
  height: min(90vh, 720px);
  background: #fff;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.cf-preview-bar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.cf-preview-body iframe,
.cf-preview-body img {
  flex: 1; width: 100%; border: 0; background: #f4f1ea; object-fit: contain;
}
.cf-preview-body iframe[hidden],
.cf-preview-body img[hidden] { display: none; }
