/* 视觉规范参照 Mantine：配色、圆角、字号、组件样式。进度条动效参照 Ant Design。 */
:root {
  color-scheme: light;
  --white: #fff;
  --gray-0: #f8f9fa;
  --gray-1: #f1f3f5;
  --gray-2: #e9ecef;
  --gray-3: #dee2e6;
  --gray-4: #ced4da;
  --gray-5: #adb5bd;
  --gray-6: #868e96;
  --gray-7: #495057;
  --gray-8: #343a40;
  --gray-9: #212529;
  --blue-0: #e7f5ff;
  --blue-1: #d0ebff;
  --blue-2: #a5d8ff;
  --blue-6: #228be6;
  --blue-7: #1c7ed6;
  --blue-8: #1971c2;
  --red-0: #fff5f5;
  --red-1: #ffe3e3;
  --red-6: #fa5252;
  --red-7: #f03e3e;
  --red-8: #e03131;
  --green-1: #d3f9d8;
  --green-6: #40c057;
  --green-8: #2f9e44;
  --yellow-0: #fff9db;
  --yellow-1: #fff3bf;
  --yellow-9: #e67700;
  --teal-1: #c3fae8;
  --teal-9: #087f5b;
  --orange-1: #ffe8cc;
  --orange-9: #d9480f;
  --violet-1: #e5dbff;
  --violet-9: #5f3dc4;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, .05), 0 1px 2px rgba(0, 0, 0, .1);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .05), rgba(0, 0, 0, .05) 0 10px 15px -5px, rgba(0, 0, 0, .04) 0 7px 7px -5px;
  --shadow-md: 0 1px 3px rgba(0, 0, 0, .05), rgba(0, 0, 0, .05) 0 20px 25px -5px, rgba(0, 0, 0, .04) 0 10px 10px -5px;
  --shadow-xl: 0 1px 3px rgba(0, 0, 0, .05), rgba(0, 0, 0, .05) 0 36px 28px -7px, rgba(0, 0, 0, .04) 0 17px 17px -7px;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-standard: cubic-bezier(.4, 0, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Roboto, sans-serif;
  --header-h: 60px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--gray-0);
  color: var(--gray-9);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
a { color: var(--blue-7); }
.muted { color: var(--gray-6); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

.icon { display: block; flex: none; }

/* ---------- 按钮 ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid var(--gray-4);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--gray-9);
  font: 600 14px/1 var(--font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color .12s var(--ease-standard), border-color .12s var(--ease-standard),
    color .12s var(--ease-standard), transform .1s var(--ease-standard), box-shadow .12s var(--ease-standard);
}
.btn:hover { background: var(--gray-0); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled, label.btn.is-disabled {
  border-color: transparent;
  background: var(--gray-1);
  color: var(--gray-5);
  cursor: not-allowed;
}
.btn-primary { border-color: transparent; background: var(--blue-6); color: var(--white); }
.btn-primary:hover { background: var(--blue-7); }
.btn-light { border-color: transparent; background: var(--blue-0); color: var(--blue-7); }
.btn-light:hover { background: var(--blue-1); }
.btn-subtle { border-color: transparent; background: transparent; color: var(--gray-7); }
.btn-subtle:hover { background: var(--gray-1); }
.btn-danger { border-color: transparent; background: var(--red-6); color: var(--white); }
.btn-danger:hover { background: var(--red-7); }
.btn-danger-light { border-color: transparent; background: var(--red-0); color: var(--red-8); }
.btn-danger-light:hover { background: var(--red-1); }
.btn-sm { min-height: 30px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
/* 处理中的按钮：转圈，文字保留位置 */
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading:disabled { background: var(--blue-1); }
.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--blue-6);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.btn-primary.is-loading:not(:disabled) { background: var(--blue-6); }
.btn-primary.is-loading:not(:disabled)::after { border-color: var(--white); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gray-6);
  cursor: pointer;
  transition: background-color .12s var(--ease-standard), color .12s var(--ease-standard), transform .1s var(--ease-standard);
}
.icon-btn:hover { background: var(--gray-1); color: var(--gray-9); }
.icon-btn:active { transform: scale(.92); }

