
:root {
  --navy: #19212e;
  --navy-light: #212b3a;
  --navy-border: #303b4c;
  --primary: #18b8ac;
  --primary-dark: #109b91;
  --primary-soft: #e6f8f6;
  --ink: #2b3440;
  --muted: #84909e;
  --line: #e6ebef;
  --canvas: #f4f6f8;
  --panel: #ffffff;
  --success: #20a879;
  --warning: #efaa39;
  --danger: #e45555;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .6; }
input, select, textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #dce3e8;
  border-radius: 3px;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
textarea { min-height: auto; resize: vertical; }
input::placeholder, textarea::placeholder { color: #adb6bf; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(24, 184, 172, .12);
}
label { display: flex; flex-direction: column; gap: 6px; color: #5c6875; font-size: 13px; }
.hidden { display: none !important; }

/* Login */
.login-view {
  position: relative;
  display: grid;
  min-height: 100vh;
  padding: 24px 24px 58px;
  place-items: center;
  background: #eef2f5;
}
.login-site-footer { position: absolute; right: 12px; bottom: 18px; left: 12px; color: #8a959f; font-size: 12px; text-align: center; }
.login-site-footer a { color: inherit; text-decoration: none; }
.login-site-footer a:hover { color: var(--primary-dark); text-decoration: underline; }
.login-panel {
  width: min(390px, 100%);
  padding: 34px 36px;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid var(--primary);
  box-shadow: 0 12px 30px rgba(28, 43, 57, .08);
}
.brand-mark {
  display: grid;
  width: 45px;
  height: 45px;
  color: #fff;
  font-size: 23px;
  font-weight: 700;
  background: var(--primary);
  border-radius: 3px;
  place-items: center;
}
.brand-mark.small { width: 34px; height: 34px; font-size: 17px; }
.eyebrow { margin: 0; color: #98a4ae; font-size: 10px; letter-spacing: 1px; }
.login-panel .eyebrow { margin-top: 15px; }
.login-panel h1 { margin: 6px 0 2px; color: #2d3743; font-size: 24px; font-weight: 600; }
.login-copy { margin: 0 0 22px; color: var(--muted); }
.login-panel label { margin-top: 13px; }
.primary-btn, .outline-btn {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 3px;
  font-weight: 500;
  transition: background .16s, border-color .16s, color .16s;
}
.primary-btn { color: #fff; background: var(--primary); }
.primary-btn:hover { background: var(--primary-dark); }
.outline-btn { color: #51606e; background: #fff; border: 1px solid #ccd5dc; }
.outline-btn:hover { color: var(--primary-dark); border-color: var(--primary); }
.login-panel .primary-btn { width: 100%; margin-top: 22px; }
.form-error { min-height: 20px; margin: 9px 0 0; color: var(--danger); font-size: 12px; }

/* Shell */
.app-view { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  width: 214px;
  padding: 0 0 14px;
  color: #aeb8c4;
  background: var(--navy);
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 67px;
  padding: 0 17px;
  border-bottom: 1px solid var(--navy-border);
}
.side-brand strong, .side-brand small { display: block; }
.side-brand strong { color: #f2f6f8; font-size: 16px; font-weight: 600; }
.side-brand small { margin-top: 1px; color: #8390a0; font-size: 11px; }
.sidebar nav { padding: 12px 9px; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 39px;
  gap: 11px;
  margin: 2px 0;
  padding: 0 11px;
  color: #aeb8c4;
  text-align: left;
  background: transparent;
  border-left: 2px solid transparent;
  border-radius: 2px;
  transition: color .15s, background .15s;
}
.nav-item span { width: 17px; color: #9ba8b7; font-size: 16px; text-align: center; }
.nav-item:hover { color: #f3f8f9; background: rgba(255, 255, 255, .045); }
.nav-item.active { color: #fff; background: var(--primary); border-left-color: #8af0e6; font-weight: 500; }
.nav-item.active span { color: #fff; }
.nav-group { margin: 2px 0; }
.nav-group-toggle { margin: 0; }
.nav-group-toggle b { font: inherit; font-weight: inherit; }
.nav-group-toggle i { margin-left: auto; color: #8f9cac; font-size: 15px; font-style: normal; transition: transform .16s; }
.nav-group.is-open .nav-group-toggle i { transform: rotate(180deg); }
.sub-nav { display: none; margin: 2px 0 5px; padding-left: 17px; }
.nav-group.is-open .sub-nav { display: block; }
.permission-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-top:8px; padding:10px; background:#f8fafb; border:1px solid #e6ebef; border-radius:4px; }
.permission-grid label { display:flex; align-items:center; gap:7px; min-height:32px; padding:6px 8px; color:#53616d; background:#fff; border:1px solid #e5eaed; border-radius:3px; font-size:13px; }
.permission-grid input { width:15px; height:15px; accent-color:var(--primary); }
.staff-permissions { min-width:0; }
.staff-permissions-head { display:flex; justify-content:space-between; align-items:center; }
.staff-permissions-head span { display:flex; gap:6px; }
.sub-nav-item { min-height: 34px; margin: 1px 0; padding-left: 15px; color: #96a3b1; font-size: 13px; }
.sub-nav-item span { color: #6f7d8d; font-size: 13px; }
.sub-nav-item.active { color: #e8fffd; background: rgba(24, 184, 172, .27); border-left-color: var(--primary); }
.side-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: auto 12px 0;
  padding: 13px 5px 0;
  color: #8491a0;
  border-top: 1px solid var(--navy-border);
  font-size: 12px;
}
.side-footer button { padding: 2px 4px; color: #c0c9d0; background: transparent; }
.side-footer button:hover { color: #fff; }
.main-content { display: flex; flex-direction: column; min-height: 100vh; width: calc(100% - 214px); margin-left: 214px; padding: 0 28px 32px; }
.admin-site-footer { display: flex; justify-content: center; margin-top: auto; padding: 28px 0 0; color: #8a959f; font-size: 12px; }
.admin-site-footer a { color: inherit; text-decoration: none; }
.admin-site-footer a:hover { color: var(--primary-dark); text-decoration: underline; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 67px;
  margin: 0 -28px 25px;
  padding: 0 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar h2 { margin: 1px 0 0; color: #27313b; font-size: 20px; font-weight: 600; }
.topbar-right { color: #8994a0; font-size: 12px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; background: var(--success); border-radius: 50%; }

/* Panels and overview */
.page-panel { display: none; }
.page-panel.active { display: block; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card { padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 3px; }
.stat-card p { margin: 0; color: #7e8a96; font-size: 12px; }
.stat-card strong { display: block; margin-top: 5px; color: #2d3843; font-size: 25px; font-weight: 600; line-height: 1.25; }
.stat-card span { display: block; margin-top: 7px; color: #9aa5ae; font-size: 11px; }
.split-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 14px; margin-top: 15px; }
.stacked-panels { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 15px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; }
.panel-head, .toolbar { display: flex; align-items: center; justify-content: space-between; }
.panel-head { min-height: 54px; padding: 10px 17px; border-bottom: 1px solid var(--line); }
.panel-head h3, .toolbar h3 { margin: 0; color: #2e3944; font-size: 16px; font-weight: 600; }
.panel-head p, .toolbar p { margin: 2px 0 0; color: #929da8; font-size: 12px; }
.notice-list { padding: 2px 17px; }
.notice-list > div { display: flex; align-items: center; gap: 10px; min-height: 45px; border-bottom: 1px solid #edf0f2; }
.notice-list > div:last-child { border-bottom: 0; }
.notice-list strong { margin-left: auto; color: #3d4a56; font-size: 15px; font-weight: 600; }
.notice-icon { display: grid; width: 23px; height: 23px; font-size: 12px; font-weight: 700; border-radius: 3px; place-items: center; }
.notice-icon.amber { color: #c5801c; background: #fff5df; }
.notice-icon.rose { color: #158f86; background: #e6f8f6; }
.notice-icon.green { color: #168c67; background: #e7f7f0; }
.quick-panel { padding-bottom: 14px; }
.quick-actions { display: grid; gap: 8px; padding: 14px 17px 0; }
.quick-actions button { min-height: 35px; padding: 0 11px; color: #53616d; text-align: left; background: #f8fafb; border: 1px solid #e5eaee; border-radius: 3px; }
.quick-actions button:hover { color: var(--primary-dark); border-color: #9ddfd8; background: var(--primary-soft); }

/* Data lists */
.toolbar { min-height: 48px; margin-bottom: 13px; }
.toolbar .primary-btn { min-width: 104px; }
.table-panel { overflow: hidden; }
.table-tools { display: flex; gap: 8px; padding: 11px 14px; background: #fafbfc; border-bottom: 1px solid var(--line); }
.table-tools input { max-width: 260px; }
.table-tools select, .toolbar select { width: 145px; }
.table-scroll { overflow: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 11px 14px; border-bottom: 1px solid #edf0f2; text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: #74818d; font-size: 12px; font-weight: 500; background: #f8fafb; }
td { color: #43505c; font-size: 13px; }
tbody tr:hover { background: #fbfdfd; }
tbody tr:last-child td { border-bottom: 0; }
.empty-cell { padding: 32px 14px; color: #9aa5af; text-align: center; }
.product-cell, .user-cell { display: flex; align-items: center; gap: 11px; min-width: 250px; }
.product-cell img { width: 46px; height: 46px; object-fit: cover; background: #eef2f4; border: 1px solid #e5eaed; border-radius: 3px; }
.product-cell strong { display: block; max-width: 280px; overflow: hidden; color: #344250; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.category-pill { display: inline-block; padding: 2px 8px; color: #65727d; background: #f2f5f7; border-radius: 2px; font-size: 12px; }
.product-type { display: inline-block; padding: 2px 8px; border-radius: 2px; font-size: 12px; }
.product-type.normal { color: #526b86; background: #edf3f9; }
.product-type.agent { color: #9a6b20; background: #fff4dc; }
.sale-price { color: #169d92; font-weight: 600; }
.old-price { display: block; margin-top: 1px; color: #a8b1b9; font-size: 11px; text-decoration: line-through; }
.tag { display: inline-block; padding: 2px 7px; color: #0e9288; background: var(--primary-soft); border-radius: 2px; font-size: 11px; }
.status { font-size: 12px; }
.status.on { color: var(--success); }
.status.off { color: #9aa5af; }
.table-action { display: inline-block; margin-right: 9px; padding: 0; color: #159f95; background: transparent; font-size: 13px; }
.table-action:hover { color: var(--primary-dark); text-decoration: underline; }
.table-action.danger { color: var(--danger); }
.balance-value { color: #0e9c91; font-weight: 600; }
.referral-code-cell { color: #647583; font-family: Consolas, "Microsoft YaHei", monospace; font-size: 12px; letter-spacing: .2px; }
#page-users .user-cell { min-width: 130px; }
.balance-current { padding: 12px 14px; color: #167d75; background: var(--primary-soft); border: 1px solid #bfece7; border-radius: 3px; font-size: 15px; font-weight: 600; }
.balance-tip { margin: 0; color: #8a7452; font-size: 12px; }
.entry-mode-panel { margin-bottom: 14px; overflow: hidden; }
.entry-mode-panel .panel-head .primary-btn { flex: 0 0 auto; }
.entry-mode-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px 17px; }
.entry-mode-options label { position: relative; display: block; cursor: pointer; }
.entry-mode-options input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.entry-mode-options span { display: block; min-height: 82px; padding: 15px 16px; background: #fafbfc; border: 1px solid #dfe5e9; border-radius: 3px; transition: border-color .16s, background .16s, box-shadow .16s; }
.entry-mode-options strong, .entry-mode-options small { display: block; }
.entry-mode-options strong { color: #344250; font-size: 14px; font-weight: 600; }
.entry-mode-options small { margin-top: 6px; color: #87939e; font-size: 12px; line-height: 1.55; }
.entry-mode-options input:checked + span { background: var(--primary-soft); border-color: var(--primary); box-shadow: 0 0 0 2px rgba(24, 184, 172, .08); }
.entry-mode-options input:checked + span strong { color: var(--primary-dark); }
.entry-mode-description { margin: 0; padding: 0 17px 15px; color: #75828e; font-size: 12px; }
.distribution-rules-panel { margin-top: 14px; }
.distribution-flow { display: grid; grid-template-columns: 1fr 34px 1fr 34px 1fr; align-items: center; margin: 0 0 14px; padding: 15px 17px; background: #fff; border: 1px solid var(--line); border-radius: 3px; }
.distribution-flow > div { display: grid; grid-template-columns: 28px 1fr; column-gap: 10px; align-items: center; }
.distribution-flow span { grid-row: 1 / 3; display: grid; width: 28px; height: 28px; color: #fff; background: var(--primary); border-radius: 50%; font-size: 12px; font-weight: 600; place-items: center; }
.distribution-flow strong, .distribution-flow small { display: block; }
.distribution-flow strong { color: #344250; font-size: 13px; font-weight: 600; }
.distribution-flow small { color: #929da8; font-size: 11px; }
.distribution-flow i { color: #b1bbc3; font-size: 18px; font-style: normal; text-align: center; }
.distribution-rule-table { min-width: 900px; }
.distribution-rule-table td { padding-top: 14px; padding-bottom: 14px; }
.distribution-rule-table td > small, .distribution-rule-table td > strong { display: block; }
.distribution-rule-table td > small { margin-top: 4px; color: #8c98a2; }
.rule-name { color: #344250; font-weight: 600; }
.reward-cell { display: flex; align-items: center; gap: 7px; }
.reward-cell b { display: inline-block; padding: 2px 6px; border-radius: 2px; font-size: 11px; font-weight: 500; }
.reward-cell.level-one b { color: #0d8e84; background: var(--primary-soft); }
.reward-cell.level-two b { color: #976c25; background: #fff4de; }
.reward-cell span { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.distribution-rule-modal-card { width: min(780px, 100%); }
.distribution-rule-form { gap: 12px; }
.rule-form-section { padding: 14px; background: #fafbfc; border: 1px solid #e5eaee; border-radius: 3px; }
.rule-section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.rule-section-heading > span { display: grid; flex: 0 0 25px; width: 25px; height: 25px; color: #fff; background: var(--primary); border-radius: 50%; font-size: 11px; font-weight: 600; place-items: center; }
.rule-section-heading strong, .rule-section-heading small { display: block; }
.rule-section-heading strong { color: #344250; font-size: 14px; }
.rule-section-heading small { margin-top: 1px; color: #919da7; font-size: 11px; }
.rule-fields { display: grid; grid-template-columns: 1.4fr .8fr .8fr; gap: 12px; }
.reward-level-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.reward-level-card { display: grid; grid-template-columns: 1.35fr .65fr; gap: 11px; padding: 13px; background: #fff; border: 1px solid #dfe5e9; border-top-width: 3px; }
.reward-level-card.level-one { border-top-color: var(--primary); }
.reward-level-card.level-two { border-top-color: #dda84d; }
.reward-level-head { grid-column: 1 / -1; padding-bottom: 8px; border-bottom: 1px solid #edf0f2; }
.reward-level-head b, .reward-level-head small { display: block; }
.reward-level-head b { color: #344250; font-size: 13px; }
.reward-level-head small { margin-top: 2px; color: #929da8; font-size: 11px; }
.rule-status-switch { padding: 9px 11px; background: var(--primary-soft); border: 1px solid #cceeea; }
.agent-level { display: inline-block; padding: 3px 8px; border-radius: 2px; font-size: 11px; font-weight: 500; }
.agent-level.normal { color: #587087; background: #edf3f8; }
.agent-level.advanced { color: #986914; background: #fff2d9; }
.level-config-panel { margin-bottom: 14px; overflow: hidden; }
.level-config-content { display: grid; grid-template-columns: minmax(230px, .72fr) minmax(400px, 1.28fr); gap: 18px 24px; align-items: center; padding: 20px; }
.level-config-content > .switch-line { display: flex; grid-column: 1 / -1; align-items: center; gap: 12px; min-height: 56px; max-width: none; padding: 12px 15px; color: #4e626d; background: linear-gradient(90deg, #f0faf8, #f8fcfb); border: 1px solid #d6eee9; border-radius: 6px; }
.level-config-content > .switch-line input { flex: 0 0 auto; width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
.level-config-content > .switch-line span { color: #315b5b; font-size: 14px; font-weight: 600; }
.level-config-content > .switch-line small { margin-left: auto; color: #7c9696; font-size: 12px; }
.level-config-content > label:not(.switch-line) { max-width: none; padding: 14px 16px; background: #fbfcfd; border: 1px solid #e5eaee; border-radius: 6px; }
.level-config-content > label:not(.switch-line) input { margin-top: 7px; }
.level-config-content label small { color: #8d99a4; font-size: 11px; }
.level-path { display: grid; grid-template-columns: 1fr 1.4fr 1fr; align-items: center; min-height: 62px; padding: 10px; background: #fafbfc; border: 1px solid #e5eaee; }
.level-path span, .level-path strong { padding: 10px; text-align: center; border-radius: 2px; }
.level-path span { color: #587087; background: #edf3f8; }
.level-path strong { color: #986914; background: #fff2d9; font-weight: 600; }
.level-path i { position: relative; color: #8895a0; font-size: 11px; font-style: normal; text-align: center; }
.level-path i::after { display: block; height: 1px; margin: 7px 12px 0; background: #cbd4da; content: ''; }
.level-users-panel { margin-bottom: 14px; }
.level-progress { width: 120px; height: 6px; overflow: hidden; background: #e8edf0; border-radius: 3px; }
.level-progress span { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.level-progress + small { display: block; margin-top: 4px; color: #8c98a2; font-size: 11px; }

/* Content configuration */
.content-grid { align-items: start; }
.content-list { padding: 4px 16px 10px; }
.workbench-shortcuts-panel { margin-top: 18px; }
.shortcut-admin-thumb { overflow: hidden; }
.shortcut-admin-thumb img { width: 100%; height: 100%; object-fit: contain; }
.content-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid #edf0f2; }
.content-row:last-child { border-bottom: 0; }
.content-thumb { width: 88px; height: 48px; object-fit: cover; background: #eef2f4; border: 1px solid #e5eaed; border-radius: 2px; }
.nav-thumb { width: 38px; height: 38px; object-fit: cover; background: #eef2f4; border-radius: 50%; }
.content-row-main { min-width: 0; flex: 1; }
.content-row-main strong, .content-row-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content-row-main small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.content-row-actions button { margin-left: 7px; }
.moment-content-cell { min-width: 300px; max-width: 460px; color: #65717d; font-size: 12px; line-height: 1.65; white-space: normal; }
#momentsBody .content-thumb { width: 92px; height: 68px; }
.moment-images-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.moment-images-preview img { width: 72px; height: 72px; object-fit: cover; border: 1px solid #e5eaed; border-radius: 3px; }
.moment-categories-list { max-height: 220px; margin: 0 20px 16px; overflow: auto; border-top: 1px solid #edf0f2; }
.moment-category-row { display: flex; align-items: center; gap: 10px; min-height: 44px; border-bottom: 1px solid #edf0f2; }
.moment-category-row span { flex: 1; color: #43505c; font-size: 13px; }
.moment-category-row small { color: #86929c; font-size: 12px; }

/* Forms and modals */
.settings-panel { width: min(920px, 100%); max-width: 920px; padding: 20px; box-sizing: border-box; }
.settings-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px -2px 20px; padding-bottom: 10px; border-bottom: 1px solid #eee2df; }
.settings-tabs button { flex: 1 1 145px; min-height: 40px; padding: 0 12px; color: #8f7a7b; background: #fff8f6; border: 1px solid transparent; border-radius: 6px; font-size: 13px; cursor: pointer; }
.settings-tabs button:hover { color: #a6535b; background: #fdf0ee; }
.settings-tabs button.active { color: #a6535b; background: #f9e7e4; border-color: #edcfcb; font-weight: 600; }
.settings-panel form { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.settings-panel form[data-settings-active="tabbar"], .settings-panel form[data-settings-active="wechat"] { grid-template-columns: 1fr; }
.settings-panel label:nth-child(3), .settings-panel .primary-btn { grid-column: 1 / -1; }
.settings-panel .tabbar-options label:nth-child(3) { grid-column: auto; }
.field-help { color: #98a3ad; font-size: 11px; line-height: 1.35; }
.switch-line { flex-direction: row; align-items: center; gap: 8px; min-height: 36px; }
.switch-line input { width: 16px; min-height: auto; margin: 0; accent-color: var(--primary); }
.settings-panel .switch-line .field-help { flex-basis: 100%; margin-left: 24px; }
.tabbar-options { padding: 13px 14px 12px; background: #fff8f6; border: 1px solid #f1dedb; border-radius: 4px; }
.tabbar-options-title { margin-bottom: 10px; color: #5f4a4a; font-size: 13px; font-weight: 600; }
.tabbar-options-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.tabbar-option { min-height: 34px; display: flex; align-items: center; gap: 7px; padding: 0 9px; color: #6e5b5b; background: #fff; border: 1px solid #f0e2df; border-radius: 3px; font-size: 12px; }
.tabbar-option input { width: 15px; min-height: auto; margin: 0; accent-color: var(--primary); }
.tabbar-options .field-help { display: block; margin-top: 9px; }
.security-note { margin-top: 20px; padding: 12px 14px; color: #6e624c; background: #fff9ed; border: 1px solid #f2dfb8; border-radius: 3px; font-size: 12px; }
.security-note p { margin: 4px 0 0; }
.modal { position: fixed; inset: 0; z-index: 10; display: grid; padding: 20px; background: rgba(20, 29, 40, .52); place-items: center; }
.modal-card { width: min(650px, 100%); max-height: 92vh; padding: 21px; overflow: auto; background: #fff; border-radius: 4px; box-shadow: 0 18px 50px rgba(18, 28, 39, .26); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 17px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 2px 0 0; color: #2d3843; font-size: 18px; font-weight: 600; }
.modal-close { width: 28px; height: 28px; padding: 0; color: #8b97a2; background: transparent; font-size: 24px; line-height: 1; }
.modal-close:hover { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 4px; padding: 12px 0 7px; border-bottom: 1px solid #e8edf0; }
.form-section-title strong { color: #344250; font-size: 14px; }
.form-section-title small { color: #8d99a4; font-size: 11px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 5px; }
.product-modal-card { width: min(920px, 100%); }
.asset-grid { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 9px; }
.asset-grid button { position: relative; width: 82px; height: 82px; padding: 0; overflow: hidden; background: #eef2f4; border: 1px solid #dfe5e9; border-radius: 3px; }
.asset-grid img { width: 100%; height: 100%; object-fit: cover; }
.asset-grid span { position: absolute; top: 3px; right: 3px; display: grid; width: 20px; height: 20px; color: #fff; background: rgba(42,51,60,.72); border-radius: 50%; line-height: 20px; place-items: center; }
.sku-editor { padding: 15px; background: #f7f9fa; border: 1px solid #e5eaed; border-radius: 3px; }
.sku-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.sku-editor-head strong,.sku-editor-head small { display: block; }
.sku-editor-head strong { color: #344250; font-size: 14px; }
.sku-editor-head small { margin-top: 3px; color: #8b97a1; font-size: 11px; }
.sku-row { padding: 11px; background: #fff; border: 1px solid #e1e7eb; border-radius: 3px; }
.sku-row + .sku-row { margin-top: 9px; }
.sku-row-main { display: grid; grid-template-columns: 1.5fr 1fr .7fr .7fr .7fr; gap: 8px; }
.sku-row-extra { display: flex; align-items: center; gap: 9px; margin-top: 8px; }
.sku-row-extra > input { min-width: 0; flex: 1; }
.sku-upload { position: relative; display: inline-flex; height: 34px; padding: 0 11px; overflow: hidden; align-items: center; color: #43505c; background: #edf1f3; border-radius: 3px; font-size: 12px; cursor: pointer; }
.sku-upload input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.sku-status { display: flex; align-items: center; flex-direction: row; gap: 5px; white-space: nowrap; }
.sku-status input { width: 15px; min-height: auto; }
.export-panel { margin-bottom: 14px; }
.export-actions { display: flex; flex-wrap: wrap; gap: 9px; padding: 0 18px 18px; }
.export-actions button { height: 34px; padding: 0 13px; color: #43505c; background: #edf1f3; border: 1px solid #dfe5e9; border-radius: 3px; }
.coupon-admin-grid { margin-top: 14px; align-items: start; }
.coupon-admin-grid .table-scroll { max-height: 430px; }
.scope-pill { display: block; max-width: 210px; color: #55636f; font-size: 12px; white-space: normal; }
.article-summary-cell { max-width: 300px; color: #71808b; white-space: normal; line-height: 1.5; }
.announcement-content-cell { max-width: 360px; color: #71808b; white-space: normal; line-height: 1.5; }
.article-cover-preview { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.article-cover-preview img { width: 180px; height: 92px; object-fit: cover; border: 1px solid #e5eaed; border-radius: 4px; }
.realname-photos { display: flex; gap: 6px; }
.realname-photos img { width: 52px; height: 34px; object-fit: cover; border: 1px solid #e5eaed; border-radius: 3px; }
.station-detail-modal-card { width: min(1050px, 100%); }
.station-detail-stats { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin-bottom:18px; }
.station-detail-stats div { padding:14px; background:#f5f8f8; border:1px solid #e4ebec; border-radius:4px; }
.station-detail-stats strong,.station-detail-stats span { display:block; }
.station-detail-stats strong { color:var(--primary); font-size:24px; }
.station-detail-stats span { margin-top:3px; color:#7d8a94; font-size:12px; }
.station-detail-content h4 { margin:20px 0 8px; color:#3f4b55; font-size:15px; }
.station-detail-content table { min-width:720px; }
.station-dividend-layout .toolbar { margin-bottom:14px; }
.station-dividend-tabs { display:flex; gap:4px; margin-bottom:14px; padding:4px; background:#eaf0f2; border:1px solid #dfe7e9; border-radius:4px; }
.station-dividend-tab { min-height:36px; flex:1; padding:0 16px; color:#687781; background:transparent; border-radius:3px; font-size:13px; transition:color .16s,background .16s,box-shadow .16s; }
.station-dividend-tab:hover { color:var(--primary-dark); background:#f8fbfb; }
.station-dividend-tab.active { color:#fff; background:var(--primary); box-shadow:0 2px 5px rgba(24,184,172,.2); }
.station-dividend-panel { display:none; }
.station-dividend-panel.active { display:block; }
.station-dividend-panel > #stationDividendStats { grid-template-columns:repeat(3,minmax(0,1fr)); margin-bottom:14px; }
.station-dividend-layout .stat-card { border-top:3px solid var(--primary); box-shadow:0 4px 12px rgba(28,43,57,.04); }
.station-dividend-layout .stat-card:nth-child(2) { border-top-color:#7aa7c2; }
.station-dividend-layout .stat-card:nth-child(3) { border-top-color:#d29b57; }
.station-dividend-config { margin-bottom:0; padding-bottom:17px; }
.station-dividend-config .panel-head { margin-bottom:15px; }
.station-dividend-config > label { padding:0 17px; }
.station-dividend-intro-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; padding:16px 17px; }
.station-dividend-intro-grid div { padding:14px; background:#f7fafb; border:1px solid #e5ecee; border-radius:3px; }
.station-dividend-intro-grid span, .station-dividend-intro-grid strong { display:block; }
.station-dividend-intro-grid span { color:#8a969f; font-size:12px; }
.station-dividend-intro-grid strong { margin-top:4px; color:#3c4a55; font-size:14px; font-weight:600; }
.station-dividend-tables { margin-top:14px; }
.station-dividend-tables .panel-head { background:#fbfcfd; }
.station-dividend-tables .panel + .panel { margin-top:14px; }
.station-dividend-tables table { min-width:860px; }
.station-dividend-link { min-width:28px; text-align:left; font-weight:600; text-decoration:underline; text-underline-offset:3px; }
.station-dividend-link:hover { color:var(--primary-dark); }
.station-dividend-record-tools { border-bottom:1px solid var(--line); }
.station-dividend-record-tools .table-tools { align-items:flex-end; border-bottom:0; }
.station-dividend-record-tools .table-tools label { display:flex; flex-direction:column; gap:5px; color:#71808a; font-size:12px; }
.station-dividend-record-tools .table-tools input, .station-dividend-record-tools .table-tools select { width:165px; height:34px; }
.station-dividend-record-tools .compact-stats { grid-template-columns:repeat(3,minmax(0,1fr)); margin:0; padding:0 14px 14px; }
.station-dividend-record-tools .compact-stats .stat-card { padding:12px 14px; }
.station-dividend-panel[data-station-dividend-panel="records"] table { min-width: 1080px; }
.station-dividend-panel[data-station-dividend-panel="records"] th:nth-child(1), .station-dividend-panel[data-station-dividend-panel="records"] td:nth-child(1) { width: 100px; }
.station-dividend-panel[data-station-dividend-panel="records"] th:nth-child(2), .station-dividend-panel[data-station-dividend-panel="records"] td:nth-child(2) { width: 160px; }
.station-dividend-panel[data-station-dividend-panel="records"] th:nth-child(4), .station-dividend-panel[data-station-dividend-panel="records"] td:nth-child(4) { width: 130px; }
.station-dividend-panel[data-station-dividend-panel="records"] th:nth-child(5), .station-dividend-panel[data-station-dividend-panel="records"] td:nth-child(5) { width: 110px; }
.station-dividend-panel[data-station-dividend-panel="records"] th:nth-child(6), .station-dividend-panel[data-station-dividend-panel="records"] td:nth-child(6) { min-width: 180px; }
#couponScopeTargets,#grantUserSelect { min-height: 130px; }
#couponCodesBody code { color: #8e5057; font-size: 12px; }
.toast { position: fixed; top: 18px; right: 20px; z-index: 20; display: none; padding: 9px 14px; color: #fff; background: #344250; border-radius: 3px; box-shadow: 0 8px 18px rgba(24, 35, 47, .22); font-size: 13px; }
.toast.show { display: block; }

@media (max-width: 1000px) {
  .sidebar { width: 190px; }
  .main-content { width: calc(100% - 190px); margin-left: 190px; padding-right: 20px; padding-left: 20px; }
  .topbar { margin-right: -20px; margin-left: -20px; padding-right: 20px; padding-left: 20px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .station-dividend-panel > #stationDividendStats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .permission-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .sidebar { position: static; width: 100%; height: auto; padding-bottom: 0; }
  .app-view { display: block; }
  .side-brand { height: 55px; }
  .sidebar nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; max-height: 270px; padding: 7px; }
  .nav-group, .sub-nav { display: contents; margin: 0; padding: 0; }
  .nav-group.is-open .sub-nav { display: contents; }
  .nav-group-toggle i { display: none; }
  .sub-nav-item { min-height: 36px; margin: 0; padding: 0 4px; }
  .nav-item { justify-content: center; min-height: 36px; gap: 4px; padding: 0 4px; border-left: 0; font-size: 11px; }
  .nav-item span { width: auto; font-size: 13px; }
  .side-footer { display: none; }
  .main-content { width: 100%; min-height: 100vh; margin: 0; padding: 0 12px 24px; }
  .admin-site-footer { padding-top: 22px; }
  .topbar { min-height: 57px; margin: 0 -12px 16px; padding: 0 12px; }
  .topbar-right { display: none; }
  .topbar h2 { font-size: 18px; }
  .stats-grid { gap: 8px; }
  .station-dividend-tabs { overflow-x:auto; }
  .station-dividend-tab { min-width:112px; padding:0 10px; white-space:nowrap; }
  .station-dividend-panel > #stationDividendStats { grid-template-columns: 1fr; }
  .station-dividend-intro-grid { grid-template-columns:1fr; }
  .stat-card { padding: 13px; }
  .stat-card strong { font-size: 21px; }
  .toolbar { align-items: flex-start; gap: 9px; }
  .toolbar .primary-btn { min-width: auto; padding: 0 9px; }
  .table-tools { flex-wrap: wrap; }
  .table-tools input, .table-tools select { max-width: none; }
  .form-grid, .settings-panel form { grid-template-columns: 1fr; }
  .tabbar-options-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .full, .settings-panel label:nth-child(3), .settings-panel .primary-btn { grid-column: auto; }
  .content-grid { display: block; }
  .content-grid > .panel + .panel { margin-top: 14px; }
  .entry-mode-panel .panel-head { align-items: flex-start; gap: 10px; }
  .entry-mode-options { grid-template-columns: 1fr; }
  .distribution-flow { grid-template-columns: 1fr; gap: 9px; }
  .distribution-flow i { transform: rotate(90deg); }
  .rule-fields, .reward-level-grid { grid-template-columns: 1fr; }
  .reward-level-card { grid-template-columns: 1fr; }
  .reward-level-head { grid-column: auto; }
  .level-config-content { grid-template-columns: 1fr; }
  .level-config-content > .switch-line { grid-column: auto; align-items: flex-start; flex-wrap: wrap; gap: 8px 10px; }
  .level-config-content > .switch-line small { width: 100%; margin-left: 28px; }
  .level-path { grid-template-columns: 1fr; gap: 7px; }
  .level-path i::after { display: none; }
  .modal { padding: 10px; }
  .modal-card { padding: 16px; }
  .sku-row-main { grid-template-columns: 1fr 1fr; }
  .sku-row-extra { align-items: stretch; flex-direction: column; }
}
.company-settings-panel { display: none; margin-top: 20px; }
.company-settings-panel .panel-head { margin-bottom: 18px; }
.category-manage-list { margin-top: 22px; border-top: 1px solid var(--line, #eee); }
.category-manage-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line, #eee); }
.category-manage-row > span { flex: 1; font-weight: 600; }
.category-manage-row small { color: #8d7777; }
.station-invite-records-panel { display: none; margin-top: 20px; }
