/* =========================================================================
   晨曦金拓供应链系统 · 设计系统
   品牌色取自 LOGO：蓝 #2B7DBE / 橙 #F2833A
   ========================================================================= */

:root {
  color-scheme: light;

  --brand-50: #eff7fe;
  --brand-100: #d9ecfb;
  --brand-200: #b3d8f6;
  --brand-400: #4b95d1;
  --brand-500: #2b7dbe;
  --brand-600: #23689f;
  --brand-700: #1b517d;

  --accent-500: #f2833a;
  --accent-600: #dd6f26;
  --accent-wash: #fff2e8;

  --page: #f3f5f8;
  --page-tint: #e9eef5;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eef2f7;

  --ink: #0c1622;
  --ink-2: #3b4a5c;
  --muted: #78859a;
  --muted-2: #98a3b3;

  --line: #e4e9f0;
  --line-strong: #d2dae5;

  --success: #0f9d58;
  --success-ink: #06713e;
  --success-wash: #e8f7ef;

  --warning: #d98324;
  --warning-ink: #9a5b06;
  --warning-wash: #fdf3e3;

  --critical: #d43d3d;
  --critical-ink: #ad2626;
  --critical-wash: #fdeaea;

  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 9px;

  --shadow-xs: 0 1px 2px rgba(12, 22, 34, 0.05);
  --shadow-sm: 0 1px 2px rgba(12, 22, 34, 0.04), 0 6px 16px -10px rgba(12, 22, 34, 0.18);
  --shadow-md: 0 1px 2px rgba(12, 22, 34, 0.05), 0 16px 34px -22px rgba(12, 22, 34, 0.32);
  --glow-brand: 0 10px 22px -12px rgba(43, 125, 190, 0.55);

  --sidebar-1: #0a1524;
  --sidebar-2: #0f2035;
  --sidebar-ink: #dbe4f0;
  --sidebar-muted: #8fa0b8;
  --glass: rgba(255, 255, 255, 0.74);

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI",
    "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  color-scheme: dark;

  --page: #070c14;
  --page-tint: #0a1119;
  --surface: #0f1823;
  --surface-2: #0c141d;
  --surface-3: #16212e;

  --ink: #e8eef6;
  --ink-2: #b7c4d4;
  --muted: #7f8da2;
  --muted-2: #66748a;

  --line: #1d2939;
  --line-strong: #2a384b;

  --brand-50: #10243a;
  --brand-100: #12324e;
  --brand-200: #17456b;
  --brand-400: #59a3dd;
  --brand-500: #4b9ad4;
  --brand-600: #3a82b8;
  --brand-700: #2f6c99;

  --accent-wash: #2a1a0f;

  --success: #35b877;
  --success-ink: #7ee0a8;
  --success-wash: #0f2a1e;

  --warning: #e69a3c;
  --warning-ink: #f3c07a;
  --warning-wash: #2b2011;

  --critical: #ec5f5f;
  --critical-ink: #f7a3a3;
  --critical-wash: #2c1414;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 20px -14px rgba(0, 0, 0, 0.8);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.4), 0 20px 40px -26px rgba(0, 0, 0, 0.9);
  --glow-brand: 0 10px 22px -12px rgba(75, 154, 212, 0.5);

  --sidebar-1: #060b12;
  --sidebar-2: #0a1421;
  --sidebar-ink: #d6e0ec;
  --sidebar-muted: #7d8da4;
  --glass: rgba(10, 17, 25, 0.76);
}

/* ---------------------------------------------------------------- 基础 */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background-color: var(--page);
  background-image:
    radial-gradient(1200px 500px at 12% -10%, rgba(43, 125, 190, 0.06), transparent 70%),
    radial-gradient(900px 420px at 92% 0%, rgba(242, 131, 58, 0.05), transparent 70%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h2 {
  font-size: 15.5px;
}

h3 {
  font-size: 15px;
}

a {
  color: var(--brand-600);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--brand-500);
}

:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--brand-200);
  color: var(--ink);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 8px 14px;
  background: var(--surface);
  border-radius: 0 0 10px 0;
}

