/* Busns 管理后台：依据项目内 imagegen 设计稿实现，样式不依赖第三方 CDN。 */
:root {
  color-scheme: light;
  --ink: #152440;
  --muted: #718198;
  --blue: #1268f5;
  --line: #e4ebf4;
  --surface: #f1f5fb;
  --sidebar-width: 228px;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--surface); }
button, input, select { font: inherit; }
button, a, input, select { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button:focus-visible, a:focus-visible { outline: 3px solid #99c1ff; outline-offset: 3px; }
input:focus, select:focus { outline: none; border-color: #70a5fa; box-shadow: 0 0 0 3px #1268f512; }
.muted { color: var(--muted); line-height: 1.7; }
.eyebrow { display: block; margin-bottom: 9px; font-size: 11px; color: #6980a3; font-weight: 600; letter-spacing: 1px; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 18px; border: 1px solid transparent; border-radius: 7px; font-size: 13px; font-weight: 600; transition: background .15s, border-color .15s, box-shadow .15s; }
.primary { color: white; background: var(--blue); box-shadow: 0 3px 8px #1268f515; }
.primary:hover { background: #075be4; box-shadow: 0 4px 12px #1268f523; }
.secondary { background: white; border-color: #d7e2f0; color: #3468aa; }
.secondary:hover { border-color: #9ebff0; background: #f7faff; }
.compact { min-height: 34px; padding: 7px 12px; font-size: 12px; }
.text-button { border: 0; background: transparent; color: #5a6b84; font-size: 13px; padding: 9px 0 9px 20px; border-left: 1px solid var(--line); }
.text-button:hover { color: var(--blue); }
.align-right { text-align: right; }
.notice { padding: 13px 17px; margin-bottom: 20px; background: #fff4ef; border: 1px solid #f5d9cc; color: #ad5034; border-radius: 9px; font-size: 13px; line-height: 1.7; }
.notice.success { background: #ecf8f2; border-color: #cbe9dc; color: #258160; }
.notice.info { background: #edf4ff; border-color: #d1e2fc; color: #396696; }
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid #cbdcf9; border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.boot-message { height: 100vh; display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }

/* 导航与工作区 */
.brand { display: flex; align-items: center; gap: 11px; color: #142540; font-size: 28px; font-weight: 750; letter-spacing: -1px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: linear-gradient(135deg, #0b6eff, #2b81ff); color: white; font-size: 30px; font-weight: 750; line-height: 1; }
.brand-caption { display: block; color: #61738d; font-size: 12px; font-weight: 500; letter-spacing: 0; margin-top: 6px; }
.admin-app { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-width); padding: 28px 15px; background: white; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.sidebar .brand { margin: 0 12px 42px; }
.nav-caption { color: #8b9bb2; font-size: 12px; margin: 0 19px 12px; }
.nav-item { position: relative; width: 100%; display: flex; align-items: center; gap: 13px; padding: 14px 18px; margin: 7px 0; border: 0; border-radius: 7px; background: transparent; color: #52647e; text-align: left; font-size: 14px; }
.nav-item:hover { background: #f5f8fd; color: #285baa; }
.nav-item.active { background: #eaf3ff; color: #0767f4; font-weight: 650; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 4px; background: var(--blue); border-radius: 4px; }
.nav-arrow { margin-left: auto; font-size: 20px; font-weight: 400; color: #92b8f3; }
.nav-item:not(.active) .nav-arrow { display: none; }
.sidebar-bottom { margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 20px 15px 0; border-top: 1px solid var(--line); color: #697d99; font-size: 12px; }
.sidebar-bottom small { display: block; color: #93a2b7; font-size: 11px; margin-top: 5px; }
.sidebar-dot, .status-dot { width: 6px; height: 6px; flex-shrink: 0; background: #40a886; border-radius: 50%; display: inline-block; }
.workspace { margin-left: var(--sidebar-width); }
.topbar { position: sticky; top: 0; z-index: 10; min-height: 70px; padding: 0 30px; background: #ffffffed; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; backdrop-filter: blur(12px); }
.breadcrumb { font-size: 13px; color: #74849c; }
.breadcrumb > span { margin: 0 12px; color: #bac7da; }
.breadcrumb b { color: #304665; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.current-avatar { width: 36px; height: 36px; display: grid; place-items: center; background: linear-gradient(135deg, #6a9be0, #467aca); border: 2px solid white; box-shadow: 0 0 0 1px #dce8f8; border-radius: 50%; color: white; font-size: 14px; }
.current-user { display: flex; flex-direction: column; gap: 3px; margin-right: 12px; }
.current-name { color: #344a6a; font-size: 13px; font-weight: 600; max-width: 150px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.role-badge { color: #8a9ab1; font-size: 10px; }
.main-content { max-width: 1660px; padding: 28px 28px 20px; margin: 0 auto; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading .eyebrow { display: none; }
.page-heading h1 { font-size: 32px; font-weight: 700; letter-spacing: -1px; margin-bottom: 8px; line-height: 1.25; }
.page-heading p { font-size: 14px; }
.page-heading .secondary { color: var(--blue); border-color: #accafa; }

/* 统计卡片 */
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric-card { position: relative; display: flex; align-items: flex-start; gap: 14px; min-height: 136px; padding: 22px 20px; border: 1px solid #dfe8f4; background: white; border-radius: 9px; box-shadow: 0 4px 12px #23466f03; }
.metric-card > div { min-width: 0; }
.metric-label { display: block; color: #4e6485; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.metric-card strong { display: block; color: #1d2c44; font-size: 34px; line-height: 1.12; letter-spacing: -.8px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-card small { display: block; font-size: 11px; color: #7e91ad; line-height: 1.5; margin-top: 8px; }
.metric-icon { order: -1; width: 34px; height: 38px; flex-shrink: 0; margin-top: 2px; display: grid; place-items: center; color: #5995f4; }
.metric-icon .icon { width: 29px; height: 29px; stroke-width: 1.9; }
.metric-card:first-child { border-color: #1268f5; background: linear-gradient(115deg, #0d6afa, #1261e5); box-shadow: 0 6px 15px #1268f51a; }
.metric-card:first-child .metric-label, .metric-card:first-child strong, .metric-card:first-child small, .metric-card:first-child .metric-icon { color: white; }
.metric-card:first-child small { color: #d9e9ff; }

/* 数据列表与筛选 */
.panel { border: 1px solid #e0e8f3; border-radius: 10px; background: white; overflow: hidden; box-shadow: 0 6px 20px #24436403; }
.panel-heading { padding: 21px 24px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-heading h2 { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 650; }
.panel-heading p { color: #8393aa; font-size: 12px; line-height: 1.6; margin-top: 6px; }
.count-chip { font-size: 12px; background: #eff3f9; border-radius: 20px; padding: 3px 10px; color: #536b8c; font-weight: 600; }
.section-tag { color: #8aa0bf; font-size: 11px; background: #f6f9fe; border: 1px solid #e7edf6; border-radius: 5px; padding: 5px 8px; }
.filters { padding: 0 24px 17px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filters input, .filters select { height: 42px; padding: 0 13px; background: white; border: 1px solid #d8e3f1; border-radius: 6px; color: #435b7c; font-size: 13px; }
.filters select { min-width: 140px; }
.filters > input { width: 160px; }
.filters .button { min-width: 76px; }
.search-field { position: relative; flex: 1; max-width: 430px; min-width: 200px; }
.search-field input { padding-left: 39px; width: 100%; }
.search-icon { position: absolute; top: 12px; left: 13px; width: 18px; height: 18px; fill: none; stroke: #778fad; stroke-width: 1.8; }
.table-wrap { overflow: auto; scrollbar-width: thin; scrollbar-color: #cbd7e7 #f8fafd; }
#users-view .table-wrap, #calls-view .table-wrap { max-height: clamp(270px, calc(100vh - 570px), 600px); }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 13px; }
th { position: sticky; top: 0; z-index: 1; text-align: left; padding: 14px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #f3f7fc; color: #607696; font-size: 12px; font-weight: 500; }
td { padding: 16px; border-bottom: 1px solid #eaf0f7; color: #506788; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
tbody tr:hover { background: #f8fbff; }
tbody tr:last-child td { border-bottom: 0; }
.user-cell { display: flex; align-items: center; gap: 12px; }
.avatar { height: 38px; width: 38px; flex-shrink: 0; display: grid; place-items: center; border-radius: 50%; font-size: 14px; font-weight: 600; background: #e2efff; color: #2778e5; }
.avatar-tone-0 { background: #e0eaff; color: #286be0; }
.avatar-tone-1 { background: #def0ff; color: #1c83d8; }
.avatar-tone-2 { background: #ebe5ff; color: #7756cb; }
.avatar-tone-3 { background: #dcf4ec; color: #258c70; }
.avatar-tone-4 { background: #ffecda; color: #bf762e; }
.user-info strong { display: block; color: #203b5d; font-size: 13px; font-weight: 600; max-width: 200px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.user-info small { display: block; font-size: 11px; color: #8798b1; margin-top: 5px; max-width: 215px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; border-radius: 5px; padding: 4px 8px; color: #718199; background: #f0f3f8; line-height: 1.5; }
.pill.green { color: #268568; background: #e0f4eb; }
.pill.gray { color: #8391a5; background: #edf1f6; }
.pill.blue { color: #2b75d7; background: #e7f1ff; }
.pill.orange { color: #b98735; background: #fff3dc; }
.pill.red { color: #b96553; background: #fff0ea; }
.pill-dot { height: 4px; width: 4px; display: inline-block; border-radius: 50%; background: currentColor; }
.quota { color: #435b7d; font-variant-numeric: tabular-nums; }
.row-action { padding: 6px 9px; border: 0; border-radius: 5px; background: transparent; color: #0870ef; font-size: 12px; font-weight: 600; }
.row-action:hover { background: #eaf3ff; }
.date-cell { color: #8193af; font-size: 11px; font-variant-numeric: tabular-nums; }
.call-id { display: block; font-family: Consolas, monospace; color: #91a2ba; font-size: 11px; margin-top: 5px; }
.panel-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 16px 24px; border-top: 1px solid var(--line); color: #6b81a1; font-size: 12px; }
.pagination { display: flex; gap: 8px; }
.empty-state { padding: 55px 24px; text-align: center; color: #99abc3; }
.empty-state h3 { margin: 12px 0 9px; color: #6f86a6; font-size: 15px; font-weight: 500; }
.empty-state p { font-size: 12px; }
.empty-icon { width: 34px; height: 34px; fill: none; stroke: #a8bfdf; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.workspace-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 21px; color: #9bacc2; font-size: 11px; }
.config-note { display: flex; gap: 12px; margin: 0 24px 20px; padding: 15px 17px; border: 1px solid #dce8f9; border-radius: 7px; background: #f6faff; color: #6d96cf; }
.config-note strong { display: block; color: #557cad; font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.config-note span { color: #8198b8; font-size: 12px; line-height: 1.8; }
.platform-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 0 24px 22px; }
.platform-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 19px 18px; border: 1px solid #e0e9f5; border-radius: 8px; background: linear-gradient(135deg, #f9fbff, white); }
.platform-card strong { display: block; color: #39577f; font-size: 15px; }
.platform-card small { display: block; margin-top: 6px; color: #8ca0be; font-size: 12px; }

/* 编辑弹窗 */
.edit-dialog { width: 550px; max-width: calc(100vw - 32px); padding: 0; border: 1px solid #dce6f4; border-radius: 13px; color: var(--ink); box-shadow: 0 22px 70px #16345c30; }
.edit-dialog::backdrop { background: #16304a55; backdrop-filter: blur(3px); }
.edit-dialog form { padding: 29px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.dialog-heading h2 { font-size: 20px; font-weight: 650; }
.close-button { height: 30px; width: 30px; border: 0; border-radius: 6px; color: #8da1bd; background: #f2f6fc; font-size: 23px; }
.dialog-user { display: flex; align-items: center; gap: 12px; margin: 22px 0; padding: 15px; background: #f5f9ff; border: 1px solid #e2ecf9; border-radius: 8px; }
.dialog-user strong { display: block; font-size: 14px; }
.dialog-user span:not(.avatar) { display: block; color: #879ebc; font-size: 12px; margin-top: 5px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-grid label { display: flex; flex-direction: column; gap: 10px; color: #667e9e; font-size: 12px; }
.form-grid input, .form-grid select { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #d4e1f1; border-radius: 6px; background: white; color: #405d82; font-size: 13px; }
.dialog-help { margin: 20px 0 25px; color: #879bb8; font-size: 12px; line-height: 1.8; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 12px; padding-top: 19px; border-top: 1px solid var(--line); }

/* 登录页沿用同一套品牌色、间距和可读字号。 */
.login-body { display: flex; min-height: 100vh; background: white; }
.login-story { display: flex; flex-direction: column; width: 46%; min-height: 100vh; padding: 45px 52px; background: radial-gradient(ellipse at 60% 65%, #d9eaff, #edf5ff 52%, #f7faff); border-right: 1px solid #dfebf9; }
.story-content { margin: auto 0; padding: 60px 0; max-width: 490px; }
.story-content .eyebrow { color: #397aca; font-size: 12px; letter-spacing: 2px; margin-bottom: 22px; }
.story-content h1 { font-size: clamp(28px, 3vw, 42px); font-weight: 600; letter-spacing: -1.3px; line-height: 1.6; color: #1d3d69; }
.story-content > p { color: #6c8bb2; font-size: 14px; line-height: 2; margin-top: 23px; }
.story-flow { display: flex; align-items: center; gap: 12px; margin-top: 42px; font-size: 12px; color: #466f9f; }
.story-flow > span { padding: 16px 15px; background: #ffffffb8; border: 1px solid #d0e2fa; border-radius: 9px; white-space: nowrap; box-shadow: 0 6px 16px #4d86c505; }
.story-flow b { display: block; color: #8faed4; margin-bottom: 9px; font-size: 10px; letter-spacing: 2px; }
.story-flow i { font-style: normal; color: #9db8dc; }
.story-note { display: flex; align-items: center; gap: 9px; margin-top: 22px; font-size: 11px; color: #8ca5c5; }
.story-footer { font-size: 10px; color: #a2b8d2; letter-spacing: 3px; }
.login-main { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 55px 30px; }
.login-card { width: 100%; max-width: 370px; }
.login-symbol { height: 46px; width: 46px; margin-bottom: 25px; border-radius: 13px; background: #e8f2ff; color: #2976e5; font-size: 25px; font-weight: 700; display: grid; place-items: center; }
.login-card h2 { font-size: 28px; font-weight: 650; letter-spacing: -.7px; margin-bottom: 10px; }
.login-card > .muted { font-size: 14px; margin-bottom: 30px; }
.login-card form > label { display: block; color: #637c9d; font-size: 13px; margin: 22px 0 10px; }
.login-card input { height: 48px; width: 100%; padding: 0 14px; border: 1px solid #d5e1f0; border-radius: 7px; background: #fcfdff; color: #405e83; font-size: 14px; }
.password-field { position: relative; }
.password-field input { padding-right: 55px; }
.password-field button { position: absolute; top: 11px; right: 10px; height: 27px; padding: 0 6px; background: transparent; border: 0; color: #8a9fb9; font-size: 11px; }
.login-submit { height: 47px; width: 100%; justify-content: space-between; padding: 0 18px; margin-top: 29px; font-size: 14px; }
.login-hint { display: flex; align-items: center; gap: 9px; color: #96a9bf; font-size: 12px; padding-top: 21px; margin-top: 28px; border-top: 1px solid var(--line); }
.lock-icon { font-size: 9px; color: #a4bad6; }
.login-footer { position: absolute; bottom: 30px; font-size: 11px; color: #a3b3c8; }
.login-footer span { margin: 0 9px; }

@media (min-width: 1500px) {
  :root { --sidebar-width: 244px; }
  .main-content { padding: 32px 34px 24px; }
  .topbar { padding: 0 34px; }
  .metrics { gap: 18px; }
  .metric-card { padding: 25px 25px; gap: 18px; }
}
@media (max-width: 1200px) {
  :root { --sidebar-width: 198px; }
  .sidebar { padding: 28px 12px; }
  .sidebar .brand { margin: 0 10px 36px; font-size: 26px; }
  .main-content { padding: 25px 23px 20px; }
  .topbar { padding: 0 23px; }
  .metrics { gap: 12px; }
  .metric-card { gap: 9px; padding: 19px 15px; }
  .metric-icon { width: 25px; }
  .metric-icon .icon { width: 24px; height: 24px; }
  .metric-label { font-size: 12px; }
  .metric-card strong { font-size: 31px; }
  .metric-card small { font-size: 11px; }
  .filters select { min-width: 116px; }
  .filters { gap: 10px; }
  .story-flow { gap: 8px; }
  .story-flow > span { padding: 13px 10px; }
  .login-story { padding: 40px 32px; }
}
@media (max-width: 900px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { min-height: 112px; }
  .page-heading h1 { font-size: 28px; }
}
@media (max-width: 800px) {
  .sidebar { position: static; width: auto; padding: 18px 20px 12px; }
  .sidebar .brand { margin: 0; font-size: 23px; }
  .sidebar .brand-mark { width: 33px; height: 33px; font-size: 26px; }
  .sidebar nav { display: flex; gap: 5px; margin-top: 16px; }
  .nav-item { width: auto; margin: 0; padding: 11px 12px; font-size: 12px; gap: 8px; }
  .nav-item.active::before { display: none; }
  .nav-arrow, .nav-caption, .sidebar-bottom { display: none; }
  .workspace { margin-left: 0; }
  .topbar { min-height: 64px; padding: 0 20px; }
  .main-content { padding: 24px 20px; }
  .current-name { max-width: 100px; }
  .current-user { margin-right: 2px; }
  .topbar-right { gap: 9px; }
  .panel-heading, .filters { padding-left: 18px; padding-right: 18px; }
  .platform-cards, .config-note { margin-left: 18px; margin-right: 18px; }
  #users-view .table-wrap, #calls-view .table-wrap { max-height: 420px; }
  .login-story { display: none; }
  .login-main { min-height: 100vh; }
}
@media (max-width: 480px) {
  .main-content { padding: 20px 12px; }
  .topbar { padding: 0 13px; }
  .breadcrumb { font-size: 11px; }
  .breadcrumb > span { margin: 0 5px; }
  .current-avatar, .role-badge { display: none; }
  .current-name { max-width: 75px; font-size: 12px; }
  .text-button { padding-left: 10px; font-size: 11px; }
  .page-heading { align-items: flex-start; }
  .page-heading h1 { font-size: 25px; }
  .page-heading p { font-size: 12px; }
  .page-heading .button { padding: 8px 10px; font-size: 12px; }
  .page-heading .button .icon { width: 15px; }
  .metrics { gap: 10px; }
  .metric-card { padding: 16px 12px; min-height: 118px; }
  .metric-icon { display: none; }
  .metric-card strong { font-size: 31px; }
  .metric-card small { font-size: 10px; }
  .section-tag { display: none; }
  .search-field { flex-basis: 100%; max-width: none; }
  .filters select { flex: 1; }
  .panel-heading p { font-size: 11px; }
  .panel-footer { padding: 14px 17px; font-size: 11px; }
  .pagination { gap: 5px; }
  .compact { padding: 7px 9px; font-size: 11px; }
  .workspace-footer { font-size: 10px; }
  .form-grid { gap: 14px; }
  .edit-dialog form { padding: 22px; }
  .login-main { padding: 40px 24px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* 积分审计保留小额费用精度，长流水仅在弹窗内滚动。 */
.points-ledger { margin: 20px 0; padding-top: 16px; border-top: 1px solid var(--line); }
.points-ledger h3 { font-size: 13px; margin: 0 0 10px; }
#edit-ledger { max-height: 170px; overflow: auto; }
.ledger-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 12px; }

#user-dialog form { padding: 24px; }
#user-dialog .form-grid { gap: 16px; }
#user-dialog .credentials-grid { padding-bottom: 16px; border-bottom: 1px solid var(--line); }
#user-dialog .credentials-grid label:first-child { grid-column: 1 / -1; }
#user-dialog .dialog-help { margin: 12px 0 16px; }
#user-dialog .points-ledger { margin: 14px 0; padding-top: 12px; }
#user-dialog #edit-ledger { max-height: 100px; }
