/* 对外客户账单门户。参照 Ark Billing 的控制台语汇：
   浅灰工作区 + 白色卡片 + 12px 圆角 + 一套语义色。
   样式自包含，不依赖内部面板的 static 目录。 */
:root {
  color-scheme: only light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-muted: #f1f4f8;
  --sidebar-bg: #fbfcfd;
  --border: #e5e9ef;
  --border-strong: #d4dae3;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eef4ff;
  --primary-border: #c7d8fb;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --success-border: #bbf7d0;
  --warning: #d97706;
  --warning-text: #b45309;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --danger-border: #fecaca;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
  --sidebar-width: 236px;
  --content-max: 1440px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text); font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); }
.is-hidden { display: none !important; }

/* ------------------------------------------------------------ 外壳 */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}
.app-sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 12px 14px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto; z-index: 30;
}
.app-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 14px; min-width: 0; color: var(--text);
}
.app-brand__mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--primary); color: #fff;
  display: grid; place-items: center; flex-shrink: 0;
}
.app-brand__mark .icon { width: 18px; height: 18px; }
.app-brand__text { min-width: 0; line-height: 1.25; }
.app-brand__name { display: block; font-size: 14px; font-weight: 650; letter-spacing: -.01em; }
.app-brand__sub {
  display: block; font-size: 11px; color: var(--muted);
  overflow-wrap: anywhere;
}
.app-nav { display: flex; flex-direction: column; gap: 2px; }
/* 一级分组：五个页面同属「火山方舟」，只作归类，不带收起/权限。 */
.app-nav__group {
  padding: 0 10px 5px; font-size: 12px; font-weight: 600;
  color: var(--muted); letter-spacing: .02em;
}
/* 管理员额外看到的「管理」分组，与上面的业务页面拉开距离 */
.app-nav__group--admin { margin-top: 14px; }
.app-nav__link {
  display: flex; align-items: center; gap: 10px;
  height: 38px; padding: 0 10px; border-radius: 8px;
  color: var(--text-2); font-weight: 500; white-space: nowrap;
}
.app-nav__link:hover { background: var(--surface-muted); color: var(--text); }
.app-nav__link.is-active { background: var(--primary-soft); color: var(--primary); }
.app-nav__link .icon { width: 18px; height: 18px; flex: none; }
.app-sidebar__foot {
  margin-top: auto; padding: 14px 2px 2px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.app-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.app-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--surface-muted); color: var(--muted);
  font-size: 18px; font-weight: 600; flex: none;
}
.app-user__meta { min-width: 0; line-height: 1.3; }
.app-user__name {
  display: block; font-size: 17px; font-weight: 650;
  letter-spacing: -.01em;
  overflow-wrap: anywhere;
}
.app-user__role { display: block; font-size: 12px; color: var(--faint); }
.app-icon-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  color: var(--muted); width: 34px; height: 34px; border-radius: 8px;
  display: grid; place-items: center;
}
.app-icon-btn:hover { background: var(--surface-muted); color: var(--text); }
.app-icon-btn .icon { width: 18px; height: 18px; }

.app-main { min-width: 0; display: flex; flex-direction: column; overflow-x: clip; }
.app-content { flex: 1; padding: 28px 32px 48px; }
.app-container { width: 100%; max-width: var(--content-max); margin: 0 auto; }
.app-footer { padding: 0 32px 24px; color: var(--faint); font-size: 12px; }
.app-footer__inner {
  max-width: var(--content-max); margin: 0 auto;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

/* ------------------------------------------------------------ 页头 */
.app-page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.app-page-header__title { font-size: 22px; font-weight: 680; letter-spacing: -.02em; }
.app-page-header__sub {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px;
  margin-top: 6px; font-size: 12px; color: var(--muted);
}
.app-page-header__sub .icon { width: 14px; height: 14px; margin-right: 4px; }
.app-page-header__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------ 工具栏 */
.app-toolbar {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px 16px; margin-bottom: 16px;
}
.app-toolbar__form {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px;
}
.app-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.app-field__label { font-size: 12px; font-weight: 500; color: var(--muted); }
.app-field--daterange { flex: 0 1 320px; }
.app-field--select { flex: 1 1 190px; max-width: 300px; }
.app-daterange__field { display: flex; align-items: center; gap: 6px; }
.app-daterange__field input { flex: 1 1 0; width: 0; min-width: 118px; }
.app-daterange__sep { color: var(--faint); font-size: 12px; flex: none; }
.app-toolbar__submit { display: flex; gap: 8px; }
.app-toolbar__row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 16px; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid var(--border);
}
.app-segmented { display: flex; gap: 4px; flex-wrap: wrap; }
.app-segmented__item {
  padding: 4px 10px; border-radius: 6px; font-size: 12px;
  color: var(--muted); border: 1px solid transparent; cursor: pointer;
}
.app-segmented__item:hover { background: var(--surface-muted); }
.app-segmented__item.is-active {
  background: var(--primary-soft); color: var(--primary);
  border-color: var(--primary-border); font-weight: 600;
}