.skip-link:focus {
  left: 0;
}

/* ---------------------------------------------------------------- 骨架 */

.app {
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  flex: 0 0 246px;
  width: 246px;
  height: 100dvh;
  padding: 18px 14px 14px;
  background: linear-gradient(180deg, var(--sidebar-1) 0%, var(--sidebar-2) 62%, var(--sidebar-1) 100%);
  color: var(--sidebar-ink);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 220px;
  background: radial-gradient(120% 100% at 20% 0%, rgba(43, 125, 190, 0.28), transparent 70%);
  pointer-events: none;
}

.sidebar::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
  pointer-events: none;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 99px;
}

.sidebar-backdrop {
  display: none;
}

.main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

/* ---------------------------------------------------------------- 品牌区 */

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 6px 18px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.brand-logo {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.45));
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(140deg, var(--accent-500), var(--brand-500));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}

.brand strong {
  display: block;
  color: #fff;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--sidebar-muted);
  font-size: 11px;
  letter-spacing: 0.06em;
}

/* ---------------------------------------------------------------- 导航 */

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 8px;
}

.nav-group {
  margin: 16px 0 6px;
  padding-left: 10px;
  color: var(--sidebar-muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-item .ico {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  opacity: 0.66;
  transition: opacity 0.16s ease, color 0.16s ease;
}

.nav-item:hover .ico,
.nav-item.active .ico {
  opacity: 1;
}

.nav-item.active .ico {
  color: #8ec6ea;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px 8px 12px;
  border-radius: 9px;
  color: var(--sidebar-ink);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(43, 125, 190, 0.34), rgba(43, 125, 190, 0.08));
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(122, 186, 232, 0.22);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 18px;
  transform: translateY(-50%);
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent-500), var(--brand-400));
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 10px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--sidebar-muted);
  font-size: 11.5px;
}

.sidebar-foot a {
  color: #9cc7ea;
  font-weight: 500;
}

.sidebar-foot a:hover {
  color: #cfe6f8;
}

/* ---------------------------------------------------------------- 顶栏 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 24px;
  background: var(--glass);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
}

.topbar h1 {
  flex: 1;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.015em;
}

.topbar-date {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 15px;
  cursor: pointer;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease, color 0.16s ease;
}

.theme-toggle:hover {
  background: var(--surface-3);
  color: var(--ink);
  transform: translateY(-1px);
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.content {
  flex: 1;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 22px 24px 48px;
}

/* ---------------------------------------------------------------- 页头 */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.page-head p {
  margin: 0;
  max-width: 74ch;
  color: var(--muted);
  font-size: 13px;
}

.page-actions,
.head-actions,
.form-actions,
.detail-actions,
.preview-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.form-actions {
  margin-top: 18px;
}

.detail-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------------- 卡片 */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: rise 0.32s ease both;
}

@keyframes rise {
  from {
    transform: translateY(6px);
  }
  to {
    transform: none;
  }
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}

/* 卡片内的直接子元素不能撑破卡片宽度（表格靠 table-wrap 横向滚动） */
.card > * {
  min-width: 0;
}

.card-head h2 {
  font-size: 14.5px;
}

.sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.card-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  padding: 18px;
}

.card-body.tight {
  padding: 0;
}

/* ---------------------------------------------------------------- 指标卡 */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  position: relative;
  padding: 15px 16px 14px;
  background:
    linear-gradient(180deg, rgba(43, 125, 190, 0.05), transparent 62%),
    var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  animation: rise 0.32s ease both;
}

.stat::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -34px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(43, 125, 190, 0.1), transparent 68%);
  pointer-events: none;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(43, 125, 190, 0.12);
}

.stat-dot.warning {
  background: var(--warning);
  box-shadow: 0 0 0 3px rgba(217, 131, 36, 0.15);
}

.stat-dot.success {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(15, 157, 88, 0.14);
}

.stat-dot.danger {
  background: var(--critical);
  box-shadow: 0 0 0 3px rgba(212, 61, 61, 0.14);
}

