:root {
  --bg: #f3ede3;
  --panel: rgba(255, 251, 244, 0.92);
  --paper: #fffaf2;
  --ink: #1f2521;
  --muted: #697468;
  --line: rgba(31, 37, 33, 0.12);
  --accent: #d06a2d;
  --accent-deep: #8c451b;
  --green: #2f6b44;
  --green-bg: #e6f2e8;
  --amber: #996515;
  --amber-bg: #fbf0d7;
  --slate: #607064;
  --slate-bg: #ebefec;
  --error: #9c2f22;
  --error-bg: #fbe9e6;
  --blue: #3766ad;
  --blue-bg: #eef4fb;
  --shadow: 0 18px 45px rgba(74, 53, 30, 0.1);
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans TC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(208, 106, 45, 0.18), transparent 25%),
    radial-gradient(circle at top right, rgba(85, 102, 77, 0.14), transparent 25%),
    linear-gradient(180deg, #fbf6ef 0%, var(--bg) 100%);
}

code,
h1,
h2,
h3,
.stat-card strong,
.asset-row strong,
.compare-col-head strong,
.tab-button {
  font-family: "Space Grotesk", sans-serif;
}

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

dt,
dd {
  margin: 0;
}

.app-shell {
  width: min(1540px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.panel-shell,
.flash,
.tool-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.page-section {
  display: grid;
  gap: 16px;
}

.soft-panel {
  background: rgba(255, 255, 255, 0.54);
  box-shadow: none;
}

/* Flat 一條 bar — brand + nav + status + user 都在同一橫排，底下一條 subtle divider
 * 拿掉之前 panel-shell 的圓角矩形視覺，讓 header 看起來像 product app header 而不是「卡片」
 */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid rgba(31, 37, 33, 0.10);
  background: none;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: none;
}

.topbar-brand {
  display: grid;
  gap: 2px;
}

.eyebrow {
  color: var(--accent-deep);
  font-size: 0.84rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1 {
  font-size: clamp(1.8rem, 3.6vw, 2.85rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.topbar-status-strip {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar-userline {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}

.user-chip {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  background: rgba(67, 87, 70, 0.1);
  color: var(--green);
  font-weight: 700;
}

.meta-chip {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(31, 37, 33, 0.08);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.topbar-actions {
  justify-self: end;
}

.inline-form {
  margin: 0;
}

.status {
  display: inline-flex;
  width: fit-content;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 700;
}

.status.ready {
  color: var(--green);
  background: var(--green-bg);
}

.status.off {
  color: var(--error);
  background: var(--error-bg);
}

.summary-list,
.run-meta {
  display: grid;
  gap: 10px;
}

.summary-list div,
.run-meta div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.summary-list dt,
.run-meta dt,
.duplicate-meta dt {
  color: var(--muted);
}

.toolbar {
  display: grid;
  gap: 16px;
  padding: 0 4px;
  margin-bottom: 18px;
  /* flat 版：不再用 panel-shell 背景；inputs 自己的邊框就足夠把 filter bar 切出來
   * stacking context 仍要拉高，不然 multi-select 下拉會被 sample-card 蓋住
   */
  position: relative;
  z-index: 20;
}

/* 當 multi-select 展開時再多拉一層，避免任何同層元素遮擋 */
.multi-select[open] {
  z-index: 40;
}

/* page-nav 內嵌在 .topbar 內，扁平 tab 樣式，沒有 card 邊框 */
.page-nav {
  display: flex;
  gap: 2px;
  align-items: center;
  padding: 0;
  margin: 0;
  flex: 1;          /* 把右側 status-strip / actions 推到最右邊 */
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.page-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--muted);
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 14px;
  font-weight: 500;
  background: transparent;
  border: none;
  transition: color 140ms ease, background 140ms ease;
}

.page-link:hover {
  color: var(--ink);
  background: rgba(31, 37, 33, 0.04);
}

.page-link.active {
  color: var(--accent-deep);
  background: rgba(208, 106, 45, 0.10);
  font-weight: 600;
}

.page-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  padding: 18px 20px;
}

.page-head h2 {
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  line-height: 1.08;
}

.page-head p:last-child {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.65;
}

.page-head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.searchbar {
  display: grid;
  grid-template-columns: minmax(220px, 1.45fr) minmax(130px, 0.8fr) minmax(130px, 0.85fr) minmax(130px, 0.85fr) minmax(260px, 1.25fr) auto;
  gap: 14px;
  align-items: end;
}

@media (max-width: 1200px) {
  .searchbar {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .searchbar-field {
    grid-column: 1 / -1;
  }
  .searchbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

.searchbar-filter,
.searchbar-field,
.stack-form,
.field,
.file-picker {
  display: grid;
  gap: 8px;
}

.searchbar-filter {
  align-self: stretch;
  min-width: 0;
}

.searchbar-filter span,
.searchbar-field span,
.field span,
.file-picker span {
  font-weight: 700;
}

.searchbar-actions,
.settings-actions,
.detail-actions,
.duplicate-actions,
.searchbar-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.searchbar-actions {
  justify-content: flex-end;
  align-self: end;
  white-space: nowrap;
}

.searchbar-actions .ghost-link.prominent,
.searchbar-actions button {
  min-height: 46px;
}

.tool-drawer-grid {
  display: grid;
  gap: 12px;
}

.tool-drawer {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.45);
  overflow: hidden;
}

.tool-drawer summary {
  padding: 16px 18px;
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  user-select: none;
}

.tool-drawer summary::-webkit-details-marker {
  display: none;
}

.tool-drawer summary::after {
  content: "+";
  float: right;
  color: var(--muted);
}

.tool-drawer[open] summary::after {
  content: "−";
}

.tool-drawer-body {
  display: grid;
  gap: 14px;
  padding: 0 18px 18px;
}

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

.tool-card {
  padding: 18px;
}

.panel-head {
  margin-bottom: 14px;
}

.page-card-head {
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(31, 37, 33, 0.06);
}

.panel-head.compact {
  margin-bottom: 10px;
}

.panel-head p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-span-2 {
  grid-column: span 2;
}

.provider-panel {
  display: none;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.5);
}

.provider-panel.active {
  display: grid;
  gap: 12px;
}

.provider-help,
.ghost-link,
.empty-state,
.section-head span,
.asset-subline {
  color: var(--muted);
}

input[type="search"],
input[type="file"],
input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(31, 37, 33, 0.16);
  border-radius: var(--radius-md);
  font: inherit;
  color: var(--ink);
  background: var(--paper);
}

select[multiple] {
  min-height: 180px;
  padding-block: 10px;
}

.multi-select {
  position: relative;
}

.multi-select summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 54px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 37, 33, 0.16);
  border-radius: var(--radius-md);
  background: var(--paper);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.multi-select summary::-webkit-details-marker {
  display: none;
}

.multi-select summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 0.92rem;
}

.multi-select[open] summary {
  border-color: rgba(208, 106, 45, 0.28);
  box-shadow: 0 0 0 3px rgba(208, 106, 45, 0.08);
}

.multi-select[open] summary::after {
  content: "▴";
}

.multi-select-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 10px);
  left: 0;
  width: min(420px, 72vw);
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(31, 37, 33, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 251, 244, 0.98);
  box-shadow: 0 24px 60px rgba(52, 40, 23, 0.16);
  backdrop-filter: blur(18px);
}

.multi-select-meta {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  line-height: 1.55;
}

.multi-select-meta strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.checkbox-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  padding-right: 4px;
  overflow: auto;
}

.checkbox-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31, 37, 33, 0.08);
  background: rgba(255, 255, 255, 0.78);
}

.checkbox-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.checkbox-option span {
  min-width: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.checkbox-option small {
  color: var(--muted);
  white-space: nowrap;
}

button,
.receipt-open {
  padding: 14px 18px;
  border: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), #e18e44);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms ease, filter 140ms ease;
}

button.secondary {
  background: linear-gradient(135deg, #435746, #69806c);
}

button.danger {
  background: linear-gradient(135deg, #a53c2f, #cb5f49);
}

button.subtle {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
}

button:hover,
.receipt-open:hover {
  filter: saturate(1.04);
  transform: translateY(-1px);
}

button:disabled,
input[type="submit"]:disabled {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.ghost-link {
  text-decoration: none;
  font-weight: 700;
}

.ghost-link.prominent {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(31, 37, 33, 0.12);
  background: rgba(255, 255, 255, 0.45);
}

.flash {
  padding: 14px 18px;
  margin-bottom: 16px;
}

.flash.success {
  background: var(--green-bg);
  border-color: rgba(47, 107, 68, 0.14);
}

.flash.loading {
  background: var(--blue-bg);
  border-color: rgba(55, 102, 173, 0.16);
}

.flash.warning {
  background: var(--amber-bg);
  border-color: rgba(153, 101, 21, 0.18);
}

.flash.error {
  background: var(--error-bg);
  border-color: rgba(156, 47, 34, 0.14);
}

.duplicate-inline {
  margin-bottom: 16px;
}

.busy-inline {
  display: flex;
  gap: 12px;
  align-items: center;
}

.busy-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(55, 102, 173, 0.18);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.management-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.9fr);
  gap: 16px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) 380px;
  gap: 16px;
}

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

.dashboard-side {
  display: grid;
  gap: 16px;
  align-content: start;
}

.dashboard-panel {
  padding: 18px;
}

.evaluation-stats .stat-card strong {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.metric-list {
  display: grid;
  gap: 10px;
}

.metric-list.compact {
  gap: 8px;
}

.metric-row-link {
  color: inherit;
  text-decoration: none;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.metric-row-link:hover {
  border-color: rgba(208, 106, 45, 0.38);
  background: rgba(255, 255, 255, 0.76);
  transform: translateY(-1px);
}

.metric-row-link:focus-visible {
  outline: 3px solid rgba(208, 106, 45, 0.28);
  outline-offset: 3px;
}

.metric-row,
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 37, 33, 0.08);
  background: rgba(255, 255, 255, 0.62);
}

.metric-row div,
.summary-row div {
  display: grid;
  gap: 4px;
}

.metric-meter {
  text-align: right;
}

.metric-meter b {
  display: block;
  font-size: 1.05rem;
}

.metric-meter small {
  color: var(--muted);
}

.summary-row span {
  color: var(--muted);
  font-size: 0.92rem;
}

.summary-row b {
  font-size: 1rem;
}

.dashboard-link {
  margin-top: 12px;
}

.gt-errors-page {
  display: grid;
  gap: 16px;
}

.gt-error-list {
  display: grid;
  gap: 10px;
}

.gt-error-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.66);
}

.gt-error-main {
  display: grid;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.gt-error-title,
.gt-error-meta,
.gt-error-values {
  min-width: 0;
}

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

.gt-error-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gt-error-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.gt-error-values span {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 251, 244, 0.86);
  color: var(--ink);
}

.gt-error-values b {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.gt-error-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.88rem;
}

.page-head .inline-upload,
.page-head .inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 0;
}

.inline-file {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(31, 37, 33, 0.16);
  background: rgba(255, 255, 255, 0.68);
  font-weight: 700;
  cursor: pointer;
}

.inline-file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.preview-panel {
  align-content: start;
  position: sticky;
  top: 16px;
}

.asset-row.compact-row {
  grid-template-columns: 72px minmax(0, 1fr) auto;
}