/* ---------- 提示 ---------- */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--red-0);
  color: var(--red-8);
  animation: rise .22s var(--ease-out);
}
.notice-text { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.notice-error .icon { margin-top: 2px; }
.notice .icon-btn { margin: -3px -4px -3px 0; color: var(--red-8); }
.notice .icon-btn:hover { background: var(--red-1); color: var(--red-8); }
.login-card .notice { animation: shake .36s var(--ease-standard); }
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shake {
  20% { transform: translateX(-5px); }
  45% { transform: translateX(4px); }
  70% { transform: translateX(-2px); }
  90% { transform: translateX(1px); }
}

/* ---------- 登录 ---------- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
  background:
    radial-gradient(900px 420px at 50% -8%, var(--blue-0), transparent 70%),
    var(--gray-0);
}
.login-card {
  display: grid;
  gap: 16px;
  width: 100%;
  max-width: 400px;
  padding: 32px;
  border: 1px solid var(--gray-3);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-md);
  animation: rise .36s var(--ease-out);
}
.login-head { display: grid; justify-items: center; gap: 10px; margin-bottom: 4px; text-align: center; }
.login-head h1 { font-size: 22px; }
.login-head .muted { margin-top: -6px; font-size: 13px; }
.login-logo { display: block; width: 44px; height: 44px; }
.login-form { display: grid; gap: 14px; }
.field-label { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 500; }
.login-form .btn { margin-top: 6px; }
.brand-mark { font-weight: 700; }

/* ---------- 输入框 ---------- */
input:not([type="file"]):not([type="checkbox"]) {
  width: 100%;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--gray-4);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--gray-9);
  font: 14px/1.55 var(--font);
  transition: border-color .12s var(--ease-standard), box-shadow .12s var(--ease-standard);
}
input:not([type="file"]):not([type="checkbox"])::placeholder { color: var(--gray-5); }
input:not([type="file"]):not([type="checkbox"]):focus {
  border-color: var(--blue-6);
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 139, 230, .14);
}
input:not([type="file"]):not([type="checkbox"]):disabled { background: var(--gray-1); color: var(--gray-5); cursor: not-allowed; }

.password-field { position: relative; }
.password-field input#password { padding-right: 42px; }
.password-field input::-ms-reveal { display: none; } /* Edge 自带的小眼睛，避免出现两个 */
.password-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gray-6);
  cursor: pointer;
  transition: background-color .12s var(--ease-standard), color .12s var(--ease-standard);
}
.password-toggle:hover { background: var(--gray-1); color: var(--gray-9); }

/* 复选框 */
input[type="checkbox"] {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1px solid var(--gray-4);
  border-radius: var(--radius-sm);
  background: var(--white);
  appearance: none;
  cursor: pointer;
  transition: background-color .12s var(--ease-standard), border-color .12s var(--ease-standard), transform .1s var(--ease-standard);
}
input[type="checkbox"]:hover { border-color: var(--gray-5); }
input[type="checkbox"]:active { transform: scale(.92); }
input[type="checkbox"]:checked, input[type="checkbox"]:indeterminate { border-color: var(--blue-6); background: var(--blue-6); }
input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5.5px;
  width: 5px;
  height: 9px;
  border: solid var(--white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  animation: check-pop .16s var(--ease-out);
}
input[type="checkbox"]:indeterminate::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 4px;
  width: 8px;
  height: 2px;
  border-radius: 1px;
  background: var(--white);
}
input[type="checkbox"]:disabled { opacity: .5; cursor: not-allowed; }
@keyframes check-pop {
  from { opacity: 0; transform: rotate(45deg) scale(.5); }
  to { opacity: 1; transform: rotate(45deg) scale(1); }
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--gray-3);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 1320px;
  min-height: var(--header-h);
  margin: 0 auto;
  padding: 0 20px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { display: block; flex: none; width: 28px; height: 28px; }
.brand-text { display: grid; line-height: 1.25; }
.brand-text .brand-mark { font-size: 14px; }
.brand-name { color: var(--gray-6); font-size: 12px; white-space: nowrap; }
.topbar-user { display: flex; align-items: center; gap: 8px; margin-left: auto; color: var(--gray-7); }
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue-0);
  color: var(--blue-8);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