/* ------------------------------------------------------------ 表单/按钮 */
.form-control, .form-select {
  height: 34px; padding: 0 10px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--surface); color: var(--text);
  font: inherit; outline: none; min-width: 0;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-select { padding-right: 28px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-subtle); border-color: #c2c9d4; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-muted); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn .icon { width: 15px; height: 15px; }

/* ------------------------------------------------------------ KPI */
.app-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.app-kpi {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; min-width: 0;
}
.app-kpi__label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.app-kpi__label .icon { width: 14px; height: 14px; }
.app-kpi__value {
  margin-top: 6px; font-size: 22px; font-weight: 660;
  letter-spacing: -.02em; font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.app-kpi__value small { font-size: 13px; font-weight: 500; color: var(--muted); }
.app-kpi__sub { margin-top: 4px; font-size: 12px; color: var(--faint); }
.app-kpi.is-danger .app-kpi__value { color: var(--danger); }
.app-kpi.is-warning .app-kpi__value { color: var(--warning-text); }
.app-kpi--hero { background: linear-gradient(180deg, #f8fbff, #fff); }
/* 六张卡：宽屏一行排满，1100~1399 折成三列两行（每行三张仍按同一套
   顺序读），不给 150px 的窄格，金额会被断成两行。 */
@media (min-width: 768px) and (max-width: 1399px) {
  .app-kpis.app-kpis--six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1400px) {
  .app-kpis.app-kpis--six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  /* 六列时每格只有 170~230px，22px 的「¥148,822.52」在 1400 附近会断行；
     按视口收一点字号，1600 以上仍回到 22px。 */
  .app-kpis.app-kpis--six .app-kpi__value { font-size: clamp(17px, 1.5vw, 22px); }
}

/* ------------------------------------------------------------ 卡片 */
.app-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 0; margin-bottom: 16px;
}
.app-card__header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 16px; padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.app-card__heading { min-width: 0; }
.app-card__title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 600; line-height: 1.4;
  white-space: nowrap;
}
.app-card__header > div { min-width: 0; }
.app-card__subtitle { margin-top: 2px; font-size: 12px; color: var(--muted); }
.app-card__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.app-card__body { padding: 16px 20px 20px; }
.app-card__body--flush { padding: 0; }
.app-card__footer {
  padding: 12px 20px; border-top: 1px solid var(--border);
  background: var(--surface-subtle);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 12px; color: var(--muted); line-height: 1.7;
}
.app-grid2 {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 16px; align-items: start;
}

/* ------------------------------------------------------------ 提示条 */
.app-note {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px; margin-bottom: 16px;
  background: var(--warning-soft); border: 1px solid var(--warning-border);
  border-radius: 10px; color: #92400e; font-size: 13px;
}
.app-note .icon { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.app-note--info {
  background: #f5f9ff; border-color: #dbe7fe; color: #1e3a8a;
}
.app-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--surface-muted); color: var(--muted);
  border: 1px solid var(--border);
}
.app-badge--muted { background: var(--surface-subtle, #f3f4f6); color: var(--text-muted, #6b7280); border-color: var(--border); }
.app-badge--success { background: var(--success-soft); color: #15803d; border-color: var(--success-border); }
.app-badge--warning { background: var(--warning-soft); color: var(--warning-text); border-color: var(--warning-border); }
.app-badge--danger { background: var(--danger-soft); color: #b91c1c; border-color: var(--danger-border); }
.app-badge--info { background: var(--primary-soft); color: var(--primary-hover); border-color: var(--primary-border); }
.app-badge .icon { width: 12px; height: 12px; }

/* ------------------------------------------------------------ 提醒设置 */
.alert-channel {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--border);
}
.alert-channel:first-child { padding-top: 0; }
.alert-channel:last-child { border-bottom: 0; padding-bottom: 0; }
.alert-channel__main {
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.alert-channel__main > .app-badge { flex: none; }
.alert-channel__addr {
  flex: 1 1 auto; min-width: 0;
  font-size: 13px; color: var(--text-2);
  overflow-wrap: anywhere;
}
.alert-channel__label {
  flex: 0 1 auto; max-width: 45%;
  overflow-wrap: anywhere;
}
.alert-add {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
}
.alert-add .app-field { flex: 1 1 150px; }
.alert-add .app-field--address { flex: 2 1 240px; }
.alert-add .alert-add__button { flex: none; }
.alert-hint {
  margin-top: 8px; font-size: 12px; color: var(--faint); line-height: 1.7;
}
.alert-switch {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-2);
}
.alert-switch input { width: 15px; height: 15px; }
.alert-switch--channels {
  margin-bottom: 12px; padding-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.alert-thresholds {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px;
  margin-top: 12px;
}
.alert-thresholds .app-field { flex: 0 0 210px; max-width: 100%; }
.alert-thresholds .app-field input { width: 100%; box-sizing: border-box; }
#alMsg .app-note { margin-top: 16px; margin-bottom: 0; }
.alert-event {
  padding: 10px 0; border-bottom: 1px dashed var(--border);
}
.alert-event:first-child { padding-top: 0; }
.alert-event:last-child { border-bottom: 0; padding-bottom: 0; }
.alert-event__main {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; font-size: 13px; color: var(--text-2);
}
.alert-event__type {
  min-width: 0; overflow-wrap: anywhere;
}
.alert-event__meta {
  margin-top: 4px; font-size: 12px; color: var(--faint);
}
.alert-event__detail {
  margin-top: 4px; font-size: 12px; color: #b91c1c; line-height: 1.6;
  word-break: break-all;
}

/* ------------------------------------------------------------ 表格 */
.app-table-wrap { overflow-x: auto; }
.app-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 13px; color: var(--text-2);
}
.app-table th, .app-table td {
  padding: 10px 14px; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.app-table th:first-child, .app-table td:first-child { padding-left: 20px; }
.app-table th:last-child, .app-table td:last-child { padding-right: 20px; }
.app-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-subtle); color: var(--muted);
  font-size: 12px; font-weight: 500;
}
/* 可排序表头：默认给一个淡箭头提示能点，点过之后换成实心方向箭头 */
.app-table thead th.is-sortable { cursor: pointer; user-select: none; }
.app-table thead th.is-sortable:hover { background: #f1f5fb; color: var(--text); }
.app-table thead th.is-sortable::after {
  content: "⇅"; margin-left: 4px; font-size: 11px;
  color: var(--faint); opacity: .8;
}
.app-table thead th.is-asc::after { content: "↑"; color: var(--primary); opacity: 1; }
.app-table thead th.is-desc::after { content: "↓"; color: var(--primary); opacity: 1; }
.app-table tbody tr:hover > td { background: #fafbfd; }
.app-table tbody tr:last-child > td { border-bottom: 1px solid var(--border); }
.app-table tfoot td {
  background: var(--surface-subtle); font-weight: 600; border-bottom: 0;
}
.app-table .num { text-align: right; }
.app-table .is-strong { color: var(--text); font-weight: 600; }
.app-table .is-muted { color: var(--faint); }
.app-table .is-wrap { white-space: normal; }
.app-empty {
  padding: 36px 16px; text-align: center; color: var(--faint); font-size: 13px;
}

/* ------------------------------------------------------------ 图表 */
.app-chart { width: 100%; height: 250px; display: block; }
.app-chart text { fill: var(--faint); font-size: 10px; font-family: var(--font); }
.app-chart .grid { stroke: var(--border); stroke-width: 1; }
.app-chart .line { stroke: var(--primary); stroke-width: 2; fill: none; }
.app-chart .line--muted {
  stroke: var(--faint); stroke-width: 1.6; stroke-dasharray: 5 4;
}
.app-chart .area { fill: url(#chart-fill); }
.app-chart .dot { fill: var(--primary); }
.app-chart-legend {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: flex-end;
  padding: 0 2px 6px; font-size: 12px; color: var(--muted);
}
.app-chart-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.app-chart-legend__swatch {
  width: 16px; height: 0; border-top: 2px solid var(--primary);
}
.app-chart-legend__swatch--muted { border-top: 2px dashed var(--faint); }
.app-chart-wrap { position: relative; }
.app-chart .hit { fill: transparent; cursor: crosshair; }
.app-chart .focus-line {
  stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3;
}
.app-chart .focus-dot {
  fill: var(--surface); stroke: var(--primary); stroke-width: 2;
}
.app-chart .focus-dot--muted { stroke: var(--faint); }
.app-chart-tip {
  position: absolute; z-index: 4; pointer-events: none;
  min-width: 140px; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  font-size: 12px; color: var(--text-2);
}
.app-chart-tip__date { color: var(--muted); margin-bottom: 4px; }
.app-chart-tip__row { display: flex; align-items: center; gap: 6px; line-height: 1.8; }
.app-chart-tip__label { color: var(--muted); }
.app-chart-tip__row b {
  margin-left: auto; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.app-monthbars { display: flex; flex-direction: column; gap: 10px; }
.app-monthbar__row { display: grid; grid-template-columns: 90px 1fr 120px; align-items: center; gap: 12px; }
.app-monthbar__month { font-size: 12px; color: var(--muted); }
.app-monthbar__track { height: 14px; background: var(--surface-muted); border-radius: 4px; overflow: hidden; }
.app-monthbar__fill { height: 100%; background: var(--primary); border-radius: 4px; }
.app-monthbar__value { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.app-chart-toggle { display: flex; gap: 4px; }

/* ------------------------------------------------------------ 分页/搜索 */
.app-table-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
}
.app-search { position: relative; flex: 1 1 220px; max-width: 320px; }
.app-search input {
  width: 100%; height: 32px; padding: 0 10px 0 30px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); font: inherit; outline: none;
}
.app-search .icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--faint);
}
/* 列设置：逐笔明细要自己挑看哪些字段，挑完导出也跟着走 */
.app-cols { position: relative; }
.app-cols__menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 20;
  width: 236px; max-height: min(480px, calc(100vh - 140px));
  overflow: auto; overscroll-behavior: contain;
  padding: 6px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); box-shadow: var(--shadow-lg);
}
.app-cols__menu--up { top: auto; bottom: calc(100% + 6px); }
.app-cols__item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px;
  color: var(--text-2);
}
.app-cols__item:hover { background: var(--surface-muted); }
.app-cols__item input { width: 14px; height: 14px; accent-color: var(--primary); }
.app-cols__item i {
  margin-left: auto; font-style: normal; font-size: 11px; color: var(--faint);
}
.app-cols__foot {
  margin-top: 4px; padding-top: 6px; border-top: 1px solid var(--border);
}
.app-cols__foot .btn { width: 100%; height: 30px; font-size: 12px; }
.app-pager {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border);
}
.app-pager__info { color: var(--muted); font-size: 12px; }
.app-pager__page {
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); font: inherit; font-size: 12px; cursor: pointer;
}
.app-pager__page.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.app-pager select { height: 28px; }