.asset-thumb {
  width: 84px;
  height: 84px;
  padding: 0;
  border: 1px solid rgba(31, 37, 33, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
  cursor: zoom-in;
}

.asset-thumb.compact {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
}

.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.asset-subline.emphasis {
  color: var(--amber);
  font-weight: 700;
}

.asset-meta-collapse {
  margin-top: 4px;
}

.asset-meta-collapse summary {
  cursor: pointer;
  list-style: none;
  color: var(--muted);
  font-size: 0.86rem;
}

.asset-meta-collapse summary::-webkit-details-marker {
  display: none;
}

.asset-subline.stacked {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.compact-list {
  gap: 8px;
}

.vendor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 420px;
  gap: 18px;
}

.vendor-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) 420px;
  gap: 18px;
  padding: 20px 22px;
}

.vendor-intro-copy {
  display: grid;
  gap: 10px;
}

.vendor-intro-copy h2 {
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  line-height: 1.12;
}

.vendor-intro-copy p:last-child {
  color: var(--muted);
  line-height: 1.7;
}

.vendor-intro-steps {
  display: grid;
  gap: 10px;
}

.vendor-intro-steps div {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(31, 37, 33, 0.08);
}

.vendor-intro-steps span {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  background: rgba(208, 106, 45, 0.14);
  color: var(--accent-deep);
  font-weight: 700;
}

.vendor-intro-steps strong {
  font-family: "Space Grotesk", sans-serif;
}

.vendor-intro-steps p {
  color: var(--muted);
  line-height: 1.55;
}

.vendor-panel {
  padding: 18px;
}

.vendor-catalog,
.unclassified-list,
.vendor-actions-col {
  display: grid;
  gap: 14px;
}

.vendor-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(31, 37, 33, 0.08);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 249, 241, 0.72));
}

.vendor-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.vendor-title-block {
  display: grid;
  gap: 8px;
}

.vendor-title-block strong {
  display: block;
  font-size: 1.22rem;
  line-height: 1.18;
}

.vendor-title-block p {
  color: var(--muted);
  line-height: 1.6;
}

.mini-label {
  color: var(--accent-deep);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.vendor-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.vendor-metrics div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 37, 33, 0.08);
  background: rgba(255, 255, 255, 0.78);
}

.vendor-metrics span {
  color: var(--muted);
  font-size: 0.84rem;
}

.vendor-metrics strong {
  font-size: 1rem;
  line-height: 1.2;
}

.vendor-counts,
.alias-chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.alias-section {
  display: grid;
  gap: 10px;
}

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

.alias-section-head strong {
  font-size: 0.95rem;
}

.alias-chip {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(31, 37, 33, 0.08);
  font-size: 0.92rem;
}

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

.unclassified-row {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 37, 33, 0.08);
  background: rgba(255, 255, 255, 0.5);
}

.manage-panel,
.library-preview,
.settings-hero {
  padding: 18px;
}

.settings-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  width: 100%;
}

.settings-side {
  position: sticky;
  top: 18px;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 248, 239, 0.98), rgba(251, 241, 226, 0.9));
}

.settings-side-head {
  margin-bottom: 16px;
}

.settings-side-stack {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.settings-note-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 37, 33, 0.08);
  background: rgba(255, 255, 255, 0.62);
}

.settings-note-card strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.3rem;
}

.settings-summary-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(31, 37, 33, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 247, 235, 0.76));
}

.settings-summary-top {
  display: grid;
  gap: 10px;
}

.settings-summary-top strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.55rem;
  line-height: 1.05;
}

.settings-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.settings-summary-grid div {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.68);
}

.settings-summary-grid dd {
  font-weight: 700;
}

.settings-note-card p {
  color: var(--muted);
}

.mini-label {
  color: var(--accent-deep);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

.settings-headline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
  margin-bottom: 6px;
}

.settings-headline p:last-child {
  margin-top: 0;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 37, 33, 0.08);
  background: rgba(255, 255, 255, 0.52);
  line-height: 1.7;
}

.settings-block {
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid rgba(31, 37, 33, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.56);
}

.settings-block-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.settings-block-head h3 {
  font-size: 1.14rem;
}

.settings-block-head span {
  color: var(--muted);
  font-size: 0.92rem;
}

.provider-callout {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(67, 87, 70, 0.08);
}

.settings-hero {
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.98), rgba(255, 248, 239, 0.9));
}

.settings-page .provider-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.settings-page .stack-form {
  gap: 16px;
}

.settings-page .field span {
  font-size: 0.94rem;
}

.model-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.nested-field {
  display: grid;
  gap: 8px;
}

.model-help-card {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 37, 33, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.model-help-card strong {
  font-size: 0.94rem;
}

.model-help-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.settings-page input[type="text"],
.settings-page input[type="password"],
.settings-page textarea,
.settings-page select {
  min-height: 60px;
  border-radius: var(--radius-md);
}

.settings-page textarea {
  resize: vertical;
  line-height: 1.55;
}

.settings-page .settings-actions {
  justify-content: flex-start;
  padding-top: 4px;
}

.stat-card {
  padding: 20px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}

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

.sidebar,
.main-stage {
  display: grid;
  gap: 16px;
  align-content: start;
}

.sidebar {
  position: sticky;
  top: 16px;
}

.sidebar-panel,
.stage-panel {
  padding: 18px;
}

.asset-list {
  display: grid;
  gap: 10px;
}

.asset-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.62);
}

.asset-actions {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.asset-row.active {
  border-color: rgba(208, 106, 45, 0.26);
  background: rgba(255, 244, 232, 0.96);
}

.asset-main {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.asset-title {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.asset-subline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.92rem;
}

.status-badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-badge.good {
  color: var(--green);
  background: var(--green-bg);
}

.status-badge.warn {
  color: var(--amber);
  background: var(--amber-bg);
}

.status-badge.muted {
  color: var(--slate);
  background: var(--slate-bg);
}

.status-badge.error {
  color: var(--error);
  background: var(--error-bg);
}

.status-badge.score-perfect {
  color: #2e6d47;
  background: rgba(111, 164, 132, 0.18);
}

.status-badge.score-high {
  color: #2f7b63;
  background: rgba(90, 176, 151, 0.16);
}

.status-badge.score-mid {
  color: #8b5d1d;
  background: rgba(193, 142, 74, 0.14);
}

.status-badge.score-low {
  color: #b05533;
  background: rgba(217, 115, 83, 0.16);
}

.stage-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(31, 37, 33, 0.06);
}

.stage-title {
  display: grid;
  gap: 8px;
}

.stage-title h2 {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  line-height: 1;
}

.stage-subtitle {
  color: var(--muted);
  line-height: 1.6;
}

.rerun-form {
  display: grid;
}

.compare-health-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.compare-health-strip article {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 37, 33, 0.08);
  background: rgba(255, 255, 255, 0.62);
}

.compare-health-strip span {
  color: var(--muted);
  font-size: 0.88rem;
}

.compare-health-strip strong {
  line-height: 1.4;
}

.tab-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.tab-button {
  padding: 12px 16px;
  border: 1px solid rgba(31, 37, 33, 0.12);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.52);
  color: var(--muted);
}

.tab-button.is-active {
  background: linear-gradient(135deg, var(--accent), #e18e44);
  color: white;
  border-color: transparent;
}

.tab-panel {
  display: grid;
  gap: 16px;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.08fr) minmax(320px, 0.92fr);
  gap: 16px;
}

.overview-side {
  display: grid;
  gap: 16px;
}

.image-stage {
  min-height: 420px;
  padding: 12px;
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(247, 241, 230, 0.95), rgba(233, 222, 204, 0.95));
}

.image-stage img {
  width: 100%;
  height: 100%;
  max-height: 72vh;
  object-fit: contain;
  object-position: center;
  image-orientation: from-image;
  display: block;
  border-radius: var(--radius-md);
}

.image-zoom-shell {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.mono {
  word-break: break-all;
  font-family: "Space Grotesk", monospace;
  font-size: 0.92rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.compare-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.56);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

.compare-table th,
.compare-table td {
  padding: 14px;
  border-bottom: 1px solid rgba(31, 37, 33, 0.08);
  vertical-align: top;
  text-align: left;
}

.compare-table th:first-child,
.compare-table td:first-child {
  width: 170px;
  background: rgba(31, 37, 33, 0.03);
}

.compare-table tbody tr.is-diff td:first-child {
  background: rgba(208, 106, 45, 0.1);
  color: var(--accent-deep);
  font-weight: 700;
}

.compare-table tbody tr.is-diff td:not(:first-child) {
  background: rgba(255, 244, 232, 0.62);
}

.compare-table tbody tr.has-missing td.is-empty {
  color: var(--error);
}

.compare-col-head {
  display: grid;
  gap: 6px;
}

.compare-col-head span {
  color: var(--muted);
  font-size: 0.92rem;
}

.run-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 14px;
}

.run-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.56);
}

/* === 人工評比面板 (run 卡片內) === */
.annotation-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(74, 110, 130, 0.22);
  border-radius: var(--radius-md);
  background: rgba(74, 110, 130, 0.04);
  display: grid;
  gap: 12px;
}

.annotation-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.annotation-head h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.annotation-score {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  background: rgba(0, 0, 0, 0.05);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
}
.annotation-score.muted {
  color: var(--muted);
}

.annotation-group {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.annotation-group legend {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* 14 個欄位平鋪一條清單,不再用 fieldset 分主要/細節 */
.annotation-fields {
  display: grid;
  gap: 4px;
}

/* === 標準答案 (image_ground_truth) panel === */
.ground-truth-panel {
  padding: 14px 18px;
}

.ground-truth-panel .panel-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ground-truth-panel .panel-title h3 {
  margin: 0;
  font-size: 14.5px;
}

.gt-fields {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.gt-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 5px 10px;
  border-radius: 5px;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.5);
  border-left: 3px solid transparent;
}

.gt-row.gt-status-filled {
  border-left-color: rgba(31, 107, 63, 0.55);
}

.gt-row.gt-status-empty {
  border-left-color: rgba(96, 112, 100, 0.45);
  background: rgba(0, 0, 0, 0.025);
}

.gt-row.gt-status-unset {
  background: rgba(0, 0, 0, 0.02);
  border-left-color: var(--line);
}


.gt-label {
  font-weight: 600;
  color: var(--ink);
}

.gt-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gt-empty, .gt-unset {
  color: var(--muted);
  font-style: italic;
}

.gt-hint {
  font-size: 11.5px;
  margin: 0;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.gt-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.gt-head h3 { flex: 0 0 auto; }
.gt-head .muted { flex: 1 1 auto; }
.gt-edit-toggle { flex: 0 0 auto; }

.gt-edit-form.hidden,
.gt-fields[data-gt-view].hidden {
  display: none;
}

.gt-fields-edit {
  display: grid;
  gap: 6px;
  margin: 10px 0 12px;
}

.gt-edit-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 10px;
  align-items: center;
}

.gt-edit-label {
  font-weight: 600;
  font-size: 13px;
}

.gt-edit-input {
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
}

.gt-edit-input:disabled {
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted);
  text-decoration: line-through;
}

.gt-edit-empty {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.gt-edit-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

/* === 標註結果 — M1/M2 tabs 切換 (取代 vertical stack) === */
.run-legend-panel {
  padding: 14px 18px;
}

.run-legend-panel .panel-title h3 {
  margin: 0 0 8px;
  font-size: 14.5px;
}

.annotation-tabs-panel {
  padding: 0;
  overflow: hidden;
}

.annotation-tabs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.annotation-tabs-head h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
}