/* 分段导航 */
.segmented {
  position: relative;
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--gray-1);
}
.segmented-indicator {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 0;
  border-radius: var(--radius-sm);
  background: var(--white);
  box-shadow: var(--shadow-xs);
  transition: transform .24s var(--ease-out), width .24s var(--ease-out);
}
.topnav-item {
  position: relative;
  z-index: 1;
  padding: 4px 14px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--gray-7);
  font: 500 14px/1.5 var(--font);
  white-space: nowrap;
  cursor: pointer;
  transition: color .16s var(--ease-standard);
}
.topnav-item:hover { color: var(--gray-9); }
.topnav-item[aria-current="page"] { color: var(--gray-9); font-weight: 600; }

/* ---------- 页面 ---------- */
.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px;
}
.work-view, #workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.view-enter { animation: rise .24s var(--ease-out); }
.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--gray-3);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-xs);
}

/* 步骤条 */
.stepper { display: flex; align-items: center; gap: 12px; padding: 4px 2px; }
.step { display: flex; flex: none; align-items: center; gap: 10px; color: var(--gray-6); font-weight: 500; }
.step-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--gray-2);
  color: var(--gray-7);
  font-size: 13px;
  font-weight: 700;
  transition: background-color .24s var(--ease-standard), border-color .24s var(--ease-standard), color .24s var(--ease-standard);
}
.step.is-active { color: var(--gray-9); }
.step.is-active .step-icon { border-color: var(--blue-6); background: var(--white); color: var(--blue-7); }
.step.is-done { color: var(--gray-9); }
.step.is-done .step-icon { background: var(--blue-6); color: var(--white); }
.step.is-done .icon { animation: pop .22s var(--ease-out); }
.step-line { position: relative; flex: 1; min-width: 16px; height: 2px; overflow: hidden; border-radius: 1px; background: var(--gray-3); }
.step-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--blue-6);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .34s var(--ease-out);
}
.step-line.is-done::after { transform: scaleX(1); }
@keyframes pop {
  from { opacity: 0; transform: scale(.5); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- 上传 ---------- */
#upload { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.upload-head { display: grid; gap: 4px; }
.dropzone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 44px 20px;
  border: 1px dashed var(--gray-4);
  border-radius: var(--radius-md);
  background: var(--gray-0);
  text-align: center;
  transition: background-color .16s var(--ease-standard), border-color .16s var(--ease-standard), transform .2s var(--ease-out);
}
.dropzone:hover { border-color: var(--gray-5); background: var(--gray-1); }
.dropzone.is-over { border-color: var(--blue-6); background: var(--blue-0); transform: scale(1.006); }
.dropzone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: var(--shadow-xs);
  color: var(--gray-6);
  transition: color .16s var(--ease-standard), transform .24s var(--ease-out);
}
.dropzone.is-over .dropzone-icon { color: var(--blue-6); transform: translateY(-4px); }
.dropzone-title { font-size: 16px; font-weight: 600; }
.dropzone-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 10px; }

/* 确认要上传的文件 */
.stage { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.stage.stage-enter { animation: rise .24s var(--ease-out); }
.stage.is-over { border-radius: var(--radius-sm); outline: 2px dashed var(--blue-6); outline-offset: 4px; }
.stage-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.stage-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.stage-list {
  max-height: 340px;
  margin: 0;
  padding: 0;
  overflow: auto;
  border: 1px solid var(--gray-3);
  border-radius: var(--radius-sm);
  list-style: none;
}
.stage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 8px 6px 12px;
  border-bottom: 1px solid var(--gray-2);
  transition: background-color .12s var(--ease-standard), opacity .15s var(--ease-standard), transform .15s var(--ease-standard);
}
.stage-row:last-child { border-bottom: 0; }
.stage-row:hover { background: var(--gray-0); }
.stage-row.is-removing { opacity: 0; transform: translateX(10px); }
.stage-row.has-problem { background: var(--red-0); }
.stage-row.is-skipped .stage-name { color: var(--gray-6); }
.stage-row > .icon { color: var(--gray-5); }
.stage-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.stage-note { display: block; color: var(--red-8); font-size: 12px; }
.stage-row.is-skipped .stage-note { color: var(--gray-6); }
.stage-size { flex: none; color: var(--gray-6); font-size: 12px; font-variant-numeric: tabular-nums; }
.stage-kind { flex: none; }
.stage-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.stage-more { margin-right: auto; color: var(--gray-6); font-size: 13px; }
.stage-more label { color: var(--blue-7); cursor: pointer; }
.stage-more label:hover { text-decoration: underline; }
.stage-error { padding: 10px 12px; }