/* ------------------------------------------------------------ 登录
   整页按整数像素排版：这里的行高一律写 px，不用 1.55 这类小数倍率。
   卡片高度一旦带小数，垂直居中后整张卡就压在半个像素上 —
   1px 边框和文字都会发虚，窗口差 1px 时还会整块跳一下。 */
.login-body {
  min-height: 100vh;
  min-height: 100dvh;            /* 手机上地址栏收起时页面不再整体位移 */
  display: grid; place-items: center; padding: 24px;
  line-height: 22px;
  background:
    radial-gradient(900px 380px at 50% -10%, #e8f1ff 0%, transparent 70%),
    var(--bg);
}
/* 内容长过一屏、滚动条出现时，卡片不会被横向挤动（两边都留槽，保持居中） */
html:has(.login-body) { scrollbar-gutter: stable both-edges; }

.login-card {
  width: 100%; max-width: 390px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 30px; box-shadow: var(--shadow-lg);
}
.login-card .app-brand { padding: 0 0 8px; }
.login-card .app-brand__name { line-height: 18px; }
.login-card .app-brand__sub { line-height: 16px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card .field { display: flex; flex-direction: column; gap: 6px; }
.login-card .field > span { font-size: 12px; line-height: 18px; color: var(--muted); }
.login-card .form-control { height: 36px; line-height: 20px; }
.login-card .btn { height: 40px; line-height: 22px; margin-top: 2px; font-size: 14px; }

/* 报错槽位恒定占一行高：出错时卡片不增高，卡里其他东西一个都不动 */
.login-alert-slot { min-height: 46px; }
.login-card .alert {
  margin: 0 0 12px; padding: 7px 12px; font-size: 13px; line-height: 18px;
}
.login-foot { margin-top: 18px; color: var(--faint); font-size: 12px; line-height: 18px; text-align: center; }
.alert {
  margin-bottom: 14px; padding: 9px 12px; border-radius: 8px;
  background: var(--danger-soft); color: #b91c1c; font-size: 13px;
  border: 1px solid var(--danger-border);
}

/* ------------------------------------------------------------ 自定义下拉
   原生 <select> 的弹出层由系统绘制，背景、圆角、阴影都不受页面控制；
   统一包一层按钮 + 浮层，原生 select 只当数据源（隐藏、保留 change 事件）。 */
.app-select { position: relative; display: flex; width: 100%; min-width: 0; }
.app-select > select { display: none; }
.app-select__btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 34px; height: auto; padding: 5px 10px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; text-align: left;
  line-height: 1.4; cursor: pointer; outline: none;
}
.app-select__btn:hover { border-color: #c2c9d4; }
.app-select__btn:focus-visible,
.app-select.is-open .app-select__btn {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.app-select__btn span {
  min-width: 0; overflow-wrap: anywhere;
}
.app-select__btn svg {
  flex: none; width: 14px; height: 14px; color: var(--faint);
}
.app-select__menu {
  position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: auto;
  min-width: 100%; width: max-content; max-width: 320px;
  padding: 4px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--surface);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .14);
  max-height: 260px; overflow-y: auto;
}
.app-select__menu[hidden] { display: none; }
.app-select__item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 8px 10px; border: 0; border-radius: 6px;
  background: transparent; color: var(--text-2); font: inherit;
  font-size: 13px; text-align: left; cursor: pointer; white-space: normal;
}
.app-select__item:hover { background: var(--surface-muted); }
.app-select__item.is-active { color: var(--primary); font-weight: 600; }
.app-select__item i { font-style: normal; color: var(--primary); }
.app-pager .app-select { width: auto; }
.app-pager .app-select__btn {
  height: auto; min-height: 28px; padding: 2px 8px; font-size: 12px;
}
.app-pager .app-select__menu { min-width: 96px; right: 0; left: auto; }