.annotation-tabs-buttons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.annotation-tab-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.6);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.1s ease, border-color 0.1s ease;
}

.annotation-tab-button:hover {
  background: rgba(0, 0, 0, 0.04);
}

.annotation-tab-button.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent-deep);
}

.annotation-tab-mark {
  display: inline-flex;
  width: 14px;
  height: 14px;
  align-items: center;
  justify-content: center;
  background: rgba(31, 107, 63, 0.95);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: 10px;
}

.annotation-tab-button.is-active .annotation-tab-mark {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.annotation-tab-panels > .annotation-tabpanel {
  display: none;
  padding: 18px;
}

.annotation-tab-panels > .annotation-tabpanel.is-active {
  display: block;
}

.annotation-tabpanel-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}

.annotation-tabpanel-meta strong {
  font-weight: 700;
}

/* items 群組裡的商品表稍微壓縮一下,跟下方 radio 視覺貼近 */
.annotation-items .item-table {
  margin-bottom: 10px;
}

.annotation-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid transparent;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.annotation-row.state-wrong {
  background: rgba(156, 47, 34, 0.06);
  border-color: rgba(156, 47, 34, 0.22);
}

.annotation-cell {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.annotation-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.annotation-value {
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.annotation-value.empty {
  color: var(--muted);
  font-style: italic;
}

/* toggle button — 兩態 (對↔錯 / 文件無↔漏抓) */
.annotation-toggle {
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: #e7f4ec;
  color: #1f6b3f;
  cursor: pointer;
  white-space: nowrap;
  min-width: 76px;
  text-align: center;
  transition: background 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}

.annotation-row.state-wrong .annotation-toggle {
  background: var(--error);
  color: #fff;
  border-color: var(--error);
}

/* 空值欄位的「文件無」狀態 = 灰色 */
.annotation-row[data-anno-has-value="0"]:not(.state-wrong) .annotation-toggle {
  background: rgba(0, 0, 0, 0.06);
  color: var(--muted);
}

.annotation-note {
  grid-column: 1 / -1;
  margin-top: 4px;
  width: 100%;
  padding: 6px 10px;
  font-size: 12.5px;
  border: 1px solid rgba(156, 47, 34, 0.28);
  border-radius: 5px;
  background: #fff;
}

.annotation-note.hidden {
  display: none;
}

.annotation-note:disabled {
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted);
  text-decoration: line-through;
}

/* ⊘ 應為空 — 只在 ✗ 錯 + 有值欄位才出現,點一下標 GT.empty */
.annotation-empty-toggle {
  grid-column: 1 / -1;
  justify-self: start;
  margin-top: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: 1px dashed rgba(74, 110, 130, 0.4);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.1s ease, color 0.1s ease;
}

.annotation-empty-toggle:hover {
  background: rgba(74, 110, 130, 0.08);
  color: var(--ink);
}

.annotation-empty-toggle.is-active {
  background: rgba(74, 110, 130, 0.22);
  color: var(--ink);
  border-style: solid;
  border-color: rgba(74, 110, 130, 0.55);
}

.annotation-empty-toggle.hidden {
  display: none;
}

.annotation-items-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.annotation-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}

.annotation-radio input {
  margin: 0;
}

.annotation-radio:has(input:checked) {
  background: #e7f4ec;
  border-color: rgba(31, 107, 63, 0.4);
  color: #1f6b3f;
  font-weight: 600;
}

.annotation-group textarea {
  width: 100%;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  resize: vertical;
}

.annotation-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px dashed rgba(74, 110, 130, 0.28);
}

.annotation-submit {
  display: block;
  width: 100%;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent-deep);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.10), 0 6px 16px rgba(208, 106, 45, 0.30);
  transition: filter 0.12s ease, transform 0.05s ease, box-shadow 0.12s ease;
}

.annotation-submit:hover {
  filter: brightness(1.05);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.10), 0 8px 22px rgba(212, 116, 35, 0.32);
}

.annotation-submit:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.10), 0 4px 10px rgba(212, 116, 35, 0.18);
}

.annotation-meta {
  text-align: center;
  font-size: 11.5px;
  color: var(--muted);
}

/* === Dashboard 辨識正確率 section === */
.annotation-stats {
  margin-top: 20px;
}

/* Dashboard 頂端工具列 — 組合 filter 與其他全頁 filter 用 */
.dashboard-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgba(74, 110, 130, 0.06), rgba(74, 110, 130, 0.02));
  border: 1px solid rgba(74, 110, 130, 0.18);
  flex-wrap: wrap;
}

/* 模型組合計數 — 左邊小 chip,跟 toolbar 一樣高,不再用 stat card 那麼大 */
.toolbar-combo-count {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-right: 4px;
}

.toolbar-combo-count-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.toolbar-combo-count-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.combo-filter-form {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.combo-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.combo-filter-form select {
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #fff;
  min-width: 360px;
  cursor: pointer;
  font-family: inherit;
}

.combo-clear {
  font-size: 12.5px;
}

.combo-active-chip {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  vertical-align: middle;
}

.combo-failure-banner {
  margin-top: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, rgba(156, 47, 34, 0.10) 0%, rgba(156, 47, 34, 0.03) 100%);
  border: 1px solid rgba(156, 47, 34, 0.24);
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.combo-failure-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--error);
  letter-spacing: 0.05em;
}

.combo-failure-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--error);
  font-variant-numeric: tabular-nums;
}

.combo-failure-meta {
  font-size: 12px;
  color: var(--muted);
}

.annotation-stats-grid {
  display: grid;
  gap: 22px;
}

.annotation-stats-overall {
  display: grid;
  grid-template-columns: 130px 1fr 60px;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  background: linear-gradient(90deg, rgba(74, 110, 130, 0.06) 0%, transparent 100%);
  border-radius: 8px;
  border: 1px solid rgba(74, 110, 130, 0.16);
}

.annotation-stats-overall .annotation-stats-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.annotation-stats-overall .annotation-stats-pct {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
}

.annotation-stats-overall .annotation-stats-meta {
  grid-column: 2;
  font-size: 11.5px;
  color: var(--muted);
}

.annotation-stats-bar {
  position: relative;
  height: 8px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.annotation-stats-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4a8c5a, #6fb87a);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.annotation-stats-block h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.annotation-stats-models {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.annotation-stats-models li {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) auto minmax(120px, 1fr) 50px auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
  font-size: 13px;
}

.annotation-stats-models li strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.annotation-stats-models li b {
  font-weight: 700;
  text-align: right;
}

.annotation-stats-weak {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.annotation-stats-weak li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 6px 12px;
  border-radius: 5px;
  background: rgba(156, 47, 34, 0.06);
  font-size: 13px;
}

.annotation-stats-weak li b {
  color: var(--error);
  font-weight: 700;
}

.annotation-stats-meta {
  font-size: 11.5px;
  color: var(--muted);
}

.run-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
  margin-bottom: 12px;
}

.run-card-head > div:first-child {
  display: grid;
  gap: 6px;
}

.run-card-head span {
  color: var(--muted);
  font-size: 0.92rem;
}

.run-card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* prompt profile chip — 顯示在 run 卡片標題、matrix model-source-list、raw json 標題 */
.prompt-profile-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  background: rgba(74, 110, 130, 0.10);
  color: var(--ink, #1f2933);
  border: 1px solid rgba(74, 110, 130, 0.22);
  font-size: 11.5px !important;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  width: max-content;
}

.item-table {
  display: grid;
  gap: 8px;
}

.item-table.compact .item-head,
.item-table.compact .item-row {
  padding: 10px 12px;
}

.item-head,
.item-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(60px, 0.58fr));
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
}

.item-head {
  color: var(--muted);
  background: rgba(31, 37, 33, 0.06);
  font-size: 0.92rem;
}

.item-row {
  background: rgba(255, 255, 255, 0.62);
}

.json-details {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.json-details summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.json-details summary::-webkit-details-marker {
  display: none;
}

.json-box {
  overflow: auto;
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: #1f2521;
  color: #e9eadf;
  line-height: 1.5;
}

.placeholder {
  min-height: 420px;
  padding: 28px;
  display: grid;
  align-content: center;
  gap: 10px;
}

.placeholder p,
.empty-state {
  line-height: 1.6;
}

.settings-page {
  grid-template-columns: 1fr;
  justify-content: stretch;
}

.login-shell {
  width: min(520px, calc(100vw - 24px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  align-content: center;
}

.login-card {
  padding: 28px;
  display: grid;
  gap: 18px;
}

.login-brand {
  display: grid;
  gap: 10px;
}

.mobile-body {
  background:
    linear-gradient(180deg, #fff6ea 0%, #f0e3d2 100%);
}

.mobile-shell {
  width: min(100vw, 680px);
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom));
  display: grid;
  gap: 14px;
}

.mobile-hero {
  display: grid;
  gap: 8px;
  padding: 20px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 251, 244, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.mobile-hero h1 {
  font-size: clamp(1.9rem, 8vw, 2.6rem);
}

.mobile-hero p:last-child,
.mobile-hero > p:not(.eyebrow) {
  color: var(--muted);
}

.mobile-capture-card,
.mobile-result-card {
  padding: 18px;
}

.mobile-mode-banner {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
}

.mobile-mode-banner h2 {
  font-size: 1.35rem;
}

.mobile-mode-banner p:last-child {
  color: var(--muted);
  line-height: 1.6;
}

.mobile-picker {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(31, 37, 33, 0.18);
  background: rgba(255, 255, 255, 0.5);
}

.mobile-result-stack {
  display: grid;
  gap: 14px;
}

.mobile-items {
  display: grid;
  gap: 10px;
}

.mobile-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.58);
}

.mobile-item div {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.94rem;
}

.duplicate-banner {
  display: flex;
  gap: 18px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.duplicate-copy {
  min-width: min(720px, 100%);
}

.duplicate-banner p {
  margin-top: 8px;
  color: var(--ink);
  line-height: 1.6;
}

.duplicate-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.duplicate-meta div {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.5);
}

.duplicate-meta dd {
  margin: 0;
  font-weight: 700;
}

.duplicate-form {
  display: grid;
}

.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1000;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 16, 0.8);
  backdrop-filter: blur(4px);
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 1400px);
  max-height: 90vh;
  margin: 0;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 251, 244, 0.98);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.lightbox-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: flex;
  gap: 10px;
}

.lightbox-action,
.lightbox-close {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
  height: 48px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: rgba(31, 37, 33, 0.82);
  cursor: pointer;
  pointer-events: auto;
}

.lightbox-image-stage {
  display: grid;
  place-items: center;
  min-height: calc(90vh - 36px);
  overflow: auto;
}

.lightbox-panel img {
  width: 100%;
  max-height: calc(90vh - 36px);
  object-fit: contain;
  display: block;
  border-radius: var(--radius-md);
  transition: transform 180ms ease;
  transform-origin: center;
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 4;
  width: 48px;
  min-width: 48px;
  padding: 0;
  font-size: 1.8rem;
  line-height: 48px;
  text-align: center;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1280px) {
  .topbar,
  .dashboard-grid,
  .workspace-grid,
  .overview-grid,
  .management-grid,
  .settings-layout,
  .settings-headline {
    grid-template-columns: 1fr;
  }

  .settings-side {
    position: static;
  }

  .preview-panel,
  .sidebar {
    position: static;
  }
}