/* ---------- 进度条：样式和动效参照 Ant Design 的 Progress ---------- */
.progress-panel {
  display: grid;
  gap: 8px;
  padding: 16px 20px;
  border: 1px solid var(--gray-3);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-xs);
  animation: rise .2s var(--ease-out);
}
.progress-label { min-height: 22px; font-weight: 500; overflow-wrap: anywhere; }
.progress { display: flex; align-items: center; gap: 10px; }
.progress-outer { flex: 1; min-width: 0; }
.progress-inner {
  position: relative;
  overflow: hidden;
  height: 8px;
  border-radius: 100px;
  background: var(--gray-2);
}
.progress-bar {
  position: relative;
  overflow: hidden;
  width: 0;
  height: 100%;
  border-radius: 100px;
  background: var(--blue-6);
  transition: width .3s cubic-bezier(.78, .14, .15, .86), background-color .3s;
}
.progress.is-active .progress-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 100px;
  background: var(--white);
  opacity: 0;
  animation: progress-active 2.4s cubic-bezier(.23, 1, .32, 1) infinite;
}
@keyframes progress-active {
  0% { transform: translateX(-100%) scaleX(0); opacity: .1; }
  20% { transform: translateX(-100%) scaleX(0); opacity: .5; }
  100% { transform: translateX(0) scaleX(1); opacity: 0; }
}
.progress-text {
  flex: none;
  min-width: 44px;
  color: var(--gray-8);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}
.progress.is-success .progress-bar { background: var(--green-6); }
.progress.is-success .progress-text { color: var(--green-8); }

/* ---------- 操作栏和统计 ---------- */
.actionbar {
  position: sticky;
  top: calc(var(--header-h) + 1px);
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin: -6px -20px 0;
  padding: 10px 20px;
  background: rgba(248, 249, 250, .9);
  backdrop-filter: saturate(180%) blur(8px);
}
.actionbar-side { display: flex; flex-wrap: wrap; gap: 8px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.metric {
  padding: 16px 18px;
  border: 1px solid var(--gray-3);
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-xs);
  transition: box-shadow .16s var(--ease-standard), transform .16s var(--ease-standard);
}
.metric:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.metric-title { color: var(--gray-6); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.metric-value { margin-top: 4px; font-size: 26px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metric-value small { margin-left: 4px; color: var(--gray-6); font-size: 13px; font-weight: 500; }
.metric-sub { margin-top: 4px; color: var(--gray-6); font-size: 13px; font-variant-numeric: tabular-nums; }
.metric-danger .metric-value { color: var(--red-8); }

/* ---------- 下载 ---------- */
.downloads { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; border-color: var(--blue-2); animation: rise .24s var(--ease-out); }
.downloads-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.download-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.download-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--gray-3);
  border-radius: var(--radius-sm);
  color: var(--gray-9);
  text-decoration: none;
  transition: border-color .12s var(--ease-standard), background-color .12s var(--ease-standard), transform .1s var(--ease-standard);
}
.download-list a:hover { border-color: var(--blue-6); background: var(--blue-0); }
.download-list a:active { transform: translateY(1px); }
.download-list .icon { color: var(--blue-6); }
.download-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.download-list small { flex: none; color: var(--gray-6); }