.stat-value {
  margin-top: 8px;
  font-size: 25px;
  font-weight: 680;
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat-foot {
  margin-top: 6px;
  color: var(--muted-2);
  font-size: 11.5px;
}

.stat-foot a {
  font-weight: 500;
}

/* ---------------------------------------------------------------- 栅格 */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid-2 > .card {
  margin-bottom: 0;
}

/* ---------------------------------------------------------------- 表格 */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius);
  scrollbar-width: thin;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tbody tr {
  transition: background 0.14s ease;
}

.table tbody tr:hover {
  background: rgba(43, 125, 190, 0.045);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table .actions {
  text-align: right;
  white-space: nowrap;
}

.table .cell-strong {
  font-weight: 600;
  color: var(--ink);
}

.table tfoot td {
  padding: 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--line-strong);
  font-weight: 600;
  color: var(--ink-2);
}

.total-row td {
  background: var(--surface-2);
}

.qty-in {
  color: var(--success);
  font-weight: 600;
}

.qty-out {
  color: var(--critical);
  font-weight: 600;
}

.nowrap {
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.text-warning {
  color: var(--warning-ink);
}

.is-inactive {
  opacity: 0.55;
}

/* ---------------------------------------------------------------- 徽标 */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid transparent;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-muted {
  background: var(--surface-3);
  color: var(--muted);
}

.badge-success {
  background: var(--success-wash);
  color: var(--success-ink);
  border-color: color-mix(in srgb, var(--success) 22%, transparent);
}

.badge-warning {
  background: var(--warning-wash);
  color: var(--warning-ink);
  border-color: color-mix(in srgb, var(--warning) 26%, transparent);
}

.badge-brand {
  background: var(--brand-50);
  color: var(--brand-600);
  border-color: color-mix(in srgb, var(--brand-500) 20%, transparent);
}

.badge.plain {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--muted);
}

/* ---------------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.16s ease, background 0.16s ease,
    border-color 0.16s ease, color 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(180deg, #3a8ccb, var(--brand-500));
  color: #fff;
  box-shadow: var(--glow-brand), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #4696d3, var(--brand-600));
  color: #fff;
  box-shadow: 0 12px 26px -12px rgba(43, 125, 190, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-2);
  box-shadow: var(--shadow-xs);
}

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--brand-400);
  color: var(--brand-600);
}

.btn-danger {
  background: linear-gradient(180deg, #e05656, var(--critical));
  color: #fff;
  box-shadow: 0 10px 22px -12px rgba(212, 61, 61, 0.6);
}

.btn-danger:hover {
  color: #fff;
  filter: brightness(1.04);
}

.btn-sm {
  height: 30px;
  padding: 0 11px;
  border-radius: 8px;
  font-size: 12.5px;
}

.btn[disabled],
.btn.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

/* ---------------------------------------------------------------- 表单 */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label {
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}

.req {
  margin-left: 2px;
  color: var(--critical);
}

input[type="text"],
input[type="date"],
input[type="number"],
input[type="password"],
input[type="search"],
select,
textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

textarea {
  min-height: 78px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3.5px rgba(43, 125, 190, 0.14);
}

input[type="file"] {
  padding: 7px 9px;
  font-size: 12.5px;
}

input[type="checkbox"],
input[type="radio"] {
  width: 15px;
  height: 15px;
  accent-color: var(--brand-500);
}

select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%2378859a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-grid .span-3 {
  grid-column: span 3;
}

.help-text,
.hint,
.file-hint {
  color: var(--muted);
  font-size: 11.5px;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-2);
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 132px;
}

.filter-field > label {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
}

.filter-field.grow {
  flex: 1;
  min-width: 200px;
}

.filter-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.form-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
}

