/* ==========================================================================
   报关财务 · 操作台
   Material 3 蓝色体系 · 原生 CSS，无外部依赖
   ========================================================================== */

:root {
  --primary: #0061a4;
  --primary-hover: #004d85;
  --primary-pressed: #003e6b;
  --on-primary: #ffffff;
  --primary-soft: #d6e7ff;
  --primary-soft-2: #eaf3ff;
  --primary-line: #9ccbff;
  --ink: #171a1f;
  --ink-strong: #001d36;
  --muted: #555b66;
  --muted-2: #6b7280;
  --bg: #f7f9fd;
  --surface: #ffffff;
  --surface-low: #f3f6fb;
  --surface-2: #f8fafd;
  --line: #e3e7ef;
  --line-2: #f0f2f7;
  --line-strong: #c6c9d2;
  --success: #116a2e;
  --success-bg: #c6efd2;
  --warning: #7a5200;
  --warning-bg: #ffe2a8;
  --warning-surface: #fff9ec;
  --warning-line: #f0d49a;
  --danger: #b3261e;
  --danger-bg: #ffdad6;
  --danger-surface: #fff6f5;
  --danger-line: #f3c1bd;
  --teal: #00696e;
  --teal-bg: #c9ecec;
  --info-bg: #d6e7ff;
  --radius-card: 14px;
  --radius-input: 8px;
  --radius-chip: 7px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 40, 70, 0.04), 0 1px 1px rgba(16, 40, 70, 0.03);
  --shadow-md: 0 12px 32px -12px rgba(16, 40, 70, 0.18), 0 2px 8px rgba(16, 40, 70, 0.05);
  --shadow-lg: 0 28px 70px -18px rgba(0, 24, 48, 0.32);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "HarmonyOS Sans SC",
    "MiSans", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --fs-10: 12px;
  --fs-11: 12px;
  --fs-12: 13px;
  --fs-13: 14px;
  --fs-14: 15px;
  --fs-18: 18px;
  --fs-21: 21px;
  --fs-25: 25px;
  --fs-32: 32px;
  --sidebar-w: 232px;
  --topbar-h: 72px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-13);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--primary-soft);
  color: var(--ink-strong);
}

a {
  color: var(--primary);
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

.icon-xl {
  width: 28px;
  height: 28px;
}

.num,
.t-right,
.money {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.money {
  white-space: nowrap;
}

.money .cur {
  color: var(--muted-2);
  font-size: 12px;
  margin-right: 1px;
}

.money.is-negative {
  color: var(--danger);
}

.money.is-positive {
  color: var(--success);
}

.muted {
  color: var(--muted);
}

.muted-2 {
  color: var(--muted-2);
}

.strong {
  font-weight: 600;
}

.nowrap {
  white-space: nowrap;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--primary);
  font-size: var(--fs-12);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 0.16s var(--ease), border-color 0.16s var(--ease),
    color 0.16s var(--ease), transform 0.16s var(--ease);
  user-select: none;
}

.btn:hover {
  background: var(--primary-soft-2);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.btn .icon {
  width: 17px;
  height: 17px;
}

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-primary:active {
  background: var(--primary-pressed);
}

.btn-outline {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary-soft-2);
  border-color: var(--primary-line);
}

.btn-ghost {
  color: var(--muted);
}

.btn-ghost:hover {
  background: var(--surface-low);
  color: var(--ink);
}

.btn-danger {
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-surface);
}

.btn-danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger-solid:hover {
  background: #951e17;
  border-color: #951e17;
}

.btn-sm {
  height: 36px;
  padding: 0 12px;
  font-size: var(--fs-11);
}

.btn-sm .icon {
  width: 15px;
  height: 15px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 40px;
  padding: 0;
  border-radius: 50%;
  color: var(--muted);
  border-color: var(--line);
  background: var(--surface);
}

.btn-icon:hover {
  color: var(--primary);
  background: var(--primary-soft-2);
  border-color: var(--primary-line);
}

.btn-icon.is-bare {
  border-color: transparent;
  background: transparent;
}

.btn-icon.is-bare:hover {
  background: var(--surface-low);
}

.btn .spin {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-outline .spin,
.btn-ghost .spin {
  border-color: rgba(0, 97, 164, 0.25);
  border-top-color: var(--primary);
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 28px;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: var(--fs-11);
  font-weight: 500;
  white-space: nowrap;
}

.link-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn .icon {
  width: 14px;
  height: 14px;
}

/* --------------------------------------------------------------------------
   Form controls
   -------------------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label,
.field-label {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 4px 8px;
  color: var(--muted);
  font-size: var(--fs-11);
  font-weight: 500;
  line-height: 1.35;
}

.field .req {
  color: var(--danger);
  margin-left: 2px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-input);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs-12);
  line-height: 1.4;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease),
    background-color 0.16s var(--ease);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted-2);
  opacity: 1;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: #aeb6c5;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 97, 164, 0.13);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: var(--surface-low);
  color: var(--muted-2);
  cursor: not-allowed;
}

.input.has-error,
.select.has-error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.1);
}

.textarea {
  padding: 10px 12px;
  min-height: 84px;
  resize: vertical;
}

.select-wrap {
  position: relative;
  min-width: 0;
}

.select-wrap .select {
  appearance: none;
  padding-right: 34px;
  cursor: pointer;
}

.select-wrap > .icon {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.input-wrap > .icon {
  position: absolute;
  left: 11px;
  width: 16px;
  height: 16px;
  color: var(--muted-2);
  pointer-events: none;
}

.input-wrap > .input {
  padding-left: 34px;
}

.input-wrap .input-affix {
  position: absolute;
  right: 11px;
  color: var(--muted-2);
  font-size: var(--fs-11);
  pointer-events: none;
}

.input-affix-pad {
  padding-right: 34px;
}

.field-hint {
  color: var(--muted-2);
  font-size: var(--fs-10);
  line-height: 1.55;
}

.field-error {
  color: var(--danger);
  font-size: var(--fs-10);
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-grid .span-2 {
  grid-column: 1 / -1;
}

.search {
  position: relative;
  min-width: 0;
}

.search .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}

.search .input {
  padding-left: 33px;
}

.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-low);
}

.segmented button {
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-11);
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease),
    box-shadow 0.16s var(--ease);
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button[aria-pressed="true"],
.segmented button.is-active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(16, 40, 70, 0.12);
}

.segmented.is-block {
  display: flex;
}

.segmented.is-block button {
  flex: 1;
}

.segmented .seg-count {
  margin-left: 5px;
  color: var(--muted-2);
  font-size: var(--fs-10);
}

.segmented button[aria-pressed="true"] .seg-count {
  color: var(--primary);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: var(--fs-11);
  line-height: 1.5;
  cursor: pointer;
}

.check input {
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--primary);
}

/* --------------------------------------------------------------------------
   Chips, badges, avatars
   -------------------------------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  max-width: 100%;
  padding: 0 8px;
  border-radius: var(--radius-chip);
  background: var(--surface-low);
  color: var(--muted);
  font-size: var(--fs-10);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  vertical-align: middle;
}

.chip::before {
  content: "";
  width: 5px;
  height: 5px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.chip.no-dot::before {
  display: none;
}

.chip.is-info {
  background: var(--info-bg);
  color: #004a7d;
}

.chip.is-success {
  background: var(--success-bg);
  color: var(--success);
}

.chip.is-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.chip.is-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.chip.is-teal {
  background: var(--teal-bg);
  color: var(--teal);
}

.chip.is-neutral {
  background: var(--surface-low);
  color: var(--muted);
}

.chip.is-outline {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.chip.is-sm {
  height: 20px;
  font-size: 12px;
  padding: 0 6px;
}

/* 启用 / 停用开关：客户、供应商等主数据用 */
.status-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 8px 4px 6px;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  color: var(--muted-2);
  font-family: inherit;
  font-size: var(--fs-11);
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}

.status-switch:hover {
  background: var(--surface-low);
}

.status-switch:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.status-switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  flex: none;
  border-radius: var(--radius-pill);
  background: var(--line-strong);
  transition: background-color 0.18s var(--ease);
}

.status-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 40, 70, 0.28);
  transition: transform 0.18s var(--ease);
}

.status-switch[aria-checked="true"] {
  color: var(--success);
}

.status-switch[aria-checked="true"] .status-switch-track {
  background: var(--success);
}

.status-switch[aria-checked="true"] .status-switch-thumb {
  transform: translateX(16px);
}

.status-switch-text {
  min-width: 26px;
  text-align: left;
}

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.badge.is-blue {
  background: var(--primary-soft);
  color: #004a7d;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--ink-strong);
  font-size: var(--fs-11);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.avatar.is-lg {
  width: 40px;
  height: 40px;
  font-size: var(--fs-13);
}

.avatar.is-sm {
  width: 26px;
  height: 26px;
  font-size: 12px;
}

.dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: currentColor;
}