/* 空表格保留表头，空态落在表体里；比整块空白更容易看懂「这里是什么表」 */
.app-table tbody tr.app-empty-row > td {
  padding: 28px 16px; color: var(--faint); text-align: center;
  border-bottom: 0;
}
/* 负数余额等要让人一眼看到的数 */
.neg { color: var(--danger); }

/* ------------------------------------------------------------ 响应式 */
@media (max-width: 1200px) {
  /* 提醒设置两栏里右栏是窄栏，1024 笔记本宽度下先合单栏，避免表格/文案挤压 */
  .app-grid2--alerts { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar {
    position: static; height: auto; padding: 12px 14px;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .app-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; overflow: visible; }
  .app-nav__link { height: 34px; padding: 0 10px; }
  .app-sidebar__foot { display: none; }
  .app-content { padding: 18px 14px 32px; }
  .app-footer { padding: 0 14px 20px; }
  .app-grid2 { grid-template-columns: 1fr; }
  .app-page-header { flex-direction: column; }
  .app-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 560px) {
  .app-page-header__title { font-size: 19px; }
  .app-kpis { grid-template-columns: 1fr 1fr; }
  .app-kpi__value { font-size: 19px; }
  .app-field--daterange { flex: 1 1 100%; }
  .app-field--select { flex: 1 1 45%; max-width: none; }
  .app-monthbar__row { grid-template-columns: 64px 1fr 96px; }
  .app-table th, .app-table td { padding: 9px 10px; }
  .app-table th:first-child, .app-table td:first-child { padding-left: 12px; }
  .app-table th:last-child, .app-table td:last-child { padding-right: 12px; }
}