.form-total strong {
  color: var(--ink);
  font-size: 19px;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.line-items td {
  padding: 7px 10px;
}

.line-items input,
.line-items select {
  min-height: 34px;
  font-size: 13px;
}

.line-amount {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.qty,
.price {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.qty.over {
  border-color: var(--critical);
  background: var(--critical-wash);
  color: var(--critical-ink);
}

/* ---------------------------------------------------------------- 提示条 */

.alert {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand-500);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  box-shadow: var(--shadow-xs);
}

.alert.success {
  border-left-color: var(--success);
  background: var(--success-wash);
  color: var(--success-ink);
}

.alert.danger {
  border-left-color: var(--critical);
  background: var(--critical-wash);
  color: var(--critical-ink);
}

.alert.warning {
  border-left-color: var(--warning);
  background: var(--warning-wash);
  color: var(--warning-ink);
}

.alert.info {
  border-left-color: var(--brand-500);
  background: var(--brand-50);
  color: var(--brand-700);
}

/* ---------------------------------------------------------------- 空状态 */

.empty {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 44px 20px;
  text-align: center;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
  border-radius: 14px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 18px;
}

.empty h3 {
  color: var(--ink-2);
  font-size: 14px;
}

.empty p {
  margin: 0 0 10px;
  max-width: 46ch;
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------------------------------------------------------------- 条形图 */

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.bar-row {
  display: grid;
  grid-template-columns: 132px minmax(60px, 1fr) 96px;
  align-items: center;
  gap: 12px;
}

.bar-label {
  overflow: hidden;
  color: var(--ink-2);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 9px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand-400), var(--brand-600));
  box-shadow: 0 0 12px rgba(43, 125, 190, 0.35);
  animation: grow 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes grow {
  from {
    transform: scaleX(0);
    transform-origin: left;
  }
  to {
    transform: scaleX(1);
  }
}

.bar-value {
  text-align: right;
  color: var(--ink-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- 元信息 */

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px 22px;
}

.meta-item .k {
  color: var(--muted);
  font-size: 11.5px;
}

.meta-item .v {
  margin-top: 3px;
  font-size: 13.5px;
  font-weight: 600;
}

.meta-item span {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
}

/* 徽标在 meta 区里要恢复行内显示，否则会被上面的 span 规则压成整块 */
.meta-item .badge {
  display: inline-flex;
  color: inherit;
}

.meta-item strong {
  display: block;
  margin-top: 3px;
  font-size: 13.5px;
  font-weight: 600;
}

/* ---------------------------------------------------------------- 导入 */

.import-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.import-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.import-card:hover {
  border-color: var(--brand-400);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.import-card h3 {
  font-size: 14px;
}

.import-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
}

.import-card form {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: auto;
}

.preview-actions {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------------- 分页 */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pagination a:hover {
  border-color: var(--brand-400);
  background: var(--brand-50);
  color: var(--brand-600);
}

.pagination .current {
  border-color: transparent;
  background: linear-gradient(180deg, #3a8ccb, var(--brand-500));
  color: #fff;
  font-weight: 650;
  box-shadow: var(--glow-brand);
}

.pagination .disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ---------------------------------------------------------------- 杂项 */

.full {
  grid-column: 1 / -1;
}

.grow {
  flex: 1;
}

.tight {
  padding: 0;
}

.nowrap {
  white-space: nowrap;
}

code {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
}

.steps {
  margin: 0;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 12.8px;
  line-height: 1.95;
}

.count-filter {
  max-width: 220px;
  min-height: 30px;
  height: 30px;
  font-size: 12.5px;
}

.count-items .actual,
.line-note {
  min-height: 32px;
  font-size: 12.8px;
}

.count-items .actual {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.count-row[hidden] {
  display: none;
}

.theme-option.active {
  border-color: var(--brand-500);
  background: var(--brand-100);
  color: var(--brand-700);
  box-shadow: inset 0 0 0 1px var(--brand-500);
  font-weight: 650;
}

.line-items .line-note {
  min-height: 34px;
}

.line-items th:nth-child(2),
.line-items th:nth-child(3),
.line-items th:nth-child(4) {
  text-align: right;
}

/* ---------------------------------------------------------------- 顶栏用户 */

.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 12px;
  margin-left: 2px;
  border-left: 1px solid var(--line);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent-500), var(--brand-500));
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  box-shadow: 0 4px 12px -6px rgba(43, 125, 190, 0.7);
}

.user-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}

.user-info strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.user-info small {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
}

.badge-danger {
  background: var(--critical-wash);
  color: var(--critical-ink);
  border-color: color-mix(in srgb, var(--critical) 26%, transparent);
}

/* ---------------------------------------------------------------- 角色卡片 */

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
  gap: 14px;
}

.role-card {
  padding: 14px 15px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.role-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.role-card-head strong {
  font-size: 13.5px;
  font-weight: 650;
}

.role-desc {
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.role-perms {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

/* ---------------------------------------------------------------- 矿点标签 */

.site-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.site-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  font-size: 11.5px;
  white-space: nowrap;
}

.site-chip b {
  color: var(--ink);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- 登录页 */

.auth-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  background-color: var(--page);
  background-image:
    radial-gradient(900px 520px at 12% -10%, rgba(43, 125, 190, 0.16), transparent 70%),
    radial-gradient(760px 420px at 95% 5%, rgba(242, 131, 58, 0.13), transparent 70%);
}

.auth-wrap {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 48px;
  align-items: center;
  width: 100%;
  max-width: 960px;
}

.auth-card {
  padding: 30px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-md);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.auth-brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.auth-brand strong {
  display: block;
  font-size: 16px;
  letter-spacing: 0.02em;
}

.auth-brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.08em;
}

.auth-card h1 {
  font-size: 22px;
  letter-spacing: -0.02em;
}

.auth-sub {
  margin: 6px 0 18px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-form input {
  height: 42px;
  font-size: 14px;
}

.auth-submit {
  height: 42px;
  margin-top: 4px;
  font-size: 14px;
}

.auth-demo {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px dashed var(--line-strong);
}

.auth-demo-title {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.auth-demo ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-demo li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
}

.auth-demo li span {
  min-width: 128px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11.5px;
}

.auth-demo li em {
  color: var(--muted);
  font-style: normal;
  font-size: 11.5px;
}

.auth-aside h2 {
  font-size: 20px;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.auth-aside > p {
  margin: 12px 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.auth-points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-points li {
  position: relative;
  padding-left: 20px;
  color: var(--ink-2);
  font-size: 12.8px;
}

.auth-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent-500), var(--brand-500));
}

@media (max-width: 860px) {
  .auth-wrap {
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: 420px;
  }

  .auth-aside {
    display: none;
  }

  .user-info {
    display: none;
  }

  .user-menu {
    padding-left: 8px;
  }
}

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 1180px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1000px) {
  .import-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    height: 100dvh;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(6, 12, 20, 0.5);
    backdrop-filter: blur(2px);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .menu-btn {
    display: inline-flex;
  }

  .topbar {
    padding: 10px 14px;
    gap: 9px;
  }

  .topbar h1 {
    font-size: 15.5px;
  }

  .topbar-date {
    display: none;
  }

  .content {
    padding: 16px 14px 40px;
  }

  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
  }

  .stat-value {
    font-size: 21px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .span-3 {
    grid-column: 1 / -1;
  }

  .bar-row {
    grid-template-columns: 88px minmax(50px, 1fr) 78px;
    gap: 8px;
  }

  .page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar {
    padding: 12px 14px;
  }

  .filter-field {
    min-width: 120px;
    flex: 1;
  }

  .filter-actions {
    margin-left: 0;
  }

  .card-body {
    padding: 14px;
  }

  .card-head {
    padding: 13px 14px;
  }

  .form-total,
  .pagination {
    padding-right: 14px;
    padding-left: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------------- 打印 */

@media print {
  .sidebar,
  .topbar,
  .page-actions,
  .head-actions,
  .pagination,
  .theme-toggle,
  .btn {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .card {
    box-shadow: none;
    border-color: #ddd;
    break-inside: avoid;
  }

  .content {
    padding: 0;
  }
}


/* ---------------------------------------------------------------- 货柜物流：节点标签行 */
.stage-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}
.stage-chips .badge {
  font-size: 12px;
}