.dot.is-live {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(17, 106, 46, 0.12);
}

.dot.is-idle {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(122, 82, 0, 0.12);
}

.dot.is-off {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(179, 38, 30, 0.1);
}

/* --------------------------------------------------------------------------
   Cards, layout, page chrome
   -------------------------------------------------------------------------- */

.app-root {
  min-height: 100vh;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  padding: 18px 12px 14px;
  overflow-y: auto;
  background: var(--surface-low);
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 20px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  line-height: 1;
  box-shadow: 0 4px 10px -3px rgba(0, 97, 164, 0.45);
}

.brand-text {
  min-width: 0;
}

.brand-name {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.brand-sub {
  margin-top: 1px;
  color: var(--muted-2);
  font-size: var(--fs-10);
  line-height: 1.4;
  white-space: nowrap;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group {
  margin-top: 12px;
}

.nav-group:first-child {
  margin-top: 0;
}

.nav-label {
  padding: 0 12px 6px;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.4;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: #3f4650;
  font-size: var(--fs-13);
  font-weight: 500;
  text-align: left;
  transition: background-color 0.16s var(--ease), color 0.16s var(--ease);
}

.nav-item .icon {
  width: 20px;
  height: 20px;
  color: var(--muted);
  transition: color 0.16s var(--ease);
}

.nav-item:hover {
  background: #e9eef7;
  color: var(--ink);
}

.nav-item:hover .icon {
  color: var(--ink);
}

.nav-item.is-active {
  background: var(--primary-soft);
  color: var(--ink-strong);
  font-weight: 600;
}

.nav-item.is-active .icon {
  color: var(--primary);
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

.nav-item .nav-badge {
  margin-left: auto;
}

.nav-item .nav-live {
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(17, 106, 46, 0.12);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 16px;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: var(--fs-10);
  line-height: 1.4;
}

.sidebar-status .dot {
  width: 6px;
  height: 6px;
}

.sidebar-status strong {
  font-weight: 500;
  color: var(--ink);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px 2px;
  border-top: 1px solid var(--line);
}

.user-card .user-meta {
  min-width: 0;
  flex: 1;
}

.user-card .user-name {
  overflow: hidden;
  color: var(--ink);
  font-size: var(--fs-12);
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-card .user-role {
  overflow: hidden;
  color: var(--muted-2);
  font-size: var(--fs-10);
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main {
  min-height: 100vh;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.page-head {
  min-width: 0;
}

.page-eyebrow {
  overflow: hidden;
  margin-bottom: 1px;
  color: var(--muted-2);
  font-size: var(--fs-10);
  font-weight: 400;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-title {
  overflow: hidden;
  color: var(--ink);
  font-size: var(--fs-21);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  min-width: 0;
}

.topbar-actions .btn {
  flex: none;
}

.topbar-divider {
  width: 1px;
  height: 24px;
  margin: 0 4px;
  background: var(--line);
}

.topbar-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-2);
  font-size: var(--fs-10);
  white-space: nowrap;
}

.topbar-note .dot {
  width: 6px;
  height: 6px;
}

.menu-toggle {
  display: none;
}

.content {
  flex: 1;
  width: 100%;
  max-width: 1660px;
  margin: 0 auto;
  padding: 24px 24px 56px;
}

.sidebar-scrim {
  display: none;
}

.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px 12px;
}

.card-head.is-bordered {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-2);
}

.card-head-main {
  min-width: 0;
  flex: 1;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: var(--fs-14);
  font-weight: 600;
  line-height: 1.35;
}

.card-sub {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: var(--fs-10);
  font-weight: 400;
  line-height: 1.5;
}

.card-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.card-body {
  padding: 18px;
}

.card-body.is-tight {
  padding: 0;
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line-2);
  background: var(--surface-2);
}

.card-tabs {
  display: flex;
  gap: 2px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.tab {
  position: relative;
  height: 44px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: var(--fs-12);
  font-weight: 500;
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  color: var(--primary);
}

.tab.is-active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--primary);
}

.tab .seg-count {
  margin-left: 5px;
  color: var(--muted-2);
  font-size: var(--fs-10);
}

.tab.is-active .seg-count {
  color: var(--primary);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-main-side {
  grid-template-columns: minmax(0, 1.85fr) minmax(320px, 1fr);
}

.grid-main-side.is-balanced {
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.spacer {
  flex: 1;
}

.section-gap {
  margin-top: 16px;
}

.page-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.page-toolbar .search {
  width: 230px;
}

.page-toolbar .select-wrap {
  width: 150px;
}

.page-toolbar .input {
  height: 40px;
}

.page-toolbar .toolbar-meta {
  margin-left: auto;
  color: var(--muted-2);
  font-size: var(--fs-10);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   KPI
   -------------------------------------------------------------------------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

/* 工作台有 5 张 KPI（含「待计费」）时铺满一行，避免第 5 张单独换行 */
.kpi-grid:has(> .kpi-card:nth-child(5)) {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.kpi-card {
  position: relative;
  min-width: 0;
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.kpi-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.kpi-label {
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: var(--fs-11);
  font-weight: 500;
  line-height: 1.4;
}

.kpi-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 9px;
  background: var(--primary-soft-2);
  color: var(--primary);
}

.kpi-icon .icon {
  width: 17px;
  height: 17px;
}

.kpi-card.is-warning .kpi-icon {
  background: var(--warning-bg);
  color: var(--warning);
}

.kpi-card.is-teal .kpi-icon {
  background: var(--teal-bg);
  color: var(--teal);
}

.kpi-card.is-danger .kpi-icon {
  background: var(--danger-bg);
  color: var(--danger);
}

.kpi-value {
  margin-top: 8px;
  color: var(--ink);
  font-size: var(--fs-25);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.kpi-value .cur {
  color: var(--muted-2);
  font-size: 0.68em;
  font-weight: 500;
  letter-spacing: 0;
  margin-right: 2px;
}

.kpi-value .unit {
  color: var(--muted-2);
  font-size: 0.62em;
  font-weight: 500;
  letter-spacing: 0;
  margin-left: 2px;
}

.kpi-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  color: var(--muted-2);
  font-size: var(--fs-10);
  line-height: 1.45;
}

.kpi-meta .up {
  color: var(--success);
  font-weight: 500;
}

.kpi-meta .warn {
  color: var(--warning);
  font-weight: 500;
}

.kpi-meta .down {
  color: var(--danger);
  font-weight: 500;
}

.kpi-progress {
  height: 4px;
  margin-top: 11px;
  border-radius: 2px;
  background: var(--surface-low);
  overflow: hidden;
}

.kpi-progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.kpi-progress.is-warning > i {
  background: #d69a1e;
}

.kpi-progress.is-teal > i {
  background: var(--teal);
}

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap {
  width: 100%;
  overflow: auto;
  scrollbar-width: thin;
}

.data-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  border-spacing: 0;
  font-size: var(--fs-12);
  line-height: 1.45;
}

.data-table.is-wide {
  min-width: 880px;
}

.data-table th {
  height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-low);
  color: var(--muted);
  font-size: var(--fs-10);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
  padding-left: 18px;
}

.data-table th:last-child,
.data-table td:last-child {
  padding-right: 18px;
}

.data-table th.t-right,
.data-table td.t-right {
  text-align: right;
}

.data-table td {
  height: 44px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background-color 0.12s var(--ease);
}

.data-table tbody tr.is-clickable {
  cursor: pointer;
}

.data-table tbody tr.is-clickable:hover {
  background: var(--surface-2);
}

.data-table tbody tr.is-selected {
  background: var(--primary-soft-2);
  box-shadow: inset 2px 0 0 var(--primary);
}

.data-table tbody tr.is-selected:hover {
  background: #e2efff;
}

.data-table tfoot td {
  height: 44px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-weight: 600;
  color: var(--ink);
}

.data-table .cell-main {
  display: block;
  max-width: 240px;
  overflow: hidden;
  color: var(--ink);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table .cell-sub {
  display: block;
  max-width: 240px;
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted-2);
  font-size: var(--fs-10);
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.data-table .cell-main.is-unset {
  color: var(--muted-2);
  font-weight: 500;
}

.data-table .cell-strong {
  font-weight: 600;
}

.data-table .cell-mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.data-table .row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}

.data-table .table-empty td {
  height: auto;
  padding: 0;
  border-bottom: 0;
}

.data-table .table-empty:hover {
  background: transparent;
}

.table-foot-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 18px;
  border-top: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--muted-2);
  font-size: var(--fs-10);
}

.table-foot-note strong {
  color: var(--ink);
  font-weight: 600;
}

.amount-cell {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount-cell.is-soft {
  font-weight: 400;
}

/* --------------------------------------------------------------------------
   Empty / loading / notice / error
   -------------------------------------------------------------------------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--warning-line);
  border-radius: 10px;
  background: var(--warning-surface);
  color: #5c3f00;
  font-size: var(--fs-11);
  line-height: 1.6;
}

.notice .icon {
  width: 17px;
  height: 17px;
  flex: none;
  margin-top: 1px;
  color: var(--warning);
}

.notice strong {
  display: block;
  font-weight: 600;
  color: #4d3400;
}

.notice p {
  margin-top: 2px;
  color: #6b4d13;
}

.notice .notice-action {
  margin-left: auto;
  flex: none;
  align-self: center;
}

.notice.is-danger {
  background: var(--danger-surface);
  border-color: var(--danger-line);
  color: #7c1a15;
}

.notice.is-danger .icon {
  color: var(--danger);
}

.notice.is-danger strong {
  color: #6b1712;
}

.notice.is-danger p {
  color: #8c3a34;
}

.notice.is-info {
  background: var(--primary-soft-2);
  border-color: #c7dffb;
  color: #00456f;
}

.notice.is-info .icon {
  color: var(--primary);
}

.notice.is-info strong {
  color: #003a60;
}

.notice.is-info p {
  color: #3e607a;
}

.notice.is-success {
  background: #f0faf2;
  border-color: #b9e5c4;
  color: #0d5525;
}

.notice.is-success .icon {
  color: var(--success);
}

.notice.is-success strong {
  color: #0b4a20;
}

.notice.is-success p {
  color: #376b46;
}

.notice.is-compact {
  padding: 9px 12px;
  font-size: var(--fs-10);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 48px 24px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--surface-low);
  color: var(--muted-2);
}

.empty-icon .icon {
  width: 21px;
  height: 21px;
}

.empty-title {
  color: var(--ink);
  font-size: var(--fs-13);
  font-weight: 600;
}

.empty-text {
  max-width: 330px;
  color: var(--muted-2);
  font-size: var(--fs-11);
  line-height: 1.65;
}

.empty .btn {
  margin-top: 8px;
}

.empty.is-compact {
  padding: 28px 16px;
}

.loading-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 24px;
  color: var(--muted-2);
  font-size: var(--fs-11);
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: #edf1f7;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: shimmer 1.35s infinite;
}

.skeleton-rows {
  padding: 8px 18px 14px;
}

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 44px;
  border-bottom: 1px solid var(--line-2);
}

.skeleton-row:last-child {
  border-bottom: 0;
}

.skeleton-row .skeleton {
  height: 10px;
}

.skeleton-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.skeleton-kpi {
  height: 108px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  padding: 16px 18px;
}

.skeleton-kpi .skeleton {
  height: 10px;
  width: 42%;
}

.skeleton-kpi .skeleton + .skeleton {
  margin-top: 14px;
  height: 22px;
  width: 62%;
}

.skeleton-kpi .skeleton + .skeleton + .skeleton {
  margin-top: 10px;
  height: 8px;
  width: 52%;
}

/* --------------------------------------------------------------------------
   Login
   -------------------------------------------------------------------------- */

.login {
  display: grid;
  grid-template-columns: minmax(0, 1.13fr) minmax(440px, 0.87fr);
  min-height: 100vh;
  background: var(--bg);
}

.login-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: 40px 56px 30px;
  overflow: hidden;
  background: #001d36;
  color: #d9e7f6;
}

.login-visual::before {
  content: "";
  position: absolute;
  right: -230px;
  top: -210px;
  width: 620px;
  height: 620px;
  border: 1px solid rgba(156, 203, 255, 0.18);
  border-radius: 50%;
  box-shadow: 0 0 0 80px rgba(156, 203, 255, 0.025),
    0 0 0 160px rgba(156, 203, 255, 0.018);
  pointer-events: none;
}

.login-visual::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 44%;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 31px,
    rgba(156, 203, 255, 0.055) 31px,
    rgba(156, 203, 255, 0.055) 32px
  );
  mask-image: linear-gradient(to top, #000 0%, transparent 100%);
  pointer-events: none;
}