/* ---------- 参数 ---------- */
.controls { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; }
.field-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; min-width: 0; }
.field { display: grid; gap: 4px; }
.field label { font-size: 14px; font-weight: 500; }
.field-note { padding-bottom: 8px; font-size: 13px; }
.affix { position: relative; width: 180px; }
.affix span {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  border-right: 1px solid var(--gray-3);
  border-radius: 3px 0 0 3px;
  background: var(--gray-1);
  color: var(--gray-7);
  font-size: 13px;
  font-weight: 600;
}
.affix input#uk-middle, .affix input#eu-middle { padding-left: 46px; }
.controls-side { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.sources summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  color: var(--gray-7);
  list-style: none;
  cursor: pointer;
}
.sources summary::-webkit-details-marker { display: none; }
.sources summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border: solid var(--gray-6);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg);
  transition: transform .16s var(--ease-standard);
}
.sources[open] summary::before { transform: rotate(45deg); }
.sources-list { display: grid; gap: 2px; max-width: 760px; margin-top: 6px; color: var(--gray-7); font-size: 13px; overflow-wrap: anywhere; animation: rise .16s var(--ease-out); }

/* ---------- 页签 ---------- */
.results { padding: 0; }
.tabs { position: relative; display: flex; overflow-x: auto; border-bottom: 1px solid var(--gray-3); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: 0;
  background: none;
  color: var(--gray-7);
  font: 500 14px/1.4 var(--font);
  cursor: pointer;
  transition: background-color .12s var(--ease-standard), color .12s var(--ease-standard);
}
.tab:hover { background: var(--gray-0); color: var(--gray-9); }
.tab[aria-selected="true"] { color: var(--gray-9); font-weight: 600; }
.tab:focus-visible { outline-offset: -2px; }
.tabs-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--blue-6);
  transition: transform .24s var(--ease-out), width .24s var(--ease-out);
}
.count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 100px;
  background: var(--gray-1);
  color: var(--gray-7);
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.count-danger { background: var(--red-1); color: var(--red-8); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-2);
  background: var(--white);
}
.tab-enter { animation: rise .2s var(--ease-out); }

.empty { display: grid; justify-items: center; gap: 8px; padding: 48px 20px; color: var(--gray-6); text-align: center; }
.empty .icon { color: var(--gray-4); }

/* ---------- 表格 ---------- */
.table-wrap { max-height: 68vh; overflow: auto; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
th, td { padding: 9px 14px; border-bottom: 1px solid var(--gray-2); text-align: left; vertical-align: top; }
th {
  position: sticky;
  top: 0;
  z-index: 1;
  border-bottom-color: var(--gray-3);
  background: var(--white);
  color: var(--gray-9);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: 0; }
tbody td { transition: background-color .1s var(--ease-standard); }
tbody tr:hover td { background: var(--gray-0); }
tbody tr.is-selected td { background: var(--blue-0); }
.tab-enter tbody tr { animation: row-in .22s var(--ease-out) backwards; animation-delay: var(--row-delay, 0ms); }
@keyframes row-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
tr.is-leaving td { opacity: 0; transition: opacity .16s var(--ease-standard); }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.wide { min-width: 220px; overflow-wrap: anywhere; }
.row-error td, .row-error:hover td { background: var(--red-0) !important; }

/* 徽标 */
.chip {
  display: inline-block;
  padding: 0 8px;
  border-radius: 100px;
  background: var(--gray-1);
  color: var(--gray-7);
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  white-space: nowrap;
}
.chip-单证报关 { background: var(--yellow-1); color: var(--yellow-9); }
.chip-合并清关 { background: var(--teal-1); color: var(--teal-9); }
.chip-隐藏 { background: var(--orange-1); color: var(--orange-9); }
.chip-备选 { background: var(--violet-1); color: var(--violet-9); }
.chip-未分单, .chip-错误 { background: var(--red-1); color: var(--red-8); }
.chip-提醒 { background: var(--yellow-0); color: var(--yellow-9); }
.chip-每日数据 { background: var(--blue-1); color: var(--blue-8); }
.chip-英卡 { background: var(--teal-1); color: var(--teal-9); }
.chip-欧卡 { background: var(--violet-1); color: var(--violet-9); }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- 历史记录 ---------- */
.records-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.records-table { margin: 10px -20px -20px; }
.records-table .table-wrap { max-height: none; }
.record-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.record-files { display: grid; gap: 2px; }
.record-files a { color: var(--blue-7); text-decoration: none; overflow-wrap: anywhere; }
.record-files a:hover { text-decoration: underline; }
.record-name { font-weight: 600; }
.record-location { display: block; margin-top: 2px; color: var(--gray-6); font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
.days-low { color: var(--red-8); font-weight: 600; }

/* 骨架屏 */
.skeleton-list { display: grid; gap: 12px; margin-top: 14px; }
.skeleton {
  height: 14px;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--gray-2) 25%, var(--gray-1) 37%, var(--gray-2) 63%);
  background-size: 400% 100%;
  animation: skeleton 1.2s ease infinite;
}
.skeleton:nth-child(2) { width: 86%; }
.skeleton:nth-child(3) { width: 64%; }
@keyframes skeleton {
  from { background-position: 100% 50%; }
  to { background-position: 0 50%; }
}

/* ---------- 右下角通知 ---------- */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  display: flex;
  gap: 12px;
  width: min(440px, calc(100vw - 32px));
  overflow: hidden;
  padding: 14px 12px 16px 14px;
  border-radius: var(--radius-md);
  background: var(--white);
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(0, 0, 0, .04);
  animation: toast-in .3s var(--ease-out);
}
.toast.is-leaving { animation: toast-out .18s var(--ease-standard) forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(28px) scale(.98); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateX(20px); }
}
.toast-icon {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-6);
  color: var(--white);
}
.toast-body { flex: 1; min-width: 0; }
.toast-title { font-weight: 600; }
.toast-location { margin-top: 2px; color: var(--gray-7); font-size: 13px; overflow-wrap: anywhere; }
.toast-note { margin-top: 2px; color: var(--gray-6); font-size: 12px; }
/* 倒计时条，走完正好 5 秒 */
.toast-timer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--green-6);
  transform-origin: left;
}
.toast.is-running .toast-timer { animation: toast-timer 5s linear forwards; }
@keyframes toast-timer { to { transform: scaleX(0); } }

/* ---------- 弹窗 ---------- */
.dialog {
  width: min(500px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  color: var(--gray-9);
}
.dialog[open] { animation: dialog-in .22s var(--ease-out); }
.dialog::backdrop { background: rgba(0, 0, 0, .55); animation: fade-in .18s var(--ease-standard); }
.dialog.is-closing { animation: dialog-out .14s var(--ease-standard) forwards; }
.dialog.is-closing::backdrop { animation: fade-out .14s var(--ease-standard) forwards; }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(-10px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dialog-out {
  to { opacity: 0; transform: translateY(-6px) scale(.98); }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { to { opacity: 0; } }
.dialog form, .dialog-inner { display: grid; gap: 14px; padding: 20px; }
.dialog-message { color: var(--gray-7); overflow-wrap: anywhere; }
.params-fields { display: grid; gap: 10px; }
.param-row { display: grid; grid-template-columns: 1fr 110px; align-items: center; gap: 12px; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 2px; }
.dialog-actions .btn-subtle { margin-right: auto; }

@media (max-width: 760px) {
  .topbar { position: static; }
  .topbar-inner { flex-wrap: wrap; gap: 8px; min-height: 0; padding: 8px 16px; }
  .brand-name { display: none; }
  .topnav { order: 3; width: 100%; }
  .segmented { display: flex; }
  .topnav-item { flex: 1; padding: 4px 6px; }
  .actionbar { position: static; margin: 0; padding: 0; background: none; backdrop-filter: none; }
  .actionbar h1 { width: 100%; }
  .actionbar-side { flex: 1; }
  .actionbar-side .btn { flex: 1; padding: 0 8px; }
  .page { padding: 16px; }
  .panel { padding: 16px; }
  .results { padding: 0; }
  .toolbar { padding: 10px 16px; }
  .records-table { margin: 10px -16px -16px; }
  .toast { right: 16px; bottom: 16px; }
  .param-row { grid-template-columns: 1fr 90px; }
  .login-card { padding: 24px; }
  .dialog-actions .btn-subtle { margin-right: 0; }
  .step-label { display: none; }
  .step.is-active .step-label { display: inline; }
  .stage-size { display: none; }
  .stage-actions .btn { flex: 1; }
  .stage-more { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .toast.is-running .toast-timer { animation: none; }
}
