* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: #e8e8e8;
  color: #222;
}
a { color: #1565c0; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: #3a3a3a;
  color: #eee;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 14px;
}
.topbar .domain { font-weight: bold; color: #fff; }
.topbar .expires { color: #aaa; }
.topbar .qishu { color: #8f8; }
.topbar .top-actions { margin-left: auto; }
.topbar .top-actions a { color: #cde; margin-left: 10px; }
.hide-menu { color: #ccc; }

.layout { display: flex; min-height: calc(100vh - 42px); }
.sidebar {
  width: 132px;
  background: #2b2b2b;
  color: #ffd54f;
  flex-shrink: 0;
}
body.sidebar-hidden .sidebar { display: none; }
.sidebar-title {
  padding: 10px 10px;
  font-weight: bold;
  font-size: 13px;
  border-bottom: 1px solid #444;
  color: #fff;
}
.sidebar ul { list-style: none; margin: 0; padding: 6px 0; }
.sidebar li a, .sidebar li span {
  display: block;
  padding: 8px 10px;
  color: #ffd54f;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-all;
}
.sidebar li.active a {
  background: #c62828;
  color: #fff;
  font-weight: bold;
}
.sidebar li.disabled span { color: #777; }
.sidebar li.disabled small { color: #555; }

.content {
  flex: 1;
  min-width: 0;
  padding: 16px 18px;
  background: #f0f0f0;
  overflow-x: auto;
  font-size: 14px;
}
.content a { color: #1565c0; }

.flash {
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 3px;
  font-size: 14px;
}
.flash.ok { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.flash.err { background: #ffebee; color: #b71c1c; border: 1px solid #ef9a9a; }

h2 { margin: 0 0 12px; font-size: 20px; }
.help { color: #c62828; margin-bottom: 12px; line-height: 1.7; font-size: 14px; }
.toolbar { margin: 10px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toolbar label { margin-right: 6px; }

button, .btn {
  background: #455a64;
  color: #fff;
  border: 0;
  padding: 7px 14px;
  cursor: pointer;
  border-radius: 2px;
  font-size: 14px;
  line-height: 1.3;
}
button.primary, .btn.primary { background: #c62828; }
button:hover, .btn:hover { opacity: 0.9; }
button.danger { background: #b71c1c; }

table.data {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
}
table.data th, table.data td {
  border: 1px solid #ccc;
  padding: 7px 8px;
  vertical-align: top;
}
table.data th { background: #eceff1; white-space: nowrap; }
table.data tr:nth-child(even) { background: #fafafa; }
table.data .title-cell { max-width: 320px; word-break: break-all; }

.form-grid { display: grid; grid-template-columns: 168px 1fr; gap: 10px 14px; max-width: 780px; }
.form-grid label { align-self: center; color: #333; font-size: 14px; }
.form-grid input[type=text],
.form-grid input[type=number],
.form-grid input[type=password],
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #bbb;
  border-radius: 2px;
  font-size: 14px;
}
.form-actions { margin-top: 14px; }

.type-matrix { background: #fff; border: 1px solid #ccc; padding: 10px; }
.type-cat { margin-bottom: 12px; }
.type-cat h3 {
  margin: 0 0 6px;
  font-size: 13px;
  background: #fffde7;
  padding: 4px 8px;
  border-left: 3px solid #f9a825;
}
.type-row { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.type-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #ddd;
  padding: 3px 6px;
  background: #fafafa;
  white-space: nowrap;
}
.type-item input[type=number] { width: 42px; }

/* ===== 发新帖 1:1 WinForms 矩阵 ===== */
.post-new-toolbar {
  background: #e8e8e8;
  border: 1px solid #999;
  padding: 8px 10px;
  margin-bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  font-size: 14px;
}
.post-new-toolbar select,
.post-new-toolbar .qishu-input {
  padding: 3px 5px;
  border: 1px solid #666;
  margin-left: 4px;
  font-size: 14px;
  background: #fff;
}
.post-new-toolbar .qishu-input { width: 72px; }

.type-matrix-table {
  width: 100%;
  border-collapse: collapse;
  background: #d4d4d4;
  border: 1px solid #666;
  font-size: 13px;
  table-layout: fixed;
}
.type-matrix-table th,
.type-matrix-table td {
  border: 1px solid #888;
  padding: 4px 6px;
  vertical-align: middle;
}
.type-matrix-table thead th {
  background: #c8c8c8;
  font-weight: normal;
  text-align: center;
  padding: 6px 8px;
}
.type-matrix-table .col-cat {
  width: 118px;
  text-align: center;
}
.type-matrix-table .col-types-head {
  text-align: left;
  position: relative;
  padding-left: 10px;
}
.type-matrix-table .types-head-label {
  float: right;
  margin-right: 10px;
  color: #222;
  line-height: 24px;
}
.type-matrix-table .btn-hdr {
  background: #e8e8e8;
  border: 1px solid #888;
  color: #222;
  cursor: pointer;
  padding: 2px 12px;
  font-size: 12px;
  margin-right: 6px;
  border-radius: 2px;
}
.type-matrix-table .btn-hdr:hover { background: #d8d8d8; }
.type-matrix-table .btn-import {
  background: #e8e8e8 !important;
  border-color: #888 !important;
  color: #0066cc !important;
  font-weight: bold;
}
.type-matrix-table .btn-import:hover {
  background: #d8d8d8 !important;
  color: #004a99 !important;
}

.type-matrix-table .cat-label {
  background: #cfcfcf;
  text-align: center;
  width: 118px;
  padding: 6px 8px;
  vertical-align: middle;
}
.type-matrix-table .cat-check {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  background: #fff;
  border: 1px solid #999;
  border-radius: 4px;
  padding: 4px 10px;
  margin: 0;
  box-shadow: inset 0 1px 0 #fff;
  white-space: nowrap;
}
.type-matrix-table .cat-check input {
  margin: 0;
  flex-shrink: 0;
}
.type-matrix-table .cat-name {
  font-weight: bold;
  color: #222;
  white-space: nowrap;
  font-size: 13px;
}
.type-matrix-table .cat-test {
  background: #fff59d;
}
.type-matrix-table .cat-test .cat-check {
  background: #fffde7;
  border-color: #c9b458;
}
.type-matrix-table .cat-test-text {
  color: #1565c0;
  font-weight: bold;
}

.type-matrix-table .type-cells {
  background: #d8d8d8;
  padding: 6px 8px;
  vertical-align: top;
}
.type-matrix-table .type-cells-empty {
  background: #fff59d;
}
.type-matrix-table .type-test-row td {
  background: #fff59d;
}
.type-matrix-table .type-chip-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px 8px;
  align-items: center;
}

.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  cursor: pointer;
  margin: 0;
  font-weight: normal;
  background: #efefef;
  border: 1px solid #9a9a9a;
  border-radius: 3px;
  padding: 2px 6px 2px 4px;
  box-shadow: inset 0 1px 0 #fff;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
}
.type-chip input.type-ck {
  margin: 0;
  flex-shrink: 0;
}
.type-chip-label {
  display: inline-block;
  background: transparent;
  border: none;
  padding: 0;
  min-width: 0;
  text-align: left;
  font-size: 13px;
  color: #111;
  line-height: 1.35;
}
.type-chip-missing {
  opacity: 0.55;
  cursor: default;
}
.type-chip-qty {
  width: 28px !important;
  height: 18px;
  padding: 0 2px !important;
  border: 1px solid #666 !important;
  background: #fff !important;
  text-align: center;
  font-size: 12px;
  border-radius: 0 !important;
  flex-shrink: 0;
}
.type-chip-unit {
  color: #333;
  font-size: 12px;
  flex-shrink: 0;
}

.import-box {
  margin-top: 10px;
  background: #fff;
  border: 1px solid #ccc;
  padding: 10px;
}
.import-box textarea { width: 100%; max-width: 640px; font-family: monospace; font-size: 12px; }

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 13px;
}
.badge.pending { background: #fff3e0; color: #e65100; }
.badge.synced { background: #e8f5e9; color: #2e7d32; }
.badge.failed { background: #ffebee; color: #c62828; }
.badge.syncing { background: #e3f2fd; color: #1565c0; }

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #263238;
}
.login-box {
  background: #fff;
  padding: 28px 32px;
  border-radius: 4px;
  width: 340px;
  box-shadow: 0 4px 20px rgba(0,0,0,.3);
}
.login-box h1 { margin: 0 0 16px; font-size: 22px; text-align: center; }
.login-box label { display: block; margin-bottom: 12px; }
.login-box input { width: 100%; padding: 8px; margin-top: 4px; }
.login-box button { width: 100%; padding: 10px; background: #c62828; color: #fff; border: 0; cursor: pointer; }
.login-box .hint { color: #888; font-size: 12px; margin-top: 12px; }

.notice {
  background: #fff;
  border: 1px solid #ccc;
  padding: 14px 16px;
  line-height: 1.7;
}
.notice h3 { margin: 12px 0 6px; color: #1565c0; }
.muted { color: #888; }
.preview-box {
  max-height: 120px;
  overflow: auto;
  font-size: 11px;
  background: #fafafa;
  border: 1px solid #eee;
  padding: 4px;
}

/* ===== 需要同步页 ===== */
.sync-help { margin-bottom: 10px; }
.sync-refresh-box {
  background: #f5f5f5;
  border: 1px solid #bbb;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-size: 14px;
}
.sync-refresh-title { font-weight: bold; margin-bottom: 2px; }
.sync-refresh-note { color: #c62828; margin-bottom: 8px; font-size: 13px; }
.sync-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 4px 0;
}
.sync-filter-label { font-weight: bold; margin-right: 4px; color: #333; }
.sync-actions { margin: 8px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sync-toolbar {
  background: #e8e8e8;
  border: 1px solid #bbb;
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  font-size: 14px;
  margin-bottom: 0;
}
.sync-title-opts { display: inline-flex; align-items: center; gap: 6px; }
.sync-pager { margin-left: auto; color: #444; }
.sync-pager a { color: #1565c0; margin-right: 6px; }
.sync-table-wrap { overflow-x: auto; border: 1px solid #999; background: #fff; }
.sync-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 1200px;
}
.sync-table th, .sync-table td {
  border: 1px solid #ccc;
  padding: 7px 8px;
  vertical-align: top;
  background: #fff;
}
.sync-table th {
  background: linear-gradient(#f0f0f0, #ddd);
  white-space: nowrap;
  font-weight: bold;
  text-align: center;
}
.sync-table .cell-main { margin-bottom: 3px; word-break: break-all; max-width: 240px; }
.sync-table .col-title .cell-main { max-width: 280px; }
.sync-table .col-hist { max-width: 160px; font-size: 13px; color: #555; }

/* ===== 同步结果页（对齐采集器） ===== */
.sync-run-page {
  background: #fff;
  padding: 8px 4px 24px;
  font-size: 14px;
  line-height: 1.7;
}
.sync-run-warn {
  color: #c62828;
  margin-bottom: 6px;
  word-break: break-all;
}
.sync-run-summary {
  color: #c62828;
  font-weight: bold;
  margin: 4px 0 10px;
}
.sync-run-list {
  border-top: 1px solid #eee;
  padding-top: 4px;
}
.sync-run-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 3px 0;
  border-bottom: 1px dotted #e0e0e0;
}
.sync-run-info {
  color: #111;
  flex: 1 1 320px;
  min-width: 200px;
  word-break: break-all;
}
.sync-run-status {
  flex: 0 0 auto;
  min-width: 4.5em;
}
.sync-run-status.ok { color: #111; }
.sync-run-status.err { color: #c62828; font-weight: bold; }
.sync-run-box {
  width: 140px;
  height: 22px;
  border: 1px solid #999;
  background: #fff;
  padding: 1px 4px;
  font-size: 12px;
  color: #333;
}
.sync-run-back { margin-top: 16px; }
.sync-run-back a { color: #1565c0; }
.btn-mini, .btn-link-blue {
  display: inline-block;
  font-size: 13px;
  padding: 2px 8px;
  cursor: pointer;
  border: 1px solid #888;
  background: #eee;
  color: #1565c0;
  border-radius: 2px;
}
.btn-link-blue { border: 0; background: none; text-decoration: underline; padding: 0; }
.col-ops .op-edit {
  display: block;
  color: #c62828;
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 4px;
}
.col-ops .op-preview { color: #1565c0; font-size: 13px; }
.price-num { color: #c62828; font-weight: bold; margin-right: 4px; }
.btn-toggle { border: 1px solid #999; padding: 0 4px; background: #fff; }

/* ===== 编辑帖子 ===== */
.edit-post-page { max-width: 980px; }
.edit-post-title { color: #6a1b9a; font-size: 18px; margin: 0 0 8px; }
.edit-post-icon { margin-right: 6px; }
.edit-tabs { display: flex; gap: 0; margin-bottom: 0; }
.edit-tab {
  display: inline-block;
  padding: 6px 16px;
  background: #e8dcc8;
  border: 1px solid #bbb;
  border-bottom: 0;
  color: #333;
  margin-right: 2px;
}
.edit-tab.active {
  background: #f5a623;
  color: #111;
  font-weight: bold;
}
.edit-toolbar {
  background: #fff8dc;
  border: 1px solid #ccc;
  padding: 4px 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.edit-toolbar .tb {
  background: #fff;
  border: 1px solid #999;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 12px;
}
.edit-src {
  width: 100%;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  border: 2px solid #f0e68c;
  padding: 8px;
  box-sizing: border-box;
  min-height: 360px;
}
.edit-wysiwyg-wrap {
  border: 2px solid #f0e68c;
  background: #fff;
  min-height: 360px;
}
.edit-wysiwyg {
  padding: 10px;
  min-height: 340px;
  outline: none;
  font-size: 13px;
  line-height: 1.6;
}
.edit-foot { margin-top: 10px; }
.edit-save { text-align: center; margin-top: 12px; }
.edit-save .primary { padding: 8px 36px; font-size: 14px; }
.edit-preview-box {
  background: #fff;
  border: 1px solid #ccc;
  padding: 12px;
  line-height: 1.7;
}

.inline-edit-mask {
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.35);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.inline-edit-dialog {
  background: #fff;
  border: 1px solid #888;
  padding: 16px 18px;
  width: 420px;
  max-width: 92vw;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.inline-edit-dialog h3 { margin: 0 0 12px; font-size: 15px; }
.inline-edit-dialog .ie-field { margin-bottom: 10px; }
.inline-edit-dialog label { display: block; margin-bottom: 4px; color: #444; }
.inline-edit-dialog input[type=text],
.inline-edit-dialog input[type=number],
.inline-edit-dialog textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid #999;
  font-size: 13px;
}
.inline-edit-dialog .ie-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 12px;
}

/* ===== �����˹��� ===== */
.buyer-help {
  color: #c62828;
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 12px;
}
.buyer-pool-box {
  margin-bottom: 10px;
}
.buyer-pool-box textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #999;
  padding: 8px;
  font-size: 13px;
  min-height: 72px;
  resize: vertical;
}
.buyer-pool-actions {
  margin-top: 6px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.auto-buy-box {
  margin-top: 8px;
  padding: 8px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.buyer-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
  padding: 8px;
  background: #f5f5f5;
  border: 1px solid #ddd;
}
.buyer-tip {
  color: #c62828;
  font-size: 13px;
  margin-left: 8px;
}
.buyer-table .buyer-add-input {
  width: 100%;
  min-width: 140px;
  box-sizing: border-box;
  border: 1px solid #aaa;
  padding: 4px 6px;
  font-size: 14px;
}
.buyer-table .buyer-result-box {
  width: 130px;
  border: 1px solid #999;
  padding: 4px 6px;
  background: #fff;
  font-size: 14px;
}
.buyer-table .buyer-result-box.is-err {
  color: #c62828;
}
.buyer-table .col-bought {
  max-width: 220px;
  word-break: break-all;
  font-size: 13px;
  color: #444;
}

/* ===== ��Ӧʽ���� ===== */
@media (max-width: 1100px) {
  .sidebar { width: 120px; }
  .sidebar li a, .sidebar li span { font-size: 12px; padding: 7px 8px; }
  .content { padding: 12px 12px; font-size: 14px; }
  .sync-table { min-width: 1000px; font-size: 13px; }
  .type-matrix-table { font-size: 12px; }
}

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid #444;
  }
  .sidebar-title { width: 100%; }
  .sidebar ul {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    padding: 4px;
    gap: 2px;
  }
  .sidebar li a, .sidebar li span {
    padding: 6px 10px;
    font-size: 13px;
    white-space: nowrap;
  }
  .content { font-size: 14px; padding: 12px 10px; }
  .form-grid { grid-template-columns: 1fr; }
  .sync-table { min-width: 900px; font-size: 13px; }
  h2 { font-size: 18px; }
}

@media (min-width: 1400px) {
  .content { font-size: 15px; }
  .sync-table { font-size: 15px; }
  table.data { font-size: 15px; }
  button, .btn { font-size: 15px; }
}