.login-visual > * {
  position: relative;
  z-index: 1;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand .brand-mark {
  background: #0e5f9c;
  box-shadow: none;
}

.login-brand .brand-name {
  color: #f2f7fc;
  font-size: 15px;
}

.login-brand .brand-sub {
  color: #8fa8c0;
}

.login-hero {
  max-width: 560px;
  margin: 34px 0 0;
}

.login-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
  color: #9ccbff;
  font-size: var(--fs-10);
  font-weight: 500;
  letter-spacing: 0.13em;
}

.login-kicker::before {
  content: "";
  width: 22px;
  height: 1px;
  background: #9ccbff;
}

.login-title {
  color: #fff;
  font-size: clamp(32px, 3.2vw, 46px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.24;
}

.login-title em {
  color: #9ccbff;
  font-style: normal;
}

.login-lead {
  max-width: 30em;
  margin-top: 16px;
  color: #a9bfd4;
  font-size: var(--fs-13);
  line-height: 1.85;
}

.login-flow {
  width: min(100%, 470px);
  margin-top: 36px;
  border-top: 1px solid rgba(156, 203, 255, 0.15);
}

.login-flow li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid rgba(156, 203, 255, 0.11);
}

.login-flow .flow-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border: 1px solid rgba(156, 203, 255, 0.35);
  border-radius: 50%;
  color: #9ccbff;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.login-flow .flow-text {
  min-width: 0;
  flex: 1;
}

.login-flow strong {
  display: block;
  color: #e7f1fb;
  font-size: var(--fs-12);
  font-weight: 500;
  line-height: 1.45;
}

.login-flow small {
  display: block;
  margin-top: 1px;
  color: #7e97ae;
  font-size: var(--fs-10);
  line-height: 1.35;
}

.login-flow .flow-meta {
  color: #7e97ae;
  font-size: var(--fs-10);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.login-visual-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 30px;
  color: #6f899f;
  font-size: var(--fs-10);
  letter-spacing: 0.02em;
}

.login-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 32px;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 392px;
}

.login-card-head {
  margin-bottom: 26px;
}

.login-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: var(--fs-10);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.login-card h2 {
  color: var(--ink);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.login-card-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--fs-12);
  line-height: 1.7;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.login-form .field > label {
  color: var(--ink);
  font-size: var(--fs-11);
  font-weight: 500;
}

.login-form .input {
  min-height: 44px;
  font-size: var(--fs-13);
}

.login-form .btn-block {
  height: 44px;
  font-size: var(--fs-13);
}

.login-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--danger-line);
  border-radius: 8px;
  background: var(--danger-surface);
  color: #7c1a15;
  font-size: var(--fs-11);
  line-height: 1.55;
}

.login-error .icon {
  width: 16px;
  height: 16px;
  flex: none;
  margin-top: 1px;
  color: var(--danger);
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
  color: var(--muted-2);
  font-size: var(--fs-10);
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.login-hint {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-low);
  color: var(--muted);
  font-size: var(--fs-10);
  line-height: 1.65;
}

.login-hint code {
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.login-panel-foot {
  margin-top: 28px;
  color: var(--muted-2);
  font-size: var(--fs-10);
  line-height: 1.6;
  text-align: center;
}

.login-mobile-brand {
  display: none;
}

/* --------------------------------------------------------------------------
   Workbench
   -------------------------------------------------------------------------- */

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(330px, 1fr);
  gap: 16px;
  align-items: start;
}

.recent-list {
  display: flex;
  flex-direction: column;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--line-2);
  background: transparent;
  text-align: left;
  transition: background-color 0.14s var(--ease);
}

.recent-item:first-child {
  border-top: 0;
}

.recent-item:hover {
  background: var(--surface-2);
}

.recent-item .recent-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  background: var(--surface-low);
  color: var(--muted);
}

.recent-item .recent-icon .icon {
  width: 17px;
  height: 17px;
}

.recent-item .recent-main {
  min-width: 0;
  flex: 1;
}

.recent-item .recent-title {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: var(--fs-12);
  font-weight: 500;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-item .recent-sub {
  display: flex;
  align-items: center;
  align-items: center;
  gap: 6px;
  margin-top: 1px;
  color: var(--muted-2);
  font-size: var(--fs-10);
  line-height: 1.5;
}

.recent-item .recent-amount {
  flex: none;
  min-width: 90px;
  color: var(--ink);
  font-size: var(--fs-12);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.recent-item .recent-amount small {
  display: block;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 400;
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 18px 18px;
}

.quick-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease),
    transform 0.16s var(--ease);
}

.quick-link:hover {
  border-color: var(--primary-line);
  background: var(--primary-soft-2);
}

.quick-link:active {
  transform: translateY(1px);
}

.quick-link .quick-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-soft-2);
  color: var(--primary);
}

.quick-link .quick-icon .icon {
  width: 16px;
  height: 16px;
}

.quick-link strong {
  color: var(--ink);
  font-size: var(--fs-11);
  font-weight: 600;
  line-height: 1.4;
}

.quick-link small {
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.4;
}

.flow-card {
  padding: 16px 18px 18px;
}

.flow-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-top: 14px;
}

