:root {
  color-scheme: dark;
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  color: #e8edf7;
  background: #05070b;
  --blue: #4d7cff;
  --blue-soft: #172346;
  --green: #38d6a2;
  --line: #252b36;
  --muted: #8e99aa;
}

.institution-management-page { max-width: 1500px; margin: 0 auto; }
.institution-toolbar { display: flex; align-items: end; gap: 14px; flex-wrap: wrap; }
.institution-create-form { display: flex; align-items: end; gap: 10px; flex: 1; min-width: 320px; }
.institution-create-form label { flex: 0 0 auto; }
.institution-layout { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 18px; margin-top: 18px; align-items: start; }
.institution-list-card, .institution-detail-card { min-width: 0; }
.institution-list { display: grid; gap: 6px; padding: 12px; max-height: 680px; overflow: auto; }
.institution-list-item { display: flex; align-items: center; width: 100%; border: 1px solid var(--border-color, #e5e7eb); border-radius: 8px; background: transparent; color: inherit; overflow: hidden; }
.institution-list-item:hover, .institution-list-item.selected { border-color: #fa9d3b; background: rgba(250,157,59,.1); }
.institution-list-select { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex: 1; min-width: 0; height: auto; padding: 12px; border: 0; background: transparent; color: inherit; cursor: pointer; text-align: left; }
.institution-list-delete { flex: 0 0 36px; width: 36px; height: 36px; padding: 0; margin-right: 6px; border: 0; border-radius: 50%; background: transparent; color: #9ca3af; font-size: 22px; line-height: 1; cursor: pointer; }
.institution-list-delete:hover { background: rgba(239,68,68,.14); color: #ef4444; }
.institution-list-item small, .institution-native-heading code, .institution-account-item code { color: #8b8b8b; font-size: 12px; overflow-wrap: anywhere; }
.institution-slot { font-style: normal; font-weight: 700; margin-right: 4px; }
.institution-slot.has-room { color: #12864c; }
.institution-slot.is-full { color: #e5484d; }
.institution-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.institution-data { display: grid; gap: 14px; padding: 4px 0; }
.institution-native-group { border: 1px solid var(--border-color, #e5e7eb); border-radius: 10px; overflow: hidden; }
.institution-native-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; list-style: none; background: rgba(127,127,127,.08); cursor: pointer; }
.institution-native-heading::-webkit-details-marker { display: none; }
.institution-native-toggle { flex: 0 0 auto; color: #8e99aa; font-size: 11px; transition: transform .15s ease; }
.institution-native-group[open] .institution-native-toggle { transform: rotate(90deg); }
.institution-native-identity { flex: 1; min-width: 0; }
.institution-native-heading h3 { margin: 0 0 4px; }
.institution-account-tools { display: flex; align-items: center; gap: 10px; padding: 12px 16px 0; }
.institution-account-search { flex: 1; min-width: 180px; height: 36px; }
.institution-account-tools span { flex: 0 0 auto; color: #8b8b8b; font-size: 12px; }
.institution-account-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; padding: 14px 16px; }
.institution-account-item { display: grid; gap: 4px; min-width: 0; padding: 10px; border: 1px solid var(--border-color, #e5e7eb); border-radius: 7px; }
.institution-account-item[hidden] { display: none; }
.institution-account-item strong { overflow-wrap: anywhere; }
.institution-account-item small { color: #888; overflow-wrap: anywhere; }
.institution-account-search-empty { padding: 18px 16px; color: var(--muted); font-size: 13px; text-align: center; }
.institution-no-accounts { padding: 14px 16px; color: var(--muted); font-size: 13px; }
.danger { color: #d93025; border-color: #d93025; }
.institution-preview-shell { user-select: none; }
@media (max-width: 800px) { .institution-layout { grid-template-columns: minmax(0, 1fr); } .institution-create-form { min-width: 0; width: 100%; } .institution-toolbar > input { width: 100%; } }

* { box-sizing: border-box; }
body { margin: 0; min-width: 1050px; background: #05070b; }
/* 表单控件统一 13px：原先 font: inherit 会继承 body 的 16px，导致按钮文字比界面其它文字大一截、
   长文案被折成多行撑出固定高度；同时禁止换行，改用 flex 撑宽。 */
button, input, select, textarea { font: inherit; font-size: 13px; line-height: 1.35; }
button { white-space: nowrap; }
button:focus-visible, a.file-links-button:focus-visible { outline: 2px solid #6f96ff; outline-offset: 2px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 26px 38px;
  color: white;
  background: linear-gradient(120deg, #090d16, #111a2c 65%, #162544);
  border-bottom: 1px solid #283247;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .38);
}
.eyebrow { font-size: 11px; letter-spacing: .18em; opacity: .72; }
h1 { margin: 5px 0 4px; font-size: 25px; }
.topbar p { margin: 0; opacity: .78; font-size: 13px; }
.status-pill { padding: 9px 14px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; background: rgba(255,255,255,.12); font-size: 13px; }
.status-pill.ready { background: rgba(15, 187, 132, .24); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

main { padding: 24px 30px 50px; }
.card { background: #101318; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 5px 18px rgba(0, 0, 0, .28); }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 16px; }
.toolbar > * { flex: 0 0 auto; }
.toolbar label, .toolbar-field { color: var(--muted); font-size: 12px; }
/* 复选框类字段的说明文字不换行：否则被挤窄后会一字一行，把整条工具栏撑高并顶出右边界 */
.toolbar-field > span { display: block; white-space: nowrap; }
.toolbar-field > label { display: flex; align-items: center; gap: 6px; margin-top: 6px; white-space: nowrap; }
.toolbar-field input[type="checkbox"] { width: 15px; height: 15px; accent-color: #4d7cff; }
.toolbar-switches { display: flex; align-items: end; gap: 16px; margin-left: auto; }
input, select, textarea { border: 1px solid #303744; border-radius: 9px; background: #171b22; color: #e7ecf5; outline: none; }
input::placeholder { color: #697487; }
textarea::placeholder { color: #697487; }
input:focus, select:focus, textarea:focus { border-color: #6088ff; box-shadow: 0 0 0 3px rgba(77, 124, 255, .18); }
.toolbar input, .toolbar select { display: block; margin-top: 6px; height: 38px; padding: 0 11px; }
.source-account-field { position: relative; min-width: 230px; }
.source-account-dropdown { position: relative; margin-top: 6px; }
.source-account-trigger { display: flex; width: 100%; min-width: 230px; align-items: center; justify-content: space-between; gap: 12px; padding: 0 11px; text-align: left; }
.source-account-trigger[aria-expanded="true"] { border-color: #6088ff; box-shadow: 0 0 0 3px rgba(77, 124, 255, .18); }
.source-account-caret { color: #8793a7; font-size: 16px; transition: transform .15s; }
.source-account-trigger[aria-expanded="true"] .source-account-caret { transform: rotate(180deg); }
.source-account-menu { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; width: max-content; min-width: 100%; max-width: min(620px, calc(100vw - 30px)); padding: 5px; border: 1px solid #343d4c; border-radius: 10px; background: #151a22; box-shadow: 0 14px 36px rgba(0, 0, 0, .55); }
.source-account-menu[hidden] { display: none; }
.source-account-option { display: flex; min-width: 220px; align-items: center; border-radius: 7px; }
.source-account-option:hover, .source-account-option.selected { background: #202838; }
.source-account-option-name { flex: 1; min-width: 0; height: 34px; overflow: hidden; padding: 0 9px; border: 0; background: transparent; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.source-account-option-name:hover { border: 0; background: transparent; }
.source-account-group-control { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; padding-left: 5px; color: #8290a5; font-size: 10px; }
.source-account-group-control select { width: 145px; height: 28px; padding: 0 6px; font-size: 11px; }
.delete-source-account { width: 32px; height: 32px; padding: 0; border: 0; background: transparent; color: #ff8b8b; font-size: 19px; line-height: 1; }
.delete-source-account:hover { border: 0; color: white; background: #a93636; }
.delete-source-account:disabled { cursor: not-allowed; color: #59616e; background: transparent; opacity: .7; }
button { height: 38px; padding: 0 15px; border: 1px solid #343c4a; border-radius: 9px; background: #191e26; color: #dce3ef; cursor: pointer; transition: border-color .15s, background .15s, color .15s, transform .08s; }
button:hover { border-color: #668cff; background: #202735; }
button:active:not(:disabled) { transform: translateY(1px); }
button.primary { color: white; border-color: var(--blue); background: var(--blue); font-weight: 600; }
button.primary:hover { border-color: #6d92ff; background: #5c88ff; }
button.danger { color: #ffadad; border-color: #633236; }
button.danger:hover { color: white; border-color: #b9474d; background: #7b292e; }
button:disabled { cursor: wait; opacity: .62; }

.table-card { overflow: hidden; margin-top: 16px; }
.table-header { display: flex; align-items: center; justify-content: space-between; padding: 19px 21px 14px; border-bottom: 1px solid var(--line); }
h2 { margin: 0 0 4px; font-size: 17px; }
.table-header p { margin: 0; color: var(--muted); font-size: 12px; }
.table-header input { width: 250px; height: 36px; padding: 0 12px; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 12px 10px; color: #96a1b3; background: #151920; font-weight: 500; text-align: left; white-space: nowrap; }
.sort-button { height: auto; padding: 0; border: 0; border-radius: 0; color: inherit; background: transparent; font-weight: inherit; }
.sort-button:hover, .sort-button.active { border: 0; color: #dce6ff; background: transparent; }
.sort-indicator { display: inline-block; width: 13px; color: #67748a; text-align: center; }
.sort-button.active .sort-indicator { color: #6f96ff; }
td { padding: 11px 10px; border-top: 1px solid var(--line); white-space: nowrap; }
tbody tr.account-row:hover { background: #171c24; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.revenue-value { color: var(--green); font-weight: 700; }
.account-name { font-weight: 650; color: #f0f4fb; }
.account-id { color: #8293b2; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.toggle-cell { width: 34px; text-align: center; }
.toggle { width: 27px; height: 27px; padding: 0; border: 0; background: transparent; color: #8da5d4; transition: transform .15s; }
.toggle.open { transform: rotate(90deg); }
.detail-row td { padding: 0; background: #0b0e13; }
.detail-panel { padding: 12px 50px 17px; color: #b7c0cf; }
.detail-panel table { background: #11151b; border: 1px solid #29303b; border-radius: 8px; overflow: hidden; }
.detail-panel th, .detail-panel td { padding: 8px 10px; font-size: 12px; }
.file-links-cell { min-width: 150px; }
.file-links-button { display: inline-flex; height: 29px; align-items: center; padding: 0 9px; border: 1px solid #343c4a; border-radius: 8px; color: #a9c0ff; background: #191e26; font-size: 11px; text-decoration: none; white-space: nowrap; }
.file-links-button:hover { border-color: #668cff; color: white; background: #202735; }
.detail-actions { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.viewer-links-card { overflow: hidden; }
.viewer-links-toolbar { align-items: end; }
.viewer-links-toolbar label { min-width: 300px; }
.viewer-links-toolbar input { width: 300px; }
.viewer-links-content { padding: 16px; }
.links-pagination { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 0 16px 16px; color: var(--muted); font-size: 12px; }
.links-pagination button { min-width: 32px; height: 30px; padding: 0 8px; border: 1px solid #343c4a; border-radius: 7px; color: #b7c0cf; background: #191e26; font-size: 11px; }
.links-pagination button:hover:not(:disabled), .links-pagination button.active { border-color: #668cff; color: white; background: #202735; }
.links-pagination button:disabled { cursor: not-allowed; opacity: .45; }
.pagination-pages { display: inline-flex; gap: 4px; }
.pagination-summary { margin-right: 6px; }
.viewer-links-list { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; }
.viewer-link-item { width: fit-content; min-width: min(100%, 360px); max-width: 100%; padding: 12px; border: 1px solid #2b3340; border-radius: 11px; background: #0c0f14; }
.viewer-link-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.viewer-link-heading h2 { margin: 0; color: #edf2fb; font-size: 16px; }
.viewer-link-heading span { max-width: 250px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; text-align: right; }
.viewer-link-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(125px, 1fr)); gap: 8px; }
.viewer-link-grid > div { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 9px; border: 1px solid #293341; border-radius: 9px; background: #11161d; color: #b7c0cf; font-size: 12px; }
.viewer-link-grid strong { color: var(--muted); font-size: 12px; font-weight: 500; }
.viewer-link-grid a { color: #84a4ff; text-decoration: none; }
.viewer-link-grid a:hover { color: white; text-decoration: underline; }
.viewer-link-empty { color: #737f92; }
.empty { padding: 50px; text-align: center; color: var(--muted); }
.empty.compact { padding: 24px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 60; max-width: 420px; padding: 13px 16px; border: 1px solid #36445c; border-radius: 10px; color: white; background: #18243a; box-shadow: 0 12px 35px rgba(0,0,0,.45); font-size: 13px; }
.toast.error { background: #b73535; }

.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 28px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .78); backdrop-filter: blur(5px); }
.login-modal-card { position: relative; width: min(1080px, calc(100vw - 56px)); max-height: calc(100vh - 56px); overflow: auto; padding: 20px; border: 1px solid #303947; border-radius: 16px; background: #0d1117; box-shadow: 0 24px 80px rgba(0, 0, 0, .62); }
.login-modal-header { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
.login-modal-header p, .login-modal-tip { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.modal-close { width: 38px; padding: 0; font-size: 24px; line-height: 1; }
.login-preview-shell { position: relative; display: grid; min-height: min(510px, 62vh); place-items: center; overflow: hidden; border: 1px solid #28303c; border-radius: 12px; background: #080a0e; }
.login-preview-shell img { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: none; user-select: none; -webkit-user-drag: none; }
.login-preview-shell img.dragging { cursor: grabbing; }
.login-preview-shell img.clicking { cursor: wait; opacity: .82; }
.login-preview-message { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); padding: 7px 12px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; color: #dbe5f7; background: rgba(5, 8, 13, .82); font-size: 12px; pointer-events: none; }
.login-modal-tip { text-align: center; }
.password-modal-card { width: min(480px, calc(100vw - 56px)); }
.password-change-form { display: grid; gap: 14px; }
.password-change-form label { display: grid; gap: 6px; color: #c9d2e1; font-size: 13px; }
.password-change-form input { width: 100%; height: 40px; }
.password-change-form > p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.password-change-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 4px; }

.user-management { margin-top: 16px; overflow: hidden; }
.section-heading { padding: 19px 21px; border-bottom: 1px solid var(--line); }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.account-create-form { display: grid; grid-template-columns: 190px 190px minmax(320px, 1fr) auto; align-items: end; gap: 12px; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.account-create-form label, .level2-user label, .auth-card label { color: var(--muted); font-size: 12px; }
.account-create-form input, .account-create-form textarea, .account-create-form select, .level2-user input, .level2-user textarea, .level2-user select, .auth-card input { display: block; width: 100%; margin-top: 6px; padding: 9px 11px; }
.account-create-form input { height: 40px; }
.account-create-form select { height: 40px; }
.account-create-form textarea { min-height: 70px; resize: vertical; }
.account-create-form button { margin-bottom: 16px; }
.level2-users { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 12px; padding: 16px 20px 20px; }
.level2-user { min-width: 0; overflow: hidden; padding: 15px; border: 1px solid #2b3340; border-radius: 11px; background: #0c0f14; }
.level2-user-header { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 12px; margin-bottom: 13px; color: var(--muted); font-size: 12px; }
.level2-user-header strong { color: #edf2fb; font-size: 15px; }
.level2-user-identity { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; gap: 7px; }
.leader-account-search { width: 210px; height: 31px; margin-left: 4px; padding: 0 9px; font-size: 11px; }
.leader-search-result { color: #8492a8; font-size: 11px; }
.leader-search-result.not-found { color: #ff9a9a; }
.user-state { display: inline-block; margin-left: 8px; padding: 2px 7px; border-radius: 999px; }
.user-state.active { color: #71e6bd; background: rgba(56, 214, 162, .12); }
.user-state.disabled { color: #ff9999; background: rgba(255, 80, 80, .12); }
.level2-user-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 210px); gap: 12px; }
.level2-user-side-fields { display: grid; align-content: start; gap: 12px; }
.level2-user textarea { min-height: 82px; resize: vertical; }
.level2-user input, .level2-user select { height: 40px; }
.source-scope-field { grid-column: 1 / -1; margin-top: 12px; padding: 12px; border: 1px solid #293341; border-radius: 10px; background: #0a0e14; }
.source-scope-field > label { display: block; color: #b8c4d6; font-size: 12px; }
.source-scope-field > label select { max-width: 360px; }
.source-scope-options { margin-top: 10px; padding: 9px; border: 1px solid #202b39; border-radius: 8px; background: #0e141c; overflow: hidden; }
.source-scope-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; color: #8190a6; font-size: 11px; }
.source-scope-toolbar span { margin-right: auto; color: #aab7ca; }
.source-scope-toolbar input { display: block; width: 180px !important; height: 30px !important; margin: 0 !important; padding: 0 8px !important; font-size: 11px; }
.source-scope-toolbar button { height: 29px; padding: 0 9px; font-size: 11px; }
.source-scope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; max-height: 220px; overflow-y: auto; overscroll-behavior: contain; padding: 1px 5px 3px 1px; }
.source-scope-option { display: flex; min-width: 0; align-items: center; gap: 7px; padding: 7px 8px; border: 1px solid #273444; border-radius: 7px; color: #c7d1e0 !important; background: #111923; cursor: pointer; font-size: 11px !important; }
.source-scope-option[hidden] { display: none; }
.source-scope-option:has(input:checked) { border-color: #5b86f5; background: rgba(77, 124, 255, .16); color: #f0f5ff !important; }
.source-scope-option input { flex: 0 0 auto; width: 15px !important; height: 15px !important; margin: 0 !important; padding: 0 !important; accent-color: #5f91ff; }
.source-scope-option span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 原生视频号授权：强制紧凑横向选项，避免通用 input 样式把复选框撑大 */
.level2-user .source-scope-options { display: block; }
.level2-user .source-scope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 210px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.level2-user label.source-scope-option { display: flex !important; width: auto !important; min-height: 32px; height: 32px !important; box-sizing: border-box; align-items: center; margin: 0 !important; padding: 5px 8px !important; }
.level2-user label.source-scope-option input[type="checkbox"] { display: inline-block !important; flex: 0 0 14px !important; width: 14px !important; min-width: 14px !important; max-width: 14px !important; height: 14px !important; min-height: 14px !important; margin: 0 2px 0 0 !important; padding: 0 !important; }
.level2-user label.source-scope-option span { display: block; line-height: 20px; }
.sub-user-card .source-scope-options { display: block; }
.sub-user-card .source-scope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 210px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.sub-user-card label.source-scope-option { display: flex !important; width: auto !important; min-height: 32px; height: 32px !important; box-sizing: border-box; align-items: center; margin: 0 !important; padding: 5px 8px !important; }
.sub-user-card label.source-scope-option input[type="checkbox"] { display: inline-block !important; flex: 0 0 14px !important; width: 14px !important; min-width: 14px !important; max-width: 14px !important; height: 14px !important; min-height: 14px !important; margin: 0 2px 0 0 !important; padding: 0 !important; }
.level2-user-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.query-code-list { margin-top: 12px; padding: 11px 12px; border: 1px solid #27303c; border-radius: 9px; background: #11161d; }
.query-code-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.query-code-items { max-height: 330px; overflow-y: auto; padding-right: 4px; }
.query-code-item { display: flex; min-width: 0; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 6px 0; border-top: 1px solid #232b36; color: #aeb9ca; font-size: 12px; }
.query-code-item button { height: 29px; margin-left: 7px; padding: 0 9px; font-size: 11px; }
.query-code-item code, .query-code-card code { color: #8fb0ff; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; letter-spacing: .08em; }
.query-code-empty { padding: 10px; color: var(--muted); font-size: 12px; text-align: center; }

.auth-page { min-width: 0; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 20%, #172545, #05070b 50%); }
.auth-card { width: min(430px, 100%); padding: 32px; }
.auth-card h1 { margin: 9px 0 6px; }
.auth-card > p { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.auth-card form { display: grid; gap: 16px; }
.auth-card input { height: 44px; }
.auth-card form button { height: 44px; margin-top: 4px; }
.public-query-link { display: block; margin-top: 18px; color: #84a4ff; font-size: 13px; text-align: center; text-decoration: none; }
.public-query-link:hover { color: white; }
.topbar-link { padding: 9px 14px; border: 1px solid rgba(255,255,255,.25); border-radius: 9px; color: white; background: rgba(255,255,255,.08); font-size: 13px; text-decoration: none; }
.topbar-link:hover { border-color: #668cff; background: rgba(255,255,255,.14); }
.accounts-page { max-width: 1500px; margin: 0 auto; }
.drama-management-page { max-width: 1600px; margin: 0 auto; }
.drama-management-toolbar { align-items: center; }
.drama-management-toolbar select { min-width: 280px; }
.toolbar-hint { margin-left: 4px; color: var(--muted); font-size: 12px; }
.drama-list { display: grid; gap: 12px; padding: 16px 20px 20px; }
.drama-management-item { padding: 16px; border: 1px solid #2b3340; border-radius: 11px; background: #0c0f14; }
.drama-management-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.drama-management-heading h3 { margin: 0 0 5px; color: #edf2fb; font-size: 16px; }
.drama-management-heading span { color: var(--muted); font-size: 12px; }
.drama-link-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.drama-link-field { min-width: 0; padding: 12px; border: 1px solid #293341; border-radius: 9px; background: #11161d; }
.drama-link-field > label { display: block; color: var(--muted); font-size: 12px; }
.drama-link-field textarea[data-link-url] { display: block; width: 100%; min-height: 74px; margin-top: 6px; padding: 8px 10px; resize: vertical; font-size: 12px; line-height: 1.45; }
.saved-link-preview { display: flex; align-items: center; gap: 6px; margin-top: 7px; color: #8d9ab0; font-size: 11px; }
.saved-link-preview a { color: #84a4ff; }
.drama-permissions { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; }
.drama-permissions label { display: inline-flex; align-items: center; gap: 5px; color: #aeb9ca; font-size: 11px; }
.drama-permissions input { width: 15px; height: 15px; margin: 0; accent-color: var(--blue); }
.accounts-view { min-width: 0; }
.accounts-page > .user-management + .user-management { margin-top: 16px; }
.section-heading:has(.management-group-select) { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.management-group-select { color: var(--muted); font-size: 12px; }
.management-group-options { display: flex; min-width: 260px; max-width: 620px; max-height: 104px; flex-wrap: wrap; gap: 7px; margin-top: 6px; overflow-y: auto; }
.management-group-option { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid #334054; border-radius: 8px; color: #c8d2e3; background: #10151d; cursor: pointer; }
.management-group-option:has(input:checked) { border-color: #6287f7; color: #edf3ff; background: rgba(77, 124, 255, .18); }
.management-group-option input { width: 15px; height: 15px; margin: 0; accent-color: #4d7cff; }
.management-group-option:has(input:disabled) { cursor: default; }
.group-management-forms { display: grid; grid-template-columns: minmax(260px, .7fr) minmax(560px, 1.3fr); gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.inline-management-form { display: flex; align-items: end; gap: 10px; padding: 12px; border: 1px solid #293341; border-radius: 10px; background: #0c1016; }
.inline-management-form label { flex: 1; color: var(--muted); font-size: 12px; }
.inline-management-form input, .inline-management-form select { display: block; width: 100%; height: 39px; margin-top: 6px; padding: 0 10px; }
.group-admin-list { display: grid; gap: 9px; padding: 14px 20px 20px; }
.managed-group-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 9px; padding: 14px 20px 0; }
.managed-group-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border: 1px solid #293341; border-radius: 9px; background: #0c1016; }
.managed-group-item strong, .managed-group-item span { display: block; }
.managed-group-item span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.managed-group-item .system-group-badge { margin: 0; padding: 5px 8px; border-radius: 999px; color: #86a8ff; background: rgba(77, 124, 255, .14); white-space: nowrap; }
.managed-group-item button { flex: 0 0 auto; }
.group-admin-item { display: grid; grid-template-columns: minmax(130px, 1fr) 160px 100px minmax(180px, 1fr) auto auto; align-items: center; gap: 9px; padding: 10px 12px; border: 1px solid #293341; border-radius: 9px; background: #0c1016; }
.group-admin-item input, .group-admin-item select { min-width: 0; height: 36px; padding: 0 9px; }
.query-codes-view { min-width: 0; }
.query-codes-page { max-width: 1600px; margin: 0 auto; }
.form-message { margin: 16px 0 0 !important; padding: 10px 12px; border-radius: 8px; color: #ffd0d0 !important; background: #4a2024; }
.viewer-toolbar { justify-content: flex-start; flex-wrap: wrap; }
.viewer-toolbar #queryDramaName { width: 170px; }
.toolbar-check { display: flex; align-items: center; gap: 6px; padding-bottom: 9px; white-space: nowrap; }
.toolbar-check input[type="checkbox"] { width: 15px; height: 15px; accent-color: #4d7cff; }
.dashboard-summary { margin-top: 16px; }
.dashboard-summary-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 0 3px; }
.dashboard-summary-heading h2 { margin: 0; }
.dashboard-summary-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.dashboard-summary .viewer-totals { margin-top: 9px; }
.native-summary .total-card::after { background: rgba(56, 214, 162, .08); }
.viewer-totals { display: grid; grid-template-columns: repeat(5, minmax(170px, 1fr)); gap: 12px; margin-top: 16px; }
.member-totals { grid-template-columns: repeat(4, minmax(180px, 1fr)); }
.total-card { position: relative; min-height: 112px; padding: 19px 20px; overflow: hidden; }
.total-card::after { content: ""; position: absolute; right: -30px; bottom: -45px; width: 100px; height: 100px; border-radius: 50%; background: rgba(77, 124, 255, .09); }
.total-card span { display: block; color: var(--muted); font-size: 12px; }
.total-card strong { display: block; margin-top: 12px; color: #f2f6ff; font-size: 27px; font-variant-numeric: tabular-nums; }
.total-card.revenue strong { color: var(--green); }
.total-card small { position: absolute; right: 18px; bottom: 16px; color: #718099; font-size: 11px; }
.query-code-panel { margin-top: 16px; overflow: hidden; }
.query-code-panel .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.query-code-panel .section-heading a { color: #85a5ff; font-size: 13px; text-decoration: none; }
.query-code-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 10px; padding: 15px 20px 20px; }
.query-code-card { display: grid; min-width: 0; gap: 10px; padding: 12px; border: 1px solid #293341; border-radius: 9px; background: #0c1016; }
.query-code-account { min-width: 0; }
.query-code-account strong { display: block; overflow-wrap: anywhere; color: #edf2fb; font-size: 14px; }
.query-code-account.missing strong { color: var(--muted); font-weight: 500; }
.query-code-account span { display: block; margin-top: 5px; overflow-wrap: anywhere; color: #8fa0b8; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; word-break: break-all; white-space: normal; }
.query-code-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.query-code-card button { height: 31px; padding: 0 9px; font-size: 11px; }

.subaccounts-view { min-width: 0; }
.subaccounts-page { max-width: 1500px; margin: 0 auto; }
.subaccount-create-form { display: grid; grid-template-columns: 190px 190px minmax(420px, 1fr) auto; align-items: end; gap: 12px; padding: 17px 20px; }
.subaccount-create-form > label, .sub-user-settings label { color: var(--muted); font-size: 12px; }
.subaccount-create-form input, .sub-user-settings input, .sub-user-settings select { display: block; width: 100%; height: 40px; margin-top: 6px; padding: 0 10px; }
.subaccount-account-field { min-width: 0; padding: 10px; border: 1px solid #293341; border-radius: 10px; background: #0c1016; }
.subaccount-account-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; color: var(--muted); font-size: 12px; }
.account-assignment-tools { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.account-assignment-tools input { width: 190px; height: 30px; margin: 0; padding: 0 8px; font-size: 11px; }
.subaccount-account-heading button { height: 28px; margin-left: 1px; padding: 0 8px; font-size: 11px; }
.delegable-account-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 7px; max-height: 260px; overflow-y: auto; }
.delegable-account-option { display: flex; min-width: 0; align-items: flex-start; gap: 8px; padding: 9px; border: 1px solid #2c3746; border-radius: 8px; background: #111720; cursor: pointer; }
.delegable-account-option[hidden] { display: none; }
.account-search-empty { grid-column: 1 / -1; padding: 16px 8px; color: var(--muted); font-size: 12px; text-align: center; }
.delegable-account-option:has(input:checked) { border-color: #6287f7; background: rgba(77, 124, 255, .15); }
.delegable-account-option input { flex: 0 0 auto; width: 15px; height: 15px; margin: 2px 0 0; accent-color: #4d7cff; }
.delegable-account-option span { min-width: 0; }
.delegable-account-option strong, .delegable-account-option small { display: block; overflow-wrap: anywhere; }
.delegable-account-option strong { color: #e7edf8; font-size: 12px; }
.delegable-account-option small { margin-top: 4px; color: #8190a6; font-size: 10px; }
.sub-user-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(480px, 1fr)); gap: 12px; padding: 16px 20px 20px; }
.sub-user-card { min-width: 0; padding: 15px; border: 1px solid #2b3340; border-radius: 11px; background: #0c0f14; }
.sub-user-settings { display: grid; grid-template-columns: 150px minmax(190px, 1fr); gap: 10px; margin-bottom: 12px; }

@media (max-width: 1200px) {
  main { padding-left: 18px; padding-right: 18px; }
  .account-create-form { grid-template-columns: 1fr 1fr; }
  .account-create-form .account-ids-field { grid-column: 1 / -1; }
  .account-create-form button { margin-bottom: 0; }
  .viewer-totals { grid-template-columns: repeat(3, 1fr); }
  .subaccount-create-form { grid-template-columns: 1fr 1fr; }
  .subaccount-create-form .subaccount-account-field { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .accounts-view .topbar { flex-wrap: wrap; gap: 16px; padding: 20px 16px; }
  .accounts-view .topbar-actions { width: 100%; justify-content: flex-end; }
  .accounts-view main { padding: 14px 12px 30px; }
  .accounts-view .account-create-form { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .accounts-view .account-create-form .account-ids-field { grid-column: auto; }
  .accounts-view .account-create-form button { width: 100%; margin-bottom: 0; }
  .accounts-view .level2-users { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .accounts-view .level2-user-fields { grid-template-columns: minmax(0, 1fr); }
  .accounts-view .level2-user-actions { flex-wrap: wrap; }
  .accounts-view .level2-user-actions button { flex: 1; min-width: 120px; }
  .accounts-view .section-heading:has(.management-group-select) { align-items: stretch; flex-direction: column; }
  .accounts-view .management-group-options { width: 100%; min-width: 0; max-width: none; }
  .accounts-view .group-management-forms { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .accounts-view .inline-management-form { align-items: stretch; flex-direction: column; }
  .accounts-view .group-admin-item { grid-template-columns: minmax(0, 1fr); }
  .accounts-view .query-code-item > span:last-child { display: flex; align-items: center; gap: 4px; }
  .subaccounts-view .topbar { flex-wrap: wrap; gap: 16px; padding: 20px 16px; }
  .subaccounts-view .topbar-actions { width: 100%; justify-content: flex-end; }
  .subaccounts-view main { padding: 14px 12px 30px; }
  .subaccounts-view .subaccount-create-form { grid-template-columns: minmax(0, 1fr); padding: 14px; }
  .subaccounts-view .subaccount-create-form .subaccount-account-field { grid-column: auto; }
  .subaccounts-view .sub-user-list { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .subaccounts-view .sub-user-settings { grid-template-columns: minmax(0, 1fr); }
  .subaccounts-view .delegable-account-list { grid-template-columns: minmax(0, 1fr); }
  .query-codes-view .topbar { flex-wrap: wrap; gap: 16px; padding: 20px 16px; }
  .query-codes-view .topbar-actions { width: 100%; flex-wrap: wrap; }
  .query-codes-view main { padding: 14px 12px 30px; }
  .query-codes-view .query-code-grid { grid-template-columns: minmax(0, 1fr); padding: 12px; }
}

/* ---------------- 剧榜 / 提示块（data-main-chain：剧榜、剧归属） ---------------- */
.notice { margin: 0 0 14px; padding: 12px 14px; border: 1px solid #42304a; border-radius: 10px; color: #ffc9c9; background: #2a1620; font-size: 13px; }
.rank-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 14px; }
.rank-card { overflow: hidden; padding: 0 0 8px; }
.rank-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.rank-card-head h2 { margin: 0; font-size: 16px; }
.rank-card-head span { color: var(--muted); font-size: 12px; }
.rank-scroll { overflow: auto; max-height: 460px; }
.rank-empty { padding: 34px; color: var(--muted); text-align: center; }
.rank-num { text-align: center; font-weight: 700; color: #8793a7; }
.rank-num.top1 { color: #f7c948; }
.rank-num.top2 { color: #cfd8e3; }
.rank-num.top3 { color: #d79a63; }
.rank-amount { color: var(--green); font-weight: 700; }
.hint-text { margin-left: 4px; color: var(--muted); font-size: 11px; }
.topbar-actions .toolbar-field { color: rgba(255, 255, 255, .72); font-size: 12px; }
.topbar-actions .toolbar-field input { margin-top: 4px; height: 34px; padding: 0 9px; }
.member-totals.total-card small { position: static; }

/* ---------------- 左侧导航栏（总控工作台 index 页） ---------------- */
.app-layout { display: flex; align-items: stretch; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  flex: 0 0 160px;
  width: 160px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 10px 14px;
  color: white;
  background: linear-gradient(160deg, #090d16, #111a2c 60%, #162544);
  border-right: 1px solid #283247;
  box-shadow: 6px 0 24px rgba(0, 0, 0, .32);
  overflow: hidden;
}
.sidebar-brand { padding: 0 4px; }
.sidebar-brand .eyebrow { font-size: 10px; letter-spacing: .16em; opacity: .7; }
.sidebar-brand h1 { margin: 5px 0 10px; font-size: 20px; line-height: 1.3; white-space: nowrap; }
.sidebar-brand .status-pill { display: inline-block; padding: 6px 10px; font-size: 14px; }
.sidebar-nav { display: flex; flex: 1; flex-direction: column; gap: 4px; overflow-y: auto; }
.sidebar-nav button,
.sidebar-footer button {
  width: 100%;
  height: 44px;
  padding: 0 6px;
  text-align: left;
  font-size: 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #dbe3f2;
  transition: background .18s ease, border-color .18s ease, color .18s ease;
}
.sidebar-nav button.active {
  border-color: rgba(77, 124, 255, .55);
  background: rgba(77, 124, 255, .18);
  box-shadow: inset 3px 0 0 #4d7cff;
  color: #fff;
}
.sidebar-nav button:hover,
.sidebar-footer button:hover { border-color: rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .08); }
.sidebar-footer { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .12); }
.app-body { flex: 1; min-width: 0; }

/* 右侧面板：点击侧边栏在当前页切换，不再整页跳转/弹窗 */
.view[hidden] { display: none !important; }
.view-enter { animation: viewIn .26s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes viewIn {
  from { opacity: 0; transform: translateX(14px); }
  to { opacity: 1; transform: none; }
}
.page-view-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 28px 14px;
}
.page-view-head h2 { margin: 0; font-size: 22px; color: #fff; }
.page-view-tip { margin: 6px 0 0; color: #8e99aa; font-size: 12px; }
.page-view-head button { flex: 0 0 auto; }
.page-view-body { padding: 0 28px 24px; }
#pageView { display: flex; flex-direction: column; height: 100vh; }
#pageFrame { display: block; flex: 1; width: 100%; min-height: 0; border: 0; background: transparent; }