@media (max-width: 980px) {
  .searchbar,
  .stats-grid,
  .tool-card-grid,
  .settings-grid,
  .model-config-grid,
  .settings-summary-grid,
  .vendor-grid,
  .vendor-intro,
  .vendor-card-head,
  .vendor-metrics,
  .dashboard-grid,
  .compare-health-strip {
    grid-template-columns: 1fr;
  }

  .settings-span-2 {
    grid-column: span 1;
  }

  .multi-select-panel {
    position: static;
    width: 100%;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 18px, 1540px);
    padding-top: 14px;
  }

  .topbar,
  .page-head {
    grid-template-columns: 1fr;
  }

  .asset-row,
  .item-head,
  .item-row {
    grid-template-columns: 1fr;
  }

  .asset-thumb,
  .asset-thumb.compact {
    width: 100%;
    height: 180px;
  }

  .searchbar-actions,
  .settings-actions,
  .settings-block-head,
  .detail-actions,
  .duplicate-actions,
  .vendor-counts,
  .alias-section-head,
  .topbar-userline,
  .summary-list div,
  .run-meta div,
  .stage-head,
  .section-head,
  .run-card-actions,
  .duplicate-banner,
  .topbar-status-strip,
  .page-head-actions {
    flex-direction: column;
    align-items: start;
  }

  .asset-actions {
    justify-items: stretch;
  }

  .tab-nav {
    overflow-x: auto;
    padding-bottom: 4px;
  }
}

/* ============================================================
 * 單據列表頁（sample-grid + sample-card）
 * ============================================================ */

.list-page {
  display: grid;
  gap: 16px;
}

.sample-grid {
  display: grid;
  gap: 12px;
}

.sample-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  transition: box-shadow 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.sample-card:hover {
  border-color: rgba(208, 106, 45, 0.35);
  box-shadow: 0 8px 22px rgba(74, 53, 30, 0.08);
  transform: translateY(-1px);
}

.sample-thumb {
  width: 96px;
  height: 96px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: zoom-in;
  overflow: hidden;
  align-self: start;
}

.sample-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sample-body {
  display: grid;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: 2px;
  margin: -2px;
}

.sample-body:hover {
  color: var(--accent-deep);
}

.sample-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px 14px;
}

.sample-field {
  display: flex;
  gap: 6px;
  align-items: baseline;
  min-width: 0;
  font-size: 0.92rem;
  line-height: 1.4;
}

.sample-field dt {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.sample-field dt::after {
  content: "：";
  color: var(--muted);
}

.sample-field dd {
  color: var(--ink);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}

.sample-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 0.85rem;
  color: var(--muted);
}

.sample-footer .sample-meta {
  display: inline-flex;
  align-items: center;
}

.gt-state-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.gt-state-badge.ready {
  background: rgba(111, 164, 132, 0.16);
  color: #2e6d47;
}

.gt-state-badge.missing {
  background: rgba(193, 142, 74, 0.12);
  color: #8b5d1d;
}

.sample-footer .sample-meta + .sample-meta::before {
  content: "·";
  margin: 0 8px;
  color: var(--line);
}

.sample-filename,
.sample-uploadtime {
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
  opacity: 0.78;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 6px;
}

.pagination-top {
  padding-top: 0;
  padding-bottom: 6px;
}

.pagination-summary {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.page-numbers {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.88rem;
  text-decoration: none;
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.page-chip:hover {
  border-color: rgba(208, 106, 45, 0.35);
  transform: translateY(-1px);
}

.page-chip.active {
  background: rgba(208, 106, 45, 0.12);
  border-color: rgba(208, 106, 45, 0.28);
  color: var(--accent-deep);
  font-weight: 700;
}

.page-chip.disabled {
  color: rgba(96, 103, 104, 0.5);
  background: rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

.page-gap {
  color: var(--muted);
  font-size: 0.88rem;
}

/* 樣本編號 #N — 卡片最上一橫排，跨整張寬度、靠左對齊
 * 用 grid-template-areas 把 header 排成第一 row，photo 跟 body 在第二 row
 * 不用 position:absolute，避免被 sample-body 的 grid flow 撞到
 */
.sample-card {
  grid-template-rows: auto auto;
  grid-template-areas:
    "header header"
    "thumb  body";
  row-gap: 6px;
  align-items: start;       /* photo 不要被拉長到 body 高度 */
}

.sample-id-tag {
  grid-area: header;
  justify-self: start;
  font-family: "Space Grotesk", monospace;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent-deep);
  letter-spacing: 0.04em;
  user-select: text;
  cursor: text;
}

.sample-thumb {
  grid-area: thumb;
}

.sample-body {
  grid-area: body;
}

/* ============================================================
 * 單據詳細比較頁（detail-page）
 * ============================================================ */

.detail-page {
  display: grid;
  gap: 14px;
}

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

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 4px 0;
}

.back-link:hover {
  color: var(--accent-deep);
}

.detail-pager {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-pager-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 82px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.detail-pager-link:hover {
  border-color: rgba(208, 106, 45, 0.35);
  color: var(--accent-deep);
}

.detail-pager-link.disabled {
  color: rgba(96, 103, 104, 0.5);
  background: rgba(255, 255, 255, 0.4);
  pointer-events: none;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 20px;
}

.detail-title-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.detail-id-tag {
  position: static;
}

.detail-title h2 {
  font-size: clamp(1.3rem, 2vw, 1.6rem);
  line-height: 1.2;
  margin-bottom: 6px;
}

.detail-subline {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.88rem;
}

.detail-subline span + span::before {
  content: "·";
  margin-right: 8px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.overflow-menu {
  position: relative;
}

.overflow-menu summary {
  list-style: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
  background: var(--paper);
  color: var(--muted);
  user-select: none;
}

.overflow-menu summary::-webkit-details-marker {
  display: none;
}

.overflow-menu summary:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.overflow-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  padding: 8px;
  display: grid;
  gap: 4px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 20;
}

.overflow-panel button,
.overflow-panel .ghost-link {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.notice-banner {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  border: 1px solid transparent;
}

.notice-banner.success {
  background: var(--green-bg);
  color: var(--green);
  border-color: rgba(47, 107, 68, 0.18);
}

.notice-banner.warning {
  background: var(--amber-bg);
  color: var(--amber);
  border-color: rgba(153, 101, 21, 0.22);
}

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

.detail-left {
  display: grid;
  gap: 12px;
  /* 跟著右側 runs / 標註面板捲動 — 圖片黏在上方,使用者比對欄位時不用一直回捲頂端。
   * 注意:不能設 overflow:auto,否則會把 hover-zoom 放大的圖片切掉 */
  position: sticky;
  top: 16px;
  align-self: start;
}

.detail-right {
  display: grid;
  gap: 12px;
}

.detail-image {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg);
  cursor: zoom-in;
  overflow: hidden;
}

.detail-image img {
  display: block;
  width: 100%;
  height: auto;
  /* 基底 1.5x — 從 64vh 拉到 96vh,讓照片預設就佔比較大 */
  max-height: 96vh;
  object-fit: contain;
  background: var(--bg);
}

/* Hover-pan-zoom — 圖片在容器內 scale 2.5x,框不變大、不溢出右邊區塊。
 * 滑鼠在圖上移動 → JS 更新 transform-origin 跟著焦點走,等於用滑鼠掃描放大區域。 */
.detail-image-hover-zoom {
  overflow: hidden;
  position: relative;
  cursor: zoom-in;
}

.detail-image-hover-zoom img {
  /* origin 由 JS 在 mousemove 時即時改寫;預設置中只是 fallback */
  transform-origin: 50% 50%;
  transition: transform 0.18s ease;
  will-change: transform;
}

.detail-image-hover-zoom:hover img {
  transform: scale(2.5);
}

.detail-info {
  padding: 14px 18px;
}

.detail-info h3 {
  font-size: 1rem;
  margin-bottom: 10px;
}

/* ============================================================
 * 模型辨識對照表（matrix-panel）
 * ============================================================ */

.matrix-panel {
  padding: 14px 18px;
}

.matrix-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.matrix-head h3 {
  font-size: 1rem;
}

.matrix-head .muted {
  color: var(--muted);
  font-size: 0.86rem;
}

.matrix-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
}

.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  table-layout: fixed;
}

.matrix-table thead th {
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 2;
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}

.matrix-table thead th.matrix-row-label {
  text-align: left;
  z-index: 3;
  left: 0;
}

.matrix-table td,
.matrix-table th {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(31, 37, 33, 0.06);
}

.matrix-row-label {
  position: sticky;
  left: 0;
  background: var(--paper);
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  z-index: 1;
  min-width: 90px;
  border-right: 1px solid var(--line);
}

.matrix-table tbody tr:hover .matrix-row-label,
.matrix-table tbody tr:hover td {
  background: rgba(208, 106, 45, 0.04);
}

.matrix-cell {
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 0;
  transition: width 0.18s ease, background 0.18s ease;
}

.matrix-cell.missing {
  color: var(--error);
  font-weight: 500;
}

.matrix-cell.diff-value {
  color: var(--accent-deep);
  font-weight: 600;
}

.matrix-cell.value {
  color: var(--ink);
}

/* Column focus 互動 ——
 * 表頭 / cell 加上 data-col，點選後 JS 把對應 <col> 拉寬到 52%、其他 col 平分 48%。
 * 只在 data-focusable（>= 2 個 model 欄）時生效，cursor 顯示 zoom-in。
 */
.matrix-table[data-focusable] thead th.matrix-col-head,
.matrix-table[data-focusable] tbody td[data-col] {
  cursor: zoom-in;
}

.matrix-table[data-focusable].has-focus thead th[data-col]:not(.col-focused),
.matrix-table[data-focusable].has-focus tbody td[data-col]:not(.col-focused) {
  cursor: zoom-out;
  opacity: 0.78;
}

.matrix-table .col-focused {
  background: rgba(208, 106, 45, 0.08) !important;
}

.matrix-table thead th.col-focused {
  border-bottom: 2px solid var(--accent);
  color: var(--accent-deep);
}

.matrix-table tbody td.matrix-cell.col-focused {
  white-space: normal;
  word-break: break-word;
  font-weight: 600;
}

.matrix-table tbody tr.is-diff .matrix-row-label,
.matrix-table tbody tr.is-diff td {
  background: rgba(208, 106, 45, 0.06);
}

.matrix-table tbody tr.is-diff .matrix-row-label {
  color: var(--accent-deep);
  font-weight: 600;
}

.matrix-completeness td {
  text-align: center;
  padding: 10px 10px 14px;
}

.matrix-completeness td strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--ink);
}

.completeness-bar {
  display: block;
  height: 4px;
  background: var(--line);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.completeness-bar .fill {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: var(--radius-pill);
  transition: width 0.2s ease;
}

.model-source-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}

.model-source-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.model-source-list li strong {
  min-width: 24px;
  color: var(--accent-deep);
}

.model-source-list li span {
  color: var(--muted);
  flex: 1 1 auto;
  min-width: 0;
}

.disclosure {
  padding: 0;
}

.disclosure > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 500;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.disclosure > summary::-webkit-details-marker {
  display: none;
}

