:root {
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  color: #182230;
  background: #f3f5f7;
  --navy: #17324d;
  --blue: #176b87;
  --line: #dce2e8;
  --muted: #667085;
  --white: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 0; overflow-x: hidden; }
button, input, select { font: inherit; }
.topbar { position: sticky; top: 0; z-index: 5; height: 82px; padding: 15px 32px; background: var(--navy); color: white; display: flex; justify-content: space-between; align-items: center; }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: .02em; }
.topbar p { margin: 5px 0 0; color: #cbd8e4; font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.log-button { height: 36px; padding: 0 14px; border: 1px solid #49647d; border-radius: 18px; background: transparent; color: white; cursor: pointer; }
.log-button:hover { background: rgba(255,255,255,.1); }
.status-dot { padding: 8px 12px; border: 1px solid #49647d; border-radius: 18px; font-size: 13px; }
.status-dot::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #f1b24a; }
.status-dot.ok::before { background: #55c58a; }
.status-dot.error::before { background: #ef6a6a; }
.tabs { position: sticky; top: 82px; z-index: 5; padding: 0 32px; height: 52px; background: white; border-bottom: 1px solid var(--line); display: flex; gap: 28px; }
.tab { border: 0; background: transparent; color: var(--muted); padding: 0 2px; border-bottom: 3px solid transparent; cursor: pointer; }
.tab.active { color: var(--navy); border-color: var(--blue); font-weight: 700; }
main { padding: 22px 32px 36px; }
.summary { position: sticky; top: 134px; z-index: 4; display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: -22px 0 0; padding: 22px 0 18px; background: #f3f5f7; }
.view-summary { display: none; }
.view-summary.active { display: grid; }
.summary article { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 15px 18px; display: flex; justify-content: space-between; align-items: center; }
.summary span { color: var(--muted); font-size: 13px; }
.summary strong { font-size: 25px; color: var(--navy); }
.view { display: none; }
.view.active { display: block; }
.panel { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 20px; box-shadow: 0 3px 12px rgba(27, 42, 58, .04); }
.panel-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 18px; }
.plan-actions { display: flex; gap: 8px; }
h2 { margin: 0; font-size: 18px; }
.panel-title p, .import-card p, .dialog-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 10px; align-items: end; padding: 14px; background: #f8fafb; border: 1px solid #e6ebef; border-radius: 7px; }
label { display: grid; gap: 6px; font-size: 12px; color: #475467; }
input, select { height: 36px; border: 1px solid #cfd7df; border-radius: 5px; padding: 0 10px; background: white; color: #182230; }
input:focus, select:focus { outline: 2px solid rgba(23,107,135,.18); border-color: var(--blue); }
.button { height: 36px; border: 1px solid var(--blue); border-radius: 5px; padding: 0 15px; background: var(--blue); color: white; cursor: pointer; white-space: nowrap; }
.button:hover { background: #12576f; }
.button:disabled { opacity: .55; cursor: wait; }
.button.secondary, .button.ghost { background: white; color: var(--blue); }
.button.ghost { border-color: #cfd7df; color: #475467; }
.button.danger { border-color: #b42318; background: #b42318; }
.button.danger:hover { background: #912018; }
.batch-bar { margin: 14px 0 10px; display: flex; align-items: center; gap: 10px; min-height: 38px; }
.batch-bar span { margin-right: auto; color: var(--muted); font-size: 13px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 6px; max-height: max(320px, calc(100vh - 430px)); }
.pagination { min-height: 48px; padding-top: 12px; display: flex; justify-content: flex-end; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.pagination label { display: flex; grid: none; align-items: center; gap: 6px; font-size: 13px; }
.pagination select { width: 76px; }
.pagination .button { padding: 0 12px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 1150px; font-size: 13px; }
.logs-dialog { width: min(1100px, 94vw); }
.logs-content { padding: 18px 20px 22px; }
.logs-content .table-wrap { max-height: 68vh; }
.logs-table { min-width: 760px; }
.logs-table td:last-child { min-width: 360px; white-space: normal; }
.dialog-head-actions { display: flex; align-items: center; gap: 8px; }
th { position: sticky; top: 0; z-index: 1; background: #edf2f5; color: #344054; font-weight: 700; text-align: left; }
th, td { padding: 10px 11px; border-bottom: 1px solid #e7ebef; white-space: nowrap; vertical-align: middle; }
.sort-button, .lettering-sort-button { display: inline-flex; align-items: center; gap: 5px; width: 100%; border: 0; padding: 0; background: transparent; color: inherit; font: inherit; font-weight: inherit; text-align: left; cursor: pointer; white-space: nowrap; }
.sort-button span, .lettering-sort-button span { color: #7d8b99; font-size: 12px; }
.plan-sort[aria-sort="ascending"] .sort-button span, .plan-sort[aria-sort="descending"] .sort-button span,
.lettering-plan-sort[aria-sort="ascending"] .lettering-sort-button span, .lettering-plan-sort[aria-sort="descending"] .lettering-sort-button span { color: var(--blue); }
tbody tr:hover { background: #f8fbfc; }
.empty { padding: 32px; text-align: center; color: var(--muted); }
.badge { display: inline-block; border-radius: 12px; padding: 4px 8px; font-size: 12px; background: #eef2f5; color: #475467; }
.badge.good { background: #e6f6ee; color: #18704a; }
.badge.warn { background: #fff3dc; color: #8b5a00; }
.badge.bad { background: #fdeaea; color: #a13c3c; }
.link-button { border: 0; padding: 0; background: transparent; color: var(--blue); cursor: pointer; }
.link-button.danger-link { color: #b42318; }
.row-actions { display: flex; gap: 12px; }
.color-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.import-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.import-card { min-height: 330px; display: flex; flex-direction: column; gap: 20px; }
.import-card a { color: var(--blue); font-size: 13px; }
.file-box { flex: 1; place-content: center; border: 1px dashed #aab7c3; border-radius: 7px; padding: 24px; text-align: center; background: #f9fbfc; cursor: pointer; }
.file-box input { border: 0; display: block; margin: 12px auto 0; width: 100%; max-width: 320px; }
.inline-search { display: flex; gap: 8px; }
.color-search { flex-wrap: wrap; justify-content: flex-end; }
.color-search input { width: 145px; }
.eva-table { min-width: 900px; }
.eva-form label:last-child { grid-column: 1 / -1; }
dialog { width: min(940px, 88vw); border: 0; border-radius: 9px; padding: 0; box-shadow: 0 18px 60px rgba(0,0,0,.24); }
dialog::backdrop { background: rgba(11,25,38,.55); }
.dialog-head { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.icon-button { border: 0; background: transparent; font-size: 26px; cursor: pointer; color: #667085; }
.candidate-list { padding: 18px 20px 22px; display: grid; gap: 10px; max-height: 65vh; overflow: auto; }
.candidate { border: 1px solid var(--line); border-radius: 7px; padding: 13px; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.lettering-list { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.lettering-candidate { min-height: 78px; }
.lettering-values { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lettering-values small { display: block; margin-bottom: 3px; color: var(--muted); }
.candidate dl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 14px; margin: 0; }
.candidate dt { color: var(--muted); font-size: 11px; }
.candidate dd { margin: 2px 0 0; font-size: 13px; }
.color-form { padding: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dialog-actions { padding: 0 20px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 440px; padding: 12px 16px; color: white; background: #263746; border-radius: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.2); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #9c3434; }
@media (max-width: 1250px) {
  .filters { grid-template-columns: repeat(4, 1fr); }
  .import-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .topbar { height: auto; min-height: 76px; padding: 13px 16px; gap: 12px; }
  .topbar h1 { font-size: 19px; }
  .status-dot { padding: 6px 9px; white-space: nowrap; }
  .tabs { top: 76px; height: 48px; padding: 0 16px; gap: 22px; overflow-x: auto; }
  main { padding: 14px 12px 28px; }
  .summary { top: 124px; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: -14px; padding: 14px 0; }
  .summary article { padding: 13px 12px; align-items: flex-start; gap: 8px; flex-direction: column; }
  .summary strong { font-size: 22px; }
  .panel { padding: 14px; }
  .panel-title { align-items: stretch; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-grid { grid-template-columns: 1fr; }
  .table-wrap { max-height: 55vh; }
}
@media (max-width: 520px) {
  .topbar p { display: none; }
  .tabs { gap: 18px; }
  .panel-title { flex-direction: column; }
  .plan-actions { width: 100%; flex-wrap: wrap; }
  .filters { grid-template-columns: 1fr; }
  .filters .button { width: 100%; }
  .batch-bar { align-items: stretch; flex-wrap: wrap; }
  .batch-bar span { flex-basis: 100%; }
  .batch-bar input { flex: 1; min-width: 145px; }
  .pagination { justify-content: flex-start; flex-wrap: wrap; }
  .inline-search { width: 100%; }
  .inline-search input { min-width: 0; flex: 1; }
  .color-search { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .color-search input { width: 100%; }
  .color-search .button { grid-column: 1 / -1; }
  .color-toolbar { width: 100%; align-items: stretch; flex-direction: column; }
  .color-form { grid-template-columns: 1fr; }
  .eva-form label:last-child { grid-column: auto; }
  .candidate dl { grid-template-columns: repeat(2, 1fr); }
}