.flow-step {
  flex: 1;
  min-width: 0;
}

.flow-step .flow-bar {
  position: relative;
  height: 5px;
  border-radius: 3px;
  background: var(--surface-low);
  overflow: hidden;
}

.flow-step .flow-bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.flow-step:first-child .flow-bar {
  border-radius: 3px 0 0 3px;
}

.flow-step:last-child .flow-bar {
  border-radius: 0 3px 3px 0;
}

.flow-step .flow-label {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--fs-10);
  line-height: 1.4;
}

.flow-step .flow-label strong {
  color: var(--ink);
  font-size: var(--fs-12);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.flow-step .flow-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted-2);
  font-size: var(--fs-10);
}

/* --------------------------------------------------------------------------
   Imports
   -------------------------------------------------------------------------- */

.import-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(330px, 1fr);
  gap: 16px;
  align-items: start;
}

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 22px 14px;
  border: 1.5px dashed #b9c3d3;
  border-radius: 12px;
  background: #fbfcff;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.16s var(--ease), background-color 0.16s var(--ease);
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--primary);
  background: var(--primary-soft-2);
}

.dropzone .drop-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
}

.dropzone .drop-icon .icon {
  width: 19px;
  height: 19px;
}

.dropzone strong {
  color: var(--ink);
  font-size: var(--fs-12);
  font-weight: 600;
  line-height: 1.4;
}

.dropzone small {
  color: var(--muted-2);
  font-size: var(--fs-10);
  line-height: 1.5;
}

.dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.selected-file {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.selected-file .file-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 7px;
  background: var(--primary-soft-2);
  color: var(--primary);
}

.selected-file .file-icon .icon {
  width: 15px;
  height: 15px;
}

.selected-file .file-meta {
  min-width: 0;
  flex: 1;
}

.selected-file .file-name {
  overflow: hidden;
  color: var(--ink);
  font-size: var(--fs-11);
  font-weight: 500;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file .file-size {
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.4;
}

.import-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.progress-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 6px;
  color: var(--muted-2);
  font-size: var(--fs-10);
}

.progress-meta strong {
  color: var(--ink);
  font-size: var(--fs-12);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 6px;
  border-radius: 3px;
  background: #e9edf4;
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.35s var(--ease);
}

.progress.is-done > i {
  background: var(--success);
}

.progress.is-error > i {
  background: var(--danger);
}

.batch-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.batch-fact {
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--surface-low);
}

.batch-fact > span {
  display: block;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.4;
}

.batch-fact strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: var(--fs-13);
  font-weight: 600;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.batch-fact strong.is-danger {
  color: var(--danger);
}

.batch-fact strong.is-success {
  color: var(--success);
}

.failure-log-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.failure-log-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.failure-log-icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
}

.failure-log-icon svg {
  width: 17px;
  height: 17px;
}

.failure-log-card.is-clean .failure-log-icon {
  background: var(--success-bg);
  color: var(--success);
}

.failure-log-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--fs-12);
  overflow-wrap: anywhere;
}

.failure-log-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .failure-log-actions {
    width: 100%;
  }

  .failure-log-actions .btn {
    flex: 1;
  }
}

.poll-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-2);
  font-size: 12px;
  white-space: nowrap;
}

.poll-chip .dot {
  width: 5px;
  height: 5px;
  background: var(--success);
  animation: pulse 1.6s ease-in-out infinite;
}

.upload-hint {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 10px;
  color: var(--muted-2);
  font-size: var(--fs-10);
  line-height: 1.55;
}

.upload-hint .icon {
  width: 13px;
  height: 13px;
  flex: none;
  margin-top: 1px;
}

/* --------------------------------------------------------------------------
   Exceptions
   -------------------------------------------------------------------------- */

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(370px, 1fr);
  gap: 16px;
  align-items: start;
}

.exception-list .data-table td {
  height: 48px;
}

.exception-editor {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}

.editor-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line-2);
}

.editor-head-main {
  min-width: 0;
  flex: 1;
}

.editor-id {
  color: var(--muted-2);
  font-size: var(--fs-10);
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.editor-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 2px;
  color: var(--ink);
  font-size: var(--fs-14);
  font-weight: 600;
  line-height: 1.4;
}

.editor-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px;
}

.remark-box {
  padding: 10px 12px;
  border-left: 3px solid var(--primary-line);
  border-radius: 0 8px 8px 0;
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--fs-11);
  line-height: 1.7;
  max-height: 104px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.remark-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  color: var(--muted-2);
  font-size: var(--fs-10);
}

.editor-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface-low);
  color: var(--muted);
  font-size: var(--fs-10);
  line-height: 1.5;
}

.editor-meta > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.editor-meta strong {
  color: var(--ink);
  font-weight: 500;
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line-2);
  background: var(--surface-2);
}

.editor-actions .btn-primary {
  flex: 1;
}

.exception-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-10);
  line-height: 1.5;
}

.exception-summary strong {
  color: var(--ink);
  font-weight: 600;
}

.log-toolbar {
  border-bottom: 0;
}

.log-pager {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line-2);
}

.log-pager .spacer {
  flex: 1;
}

.log-note {
  min-width: 190px;
}

@media (max-width: 1180px) {
  .log-col-batch,
  .log-col-fee {
    display: none;
  }
  .log-table {
    table-layout: fixed;
  }
  .log-table th:nth-child(1) {
    width: 14%;
  }
  .log-table th:nth-child(3) {
    width: 11%;
  }
  .log-table th:nth-child(4) {
    width: 22%;
  }
  .log-table th:nth-child(5) {
    width: 20%;
  }
  .log-table th:nth-child(7) {
    width: 18%;
  }
  .log-table th:nth-child(8) {
    width: 15%;
  }
  .log-period {
    display: none;
  }
  .log-waybill .cell-main {
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .log-actions .btn {
    display: block;
    width: 100%;
    margin: 0 0 2px;
    padding-left: 4px;
    padding-right: 4px;
  }
  .log-actions .btn:last-child {
    margin-bottom: 0;
  }
}

/* --------------------------------------------------------------------------
   Detail pages
   -------------------------------------------------------------------------- */

.page-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  margin-bottom: 4px;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: var(--fs-11);
  font-weight: 500;
}

.page-back:hover {
  color: var(--primary);
}

.page-back .icon {
  width: 15px;
  height: 15px;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 22px;
}

.detail-head-main {
  min-width: 0;
  flex: 1;
}

.detail-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--muted-2);
  font-size: var(--fs-10);
}

.detail-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  color: var(--ink);
  font-size: var(--fs-21);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.detail-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--fs-11);
  line-height: 1.5;
}

.detail-sub span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.detail-sub strong {
  color: var(--ink);
  font-weight: 500;
}

.detail-amount {
  flex: none;
  padding-left: 24px;
  border-left: 1px solid var(--line);
  text-align: right;
}

.detail-amount .label {
  color: var(--muted-2);
  font-size: var(--fs-10);
  line-height: 1.4;
}

.detail-amount .value {
  margin-top: 3px;
  color: var(--ink);
  font-size: var(--fs-32);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.detail-amount .value .cur {
  color: var(--muted-2);
  font-size: 0.4375em;
  font-weight: 500;
  letter-spacing: 0;
  margin-right: 2px;
}

.detail-amount .meta {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: var(--fs-10);
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}

.stat-cell {
  padding: 13px 20px;
  border-right: 1px solid var(--line-2);
}

.stat-cell:last-child {
  border-right: 0;
}

.stat-cell > span {
  display: block;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.4;
}

.stat-cell strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: var(--fs-14);
  font-weight: 600;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.stat-cell strong.is-primary {
  color: var(--primary);
}

.stat-cell strong.is-success {
  color: var(--success);
}

.stat-cell strong.is-danger {
  color: var(--danger);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.detail-aside {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}

.info-list {
  display: flex;
  flex-direction: column;
}

.info-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 18px;
  border-top: 1px solid var(--line-2);
  font-size: var(--fs-11);
  line-height: 1.5;
}

.info-row:first-child {
  border-top: 0;
}

.info-row > span:first-child {
  flex: none;
  color: var(--muted-2);
}

.info-row > span:last-child,
.info-row > div:last-child {
  color: var(--ink);
  text-align: right;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.aside-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 18px 18px;
}

.aside-actions .btn {
  width: 100%;
  justify-content: center;
}

.aside-actions .btn-primary {
  justify-content: center;
}

/* Reissue stepper / timeline */

.stepper {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: 16px 22px 18px;
  overflow-x: auto;
  border-top: 1px solid var(--line);
  scrollbar-width: thin;
}

.step {
  position: relative;
  flex: 1;
  min-width: 62px;
  text-align: center;
}

.step::before {
  content: "";
  position: absolute;
  top: 10px;
  left: calc(-50% + 11px);
  right: calc(50% + 11px);
  height: 2px;
  background: var(--line);
}

.step:first-child::before {
  display: none;
}

.step.is-done::before,
.step.is-current::before {
  background: var(--primary-line);
}

.step-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin: 0 auto;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 600;
}

