:root {
  color-scheme: light;
  --canvas: #eef1f4;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --header: #17191d;
  --border: #d8dde3;
  --border-strong: #c6cdd5;
  --text: #20242a;
  --muted: #69727d;
  --accent: #1769aa;
  --accent-hover: #12588f;
  --success: #16835c;
  --warning: #a76207;
  --danger: #b23a3a;
  --page-max: 1180px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 13px;
}

.app-header {
  min-height: 64px;
  padding: 0;
  background: var(--header);
  color: #ffffff;
  border-bottom: 3px solid var(--accent);
}

.header-inner {
  display: flex;
  width: calc(100% - 32px);
  max-width: var(--page-max);
  min-height: inherit;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  background: #ffffff;
  color: var(--header);
  border-radius: 6px;
  font-size: 18px;
  font-weight: 800;
}

.brand-icon {
  width: 21px;
  height: 21px;
  fill: currentColor;
}

h1,
h2,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 17px;
  line-height: 1.3;
  font-weight: 700;
}

.brand p {
  margin-top: 2px;
  color: #aeb6bf;
  font-size: 11px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 18px;
  color: #c5cbd2;
  font-size: 12px;
}

.header-link,
.header-button,
.user-chip {
  color: #dce2e8;
  font-size: 12px;
  white-space: nowrap;
}

.header-link {
  text-decoration: none;
}

.header-link:hover {
  color: #ffffff;
}

.user-chip {
  padding-left: 18px;
  border-left: 1px solid #3c4249;
}

.header-button {
  min-height: 28px;
  margin: 0;
  padding: 0 10px;
  border-color: #59616a;
  background: transparent;
}

.hidden {
  display: none !important;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.connection-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38b887;
  box-shadow: 0 0 0 3px rgba(56, 184, 135, 0.14);
}

.app-shell {
  width: calc(100% - 32px);
  max-width: var(--page-max);
  margin: 16px auto 28px;
}

.control-bar,
.orders-panel {
  background: var(--surface);
  border: 1px solid var(--border);
}

.control-bar {
  display: flex;
  align-items: center;
  align-content: center;
  flex-wrap: wrap;
  justify-content: space-between;
  row-gap: 10px;
  column-gap: 24px;
  min-height: 66px;
  padding: 10px 16px;
}