.disclosure > summary::before {
  content: "▸";
  color: var(--muted);
  transition: transform 0.16s ease;
  display: inline-block;
}

.disclosure[open] > summary::before {
  transform: rotate(90deg);
}

.disclosure[open] {
  padding-bottom: 12px;
}

.disclosure[open] > *:not(summary) {
  padding-left: 16px;
  padding-right: 16px;
}

.raw-json-stack {
  display: grid;
  gap: 12px;
}

.raw-json-block h4 {
  font-size: 0.9rem;
  margin: 0 0 6px;
  color: var(--accent-deep);
}

/* ============================================================
 * Responsive — sample card / detail-grid
 * ============================================================ */

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

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

@media (max-width: 640px) {
  .sample-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "thumb"
      "body";
  }

  .sample-thumb {
    width: 100%;
    height: 200px;
  }

  .sample-fields {
    grid-template-columns: 1fr;
  }

  .detail-head {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ============================================================
 * Mobile (end-user) — namespace .m-*
 * 設計原則：大留白、柔和、零工程感、轉場順
 * ============================================================ */

.m-body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Noto Sans TC", sans-serif;
  background:
    radial-gradient(circle at top right, rgba(208, 106, 45, 0.12), transparent 55%),
    linear-gradient(180deg, #fdf9f1 0%, #f6efe2 100%);
  font-size: 17px;
  line-height: 1.55;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* [hidden] 屬性必須蓋掉 .m-* 元件自己宣告的 display 規則
 * (.m-lightbox display:flex / .m-banner display:grid / .m-success-flash display:inline-flex / .m-total-card display:flex 等)
 * 沒這條，hidden 元素會從頁面打開就可見、蓋住其他內容。
 */
.m-body [hidden] {
  display: none !important;
}

.m-lock-scroll {
  overflow: hidden;
}

.m-screen {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: block;
  animation: m-screen-in 280ms cubic-bezier(.2,.7,.3,1);
}

.m-screen[hidden] {
  display: none;
}

@keyframes m-screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.m-screen-inner {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 32px 24px 48px;
  display: grid;
  gap: 24px;
}

/* ---- 主頁 ---- */
.m-hero {
  text-align: center;
  display: grid;
  gap: 6px;
  padding-top: 24px;
}

.m-hero h1 {
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.m-hero p {
  color: var(--muted);
  font-size: 15px;
}

.m-illustration {
  display: flex;
  justify-content: center;
  padding: 12px 0 16px;
}

.m-illustration svg {
  width: 168px;
  height: 168px;
  filter: drop-shadow(0 12px 28px rgba(208, 106, 45, 0.18));
}

.m-actions {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.m-cta-primary {
  width: 100%;
  max-width: 380px;
  min-height: 60px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #d97b3a 0%, #c25920 100%);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  font-family: "Noto Sans TC", sans-serif;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(208, 106, 45, 0.32), 0 2px 6px rgba(140, 69, 27, 0.16);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.m-cta-primary:active {
  transform: scale(0.97);
  box-shadow: 0 6px 16px rgba(208, 106, 45, 0.28);
}

.m-cta-primary:hover {
  filter: brightness(1.04);
}

.m-cta-secondary {
  background: rgba(208, 106, 45, 0.12);
  color: var(--accent-deep);
  box-shadow: none;
}

.m-cta-secondary:hover {
  background: rgba(208, 106, 45, 0.18);
  filter: none;
}

.m-cta-icon {
  font-size: 22px;
  line-height: 1;
}

.m-cta-bottom {
  margin-top: 12px;
}

.m-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 15px;
  font-family: "Noto Sans TC", sans-serif;
  cursor: pointer;
  padding: 8px 16px;
  text-decoration: none;
  text-underline-offset: 4px;
}

.m-link:hover {
  color: var(--accent-deep);
  text-decoration: underline;
}

.m-tiny-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 0;
}

.m-tiny-link:hover {
  color: var(--accent-deep);
}

.m-section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.m-section-head h3,
.m-recent h3,
.m-fields h3,
.m-items h3 {
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0;
}

/* 最近辨識 */
.m-recent-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
  margin: 0 -24px;
  padding-left: 24px;
  padding-right: 24px;
}

.m-recent-row::-webkit-scrollbar {
  display: none;
}

.m-recent-card {
  flex: 0 0 auto;
  width: 88px;
  display: grid;
  gap: 4px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  font-family: "Noto Sans TC", sans-serif;
  scroll-snap-align: start;
  text-align: left;
}

.m-recent-card:active {
  transform: scale(0.96);
}

.m-recent-thumb {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  box-shadow: 0 4px 12px rgba(74, 53, 30, 0.08);
}

.m-recent-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.m-recent-card strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-recent-card small {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 小撇步 */
.m-tips {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.5);
  padding: 0;
  overflow: hidden;
}

.m-tips summary {
  padding: 14px 18px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  color: var(--ink);
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.m-tips summary::-webkit-details-marker {
  display: none;
}

.m-tips summary::after {
  content: "▸";
  color: var(--muted);
  font-size: 14px;
  transition: transform 180ms ease;
}

.m-tips[open] summary::after {
  transform: rotate(90deg);
}

.m-tips ul {
  list-style: none;
  margin: 0;
  padding: 0 18px 18px;
  display: grid;
  gap: 8px;
}

.m-tips li {
  font-size: 14px;
  color: var(--muted);
  padding-left: 22px;
  position: relative;
  line-height: 1.55;
}

.m-tips li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--green);
  font-weight: 700;
}

/* ---- 辨識中 ---- */
.m-screen-loading .m-screen-inner {
  min-height: 100vh;
  min-height: 100dvh;
  align-content: center;
  justify-items: center;
  gap: 24px;
  padding-inline: 16px;
}

.m-loading-preview {
  width: min(100%, 560px);
  height: min(58vh, 520px);
  min-height: 260px;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 15%, rgba(255, 255, 255, 0.78), transparent 58%),
    #f7efe2;
  box-shadow: 0 24px 48px rgba(74, 53, 30, 0.14);
  border: 1px solid var(--line);
}

.m-loading-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.96;
}

.m-scanning-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(180deg, rgba(208, 106, 45, 0), rgba(208, 106, 45, 0.92) 60%, rgba(208, 106, 45, 0));
  box-shadow: 0 0 18px rgba(208, 106, 45, 0.7), 0 0 36px rgba(208, 106, 45, 0.35);
  animation: m-scan 1.8s cubic-bezier(.45,.05,.55,.95) infinite;
}

@keyframes m-scan {
  0% { transform: translateY(0%); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateY(58vh); opacity: 0; }
}

.m-loading-phase {
  font-family: "Noto Sans TC", sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  min-height: 28px;
  transition: opacity 200ms ease;
}

.m-loading-bar {
  width: min(220px, 60vw);
  height: 4px;
  background: rgba(31, 37, 33, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}

.m-loading-bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  border-radius: var(--radius-pill);
  animation: m-bar 1.4s ease-in-out infinite;
}

@keyframes m-bar {
  0% { left: -40%; }
  100% { left: 100%; }
}

.m-loading-hint {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  max-width: 320px;
}

/* ---- 結果頁 ---- */
.m-result-bar {
  width: min(560px, 100%);
  margin: 0 auto;
  padding: 14px 24px 0;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

.m-back {
  min-width: 44px;
  min-height: 44px;
  padding: 0 14px 0 10px;
  border-radius: var(--radius-pill);
  border: none;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(74, 53, 30, 0.08);
  font-family: "Noto Sans TC", sans-serif;
  font-size: 15px;
  font-weight: 600;
}

.m-back:active {
  transform: scale(0.94);
}

.m-screen-result .m-screen-inner {
  padding-top: 12px;
}

.m-success-flash {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
  padding: 8px 16px;
  background: var(--green-bg);
  color: var(--green);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  justify-self: center;
}

.m-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--green);
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
}

.m-fade-in {
  animation: m-fade-in 320ms cubic-bezier(.2,.8,.3,1);
}

.m-fade-out {
  animation: m-fade-out 400ms ease forwards;
}

@keyframes m-fade-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes m-fade-out {
  to { opacity: 0; transform: translateY(-6px); }
}

.m-result-title {
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}

.m-result-subtitle {
  color: var(--muted);
  font-size: 15px;
  margin-top: 4px;
}

.m-result-image {
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: 0 8px 22px rgba(74, 53, 30, 0.08);
  display: block;
}

.m-result-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 48vh;
  object-fit: cover;
}

/* banner */
.m-banner {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: grid;
  gap: 6px;
  border: 1px solid transparent;
}

.m-banner-title {
  font-size: 15px;
  font-weight: 700;
}

.m-banner p {
  font-size: 14px;
  margin: 0;
}

.m-banner-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.m-banner-ok {
  background: var(--green-bg);
  color: var(--green);
  border-color: rgba(47, 107, 68, 0.18);
}

.m-banner-warn {
  background: var(--amber-bg);
  color: var(--amber);
  border-color: rgba(153, 101, 21, 0.22);
}

.m-banner-bad {
  background: var(--error-bg);
  color: var(--error);
  border-color: rgba(156, 47, 34, 0.22);
}

/* 欄位卡 */
.m-fields {
  display: grid;
  gap: 10px;
}

.m-fields-list {
  display: grid;
  gap: 2px;
  background: #fff;
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: 0 4px 14px rgba(74, 53, 30, 0.05);
  border: 1px solid var(--line);
  animation: m-stagger-in 400ms ease both;
}

.m-field {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}

.m-field + .m-field {
  border-top: 1px solid rgba(31, 37, 33, 0.04);
}

.m-field-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.m-field-value {
  font-size: 17px;
  color: var(--ink);
  font-weight: 500;
  word-break: break-word;
}

.m-field-empty .m-field-value {
  color: rgba(31, 37, 33, 0.3);
  font-weight: 400;
}

@keyframes m-stagger-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* total card */
.m-total-card {
  background: linear-gradient(135deg, rgba(208, 106, 45, 0.92), rgba(140, 69, 27, 0.92));
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 24px rgba(208, 106, 45, 0.22);
}

.m-total-label {
  font-size: 13px;
  opacity: 0.88;
  letter-spacing: 0.05em;
}

.m-total-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 商品 */
.m-items {
  display: grid;
  gap: 10px;
}

.m-items-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  margin-left: 4px;
}

.m-items-list {
  display: grid;
  gap: 1px;
  background: var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
}

.m-item {
  background: #fff;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
}

.m-item strong {
  font-size: 15px;
  color: var(--ink);
  font-weight: 600;
}

.m-item span {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---- 錯誤頁 ---- */
.m-error-inner {
  min-height: 80vh;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 16px;
}

.m-error-icon {
  font-size: 56px;
  line-height: 1;
  filter: drop-shadow(0 6px 12px rgba(156, 47, 34, 0.18));
}

.m-screen-error h2 {
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 22px;
  font-weight: 600;
}

.m-screen-error p {
  color: var(--muted);
  max-width: 320px;
}

/* ---- lightbox ---- */
.m-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 14, 8, 0.92);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.m-lightbox img {
  max-width: 100%;
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.m-lightbox-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-size: 24px;
  line-height: 44px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.m-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.24);
}