.step-dot .icon {
  width: 12px;
  height: 12px;
}

.step.is-done .step-dot {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.step.is-current .step-dot {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 97, 164, 0.12);
}

.step.is-danger .step-dot {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.step-label {
  display: block;
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
}

.step.is-done .step-label {
  color: var(--muted);
}

.step.is-current .step-label {
  color: var(--primary);
  font-weight: 600;
}

.timeline {
  padding: 4px 18px 18px;
}

.timeline-item {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 10px 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 32px;
  bottom: -10px;
  width: 1px;
  background: var(--line);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  flex: none;
  margin-top: 1px;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted-2);
}

.timeline-dot .icon {
  width: 11px;
  height: 11px;
}

.timeline-item.is-done .timeline-dot {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.timeline-item.is-current .timeline-dot {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.timeline-main {
  min-width: 0;
  flex: 1;
  padding-bottom: 4px;
}

.timeline-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: var(--fs-11);
  font-weight: 500;
  line-height: 1.5;
}

.timeline-item.is-done .timeline-title,
.timeline-item.is-current .timeline-title {
  color: var(--ink);
}

.timeline-meta {
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.5;
}

.four-piece {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 18px 18px;
}

.piece {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
}

.piece .piece-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-low);
  color: var(--muted-2);
}

.piece .piece-icon .icon {
  width: 12px;
  height: 12px;
}

.piece.is-done {
  border-color: #c7e7cf;
  background: #f7fdf8;
}

.piece.is-done .piece-icon {
  background: var(--success-bg);
  color: var(--success);
}

.piece.is-missing {
  border-color: var(--warning-line);
  background: var(--warning-surface);
}

.piece.is-missing .piece-icon {
  background: var(--warning-bg);
  color: var(--warning);
}

.piece-text {
  min-width: 0;
}

.piece-text strong {
  display: block;
  color: var(--ink);
  font-size: var(--fs-10);
  font-weight: 600;
  line-height: 1.4;
}

.piece-text > span {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amount-compare {
  padding: 0 18px 16px;
}

.amount-compare-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: var(--fs-11);
}

.amount-compare-row:last-child {
  border-bottom: 0;
}

.amount-compare-row > span {
  color: var(--muted-2);
}

.amount-compare-row strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.amount-compare-row.is-total {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-12);
}

.amount-compare-row.is-total strong {
  color: var(--primary);
  font-size: var(--fs-14);
}

.reissue-action-note {
  margin: 0 18px 14px;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--surface-low);
  color: var(--muted);
  font-size: var(--fs-10);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Reports
   -------------------------------------------------------------------------- */

.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 16px;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 2px 18px 18px;
}

.bar-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 80px;
  align-items: center;
  gap: 10px;
}

.bar-row .bar-label {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-10);
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 8px;
  border-radius: 4px;
  background: var(--surface-low);
  overflow: hidden;
}

.bar-track > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.bar-row:nth-child(2) .bar-track > i {
  background: #2b7fbe;
}

.bar-row:nth-child(3) .bar-track > i {
  background: #62a6d8;
}

.bar-row:nth-child(4) .bar-track > i {
  background: #98c6e7;
}

