:root {
  --bg: #f6f3ed;
  --bg-soft: #efe9df;
  --card: #ffffff;
  --ink: #211f1b;
  --muted: #72685b;
  --line: #e2d9cb;
  --line-strong: #d2c4b1;
  --accent: #8a5a2b;
  --accent-soft: #f3e7d6;
  --green: #2f6f4e;
  --green-soft: #e3f1e8;
  --red: #a23b32;
  --red-soft: #f8e5e2;
  --amber: #a76a1a;
  --amber-soft: #fbf0da;
  --blue: #3d5f7a;
  --blue-soft: #e6eef4;
  --shadow: 0 1px 2px rgba(40, 30, 15, 0.04), 0 8px 28px rgba(40, 30, 15, 0.06);
  --radius: 14px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 30px; }
h2 { font-size: 18px; }
p { margin: 0; }

code, .mono { font-family: var(--mono); font-size: 0.9em; }

.wrap { width: min(1320px, calc(100% - 40px)); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(246, 243, 237, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.topbar-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--ink); color: #fff;
  font-weight: 800; font-size: 12px; letter-spacing: 0.06em;
}
.brand-text { display: flex; flex-direction: column; font-weight: 700; font-size: 15px; line-height: 1.15; }
.brand-text small { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  color: var(--muted); padding: 7px 12px; border-radius: 999px;
  font-weight: 600; font-size: 14px;
}
.nav a:hover { color: var(--ink); background: var(--bg-soft); text-decoration: none; }
.nav a.active { color: var(--ink); background: var(--card); box-shadow: var(--shadow); }

.user { margin-left: auto; color: var(--muted); font-size: 13px; }
.user strong { color: var(--ink); }

.main { padding-top: 30px; padding-bottom: 60px; min-height: calc(100vh - 150px); }

.footer {
  border-top: 1px solid var(--line);
  padding: 18px 0 34px;
  display: flex; justify-content: space-between; gap: 16px;
  color: var(--muted); font-size: 12px;
}

