:root {
  --navy: #132d43;
  --navy-strong: #0b2134;
  --navy-soft: #e8eef2;
  --red: #a92f34;
  --red-strong: #812126;
  --red-soft: #f7e8e8;
  --green: #237355;
  --green-soft: #e5f1eb;
  --ink: #17242e;
  --muted: #66747f;
  --line: #d8dfe4;
  --paper: #f3f5f6;
  --white: #fff;
  --shadow: 0 12px 32px rgba(19, 45, 67, .14);
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, select { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
kbd { min-width: 24px; padding: 2px 6px; color: inherit; background: rgba(255,255,255,.72); border: 1px solid currentColor; border-radius: 3px; font-family: inherit; font-size: 12px; line-height: 1.3; }
.hidden { display: none !important; }
.section-label { margin: 0 0 5px; color: var(--red); font-size: 11px; font-weight: 700; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #edf1f3; }
.login-panel { width: min(390px, 100%); padding: 28px 36px 34px; background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--navy); border-radius: 6px; box-shadow: var(--shadow); }
.login-brand { height: 112px; overflow: hidden; margin: 0 auto 4px; }
.login-brand img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 48%; transform: scale(1.32); }
.login-panel h1 { margin: 0 0 24px; text-align: center; color: var(--navy); font-size: 24px; }
.login-panel label, .modal label { display: grid; gap: 7px; margin: 0 0 16px; color: #354652; font-size: 13px; font-weight: 650; }
input, select { width: 100%; height: 42px; padding: 0 12px; color: var(--ink); background: var(--white); border: 1px solid #c7d0d6; border-radius: 4px; outline: none; }
input:focus, select:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(19,45,67,.11); }
.command { min-height: 42px; padding: 0 20px; border: 0; border-radius: 4px; cursor: pointer; font-weight: 700; }
.command.primary { width: 100%; color: #fff; background: var(--navy); }
.command.primary:hover { background: var(--navy-strong); }
.command.danger { color: #fff; background: var(--red); }
.command:disabled { cursor: not-allowed; opacity: .5; }
.form-error { min-height: 19px; margin: 10px 0 0; color: var(--red); font-size: 13px; }

.app-shell { height: 100vh; display: grid; grid-template-rows: 60px minmax(0, 1fr) 30px; }
.topbar { display: grid; grid-template-columns: 225px minmax(420px, 1fr) auto; align-items: center; gap: 16px; padding: 0 14px; background: var(--white); border-bottom: 1px solid var(--line); }
.brand { min-width: 0; display: flex; align-items: center; gap: 8px; color: var(--navy); }
.brand-logo { width: 82px; height: 42px; overflow: hidden; flex: none; }
.brand-logo img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.48); }
.brand strong { white-space: nowrap; font-size: 14px; }
.stats { display: flex; justify-content: center; gap: 18px; white-space: nowrap; }
.stat { display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 5px; color: var(--muted); font-size: 11px; }
.stat strong { color: var(--navy); font-size: 17px; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; align-items: center; gap: 6px; }
.tool-button, .icon-button { min-height: 32px; padding: 0 11px; color: #334653; background: var(--white); border: 1px solid #cbd4da; border-radius: 4px; cursor: pointer; text-decoration: none; font-size: 12px; font-weight: 650; }
.tool-button:hover, .icon-button:hover { color: var(--navy); border-color: #8294a1; background: #f4f7f8; }
.danger-ghost { color: var(--red); border-color: #dfb5b7; }
.icon-button { width: 32px; padding: 0; font-size: 17px; }
.icon-button:disabled { opacity: .35; cursor: not-allowed; }

.workspace { min-height: 0; display: grid; grid-template-columns: 238px minmax(500px, 1fr) 320px; }
.queue-panel, .detail-panel { min-height: 0; background: var(--white); }
.queue-panel { overflow: hidden; display: grid; grid-template-rows: 46px auto minmax(0, 1fr); border-right: 1px solid var(--line); }
.detail-panel { display: grid; grid-template-rows: 46px minmax(0, 1fr) auto; border-left: 1px solid var(--line); }
.panel-heading, .reviewer-line { display: flex; align-items: center; justify-content: space-between; padding: 0 14px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; font-size: 14px; }
.panel-heading span { color: var(--muted); font-size: 12px; }
.status-filters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; padding: 9px; border-bottom: 1px solid var(--line); }
.status-filter { min-height: 30px; padding: 0 6px; color: #586873; background: #f0f3f5; border: 1px solid transparent; border-radius: 3px; cursor: pointer; font-size: 11px; }
.status-filter.active { color: var(--navy); background: var(--navy-soft); border-color: #9aabb6; font-weight: 700; }
.task-list { overflow: auto; }
.task-item { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 5px; padding: 11px 12px; text-align: left; background: #fff; border: 0; border-bottom: 1px solid #e8ecef; cursor: pointer; }
.task-item:hover, .task-item.active { background: #edf2f5; box-shadow: inset 3px 0 var(--navy); }
.task-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.task-item span { color: var(--muted); font-size: 11px; }
.task-item .status-label { color: var(--navy); }
.empty-list { padding: 26px 14px; color: var(--muted); text-align: center; font-size: 12px; }

.preview-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: 46px minmax(0, 1fr); background: #dfe4e7; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: var(--white); border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 650; }
.preview-toolbar div { display: flex; gap: 5px; }
.empty-preview { display: grid; align-content: center; justify-items: center; color: #60717c; }
.empty-preview h2 { margin: 16px 0 4px; font-size: 17px; }
.empty-preview p { margin: 0; font-size: 12px; }
.empty-symbol { width: 64px; height: 64px; display: grid; place-items: center; color: var(--navy); background: #fff; border: 1px solid #9eacb5; font-size: 26px; font-weight: 700; }
.image-viewport { min-height: 0; overflow: auto; padding: 10px; text-align: center; }
.image-viewport img { display: block; max-width: 100%; height: auto; margin: 0 auto; background: #fff; box-shadow: 0 3px 14px rgba(16,35,49,.18); }
.image-viewport.original img { max-width: none; }

.reviewer-line { color: var(--muted); font-size: 12px; }
.lease-state { padding: 3px 7px; color: var(--navy); background: var(--navy-soft); border-radius: 3px; }
.lease-state.active { color: var(--green); background: var(--green-soft); }
.shop-details { overflow: auto; padding: 18px; }
.shop-details h2 { margin: 0 0 16px; color: var(--navy); font-size: 18px; line-height: 1.4; overflow-wrap: anywhere; }
.shop-details dl { margin: 0; }
.shop-details dl div { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 8px; padding: 9px 0; border-bottom: 1px solid #e6ebee; }
.shop-details dt { color: var(--muted); font-size: 12px; }
.shop-details dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-size: 12px; font-weight: 650; }
.shop-url-link { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
.shop-url-link:hover { color: var(--red); }
.decision-area { padding: 13px; border-top: 1px solid var(--line); }
.decision { width: 100%; min-height: 58px; display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; margin-bottom: 8px; padding: 0 12px; border-radius: 4px; cursor: pointer; font-size: 14px; }
.decision strong { grid-column: 2; }
.decision kbd { grid-column: 1; grid-row: 1; }
.decision.approve { color: #185f45; background: var(--green-soft); border: 1px solid #84b39f; }
.decision.exclude { color: var(--red-strong); background: var(--red-soft); border: 1px solid #d7a4a7; }
.decision:not(:disabled):hover { filter: brightness(.97); }
.decision:disabled { cursor: not-allowed; opacity: .42; }
.decision-message { min-height: 18px; margin: 3px 0 0; color: var(--muted); text-align: center; font-size: 12px; }
.statusbar { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; color: #dbe4ea; background: var(--navy-strong); font-size: 11px; }
.statusbar kbd { color: #fff; background: rgba(255,255,255,.08); }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; background: #54bd8b; border-radius: 50%; }
.status-dot.error { background: #d55c61; }

.modal { width: min(620px, 90vw); max-height: 90vh; padding: 0; color: var(--ink); background: #fff; border: 1px solid #9eacb5; border-radius: 6px; box-shadow: var(--shadow); }
.modal.wide { width: min(900px, 92vw); }
.modal::backdrop { background: rgba(10,27,40,.58); }
.modal form > header, .modal form > footer, .modal section > header, .modal section > footer { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal form > footer, .modal section > footer { justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); border-bottom: 0; }
.modal h2, .modal h3 { margin: 0; }
.modal form > label, .modal .settings-grid, .modal .rule-heading, .modal .rule-list, .modal .cleanup-preview, .modal form > .tool-button, .modal .form-error { margin-left: 20px; margin-right: 20px; }
.modal form > label:first-of-type { margin-top: 20px; }
.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 18px; padding-top: 18px; }
.switch-row { display: flex !important; align-items: center; }
.switch-row input { width: 18px; height: 18px; }
.rule-heading { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 10px; }
.rule-heading div, .cleanup-actions, .user-actions { display: flex; gap: 6px; }
.rule-list { max-height: 340px; overflow: auto; border: 1px solid var(--line); }
.rule-row { display: grid; grid-template-columns: 26px 180px minmax(280px, 1fr) 34px; gap: 7px; align-items: center; padding: 7px; border-bottom: 1px solid #e8ecef; }
.rule-row:last-child, .user-row:last-child { border-bottom: 0; }
.rule-row input { height: 34px; }
.rule-row input[type=checkbox] { width: 16px; height: 16px; }
.rule-delete { color: var(--red); }
.cleanup-preview { padding: 14px; color: #3c4d58; background: #edf2f5; border-left: 3px solid var(--navy); font-size: 13px; }
.cleanup-actions { margin: 10px 20px 16px; }
.cleanup-actions .tool-button { margin: 0 !important; }
.user-create-form { display: grid; grid-template-columns: 1fr 1.3fr .8fr auto; align-items: end; gap: 8px; padding: 18px 20px 6px; }
.user-create-form label { margin: 0; }
.user-create-form .command { width: auto; }
.user-list-heading { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(360px, 2fr) 150px; gap: 14px; margin: 16px 20px 6px; color: var(--muted); font-size: 11px; }
.users-list { max-height: 360px; overflow: auto; margin: 0 20px 18px; border: 1px solid var(--line); }
.user-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(360px, 2fr) 150px; align-items: center; gap: 14px; padding: 12px; border-bottom: 1px solid #e8ecef; font-size: 12px; }
.user-identity { display: grid; gap: 3px; min-width: 0; }
.user-identity strong { overflow: hidden; text-overflow: ellipsis; }
.user-identity span, .user-identity small, .user-review-stats small { color: var(--muted); }
.user-review-stats { display: grid; grid-template-columns: repeat(4, minmax(74px, 1fr)); gap: 6px; }
.user-review-stats > span { display: grid; gap: 2px; padding: 7px 8px; background: #f3f6f7; border: 1px solid #e2e8eb; }
.user-review-stats strong { color: #173447; font-size: 16px; font-variant-numeric: tabular-nums; }
.user-actions { display: flex; justify-content: flex-end; gap: 6px; }
.user-actions { justify-content: flex-end; }

@media (max-width: 1240px) {
  .topbar { grid-template-columns: 190px 1fr auto; }
  .stats .stat:first-child { display: none; }
  .workspace { grid-template-columns: 210px minmax(430px, 1fr) 286px; }
}

@media (max-width: 900px) {
  .app-shell { height: auto; min-height: 100vh; grid-template-rows: auto auto 34px; }
  .topbar { grid-template-columns: 1fr auto; gap: 8px; padding: 8px 10px; }
  .stats { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; overflow-x: auto; padding: 3px 0; }
  .toolbar { flex-wrap: wrap; justify-content: flex-end; }
  .workspace { min-height: calc(100vh - 150px); grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(460px, 65vh) auto; }
  .queue-panel { display: none; }
  .detail-panel { border: 0; border-top: 1px solid var(--line); grid-template-rows: 46px auto auto; }
  .shop-details { max-height: none; }
  .decision-area { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .decision { margin: 0; }
  .decision-message { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .brand strong { display: none; }
  .toolbar .admin-only { display: none; }
  .stats { gap: 12px; }
  .workspace { grid-template-rows: minmax(420px, 60vh) auto; }
  .decision-area { grid-template-columns: 1fr; }
  .decision-message { grid-column: auto; }
  .settings-grid, .user-create-form { grid-template-columns: 1fr; }
  .rule-row { grid-template-columns: 24px minmax(120px, 1fr) 34px; }
  .rule-pattern { grid-column: 1 / -1; }
}