.bar-row .bar-value {
  color: var(--ink);
  font-size: var(--fs-10);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.report-quality {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 18px 18px;
}

.quality-cell {
  padding: 11px 12px;
  border-radius: 9px;
  background: var(--surface-low);
}

.quality-cell > span {
  display: block;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.4;
}

.quality-cell strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: var(--fs-16, 16px);
  font-weight: 600;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.quality-cell strong.is-warning {
  color: var(--warning);
}

.quality-cell strong.is-success {
  color: var(--success);
}

/* --------------------------------------------------------------------------
   Drawer / modal / toast
   -------------------------------------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 20, 40, 0.34);
  animation: fadeIn 0.18s var(--ease);
}

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 81;
  display: flex;
  flex-direction: column;
  width: 460px;
  max-width: 94vw;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.22s var(--ease);
}

.drawer.is-wide {
  width: 560px;
}

.drawer.is-extra-wide {
  width: 860px;
  max-width: 96vw;
}

@media (max-width: 900px) {
  .drawer.is-extra-wide {
    width: 100vw;
    max-width: 100vw;
  }
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--line);
}

.drawer-head-main {
  min-width: 0;
  flex: 1;
}

.drawer-eyebrow {
  color: var(--muted-2);
  font-size: var(--fs-10);
  line-height: 1.4;
}

.drawer-title {
  margin-top: 2px;
  color: var(--ink);
  font-size: var(--fs-18);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

.drawer-sub {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: var(--fs-10);
  line-height: 1.55;
}

.drawer-close {
  flex: none;
}

.drawer-body {
  flex: 1;
  padding: 18px 22px 24px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.drawer-body .form-grid {
  gap: 14px;
}

.drawer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.drawer-foot .spacer {
  flex: 1;
}

.form-section + .form-section {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line-2);
}

.form-section-title {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: var(--fs-11);
  font-weight: 600;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 20, 40, 0.4);
  animation: fadeIn 0.16s var(--ease);
}

.modal {
  width: 100%;
  max-width: 430px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s var(--ease);
}

.modal-body {
  padding: 22px 22px 18px;
}

.modal-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
}

.modal-icon .icon {
  width: 19px;
  height: 19px;
}

.modal-icon.is-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.modal-icon.is-warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.modal-title {
  color: var(--ink);
  font-size: var(--fs-18);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

.modal-text {
  margin-top: 6px;
  color: var(--muted);
  font-size: var(--fs-12);
  line-height: 1.7;
}

.modal-text strong {
  color: var(--ink);
  font-weight: 600;
}

.modal-extra {
  margin-top: 16px;
}

.modal-summary {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.modal-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-2);
  font-size: var(--fs-11);
  line-height: 1.5;
}

.modal-summary-row:last-child {
  border-bottom: 0;
}

.modal-summary-row > span {
  color: var(--muted-2);
}

.modal-summary-row strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.toast-region {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px 11px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--ink);
  font-size: var(--fs-11);
  line-height: 1.55;
  pointer-events: auto;
  animation: toastIn 0.2s var(--ease);
}

.toast.is-leaving {
  animation: toastOut 0.18s var(--ease) forwards;
}

.toast .toast-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  border-radius: 50%;
  background: var(--primary-soft-2);
  color: var(--primary);
}

.toast .toast-icon .icon {
  width: 12px;
  height: 12px;
}

.toast.is-success {
  border-left-color: var(--success);
}

.toast.is-success .toast-icon {
  background: var(--success-bg);
  color: var(--success);
}

.toast.is-error {
  border-left-color: var(--danger);
}

.toast.is-error .toast-icon {
  background: var(--danger-bg);
  color: var(--danger);
}

.toast.is-warning {
  border-left-color: var(--warning);
}

.toast.is-warning .toast-icon {
  background: var(--warning-bg);
  color: var(--warning);
}

.toast .toast-title {
  display: block;
  color: var(--ink);
  font-weight: 600;
}

.toast .toast-msg {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: var(--fs-10);
  line-height: 1.55;
}

.toast .toast-close {
  flex: none;
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted-2);
  line-height: 0;
}

/* --------------------------------------------------------------------------
   Misc
   -------------------------------------------------------------------------- */

.copy-value {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.copy-value .link-btn {
  color: var(--muted-2);
}

.copy-value .link-btn:hover {
  color: var(--primary);
}

.entity-line {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.entity-line .avatar {
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line-2);
}

.table-toolbar .search {
  width: 210px;
}

.table-toolbar .select-wrap {
  width: 136px;
}

.table-toolbar .input,
.table-toolbar .select {
  height: 36px;
  min-height: 36px;
}

.toolbar-count {
  margin-left: auto;
  color: var(--muted-2);
  font-size: var(--fs-10);
  white-space: nowrap;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.list-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-top: 1px solid var(--line-2);
  color: var(--muted-2);
  font-size: var(--fs-10);
}

.list-footer strong {
  color: var(--ink);
  font-weight: 600;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.mini-stats.is-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mini-stats.is-six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.mini-stat {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.mini-stat > span {
  display: block;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.4;
}

.mini-stat strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: var(--fs-18);
  font-weight: 600;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.mini-stat strong .cur {
  color: var(--muted-2);
  font-size: 0.75em;
  font-weight: 500;
  margin-right: 1px;
}

.mini-stat small {
  display: block;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.4;
}

.drawer-summary {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-low);
  color: var(--muted);
  font-size: var(--fs-10);
  line-height: 1.65;
}

.drawer-summary strong {
  color: var(--ink);
  font-weight: 600;
}

.drawer-summary .money {
  color: var(--ink);
  font-weight: 600;
}

.code-pill {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-low);
  color: var(--muted);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

/* Scrollbars */
.table-wrap::-webkit-scrollbar,
.drawer-body::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.stepper::-webkit-scrollbar,
.remark-box::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.table-wrap::-webkit-scrollbar-thumb,
.drawer-body::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.stepper::-webkit-scrollbar-thumb,
.remark-box::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  background: #cbd3e0;
  background-clip: content-box;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .skeleton-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workbench-grid,
  .import-grid {
    grid-template-columns: minmax(0, 1.55fr) minmax(310px, 1fr);
  }

  .login-visual {
    padding-left: 40px;
    padding-right: 40px;
  }
}

@media (max-width: 1120px) {
  .grid-main-side,
  .grid-main-side.is-balanced,
  .split-grid,
  .detail-grid,
  .report-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .detail-aside,
  .exception-editor {
    position: static;
  }

  .detail-aside {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .workbench-grid,
  .import-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .import-side {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .topbar-note {
    display: none;
  }
}

@media (max-width: 960px) {
  :root {
    --sidebar-w: 232px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s var(--ease);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 45;
    display: none;
    background: rgba(0, 20, 40, 0.32);
  }

  .sidebar-scrim.is-open {
    display: block;
  }

  .main {
    margin-left: 0;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .topbar {
    padding: 0 16px;
    gap: 8px;
  }

  .content {
    padding: 18px 16px 48px;
  }

  .login {
    grid-template-columns: minmax(0, 1fr);
  }

  .login-visual {
    min-height: 260px;
    padding: 28px 32px;
    justify-content: flex-start;
  }

  .login-visual::after {
    height: 60%;
  }

  .login-hero {
    margin-top: 24px;
  }

  .login-title {
    font-size: 32px;
  }

  .login-lead {
    margin-top: 10px;
    font-size: var(--fs-12);
  }

  .login-flow {
    display: none;
  }

  .login-visual-foot {
    display: none;
  }

  .login-panel {
    min-height: auto;
    padding: 32px 24px 48px;
  }
}

@media (max-width: 1100px) {
  .mini-stats.is-six {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .span-2 {
    grid-column: auto;
  }

  .kpi-grid {
    gap: 10px;
  }

  .mini-stats {
    grid-template-columns: 1fr;
  }

  .mini-stats.is-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  .mini-stats.is-four .mini-stat {
    padding: 10px 8px;
  }

  .mini-stats.is-four .mini-stat > span,
  .mini-stats.is-four .mini-stat small {
    font-size: 12px;
    overflow-wrap: anywhere;
  }

  .mini-stats.is-four .mini-stat strong {
    font-size: 16px;
    overflow-wrap: anywhere;
  }

  .mini-stats.is-six {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .mini-stats.is-six .mini-stat {
    padding: 10px 8px;
  }

  .mini-stats.is-six .mini-stat > span,
  .mini-stats.is-six .mini-stat small {
    font-size: 12px;
    overflow-wrap: anywhere;
  }

  .mini-stats.is-six .mini-stat strong {
    font-size: 16px;
    overflow-wrap: anywhere;
  }

  .page-toolbar .search {
    width: 100%;
    flex: 1 1 180px;
  }

  .topbar-actions .btn .btn-label {
    display: none;
  }

  .topbar-actions .btn {
    width: 40px;
    padding: 0;
  }

  .topbar-actions .btn.has-icon {
    width: auto;
    padding: 0 12px;
  }

  .detail-head {
    flex-direction: column;
    gap: 16px;
    padding: 18px;
  }

  .detail-title {
    font-size: var(--fs-18);
  }

  .detail-amount {
    width: 100%;
    padding: 14px 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    text-align: left;
  }

  .detail-amount .value {
    font-size: 28px;
  }

  .stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-cell:nth-child(2) {
    border-right: 0;
  }

  .stat-cell:nth-child(n + 3) {
    border-top: 1px solid var(--line-2);
  }

  .detail-aside {
    grid-template-columns: 1fr;
  }

  .import-side {
    grid-template-columns: 1fr;
  }

  .four-piece {
    grid-template-columns: 1fr;
  }

  .quick-grid {
    grid-template-columns: 1fr 1fr;
  }

  .topbar .page-title {
    font-size: 18px;
  }

  .card-head {
    padding: 14px 16px 10px;
  }

  .card-body {
    padding: 16px;
  }

  .table-toolbar {
    padding: 10px 16px;
  }
}

@media (max-width: 520px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .skeleton-kpis {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 220px;
    padding: 22px 20px;
  }

  .login-title {
    font-size: 27px;
  }

  .login-kicker {
    margin-bottom: 10px;
  }

  .login-panel {
    padding: 26px 18px 40px;
  }

  .login-card h2 {
    font-size: 24px;
  }

  .topbar {
    padding: 0 12px;
  }

  .content {
    padding: 14px 12px 44px;
  }

  .page-eyebrow {
    display: none;
  }

  .quick-grid {
    grid-template-columns: 1fr;
  }

  .toast-region {
    right: 12px;
    bottom: 12px;
  }

  .page-toolbar {
    gap: 6px;
  }

  .page-toolbar .select-wrap {
    width: 100%;
  }

  .flow-card {
    padding: 14px;
  }

  .flow-steps {
    margin-top: 10px;
  }

  .flow-step .flow-label {
    flex-direction: column;
    align-items: flex-start;
    gap: 1px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateX(28px);
    opacity: 0.6;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes modalIn {
  from {
    transform: translateY(8px) scale(0.985);
    opacity: 0.6;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes toastIn {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toastOut {
  to {
    transform: translateY(4px);
    opacity: 0;
  }
}

/* Boot screen */
.boot-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 100vh;
  background: var(--bg);
}

.boot-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 21px;
  font-weight: 600;
  box-shadow: 0 6px 18px -6px rgba(0, 97, 164, 0.5);
}

.boot-name {
  color: var(--muted);
  font-size: var(--fs-12);
  letter-spacing: 0.02em;
}

.drawer-body {
  display: flex;
  flex-direction: column;
}

.page-back-row {
  margin-bottom: 10px;
}

/* 操作日志 */
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2, #eef4fb);
  color: var(--primary, #0061a4);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.log-detail {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted, #5b6b7c);
}

/* 客户费用筛选 */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 14px;
}
.date-range-field {
  position: relative;
}
.date-range-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  font: inherit;
  white-space: nowrap;
}
.date-range-trigger > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.date-range-trigger .icon {
  flex: none;
  color: var(--muted-2);
}
.date-range-placeholder {
  color: var(--muted-2);
}
.date-range-time {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-2);
}
.date-range-time label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--muted-2);
  font-size: var(--fs-10);
}
.date-range-time .input {
  min-height: 32px;
  padding: 4px 8px;
  font-size: var(--fs-12);
}
.date-range-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-2);
  color: var(--muted-2);
  font-size: var(--fs-11);
}
.date-range-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
@media (max-width: 980px) {
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .filter-grid { grid-template-columns: 1fr; }
}

.cell-note {
  max-width: 320px;
  line-height: 1.45;
  color: var(--muted, #5b6b7c);
}
.cell-note-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-width: 320px;
  overflow: hidden;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.check-inline {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 40px;
  color: var(--muted, #5b6b7c);
  font-size: 13px;
  line-height: 1.45;
  white-space: normal;
}
.check-inline input { width: 24px; height: 24px; margin-top: 1px; flex: 0 0 24px; accent-color: var(--primary, #0061a4); }
.check-inline.is-block { display: flex; width: 100%; }
.check-inline.is-block > span { flex: 1 1 auto; min-width: 0; }
.op-type-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.op-type-picker .check-inline {
  align-items: center;
  min-height: 24px;
  gap: 5px;
  font-size: var(--fs-12);
  white-space: nowrap;
}
.op-type-picker .check-inline input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin-top: 0;
}

/* 客户费用 · 费目选择器（避免原生 select 长列表在页面内被裁剪） */
.combo {
  position: relative;
  min-width: 0;
}
.combo-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}
.combo-trigger > .icon {
  flex: none;
  color: var(--muted-2);
}
.combo-panel {
  position: absolute;
  z-index: 90;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
}
.combo-panel .search {
  margin-bottom: 8px;
}
.combo-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 260px;
  overflow-y: auto;
}
.combo-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 34px;
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.combo-option:hover,
.combo-option:focus-visible {
  background: var(--surface-low);
}
.combo-option span {
  color: var(--muted-2);
  font-size: 11px;
}
.cfe-fee-combo {
  max-width: 620px;
}


@media (max-width: 520px) {
  .mini-stats.is-four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==== 导入报告 / 待计费 / 主数据分组（v2 界面清单） ==== */
.report-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 14px;
}
.report-title {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-2, #45536b);
  margin-bottom: 8px;
}
.report-bar {
  display: grid;
  grid-template-columns: minmax(72px, 132px) 1fr 48px;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 12px;
}
.report-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}
.report-bar-track {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-low, #eef2f9);
  overflow: hidden;
}
.report-bar-track i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--primary, #0061a4);
}
.report-bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted-2, #6b7793);
}
.tab-divider {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: #cfd6e4;
  flex: 0 0 auto;
}
@media (max-width: 720px) {
  .report-cols {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 对账单明细：勾选与表脚 */
.line-check,
#statement-select-all {
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.table-foot-note > span:last-child {
  white-space: nowrap;
}

@media (max-width: 640px) {
  .table-foot-note {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .table-foot-note > span:last-child {
    white-space: normal;
  }
}

/* 按价目表计费：业务记录多选表格，紧凑行高，保证小窗口也能多选 */
#auto-records td {
  padding-top: 4px;
  padding-bottom: 4px;
}
#auto-records .cell-main {
  font-size: 12px;
  line-height: 1.3;
}
#auto-records .cell-sub {
  font-size: 10px;
  line-height: 1.3;
}


/* 客户详情抽屉：付款抬头列表 */
.ct-head {
  margin: 4px 0 2px;
  padding-top: 4px;
}
.ct-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--text);
}
.ct-head .card-sub { margin-top: 2px; }
.ct-list {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.ct-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-2);
}
.ct-item:last-child { border-bottom: 0; }
.ct-main { min-width: 0; }
.ct-name {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-weight: 600;
  color: var(--text);
  font-size: var(--fs-12);
}
.ct-main .cell-sub {
  white-space: normal;
  word-break: break-all;
}
.ct-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
@media (max-width: 640px) {
  .ct-item { grid-template-columns: minmax(0, 1fr); }
  .ct-actions { justify-content: flex-start; }
}