/* ---- 小螢幕微調 ---- */
@media (max-width: 380px) {
  .m-screen-inner {
    padding: 20px 18px 36px;
  }
  .m-hero h1 {
    font-size: 26px;
  }
  .m-cta-primary {
    font-size: 17px;
    min-height: 56px;
  }
  .m-result-title {
    font-size: 21px;
  }
  .m-field-value {
    font-size: 16px;
  }
}

/* ============================================================
 * Polish pass — typography hierarchy, login, topbar, panel-title
 * 移除冗字後的視覺收緊
 * ============================================================ */

/* Login 頁 */
.login-body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-family: "Noto Sans TC", sans-serif;
  background:
    radial-gradient(circle at 20% 10%, rgba(208, 106, 45, 0.16), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(85, 102, 77, 0.12), transparent 50%),
    linear-gradient(180deg, #fdf9f1 0%, #f3ede3 100%);
  padding: 24px;
}

.login-shell {
  width: 100%;
  max-width: 380px;
}

.login-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: 0 24px 60px rgba(74, 53, 30, 0.10);
  display: grid;
  gap: 24px;
}

.login-brand-name {
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--ink);
}

.login-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(156, 47, 34, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 0;
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-field {
  display: grid;
  gap: 6px;
}

.login-field span {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.login-field input {
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 15px;
  font-family: "Noto Sans TC", sans-serif;
  color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.login-field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(208, 106, 45, 0.15);
}

.login-submit {
  margin-top: 6px;
  height: 46px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #d97b3a 0%, #c25920 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  font-family: "Noto Sans TC", sans-serif;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(208, 106, 45, 0.22);
  transition: filter 120ms ease, transform 120ms ease;
}

.login-submit:hover { filter: brightness(1.04); }
.login-submit:active { transform: scale(0.98); }

/* Topbar 重整 (flat 版 — 第一處 .topbar 已改 display:flex，這裡只補 brand) */
.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  flex-shrink: 0;
}

/* Brand mark — 簡化版：純色橘色方塊 + 一個白色「印章」十字
 * 不再用 inner box；改用 SVG-like 效果讓 logo 像「印」(stamp) 的概念
 */
.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #d97b3a 0%, #b04918 100%);
  box-shadow: 0 2px 6px rgba(208, 106, 45, 0.32);
  position: relative;
  flex-shrink: 0;
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  background: rgba(255, 251, 244, 0.92);
}

.brand-mark::before {
  /* 水平短線 */
  top: 50%;
  left: 6px;
  right: 6px;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
}

.brand-mark::after {
  /* 垂直短線：構成 + 字（像蓋章用的十字定位） */
  top: 6px;
  bottom: 6px;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
}

.brand-name {
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.topbar-status-strip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status.ready .status-dot { animation: status-pulse 2.2s ease-in-out infinite; }

@keyframes status-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.4); }
}

.meta-chip {
  font-size: 12px;
  padding: 6px 10px;
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-weight: 500;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.topbar-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: color 140ms ease, background 140ms ease;
}

.topbar-link:hover {
  color: var(--accent-deep);
  background: rgba(208, 106, 45, 0.06);
}

/* Mode switch button — 視覺暗示「切到不同 mode」(end-user 手機端拍照)
 * 用偏冷的 slate / blue tint 跟主橘色 accent 區隔開，告訴使用者「這是另一個世界」
 */
.mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(67, 87, 100, 0.20);
  background: rgba(67, 87, 100, 0.06);
  color: #3a5060;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background 140ms ease, border-color 140ms ease, transform 80ms ease;
}

.mode-switch:hover {
  background: rgba(67, 87, 100, 0.12);
  border-color: rgba(67, 87, 100, 0.32);
}

.mode-switch:active {
  transform: scale(0.97);
}

.mode-switch svg {
  flex-shrink: 0;
}

.user-chip {
  font-size: 13px;
  padding: 6px 10px;
  background: rgba(67, 87, 70, 0.08);
}

.topbar-logout {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color 140ms ease, background 140ms ease;
}

.topbar-logout:hover {
  color: var(--error);
  background: rgba(156, 47, 34, 0.08);
}

/* Page-nav typography 收緊 */
.page-nav {
  gap: 6px;
  padding: 6px;
}

.page-link {
  padding: 8px 14px;
}

.page-link span {
  font-size: 14px;
  font-weight: 500;
}

.page-link.active span {
  font-weight: 600;
  color: var(--accent-deep);
}

/* 統一的 page-title (h1) */
.page-title {
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: clamp(20px, 1.6vw, 24px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--ink);
  margin: 0;
}

/* page-head 收緊 — 無 panel-shell 包裝 */
.list-page .page-head,
.detail-page .page-head {
  background: none;
  border: none;
  box-shadow: none;
  padding: 4px 4px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.page-head-title {
  display: grid;
  gap: 4px;
}

.page-head-subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

/* 主 CTA：實心橘色 gradient — 整個畫面唯一的 primary action */
.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #d97b3a 0%, #c25920 100%);
  color: #fff;
  font-family: "Noto Sans TC", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(208, 106, 45, 0.24);
  transition: filter 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.primary-button:hover {
  filter: brightness(1.04);
  box-shadow: 0 6px 16px rgba(208, 106, 45, 0.28);
}

.primary-button:active {
  transform: scale(0.97);
}

/* Ghost button：淡灰邊框、白底，給次要動作（匯入測試資料這類）*/
.ghost-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-family: "Noto Sans TC", sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}

.ghost-button:hover {
  color: var(--ink);
  border-color: rgba(31, 37, 33, 0.22);
  background: rgba(31, 37, 33, 0.03);
}

/* panel-title 替代 panel-head — 不寫描述句 */
.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(31, 37, 33, 0.06);
  margin-bottom: 14px;
}

.panel-title h2 {
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink);
}

.panel-title h3 {
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.panel-title .muted {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.title-with-tip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Dashboard stat-card 大字加強 */
.evaluation-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 18px 16px;
  box-shadow: none;
  display: grid;
  gap: 4px;
}

.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat-card-accent {
  background: linear-gradient(135deg, rgba(208, 106, 45, 0.96), rgba(140, 69, 27, 0.96));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(208, 106, 45, 0.22);
}

.stat-card-danger {
  background: linear-gradient(135deg, rgba(156, 47, 34, 0.96), rgba(120, 30, 20, 0.96));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(156, 47, 34, 0.22);
}

.stat-card-danger .stat-label {
  color: rgba(255, 255, 255, 0.85);
}

.stat-card-danger .stat-value {
  color: #fff;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-card-accent .stat-label {
  color: rgba(255, 255, 255, 0.85);
}

.stat-value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--ink);
}

.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(31, 37, 33, 0.14);
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  user-select: none;
}

.stat-card-accent .info-tip,
.stat-card-danger .info-tip {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.24);
  color: rgba(255, 255, 255, 0.92);
}

.info-tip-bubble {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(320px, 60vw);
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 250, 242, 0.98);
  border: 1px solid rgba(31, 37, 33, 0.12);
  color: rgba(31, 37, 33, 0.96);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
  text-align: left;
  box-shadow: 0 14px 34px rgba(38, 34, 27, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
  z-index: 40;
  pointer-events: none;
}