.flash-stack { display: grid; gap: 8px; margin-bottom: 18px; }
.flash {
  padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--card);
  font-size: 14px;
}
.flash-success { background: var(--green-soft); border-color: #bfdccb; color: #23563c; }
.flash-error { background: var(--red-soft); border-color: #ecc6c1; color: #7c2d26; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 22px;
}
.page-head .muted { margin-top: 7px; max-width: 760px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crumb { color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.crumb a { color: var(--muted); }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.break { overflow-wrap: anywhere; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--card);
  color: var(--ink); font: inherit; font-size: 13px; font-weight: 650;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--bg-soft); text-decoration: none; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-primary:hover { background: #3a352d; }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #255c3f; }
.btn-warning { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn-warning:hover { background: #8d5813; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #883027; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--muted); }
.link { color: var(--accent); font-size: 13px; font-weight: 600; }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px; margin-bottom: 18px;
}
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 3px;
  border-top: 3px solid var(--line-strong);
}
.stat-pending { border-top-color: var(--amber); }
.stat-approved { border-top-color: var(--green); }
.stat-rework { border-top-color: var(--blue); }
.stat-rejected { border-top-color: var(--red); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 650; letter-spacing: 0.04em; }
.stat-value { font-size: 32px; line-height: 1.1; letter-spacing: -0.04em; }
.stat-foot { color: var(--muted); font-size: 12px; }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
.panel-compact { padding: 14px 18px; }
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 14px;
}
.panel-head .muted { margin-top: 4px; font-size: 12.5px; }
.big-pct { font-size: 30px; letter-spacing: -0.04em; }

.progress {
  height: 8px; background: var(--bg-soft); border-radius: 999px; overflow: hidden;
}
.progress-lg { height: 12px; }
.progress-bar { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.progress-approved { background: var(--green); }

.mini-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px; margin-top: 14px;
}
.mini-grid > div { display: flex; flex-direction: column; gap: 2px; }
.mini-grid strong { font-size: 18px; letter-spacing: -0.02em; }

.two-col {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 16px; align-items: start;
}

.batch-list { display: grid; gap: 2px; }
.batch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 12px 8px; border-radius: var(--radius-sm); color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.batch-row:last-child { border-bottom: 0; }
.batch-row:hover { background: var(--bg); text-decoration: none; }
.batch-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.batch-row-main .muted { font-size: 12px; }
.batch-row-progress { display: flex; align-items: center; gap: 9px; min-width: 210px; }
.batch-row-progress .progress { flex: 1; }
.batch-row-progress .muted { font-size: 12px; white-space: nowrap; }

.review-list { display: grid; gap: 0; }
.review-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.review-row:last-child { border-bottom: 0; }
.review-row > .muted { grid-column: 1 / -1; }
.review-note {
  grid-column: 1 / -1; margin-top: 4px; padding: 7px 10px;
  background: var(--bg); border-radius: 7px; color: #5b5044; font-size: 12.5px;
}
.review-row strong { margin-right: 6px; }

.empty {
  padding: 26px 16px; text-align: center; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
}
.empty strong { display: block; color: var(--ink); margin-bottom: 5px; }
.empty-large { padding: 60px 20px; margin-top: 8px; }
.empty p { font-size: 13px; }

.tag {
  display: inline-flex; align-items: center; padding: 2px 8px;
  border-radius: 999px; background: var(--bg-soft); color: var(--muted);
  font-size: 11px; font-weight: 650;
}

.badge {
  display: inline-flex; align-items: center; padding: 2px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap;
  background: var(--bg-soft); color: var(--muted);
}
.badge-pending { background: var(--amber-soft); color: #7c4e0f; }
.badge-approved { background: var(--green-soft); color: #23563c; }
.badge-rejected { background: var(--red-soft); color: #7c2d26; }
.badge-rework { background: var(--blue-soft); color: #2e4b62; }
.badge-archived { background: var(--bg-soft); color: var(--muted); }
.badge-latest { background: var(--ink); color: #fff; }
.badge-test { background: #efe3f1; color: #6b3f73; }

.batch-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.batch-card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  color: var(--ink);
}
.batch-card:hover { border-color: var(--line-strong); text-decoration: none; transform: translateY(-1px); }
.batch-card h2 { margin: 8px 0 3px; font-size: 18px; }
.batch-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.batch-card .progress { margin-top: 14px; }
.batch-metrics {
  display: flex; justify-content: space-between; gap: 6px; margin-top: 9px;
  color: var(--muted); font-size: 11.5px;
}
.batch-metrics strong { color: var(--ink); }

.filters {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 130px; }
.field > span { color: var(--muted); font-size: 11.5px; font-weight: 650; }
.field-grow { flex: 1; min-width: 220px; }
select, input[type="search"], input[type="text"], textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--card); color: var(--ink); font: inherit; font-size: 13.5px;
  padding: 8px 10px; outline: none;
}
select:focus, input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 92px; }

.asset-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}
.asset-card {
  display: block; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  color: var(--ink);
}
.asset-card:hover { border-color: var(--line-strong); text-decoration: none; transform: translateY(-1px); }
.asset-thumb {
  position: relative; aspect-ratio: 16 / 9; background: var(--bg-soft); overflow: hidden;
}
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-thumb .badge { position: absolute; top: 9px; left: 9px; }
.corner-tag {
  position: absolute; bottom: 9px; padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 750; letter-spacing: 0.03em;
}
.corner-latest { right: 9px; background: var(--ink); color: #fff; }
.corner-test { left: 9px; background: #efe3f1; color: #6b3f73; }
.asset-card-body { padding: 11px 13px 13px; }
.asset-card-title { display: flex; align-items: baseline; gap: 7px; font-size: 15px; }
.asset-card-title .muted { font-size: 11.5px; }
.asset-name { margin-top: 2px; font-size: 13px; color: #4c443a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 11px; }

.detail-grid {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.75fr);
  gap: 16px; align-items: start;
}
.image-panel { padding: 10px; }
.image-panel img { width: 100%; height: auto; display: block; border-radius: 10px; background: var(--bg-soft); }
.image-foot { display: flex; justify-content: space-between; align-items: center; padding: 9px 4px 2px; font-size: 12px; }
.detail-side { display: grid; gap: 16px; }
.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0; }
.meta > div { padding: 8px 0; border-bottom: 1px solid var(--line); }
.meta > div:nth-last-child(-n+2) { border-bottom: 0; }
.meta dt { color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.meta dd { margin: 0; font-size: 12.5px; overflow-wrap: anywhere; }
.meta-wide { grid-column: 1 / -1; }
.compare-links { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tab {
  border: 0; background: transparent; color: var(--muted); font: inherit;
  font-size: 13px; font-weight: 650; padding: 7px 12px; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.prompt {
  white-space: pre-wrap; overflow-wrap: anywhere; margin: 0;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px 16px; font-family: var(--font); font-size: 13.5px; line-height: 1.7;
  max-height: 460px; overflow: auto;
}

.review-form { display: grid; gap: 10px; }
.check { display: flex; align-items: center; gap: 8px; color: #5b5044; font-size: 13px; }
.check input { width: auto; }
.review-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th, .table td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.row-current { background: #fbf7f0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); display: inline-block; }
.dot-on { background: var(--green); }

.audit-list { display: grid; gap: 0; }
.audit-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.audit-row:last-child { border-bottom: 0; }
.audit-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.audit-row .review-note { margin-top: 6px; }

.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.compare-panel { min-width: 0; }
.compare-img { width: 100%; height: auto; display: block; border-radius: 10px; background: var(--bg-soft); }

.notice {
  background: #fbf4e6; border: 1px solid #ead5b3; color: #6b4a1b;
  border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 16px; font-size: 13px;
}
.notice strong { margin-right: 6px; }

.code { font-family: var(--mono); font-weight: 700; letter-spacing: -0.02em; }

@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col, .detail-grid, .compare-grid { grid-template-columns: 1fr; }
  .mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page-head { align-items: flex-start; flex-direction: column; gap: 12px; }
}

@media (max-width: 640px) {
  .wrap { width: min(100% - 24px, 1320px); }
  .topbar-inner { min-height: 58px; gap: 14px; flex-wrap: wrap; padding: 8px 0; }
  .nav { order: 3; width: 100%; margin-left: 0; }
  .user { display: none; }
  h1 { font-size: 24px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .asset-grid { grid-template-columns: 1fr 1fr; }
  .batch-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .meta { grid-template-columns: 1fr; }
  .meta > div:nth-last-child(-n+2) { border-bottom: 1px solid var(--line); }
  .meta > div:last-child { border-bottom: 0; }
}

@media (max-width: 440px) {
  .asset-grid { grid-template-columns: 1fr; }
  .stat-value { font-size: 26px; }
}

/* login */
.logout-form { display: inline; margin-left: 10px; }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { width: min(360px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px 28px; }
.login-brand { margin-bottom: 20px; }
.login-card h1 { font-size: 20px; margin: 0 0 16px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login-form input { font: inherit; font-size: 15px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); color: var(--ink); background: #fff; }
.login-form input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.login-form .btn { justify-content: center; padding: 10px; font-size: 15px; margin-top: 4px; }