/* 发票 · 客户 / 供应商切换与开票概览 */
.invoice-hero {
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background:
    radial-gradient(110% 180% at 100% 0%, rgba(0, 97, 164, 0.07), transparent 58%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.invoice-hero-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.invoice-party-switch {
  padding: 4px;
  border-radius: 12px;
}

.invoice-party-switch button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 14px;
  font-size: var(--fs-12);
  font-weight: 500;
}

.invoice-party-switch button .icon {
  width: 16px;
  height: 16px;
  opacity: 0.72;
}

.invoice-party-switch button.is-active .icon {
  opacity: 1;
}

.invoice-metrics {
  display: flex;
  align-items: flex-start;
  gap: 32px;
  margin-left: auto;
}

.invoice-metric {
  min-width: 132px;
}

.invoice-metric-label {
  color: var(--muted);
  font-size: var(--fs-10);
  font-weight: 500;
}

.invoice-metric-value {
  margin-top: 3px;
  color: var(--warning);
  font-size: var(--fs-21);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.invoice-metric.is-issued .invoice-metric-value {
  color: var(--teal);
}

.invoice-metric-value .money {
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.invoice-metric-meta {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: var(--fs-10);
}

@media (max-width: 900px) {
  .invoice-hero {
    padding: 14px;
  }

  .invoice-metrics {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    gap: 12px;
  }

  .invoice-metric {
    min-width: 0;
  }
}

@media (max-width: 560px) {
  .invoice-party-switch {
    width: 100%;
  }

  .invoice-party-switch button {
    flex: 1;
    justify-content: center;
    padding: 0 8px;
  }

  .invoice-metric-value {
    font-size: var(--fs-18);
  }
}

/* 主数据：页签横向滚动；客户名链接的可点击高度 */
.card-tabs {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.data-table a.cell-main.link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 0;
}

/* 出账单：左侧勾选应收，右侧金额 / 抵扣 */
.bill-builder {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.bill-builder-side {
  position: sticky;
  top: calc(var(--topbar-h) + 16px);
}

.bill-summary-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  color: var(--muted);
  font-size: var(--fs-13);
}

.bill-summary-row strong {
  color: var(--ink);
  font-size: var(--fs-16);
}

.bill-summary-row.is-total {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line-strong, var(--line));
  border-bottom: 0;
  color: var(--ink);
  font-weight: 600;
}

.bill-summary-row.is-total strong {
  font-size: 24px;
}

.bill-summary-row .is-deduct {
  color: var(--teal, var(--primary));
}

.bill-summary-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  justify-content: space-between;
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: var(--fs-12);
}

.bill-deduct-list {
  max-height: 360px;
  overflow-y: auto;
}

.bill-deduct-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.bill-deduct-item:last-child {
  border-bottom: 0;
}

.bill-deduct-item input {
  flex: 0 0 auto;
}

.bill-deduct-main {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.bill-deduct-main .cell-sub {
  white-space: normal;
}

.bill-deduct-item strong {
  flex: 0 0 auto;
  font-size: var(--fs-13);
}

#bb-charge-all {
  width: 24px;
  height: 24px;
  accent-color: var(--primary);
}

@media (max-width: 1020px) {
  .bill-builder {
    grid-template-columns: 1fr;
  }

  .bill-builder-side {
    position: static;
  }
}

/* 财务流水 */
.finance-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.ledger-balance-list {
  padding-top: 4px;
  max-height: 480px;
  overflow-y: auto;
}

.ledger-balance-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.ledger-balance-row:last-child {
  border-bottom: 0;
}

.ledger-balance-row:hover,
.ledger-balance-row.is-active {
  background: var(--surface-2);
}

.ledger-balance-row span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.ledger-balance-row small {
  color: var(--muted);
  font-size: var(--fs-12);
}

.ledger-balance-row > strong {
  flex: 0 0 auto;
  font-size: var(--fs-13);
}

@media (max-width: 980px) {
  .finance-grid {
    grid-template-columns: 1fr;
  }
}

/* 客户发票 · 按客户待开票统计 */
.pending-customer-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 12px;
}