.info-tip:hover .info-tip-bubble,
.info-tip:focus .info-tip-bubble,
.info-tip:focus-within .info-tip-bubble {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.stat-card-accent .stat-value {
  color: #fff;
}

.stat-unit {
  font-size: 18px;
  font-weight: 500;
  margin-left: 2px;
  opacity: 0.7;
}

/* metric-row 重做為水平 bar */
.metric-list {
  display: grid;
  gap: 12px;
}

.metric-row {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(31, 37, 33, 0.06);
  background: rgba(255, 255, 255, 0.42);
}

.metric-row > .metric-row-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.metric-row > .metric-row-head > .metric-row-label {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.metric-row-label strong {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.metric-meta {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.metric-row > .metric-row-bar {
  display: block;
  height: 10px;
  background: rgba(31, 37, 33, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
  min-width: 0;
  width: 100%;
}

.metric-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #c25920, #d97b3a);
  border-radius: var(--radius-pill);
  transition: width 320ms cubic-bezier(.2,.7,.3,1);
}

.metric-bar-fill.is-excellent {
  background: linear-gradient(90deg, #2f8456, #67b67e);
}

.metric-bar-fill.is-good {
  background: linear-gradient(90deg, #4f8f7a, #7fc3aa);
}

.metric-bar-fill.is-warn {
  background: linear-gradient(90deg, #d08b2d, #e4b04f);
}

.metric-bar-fill.is-critical {
  background: linear-gradient(90deg, #c25920, #d97b3a);
}

.metric-row-rate {
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-align: right;
  flex: 0 0 auto;
  min-width: 56px;
}

.metric-row-rate.is-excellent {
  color: #2f8456;
}

.metric-row-rate.is-good {
  color: #3e7a68;
}

.metric-row-rate.is-warn {
  color: #b46d17;
}

.metric-row-rate.is-critical {
  color: #b24b22;
}

.field-accuracy-list {
  gap: 2px;
}

.field-accuracy-list .metric-row-compact {
  display: block !important;
  gap: 8px;
  padding: 14px 0 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  border-bottom: 1px solid rgba(31, 37, 33, 0.08);
}

.field-accuracy-list .metric-row-compact:first-child {
  padding-top: 4px;
}

.field-accuracy-list .metric-row-compact:last-child {
  padding-bottom: 4px;
  border-bottom: 0;
}

.field-accuracy-list .metric-row-compact > .metric-row-head {
  display: flex !important;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.field-accuracy-list .metric-row-compact .metric-row-label {
  gap: 4px;
}

.field-accuracy-list .metric-row-compact .metric-row-label strong {
  font-size: 15px;
  font-weight: 600;
}

.field-accuracy-list .metric-row-compact .metric-meta {
  font-size: 13px;
}

.field-accuracy-list .metric-row-compact > .metric-row-bar {
  display: block !important;
  width: 100% !important;
  height: 12px;
  margin-top: 8px;
}

.field-accuracy-list .metric-row-compact .metric-row-rate {
  min-width: 68px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.summary-meta {
  font-size: 12px;
  color: var(--muted);
}

/* asset-row → 一行可點 (a tag body) */
.compact-row {
  grid-template-columns: 56px 1fr;
  padding: 8px;
  gap: 10px;
  align-items: center;
}

.compact-row .asset-thumb.compact {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
}

.asset-row-body {
  display: grid;
  gap: 4px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.asset-row-body:hover .asset-title strong {
  color: var(--accent-deep);
}

/* Vendor 頁瘦身 */
.vendor-page .vendor-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: var(--paper);
  display: grid;
  gap: 10px;
}

.vendor-card-head {
  display: grid;
  gap: 4px;
}

.vendor-title-block {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.vendor-title-block strong {
  font-size: 16px;
  font-weight: 600;
}

.vendor-id-tag {
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.vendor-metrics {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.unclassified-row {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  text-align: left;
  width: 100%;
  cursor: pointer;
  transition: border-color 140ms ease, transform 80ms ease;
  font-family: "Noto Sans TC", sans-serif;
}

.unclassified-row:hover {
  border-color: rgba(208, 106, 45, 0.45);
  background: rgba(208, 106, 45, 0.04);
}

.unclassified-row:active {
  transform: scale(0.98);
}

.unclassified-row strong {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

.unclassified-row span {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.unclassified-list {
  display: grid;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}

.panel-helper {
  font-size: 13px;
  color: var(--muted);
  margin: -8px 0 12px;
}

/* Settings 頁簡化 */
.settings-page {
  display: grid;
  place-items: start center;
  padding-top: 8px;
}

.settings-hero {
  width: 100%;
  max-width: 680px;
  padding: 28px 32px 32px;
}

.settings-maintenance-grid {
  width: 100%;
  max-width: 680px;
  display: grid;
  gap: 16px;
}

.prompt-admin-panel {
  width: 100%;
  max-width: 680px;
  padding: 24px 28px;
}

.prompt-admin-create,
.prompt-admin-edit {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
  overflow: hidden;
}

.prompt-admin-create {
  margin-top: 16px;
}

.prompt-admin-create summary,
.prompt-admin-edit summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 800;
  color: var(--forest);
  list-style-position: inside;
}

.prompt-admin-form {
  padding: 16px;
  border-top: 1px solid var(--line);
}

.prompt-admin-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.prompt-admin-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  overflow: hidden;
}

.prompt-admin-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
}

.prompt-admin-card-head div:first-child {
  display: grid;
  gap: 4px;
}

.prompt-admin-card-head strong {
  color: var(--ink);
  font-size: 14px;
}

.prompt-admin-card-head span {
  color: var(--muted);
  font-size: 12px;
}

.prompt-admin-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.prompt-admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.prompt-admin-badge.builtin,
.prompt-admin-badge.active {
  color: var(--forest);
  background: rgba(78, 111, 86, 0.1);
  border-color: rgba(78, 111, 86, 0.16);
}

.prompt-admin-badge.muted {
  opacity: 0.65;
}

.prompt-admin-warning {
  margin: 0 16px 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(153, 101, 21, 0.08);
  border: 1px solid rgba(153, 101, 21, 0.16);
  color: var(--amber);
  font-size: 12.5px;
  line-height: 1.5;
}

.prompt-admin-edit {
  margin: 0 16px 16px;
}

.prompt-admin-reset {
  padding: 0 16px 16px;
}

.compact-toggle {
  min-height: 60px;
  align-items: center;
}

.settings-block {
  margin-bottom: 18px;
}

.settings-block:last-of-type {
  margin-bottom: 0;
}

.nested-label {
  font-size: 12px !important;
  font-weight: 500 !important;
  color: var(--muted) !important;
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.5;
}

.field-optional {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 4px;
}

/* 響應式 — stat-card 在窄畫面 2 欄 */
@media (max-width: 720px) {
  .evaluation-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stat-value {
    font-size: 26px;
  }
  .metric-row {
    padding: 10px 12px;
  }
  .metric-row > .metric-row-head {
    align-items: start;
  }
  .field-accuracy-list .metric-row-compact {
    padding: 12px 0 14px;
  }
  .field-accuracy-list .metric-row-compact .metric-row-rate {
    font-size: 18px;
    min-width: 60px;
  }
}

@media (max-width: 1100px) {
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
  }
  .page-nav {
    order: 4;
    flex: 1 1 100%;
    overflow-x: auto;
  }
  .topbar-status-strip {
    margin-left: auto;
  }
}

/* ============================================================
 * 匯入進度 panel — list 頁右下角浮動,JS poll /import/progress 即時更新
 * ============================================================ */
.import-progress {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: min(420px, calc(100vw - 32px));
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(74, 53, 30, 0.18);
  z-index: 200;
  overflow: hidden;
  font-size: 14px;
  animation: import-progress-in 320ms cubic-bezier(.2,.7,.3,1);
}

@keyframes import-progress-in {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.import-progress.is-collapsed .import-progress-body {
  display: none;
}

.import-progress.is-aborting {
  filter: saturate(0.5);
}

.import-progress.is-finished {
  border-color: rgba(47, 107, 68, 0.32);
}

.import-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(208, 106, 45, 0.08), transparent);
  border-bottom: 1px solid var(--line);
}

.import-progress-head strong {
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.import-progress-actions {
  display: inline-flex;
  gap: 6px;
}

.import-progress-cancel {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--error);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: "Noto Sans TC", sans-serif;
}

.import-progress-cancel:hover:not(:disabled) {
  background: rgba(156, 47, 34, 0.06);
  border-color: rgba(156, 47, 34, 0.32);
}

.import-progress-cancel:disabled {
  cursor: default;
  color: var(--muted);
  background: rgba(31, 37, 33, 0.04);
}

.import-progress-toggle {
  width: 22px;
  height: 22px;
  padding: 0;
  line-height: 1;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}

.import-progress-body {
  padding: 12px 14px 14px;
  display: grid;
  gap: 10px;
}

.import-progress-meter {
  height: 6px;
  background: rgba(31, 37, 33, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.import-progress-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #c25920, #d97b3a);
  border-radius: var(--radius-pill);
  transition: width 200ms ease;
}

.is-aborting .import-progress-fill {
  background: var(--muted);
}

.is-finished .import-progress-fill {
  background: var(--green);
}

.import-progress-text {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.import-progress-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
}

.import-progress-log li {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 6px;
  align-items: baseline;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  line-height: 1.4;
}

.import-progress-log .log-icon {
  font-family: "Space Grotesk", monospace;
  font-weight: 700;
  text-align: center;
}

.import-progress-log .log-file {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-progress-log .log-detail {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.import-progress-log .log-new .log-icon { color: var(--green); }
.import-progress-log .log-dup .log-icon { color: var(--muted); }
.import-progress-log .log-err .log-icon { color: var(--error); }
.import-progress-log .log-err .log-detail { color: var(--error); }

@media (max-width: 640px) {
  .import-progress {
    bottom: 12px;
    right: 12px;
    left: 12px;
    width: auto;
  }
}

/* 設定頁警示 — 當前有 import 任務在跑時提醒 user 設定不會影響正在跑的任務 */
.settings-warning {
  background: var(--amber-bg);
  border: 1px solid rgba(153, 101, 21, 0.24);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: grid;
  gap: 6px;
  max-width: 680px;
  width: 100%;
}

.settings-warning strong {
  color: var(--amber);
  font-size: 14px;
}

.settings-warning p {
  margin: 0;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.55;
}

.settings-warning p strong {
  color: var(--ink);
  font-size: 13px;
}

/* 設定頁 GT 匯出 — 將標準答案整理成外部可讀 JSON ZIP */
.gt-export-zone {
  margin-top: 24px;
  border-color: rgba(78, 111, 86, 0.22);
  background: linear-gradient(180deg, #fff 0%, #f8fbf6 100%);
}

.export-page .gt-export-zone {
  margin-top: 0;
}

.gt-export-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(78, 111, 86, 0.14);
}

.gt-export-head h2,
.gt-export-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
}

.gt-export-head h2 {
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  letter-spacing: -0.04em;
}

.gt-export-head p {
  margin: 6px 0 0;
  max-width: 760px;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.55;
}

.gt-export-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: rgba(78, 111, 86, 0.12);
  color: var(--forest);
  border: 1px solid rgba(78, 111, 86, 0.18);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.gt-export-form {
  padding: 18px 20px 20px;
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(180px, 0.9fr) minmax(260px, 1.4fr);
  gap: 14px;
  align-items: end;
}

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

.gt-export-form [data-gt-export-field][hidden] {
  display: none !important;
}

.gt-export-note {
  display: grid;
  gap: 4px;
  align-self: stretch;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(78, 111, 86, 0.06);
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.5;
}

.gt-export-note strong {
  color: var(--ink);
}

.gt-export-note code {
  color: var(--forest);
  background: rgba(78, 111, 86, 0.1);
  padding: 1px 5px;
  border-radius: 5px;
}

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

  .gt-export-head {
    flex-direction: column;
  }
}

/* 設定頁維護工具 — 統計修補與危險重置共用一套尺寸/間距 */
.repair-zone,
.danger-zone {
  margin-top: 24px;
}

.settings-maintenance-grid .repair-zone,
.settings-maintenance-grid .danger-zone {
  margin-top: 0;
}

.repair-zone {
  border-color: rgba(78, 111, 86, 0.24);
  background: linear-gradient(180deg, #fff 0%, #f8fbf6 100%);
}

.danger-zone {
  border-color: rgba(156, 47, 34, 0.32);
  background: linear-gradient(180deg, #fff 0%, #fff5f3 100%);
}

.danger-zone-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(156, 47, 34, 0.16);
}

.danger-zone-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--error);
  letter-spacing: 0.01em;
}

.repair-zone .danger-zone-head {
  border-bottom-color: rgba(78, 111, 86, 0.16);
}

.repair-zone .danger-zone-head h3 {
  color: var(--forest);
}

.repair-zone .danger-chip {
  background: rgba(78, 111, 86, 0.12);
  color: var(--forest);
  border: 1px solid rgba(78, 111, 86, 0.18);
}

.repair-zone .danger-zone-body code {
  background: rgba(78, 111, 86, 0.1);
  color: var(--forest);
}

.danger-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--error);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.danger-zone-body {
  padding: 18px 20px 20px;
  display: grid;
  gap: 10px;
}

.danger-zone-body p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink);
}

.danger-zone-body code {
  background: rgba(156, 47, 34, 0.08);
  color: var(--error);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12.5px;
}

.danger-zone-keep {
  background: rgba(0, 0, 0, 0.03);
  border-left: 3px solid var(--ink-muted, #cbd5d8);
  padding: 10px 12px;
  border-radius: 4px;
}

.danger-zone-usecase {
  color: var(--ink-soft, #5a6e73);
  font-size: 12.5px !important;
}

.danger-zone-form {
  margin-top: 8px;
}

.danger-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-md);
  background: var(--error);
  color: #fff;
  border: 1px solid rgba(156, 47, 34, 0.4);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.danger-button:hover {
  background: #7e261c;
}

.danger-button:active {
  transform: translateY(1px);
}

.danger-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Force-rerun mode chip — list 頁主 CTA 旁邊跟 import 進度 panel 標題旁邊
 * 紅色警示提醒「目前是強制重跑模式」 */
.force-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(156, 47, 34, 0.24);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: help;
  white-space: nowrap;
}

.force-chip-inline {
  margin-left: 6px;
  font-size: 11px;
  padding: 2px 8px;
}

/* Settings 頁 checkbox toggle (給「強制重跑」用) */
.settings-toggle {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.settings-toggle:hover {
  border-color: rgba(208, 106, 45, 0.32);
  background: rgba(208, 106, 45, 0.03);
}

.settings-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--accent);
}

.settings-toggle-body {
  display: grid;
  gap: 4px;
}

.settings-toggle-body strong {
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
}

.settings-toggle-body small {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

/* Force on 時 settings-toggle 邊框換成警示紅讓使用者知道目前是 ON */
.settings-toggle:has(input:checked) {
  border-color: rgba(156, 47, 34, 0.28);
  background: rgba(156, 47, 34, 0.04);
}

.settings-explainer {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.55);
  overflow: hidden;
}

.settings-explainer summary {
  cursor: pointer;
  padding: 10px 14px;
  color: var(--forest);
  font-size: 13px;
  font-weight: 800;
}

.settings-explainer div {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
}

.settings-explainer p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

/* ============================================================
 * Prompt 模式 — settings 頁 radio cards + preview pane
 * ============================================================ */
.prompt-profile-list {
  display: grid;
  gap: 10px;
}

.prompt-profile-card {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
  overflow: hidden;
}

.prompt-profile-card:hover {
  border-color: rgba(208, 106, 45, 0.28);
  background: rgba(208, 106, 45, 0.03);
}

.prompt-profile-card.is-active {
  border-color: var(--accent);
  background: rgba(208, 106, 45, 0.06);
  box-shadow: 0 0 0 1px rgba(208, 106, 45, 0.18);
}

.prompt-profile-choice {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}

.prompt-profile-card input[type="radio"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: var(--accent);
}

.prompt-profile-meta {
  display: grid;
  gap: 4px;
}

.prompt-profile-meta strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.prompt-profile-tagline {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent-deep);
  letter-spacing: 0.02em;
}

.prompt-profile-description {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}

.prompt-profile-details {
  border-top: 1px solid rgba(31, 37, 33, 0.08);
  background: rgba(255, 255, 255, 0.52);
}

.prompt-profile-details summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 16px 12px 50px;
  color: var(--accent-deep);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  position: relative;
  user-select: none;
}

.prompt-profile-details summary::-webkit-details-marker {
  display: none;
}

.prompt-profile-details summary::before {
  content: "›";
  position: absolute;
  left: 30px;
  top: 9px;
  font-size: 18px;
  line-height: 1;
  transition: transform 140ms ease;
}

.prompt-profile-details[open] summary::before {
  transform: rotate(90deg);
}

.prompt-profile-details[open] {
  padding-bottom: 16px;
}

.prompt-profile-details[open] > :not(summary) {
  margin-left: 50px;
  margin-right: 16px;
}

.prompt-profile-details .prompt-preview-meta,
.prompt-profile-details .prompt-preview-section {
  margin-top: 12px;
}

.prompt-preview-pane {
  display: grid;
  gap: 14px;
}

.prompt-preview-meta {
  display: grid;
  gap: 6px;
  margin: 0;
}

.prompt-preview-meta div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  align-items: baseline;
}

.prompt-preview-meta dt {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.prompt-preview-meta dd {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.55;
}

.prompt-preview-section h4 {
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.prompt-text {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
  background: rgba(31, 37, 33, 0.05);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
  max-height: 260px;
  overflow-y: auto;
}

/* ============================================================
   Playground (/playground) — VLM 測試播放台
   ============================================================ */

.pg-body {
  background: linear-gradient(180deg, #fdf8ef 0%, #faf3e3 100%);
  color: #1f2521;
  font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
  margin: 0;
}

.pg-header {
  background: linear-gradient(135deg, #d06a2d 0%, #c25920 100%);
  color: #fff;
  padding: 22px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 14px rgba(140, 69, 27, 0.18);
}
.pg-header h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.pg-header p { margin: 4px 0 0; font-size: 13px; opacity: 0.92; }
.pg-header-nav a {
  color: rgba(255,255,255,0.92);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.45);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
}
.pg-header-nav a:hover { background: rgba(255,255,255,0.14); }

.pg-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

.pg-step {
  background: #fff;
  border: 1px solid #e8dcc4;
  border-radius: 12px;
  padding: 22px 26px;
  margin-bottom: 20px;
  box-shadow: 0 4px 12px rgba(74, 53, 30, 0.05);
}
.pg-step h2 {
  margin: 0 0 16px;
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #2a2018;
  display: flex;
  align-items: center;
  gap: 10px;
}
.pg-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #d06a2d;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
}

/* Tabs */
.pg-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 2px solid #e8dcc4;
  margin-bottom: 16px;
}
.pg-tab {
  background: none;
  border: none;
  padding: 10px 18px;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #697468;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.pg-tab-active {
  color: #d06a2d;
  border-bottom-color: #d06a2d;
  font-weight: 600;
}
.pg-tab-panel { display: none; }
.pg-tab-panel-active { display: block; }

/* Sample bucket */
.pg-sample-bucket { margin-bottom: 18px; }
.pg-sample-bucket h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: #4a352f;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pg-badge-true {
  background: #b91c1c;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.pg-badge-false {
  background: #15803d;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.pg-sample-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.pg-sample-card {
  background: none;
  border: 2px solid #e8dcc4;
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: border-color 120ms ease, transform 120ms ease;
  font-family: inherit;
}
.pg-sample-card:hover {
  border-color: #d06a2d;
}
.pg-sample-card-active {
  border-color: #d06a2d;
  background: rgba(208, 106, 45, 0.06);
  box-shadow: 0 0 0 3px rgba(208, 106, 45, 0.18);
}
.pg-sample-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  background: #f0e8d8;
}
.pg-sample-card small {
  font-size: 10px;
  color: #697468;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.pg-empty {
  color: #697468;
  font-style: italic;
  margin: 0;
}

/* Upload */
.pg-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border: 2px dashed #d06a2d;
  border-radius: 12px;
  padding: 40px 24px;
  cursor: pointer;
  background: rgba(208, 106, 45, 0.04);
  transition: background 120ms ease;
}
.pg-upload:hover { background: rgba(208, 106, 45, 0.1); }
.pg-upload-cta {
  font-weight: 600;
  color: #d06a2d;
  font-size: 16px;
}
.pg-upload-hint {
  font-size: 13px;
  color: #697468;
}

/* Preview */
.pg-preview {
  margin-top: 16px;
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 14px;
  background: #fbf6ec;
  border: 1px solid #e8dcc4;
  border-radius: 8px;
}
.pg-preview img {
  width: 240px;
  height: 180px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e8dcc4;
}
.pg-preview-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pg-preview-meta strong { font-size: 14px; word-break: break-all; }

.pg-expected {
  display: inline-block;
  font-size: 12px;
  color: #697468;
}
.pg-expected-true {
  color: #b91c1c;
  font-weight: 600;
}
.pg-expected-false {
  color: #15803d;
  font-weight: 600;
}

/* Prompt mode */
.pg-prompt-mode {
  display: flex;
  gap: 18px;
  margin-bottom: 14px;
  font-size: 14px;
}
.pg-prompt-mode label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.pg-field {
  display: block;
  margin-bottom: 14px;
}
.pg-field > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #4a352f;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.pg-field select,
.pg-field input[type="number"],
.pg-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e8dcc4;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  background: #fbf6ec;
  box-sizing: border-box;
}
.pg-field textarea {
  font-family: "JetBrains Mono", "SF Mono", monospace;
  font-size: 12.5px;
  line-height: 1.55;
  resize: vertical;
}
.pg-field select:focus,
.pg-field input:focus,
.pg-field textarea:focus {
  outline: none;
  border-color: #d06a2d;
  background: #fff;
}

.pg-profile-detail {
  margin-top: 12px;
  background: #fbf6ec;
  border: 1px solid #e8dcc4;
  border-radius: 6px;
  padding: 10px 12px;
}
.pg-profile-detail summary {
  cursor: pointer;
  font-size: 13px;
  color: #4a352f;
  font-weight: 500;
}
.pg-profile-detail h4 {
  font-size: 11px;
  color: #697468;
  margin: 12px 0 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.pg-profile-detail pre {
  background: #fff;
  border: 1px solid #ebe1ce;
  border-radius: 4px;
  padding: 10px 12px;
  font-family: "JetBrains Mono", "SF Mono", monospace;
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  max-height: 200px;
  overflow-y: auto;
  color: #2a2018;
}

.pg-hint {
  font-size: 12px;
  color: #697468;
  margin: 8px 0;
}
.pg-hint button {
  background: none;
  border: 1px solid #d06a2d;
  color: #d06a2d;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
}
.pg-hint button:hover { background: rgba(208, 106, 45, 0.08); }
.pg-hint a {
  color: #c25920;
  text-decoration: underline;
}

.pg-params {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.pg-params .pg-hint { grid-column: 1 / -1; margin: 0; }

/* Run button */
.pg-run {
  text-align: center;
  background: none;
  border: none;
  box-shadow: none;
  padding: 0;
}
.pg-cta {
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(180deg, #d97b3a 0%, #c25920 100%);
  color: #fff;
  border: none;
  padding: 18px 60px;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(208, 106, 45, 0.32);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.pg-cta:hover { transform: translateY(-1px); }
.pg-cta:active { transform: scale(0.97); }
.pg-cta:disabled {
  background: #d6cbb7;
  color: #fff;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Busy */
.pg-busy {
  text-align: center;
  padding: 30px;
  color: #4a352f;
}
.pg-busy-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border: 4px solid #e8dcc4;
  border-top-color: #d06a2d;
  border-radius: 50%;
  animation: pg-spin 0.9s linear infinite;
}
@keyframes pg-spin { to { transform: rotate(360deg); } }

/* Result */
.pg-result {
  background: #fff;
  border: 1px solid #e8dcc4;
  border-radius: 12px;
  padding: 26px;
  box-shadow: 0 4px 14px rgba(74, 53, 30, 0.06);
}
.pg-result h2 {
  margin: 0 0 16px;
  font-family: "Space Grotesk", "Noto Sans TC", sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #2a2018;
}

.pg-result-badges {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.pg-risk-badge {
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  font-weight: 700;
  padding: 14px 28px;
  border-radius: 10px;
  color: #fff;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
}
.pg-risk-critical { background: #991b1b; }
.pg-risk-high     { background: #c2410c; }
.pg-risk-medium   { background: #ca8a04; }
.pg-risk-low      { background: #15803d; }
.pg-risk-info     { background: #5b6d5f; }
.pg-risk-error    { background: #475569; }

.pg-expected-cmp {
  font-size: 14px;
  color: #4a352f;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #fbf6ec;
  border: 1px solid #e8dcc4;
  border-radius: 8px;
  padding: 10px 14px;
}
.pg-verdict-correct { color: #15803d; font-weight: 700; }
.pg-verdict-wrong { color: #b91c1c; font-weight: 700; }

.pg-result-fields {
  background: #fbf6ec;
  border: 1px solid #e8dcc4;
  border-radius: 8px;
  padding: 12px 16px;
  font-family: "JetBrains Mono", "SF Mono", monospace;
  font-size: 13px;
  margin-bottom: 14px;
}
.pg-field-row {
  display: flex;
  padding: 4px 0;
  border-bottom: 1px dashed #e8dcc4;
}
.pg-field-row:last-child { border-bottom: none; }
.pg-field-key {
  font-weight: 600;
  color: #8c451b;
  width: 220px;
  flex-shrink: 0;
}
.pg-field-val {
  color: #2a2018;
  word-break: break-word;
}

.pg-result-meta {
  display: flex;
  gap: 24px;
  font-size: 13px;
  color: #697468;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.pg-raw {
  border-top: 1px solid #e8dcc4;
  padding-top: 14px;
}
.pg-raw summary {
  cursor: pointer;
  font-size: 13px;
  color: #4a352f;
  font-weight: 500;
}
.pg-raw pre {
  margin-top: 10px;
  background: #fbf6ec;
  border: 1px solid #e8dcc4;
  border-radius: 6px;
  padding: 12px;
  font-family: "JetBrains Mono", "SF Mono", monospace;
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow-y: auto;
  color: #2a2018;
}

.pg-parse-error {
  background: rgba(185, 28, 28, 0.06);
  border: 1px solid rgba(185, 28, 28, 0.32);
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 12px;
  font-size: 13px;
}
.pg-parse-error pre {
  margin: 6px 0 0;
  font-family: "JetBrains Mono", "SF Mono", monospace;
  font-size: 11.5px;
  white-space: pre-wrap;
}