.source-block {
  display: flex;
  min-width: 0;
  flex: 0 1 560px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.navigation-note-ticker {
  position: relative;
  min-width: 120px;
  flex: 1 1 360px;
  align-self: center;
  overflow: hidden;
  margin: 0 8px;
  padding: 8px 0;
  color: var(--accent);
  font-size: 9px;
  line-height: 16px;
  white-space: nowrap;
}

.information-pool-reminder {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  min-width: 0;
  flex: 0 1 auto;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
  border: 1px solid #e5c8c8;
  background: #fff6f6;
  color: #6f3838;
  font-size: 11px;
  line-height: 18px;
}

.information-pool-reminder-icon {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  border: 1px solid #daa9a9;
  border-radius: 2px;
  background: #fbe4e4;
  color: #a32f2f;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.information-pool-reminder-text {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.information-pool-reminder a {
  display: inline-flex;
  min-height: 22px;
  flex: 0 0 auto;
  align-items: center;
  gap: 3px;
  padding: 0 6px 0 8px;
  border-left: 1px solid #e2caca;
  color: #9b3030;
  font-weight: 600;
  text-decoration: none;
}

.information-pool-reminder a::after {
  content: "›";
  font-size: 15px;
  line-height: 1;
}

.information-pool-reminder a:hover {
  color: #7f2424;
  background: #fbeaea;
}

.navigation-note-track {
  display: flex;
  width: max-content;
  gap: 56px;
  will-change: transform;
}

.navigation-note-ticker.scrolling .navigation-note-track {
  animation: navigation-note-scroll var(--note-duration, 12s) linear infinite;
}

.navigation-note-ticker:hover .navigation-note-track {
  animation-play-state: paused;
}

.navigation-note-highlight {
  color: var(--danger);
}

@keyframes navigation-note-scroll {
  to {
    transform: translateX(calc(-50% - 28px));
  }
}

.label,
.new-orders-metric span,
.period-filter span,
.panel-heading span {
  color: var(--muted);
  font-size: 11px;
}

.source-block strong {
  overflow: hidden;
  max-width: 560px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.metrics {
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
}

.order-navigation-region {
  min-width: 0;
}

.new-orders-metric {
  display: flex;
  min-width: 92px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 0 18px;
  border-left: 1px solid var(--border);
  color: var(--text);
  text-align: center;
}

.new-orders-metric strong {
  color: var(--success);
  font-size: 20px;
  line-height: 1.1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.period-filter {
  display: flex;
  min-width: 92px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 0 18px;
  margin: 0;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: center;
}

.period-filter strong {
  font-size: 20px;
  line-height: 1.1;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.period-filter:hover,
.period-filter.active {
  background: #edf5fb;
  border-color: var(--border);
  color: var(--accent);
}

.period-filter.active {
  box-shadow: inset 0 -3px 0 var(--accent);
}

button {
  align-self: center;
  min-height: 32px;
  margin-left: 16px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.scope-select {
  align-self: center;
  min-height: 32px;
  margin-left: 8px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button.period-filter {
  align-self: stretch;
  min-height: 0;
  margin-left: 0;
  padding: 0 18px;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text);
}

button.period-filter:hover,
button.period-filter.active {
  background: #edf5fb;
  border-color: var(--border);
  color: var(--accent);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.orders-panel {
  margin-top: 12px;
}

.panel-heading {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}

.panel-heading > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.panel-heading > div:first-child {
  flex: 0 0 auto;
}

.panel-meta {
  flex-wrap: wrap;
}

.notification-bar {
  display: flex;
  flex: 1 0 100%;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 8px 14px;
  flex-wrap: wrap;
}

.email-notification-form input {
  width: 15em;
  max-width: 15em;
}

.notification-form {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
  min-width: 0;
}

.notification-status {
  white-space: nowrap;
}

.notification-status-value {
  font-weight: 600;
}

.notification-status-enabled {
  color: var(--success) !important;
}

.notification-status-disabled {
  color: var(--danger) !important;
}

.notification-form input {
  width: 10em;
  max-width: 10em;
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.notification-form input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(23, 105, 170, 0.12);
}

.notification-form button {
  min-height: 28px;
  margin-left: 0;
  padding: 0 8px;
}

.panel-heading .batch-actions {
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  justify-content: flex-end;
}

#selectedCount {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.keyword-filter {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-start;
}

.keyword-filter input {
  width: calc((5em + 20px) * 1.33);
  max-width: calc((5em + 20px) * 1.33);
  height: 28px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  text-align: left;
}

.keyword-filter input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(23, 105, 170, 0.12);
}

.keyword-filter input::placeholder {
  text-align: left;
}

.copy-notice {
  color: var(--success) !important;
  font-weight: 600;
  white-space: nowrap;
}

.batch-actions button {
  min-height: 28px;
  margin-left: 0;
  padding: 0 10px;
}

.status-proxy-text {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.status-proxy-count {
  display: inline-block;
  min-width: 1.2em;
  color: var(--danger) !important;
  -webkit-text-fill-color: var(--danger);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  transform-origin: center bottom;
  will-change: transform, opacity;
}

.status-proxy-count.bump {
  animation: statusProxyCountBump 520ms cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes statusProxyCountBump {
  0% {
    opacity: 0.35;
    transform: translateY(8px) scale(0.9);
  }
  45% {
    opacity: 1;
    transform: translateY(-7px) scale(1.18);
  }
  70% {
    transform: translateY(1px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-proxy-count.bump {
    animation: none;
  }
}

.status-proxy-text.error {
  color: var(--danger);
}

.batch-actions .batch-delete-button {
  border-color: #d8a0a0;
  background: #ffffff;
  color: var(--danger);
}

.batch-actions .batch-delete-button:hover {
  border-color: var(--danger);
  background: #fff2f2;
}

h2 {
  font-size: 14px;
  font-weight: 700;
}

.table-hint {
  white-space: nowrap;
}

.table-wrap {
  max-height: calc(100vh - 218px);
  overflow: auto;
  scrollbar-color: #aeb7c1 #edf0f2;
  scrollbar-width: thin;
}

table {
  width: 100%;
  min-width: 570px;
  border-spacing: 0;
  border-collapse: separate;
  table-layout: fixed;
}

th,
td {
  padding: 9px 10px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}

th:last-child,
td:last-child {
  border-right: 0;
}

th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 38px;
  background: #e9edf1;
  color: #3c4651;
  border-bottom-color: var(--border-strong);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.user-index-marker {
  display: inline-block;
  margin-left: 4px;
  color: #e3e7eb;
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
  user-select: none;
}

th:first-child,
td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 28px;
  text-align: center;
}

th:first-child {
  z-index: 4;
  background: #e2e7ec;
}

td:first-child {
  background: #f5f7f9;
  color: var(--text);
  font-weight: 400;
}

th:nth-child(2),
td:nth-child(2) {
  position: sticky;
  left: 28px;
  z-index: 2;
  text-align: center;
}

th:nth-child(2) {
  z-index: 4;
  background: #fafbfc;
}

td:nth-child(2) {
  background: #ffffff;
}

.select-column,
.select-cell {
  padding-right: 4px;
  padding-left: 4px;
  cursor: pointer;
}

.select-column input,
.select-cell input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.select-column:hover,
.select-cell:hover {
  background: #e3f0f9;
}

tbody tr:nth-child(even) td {
  background: #fafbfc;
}

tbody tr:nth-child(even) td:first-child {
  background: #f0f3f6;
}

tbody tr:hover td {
  background: #eef6fc;
}

tbody tr:hover td:first-child {
  background: #e3f0f9;
}

tbody tr.processed td {
  background: #eef6fc;
}

tbody tr.processed td:first-child {
  background: #e3f0f9;
}

th:nth-child(2) {
  width: 34px;
  text-align: center;
}

th:nth-child(3) {
  width: clamp(94px, 8vw, 112px);
}

th:nth-child(4) {
  width: clamp(86px, 10vw, 96px);
}

th:nth-child(5) {
  width: 72px;
  text-align: center;
}

th:nth-child(6) {
  width: 56px;
  text-align: center;
}

th:nth-child(7) {
  width: 112px;
}

th:nth-child(8) {
  width: 46px;
  text-align: center;
}

th:nth-child(9) {
  width: 78px;
}

.id-cell {
  text-align: center;
}

tbody tr.selected td {
  background: #e8f3fb;
}

tbody tr.selected td:first-child {
  background: #dcecf8;
}

.mono {
  font-family: Consolas, "SFMono-Regular", "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
}

.time-cell {
  white-space: nowrap;
}

.time-cell span {
  display: block;
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
}

.time-cell .countdown-text {
  color: var(--danger);
}

.time-cell .countdown-safe {
  color: var(--success);
}

.time-cell .countdown-warning {
  color: var(--warning);
}

.time-cell .countdown-danger {
  color: var(--danger);
}

.order-info-cell,
.tag-cell,
.pickup-cell,
.source-cell,
.status-detail-cell {
  color: var(--text);
  font-weight: 400;
}

.tag-cell {
  text-align: center;
  white-space: nowrap;
}

.source-cell {
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  white-space: nowrap;
}

.status-detail-cell {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.info-line {
  display: block;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-line + .info-line {
  margin-top: 2px;
}

.order-number-line,
.pickup-name-line {
  color: var(--text);
}

.product-line,
.store-line,
.pickup-id-line,
.pickup-apple-id-line,
.pickup-phone-line,
.pickup-email-line {
  color: var(--muted);
}

.product-line {
  display: block;
  overflow: visible;
  max-width: 100%;
  color: var(--muted);
  text-overflow: clip;
  white-space: normal;
}

.product-model-text {
  display: inline;
  overflow: visible;
  max-width: none;
  text-overflow: clip;
  white-space: normal;
}

.product-quantity-inline {
  display: inline;
  text-align: inherit;
  white-space: nowrap;
}

.order-mode-badge {
  display: inline-block;
  width: fit-content;
  margin-top: 2px;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: #f4f6f8;
  color: #37414b;
  font-size: 11px;
  line-height: 1.5;
}

.order-mode-refurb { border-color: #8c6fbb; color: #62488d; background: #f7f3fb; }
.order-mode-delivery { border-color: #6090b5; color: #315f82; background: #f1f7fb; }
.order-mode-pickup { border-color: #5c9774; color: #326347; background: #f0f8f3; }
.product-meta-line,
.store-line {
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-meta-line, .proxy-ip-line { color: var(--muted); font-size: 11px; }

tbody tr {
  cursor: pointer;
}

tbody tr .order-actions-cell {
  cursor: pointer;
}

tbody tr .select-cell {
  cursor: pointer;
}

tbody tr .order-actions-cell a,
tbody tr .order-actions-cell img,
tbody tr .order-actions-cell [role="button"] {
  cursor: pointer;
}

tbody tr .order-actions-cell .missing-action {
  cursor: default;
}

.order-actions-cell {
  text-align: center;
  white-space: nowrap;
}

.order-action-items {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.action-payment-method {
  overflow: hidden;
  max-width: 64px;
  color: var(--accent);
  text-overflow: ellipsis;
  text-decoration: none;
  white-space: nowrap;
}

.action-payment-method:hover {
  color: var(--accent-hover);
  text-decoration: none;
}

.action-payment-method.clicked,
.action-payment-method.clicked:hover {
  color: #b56a13;
}

span.action-payment-method {
  color: var(--muted);
  text-decoration: none;
}

.payment-action-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.delivery-date-result {
  display: inline-block;
  max-width: 100%;
  margin-top: 3px;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 11px;
  line-height: 1.35;
  color: #ffffff;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.delivery-date-success {
  background: var(--success);
}

.delivery-date-failed {
  background: var(--danger);
}

.order-status-pending {
  background: #b23a3a;
}

.order-status-paid {
  background: #2f855a;
}

.order-status-processing {
  background: #2f855a;
}

.order-status-pickup-ready {
  background: #16835c;
}

.order-status-expired {
  background: #9ca3af;
}

.order-status-picked-up {
  background: #3f82b8;
}

.order-status-cancelled {
  background: #9ca3af;
}

.order-status-returned {
  background: #9ca3af;
}

.action-qr {
  display: inline-flex;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
}

.missing-action {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-decoration: none;
}

.missing-action {
  color: var(--muted);
  font-weight: 400;
}

.qr-cell img,
.qr-placeholder {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  image-rendering: crisp-edges;
}

.qr-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  image-rendering: auto;
}

.missing {
  color: var(--muted);
}

.empty {
  height: 160px;
  color: var(--muted);
  text-align: center;
}


@media (max-width: 760px) {
  .app-header {
    min-height: 58px;
    gap: 8px;
    padding: 0;
  }

  .header-inner {
    width: calc(100% - 16px);
    gap: 8px;
  }

  .brand {
    min-width: 0;
    gap: 8px;
    flex: 0 0 auto;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  h1 {
    font-size: 16px;
    white-space: nowrap;
  }

  .brand p,
  #readAt {
    display: none;
  }

  .header-status {
    min-width: 0;
    flex: 1 1 auto;
    justify-content: flex-end;
    gap: 8px;
    font-size: 11px;
  }

  .connection-status,
  #refreshState {
    white-space: nowrap;
  }

  .user-chip {
    overflow: hidden;
    max-width: 108px;
    padding-left: 8px;
    text-overflow: ellipsis;
  }

  .header-button {
    min-height: 28px;
    padding: 0 8px;
  }

  .app-shell {
    width: calc(100% - 16px);
    margin-top: 8px;
  }

  .control-bar {
    min-height: 0;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .source-block,
  .navigation-note-ticker {
    width: 100%;
    flex-basis: auto;
  }

  .navigation-note-ticker {
    min-height: 34px;
    margin: 0;
    padding: 7px 0;
    font-size: 9px;
    line-height: 16px;
  }

  .notification-bar {
    width: 100%;
    flex: 0 0 auto;
    justify-content: flex-start;
  }

  .metrics {
    width: 100%;
  }

  .period-filter {
    min-width: 0;
    flex: 1;
    padding: 0 8px;
  }

  .new-orders-metric {
    min-width: 0;
    flex: 1;
    padding: 0 8px;
    border-left: 0;
  }

  .new-orders-metric + .period-filter {
    border-left: 0;
  }

  button {
    margin-left: 8px;
    white-space: nowrap;
  }

  .table-wrap {
    max-height: calc(100vh - 248px);
  }

  .panel-heading {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  .panel-meta {
    align-items: center;
    gap: 6px;
  }

  .notification-form {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 3px;
    font-size: 11px;
  }

  .notification-status {
    flex: 0 0 auto;
  }

  .notification-form input {
    width: auto;
    min-width: 9em;
    max-width: none;
    flex: 1 1 9em;
    height: 26px;
    padding: 0 9px;
    font-size: 11px;
  }

  .email-notification-form input {
    width: auto;
    max-width: none;
  }

  .notification-form button {
    min-height: 26px;
    padding: 0 6px;
    font-size: 11px;
  }

  .panel-heading .batch-actions {
    width: 100%;
    flex-wrap: wrap;
  }
}

/* Compact style is intentionally scoped to the order table. */
.metrics {
  flex-wrap: nowrap;
}

.new-orders-metric,
button.period-filter {
  align-self: stretch;
}

.table-wrap {
  max-height: calc(100vh - 218px);
}

  table {
    min-width: 570px;
  }

th,
td {
  padding: 5px 5px;
  border-right: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
}

th {
  height: 34px;
  background: #fafbfc;
  color: #8993a2;
  border-bottom-color: var(--border-strong);
  font-size: 10px;
  font-weight: 400;
}

th:first-child {
  background: #fafbfc;
}

td:first-child,
tbody tr:nth-child(even) td,
tbody tr:nth-child(even) td:first-child {
  background: #ffffff;
}

tbody tr:hover td,
tbody tr:hover td:first-child {
  background: #f3f7ff;
}

tbody tr.processed td,
tbody tr.processed td:first-child {
  background: #ffffff;
}

tbody tr.processed:hover td,
tbody tr.processed:hover td:first-child {
  background: #f3f7ff;
}

tbody tr.selected td,
tbody tr.selected td:first-child {
  background: #e8f1ff;
}

.select-column input,
.select-cell input {
  width: 12px;
  height: 12px;
  display: inline-grid;
  margin: 0;
  appearance: none;
  place-content: center;
  border: 1px solid #c9d0da;
  border-radius: 2px;
  background: #ffffff;
}

.select-column input:checked,
.select-cell input:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.select-column input:checked::after,
.select-cell input:checked::after {
  width: 6px;
  height: 3px;
  border-bottom: 1.5px solid #ffffff;
  border-left: 1.5px solid #ffffff;
  content: "";
  transform: translateY(-1px) rotate(-45deg);
}

tbody tr.processed .order-select {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(23, 105, 170, 0.18);
}

.mono {
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

.time-cell span {
  font-size: 10px;
}

.time-cell .countdown-text {
  color: var(--danger);
}

.time-cell .countdown-text.countdown-safe {
  color: var(--success);
}

.time-cell .countdown-text.countdown-warning {
  color: var(--warning);
}

.time-cell .countdown-text.countdown-danger {
  color: var(--danger);
}

.time-cell .countdown-text:empty {
  display: none;
}

.missing-action {
  font-size: 10px;
  font-weight: 400;
}

.action-qr img,
.qr-placeholder {
  display: block;
  width: 24px;
  height: 24px;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-color: var(--border-strong);
  border-radius: 2px;
  background: #ffffff;
  image-rendering: crisp-edges;
}

.action-qr img {
  cursor: zoom-in;
}

.action-qr img:focus-visible {
  outline: 2px solid #9fc0f7;
  outline-offset: 2px;
}

.action-qr.qr-clicked img {
  border-color: #b56a13;
  background: #fff4e2;
  box-shadow: 0 0 0 2px #e5b66f;
}

.new-orders-filter strong {
  color: var(--success);
}

.qr-placeholder {
  background: #ffffff;
  font-size: 9px;
}

.qr-preview {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 36px;
  background: rgba(31, 42, 57, 0.48);
}

.qr-preview-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.qr-preview-meta {
  color: #ffffff;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  text-shadow: 0 1px 3px rgba(22, 35, 54, 0.45);
}

.qr-preview img {
  width: min(420px, calc(100vw - 72px));
  height: min(420px, calc(100vw - 72px));
  border: 12px solid #ffffff;
  border-radius: 3px;
  background: #ffffff;
  box-shadow: 0 16px 50px rgba(22, 35, 54, 0.24);
  image-rendering: crisp-edges;
}

.qr-preview-close {
  position: fixed;
  top: 18px;
  right: 22px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.94);
  color: #596577;
  font-size: 20px;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  .navigation-note-ticker {
    text-overflow: ellipsis;
  }

  .navigation-note-track {
    display: block;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .navigation-note-track > span:first-child {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .navigation-note-track > span:last-child {
    display: none;
  }
}

@media (max-width: 760px) {
  .metrics {
    flex-wrap: nowrap;
  }

  table {
    min-width: clamp(570px, 148vw, 640px);
  }

  th,
  td {
    padding: 4px 5px;
    font-size: 11px;
  }

  th:nth-child(3) {
    width: clamp(92px, 25vw, 116px);
  }

  th:nth-child(4) {
    width: clamp(105px, 32vw, 120px);
  }

  th:nth-child(5) {
    width: 68px;
  }

  th:nth-child(6) {
    width: 54px;
  }

  th:nth-child(7) {
    width: 116px;
  }

  th:nth-child(8) {
    width: 46px;
  }

  th:nth-child(9) {
    width: 78px;
  }

  .time-cell {
    white-space: nowrap;
  }

  .product-line,
  .product-meta-line,
  .store-line {
    line-height: 1.3;
  }

  .order-action-items {
    gap: 1px;
  }

  .action-payment-method {
    max-width: 60px;
  }

  .payment-action-row {
    gap: 3px;
  }

  .action-qr {
    flex-basis: 24px;
    width: 24px;
    height: 24px;
  }

  .action-qr img,
  .qr-placeholder {
    width: 24px;
    height: 24px;
  }
}

/* Order assistant style skin: visual-only overrides, layout remains unchanged. */
:root {
  --canvas: #f3f3f3;
  --surface: #ffffff;
  --surface-muted: #f7f7f7;
  --header: #f3f3f3;
  --border: #d2d2d2;
  --border-strong: #c5c5c5;
  --text: #15191f;
  --muted: #4f5965;
  --accent: #1d6fb8;
  --accent-hover: #155b97;
  --success: #12805c;
  --warning: #ad6a00;
  --danger: #bf2f2f;
}

body {
  background: var(--canvas);
  color: var(--text);
}

.app-header {
  min-height: 58px;
  background: var(--header);
  color: var(--text);
  border-bottom: 1px solid #c8c8c8;
}

.brand-mark {
  background: #11151b;
  color: #ffffff;
  border-radius: 3px;
}

.brand p,
.header-status,
.header-link,
.header-button,
.user-chip {
  color: #3f4751;
}

.header-link:hover {
  color: #11151b;
}

.account-config-entry {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  color: #15191f;
  background: #f4f4f4;
  border: 1px solid #c7c7c7;
  text-decoration: none;
  white-space: nowrap;
}

.account-config-entry:hover {
  color: #11151b;
  background: #e9eef5;
  border-color: #aeb7c1;
}

.metrics-action {
  flex: 0 0 auto;
  margin-left: 8px;
  font-size: 12px;
}

#accountConfigLink {
  min-width: 112px;
}

.user-chip {
  border-left-color: #c9c9c9;
}

.connection-status i {
  background: #16a06f;
  box-shadow: none;
}

.header-button,
button {
  border: 1px solid #c7c7c7;
  border-radius: 0;
  background: #f4f4f4;
  color: #15191f;
  font-weight: 400;
  box-shadow: none;
}

button:hover {
  border-color: #aeb7c1;
  background: #e9eef5;
  color: #11151b;
}

#refreshButton {
  border-color: #c7c7c7;
  background: #f4f4f4;
  color: #15191f;
}

#refreshButton:hover {
  border-color: #aeb7c1;
  background: #e9eef5;
  color: #11151b;
}

button:disabled {
  background: #eeeeee;
  color: #8a8f96;
  cursor: not-allowed;
  opacity: 1;
}

.control-bar,
.orders-panel {
  border-color: #cfcfcf;
  background: #ffffff;
  box-shadow: none;
}

.control-bar {
  padding: 12px 16px;
}

.notification-form input,
.keyword-filter input,
.scope-select {
  border-color: #c7c7c7;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.notification-form input:focus,
.keyword-filter input:focus,
.scope-select:focus {
  border-color: #7fa7d7;
  outline: 1px solid #7fa7d7;
  box-shadow: none;
}

.new-orders-metric,
button.period-filter {
  background: #ffffff;
}

.new-orders-metric {
  border-left-color: #d7d7d7;
}

button.period-filter {
  border-left-color: #d7d7d7;
}

button.period-filter:hover,
button.period-filter.active {
  background: #eaf2fb;
  color: #144f8d;
}

button.period-filter.active {
  box-shadow: inset 0 -3px 0 #1d6fb8;
}

.panel-heading {
  background: #ffffff;
  border-bottom-color: #d2d2d2;
}

.panel-heading .batch-actions button,
.notification-form button {
  min-height: 28px;
}

.batch-actions .batch-delete-button {
  border-color: #d6b5b5;
  background: #f7f7f7;
  color: #bf2f2f;
}

.table-wrap {
  scrollbar-color: #9f9f9f #eeeeee;
}

th,
td {
  border-bottom-color: #d7d7d7;
}

th {
  background: #f6f6f6;
  color: #616975;
  border-bottom-color: #cfcfcf;
  font-weight: 400;
}

th:first-child,
th:nth-child(2) {
  background: #f6f6f6;
}

td:first-child,
td:nth-child(2),
tbody tr:nth-child(even) td,
tbody tr:nth-child(even) td:first-child {
  background: #ffffff;
}

tbody tr:hover td,
tbody tr:hover td:first-child,
tbody tr.processed:hover td,
tbody tr.processed:hover td:first-child {
  background: #f2f6fb;
}

tbody tr.selected td,
tbody tr.selected td:first-child {
  background: #e8f1fb;
}

.select-column input,
.select-cell input {
  border-color: #bfc5cc;
  border-radius: 2px;
}

.select-column input:checked,
.select-cell input:checked {
  border-color: #1d6fb8;
  background: #1d6fb8;
}

.action-payment-method {
  color: #1769aa;
}

.action-payment-method:hover {
  color: #12588f;
}

.delivery-date-result {
  border-radius: 2px;
}

.order-mode-badge,
.action-qr img,
.qr-placeholder,
.qr-preview img,
.qr-preview-close {
  border-radius: 0;
}

@media (max-width: 760px) {
  .app-header {
    background: var(--header);
    border-bottom: 1px solid #c8c8c8;
  }

  .header-button {
    background: #f4f4f4;
    color: #15191f;
  }

  .control-bar {
    padding: 10px;
  }

  .navigation-note-ticker {
    order: 2;
  }

  .information-pool-reminder {
    order: 1;
    width: 100%;
    flex-basis: auto;
    padding: 5px 6px;
  }

  .notification-bar {
    order: 3;
  }

  .order-navigation-region {
    order: 4;
    width: calc(100% + 20px);
    margin: 0 -10px -10px;
    padding: 10px;
    border-top: 1px solid #d3d7dc;
    background: #f8f9fa;
  }

  .metrics {
    order: 4;
    width: 100%;
  }

  .panel-heading .batch-actions {
    width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .panel-heading .batch-actions::-webkit-scrollbar {
    display: none;
  }

  .panel-heading .batch-actions > * {
    flex: 0 0 auto;
  }

  #selectedCount {
    font-size: 10px;
  }

  .batch-actions button {
    min-height: 26px;
    padding: 0 7px;
    font-size: 11px;
  }

  .keyword-filter input {
    width: 90px;
    max-width: 90px;
    height: 26px;
    padding: 0 7px;
    font-size: 11px;
  }
}

@media (min-width: 761px) {
  .control-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    grid-template-areas:
      "reminder reminder"
      "ticker ticker"
      "notice metrics";
    align-items: center;
    row-gap: 8px;
    column-gap: 28px;
    min-height: 104px;
    padding: 14px 16px;
  }

  .notification-bar {
    grid-area: notice;
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
  }

  .information-pool-reminder {
    grid-area: reminder;
    justify-self: start;
  }

  .notification-form {
    gap: 6px;
    min-width: 0;
    max-width: 100%;
    flex-wrap: nowrap;
  }

  .notification-form input {
    width: 13em;
    max-width: 13em;
  }

  .navigation-note-ticker {
    grid-area: ticker;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 2px 0;
    font-size: 12px;
    line-height: 20px;
  }

  .order-navigation-region {
    grid-area: metrics;
    min-width: max-content;
    padding: 6px 0 6px 18px;
    border-left: 1px solid #d3d7dc;
    background: #fafafa;
  }

  .order-navigation-region .metrics {
    grid-area: auto;
    justify-content: flex-end;
  }

  .new-orders-metric,
  button.period-filter {
    min-width: 110px;
    padding-right: 20px;
    padding-left: 20px;
  }

  #refreshButton {
    min-width: 104px;
    margin-left: 18px;
  }

  .metrics-action {
    min-width: 84px;
  }
}

/* Empty order table should still occupy the remaining page height. */
.orders-panel {
  min-height: calc(100vh - 232px);
  display: flex;
  flex-direction: column;
}

.orders-panel .table-wrap {
  flex: 1 1 auto;
  min-height: calc(100vh - 282px);
}

.empty {
  height: max(360px, calc(100vh - 330px));
}

@media (max-width: 760px) {
  .orders-panel {
    min-height: calc(100vh - 292px);
  }

  .orders-panel .table-wrap {
    min-height: calc(100vh - 338px);
  }

  .empty {
    height: max(300px, calc(100vh - 384px));
  }
}

/* Header title aligns vertically with the right-side controls. */
.app-header {
  min-height: 48px;
}

.brand {
  align-self: stretch;
  align-items: center;
}

.brand h1 {
  line-height: 1;
}

.brand p {
  display: none;
}

@media (max-width: 760px) {
  .app-header {
    min-height: 50px;
  }
}

/* Period filters: segmented control instead of heavy underline. */
.metrics {
  gap: 6px;
  align-items: center;
}

button.period-filter {
  position: relative;
  min-height: 52px;
  border: 1px solid #bcc7d2;
  background: #ffffff;
  color: #2c3440;
  box-shadow: none;
}

button.period-filter span {
  color: #4e5b68;
}

button.period-filter strong {
  color: #15191f;
}

button.period-filter.new-orders-filter strong {
  color: var(--success);
}

button.period-filter:hover {
  border-color: #9aaec3;
  background: #f6f9fc;
  color: #285c8c;
  box-shadow: none;
}

button.period-filter.active {
  border-color: #3f7fb7;
  background: #eef5fb;
  color: #285c8c;
  box-shadow: none;
  z-index: 2;
}

button.period-filter.active span,
button.period-filter.active strong {
  color: #285c8c;
}

button.period-filter:focus-visible {
  outline: 2px solid #adc5dc;
  outline-offset: 2px;
}

@media (max-width: 760px) {
  .metrics {
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .metrics::-webkit-scrollbar {
    display: none;
  }

  button.period-filter {
    min-height: 50px;
    padding-right: 6px;
    padding-left: 6px;
  }

  #refreshButton,
  .metrics-action {
    min-width: 76px;
    min-height: 32px;
    margin-left: 0;
    padding-right: 9px;
    padding-left: 9px;
  }

  #accountConfigLink {
    min-width: 76px;
  }

}

/* Infinite order loading stays quiet until a new batch is being fetched. */
.order-infinite-scroll {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 5px 10px;
  border-top: 1px solid #d6dce2;
  background: #fafbfc;
  color: #617080;
  font-size: 11px;
}

.order-infinite-scroll.hidden {
  display: none;
}

@media (max-width: 760px) {
  .order-infinite-scroll {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 10px;
  }
}