.pending-customer-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(80px, 2fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  border-bottom: 1px solid var(--line-2);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.pending-customer-row:last-child {
  border-bottom: 0;
}

.pending-customer-row:hover {
  background: var(--surface-2);
}

.pending-customer-row.is-active {
  background: var(--primary-soft);
}

.pending-customer-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pending-customer-main strong {
  overflow: hidden;
  font-size: var(--fs-13);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-customer-main small {
  color: var(--muted);
  font-size: var(--fs-11);
}

.pending-customer-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.pending-customer-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.pending-customer-amount {
  font-variant-numeric: tabular-nums;
  font-size: var(--fs-13);
  font-weight: 600;
  white-space: nowrap;
}

.pending-customer-empty {
  padding: 16px 10px;
  color: var(--muted);
  font-size: var(--fs-12);
}

@media (max-width: 640px) {
  .pending-customer-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 10px;
  }

  .pending-customer-track {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* 客户账单：待出账 / 已出账切换 */
.flow-tabs {
  margin-bottom: 16px;
}


/* 待计费：窄屏下标题与两个操作按钮分两行，避免标题被挤断 */
@media (max-width: 640px) {
  .pricing-card-head {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .pricing-card-head .card-title {
    white-space: nowrap;
  }

  .pricing-card-head .card-head-actions {
    width: 100%;
  }

  .pricing-card-head .card-head-actions .btn {
    flex: 1;
  }
}

/* 客户下拉框：下拉本身可输入搜索 */
.select-wrap.is-combo {
  min-width: 0;
}

.combo-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.combo-trigger .combo-value {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combo-trigger[aria-expanded="true"] {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 97, 164, 0.13);
}

.combo-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.combo-pop {
  position: absolute;
  z-index: 120;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  min-width: 230px;
  max-width: 320px;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(16, 40, 70, 0.16);
}

.combo-pop[hidden] {
  display: none;
}

.combo-search {
  height: 34px;
  min-height: 34px;
  margin-bottom: 6px;
  font-size: var(--fs-12);
}

.combo-options {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.combo-option {
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-size: var(--fs-12);
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
}

.combo-option:hover,
.combo-option.is-active {
  background: var(--surface-2);
}

.combo-option.is-selected {
  color: var(--primary);
  font-weight: 600;
}

.combo-empty {
  padding: 10px;
  color: var(--muted-2);
  font-size: var(--fs-12);
  text-align: center;
}

@media (max-width: 760px) {
  .combo-pop {
    min-width: min(260px, calc(100vw - 40px));
    max-width: calc(100vw - 40px);
  }
}

/* ==========================================================================
   日期选择器（Element 风格日历面板）
   ========================================================================== */

.date-picker {
  position: relative;
  display: block;
  min-width: 0;
}

.date-picker > .date-picker-icon {
  position: absolute;
  top: 50%;
  left: 11px;
  z-index: 1;
  display: grid;
  width: 16px;
  height: 16px;
  color: var(--muted-2);
  pointer-events: none;
  transform: translateY(-50%);
}

.date-picker > .date-picker-icon .icon {
  width: 16px;
  height: 16px;
}

.date-picker > .date-picker-input {
  padding-right: 38px;
  padding-left: 35px;
  font-variant-numeric: tabular-nums;
  cursor: text;
}

.date-picker.is-disabled > .date-picker-input {
  cursor: not-allowed;
}

.date-picker.is-disabled > .date-picker-icon {
  opacity: 0.55;
}

.date-picker-clear {
  position: absolute;
  top: 50%;
  right: 5px;
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--muted-2);
  background: transparent;
  border: 0;
  border-radius: 50%;
  opacity: 0;
  place-items: center;
  pointer-events: none;
  transform: translateY(-50%);
  transition: color 0.14s var(--ease), background-color 0.14s var(--ease),
    opacity 0.14s var(--ease);
}

.date-picker.has-value > .date-picker-clear {
  opacity: 1;
  pointer-events: auto;
}

.date-picker-clear:hover {
  color: var(--ink);
  background: var(--surface-low);
}

.date-picker-clear:focus-visible {
  outline: 2px solid var(--primary-line);
  outline-offset: 1px;
}

.date-picker-clear .icon {
  width: 14px;
  height: 14px;
}

.date-picker-error {
  display: block;
  margin-top: 4px;
  color: var(--danger);
  font-size: var(--fs-10);
  line-height: 1.45;
}

.date-panel:focus {
  outline: none;
}

.date-panel {
  position: fixed;
  z-index: 115;
  display: flex;
  width: 396px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 48px -18px rgba(16, 40, 70, 0.3), 0 4px 14px rgba(16, 40, 70, 0.08);
  animation: datePanelIn 0.16s var(--ease);
}

.date-panel.is-above {
  transform-origin: bottom center;
}

.date-panel-shortcuts {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 2px;
  width: 88px;
  padding: 10px 8px;
  background: var(--surface-2);
  border-right: 1px solid var(--line-2);
}

.date-shortcut {
  height: 32px;
  padding: 0 8px;
  color: var(--muted);
  font-size: var(--fs-10);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 6px;
  transition: color 0.14s var(--ease), background-color 0.14s var(--ease);
}

.date-shortcut:hover {
  color: var(--primary);
  background: var(--primary-soft-2);
}

.date-shortcut:focus-visible {
  outline: 2px solid var(--primary-line);
  outline-offset: 1px;
}

.date-shortcut.is-clear {
  height: 34px;
  margin-top: auto;
  padding-top: 2px;
  color: var(--muted-2);
  border-top: 1px solid var(--line);
  border-radius: 0 0 6px 6px;
}

.date-shortcut.is-clear:hover {
  color: var(--danger);
  background: var(--danger-surface);
}

.date-panel-main {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
}

.date-panel-head {
  display: flex;
  align-items: center;
  gap: 1px;
  height: 30px;
}

.date-nav {
  display: grid;
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  place-items: center;
  transition: color 0.14s var(--ease), background-color 0.14s var(--ease);
}

.date-nav:hover {
  color: var(--ink);
  background: var(--surface-low);
}

.date-nav:focus-visible {
  outline: 2px solid var(--primary-line);
  outline-offset: 1px;
}

.date-nav .icon {
  width: 15px;
  height: 15px;
}

.date-panel-title {
  flex: 1;
  min-width: 0;
  height: 28px;
  padding: 0 4px;
  color: var(--ink);
  font-size: var(--fs-12);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  background: transparent;
  border: 0;
  border-radius: 6px;
  transition: color 0.14s var(--ease), background-color 0.14s var(--ease);
}

.date-panel-title:hover {
  color: var(--primary);
  background: var(--primary-soft-2);
}

.date-panel-title:focus-visible {
  outline: 2px solid var(--primary-line);
  outline-offset: 1px;
}

.date-panel-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 5px 0 3px;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
}

.date-panel-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.date-day {
  position: relative;
  display: grid;
  height: 32px;
  padding: 0;
  color: var(--ink);
  font-size: var(--fs-10);
  font-variant-numeric: tabular-nums;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  place-items: center;
  transition: color 0.14s var(--ease), background-color 0.14s var(--ease),
    box-shadow 0.14s var(--ease);
}

.date-day:hover {
  color: var(--primary);
  background: var(--primary-soft-2);
}

.date-day:focus-visible {
  outline: 2px solid var(--primary-line);
  outline-offset: -2px;
}

.date-day.is-outside {
  color: var(--muted-2);
  opacity: 0.48;
}

.date-day.is-today {
  color: var(--primary);
  font-weight: 600;
}

.date-day.is-today::after {
  position: absolute;
  bottom: 4px;
  width: 3px;
  height: 3px;
  background: currentColor;
  border-radius: 50%;
  content: "";
}

.date-day.is-focus {
  box-shadow: inset 0 0 0 2px var(--primary-line);
}

.date-day.is-selected,
.date-day.is-selected:hover {
  color: var(--on-primary);
  font-weight: 600;
  background: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 97, 164, 0.26);
  opacity: 1;
}

.date-day.is-selected.is-focus {
  box-shadow: inset 0 0 0 2px var(--on-primary), 0 1px 2px rgba(0, 97, 164, 0.26);
}

.date-day.is-selected.is-today::after {
  background: var(--on-primary);
}

.date-panel-grid.is-months {
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding-top: 7px;
}

.date-month {
  height: 44px;
  padding: 0;
  color: var(--ink);
  font-size: var(--fs-10);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.14s var(--ease), background-color 0.14s var(--ease);
}

.date-month:hover {
  color: var(--primary);
  background: var(--primary-soft-2);
}

.date-month:focus-visible {
  outline: 2px solid var(--primary-line);
  outline-offset: 1px;
}

.date-month.is-current {
  color: var(--primary);
  font-weight: 600;
}

.date-month.is-selected,
.date-month.is-selected:hover {
  color: var(--on-primary);
  font-weight: 600;
  background: var(--primary);
}

.date-panel.is-month-view .date-panel-weekdays,
.date-panel.is-month-view [data-date-nav="prev-month"],
.date-panel.is-month-view [data-date-nav="next-month"] {
  display: none;
}

.date-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-2);
}

.date-panel-today {
  color: var(--muted-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.date-panel-today-btn {
  padding: 3px 4px;
  color: var(--primary);
  font-size: var(--fs-10);
  background: transparent;
  border: 0;
  border-radius: 4px;
}

.date-panel-today-btn:hover {
  background: var(--primary-soft-2);
}

.date-range-panel .date-panel-title.is-static {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.date-range-panel .date-panel-title.is-static:hover {
  color: var(--ink);
  background: transparent;
}

.date-range-panel .date-range-foot {
  flex-wrap: wrap;
}

.date-range-panel .date-range-hint {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}

.date-range-panel .date-range-actions {
  margin-left: auto;
}

.date-day.is-in-range,
.date-day.is-in-range:hover {
  color: var(--primary);
  background: var(--primary-soft-2);
  border-radius: 0;
}

.date-day.is-start,
.date-day.is-end,
.date-day.is-start:hover,
.date-day.is-end:hover {
  color: var(--on-primary);
  font-weight: 600;
  background: var(--primary);
  opacity: 1;
}

.date-day.is-start {
  border-radius: 7px 0 0 7px;
}

.date-day.is-end {
  border-radius: 0 7px 7px 0;
}

.date-day.is-start.is-end {
  border-radius: 7px;
}

.date-day.is-start.is-today::after,
.date-day.is-end.is-today::after {
  background: var(--on-primary);
}

.date-day.is-focus {
  box-shadow: none;
}

.date-panel:focus .date-day.is-focus {
  box-shadow: inset 0 0 0 2px var(--primary-line);
}

.date-panel:focus .date-day.is-selected.is-focus,
.date-panel:focus .date-day.is-start.is-focus,
.date-panel:focus .date-day.is-end.is-focus {
  box-shadow: inset 0 0 0 2px var(--on-primary), 0 1px 2px rgba(0, 97, 164, 0.26);
}

@keyframes datePanelIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 520px) {
  .date-panel {
    width: calc(100vw - 16px);
  }

  .date-panel-shortcuts {
    width: 76px;
    padding: 8px 6px;
  }

  .date-panel-main {
    padding: 8px;
  }

  .date-shortcut {
    height: 30px;
    padding: 0 6px;
    font-size: 11px;
  }

  .date-shortcut.is-clear {
    height: 32px;
  }

  .date-nav {
    width: 24px;
  }

  .date-day {
    height: 30px;
    font-size: 11px;
  }

  .date-panel-title {
    font-size: 12px;
  }
}


@media (max-width: 620px) {
  .date-panel.is-sheet {
    top: auto !important;
    right: 12px !important;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    left: 12px !important;
    width: auto !important;
    max-width: none;
    max-height: 76vh;
    border-radius: 14px;
  }

  .date-panel.is-sheet .date-panel-shortcuts {
    width: 78px;
  }

  .date-panel.is-sheet .date-panel-main {
    padding: 8px;
  }

  .date-panel.is-sheet .date-range-foot {
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .date-panel {
    animation: none;
  }
}

@media (max-width: 640px) {
  .data-table.pricing-customers-table {
    min-width: 0;
  }
}
