:root {
  --bg: #f3efe6;
  --ink: #1c2430;
  --muted: #5d6b7c;
  --card: #fffdf8;
  --line: #d9d0c0;
  --accent: #0f4c5c;
  --accent-2: #b08900;
  --danger: #9b2226;
  --ok: #2a6f4e;
  --shadow: 0 10px 30px rgba(28, 36, 48, 0.08);
  --font: "Hiragino Sans", "Noto Sans JP", "Noto Sans SC", "Microsoft YaHei", "Yu Gothic UI", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, rgba(176,137,0,.12), transparent 35%),
    radial-gradient(circle at 90% 0%, rgba(15,76,92,.10), transparent 30%),
    linear-gradient(180deg, #f7f3ea, #efe8da 40%, #f3efe6);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px; border-bottom: 1px solid var(--line);
  background: rgba(255,253,248,.96);
  position: sticky; top: 0; z-index: 10;
  gap: 16px;
}
.topbar-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand { font-weight: 700; letter-spacing: .04em; min-width: 0; }
.brand small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; margin-top: 2px; max-width: 520px; }
.brand-page { display: none; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-toggle, .chat-history-toggle {
  display: none; width: 42px; height: 42px; padding: 0;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  cursor: pointer; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.nav-toggle span:not(.sr-only),
.chat-history-toggle span:not(.sr-only) {
  display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px;
}
.chat-history-toggle span:not(.sr-only) { width: 11px; }
.chat-history-toggle[aria-expanded="true"] {
  background: #e8f1f3;
  border-color: #b7cdd3;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.nav { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.nav a { padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.nav a:hover, .nav a.active { background: #e8f1f3; color: var(--accent); }
.nav-drawer-head, .nav-mask { display: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 24px 18px 48px; }
.price-page h1 { margin: 0 0 8px; font-size: 22px; }
.price-page .lead { margin: 0 0 10px; line-height: 1.55; max-width: 920px; }
.price-page .note {
  margin: 0 0 16px; padding: 10px 12px; border-radius: 10px;
  background: #f4ead3; color: #5a4a22; font-size: 13px; line-height: 1.5;
}
.price-page .card { padding: 18px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 16px; }
.price-page .card h2 { margin: 0; font-size: 20px; }
.price-page .card > p.muted { margin: 0; }
.price-page .card h3 {
  margin: 0; font-size: 14px; color: var(--ink); font-weight: 700;
}
.price-section {
  display: flex; flex-direction: column; gap: 10px;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.price-page .stack { margin: 0; }
.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 12px; margin: 0;
  background: #f6f1e6; border: 1px solid var(--line); border-radius: 12px;
}
.toolbar .field { margin: 0; flex: 1 1 140px; }
.toolbar .field.grow { flex: 1 1 180px; }
.toolbar .field.narrow { flex: 0 0 120px; min-width: 100px; }
.toolbar .btn { height: 40px; white-space: nowrap; }
.market-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
}
.market-bar form { margin: 0; }
.market-meta { margin: 0; flex: 1 1 280px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.price-split { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(0, 1.2fr); gap: 14px; }
.table-wrap {
  max-height: 440px; overflow: auto;
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
.table-wrap table { margin: 0; }
.table-wrap th {
  position: sticky; top: 0; z-index: 1;
  background: #faf6ee;
}
table.compact th, table.compact td { padding: 7px 8px; }
.table-wrap .price-inline { max-width: none; }
.grid { display: grid; gap: 16px; }
.grid.stats { grid-template-columns: repeat(4, 1fr); }
.grid.two { grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); align-items: start; }
.grid.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.stack { display: grid; gap: 16px; margin: 16px 0; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px; box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0 0 12px; font-size: 18px; }
.card > p.muted { margin: 0 0 12px; }
.muted { color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 10px; padding: 10px 14px; cursor: pointer;
  background: var(--accent); color: #fff; font-weight: 600;
}
.btn.secondary { background: #e7e1d4; color: var(--ink); }
.btn.warn { background: var(--accent-2); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.table-actions {
  white-space: nowrap;
  vertical-align: middle;
  width: 1%;
}
.row-actions {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
}
.row-actions form { display: inline-flex; margin: 0; }
.price-inline {
  width: 100%; max-width: 160px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; font: inherit; text-align: left;
}
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; font: inherit;
}
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field { margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.equal-cols { table-layout: auto; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; }
.flash.ok { background: #e7f5ee; color: var(--ok); }
.flash.error { background: #fdecee; color: var(--danger); }
.login-split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 480px);
}
.login-visual {
  position: relative;
  background:
    linear-gradient(180deg, rgba(12, 22, 28, .18), rgba(12, 22, 28, .45)),
    url("/assets/login-jewelry.png") center / cover no-repeat;
}
.login-visual-copy {
  position: absolute; left: 32px; bottom: 36px; right: 32px;
  color: #fff;
  text-shadow: 0 8px 24px rgba(0,0,0,.45);
}
.login-visual-copy .company { font-size: 28px; font-weight: 800; margin: 0 0 8px; }
.login-visual-copy p { margin: 0; line-height: 1.55; max-width: 420px; }
.login-panel {
  position: relative;
  display: grid;
  place-items: center;
  padding: 48px 36px;
  background: var(--card);
}
.login-box { width: min(400px, 100%); }
.login-box h1 { margin: 0 0 8px; font-size: 28px; }
.login-box .sysname { color: var(--muted); line-height: 1.5; margin: 0 0 22px; }
.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-row input { flex: 1; min-width: 0; }
.captcha-btn {
  border: 1px solid var(--line); border-radius: 10px; padding: 0; background: #f7f3ea;
  cursor: pointer; height: 44px; overflow: hidden;
}
.captcha-btn img { display: block; height: 44px; width: 140px; }
.login-lang { position: absolute; top: 18px; right: 18px; }
.stat strong { display: block; font-size: 28px; margin-top: 4px; }
a.card.stat { color: inherit; }
a.card.stat:hover { border-color: var(--accent); }
.dash h1 { margin: 0 0 8px; }
.dash-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  margin-bottom: 4px;
}
.dash-head .muted { margin: 0; max-width: 720px; line-height: 1.55; }
.dash-actions { display: flex; flex-wrap: wrap; gap: 8px; flex-shrink: 0; }
/* 内容宽 1144px（wrap 1180 - 左右 18），间距 12×4=48，每格 (1144-48)/5 ≈ 219px */
.grid.stats.dash-stats {
  margin: 18px 0;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.dash-stats .card.stat {
  min-width: 0;
  padding: 14px 12px;
}
.dash-stats .stat strong { font-size: 26px; }
.card-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  margin-bottom: 12px;
}
.card-head h2 { margin: 0; }
.card-head .muted { margin: 6px 0 0; }
.card-head a { font-size: 13px; font-weight: 700; white-space: nowrap; }
.dash-chats { margin-bottom: 16px; }
.dash-gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.dash-shot {
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.dash-shot:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 14px 28px rgba(28, 36, 48, .1);
  color: inherit;
}
.dash-shot-img {
  position: relative; aspect-ratio: 1 / 1;
  background: #ece6d8; overflow: hidden;
}
.dash-shot-img img {
  width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block;
}
.dash-shot-img.is-listing img {
  height: auto;
  object-fit: unset;
  object-position: top center;
  margin-top: -8%;
}
.dash-shot-img .placeholder {
  display: grid; place-items: center; height: 100%;
  color: var(--muted); font-size: 13px;
}
.dash-shot-count {
  position: absolute; top: 8px; right: 8px;
  background: rgba(15, 76, 92, .88); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px;
}
.dash-shot-body { padding: 12px 13px 13px; }
.dash-shot-body h3 {
  margin: 0 0 6px; font-size: 14px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 2.7em;
}
.dash-shot-meta { margin: 0 0 8px; font-size: 12px; color: var(--muted); line-height: 1.4; }
.dash-shot-bid { margin: 0; font-size: 18px; font-weight: 800; color: var(--accent); }
.dash-shot-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; font-size: 12px; color: var(--muted);
}
.dash-empty {
  text-align: center; padding: 28px 12px 12px;
  border: 1px dashed var(--line); border-radius: 12px; background: #faf6ee;
}
.dash-empty p { margin: 0 0 12px; color: var(--muted); }
tr.dash-row { cursor: pointer; }
tr.dash-row:hover td { background: #f3f8f9; }
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  background: #e8f1f3; color: var(--accent); font-size: 12px;
}
.badge.yes { background: #e7f5ee; color: var(--ok); }
.thumb {
  width: 48px; height: 48px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--line); display: block;
}
td.item-title {
  width: 14%;
  min-width: 88px;
  max-width: 160px;
  overflow-wrap: anywhere; word-break: break-word;
  line-height: 1.4; font-size: 13px;
  white-space: normal;
}
.items-table-wrap { max-height: min(82vh, 880px); }
table.items-table { table-layout: fixed; width: 100%; }
.items-table th, .items-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  vertical-align: top;
  line-height: 1.4;
}
.batch-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.items-table th:nth-child(1), .items-table td:nth-child(1) { width: 36px; text-align: center; }
.items-table th:nth-child(2), .items-table td:nth-child(2) { width: 56px; }
.items-table th:nth-child(3), .items-table td:nth-child(3) { width: 92px; }
.items-table th:nth-child(4), .items-table td:nth-child(4) { width: 14%; }
.items-table th:nth-child(5), .items-table td:nth-child(5),
.items-table th:nth-child(6), .items-table td:nth-child(6),
.items-table th:nth-child(7), .items-table td:nth-child(7) { width: 12%; }
.items-table th:nth-child(8), .items-table td:nth-child(8) { width: 12%; }
.items-table th:nth-child(9), .items-table td:nth-child(9) { width: 11%; }
.items-table th:nth-child(10), .items-table td:nth-child(10) { width: 72px; }
.items-table.with-reason th:nth-child(4), .items-table.with-reason td:nth-child(4) { width: 12%; }
.items-table.with-reason th:nth-child(11), .items-table.with-reason td:nth-child(11) { width: 16%; }
.items-table td.col-reason { font-size: 13px; color: var(--muted); }
.items-table tr.is-candidate td { background: #f3faf4; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
#crawlSubmit:disabled { cursor: wait; }
.ai-busy {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(18, 28, 36, .45);
  display: grid; place-items: center;
}
.ai-busy[hidden] { display: none !important; }
.ai-busy-card {
  background: #fff; border-radius: 16px; padding: 28px 32px;
  text-align: center; min-width: 260px;
  box-shadow: 0 16px 40px rgba(0,0,0,.18);
}
.ai-busy-card p { margin: 14px 0 0; font-weight: 600; color: var(--ink); }
.ai-busy-spin {
  width: 40px; height: 40px; margin: 0 auto;
  border: 4px solid #d7e4e8; border-top-color: var(--accent);
  border-radius: 50%;
  animation: aiSpin .8s linear infinite;
}
@keyframes aiSpin { to { transform: rotate(360deg); } }
.dropzone {
  min-height: 160px; border: 2px dashed var(--line); border-radius: 14px;
  background: #fff; padding: 14px; cursor: pointer;
  display: flex; flex-direction: column; align-items: stretch; justify-content: center;
}
.dropzone.dragover { border-color: var(--accent); background: #e8f1f3; }
.dropzone.disabled { opacity: .55; cursor: not-allowed; }
.dropzone-hint { text-align: center; color: var(--muted); font-size: 14px; padding: 28px 8px; }
.dropzone-previews { display: flex; flex-wrap: wrap; gap: 10px; }
.drop-preview { position: relative; width: 88px; height: 88px; }
.drop-preview img {
  width: 88px; height: 88px; object-fit: cover; border-radius: 10px;
  border: 1px solid var(--line); display: block;
}
.drop-preview button {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  border: 0; border-radius: 50%; background: var(--danger); color: #fff;
  cursor: pointer; font-size: 14px; line-height: 22px; padding: 0;
}
.footer-company {
  margin-top: 28px; text-align: center; color: var(--muted); font-size: 13px;
}
.lang-switch {
  display: inline-flex; align-items: stretch; border: 1px solid var(--line);
  border-radius: 999px; overflow: hidden; margin-left: 4px; vertical-align: middle;
}
.lang-switch a {
  padding: 6px 11px; font-size: 12px; font-weight: 700; color: var(--muted);
  background: #fff; border-radius: 0;
}
.lang-switch a.active { background: var(--accent); color: #fff; }
.lang-switch a:hover:not(.active) { background: #e8f1f3; color: var(--accent); }
@media (max-width: 1100px) {
  .dash-gallery { grid-template-columns: repeat(2, 1fr); }
  .chat-history-toggle { display: inline-flex; }
}
@media (max-width: 900px) {
  .grid.stats { grid-template-columns: 1fr; }
  .grid.stats.dash-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .login-split { grid-template-columns: 1fr; }
  .login-visual { min-height: 220px; }
  .dash-head { flex-direction: column; }
  .topbar {
    display: block;
    flex-wrap: nowrap;
    padding: 0;
    gap: 0;
  }
  .topbar.nav-open { z-index: 50; }
  .topbar-row {
    width: 100%;
    justify-content: space-between;
    padding: 8px 12px;
    min-height: 52px;
  }
  .brand { font-size: 15px; line-height: 1.25; }
  .brand-full { display: none !important; }
  .brand-page { display: block; font-size: 12px; font-weight: 600; color: var(--accent); }
  .nav-toggle { display: inline-flex; }
  .chat-history-toggle { display: inline-flex; }
  .nav-toggle span:not(.sr-only) { transition: background .15s ease; }
  .topbar.nav-open .nav-toggle { background: #e8f1f3; border-color: #b7cdd3; }
  .nav-mask {
    display: none;
    position: fixed;
    inset: 52px 0 0 0;
    background: rgba(18, 28, 36, .4);
    z-index: 35;
  }
  .topbar.nav-open + .nav-mask { display: block; }
  .nav-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 0 8px;
    flex-shrink: 0;
  }
  .nav-drawer-head strong { font-size: 18px; }
  .nav-drawer-close {
    width: 36px; height: 36px; padding: 0; border: 0; border-radius: 10px;
    background: #e7e1d4; color: var(--ink); font-size: 22px; line-height: 36px; cursor: pointer;
  }
  .nav {
    display: none;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 4px;
    position: fixed;
    z-index: 40;
    top: 52px;
    right: 0;
    left: auto;
    bottom: auto;
    width: min(88vw, 360px);
    height: calc(100dvh - 52px);
    max-height: calc(100dvh - 52px);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 14px 14px 28px;
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0;
    background: rgba(255,253,248,.96);
    box-shadow: 0 8px 28px rgba(0,0,0,.22);
  }
  .topbar.nav-open .nav { display: flex; }
  .nav > a {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 12px 12px;
    font-size: 16px;
    line-height: 1.35;
    flex: 0 0 auto;
  }
  .nav .lang-switch {
    display: flex;
    width: 100%;
    margin: 10px 0 0;
    align-self: stretch;
    box-sizing: border-box;
  }
  .nav .lang-switch a {
    flex: 1;
    text-align: center;
    padding: 11px 12px;
    font-size: 14px;
  }
  .wrap { padding: 14px 12px 32px; }
}
@media (max-width: 760px) {
  .grid.stats.dash-stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .grid.two, .grid.even { grid-template-columns: 1fr; }
  .price-split { grid-template-columns: 1fr; }
  .toolbar .field.narrow { flex: 1 1 120px; }
  .dash-gallery { grid-template-columns: 1fr; }
}
table.eval-results { table-layout: fixed; width: 100%; }
.eval-results th, .eval-results td { vertical-align: top; }
.eval-results th:nth-child(1), .eval-results td:nth-child(1) { width: 16%; }
.eval-results th:nth-child(2), .eval-results td:nth-child(2) { width: 38%; }
.eval-results th:nth-child(3), .eval-results td:nth-child(3) { width: 88px; text-align: center; }
.eval-results th:nth-child(4), .eval-results td:nth-child(4) { width: 12%; }
.eval-results th:nth-child(5), .eval-results td:nth-child(5) { width: 16%; }
.eval-results th:nth-child(6), .eval-results td:nth-child(6) { width: 96px; }
.eval-results td.col-eval { font-size: 13px; line-height: 1.45; white-space: normal; overflow-wrap: anywhere; }
.eval-results td.col-eval .muted { max-height: none; overflow: visible; white-space: pre-wrap; }
.eval-results td.col-rank { font-size: 20px; font-weight: 700; letter-spacing: .04em; }
.eval-results td.col-bid { font-size: 16px; }
.eval-results td.col-rank select {
  width: 100%;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  padding: 4px 2px;
}
.eval-results td.col-bid input[type="number"] {
  width: 100%;
  max-width: 140px;
  font-size: 15px;
  font-weight: 700;
  box-sizing: border-box;
}
.eval-results td.col-bid .relearn-note {
  display: block;
  width: 100%;
  max-width: 180px;
  margin-top: 6px;
  font-size: 12px;
  box-sizing: border-box;
}
.relearn-inline { margin: 0; }
