:root {
  --bg: #f2f2f4;
  --card: #ffffff;
  --topbar-bg: #17161a;
  --sidebar-w: 248px;
  --accent: #ff6a00;
  --accent-soft: #fff3ea;
  --text: #222226;
  --muted: #9a9aa0;
  --muted2: #c0c0c6;
  --border: #ebebee;
  --green-bg: #dcf6e4;
  --green-text: #2ea85a;
  --radius: 12px;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}

#app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- top bar ---------- */
.topbar {
  height: 64px;
  background: linear-gradient(180deg, #1b1a1f 0%, #151419 100%);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: relative;
  z-index: 30;
}
.tb-left { display: flex; align-items: center; gap: 10px; }
.tb-logo { display: flex; gap: 3px; }
.tb-logo i { display: block; width: 11px; height: 22px; border-radius: 4px; background: #fff; }
.tb-logo i + i { border-radius: 0 4px 4px 0; margin-left: -3px; opacity: .85; }
.tb-title { color: #fff; font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.tb-center {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 34px;
}
.tb-tab { color: #d6d6da; font-size: 15px; padding: 6px 2px; position: relative; cursor: pointer; }
.tb-tab.active { color: #fff; font-weight: 600; }
.tb-tab.active::after {
  content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  bottom: -14px; width: 20px; height: 3px; border-radius: 3px; background: #fff;
}
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.tb-icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: #2c2b31; color: #cfcfd4; display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: none;
}
.tb-icon-btn svg { width: 16px; height: 16px; }
.tb-user {
  display: flex; align-items: center; gap: 10px;
  background: #2b2a30; border-radius: 22px; padding: 5px 14px 5px 5px; cursor: pointer;
}
.tb-user .avatar { width: 34px; height: 34px; }
.tb-user .u-meta { line-height: 1.25; }
.tb-user .u-name { color: #fff; font-size: 13px; font-weight: 600; }
.tb-user .u-role { color: #9b9ba1; font-size: 11px; }
.tb-user .u-caret { color: #cfcfd4; margin-left: 4px; }

/* ---------- body / layout ---------- */
.body { flex: 1; display: flex; min-height: 0; }
.sidebar { width: var(--sidebar-w); flex-shrink: 0; padding: 16px 12px; overflow-y: auto; }
.main { flex: 1; min-width: 0; padding: 16px 16px 16px 4px; }
.page-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  height: 100%; overflow: auto; padding: 28px 34px;
}

/* ---------- sidebar menu ---------- */
.menu { display: flex; flex-direction: column; }
.mi-ic { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mi-ic svg, .mi-ic img { width: 18px; height: 18px; }
.caret { display: inline-flex; align-items: center; justify-content: center; color: #b7b7bd; flex-shrink: 0; transition: transform .2s; }
.caret svg { width: 16px; height: 16px; }
.menu-item {
  display: flex; align-items: center; gap: 12px;
  height: 46px; padding: 0 14px; border-radius: 10px; cursor: pointer;
  color: #2c2c30; font-size: 14px;
}
.menu-item .mi-ic { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; color: #2c2c30; }
.menu-item .mi-ic svg, .menu-item .mi-ic img { width: 18px; height: 18px; }
.menu-item.active { background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.06); color: #111; font-weight: 600; }
.menu-item:hover { background: rgba(255,255,255,.55); }
.menu-group { display: flex; flex-direction: column; }
.mg-head {
  display: flex; align-items: center; gap: 12px; height: 46px; padding: 0 14px;
  border-radius: 10px; cursor: pointer; color: #2c2c30; font-size: 14px;
}
.mg-head .caret { margin-left: auto; transition: transform .2s; }
.mg-head { font-weight: 400; }
.mg-head.open { color: #111; font-weight: 500; }
.mg-head.open .caret { transform: rotate(180deg); }
.mg-body { display: none; padding-left: 46px; }
.mg-head.open + .mg-body { display: block; }
.mg-body .menu-item { height: 42px; font-size: 13.5px; color: #3a3a3e; }
.mg-body .menu-item.active {
  background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.06); color: #111; font-weight: 600;
}

/* ---------- page head ---------- */
.page-head { display: flex; align-items: center; margin-bottom: 20px; }
.page-head .ph-title { font-size: 19px; font-weight: 700; }
.page-head .ph-sub { font-size: 13px; color: var(--muted); margin-left: 10px; }
.page-head .ph-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ---------- generic ---------- */
.link { color: var(--accent); cursor: pointer; font-size: 13px; }
.link:hover { text-decoration: underline; }
.link.muted { color: #8a8a90; }
.btn {
  border: none; cursor: pointer; border-radius: 8px; font-size: 13px; padding: 0 16px; height: 34px;
}
.btn-dark { background: #17171a; color: #fff; }
.btn-outline { background: transparent; border: 1px solid #d9d9de; color: #333; }
.btn-primary { background: var(--accent); color: #fff; }
.btn:hover { opacity: .92; }

/* section label */
.section-label { font-size: 14px; font-weight: 600; color: #333; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead th {
  text-align: left; color: #707077; font-weight: 400; font-size: 13px;
  padding: 12px 16px; background: #fafafb; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table tbody td {
  padding: 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: #2a2a2e;
}
.table tbody tr:last-child td { border-bottom: none; }

/* status tag */
.tag {
  display: inline-block; background: var(--green-bg); color: var(--green-text);
  border-radius: 4px; padding: 2px 8px; font-size: 12px;
}
.tag.gray { background: #f1f1f3; color: #8a8a90; }

/* ---------- home: script management ---------- */
.home-cols { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; height: 100%; }
.home-cols .page-card { height: auto; min-height: 100%; }
.home-grid { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.col-head { display: flex; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.col-head .ch1 { width: 200px; flex-shrink: 0; font-size: 13px; color: #707077; }
.col-head .ch2 { flex: 1; font-size: 13px; color: #707077; padding-left: 40px; }
.script-row { display: flex; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.script-row:last-child { border-bottom: none; }
.script-info { width: 200px; flex-shrink: 0; display: flex; gap: 12px; }
.cover {
  width: 46px; height: 62px; border-radius: 6px; flex-shrink: 0;
  background: linear-gradient(160deg, #f7c3c9 0%, #f0a9b4 60%, #e7919f 100%);
  position: relative; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.cover::before {
  content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1px; background: rgba(0,0,0,.12);
}
.cover-text {
  position: absolute; inset: 6px 4px; display: flex; flex-wrap: wrap; align-content: flex-start;
  writing-mode: vertical-rl; font-size: 8px; letter-spacing: 1px; color: #7a2b3a;
}
.script-title { font-size: 15px; font-weight: 600; color: #1c1c1f; }
.script-meta { margin-top: 12px; font-size: 13px; color: #5a5a60; }
.nodes { flex: 1; position: relative; padding-top: 2px; }
.node-track {
  position: relative; height: 2px; background: #ececf0; margin: 6px 2px 14px; border-radius: 2px;
}
.node-track .fill {
  position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #ffb873, var(--accent));
  border-radius: 2px; transition: width .3s;
}
.node-track .pin {
  position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--accent);
}
.node-labels { display: flex; justify-content: space-between; font-size: 12px; color: #6c6c72; }

/* ---------- home: right rail ---------- */
.rail { display: flex; flex-direction: column; gap: 20px; }
.rail-card { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 18px; }
.rail-card .rc-head { display: flex; align-items: center; margin-bottom: 14px; }
.rail-card .rc-head .rc-title { font-size: 15px; font-weight: 700; }
.rail-card .rc-head .rc-all { margin-left: auto; }
.banner {
  border-radius: 10px; overflow: hidden; background: linear-gradient(135deg, #2a1150 0%, #3c1e6e 40%, #6a2a8e 75%, #9c3b8e 100%);
  color: #fff; padding: 20px 16px 18px; text-align: center; margin-bottom: 14px; position: relative;
}
.banner::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 50% 120%, rgba(255,80,180,.45), transparent 60%);
}
.banner .b-top { font-size: 8px; opacity: .85; letter-spacing: 1px; position: relative; z-index: 1; }
.banner .b-title { font-size: 22px; font-weight: 800; letter-spacing: 2px; margin-top: 6px; position: relative; z-index: 1; }
.banner .b-sub { font-size: 12px; opacity: .9; margin-top: 2px; font-style: italic; position: relative; z-index: 1; }
.ann-list { display: flex; flex-direction: column; }
.ann-item {
  display: flex; align-items: center; justify-content: space-between; padding: 11px 2px; font-size: 13.5px;
  cursor: pointer; color: #2a2a2e;
}
.ann-item .chev { color: #c6c6cc; }
.chev { display: inline-flex; align-items: center; justify-content: center; }
.chev svg { width: 14px; height: 14px; }
.ann-item.hl { color: var(--accent); font-weight: 600; }
.act-list { display: flex; flex-direction: column; gap: 14px; }
.act-item { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.act-icon {
  width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.act-icon svg { width: 26px; height: 26px; }
.act-icon.pink { background: #fde7ee; }
.act-icon.purple { background: #ece4fb; }
.act-icon.green { background: #e8f8d8; }
.act-title { font-size: 14px; font-weight: 600; }

/* ---------- account info ---------- */
.kv { display: flex; flex-direction: column; gap: 22px; }
.kv-row { display: flex; align-items: center; min-height: 52px; }
.kv-label { width: 190px; text-align: right; padding-right: 30px; color: #8a8a90; font-size: 13px; flex-shrink: 0; }
.kv-value { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.kv-value.with-action { width: 100%; justify-content: space-between; }
.kv-action { display: flex; gap: 22px; padding-left: 40px; }
.kv-action .link { font-size: 13px; }
.avatar { border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; flex-shrink: 0; }
.avatar.lg { width: 80px; height: 80px; font-size: 30px; }
.avatar.sm { width: 32px; height: 32px; font-size: 15px; }
.section-title { font-size: 15px; font-weight: 700; margin: 28px 0 14px; }
.avatar-cover { width: 80px; height: 80px; border-radius: 50%; background: linear-gradient(160deg,#3aa7a0,#2b8f88); position: relative; overflow: hidden; }
.avatar-cover::before { content:""; position:absolute; width:34px;height:34px;border-radius:50%;background:#f4f7f3;left:22px;top:18px; }
.avatar-cover::after { content:""; position:absolute; width:13px;height:13px;border-radius:50%;background:#16161a;left:33px;top:29px; }
.avatar-cover .cap { position:absolute; left:0;right:0;bottom:0;height:22px;background:rgba(20,40,40,.55);color:#fff;font-size:11px;display:flex;align-items:center;justify-content:center; }
.avatar-teal { background: linear-gradient(160deg,#3aa7a0,#2b8f88); }

/* ---------- members ---------- */
.filter-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.select-wrap { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.select-label { font-size: 12px; color: #8a8a90; }
.select {
  background: #fff; border: 1px solid #e2e2e6; border-radius: 8px; height: 34px; padding: 0 30px 0 12px;
  font-size: 13px; color: #333; appearance: none; cursor: pointer; min-width: 128px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.search-box {
  border: 1px solid #e2e2e6; border-radius: 8px; height: 34px; padding: 0 12px; font-size: 13px; min-width: 200px;
  display: flex; align-items: center; gap: 8px; color: #8a8a90;
}
.search-box input { border: none; outline: none; flex: 1; font-size: 13px; color: #333; }
.search-box svg { width: 15px; height: 15px; color: #9a9aa0; }
.note-box {
  display: flex; align-items: center; gap: 8px; background: #f5f7fb; border-radius: 8px; padding: 10px 14px;
  font-size: 12.5px; color: #5a5a63; margin-bottom: 16px;
}
.note-box svg { width: 15px; height: 15px; color: #4a90e2; flex-shrink: 0; }
.member-cell { display: flex; align-items: center; gap: 12px; }
.member-cell .m-name { font-size: 14px; color: #1c1c1f; }
.member-cell .m-mid { font-size: 12px; color: #9a9aa0; margin-top: 2px; }
.copy-ic { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; color: #b8b8be; vertical-align: middle; }
.copy-ic svg { width: 14px; height: 14px; }
.chev-inline { display: inline-flex; vertical-align: middle; color: #b0b0b6; }
.chev-inline svg { width: 12px; height: 12px; }

/* ---------- settle income ---------- */
.tab-pill { display: inline-flex; align-items: center; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 5px 12px; font-size: 13px; font-weight: 600; }

/* ---------- settle works ---------- */
.works-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* ---------- identity ---------- */
.entity-card {
  display: flex; align-items: center; gap: 16px; border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px;
}
.entity-ic { width: 48px; height: 48px; border-radius: 10px; background: #fdeee2; display: flex; align-items: center; justify-content: center; }
.entity-ic svg { width: 26px; height: 26px; color: var(--accent); }
.entity-name { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.entity-tag { font-size: 11px; color: #8a8a90; border: 1px solid #e2e2e6; border-radius: 4px; padding: 1px 6px; }
.entity-cert { font-size: 12px; color: #9a9aa0; margin-top: 4px; }

/* ---------- 客服中心 button ---------- */
.cs-button {
  position: fixed; right: 24px; bottom: 22px; z-index: 40; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px; background: transparent; padding: 0;
}
.cs-button .cs-ic {
  width: 44px; height: 44px; border-radius: 50%; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.16);
  display: flex; align-items: center; justify-content: center; color: #17171a;
}
.cs-button .cs-ic svg { width: 22px; height: 22px; }
.cs-button .cs-label { font-size: 12px; color: #2a2a2e; font-weight: 600; background: #fff; padding: 1px 8px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0,0,0,.1); }
.cs-button:hover { transform: translateY(-1px); }

/* ---------- overlay / editor ---------- */
.overlay {
  position: fixed; inset: 0; background: rgba(20,20,24,.5); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 30px;
}
.editor-card {
  background: #fff; border-radius: 14px; width: 900px; max-width: 100%; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.3);
}
.editor-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; }
.editor-head .eh-title { font-size: 16px; font-weight: 700; }
.editor-head .eh-sub { font-size: 12px; color: #9a9aa0; margin-left: 12px; }
.editor-head .eh-close { margin-left: auto; cursor: pointer; color: #9a9aa0; font-size: 20px; line-height: 1; }
.editor-tabs { display: flex; gap: 4px; padding: 0 22px; border-bottom: 1px solid var(--border); }
.editor-tab { padding: 12px 8px; margin-right: 16px; cursor: pointer; font-size: 13px; color: #6a6a70; border-bottom: 2px solid transparent; }
.editor-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.editor-body { padding: 18px 22px; overflow: auto; flex: 1; }
.editor-tools { display: flex; align-items: center; margin-bottom: 14px; }
.editor-tools .et-title { font-size: 13px; font-weight: 600; }
.editor-tools .et-btn { margin-left: 12px; }
.editor-tools .et-muted { margin-left: auto; font-size: 12px; color: #9a9aa0; }
.editor-foot {
  padding: 14px 22px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 12px;
}
.editor-foot .save-hint { margin-right: auto; font-size: 12px; color: #9a9aa0; }

/* editable table */
.edtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.edtable thead th { text-align: left; color: #707077; font-weight: 400; padding: 8px 10px; background: #fafafb; border-bottom: 1px solid var(--border); white-space: nowrap; }
.edtable tbody td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.edtable input, .edtable select {
  width: 100%; border: 1px solid #e2e2e6; border-radius: 6px; padding: 7px 9px; font-size: 13px; color: #333; font-family: inherit;
}
.edtable input:focus, .edtable select:focus { border-color: var(--accent); outline: none; }
.row-del { color: #e34; cursor: pointer; width: 18px; height: 18px; flex-shrink: 0; }
.edtable .ops { display: flex; gap: 8px; }
.edtable .ops .row-del { background: none; border: none; display: flex; align-items: center; }

/* form editor */
.form-grid { display: grid; grid-template-columns: 130px 1fr; gap: 14px 12px; align-items: center; }
.form-grid .fl { text-align: right; color: #8a8a90; font-size: 13px; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%; border: 1px solid #e2e2e6; border-radius: 6px; padding: 8px 10px; font-size: 13px; color: #333; font-family: inherit;
}
.form-grid textarea { min-height: 54px; resize: vertical; }
.empty-hint { color: #b0b0b6; text-align: center; padding: 30px 0; font-size: 13px; }

/* toast */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: #17171a; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 6px 18px rgba(0,0,0,.25); animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 登录门禁 ---------- */
body.locked #topbar, body.locked .body, body.locked .cs-button { display: none; }
body.locked { overflow: hidden; }
.login-wrap {
  position: fixed; inset: 0; z-index: 200; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 360px; background: #fff; border-radius: 16px; box-shadow: 0 16px 44px rgba(0,0,0,.12);
  padding: 36px 34px; display: flex; flex-direction: column; align-items: center; text-align: center;
}
.login-logo .tb-logo i { background: #17171a; }
.login-title { font-size: 20px; font-weight: 700; margin-top: 16px; }
.login-sub { font-size: 13px; color: #9a9aa0; margin-top: 6px; }
.login-err { width: 100%; margin-top: 14px; text-align: left; font-size: 12px; color: #c0392b; background: #fdecea; border-radius: 8px; padding: 8px 12px; }
.login-input {
  width: 100%; margin-top: 20px; border: 1px solid #e2e2e6; border-radius: 8px; height: 42px;
  padding: 0 14px; font-size: 14px; color: #333; text-align: center; outline: none;
}
.login-input:focus { border-color: var(--accent); }
.login-msg { min-height: 18px; margin-top: 8px; font-size: 12px; color: #c0392b; }
.login-btn { width: 100%; height: 42px; margin-top: 8px; background: #17171a; }

/* scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d6d6da; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }
