:root {
  --canvas: #eef3f7;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --ink: #172033;
  --muted: #667085;
  --line: #d5dee8;
  --line-strong: #b9c6d4;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --success: #16835d;
  --success-soft: #e7f6ef;
  --accent: #c2410c;
  --accent-dark: #9a3412;
  --accent-soft: #fff1e8;
  --warning: #b45309;
  --warning-soft: #fff4df;
  --danger: #c2413b;
  --danger-soft: #fff0ef;
  --shadow: 0 18px 55px rgba(26, 46, 68, 0.11);
  /* 右侧栏宽度：摘要卡片（累计处理等）与标题行的下载卡片共用，保证两者同宽同列 */
  --side-col: 310px;
  --font: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font);
}

/* 公开页（base.html 的默认 body 类）：内容不足一屏时把页脚压到窗口底部，
   避免备案号与版权行浮在半空；内容超过一屏时按文档流正常跟随。
   运营后台用自己的 admin-body / admin-login-page，不受这里影响。 */
.site-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-body > main {
  flex: 1 0 auto;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

i[data-lucide] {
  width: 18px;
  height: 18px;
  display: inline-block;
  flex: 0 0 auto;
}

.topbar {
  width: 100%;
  border-bottom: 1px solid rgba(185, 198, 212, 0.75);
  background: rgba(255, 255, 255, 0.96);
}

.topbar-inner {
  width: min(1240px, calc(100% - 48px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: 0;
}

.brand img {
  width: 34px;
  height: 34px;
  display: block;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
}

.topnav a {
  color: inherit;
  text-decoration: none;
}

.topnav a.active {
  color: var(--ink);
  font-weight: 650;
}

/* 界面语言选择：右上角的下拉。用 <details> 实现，没有 JavaScript 也能开合。 */
.lang-switch {
  position: relative;
}

.lang-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
}

.lang-summary::-webkit-details-marker {
  display: none;
}

.lang-summary:hover,
.lang-switch[open] > .lang-summary {
  border-color: var(--primary);
  color: var(--ink);
}

.lang-summary i[data-lucide] {
  width: 15px;
  height: 15px;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  display: grid;
  gap: 2px;
  min-width: 150px;
  max-height: min(70vh, 640px);
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(23, 32, 51, 0.14);
}

.topnav .lang-option {
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
}

.topnav .lang-option:hover {
  background: var(--primary-soft);
}

.topnav .lang-option.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 650;
}

.login-lang {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 6px;
}

.page {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 24px 0 54px;
}

.page-heading {
  margin-bottom: 24px;
}

.page-heading h1 {
  margin: 0 0 8px;
  font-size: 34px;
  line-height: 1.18;
}

.page-heading p,
.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.page-heading .page-lead {
  margin: 10px 0 0;
  max-width: 780px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

.heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.heading-row .heading-main {
  /* flex-basis 0 让标题块按剩余空间收缩：否则它的内容宽度会把右侧的卡片挤到下一行，
     标题行就变成上下两段（1280 宽放得下、1024 宽就会换行）。 */
  flex: 1 1 0;
  min-width: 0;
}

.heading-row .button {
  flex-shrink: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--side-col);
  gap: 22px;
  align-items: stretch;
}

.side-stack {
  display: grid;
  gap: 18px;
}

.tool-panel,
.side-panel,
.result-panel,
.feedback-panel,
.table-panel,
.detail-panel,
.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.tool-panel,
.table-panel {
  overflow: hidden;
}

.panel-head {
  padding: 18px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 750;
}

.panel-body {
  padding: 22px;
}

.dropzone {
  min-height: 244px;
  display: grid;
  place-items: center;
  padding: 32px;
  text-align: center;
  border: 1.5px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
}

.dropzone.dragging {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.dropzone > span {
  display: block;
}

.dropzone-icon {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 8px;
}

.dropzone-icon i {
  width: 28px;
  height: 28px;
}

.dropzone strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

.dropzone small {
  display: block;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}

.button.primary {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
}

.button.primary:hover {
  background: var(--primary-dark);
}

/* 处理失败页的「上报错误得会员奖励」：用强调色，与「重新上传」区分主次 */
.button.reward {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.button.reward:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.button.blue {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
}

.button.ghost {
  background: var(--surface-soft);
}

.button.danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #efc4c1;
}

/* 失败结果页的「去下载桌面版」：红底白字，和「重新上传」区分开。 */
.button.danger-solid {
  color: white;
  background: var(--danger);
  border-color: var(--danger);
}

.button.danger-solid:hover {
  background: #a9342f;
  border-color: #a9342f;
}

.button.wide {
  width: 100%;
}

.button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.selected-file {
  margin-top: 16px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.file-badge {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 7px;
}

.file-badge.success {
  color: var(--primary);
  background: var(--primary-soft);
}

.selected-file-main {
  min-width: 0;
  flex: 1;
}

.selected-file-main strong,
.selected-file-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file-main span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.form-grid,
.detail-panel form {
  margin-top: 18px;
}

.field + .field {
  margin-top: 14px;
}

.field label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.field .hint {
  margin-top: 8px;
}

.input-wrap {
  position: relative;
}

.input,
.textarea,
.select {
  width: 100%;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: none;
}

.input,
.select {
  height: 42px;
  padding: 0 12px;
}

.input.with-action {
  padding-right: 44px;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.input-action,
.icon-button {
  width: 31px;
  height: 31px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-decoration: none;
}

.input-action {
  position: absolute;
  top: 50%;
  right: 7px;
  border: 0;
  transform: translateY(-50%);
}

.textarea {
  min-height: 104px;
  padding: 11px 12px;
  resize: vertical;
}

#upload-form > .button {
  margin-top: 20px;
}

.turnstile-wrap {
  margin-top: 16px;
}

.status-chip,
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  flex: 0 0 auto;
}

.status-chip.success,
.badge.succeeded,
.badge.resolved {
  color: var(--success);
  background: var(--success-soft);
  border-color: #bfe7d6;
}

.status-chip.warning,
.badge.reviewing {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #efd39d;
}

.status-chip.info,
.badge.new {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #c9d9fc;
}

.side-panel {
  padding: 18px;
}

.side-panel h3 {
  margin: 0 0 14px;
  font-size: 15px;
}

/* 首页右栏的桌面端下载入口：标题 + 一个「去下载」按钮 + 本地安装包的优点 */
.download-panel .download-benefits {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 9px;
}

.download-panel .download-benefits li {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.download-panel .download-benefits i {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--success);
}

/* 桌面版下载页：三个入口按钮一排，下面放界面截图与功能卡片 */
.desktop-heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.desktop-heading-title {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.desktop-heading h1 {
  margin: 0;
}

.desktop-heading .page-lead {
  margin: 0;
}

.desktop-download-panel {
  padding: 22px;
}

.desktop-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.desktop-actions .button {
  min-height: 52px;
  font-size: 15px;
}

.button.disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button-note {
  margin-left: 2px;
  padding: 2px 6px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 650;
}

.desktop-meta {
  margin: 12px 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 6px;
  color: var(--muted);
  font-size: 12px;
}

.desktop-meta span + span::before {
  content: "·";
  margin-right: 6px;
}

.desktop-install-note {
  margin: 10px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.desktop-install-note i {
  width: 14px;
  height: 14px;
}

.desktop-license-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.desktop-legal {
  margin: 8px 0 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  color: var(--muted);
  font-size: 12px;
}

.desktop-legal a {
  color: var(--muted);
  text-decoration: none;
}

.desktop-legal a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.legal-meta {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.legal-links {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.legal-links a {
  color: var(--primary-dark);
  text-decoration: none;
}

.legal-links a + a {
  margin-left: 16px;
}

.legal-links a:hover {
  text-decoration: underline;
}

.guide-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-list li {
  padding: 4px 0 4px 12px;
  border-left: 2px solid var(--line);
  font-size: 14px;
  line-height: 1.5;
}

.guide-list a {
  color: var(--primary-dark);
  text-decoration: none;
}

.guide-list a:hover {
  text-decoration: underline;
}

.desktop-shot-panel {
  margin-top: 22px;
  padding: 16px;
}

.desktop-shot {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.desktop-shot-caption {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.desktop-features {
  margin-top: 28px;
}

.desktop-features h2 {
  margin: 0 0 14px;
  font-size: 22px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.feature-card {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.feature-card i {
  width: 22px;
  height: 22px;
  color: var(--primary);
}

.feature-card h3 {
  margin: 10px 0 6px;
  font-size: 15px;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

/* 首页工具卡片：顶部功能插画，标题与说明居中，按钮贴底对齐。 */
.tool-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 26px 28px 24px;
  border-radius: 12px;
}

.tool-card .tool-art {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-card .tool-art svg {
  display: block;
  max-width: 100%;
  height: auto;
}

.tool-card h2 {
  margin: 12px 0 8px;
  font-size: 21px;
  font-weight: 750;
}

.tool-card p {
  max-width: 430px;
  margin: 0 auto 18px;
  font-size: 14px;
}

.tool-card .button.primary {
  margin-top: auto;
}

.content-section {
  margin-top: 32px;
}

.content-section > h2 {
  margin: 0 0 14px;
  font-size: 22px;
}

.content-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.content-columns > div {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.content-columns h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.content-columns p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.about-steps {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.faq-list {
  display: grid;
  gap: 12px;
}

.faq-item h2 {
  margin: 0;
  font-size: 15px;
}

.faq-item p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.desktop-notes {
  margin: 16px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  color: var(--muted);
  font-size: 12px;
}

.stat-panel .stat-value {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stat-panel .stat-number {
  color: var(--primary);
  font-size: 40px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.stat-panel .stat-value span {
  color: var(--muted);
  font-size: 13px;
}

.info-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.info-list li {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.45;
}

.info-list li:last-child {
  border-bottom: 0;
}

.info-list i {
  color: var(--primary);
  margin-top: 1px;
}

.result-panel,
.feedback-panel {
  padding: 22px;
}

#job-app {
  display: grid;
  gap: 20px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  background: #e6ebf0;
  border-radius: 999px;
}

.progress-track.large {
  height: 12px;
}

.progress-value {
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
  transition: width 220ms ease;
}

/* 识别阶段每页结束才回报一次进度，条纹滚动说明任务没有卡住。 */
.progress-value.busy {
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.3) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0.3) 75%,
    transparent 75%
  );
  background-size: 22px 22px;
  animation: progress-stripes 0.9s linear infinite;
}

@keyframes progress-stripes {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 22px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .progress-value.busy {
    animation: none;
  }
}

.stage-row {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.result-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.result-hero > .status-chip {
  margin-left: auto;
}

.result-hero h2 {
  margin: 0 0 5px;
  font-size: 22px;
}

.result-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.success-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: white;
  background: var(--success);
  border-radius: 50%;
}

.success-mark.danger {
  background: var(--danger);
}

.success-mark i {
  width: 28px;
  height: 28px;
}

.metrics {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  min-height: 84px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.metric span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  font-size: 21px;
}

.download-box {
  margin-top: 20px;
  padding: 15px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid #c7d6fb;
  border-radius: 8px;
  background: var(--primary-soft);
}

.download-box .button {
  flex: 1;
}

.download-size {
  font-weight: 500;
  opacity: 0.85;
}

.download-size:empty {
  display: none;
}

.feedback-panel .panel-title {
  margin-bottom: 8px;
}

.feedback-panel > p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.choice {
  min-height: 39px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 600;
}

.choice input {
  accent-color: var(--primary);
}

.feedback-panel > form .textarea {
  margin-bottom: 14px;
}

.danger-panel .result-hero {
  border-bottom: 0;
}

.failure-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* 失败但可引导的面板（整页图片超过识别上限、文件超过大小上限）：
   说明限制原因，并给出重新处理 / 桌面版出口。 */
.scan-limit-panel {
  margin: 0 0 18px;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.scan-limit-panel p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.scan-limit-panel .inline-error {
  margin-top: 0;
}

.inline-error {
  margin-top: 14px;
  padding: 11px 12px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #efc4c1;
  border-radius: 7px;
  font-size: 13px;
}

/* 首页「我有话说」：标题行右侧的圆角按钮与留言对话框 */
.contact-button {
  padding: 0 20px;
  color: white;
  background: var(--accent);
  border-color: var(--accent);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(194, 65, 12, 0.22);
}

.contact-button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.contact-dialog {
  width: min(480px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.contact-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.contact-form {
  padding: 22px;
}

.contact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.contact-head h2 {
  margin: 0;
  font-size: 20px;
}

.contact-form .field {
  margin-top: 14px;
}

.contact-form .hint {
  margin: 0;
}

.contact-form .button[type="submit"] {
  margin-top: 18px;
}

.feedback-thanks {
  text-align: center;
}

.feedback-thanks .thanks-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 50%;
}

.feedback-thanks .thanks-mark.success {
  color: var(--success);
  background: var(--success-soft);
}

.feedback-thanks .thanks-mark i {
  width: 28px;
  height: 28px;
}

.feedback-thanks h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.feedback-thanks p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.dialog-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dialog-actions .button[type="submit"] {
  margin-top: 0;
}

.contact-success {
  margin: 14px 0 0;
  padding: 11px 12px;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid #bfe7d6;
  border-radius: 7px;
  font-size: 13px;
}

.spinner {
  width: 15px;
  height: 15px;
  display: inline-block;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.success-feedback {
  display: flex;
  align-items: center;
  gap: 16px;
}

.success-feedback h2 {
  margin: 0 0 5px;
}

.success-feedback p {
  margin: 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-body {
  background: var(--canvas);
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
}

.admin-sidebar {
  padding: 20px 16px;
  color: #dfe8ef;
  background: #17252f;
}

.admin-sidebar .brand {
  margin-bottom: 28px;
  color: white;
}

.admin-nav {
  display: grid;
  gap: 5px;
}

.admin-nav a {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  color: #b9c8d3;
  border-radius: 7px;
  text-decoration: none;
  font-size: 13px;
}

.admin-nav a.active {
  color: white;
  background: #203b46;
}

.admin-main {
  min-width: 0;
  padding: 24px 28px 36px;
}

.admin-header {
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.admin-header h1 {
  margin: 0 0 5px;
  font-size: 26px;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.admin-user form {
  margin: 0;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-strip .metric {
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.metric-strip .metric:nth-child(4n) {
  border-right: 0;
}

.metric-strip .metric:nth-last-child(-n + 4) {
  border-bottom: 0;
}

.table-panel {
  margin-top: 20px;
  box-shadow: none;
  /* 列多（如任务记录的密码列）时窄屏可横向滚动，避免右侧列被裁掉。 */
  overflow-x: auto;
  overflow-y: hidden;
}

.section-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
}

/* 后台「下载记录」里，小计列表跟在标题下方 */
.section-head .info-list {
  margin-top: 10px;
}

/* ── 运营总览：卡片网格、条形图与分布列表（纯 CSS，不引图表库） ── */

.ov-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.ov-grid .ov-card {
  margin-top: 0;
}

.ov-card.wide {
  grid-column: 1 / -1;
}

.ov-card-body {
  padding: 16px;
}

.ov-summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.ov-subtitle {
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.ov-subtitle:first-child {
  margin-top: 0;
}

.ov-bars {
  display: grid;
  gap: 6px;
}

.ov-bar-row {
  display: grid;
  grid-template-columns: minmax(64px, 34%) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.ov-bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ov-bar-track {
  height: 8px;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}

.ov-bar-fill {
  display: block;
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
}

.ov-bar-value {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.ov-bar-value small {
  color: var(--muted);
}

.ov-chart {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  align-items: end;
  gap: 2px;
  height: 120px;
  margin-top: 4px;
}

.ov-chart.opens {
  height: 40px;
  margin-top: 6px;
}

.ov-chart.small {
  grid-template-columns: repeat(24, minmax(0, 1fr));
  height: 72px;
}

.ov-col {
  display: flex;
  align-items: flex-end;
  height: 100%;
}

.ov-stack {
  display: flex;
  flex-direction: column-reverse;
  width: 100%;
  overflow: hidden;
  border-radius: 2px 2px 0 0;
}

.ov-seg {
  display: block;
  width: 100%;
  height: 100%;
}

.ov-seg.rmv {
  background: var(--accent);
}

.ov-seg.cvt {
  background: var(--primary);
}

.ov-seg.xls {
  background: var(--success);
}

.ov-seg.img {
  background: #7c3aed;
}

.ov-seg.wtp {
  background: #d97706;
}

.ov-seg.opens {
  height: 100%;
  background: var(--muted);
  opacity: 0.55;
}

.ov-mini-label {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.ov-axis-row {
  display: grid;
  grid-template-columns: repeat(30, minmax(0, 1fr));
  gap: 2px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  white-space: nowrap;
}

.ov-chart.small + .ov-axis-row {
  grid-template-columns: repeat(24, minmax(0, 1fr));
}

.ov-axis-row span {
  /* 标签只在部分列显示，允许溢出到相邻的空列，窄屏下也不会被截断。 */
  overflow: visible;
}

.ov-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.ov-legend-value {
  margin-inline-start: auto;
  font-variant-numeric: tabular-nums;
}

.ov-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* 趋势柱的悬停明细：浮动层挂在 body 上，避免被卡片的 overflow 裁掉。 */
.ov-tooltip {
  position: fixed;
  z-index: 90;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(23, 32, 51, 0.95);
  color: #fff;
  font-size: 12px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
  white-space: pre-line;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.ov-col[data-tip]:hover .ov-stack {
  filter: brightness(1.15);
}

.ov-dot.rmv {
  background: var(--accent);
}

.ov-dot.cvt {
  background: var(--primary);
}

.ov-dot.xls {
  background: var(--success);
}

.ov-dot.img {
  background: #7c3aed;
}

.ov-dot.wtp {
  background: #d97706;
}

.ov-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.ov-facts > div {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ov-facts dt {
  color: var(--muted);
  font-size: 12px;
}

.ov-facts dd {
  margin: 4px 0 0;
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ov-table td,
.ov-table th {
  font-variant-numeric: tabular-nums;
}

/* 后台「下载记录」的版本汇总：按工具分块，块内版本卡片左右自动换行 */
.tool-group {
  padding: 16px;
}

.tool-group + .tool-group {
  border-top: 1px solid var(--line);
}

.tool-group-head {
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.tool-tag.cvt {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid #c9dbff;
}

.tool-tag.rmv {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid #ffd8c2;
}

.tool-tag.xls {
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid #bfe7d5;
}

.tool-tag.img {
  color: #5b21b6;
  background: #ede9fe;
  border: 1px solid #ddd6fe;
}

.tool-tag.wtp {
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
}

.version-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.version-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.version-card:hover {
  border-color: var(--line-strong);
}

.vc-top,
.vc-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vc-platform {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.vc-version {
  margin: 6px 0 8px;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.badge.strong {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: #c9dbff;
}

.empty-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.filterbar {
  padding: 14px 16px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px 160px 120px;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.col-note {
  margin-left: 4px;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
}

.job-name {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 任务记录列变多后，文件名只占固定宽度，完整名称放在悬浮提示里。 */
.job-name span {
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jobs-table th,
.jobs-table td {
  padding: 10px 8px;
  /* 列多时宁可横向滚动，也不要「PDF 转 Excel」折成三行；密码列仍按需换行。 */
  white-space: nowrap;
}

.jobs-table td.password-cell {
  white-space: normal;
}

/* 横向滚动时标题与分页留在面板左缘，不跟着表格跑丢。 */
.table-panel > .section-head,
.table-panel > .pager {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: var(--surface);
}

.mark-col {
  width: 92px;
}

.mark-cell {
  padding-right: 10px !important;
}

/* 「标记 / 详情」随表格横滑时钉在左侧，不用滑回最左才能操作。 */
.jobs-table th.mark-col,
.jobs-table td.mark-cell {
  position: sticky;
  inset-inline-start: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
}

.jobs-table th.mark-col {
  background: var(--surface-soft);
}

/* 「标记」「详情」并排放在第一列。 */
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 参数摘要列：一行放不下时截断，完整内容在悬浮提示和详情弹框里。 */
.params-cell {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.review-open {
  padding: 0;
  color: var(--primary);
  background: none;
  border: 0;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.review-open:hover {
  text-decoration: underline;
}

.review-flag {
  text-align: center;
  white-space: nowrap;
  font-weight: 650;
}

.review-note-cell {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delete-col {
  width: 36px;
}

.delete-cell {
  padding-left: 0 !important;
}

.delete-cell form {
  margin: 0;
}

.row-delete-button {
  width: 26px;
  height: 26px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--danger);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
}

.row-delete-button:hover {
  background: var(--danger-soft);
  border-color: #f0c9c6;
}

.row-delete-button i[data-lucide] {
  width: 16px;
  height: 16px;
}

/* 检查结果为正常、或异常但已处理：整行绿色；异常且未处理：整行红色；
   未检查保持默认字色。 */
tr.review-ok td {
  color: var(--success);
}

tr.review-bad td {
  color: var(--danger);
}

.check-line {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 650;
}

.check-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.review-dialog .hint {
  margin: 4px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

/* ── 任务详情弹框 ── */

.detail-dialog {
  width: min(560px, calc(100% - 32px));
}

.detail-file {
  margin: 2px 0 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}

.kv-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.kv-section h3 {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 750;
}

.kv-list {
  margin: 0;
  display: grid;
  gap: 6px;
}

.kv-list > div {
  display: grid;
  grid-template-columns: minmax(96px, 34%) minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}

.kv-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.kv-list dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.kv-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  /* 任务 ID、IP、UA 都是从左到右的串，RTL 界面里也按原顺序显示。 */
  direction: ltr;
  text-align: start;
}

.detail-raw {
  margin: 0;
  padding: 10px 12px;
  max-height: 220px;
  overflow: auto;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  /* JSON 始终按从左到右排，RTL 界面里也不把键值顺序颠倒。 */
  direction: ltr;
  text-align: left;
}

.icon-button.tiny {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  flex: 0 0 auto;
}

.icon-button.tiny svg {
  width: 16px;
  height: 16px;
}

.icon-button.tiny:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.password-cell {
  min-width: 118px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

.source-cell {
  min-width: 136px;
}

.source-cell span,
.cell-note {
  display: block;
}

.cell-note {
  margin-top: 2px;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

.empty-cell {
  color: var(--muted);
  text-align: center !important;
}

.pager {
  padding: 12px 16px;
  border-top: 1px solid #d5dee8;
  color: #667085;
  font-size: 13px;
  line-height: 1.6;
  overflow-wrap: break-word;
}

.pager-info {
  color: #667085;
  font-size: 13px;
}

.pager-controls {
  margin-top: 6px;
}

.pager-link {
  min-width: 34px;
  height: 32px;
  display: inline-block;
  margin: 2px 6px 2px 0;
  padding: 0 10px;
  color: #172033;
  background: #ffffff;
  border: 1px solid #d5dee8;
  border-radius: 6px;
  font-size: 13px;
  line-height: 30px;
  text-align: center;
  text-decoration: none;
  vertical-align: middle;
  white-space: nowrap;
}

.pager-link:hover {
  border-color: #b9c6d4;
}

.pager-link.active,
.pager-link.active:hover {
  color: #ffffff;
  background: #203b46;
  border-color: #203b46;
}

.pager-link.disabled,
.pager-link.disabled:hover {
  color: #b9c6d4;
  background: #f7f9fc;
  border-color: #d5dee8;
}

.pager-ellipsis {
  display: inline-block;
  margin: 2px 6px 2px 0;
  padding: 0 2px;
  color: #667085;
  font-size: 13px;
  line-height: 32px;
  vertical-align: middle;
}

/* 支持 flex 的新内核：信息居左、翻页控件居右；旧内核退化为上下两行。 */
@supports (display: flex) {
  .pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }

  .pager-controls {
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.detail-panel {
  padding: 20px;
  box-shadow: none;
}

.detail-panel h2 {
  margin: 0 0 16px;
  font-size: 17px;
}

.detail-list {
  margin: 0;
}

/* 法律页的正文里有 Windows 路径这类长串，窄屏不换行会把页面撑出横向滚动条。 */
.detail-list p {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.detail-list dt {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-list dd {
  margin: 5px 0 0;
  line-height: 1.55;
  word-break: break-word;
}

.detail-actions {
  margin-top: 20px;
}

.danger-zone {
  margin-top: 18px !important;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.admin-login-page {
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(420px, calc(100% - 32px));
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-panel {
  width: 100%;
  padding: 28px;
}

.login-brand {
  margin-bottom: 26px;
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 25px;
}

.login-panel form {
  margin-top: 20px;
}

.login-panel form .button {
  margin-top: 18px;
}

/* 站点页脚：备案号、版权、隐私说明入口，宽度与 .page / .topbar 对齐 */
.site-footer {
  width: 100%;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.site-footer-inner {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0 28px;
}

.site-footer-icp {
  margin: 0 0 14px;
  text-align: center;
  font-size: 13px;
}

.site-footer-contact {
  margin: 0 0 14px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.site-footer-badge {
  margin: 0 0 16px;
  text-align: center;
  line-height: 0;
}

.site-footer-badge img {
  display: inline-block;
  width: 150px;
  height: 50px;
}

.site-footer-icp a,
.site-footer-contact a,
.site-footer-links a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer-icp a:hover,
.site-footer-contact a:hover,
.site-footer-links a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.site-footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.site-footer-copy {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 20px;
  font-size: 13px;
}

@media (max-width: 1000px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .admin-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .admin-sidebar .brand span,
  .admin-nav a span {
    display: none;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar-inner,
  .page {
    width: calc(100% - 28px);
  }

  .topbar-inner {
    padding: 12px 0;
    gap: 0 16px;
  }

  .topbar-inner > .status-chip {
    margin-top: 10px;
  }

  /* The language picker stays reachable on narrow screens, so only the
     top-level links and chips are hidden. */
  .topnav > a,
  .topnav > .status-chip {
    display: none;
  }

  .topnav .lang-option {
    display: block;
  }

  /* 窄屏下语言按钮靠近视口左/右边缘，下拉菜单改为从按钮靠近边缘的一侧
     展开，否则较长的语言名会伸出视口被裁掉。选择器带 .topnav 以覆盖后面
     桌面端 RTL 的全局定位规则。 */
  html[dir="ltr"] .topnav .lang-menu {
    left: 0;
    right: auto;
  }

  html[dir="rtl"] .topnav .lang-menu {
    left: auto;
    right: 0;
  }

  /* 状态标签文案较长的语言（马来语、菲律宾语）在窄屏会撑出面板，改为可换行。 */
  .panel-head .status-chip {
    white-space: normal;
    max-width: 100%;
  }

  .page-heading h1 {
    font-size: 27px;
  }

  .stage-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .stage-row .hint {
    margin-top: 10px;
  }

  .result-hero {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px 14px;
  }

  .result-hero > .status-chip {
    grid-column: 2;
    margin-left: 0;
    justify-self: start;
  }

  .download-box {
    flex-wrap: wrap;
    gap: 0 14px;
  }

  .download-box .button {
    width: 100%;
    margin-top: 12px;
  }

  .metrics,
  .filterbar,
  .metric-strip {
    grid-template-columns: 1fr;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .metric-strip .metric,
  .metric-strip .metric:nth-last-child(-n + 4) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric-strip .metric:last-child {
    border-bottom: 0;
  }

  .site-footer-row {
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 720px) {
  .desktop-actions,
  .feature-grid,
  .content-columns {
    grid-template-columns: 1fr;
  }

  /* 下载按钮文案较长（德语、荷兰语等）时不能强制单行，否则整行撑出视口。 */
  .desktop-actions .button {
    min-width: 0;
    white-space: normal;
  }

  .desktop-download-panel,
  .desktop-shot-panel {
    padding: 16px;
  }
}

/* 从右到左（阿拉伯语）：与 <html dir="rtl"> 配合，只镜像这里写死的左右方向。
   flex/grid 布局本身会跟随 dir 自动镜像，无需重复声明。 */
html[dir="rtl"] body {
  direction: rtl;
}

html[dir="rtl"] .lang-menu {
  right: auto;
  left: 0;
}

html[dir="rtl"] .login-lang {
  justify-content: flex-start;
}

html[dir="rtl"] .input.with-action {
  padding-right: 12px;
  padding-left: 44px;
}

html[dir="rtl"] .input-action {
  right: auto;
  left: 7px;
}

html[dir="rtl"] .about-steps {
  padding-left: 0;
  padding-right: 20px;
}

html[dir="rtl"] .result-hero > .status-chip {
  margin-left: 0;
  margin-right: auto;
}

html[dir="rtl"] .metric-strip .metric {
  border-right: 0;
  border-left: 1px solid var(--line);
}

html[dir="rtl"] .metric-strip .metric:nth-child(4n) {
  border-left: 0;
}

html[dir="rtl"] .data-table th,
html[dir="rtl"] .data-table td {
  text-align: right;
}

html[dir="rtl"] .col-note {
  margin-left: 0;
  margin-right: 4px;
}

html[dir="rtl"] .jobs-table th.mark-col,
html[dir="rtl"] .jobs-table td.mark-cell {
  box-shadow: -1px 0 0 var(--line);
}

html[dir="rtl"] .button-note {
  margin-left: 0;
  margin-right: 2px;
}

html[dir="rtl"] .desktop-meta span + span::before {
  margin-right: 0;
  margin-left: 6px;
}

/* 总览卡片在中等宽度以下改为单列，避免条形图被压得太窄 */
@media (max-width: 1100px) {
  .ov-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ov-card.wide {
    grid-column: auto;
  }
}

/* RTL 下条形列表的进度条从右往左增长，数值列跟随镜像 */
html[dir="rtl"] .ov-bar-row,
html[dir="rtl"] .ov-legend {
  direction: rtl;
}

/* ── 手机上的管理后台：侧栏改成顶部横向菜单，表格仍可左右滑动 ── */
@media (max-width: 720px) {
  .admin-shell {
    grid-template-columns: minmax(0, 1fr);
    /* 单列时别把多出来的高度分摊给顶部菜单，否则短页面会空出一块深色。 */
    align-content: start;
  }

  .admin-sidebar {
    padding: 12px 14px 8px;
  }

  .admin-sidebar .brand {
    margin-bottom: 10px;
    font-size: 15px;
  }

  /* 1000px 起侧栏只留图标；手机上是顶部菜单，图标和文字都显示。 */
  .admin-sidebar .brand span,
  .admin-nav a span {
    display: inline;
  }

  .admin-nav {
    display: flex;
    gap: 4px;
    padding-bottom: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
  }

  .admin-nav a {
    flex: 0 0 auto;
    min-height: 36px;
    gap: 7px;
    padding: 0 9px;
    font-size: 12px;
    white-space: nowrap;
  }

  .admin-nav a i[data-lucide] {
    width: 16px;
    height: 16px;
  }

  .admin-nav-group {
    display: none;
  }

  .admin-main {
    padding: 16px 14px 28px;
  }

  .admin-header {
    margin-bottom: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .admin-header h1 {
    font-size: 21px;
  }

  .admin-user {
    width: 100%;
    flex-wrap: wrap;
  }

  .admin-user form {
    margin-left: auto;
  }

  .metric {
    min-height: 0;
    padding: 11px 13px;
  }

  /* 指标两列排，8 个指标一屏能看全，不用滚一长串。 */
  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-strip .metric,
  .metric-strip .metric:nth-last-child(-n + 4) {
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .metric-strip .metric:nth-child(2n) {
    border-right: 0;
  }

  .metric-strip .metric:nth-last-child(-n + 2),
  .metric-strip .metric:last-child {
    border-bottom: 0;
  }

  .section-head {
    padding: 12px 14px;
  }

  .table-panel {
    margin-top: 14px;
    -webkit-overflow-scrolling: touch;
  }

  .filterbar {
    padding: 12px 14px;
  }

  /* 横滑表格时给右侧一点留白，最后一列不贴着边缘。 */
  .jobs-table th:last-child,
  .jobs-table td:last-child {
    padding-right: 12px;
  }

  /* 任务记录列多，手机上先隐藏详情弹框里已有的列，横滑一次就能看完。 */
  .jobs-table .opt-col {
    display: none;
  }

  .jobs-table .job-name span {
    max-width: 130px;
  }

  .jobs-table .params-cell {
    max-width: 150px;
  }

  .jobs-table .review-note-cell {
    max-width: 130px;
  }

  .contact-dialog {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 20px);
  }

  .contact-form {
    padding: 16px;
  }

  .detail-dialog .kv-list > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}

/* PDF添加密码水印：颜色选择与权限复选网格 */
.color-input {
  min-height: 39px;
  padding: 3px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.form-grid.compact {
  margin-top: 12px;
}
