:root {
  --sidebar-width: clamp(168px, 12vw, 220px);
  --page-padding: clamp(12px, 1.4vw, 24px);
  --panel-radius: 8px;
  --bg: #edf4f8;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe4f0;
  --blue: #2563eb;
  --blue-soft: #eaf2ff;
  --green: #059669;
  --red: #dc2626;
  --amber: #d97706;
  --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 18px 48px rgba(15, 23, 42, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, #f6fbff 0, var(--bg) 280px),
    var(--bg);
  color: var(--ink);
  font-family: Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
}

body:not(.authenticated) .sidebar,
body:not(.authenticated) .sidebar-toggle,
body:not(.authenticated) .sidebar-resize-handle,
body:not(.authenticated) .main {
  display: none;
}

body.authenticated .login-screen {
  display: none;
}

body.system-alert-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

.login-screen {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #edf4f8;
}

.login-card {
  width: min(400px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.login-brand {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
}

.login-card h1 {
  margin: 6px 0 0;
  font-size: 22px;
  text-align: center;
}

.login-card p {
  margin: 10px 0 26px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

.login-card label {
  display: block;
  margin-bottom: 16px;
}

.login-card input {
  height: 48px;
  border-radius: 8px;
  background: #fff;
  font-size: 15px;
}

.login-card .btn {
  width: 100%;
  height: 52px;
  margin-top: 6px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  font-size: 17px;
  box-shadow: none;
}

.login-card .btn:hover {
  background: #1d4ed8;
  box-shadow: none;
}

@media (max-width: 900px) {
  .login-screen {
    padding: 20px;
  }
}

@media (max-width: 520px) {
  .login-screen {
    padding: 16px;
  }

  .login-card {
    border-radius: 8px;
    padding: 22px;
  }
}

.login-error {
  margin-top: 12px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fef2f2;
  padding: 10px 12px;
  color: var(--red);
  font-weight: 800;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0, #f8fbff 100%);
  overflow-y: auto;
  padding-bottom: 18px;
  overflow-x: hidden;
  box-shadow: 8px 0 28px rgba(15, 23, 42, 0.035);
  transition: transform 0.18s ease;
}

.brand {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.09), rgba(5, 150, 105, 0.06)),
    #fff;
}

.brand-title {
  font-size: 19px;
  font-weight: 900;
}

.brand-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

nav {
  padding: 12px 10px 18px;
}

.nav-group-title {
  margin: 16px 10px 7px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

nav a {
  position: relative;
  display: flex;
  height: 40px;
  align-items: center;
  padding: 0 12px;
  border-radius: 6px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

nav a:hover {
  background: #f1f6fb;
  color: #0f172a;
  transform: translateX(1px);
}

nav a.active {
  background: linear-gradient(90deg, var(--blue-soft), #f8fbff);
  color: #1d4ed8;
  box-shadow: inset 3px 0 0 var(--blue), 0 8px 18px rgba(37, 99, 235, 0.08);
}

nav a.permission-hidden {
  display: none;
}

.main {
  min-width: 0;
  width: calc(100% - var(--sidebar-width));
  max-width: none;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  padding: var(--page-padding);
  transition: margin-left 0.18s ease, width 0.18s ease;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 2px 0 4px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
}

.topbar p,
.panel-head p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-guide-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #2563eb;
  cursor: pointer;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.help-guide-btn:hover {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.12);
}

.help-guide-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.34);
}

.help-guide-modal {
  position: relative;
  width: min(680px, 100%);
  max-height: min(76vh, 720px);
  overflow-y: auto;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  padding: 22px;
}

.help-guide-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid #dbe5ef;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.help-guide-close:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.help-guide-kicker {
  margin-bottom: 8px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 900;
}

.help-guide-modal h2 {
  padding-right: 40px;
  font-size: 22px;
}

.help-guide-modal p {
  margin-top: 8px;
  color: #475569;
  line-height: 1.65;
}

.help-guide-steps {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.system-alert-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.58);
}

.system-alert-modal {
  position: relative;
  width: min(560px, 100%);
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-top: 4px solid #f59e0b;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.32);
}

.system-alert-header {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 22px;
}

.system-alert-title-wrap {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.system-alert-warning-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
}

.system-alert-title-wrap h2 {
  margin: 0;
  color: #0f172a;
  font-size: 21px;
  font-weight: 900;
  line-height: 1.2;
}

.system-alert-only-reminder {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  background: #fff7ed;
  padding: 0 10px;
  color: #c2410c;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.system-alert-close {
  display: inline-flex;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.system-alert-close:hover {
  background: #f1f5f9;
}

.system-alert-close img {
  width: 22px;
  height: 22px;
}

.system-alert-product {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 22px 0;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
  padding: 10px 12px;
}

.system-alert-product-image {
  width: 54px;
  height: 54px;
  flex: 0 0 auto;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  object-fit: cover;
}

.system-alert-product-copy {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.system-alert-product-copy strong {
  overflow: hidden;
  color: #111827;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-alert-product-copy span {
  overflow: hidden;
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-alert-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 12px 22px 0;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.system-alert-metric {
  display: grid;
  min-width: 0;
  gap: 7px;
  padding: 14px 18px;
}

.system-alert-metric + .system-alert-metric {
  border-left: 1px solid #e2e8f0;
}

.system-alert-metric span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.system-alert-metric strong {
  color: #dc2626;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.system-alert-metric:first-child strong {
  color: #d97706;
}

.system-alert-message {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  margin: 16px 22px 0;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  background: #fff7ed;
  padding: 14px 16px;
}

.system-alert-message > img {
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.system-alert-message strong {
  display: block;
  color: #9a3412;
  font-size: 14px;
  font-weight: 900;
}

.system-alert-message p {
  margin: 7px 0 0;
  color: #7c2d12;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.65;
}

.system-alert-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 1.3fr;
  gap: 8px;
  padding: 18px 22px 14px;
}

.system-alert-actions .btn {
  min-width: 0;
  height: 42px;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.system-alert-secondary {
  border-color: #cbd5e1;
  color: #334155;
}

.system-alert-actions .btn.system-alert-attention {
  border-color: #fecaca;
  color: #dc2626;
}

.system-alert-actions .btn.system-alert-attention:hover {
  border-color: #fca5a5;
  background: #fff1f2;
  color: #b91c1c;
}

.system-alert-primary {
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.system-alert-footnote {
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 10px 22px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

@media (max-width: 680px) {
  .system-alert-overlay {
    align-items: flex-end;
    padding: 12px;
  }

  .system-alert-modal {
    width: 100%;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }

  .system-alert-header,
  .system-alert-product {
    padding-right: 16px;
    padding-left: 16px;
  }

  .system-alert-product {
    margin-right: 16px;
    margin-left: 16px;
  }

  .system-alert-metrics,
  .system-alert-message {
    margin-right: 16px;
    margin-left: 16px;
  }

  .system-alert-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-right: 16px;
    padding-left: 16px;
  }

  .system-alert-primary {
    grid-column: 1 / -1;
  }
}

.help-guide-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.help-guide-step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 900;
}

.help-guide-step strong {
  display: block;
  color: #0f172a;
  font-size: 14px;
}

.help-guide-step span {
  display: block;
  margin-top: 4px;
  color: #475569;
  font-size: 13px;
  line-height: 1.55;
}

.top-actions {
  display: flex;
  flex: 1 1 360px;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.auth-user {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 12px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.btn {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 16px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  border-color: #bfdbfe;
  background: #f8fbff;
  color: #1d4ed8;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.05);
}

.btn.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.btn.primary:hover {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #fff;
}

.install-app-btn {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.install-app-btn:hover {
  border-color: #86efac;
  background: #dcfce7;
  color: #065f46;
}

.btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(150px, 12vw, 190px), 1fr));
  gap: 14px;
  padding: 18px;
  margin-bottom: 16px;
}

.date-shortcuts {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  align-self: end;
}

.date-shortcuts button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  font-weight: 800;
  cursor: pointer;
}

.date-shortcuts button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eff6ff;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 11px;
  color: var(--ink);
  outline: none;
}

input,
select {
  height: 40px;
}

textarea {
  min-height: 82px;
  padding-top: 10px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.notice {
  max-width: 100%;
  margin-bottom: 16px;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-word;
}

.notice.ok {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: var(--green);
}

.notice.error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: var(--red);
}

.assignment-alert,
.final-price-alert {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  padding: 12px 14px;
  color: #9a3412;
  font-size: 14px;
  font-weight: 800;
}

.assignment-alert .sub,
.final-price-alert .sub {
  margin-top: 5px;
  color: #9a3412;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}

.assignment-alert .btn,
.final-price-alert .btn {
  flex: 0 0 auto;
  height: 34px;
  border-color: #fdba74;
}

.assignment-alert {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1e40af;
}

.assignment-alert .sub {
  color: #1e40af;
}

.assignment-alert .btn {
  border-color: #93c5fd;
}

.assignment-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 310px;
  overflow: auto;
}

.assignment-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 0.9fr);
  gap: 10px;
  align-items: center;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
}

.assignment-meta {
  min-width: 0;
}

.assignment-meta strong {
  display: block;
  overflow: hidden;
  color: #0f172a;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-meta span {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-bind {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.assignment-bind input {
  width: 100%;
  height: 34px;
}

.hidden {
  display: none !important;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(150px, 12vw, 190px), 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.config-panel {
  margin-bottom: 16px;
}

.diagnostic-panel {
  margin-bottom: 16px;
}

.diagnostic-body {
  padding: 16px 18px;
}

.diagnostic-summary {
  margin-bottom: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  padding: 14px;
}

.diagnostic-summary b {
  display: block;
  margin-bottom: 8px;
  color: #1e40af;
  font-size: 16px;
}

.diagnostic-summary ul {
  margin: 0;
  padding-left: 20px;
  color: #334155;
}

.diagnostic-summary li + li {
  margin-top: 4px;
}

.visible-accounts {
  margin-top: 14px;
}

.visible-accounts h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.account-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.account-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
  font-size: 13px;
}

.account-chip b {
  display: block;
  margin-bottom: 4px;
}

.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  padding: 18px;
}

.config-grid .wide {
  grid-column: 1 / -1;
}

.field-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.config-actions {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.config-actions span {
  color: var(--muted);
  font-size: 13px;
}

.main > .config-panel,
.main > .log-panel,
.main > .permission-panel {
  margin-bottom: 16px;
}

.permission-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 18px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.permission-form,
.permission-right {
  min-width: 0;
}

.permission-form h3,
.permission-right h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.permission-form label {
  display: block;
  margin-bottom: 12px;
}

.permission-form .inline-check {
  display: flex;
  gap: 8px;
  align-items: center;
}

.permission-form .inline-check input {
  width: auto;
}

.permission-form .inline-check span {
  margin: 0;
}

.permission-actions {
  display: flex;
  gap: 10px;
}

.permission-actions .btn {
  flex: 1;
}

.permission-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.permission-checks label {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 0 10px;
  font-weight: 800;
}

.permission-checks input {
  width: auto;
}

.permission-checks span {
  margin: 0;
}

.permission-table-wrap {
  border-top: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
}

@media (max-width: 820px) {
  .permission-layout {
    grid-template-columns: 1fr;
  }
}

.config-section-label {
  border-top: 1px solid var(--line);
  padding: 14px 18px 0;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.config-panel .panel-head + .config-section-label {
  border-top: 0;
}

.config-log-table {
  max-height: min(62vh, 640px);
  overflow: auto;
}

.meta-usage-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin: 0 18px 12px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
  padding: 10px 12px;
  color: #166534;
  font-size: 13px;
  line-height: 1.45;
}

.meta-usage-panel.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.meta-usage-panel.danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.meta-usage-panel.muted {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #475569;
}

.meta-usage-badge {
  display: inline-flex;
  align-items: center;
  min-width: 68px;
  justify-content: center;
  border-radius: 999px;
  background: #dcfce7;
  padding: 3px 8px;
  color: #166534;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.meta-usage-badge.warning {
  background: #fef3c7;
  color: #92400e;
}

.meta-usage-badge.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.meta-usage-badge.muted {
  background: #f1f5f9;
  color: #64748b;
}


.sidebar .config-panel,
.sidebar .log-panel {
  margin: 12px;
  border-radius: 8px;
  box-shadow: none;
}

.sidebar .config-panel .panel-head,
.sidebar .log-panel .panel-head {
  display: block;
  padding: 14px;
}

.sidebar .config-panel h2,
.sidebar .log-panel h2 {
  font-size: 16px;
}

.sidebar .config-panel .panel-head p,
.sidebar .log-panel .panel-head p {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.45;
}

.sidebar .config-panel .account-info {
  max-width: none;
  margin-top: 8px;
  text-align: left;
  font-size: 12px;
}

.sidebar .config-grid {
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px;
}

.sidebar .config-grid .wide,
.sidebar .config-actions {
  grid-column: auto;
}

.sidebar .config-actions {
  display: grid;
  gap: 8px;
  align-items: stretch;
}

.sidebar .config-actions .btn {
  width: 100%;
}

.sidebar .config-actions span {
  font-size: 12px;
  line-height: 1.45;
}

.sidebar label span {
  margin-bottom: 5px;
  font-size: 12px;
}

.sidebar input,
.sidebar select {
  height: 34px;
}

.sidebar textarea {
  min-height: 62px;
}

.sidebar #accountIdsInput {
  min-height: 58px;
}

.sidebar #coupangMatchRules {
  min-height: 86px;
}

.sidebar .config-section-label {
  border-top: 1px solid var(--line);
  padding: 12px 14px 0;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.sidebar .config-panel .panel-head + .config-section-label {
  border-top: 0;
}

.sidebar .config-log-table {
  max-height: 360px;
  margin-top: 10px;
  overflow: auto;
}

.sidebar .config-log-table table {
  min-width: 640px;
  table-layout: fixed;
  font-size: 12px;
}

.sidebar .config-log-table th,
.sidebar .config-log-table td {
  overflow: hidden;
  padding: 8px;
  text-overflow: ellipsis;
}

.sidebar .config-log-table th:nth-child(1) { width: 120px; }
.sidebar .config-log-table th:nth-child(2) { width: 42px; }
.sidebar .config-log-table th:nth-child(3) { width: 56px; }
.sidebar .config-log-table th:nth-child(4) { width: 52px; }
.sidebar .config-log-table th:nth-child(5) { width: 66px; }
.sidebar .config-log-table th:nth-child(6) { width: 88px; }
.sidebar .config-log-table th:nth-child(7) { width: 216px; }

.card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff 0, #fbfdff 100%);
  padding: clamp(12px, 1vw, 16px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.035);
}

.card span {
  color: var(--muted);
  font-size: 13px;
}

.card b {
  display: block;
  margin-top: 9px;
  font-size: clamp(18px, 1.45vw, 24px);
  line-height: 1.1;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff 0, #fbfdff 100%);
  padding: 16px 18px;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.account-info {
  max-width: 420px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

body[data-view-mode="ads"] .product-frozen-head {
  position: sticky;
  top: 0;
  z-index: 55;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

body[data-view-mode="ads"] #productGroupsPanel {
  overflow: visible;
}

body[data-view-mode="ads"] #filtersPanel {
  gap: 10px;
  margin-bottom: 10px;
  padding: 12px 14px;
}

body[data-view-mode="ads"] #filtersPanel label span {
  margin-bottom: 5px;
  font-size: 12px;
}

body[data-view-mode="ads"] #filtersPanel input,
body[data-view-mode="ads"] #filtersPanel select {
  height: 36px;
}

body[data-view-mode="ads"] .assignment-alert,
body[data-view-mode="ads"] .final-price-alert {
  margin-bottom: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

body[data-view-mode="ads"] .ad-summary-cards {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

body[data-view-mode="ads"] .ad-summary-cards .card {
  padding: 10px 12px;
  box-shadow: none;
}

body[data-view-mode="ads"] .ad-summary-cards .card span {
  font-size: 12px;
}

body[data-view-mode="ads"] .ad-summary-cards .card b {
  margin-top: 6px;
  font-size: 19px;
}

body[data-view-mode="ads"] .ad-summary-cards .card small {
  display: block;
  min-height: 14px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

body[data-view-mode="ads"] #productGroupsPanel .panel-head {
  min-height: 50px;
  padding: 9px 14px;
}

body[data-view-mode="ads"] #productGroupsPanel .panel-head h2 {
  font-size: 17px;
}

.product-view-actions,
.product-view-settings {
  position: relative;
}

.product-view-settings > summary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  padding: 0 12px;
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.product-view-settings > summary::-webkit-details-marker {
  display: none;
}

.product-view-settings[open] > summary {
  border-color: #60a5fa;
  background: #dbeafe;
}

.product-view-settings-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  right: 0;
  width: min(560px, 84vw);
  max-height: min(640px, 72vh);
  overflow: auto;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
}

.product-view-settings-title {
  margin: 10px 0 8px;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.product-view-settings-title:first-child {
  margin-top: 0;
}

.product-view-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.product-view-presets button {
  min-width: 58px;
  height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  font-weight: 800;
  cursor: pointer;
}

.product-view-presets button:hover,
.product-view-presets button.active {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
}

.product-view-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px 10px;
}

.product-view-options label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.product-view-options label span {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-view-options input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  min-height: 0;
}

.product-column-hidden {
  display: none !important;
}

.product-roi-panel {
  margin: 12px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  overflow: hidden;
}

.product-roi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.product-roi-title {
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
}

.product-roi-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  padding: 12px 14px;
}

.product-roi-cards > div {
  border: 1px solid #dbe5f1;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.product-roi-cards > div.product-roi-primary {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
}

.product-roi-cards span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-roi-cards b {
  display: block;
  margin-top: 6px;
  color: #0f172a;
  font-size: 19px;
  line-height: 1.1;
}

.product-roi-primary b {
  color: #1d4ed8;
}

.product-roi-periods {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  padding: 0 14px 14px;
}

.product-roi-period-card {
  min-width: 0;
  border: 1px solid #dbe5f1;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.product-roi-period-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.product-roi-period-card b {
  display: block;
  margin-top: 6px;
  color: #0f172a;
  font-size: 20px;
  line-height: 1.1;
}

.product-roi-period-card small {
  display: block;
  margin-top: 7px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.product-roi-chart {
  margin: 0 14px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.product-roi-chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.product-roi-chart-head strong {
  display: block;
  color: #0f172a;
  font-size: 13px;
  font-weight: 900;
}

.product-roi-chart-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.product-roi-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  justify-content: flex-end;
}

.product-roi-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #334155;
  white-space: nowrap;
}

.product-roi-chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.product-roi-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
}

.product-roi-chart-grid {
  stroke: #e2e8f0;
  stroke-width: 1;
}

.product-roi-chart-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.product-roi-chart-label {
  fill: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.product-roi-sections {
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
  padding: 0 14px 14px;
}

.product-roi-section {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
}

.product-roi-section-title {
  border-bottom: 1px solid #e2e8f0;
  padding: 9px 10px;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.product-roi-table {
  min-width: 560px;
  font-size: 12px;
}

.product-roi-table th,
.product-roi-table td {
  padding: 8px 10px;
}

.manual-spend-cell {
  min-width: 180px;
}

.manual-spend-editor {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}

.manual-ad-spend-input {
  width: 86px;
  height: 28px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 1900px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

th {
  border-bottom: 1px solid var(--line);
  background: #f7fafd;
  padding: 11px 12px;
  color: #475569;
  font-weight: 900;
  text-align: left;
  white-space: nowrap;
}

.has-tip {
  cursor: help;
  text-decoration: underline dotted rgba(71, 85, 105, 0.55);
  text-underline-offset: 3px;
}

.hover-tip {
  position: fixed;
  z-index: 99999;
  max-width: min(320px, calc(100vw - 24px));
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.24);
  color: #fff;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.hover-tip.show {
  opacity: 1;
  transform: translateY(0);
}

td {
  border-bottom: 1px solid #edf2f7;
  padding: 11px 12px;
  vertical-align: middle;
  white-space: nowrap;
}

tr:hover td {
  background: #f8fbff;
}

.name {
  max-width: 320px;
  white-space: normal;
  font-weight: 800;
}

.sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.status {
  display: inline-flex;
  align-items: center;
  height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #f1f5f9;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.status.active {
  background: #dcfce7;
  color: var(--green);
}

.status.paused {
  background: #fef3c7;
  color: var(--amber);
}

.status.pending {
  background: #dbeafe;
  color: #2563eb;
}

.status.deleted,
.status.archived {
  background: #fee2e2;
  color: var(--red);
}

.num {
  font-variant-numeric: tabular-nums;
}

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

.compact table {
  min-width: 1050px;
}

.trend-panel {
  margin-bottom: 16px;
}

.external-system-panel {
  margin-bottom: 16px;
}

.robot-design-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.robot-design-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid #dbe5f1;
  border-radius: 8px;
  background: #fff;
}

.robot-design-grid b {
  display: block;
  margin-bottom: 6px;
  color: #0f172a;
  font-size: 13px;
}

.robot-design-grid span {
  display: block;
  color: #475569;
  font-size: 12px;
  line-height: 1.5;
}

.external-system-frame {
  display: block;
  width: 100%;
  height: calc(100dvh - 170px);
  min-height: min(680px, calc(100dvh - 150px));
  border: 0;
  background: #fff;
}

.design-image-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.design-image-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
}

.design-image-form,
.design-image-side {
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.design-image-side h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.design-image-side p {
  margin: 0 0 10px;
  color: #53647a;
  line-height: 1.65;
}

.design-image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.design-image-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #142238;
  font-weight: 700;
}

.design-image-grid label.wide {
  grid-column: 1 / -1;
}

.design-image-grid input,
.design-image-grid select {
  width: 100%;
  border: 1px solid #cbd7e6;
  border-radius: 6px;
  padding: 0 10px;
  min-height: 38px;
  background: #fff;
  font: inherit;
}

.design-image-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.design-image-table table {
  min-width: 1180px;
}

.design-image-table td {
  vertical-align: top;
}

.design-image-table b {
  color: #101828;
}

.design-image-table .good {
  color: #079455;
}

.design-image-table .bad {
  color: #d92d20;
}

.design-image-table .muted {
  color: #667085;
}

.design-image-table .sub {
  margin-top: 4px;
}

@media (max-width: 1100px) {
  .design-image-workspace {
    grid-template-columns: 1fr;
  }
}

.breakeven-roi-card {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.breakeven-roi-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.breakeven-roi-head h3 {
  margin: 0 0 4px;
  color: #0f172a;
  font-size: 16px;
}

.breakeven-roi-head p {
  margin: 0;
  color: #64748b;
  font-size: 12px;
}

.breakeven-roi-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(118px, 1fr));
  gap: 10px;
}

.breakeven-roi-grid label {
  min-width: 0;
}

.breakeven-roi-grid label.wide {
  grid-column: span 2;
}

.breakeven-roi-grid span {
  display: block;
  margin-bottom: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.breakeven-roi-grid input {
  width: 100%;
  height: 36px;
}

.breakeven-roi-result {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.breakeven-roi-result > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.breakeven-roi-result span {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 12px;
}

.breakeven-roi-result b {
  color: #0f172a;
  font-size: 18px;
}

.breakeven-roi-result .primary {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.breakeven-roi-result .primary b {
  color: #1d4ed8;
}

.breakeven-roi-hint {
  margin-top: 10px;
  color: #475569;
  font-size: 13px;
}

.breakeven-roi-hint.good {
  color: #047857;
}

.breakeven-roi-hint.bad {
  color: #dc2626;
}

.breakeven-roi-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.profit-product-picker {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.profit-product-picker-head {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(260px, 0.9fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 10px;
}

.profit-product-picker-head label {
  min-width: 0;
}

.profit-product-picker-head span {
  display: block;
  margin-bottom: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.profit-product-picker-head input {
  width: 100%;
  height: 36px;
}

.profit-selected-product {
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 700;
}

.profit-selected-product.missing {
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
}

.profit-product-table {
  max-height: 280px;
  overflow: auto;
}

.profit-product-table table {
  min-width: 960px;
}

.profit-product-table td {
  vertical-align: middle;
}

.profit-product-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
}

.profit-product-name b {
  display: block;
  color: #0f172a;
  font-size: 13px;
}

.product-breakeven-editor {
  margin: 14px 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.product-breakeven-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  gap: 10px;
}

.product-breakeven-grid label {
  min-width: 0;
}

.product-breakeven-grid label.wide {
  grid-column: span 2;
}

.product-breakeven-grid span {
  display: block;
  margin-bottom: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.product-breakeven-grid input {
  width: 100%;
  height: 36px;
}

.product-breakeven-result {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.product-breakeven-result > div {
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.product-breakeven-result span {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 12px;
}

.product-breakeven-result b {
  color: #0f172a;
  font-size: 18px;
}

.product-breakeven-result .primary {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.product-breakeven-result .primary b {
  color: #1d4ed8;
}

.product-breakeven-hint {
  margin-top: 10px;
  color: #475569;
  font-size: 13px;
}

.product-breakeven-hint.good {
  color: #047857;
}

.product-breakeven-hint.bad {
  color: #dc2626;
}

.product-breakeven-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.breakeven-status {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.breakeven-status.good {
  color: #047857;
  background: #d1fae5;
}

.breakeven-status.bad {
  color: #b91c1c;
  background: #fee2e2;
}

.breakeven-status.missing {
  color: #64748b;
  background: #f1f5f9;
}

.daily-trend-table table {
  min-width: 1480px;
}

.returns-table table {
  min-width: 1460px;
}

.daily-trend-table th:first-child,
.daily-trend-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #fff;
  box-shadow: 1px 0 0 #e2e8f0;
}

.daily-trend-table thead th:first-child {
  z-index: 3;
  background: #f8fafc;
}

.daily-date-cell {
  min-width: 126px;
}

.daily-date-cell b,
.daily-data-status {
  display: block;
}

.daily-data-status {
  width: max-content;
  max-width: 118px;
  margin-top: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
  white-space: nowrap;
}

.daily-data-status.realtime,
.daily-data-status.reconciled {
  color: #047857;
  background: #d1fae5;
}

.daily-data-status.pending {
  color: #b45309;
  background: #fef3c7;
}

.daily-data-status.missing {
  color: #64748b;
  background: #f1f5f9;
}

.daily-refund-value {
  color: #c2410c;
  font-weight: 750;
}

.daily-net-value {
  color: #0f766e;
  font-weight: 800;
}

.return-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.return-status-badge.pending {
  color: #b45309;
  background: #fef3c7;
}

.return-status-badge.completed {
  color: #b91c1c;
  background: #fee2e2;
}

.return-status-badge.withdrawn {
  color: #475569;
  background: #e2e8f0;
}

.return-status-badge.unknown {
  color: #1d4ed8;
  background: #dbeafe;
}

.returns-reason-cell {
  min-width: 210px;
  max-width: 320px;
  white-space: normal;
  line-height: 1.45;
}





.sidebar-toggle {
  position: fixed;
  z-index: 50;
  top: 18px;
  left: calc(var(--sidebar-width) - 13px);
  width: 26px;
  height: 54px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  transition: left 0.18s ease, background 0.15s ease, border-color 0.15s ease;
}

.sidebar-toggle:hover {
  border-color: var(--blue);
  background: #eff6ff;
}

.sidebar-resize-handle {
  position: fixed;
  z-index: 45;
  top: 0;
  bottom: 0;
  left: calc(var(--sidebar-width) - 3px);
  width: 6px;
  cursor: col-resize;
  background: transparent;
  transition: left 0.18s ease, background 0.15s ease;
}

.sidebar-resize-handle:hover,
body.sidebar-resizing .sidebar-resize-handle {
  background: rgba(37, 99, 235, 0.18);
}

body.sidebar-resizing {
  cursor: col-resize;
  user-select: none;
}

body.sidebar-resizing .main,
body.sidebar-resizing .sidebar-toggle,
body.sidebar-resizing .sidebar-resize-handle {
  transition: none;
}

body.sidebar-collapsed .sidebar {
  transform: translateX(calc(-1 * var(--sidebar-width)));
  pointer-events: none;
}

body.sidebar-collapsed .main {
  width: 100%;
  margin-left: 0;
}

body.sidebar-collapsed .sidebar-toggle {
  left: 8px;
}

body.sidebar-collapsed .sidebar-resize-handle {
  left: 0;
  width: 12px;
}

body.sidebar-collapsed .sidebar-toggle {
  color: var(--blue);
}

@media (max-width: 1100px) {
  .sidebar-toggle,
  .sidebar-resize-handle {
    display: none;
  }
}

@media (min-width: 1501px) {
  .cards {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  }
}

@media (max-width: 1366px) {
  :root {
    --sidebar-width: 172px;
    --page-padding: 12px;
  }

  h1 {
    font-size: 24px;
  }

  .brand {
    padding-inline: 14px;
  }

  nav {
    padding-inline: 8px;
  }

  nav a {
    padding-inline: 10px;
    font-size: 13px;
  }

  .filters {
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: 10px;
    padding: 14px;
  }

  .cards {
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: 10px;
  }

  .card span {
    font-size: 12px;
  }

  .btn {
    padding-inline: 12px;
  }

  th,
  td {
    padding: 9px 10px;
    font-size: 12px;
  }

  .external-system-frame {
    height: calc(100dvh - 145px);
    min-height: 540px;
  }
}

@media (max-width: 1100px) {
  .main {
    width: 100%;
  }
}

@media (max-width: 900px) {
  .top-actions {
    flex-basis: 100%;
    justify-content: flex-start;
  }

  .external-system-frame {
    height: calc(100dvh - 190px);
    min-height: 460px;
  }

  .breakeven-roi-grid,
  .breakeven-roi-result {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .robot-design-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 8px;
  }

  .brand {
    padding: 14px 16px 8px;
  }

  nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 12px;
  }

  .nav-group-title {
    display: flex;
    flex: 0 0 auto;
    height: 36px;
    align-items: center;
    margin: 0 2px;
    padding: 0 4px;
  }

  nav a {
    flex: 0 0 auto;
    height: 36px;
  }

  .main {
    max-width: none;
    margin-left: 0;
    padding: 16px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  h1 {
    font-size: 22px;
  }

  .page-title-row {
    gap: 6px;
  }

  .help-guide-btn {
    width: 24px;
    height: 24px;
    font-size: 14px;
  }

  .help-guide-overlay {
    align-items: flex-end;
    padding: 12px;
  }

  .help-guide-modal {
    max-height: 82vh;
    padding: 18px;
  }

  .notice {
    margin-bottom: 12px;
    padding: 9px 10px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.45;
  }

  .filters,
  .cards,
  .config-grid {
    grid-template-columns: 1fr;
  }

  .config-grid .wide,
  .config-actions {
    grid-column: 1 / -1;
  }

  .panel-head,
  .assignment-alert,
  .final-price-alert {
    align-items: flex-start;
    flex-direction: column;
  }

  .assignment-item,
  .assignment-bind {
    grid-template-columns: 1fr;
  }

  .account-info {
    max-width: none;
    text-align: left;
  }

  .btn {
    min-width: 0;
  }
}

/* 独立利润计算器：延续现有后台的白底、细边框和紧凑数据密度。 */
.profit-calculator-panel {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  background: transparent;
  box-shadow: none;
}

.profit-calculator-shell {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: #fff;
  padding: clamp(14px, 1.5vw, 24px);
  box-shadow: 0 14px 36px rgba(30, 41, 59, 0.07);
}

.profit-calculator-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.profit-calculator-head > div:first-child {
  min-width: 0;
  flex: 1 1 520px;
}

.profit-calculator-head h2 {
  margin: 4px 0 6px;
  font-size: clamp(21px, 1.7vw, 28px);
  line-height: 1.2;
}

.profit-calculator-head p {
  max-width: 760px;
  margin: 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.profit-calculator-kicker {
  color: #4f46e5;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.profit-calculator-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 1 1 430px;
  min-width: 0;
  gap: 8px;
}

.profit-calculator-actions .btn {
  min-height: 38px;
  white-space: nowrap;
}

.profit-calculator-ratebar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  border: 1px solid #d8ddff;
  border-radius: 10px;
  background: #eef1ff;
  padding: 12px 16px;
}

.profit-rate-copy {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: #4338ca;
}

.profit-rate-copy span {
  font-size: 12px;
  font-weight: 800;
}

.profit-rate-copy b {
  font-size: 14px;
}

#profitCalculatorExchangeRate {
  width: 96px;
  height: 38px;
  border-color: #c7d2fe;
  background: #f8fafc;
  color: #312e81;
  font-weight: 900;
  text-align: center;
  cursor: default;
}

.profit-rate-unit { color: #4338ca; font-size: 13px; }

.profit-rate-status {
  min-width: 0;
  flex: 1;
  color: #047857;
  font-size: 12px;
  font-weight: 700;
}

.profit-calculator-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 12px 2px 10px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.profit-calculator-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.profit-calculator-legend i {
  width: 11px;
  height: 11px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
}

.profit-calculator-legend i.manual { background: #fff8e6; border-color: #fbbf24; }
.profit-calculator-legend i.calculated { background: #ecfeff; border-color: #22d3ee; }
.profit-calculator-legend i.archive { background: #eef2ff; border-color: #818cf8; }

.profit-calculator-table-wrap {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  background: #fff;
  scrollbar-color: #94a3b8 #edf2f7;
}

.profit-calculator-table {
  width: 100%;
  min-width: 2620px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.profit-calculator-table th,
.profit-calculator-table td {
  height: 54px;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px;
  text-align: center;
  vertical-align: middle;
}

.profit-calculator-table th:last-child,
.profit-calculator-table td:last-child { border-right: 0; }
.profit-calculator-table tbody tr:last-child td { border-bottom: 0; }

.profit-calculator-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.35;
}

.profit-calculator-table thead .profit-calculator-groups th {
  top: 0;
  height: 32px;
  border-bottom: 0;
  color: #fff;
  letter-spacing: 0.03em;
}

.profit-calculator-table thead .profit-calculator-groups + tr th { top: 32px; }
.profit-calculator-groups th[rowspan] { background: #312e81; }
.profit-calculator-groups .group-product { background: #4f46e5; }
.profit-calculator-groups .group-cost { background: #d97706; }
.profit-calculator-groups .group-commission { background: #7c3aed; }
.profit-calculator-groups .group-logistics { background: #0891b2; }
.profit-calculator-groups .group-marketing { background: #ea580c; }
.profit-calculator-groups .group-after-sale { background: #e11d48; }
.profit-calculator-groups .group-profit { background: #059669; }

.profit-calculator-row:hover td { box-shadow: inset 0 0 0 999px rgba(37, 99, 235, 0.025); }
.profit-calculator-row td.manual-cell { background: #fffbeb; }
.profit-calculator-row td.sign-rate-cell { background: #eef6ff; }
.profit-calculator-row td.calculated-cell { background: #ecfeff; color: #0e7490; font-weight: 800; }
.profit-calculator-row td.archive-cell { background: #eef2ff; }
.profit-calculator-row td.simulation { background: #fff1f2; box-shadow: inset 0 0 0 1px #fb7185; }

.profit-product-cell {
  position: sticky;
  left: 40px;
  z-index: 2;
  width: 270px;
  min-width: 270px;
  text-align: left !important;
}

.profit-row-index {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 40px;
  min-width: 40px;
  background: #fff;
  color: #64748b;
  font-weight: 900;
}

.profit-product-select {
  width: 100%;
  height: 36px;
  border: 1px solid #c7d2fe;
  border-radius: 7px;
  background: #fff;
  color: #1e293b;
  font-weight: 800;
}

.profit-product-cell small,
.manual-cell small,
.result-cell small {
  display: block;
  margin-top: 5px;
  color: #64748b;
  font-size: 10px;
  line-height: 1.3;
}

.profit-calculator-input {
  width: 86px;
  height: 34px;
  border: 1px solid #f2d59c;
  border-radius: 6px;
  background: #fffdf5;
  padding: 5px 7px;
  color: #7c2d12;
  font-weight: 800;
  text-align: right;
}

.profit-calculator-input:focus,
.profit-product-select:focus {
  outline: 3px solid rgba(79, 70, 229, 0.16);
  border-color: #6366f1;
}

.percent-cell { white-space: nowrap; }
.percent-cell .profit-calculator-input { width: 66px; }
.percent-cell small { display: inline; margin-left: 2px; }

.result-cell b { display: block; font-size: 14px; }
.result-cell.good b { color: #047857; }
.result-cell.bad b { color: #dc2626; }
.result-cell.pending b { color: #64748b; }
.result-cell.roi { background: #eef2ff; color: #4338ca; }
.result-cell.acos { background: #f0fdf4; }

.profit-row-actions {
  min-width: 112px;
  white-space: nowrap;
}

.profit-row-actions .mini-btn + .mini-btn { margin-left: 5px; }

.profit-calculator-summary-title {
  margin: 22px 0 10px;
  color: #312e81;
  font-size: 15px;
  font-weight: 900;
}

.profit-calculator-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(150px, 1fr));
  gap: 12px;
}

.profit-summary-card {
  min-width: 0;
  min-height: 104px;
  border: 1px solid #dbe4f0;
  border-left: 4px solid #6366f1;
  border-radius: 10px;
  background: #fbfdff;
  padding: 16px;
}

.profit-summary-card span,
.profit-summary-card small { display: block; color: #64748b; font-size: 11px; }
.profit-summary-card b { display: block; margin: 9px 0 5px; font-size: 22px; }
.profit-summary-card.profit { border-left-color: #10b981; }
.profit-summary-card.profit b { color: #047857; }
.profit-summary-card.roi { border-left-color: #8b5cf6; }
.profit-summary-card.roi b { color: #6d28d9; }
.profit-summary-card.acos { border-left-color: #f59e0b; }
.profit-summary-card.acos b { color: #b45309; }
.profit-summary-card.max-ad {
  border-color: #fdba74;
  border-left-color: #f97316;
  background: linear-gradient(145deg, #fff7ed, #fff);
  box-shadow: 0 8px 20px rgba(249, 115, 22, 0.08);
}
.profit-summary-card.max-ad b { color: #c2410c; }

.profit-calculator-guide {
  margin-top: 16px;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  background: #f0fdf4;
  padding: 16px 18px;
}

.profit-guide-title { color: #166534; font-size: 14px; font-weight: 900; }
.profit-guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px; margin-top: 12px; }
.profit-guide-grid > div { border-bottom: 1px dashed #bbf7d0; padding-bottom: 8px; }
.profit-guide-grid b { color: #166534; font-size: 12px; }
.profit-guide-grid p { margin: 3px 0 0; color: #3f6250; font-size: 11px; line-height: 1.55; }
.profit-formula-note { margin-top: 10px; border-radius: 7px; background: #dcfce7; padding: 10px 12px; color: #166534; font-size: 12px; font-weight: 800; }

@media (max-width: 1100px) {
  .profit-calculator-head { display: block; }
  .profit-calculator-actions { justify-content: flex-start; margin-top: 14px; }
  .profit-calculator-summary { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .profit-guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .profit-calculator-shell { border-radius: 9px; padding: 12px; }
  .profit-calculator-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .profit-calculator-actions .btn { width: 100%; min-width: 0; padding-inline: 8px; }
  .profit-calculator-actions .btn.primary { grid-column: 1 / -1; }
  .profit-calculator-ratebar { display: grid; grid-template-columns: 1fr 86px auto; gap: 8px; }
  .profit-rate-copy { display: block; }
  .profit-rate-copy span, .profit-rate-copy b { display: block; }
  .profit-rate-status { grid-column: 1 / -1; }
  .profit-calculator-legend { gap: 10px; }
  .profit-calculator-table-wrap { overflow: visible; border: 0; background: transparent; }
  .profit-calculator-table { display: block; min-width: 0; }
  .profit-calculator-table thead { display: none; }
  .profit-calculator-table tbody { display: grid; gap: 12px; }
  .profit-calculator-table tr { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid #dbe4f0; border-radius: 10px; background: #fff; overflow: hidden; }
  .profit-calculator-table td {
    position: static;
    display: grid;
    grid-template-columns: minmax(78px, 0.85fr) minmax(0, 1.15fr);
    align-items: center;
    gap: 8px;
    width: auto;
    min-width: 0;
    height: auto;
    min-height: 50px;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    padding: 8px;
    text-align: right;
  }
  .profit-calculator-table td::before { content: attr(data-label); color: #64748b; font-size: 10px; font-weight: 800; text-align: left; }
  .profit-calculator-table td:nth-child(even) { border-right: 0; }
  .profit-calculator-table td.profit-row-index { display: none; }
  .profit-calculator-table td.profit-product-cell { grid-column: 1 / -1; display: block; width: auto; min-width: 0; border-right: 0; text-align: left !important; }
  .profit-product-cell::before { display: block; margin-bottom: 6px; }
  .profit-calculator-input { width: 100%; min-width: 0; }
  .percent-cell .profit-calculator-input { width: 100%; }
  .profit-row-actions { grid-column: 1 / -1; display: flex !important; justify-content: flex-end; min-width: 0; border-right: 0 !important; }
  .profit-row-actions::before { margin-right: auto; }
  .profit-calculator-summary { grid-template-columns: 1fr 1fr; }
  .profit-summary-card { min-height: 96px; padding: 12px; }
  .profit-summary-card b { font-size: 18px; }
  .profit-guide-grid { grid-template-columns: 1fr; }
}

/* Product archive: automatic Coupang coupon sync */
.product-coupon-sync-bar {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 12px 16px 0;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #f8fbff, #eff6ff);
}

.product-coupon-sync-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.2);
}

.product-coupon-sync-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.product-coupon-sync-copy b {
  color: #0f172a;
  font-size: 13px;
}

.product-coupon-sync-copy span {
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-coupon-sync-bar.success {
  border-color: #a7f3d0;
  background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
}

.product-coupon-sync-bar.success .product-coupon-sync-icon {
  background: #059669;
}

.product-coupon-sync-bar.warning,
.product-coupon-sync-bar.error {
  border-color: #fed7aa;
  background: linear-gradient(135deg, #fffaf5, #fff7ed);
}

.product-coupon-sync-bar.warning .product-coupon-sync-icon,
.product-coupon-sync-bar.error .product-coupon-sync-icon {
  background: #ea580c;
}

.product-master-price-auto {
  display: grid;
  min-width: 150px;
  gap: 6px;
}

.product-master-price-auto > div:first-child {
  display: grid;
  gap: 2px;
}

.product-master-price-auto > div:first-child span {
  color: #64748b;
  font-size: 11px;
}

.product-master-coupon-line {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #047857;
  font-size: 11px;
  font-weight: 750;
}

.product-master-coupon-line.warning {
  color: #b45309;
}

.product-coupon-sku-summary {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.product-archive-coupon em {
  border-radius: 999px;
  padding: 2px 6px;
  background: #fef3c7;
  color: #92400e;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.product-coupon-modal {
  width: min(860px, 100%);
}

.product-coupon-modal .product-review-modal-head h3 {
  margin: 2px 0 0;
  color: #0f172a;
  font-size: 20px;
}

.product-coupon-modal .product-review-modal-head .mini-btn {
  flex: 0 0 auto;
  min-width: 64px;
  white-space: nowrap;
}

.product-coupon-eyebrow {
  color: #2563eb;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .08em;
}

.product-coupon-modal-body {
  grid-template-columns: 1fr;
  max-height: calc(100dvh - 150px);
  overflow-y: auto;
  background: #f8fafc;
}

.product-coupon-detail-card {
  display: grid;
  gap: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  background: #fff;
}

.product-coupon-detail-card.conflict,
.product-coupon-detail-card.needs_review {
  border-color: #fed7aa;
}

.product-coupon-detail-head,
.product-coupon-detail-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.product-coupon-detail-head > div,
.product-coupon-detail-list > div > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.product-coupon-detail-head span,
.product-coupon-detail-list span {
  color: #64748b;
  font-size: 11px;
  line-height: 1.35;
}

.product-coupon-price-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr) auto) minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
}

.product-coupon-price-flow > div {
  display: grid;
  gap: 4px;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.product-coupon-price-flow > div.final {
  background: #eff6ff;
  color: #1d4ed8;
}

.product-coupon-price-flow span {
  color: #64748b;
  font-size: 10px;
}

.product-coupon-price-flow i {
  align-self: center;
  color: #94a3b8;
  font-style: normal;
  font-weight: 900;
}

.product-coupon-detail-list {
  display: grid;
  gap: 7px;
  border-top: 1px solid #eef2f7;
  padding-top: 10px;
}

.product-coupon-detail-list > div + div {
  border-top: 1px dashed #e2e8f0;
  padding-top: 7px;
}

.product-coupon-detail-list strong {
  color: #dc2626;
}

.product-coupon-rule-note {
  margin: 0;
  border-radius: 7px;
  padding: 8px 10px;
  background: #f8fafc;
  color: #475569;
  font-size: 11px;
  line-height: 1.5;
}

.product-coupon-empty {
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 160px;
  color: #64748b;
  text-align: center;
}

@media (max-width: 720px) {
  .product-coupon-sync-bar {
    grid-template-columns: 34px minmax(0, 1fr);
    margin: 10px;
  }

  .product-coupon-sync-icon {
    width: 34px;
    height: 34px;
  }

  .product-coupon-sync-copy span {
    white-space: normal;
  }

  .product-coupon-sync-bar .mini-btn {
    grid-column: 1 / -1;
    width: 100%;
  }

  .product-coupon-detail-head,
  .product-coupon-detail-list > div {
    align-items: flex-start;
    flex-direction: column;
  }

  .product-coupon-price-flow {
    grid-template-columns: 1fr;
  }

  .product-coupon-price-flow i {
    display: none;
  }
}

/* v93: advertising details visual refresh. Business logic and other menus stay unchanged. */
body[data-view-mode="ads"] {
  background: #f5f8fc;
}

body[data-view-mode="ads"] .main {
  padding: 0 18px 22px;
}

body[data-view-mode="ads"] .topbar {
  min-height: 92px;
  margin: 0 -18px 16px;
  border-bottom: 1px solid #e5ebf3;
  background: rgba(255, 255, 255, 0.96);
  padding: 17px 22px;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.025);
}

body[data-view-mode="ads"] .topbar h1 {
  color: #111827;
  font-size: 27px;
  letter-spacing: -0.02em;
}

body[data-view-mode="ads"] .topbar p {
  margin-top: 6px;
  color: #738198;
  font-size: 13px;
}

body[data-view-mode="ads"] .top-actions {
  gap: 9px;
}

body[data-view-mode="ads"] .top-actions .btn,
body[data-view-mode="ads"] .auth-user {
  min-height: 38px;
  border-color: #dce4ef;
  border-radius: 7px;
  padding: 0 14px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.025);
  font-size: 13px;
}

body[data-view-mode="ads"] .top-actions .install-app-btn {
  border-color: #059669;
  background: #059669;
  color: #fff;
}

body[data-view-mode="ads"] #filtersPanel {
  grid-template-columns: minmax(170px, 1.15fr) minmax(135px, 0.9fr) minmax(135px, 0.9fr) minmax(300px, 1.65fr) minmax(150px, 1fr) minmax(220px, 1.45fr);
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
  border-color: #e1e8f1;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.025);
}

body[data-view-mode="ads"] #filtersPanel label span,
body[data-view-mode="ads"] .date-shortcuts-label {
  margin-bottom: 6px;
  color: #526078;
  font-size: 12px;
  font-weight: 800;
}

body[data-view-mode="ads"] #filtersPanel input,
body[data-view-mode="ads"] #filtersPanel select {
  height: 40px;
  border-color: #d8e1ed;
  border-radius: 7px;
  color: #1e293b;
  font-size: 13px;
}

body[data-view-mode="ads"] #filtersPanel input:focus,
body[data-view-mode="ads"] #filtersPanel select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

body[data-view-mode="ads"] .date-shortcuts {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

body[data-view-mode="ads"] .date-shortcuts-label {
  grid-column: 1 / -1;
}

body[data-view-mode="ads"] .date-shortcuts button {
  height: 40px;
  border-color: #d8e1ed;
  border-radius: 7px;
  color: #334155;
  font-size: 13px;
}

body[data-view-mode="ads"] .date-shortcuts button:hover,
body[data-view-mode="ads"] .date-shortcuts button.active {
  border-color: #93b4f8;
  background: #eef4ff;
  color: #2563eb;
}

body[data-view-mode="ads"] #notice,
body[data-view-mode="ads"] .assignment-alert,
body[data-view-mode="ads"] .final-price-alert {
  min-height: 50px;
  margin-bottom: 12px;
  border-radius: 9px;
  padding: 11px 14px;
  box-shadow: none;
  font-size: 13px;
  line-height: 1.5;
}

body[data-view-mode="ads"] #notice.success,
body[data-view-mode="ads"] #notice.loading {
  border-color: #bcebd7;
  background: #f0fcf6;
  color: #047857;
}

body[data-view-mode="ads"] .final-price-alert {
  border-color: #f7d8bd;
  background: #fff9f3;
  color: #c2410c;
}

body[data-view-mode="ads"] .final-price-alert .btn,
body[data-view-mode="ads"] .assignment-alert .btn {
  min-width: 76px;
  height: 36px;
  border-radius: 7px;
  background: #fff;
}

body[data-view-mode="ads"] .ad-summary-cards {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

body[data-view-mode="ads"] .ad-summary-cards .card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  min-height: 98px;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  border-color: #e1e8f1;
  border-radius: 10px;
  padding: 13px 14px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.025);
}

body[data-view-mode="ads"] .ad-kpi-icon {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  margin: 0;
  border-radius: 10px;
  background: #eef4ff;
}

body[data-view-mode="ads"] .ad-kpi-icon img {
  width: 21px;
  height: 21px;
  opacity: 0.86;
}

body[data-view-mode="ads"] .ad-kpi-icon.tone-green,
body[data-view-mode="ads"] .ad-kpi-icon.tone-emerald { background: #eaf9f2; }
body[data-view-mode="ads"] .ad-kpi-icon.tone-purple,
body[data-view-mode="ads"] .ad-kpi-icon.tone-violet { background: #f1edff; }
body[data-view-mode="ads"] .ad-kpi-icon.tone-orange,
body[data-view-mode="ads"] .ad-kpi-icon.tone-coral { background: #fff1e9; }
body[data-view-mode="ads"] .ad-kpi-icon.tone-sky,
body[data-view-mode="ads"] .ad-kpi-icon.tone-cyan { background: #e9f7fb; }
body[data-view-mode="ads"] .ad-kpi-icon.tone-amber { background: #fff7df; }
body[data-view-mode="ads"] .ad-kpi-icon.tone-pink { background: #fff0f6; }
body[data-view-mode="ads"] .ad-kpi-icon.tone-indigo { background: #edf1ff; }
body[data-view-mode="ads"] .ad-kpi-icon.tone-launch { background: #eafaf2; }

body[data-view-mode="ads"] .launch-rate-card {
  border-color: #cceede;
}

body[data-view-mode="ads"] .launch-rate-card .ad-kpi-copy > b {
  color: #047857;
}

body[data-view-mode="ads"] .ad-kpi-copy {
  min-width: 0;
}

body[data-view-mode="ads"] .ad-summary-cards .ad-kpi-copy > span {
  display: block;
  overflow: hidden;
  color: #61708a;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-view-mode="ads"] .ad-summary-cards .ad-kpi-copy > b {
  margin-top: 5px;
  overflow: hidden;
  color: #111827;
  font-size: clamp(18px, 1.15vw, 23px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-view-mode="ads"] .ad-summary-cards .ad-kpi-copy > small {
  display: block;
  min-height: 14px;
  margin-top: 5px;
  overflow: hidden;
  color: #8794a8;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-view-mode="ads"] #productGroupsPanel {
  border-color: #dfe7f1;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.035);
}

body[data-view-mode="ads"] #productGroupsPanel .panel-head {
  min-height: 58px;
  border-bottom-color: #e5ebf3;
  padding: 10px 14px;
  background: #fff;
}

body[data-view-mode="ads"] .product-table-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

body[data-view-mode="ads"] .product-table-tabs {
  display: flex;
  align-items: center;
  gap: 18px;
}

body[data-view-mode="ads"] .product-table-tab {
  position: relative;
  min-height: 38px;
  border: 0;
  background: transparent;
  padding: 0 2px;
  color: #64748b;
  font-size: 16px;
  font-weight: 850;
  cursor: pointer;
}

body[data-view-mode="ads"] .product-table-tab::after {
  position: absolute;
  right: 0;
  bottom: -10px;
  left: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: transparent;
  content: "";
}

body[data-view-mode="ads"] .product-table-tab.active {
  color: #1d4ed8;
}

body[data-view-mode="ads"] .product-table-tab.active::after {
  background: #2563eb;
}

body[data-view-mode="ads"] .product-table-tab.loss.active {
  color: #b91c1c;
}

body[data-view-mode="ads"] .product-table-tab.loss.active::after {
  background: #dc2626;
}

body[data-view-mode="ads"] .product-table-tab b {
  display: inline-flex;
  min-width: 22px;
  height: 20px;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  border-radius: 999px;
  background: #eef2f7;
  padding: 0 6px;
  color: #64748b;
  font-size: 10px;
}

body[data-view-mode="ads"] .product-table-tab.loss b {
  background: #fee2e2;
  color: #b91c1c;
}

body[data-view-mode="ads"] .product-loss-pool-settings {
  min-height: 36px;
  border-color: #fecaca;
  background: #fff7f7;
  color: #b91c1c;
  font-size: 12px;
}

body[data-view-mode="ads"] .product-loss-pool-notice {
  border-bottom: 1px solid #fecaca;
  background: #fff7f7;
  padding: 10px 14px;
  color: #991b1b;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.55;
}

body[data-view-mode="ads"] #productGroupsPanel .panel-head h2 {
  color: #172033;
  font-size: 18px;
}

body[data-view-mode="ads"] .product-table-count {
  margin: 0;
  color: #718096;
  font-size: 12px;
  font-weight: 700;
}

body[data-view-mode="ads"] .product-view-settings > summary {
  min-height: 36px;
  border-color: #d8e1ed;
  border-radius: 7px;
  background: #fff;
  color: #334155;
  font-size: 12px;
}

body[data-view-mode="ads"] .product-view-settings > summary:hover {
  border-color: #93b4f8;
  background: #f8fbff;
  color: #2563eb;
}

body[data-view-mode="ads"] .product-table-wrap {
  border-top: 0;
  background: #fff;
}

body[data-view-mode="ads"] .product-table-wrap table {
  font-size: clamp(11.5px, 0.66vw, 13px);
}

body[data-view-mode="ads"] .product-table-wrap th {
  height: 48px;
  border-bottom-color: #dfe7f1;
  background: #f8fafc;
  color: #40506a;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.01em;
  vertical-align: middle;
}

body[data-view-mode="ads"] .product-table-wrap td {
  min-height: 58px;
  border-bottom-color: #edf1f6;
  color: #1f2937;
  vertical-align: middle;
}

body[data-view-mode="ads"] .product-group-row:hover,
body[data-view-mode="ads"] .product-group-row:hover > td:first-child,
body[data-view-mode="ads"] .product-group-row:hover > td:last-child {
  background: #f7faff;
}

body[data-view-mode="ads"] .product-group-row.expanded,
body[data-view-mode="ads"] .product-group-row.expanded > td:first-child,
body[data-view-mode="ads"] .product-group-row.expanded > td:last-child {
  background: #f2f7ff;
}

body[data-view-mode="ads"] .product-group-identity {
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
}

body[data-view-mode="ads"] .product-group-thumb {
  width: 46px;
  height: 46px;
  border-color: #e0e7f0;
  border-radius: 7px;
}

body[data-view-mode="ads"] .product-group-copy b {
  overflow: hidden;
  color: #172033;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-view-mode="ads"] .product-group-copy .sub {
  margin-top: 3px;
  overflow: hidden;
  color: #8390a3;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-view-mode="ads"] .status {
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 10px;
}

body[data-view-mode="ads"] .product-row-action .mini-btn {
  min-width: 54px;
  min-height: 30px;
  border-color: transparent;
  background: transparent;
  color: #2563eb;
  font-size: 11px;
}

body[data-view-mode="ads"] .product-row-action .mini-btn:hover {
  border-color: #bfdbfe;
  background: #eff6ff;
}

body[data-view-mode="ads"] #productGroupTable > thead th:last-child,
body[data-view-mode="ads"] #productGroupTable > tbody > tr.product-group-row > td:last-child,
body[data-view-mode="ads"] #productHeaderTable > thead th:last-child {
  position: sticky;
  right: 0;
  z-index: 13;
  background: #fff;
  box-shadow: -1px 0 0 #e5ebf3;
}

body[data-view-mode="ads"] #productGroupTable > thead th:last-child,
body[data-view-mode="ads"] #productHeaderTable > thead th:last-child {
  z-index: 29;
  background: #f8fafc;
}

@media (max-width: 1350px) {
  body[data-view-mode="ads"] #filtersPanel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body[data-view-mode="ads"] .ad-summary-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  body[data-view-mode="ads"] .main {
    padding: 0 12px 16px;
  }

  body[data-view-mode="ads"] .topbar {
    margin-right: -12px;
    margin-left: -12px;
    padding: 14px 16px;
  }

  body[data-view-mode="ads"] #filtersPanel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-view-mode="ads"] .ad-summary-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body[data-view-mode="ads"] .topbar {
    align-items: flex-start;
  }

  body[data-view-mode="ads"] .top-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: stretch;
  }

  body[data-view-mode="ads"] .top-actions .auth-user {
    grid-column: 1 / -1;
    justify-content: center;
  }

  body[data-view-mode="ads"] .top-actions .btn {
    width: 100%;
    padding: 0 8px;
  }

  body[data-view-mode="ads"] #filtersPanel {
    grid-template-columns: 1fr;
  }

  body[data-view-mode="ads"] .ad-summary-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body[data-view-mode="ads"] .date-shortcuts {
    grid-template-columns: repeat(5, minmax(56px, 1fr));
    overflow-x: auto;
  }

  body[data-view-mode="ads"] .ad-summary-cards .card {
    grid-template-columns: 36px minmax(0, 1fr);
    min-height: 82px;
    gap: 8px;
    padding: 10px;
  }

  body[data-view-mode="ads"] .ad-kpi-icon {
    width: 36px;
    height: 36px;
  }

  body[data-view-mode="ads"] .ad-kpi-icon img {
    width: 18px;
    height: 18px;
  }

  body[data-view-mode="ads"] .ad-summary-cards .ad-kpi-copy > b {
    font-size: 16px;
  }

  body[data-view-mode="ads"] .product-table-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }
}

@media (min-width: 1101px) and (max-width: 1500px) {
  .cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}


.product-group-row {
  cursor: pointer;
}

.product-group-row:hover {
  background: #f8fbff;
}

.product-group-row.expanded {
  background: #eff6ff;
}

.product-detail-row > td {
  background: #f8fafc;
  padding: 14px;
}

.product-detail {
  display: grid;
  gap: 10px;
}

.detail-title {
  color: #142033;
  font-weight: 800;
}

.detail-table {
  width: 100%;
  min-width: 1500px;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #d8e1eb;
  border-radius: 8px;
  overflow: hidden;
}

.detail-table th,
.detail-table td {
  border-bottom: 1px solid #e7edf4;
  padding: 8px 10px;
  text-align: left;
}

.product-plan-count {
  min-width: 92px;
}

.product-plan-count b {
  display: block;
  color: #0f172a;
}

.historical-campaign-summary-row > td {
  padding: 0 !important;
  background: #f8fafc;
  color: #475569;
}

.deleted-ad-summary {
  display: grid;
  grid-template-columns: minmax(230px, 1.4fr) minmax(420px, 2fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 66px;
  padding: 10px 16px;
  border-left: 3px solid #94a3b8;
}

.deleted-ad-summary-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.deleted-ad-summary-title > span:last-child {
  min-width: 0;
}

.deleted-ad-summary-title b,
.deleted-ad-summary-title small {
  display: block;
}

.deleted-ad-summary-title b {
  overflow: hidden;
  color: #334155;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deleted-ad-summary-title small {
  margin-top: 3px;
  color: #94a3b8;
  font-size: 11px;
}

.deleted-ad-summary-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(80px, 1fr));
  gap: 18px;
  margin: 0;
}

.deleted-ad-summary-metrics div {
  min-width: 0;
}

.deleted-ad-summary-metrics dt {
  color: #94a3b8;
  font-size: 11px;
}

.deleted-ad-summary-metrics dd {
  margin: 3px 0 0;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.historical-campaign-details {
  position: relative;
  min-width: 76px;
}

.historical-campaign-details summary {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: #2563eb;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
  white-space: nowrap;
}

.historical-campaign-details summary::-webkit-details-marker {
  display: none;
}

.historical-campaign-list {
  display: grid;
  max-height: 260px;
  min-width: min(720px, calc(100vw - 220px));
  margin-top: 10px;
  overflow-y: auto;
  border: 1px solid #dbe4ee;
  border-radius: 6px;
  background: #fff;
}

.deleted-ad-summary .historical-campaign-details[open] {
  grid-column: 1 / -1;
}

.deleted-ad-summary .historical-campaign-details[open] summary {
  margin-left: auto;
}

.historical-campaign-item {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(130px, auto);
  gap: 16px;
  padding: 8px 10px;
  border-bottom: 1px solid #edf2f7;
}

.historical-campaign-item:last-child {
  border-bottom: 0;
}

.historical-campaign-item span:last-child {
  text-align: right;
}

.historical-campaign-item b,
.historical-campaign-item small {
  display: block;
}

.historical-campaign-item b {
  max-width: 420px;
  overflow: hidden;
  color: #334155;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.historical-campaign-item small {
  margin-top: 2px;
  color: #94a3b8;
  font-size: 11px;
}

@media (max-width: 1100px) {
  .deleted-ad-summary {
    grid-template-columns: minmax(210px, 1fr) minmax(360px, 1.5fr) auto;
    gap: 16px;
  }

  .deleted-ad-summary-metrics {
    gap: 12px;
  }
}

.group-editor {
  min-width: 250px;
}

.manual-product-input {
  width: 170px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #142033;
  font-size: 12px;
  font-weight: 700;
  outline: none;
}

.manual-product-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.mini-btn {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid #d8e1eb;
  border-radius: 8px;
  background: #fff;
  color: #142033;
  font-weight: 800;
  cursor: pointer;
}

.mini-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.mini-btn.primary {
  border-color: #bfdbfe;
  color: #2563eb;
  background: #eff6ff;
}

.mini-btn.primary:hover {
  background: #dbeafe;
}

.mini-btn:disabled {
  cursor: wait;
  opacity: 0.55;
}

.save-manual-product {
  margin-left: 6px;
}

.product-picker-portal {
  position: fixed;
  z-index: 10000;
  max-height: min(420px, 70vh);
  overflow-y: auto;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  padding: 6px;
}

.product-picker-option {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  gap: 10px;
  border: 0;
  border-radius: 6px;
  background: #fff;
  padding: 6px 8px;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
}

.product-picker-count {
  position: sticky;
  z-index: 1;
  top: -6px;
  margin: -6px -6px 4px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 7px 10px;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.manual-replenishment-picker-option {
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-height: 66px;
  gap: 10px;
  border: 0;
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
}

.product-picker-option:hover,
.product-picker-option:focus,
.manual-replenishment-picker-option:hover,
.manual-replenishment-picker-option:focus {
  background: #eff6ff;
  outline: none;
}

.product-picker-thumb {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  object-fit: cover;
}

.product-picker-thumb-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 14px;
  font-weight: 800;
}

.product-picker-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 2px;
}

.product-picker-text strong {
  overflow: hidden;
  font-size: 13px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-picker-text small {
  color: #64748b;
  font-size: 11px;
  line-height: 1.25;
  white-space: normal;
}

.manual-replenishment-picker-text {
  gap: 4px;
}

.manual-replenishment-picker-text strong,
.manual-replenishment-picker-text small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-replenishment-picker-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.manual-replenishment-meta-chip {
  display: inline-flex;
  align-items: center;
  max-width: 180px;
  min-height: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #eef2ff;
  color: #475569;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-picker-empty {
  padding: 12px;
  color: #64748b;
  font-size: 13px;
}

.detail-note {
  margin-bottom: 8px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
}

body[data-view-mode="daily"] #diagnoseBtn,
body[data-view-mode="daily"] #exportBtn {
  display: none;
}

body[data-view-mode="daily"] #dailyReportPanel {
  margin-top: 0;
}

body[data-view-mode="logs"] #refreshBtn,
body[data-view-mode="logs"] #diagnoseBtn,
body[data-view-mode="logs"] #exportBtn,
body[data-view-mode="config"] #refreshBtn,
body[data-view-mode="config"] #diagnoseBtn,
body[data-view-mode="config"] #exportBtn {
  display: none;
}

.manual-detail-row td {
  background: #fffdf5;
}

.manual-detail-new td {
  border-top: 2px solid #f59e0b;
}

.manual-detail-actions {
  min-width: 150px;
}

.manual-detail-actions .mini-btn {
  margin-left: 6px;
}

.manual-detail-input {
  width: 112px;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.manual-detail-input.wide {
  width: 170px;
}

.manual-detail-input.num {
  width: 88px;
  text-align: right;
}

.creative-panel {
  margin-bottom: 16px;
}

.creative-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}

.creative-leaderboard {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.creative-leaderboard-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.creative-leaderboard-head h3 {
  margin: 0;
  color: #0f172a;
  font-size: 15px;
}

.creative-leaderboard-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.creative-rank-table {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.creative-rank-table table {
  min-width: 940px;
}

.creative-table table {
  min-width: 1180px;
}

.creative-product-row td {
  background: #fbfdff;
  font-weight: 700;
}

.creative-product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 300px;
  white-space: normal;
}

.creative-product-thumb {
  display: block;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border: 1px solid #dbe4ef;
  border-radius: 9px;
  background: #fff;
  object-fit: cover;
}

.creative-product-thumb-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  color: #94a3b8;
  font-size: 10px;
  text-align: center;
}

.creative-product-detail-row > td {
  padding: 0;
  background: #f8fafc;
}

.creative-material-count {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  white-space: nowrap;
}

.creative-material-count b {
  min-width: 18px;
  color: #0f172a;
  font-size: 14px;
  text-align: right;
}

.creative-material-toggle {
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  color: #1d4ed8;
  background: #eff6ff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.creative-material-toggle:hover,
.creative-material-toggle:focus-visible {
  border-color: #60a5fa;
  background: #dbeafe;
  outline: none;
}

.creative-material-toggle.secondary {
  color: #475569;
  border-color: #cbd5e1;
  background: #fff;
}

.creative-product-detail-panel {
  padding: 12px 14px 14px;
  border-top: 2px solid #bfdbfe;
  background: #f8fafc;
}

.creative-product-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.creative-product-detail-head > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.creative-product-detail-head b {
  color: #0f172a;
  font-size: 13px;
}

.creative-product-detail-head span {
  color: #64748b;
  font-size: 12px;
}

.creative-material-table {
  min-width: 2250px !important;
  background: #fff;
}

.creative-material-table th,
.creative-material-table td {
  padding: 9px 10px;
}

.creative-editor-control {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 168px;
}

.creative-editor-input {
  width: 112px;
  height: 30px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 5px 8px;
  background: #fff;
  color: #0f172a;
  font-size: 12px;
}

.creative-editor-input[readonly] {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #334155;
}

.creative-editor-input.is-editing {
  background: #fff;
  border-color: #2563eb;
}

.creative-save-editor {
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
}

.creative-score {
  min-width: 86px;
  color: #0f172a;
  font-weight: 900;
}

.creative-score .sub {
  margin-top: 2px;
  font-weight: 700;
}

.creative-commission {
  color: #b45309;
  font-weight: 900;
}

.creative-hit {
  background: #fff7ed;
  color: #c2410c;
}

.creative-reason {
  display: inline-block;
  margin: 2px 5px 2px 0;
  border-radius: 999px;
  background: #eff6ff;
  padding: 3px 8px;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}


.metric-stack {
  max-width: 190px;
  color: #334155;
  font-size: 12px;
  line-height: 1.55;
  white-space: normal;
}

.creative-trend {
  min-width: 260px;
  color: #334155;
  font-size: 12px;
  line-height: 1.55;
  white-space: normal;
}

.creative-trend div + div {
  margin-top: 2px;
}

.budget-trend {
  min-width: 190px;
  white-space: normal;
  line-height: 1.45;
}

.budget-trend strong {
  display: block;
  font-size: 12px;
  font-weight: 900;
}

.budget-trend span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.budget-trend-good strong {
  color: var(--green);
}

.budget-trend-bad strong {
  color: var(--red);
}

.budget-trend-watch strong,
.budget-trend-stable strong {
  color: var(--amber);
}

.budget-trend-neutral strong {
  color: #64748b;
}

.replenishment-panel {
  margin-bottom: 16px;
}

.replenishment-cards {
  padding: 16px 18px 0;
}

.manual-replenishment-entry {
  margin: 14px 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.manual-replenishment-picker {
  max-height: min(520px, 74vh);
}

.manual-replenishment-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.manual-replenishment-title h3 {
  margin: 0;
  font-size: 15px;
}

.manual-replenishment-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.manual-replenishment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}

.manual-replenishment-grid label {
  display: grid;
  gap: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.manual-replenishment-grid label.wide {
  grid-column: span 2;
  min-width: 220px;
}

.manual-replenishment-grid input,
.manual-replenishment-grid select {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  font: inherit;
}

.manual-replenishment-grid .btn {
  min-height: 34px;
}

.purchase-entry {
  margin-top: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.purchase-entry .manual-replenishment-title,
.purchase-entry .manual-replenishment-selected {
  margin-left: 18px;
  margin-right: 18px;
}

.purchase-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  padding: 16px 18px 18px;
}

.panel-subhead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 8px;
  border-top: 1px solid var(--line);
}

.panel-subhead h3 {
  margin: 0;
  color: #0f172a;
  font-size: 15px;
}

.panel-subhead p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.purchase-replenishment-table {
  margin-top: 0;
}

.purchase-replenishment-table table {
  width: 100%;
  min-width: 1180px;
  table-layout: fixed;
}

.purchase-replenishment-table.purchase-card-mode {
  overflow-x: visible;
}

.purchase-replenishment-table.purchase-card-mode table {
  min-width: 0;
}

.purchase-replenishment-table.purchase-card-mode thead {
  display: none;
}

.purchase-replenishment-table th:nth-child(1) { width: 19%; }
.purchase-replenishment-table th:nth-child(2) { width: 10%; }
.purchase-replenishment-table th:nth-child(3) { width: 16%; }
.purchase-replenishment-table th:nth-child(4) { width: 18%; }
.purchase-replenishment-table th:nth-child(5) { width: 27%; }
.purchase-replenishment-table th:nth-child(6) { width: 10%; }

.purchase-replenishment-input {
  width: 100%;
  min-width: 112px;
  height: 34px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 12px;
}

.purchase-replenishment-input.product-name-input {
  min-width: 180px;
}

.purchase-replenishment-input.purchase-url-input,
.purchase-replenishment-input.purchase-note-input {
  min-width: 0;
}

.purchase-execution-tabs {
  display: flex;
  gap: 6px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.purchase-execution-tabs button {
  height: 36px;
  padding: 0 14px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.purchase-execution-tabs button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.purchase-execution-tabs b {
  margin-left: 4px;
}

.purchase-batch-head td {
  padding: 10px 12px;
  border-top: 2px solid #dbe4f0;
  background: #f8fafc;
}

.purchase-batch-summary,
.purchase-batch-summary > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.purchase-batch-summary {
  justify-content: space-between;
}

.purchase-batch-summary strong,
.purchase-batch-summary span,
.purchase-sku-cell strong,
.purchase-sku-cell span {
  display: block;
}

.purchase-batch-summary strong {
  color: #0f172a;
  font-size: 14px;
}

.purchase-batch-summary span,
.purchase-sku-cell span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.purchase-execution-row > td {
  padding: 10px;
  vertical-align: top;
}

.purchase-sku-cell {
  min-width: 0;
  white-space: normal;
}

.purchase-sku-cell strong {
  color: #0f172a;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.purchase-record-fields {
  display: grid;
  gap: 6px;
}

.purchase-record-fields.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.purchase-record-field {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.purchase-record-field > span {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.purchase-record-field .purchase-replenishment-input {
  min-width: 0;
}

.purchase-record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.purchase-record-actions small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  white-space: normal;
}

.purchase-batch-detail > td {
  padding: 12px;
  background: #fff;
}

.purchase-order-overview {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.2fr);
  gap: 14px;
  margin-bottom: 12px;
}

.purchase-order-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 5px 10px;
  padding: 10px;
  border: 1px solid #dbe4f0;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 12px;
}

.purchase-order-meta b { color: #64748b; }
.purchase-order-meta span { color: #0f172a; font-weight: 800; overflow-wrap: anywhere; }

.purchase-order-meta.purchase-order-edit {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.purchase-order-edit input,
.purchase-order-sku-edit input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 12px;
}

.purchase-order-skus {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #dbe4f0;
  border-radius: 6px;
  font-size: 12px;
}

.purchase-order-skus span { display: block; color: #475569; }

.purchase-order-sku-edit {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) repeat(3, minmax(90px, 0.7fr));
  gap: 8px;
  align-items: end;
  padding: 7px 0;
  border-bottom: 1px solid #e2e8f0;
}

.purchase-order-sku-edit:last-child { border-bottom: 0; }

.purchase-recycle-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fff7f7;
}

.purchase-recycle-summary div { display: grid; gap: 3px; }
.purchase-recycle-summary b { color: #64748b; font-size: 11px; }
.purchase-recycle-summary span { color: #0f172a; font-size: 12px; }

.purchase-tracking-editor {
  display: grid;
  gap: 8px;
}

.purchase-tracking-fields {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.purchase-tracking-editor input,
.purchase-inspection-line input,
.purchase-batch-input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 12px;
}

.purchase-inspection-grid { display: grid; gap: 7px; }

.purchase-inspection-line {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(4, minmax(90px, 0.7fr)) minmax(180px, 1.2fr);
  gap: 8px;
  align-items: end;
  padding: 9px;
  border: 1px solid #dbe4f0;
  border-radius: 6px;
  background: #f8fafc;
}

.purchase-batch-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 10px;
  color: #64748b;
  font-size: 12px;
}

.purchase-inline-feedback {
  min-height: 18px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

.purchase-inline-feedback.working {
  color: #2563eb;
}

.purchase-inline-feedback.success {
  color: #15803d;
}

.purchase-inline-feedback.error {
  color: #dc2626;
  font-weight: 600;
}

.purchase-tracking-status { min-width: 0; }

.row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

.muted-cell {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.logistics-replenishment-table {
  margin-top: 0;
}

.logistics-replenishment-table table {
  min-width: 2480px;
}

#logisticsReplenishmentPanel .logistics-replenishment-table table {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  table-layout: fixed;
}

#logisticsReplenishmentPanel .logistics-replenishment-table th:nth-child(1) { width: 24%; }
#logisticsReplenishmentPanel .logistics-replenishment-table th:nth-child(2) { width: 9%; }
#logisticsReplenishmentPanel .logistics-replenishment-table th:nth-child(3) { width: 14%; }
#logisticsReplenishmentPanel .logistics-replenishment-table th:nth-child(4) { width: 9%; }
#logisticsReplenishmentPanel .logistics-replenishment-table th:nth-child(5) { width: 11%; }
#logisticsReplenishmentPanel .logistics-replenishment-table th:nth-child(6) { width: 11%; }
#logisticsReplenishmentPanel .logistics-replenishment-table th:nth-child(7) { width: 22%; }

#logisticsReplenishmentPanel .logistics-replenishment-table th,
#logisticsReplenishmentPanel .logistics-replenishment-table td {
  min-width: 0;
}

#weihaiOutboundPanel .logistics-replenishment-table table {
  width: 100%;
  min-width: 1550px;
  table-layout: fixed;
}

#weihaiOutboundPanel .logistics-replenishment-table th:nth-child(1) { width: 160px; }
#weihaiOutboundPanel .logistics-replenishment-table th:nth-child(2) { width: 340px; }
#weihaiOutboundPanel .logistics-replenishment-table th:nth-child(3) { width: 90px; }
#weihaiOutboundPanel .logistics-replenishment-table th:nth-child(4) { width: 110px; }
#weihaiOutboundPanel .logistics-replenishment-table th:nth-child(5) { width: 90px; }
#weihaiOutboundPanel .logistics-replenishment-table th:nth-child(6) { width: 125px; }
#weihaiOutboundPanel .logistics-replenishment-table th:nth-child(7) { width: 120px; }
#weihaiOutboundPanel .logistics-replenishment-table th:nth-child(8) { width: 135px; }
#weihaiOutboundPanel .logistics-replenishment-table th:nth-child(9) { width: 180px; }
#weihaiOutboundPanel .logistics-replenishment-table th:nth-child(10) { width: 145px; }
#weihaiOutboundPanel .logistics-replenishment-table th:nth-child(11) { width: 110px; }

#logisticsReplenishmentPanel .replenishment-stage-input,
#weihaiOutboundPanel .replenishment-stage-input {
  width: 100%;
  min-width: 0;
}

#weihaiOutboundPanel .carton-outbound-input {
  width: 100%;
  min-width: 0;
}

#seaLogisticsPanel .logistics-replenishment-table table {
  min-width: 1500px;
}

.shipping-cost-calculator {
  padding: 16px 18px;
  border-bottom: 1px solid #dbe4ee;
  background: #f8fafc;
}

.shipping-calculator-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.shipping-calculator-head h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.shipping-calculator-head p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
}

.shipping-input-grid,
.shipping-rate-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.shipping-input-grid {
  grid-template-columns: repeat(7, minmax(115px, 1fr));
}

.shipping-input-grid label,
.shipping-rate-grid label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.shipping-input-grid label > span,
.shipping-rate-grid label > span {
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

.shipping-input-grid input,
.shipping-rate-grid input {
  width: 100%;
  min-width: 0;
  height: 36px;
}

.shipping-input-grid .shipping-calculated-input {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 700;
  cursor: default;
}

.shipping-rate-settings {
  margin-top: 10px;
}

.shipping-rate-settings summary {
  width: max-content;
  cursor: pointer;
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
}

.shipping-rate-settings[open] summary {
  margin-bottom: 10px;
}

.shipping-rate-grid {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  padding: 12px;
  border: 1px solid #dbe4ee;
  border-radius: 6px;
  background: #ffffff;
}

.shipping-rate-grid .shipping-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding-top: 18px;
}

.shipping-rate-grid .shipping-check input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.shipping-result-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  margin-top: 14px;
  border: 1px solid #dbe4ee;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
}

.shipping-result-strip > div {
  display: grid;
  align-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 92px;
  padding: 12px 14px;
  border-right: 1px solid #e2e8f0;
}

.shipping-result-strip > div:last-child {
  border-right: 0;
}

.shipping-result-strip span,
.shipping-result-strip small {
  color: #64748b;
  font-size: 11px;
  line-height: 1.35;
}

.shipping-result-strip b {
  color: #0f172a;
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.shipping-result-strip .shipping-total-result {
  border-top: 3px solid #16a34a;
  background: #f0fdf4;
}

.shipping-result-strip .shipping-total-result b {
  color: #15803d;
  font-size: 20px;
}

.shipping-calculator-notice {
  margin-top: 10px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.shipping-calculator-notice.success { color: #15803d; }
.shipping-calculator-notice.warning { color: #b45309; }
.shipping-calculator-notice.danger { color: #dc2626; font-weight: 600; }

@media (max-width: 1280px) {
  .shipping-input-grid,
  .shipping-rate-grid,
  .shipping-result-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .shipping-result-strip > div:nth-child(3) {
    border-right: 0;
  }

  .shipping-result-strip > div:nth-child(-n+3) {
    border-bottom: 1px solid #e2e8f0;
  }
}

@media (max-width: 1100px) {
  .purchase-order-overview { grid-template-columns: 1fr; }
  .purchase-order-sku-edit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-order-sku-edit > b { grid-column: 1 / -1; }
  .purchase-recycle-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-tracking-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-inspection-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .purchase-inspection-line .purchase-sku-cell { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .purchase-order-meta.purchase-order-edit,
  .purchase-order-sku-edit,
  .purchase-recycle-summary,
  .purchase-tracking-fields { grid-template-columns: 1fr; }
  .shipping-input-grid,
  .shipping-rate-grid,
  .shipping-result-strip { grid-template-columns: 1fr; }
  .shipping-result-strip > div,
  .shipping-result-strip > div:nth-child(3) {
    min-height: 76px;
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
  }
  .shipping-result-strip > div:last-child { border-bottom: 0; }
  .shipping-calculator-head { align-items: center; }
}

.logistics-replenishment-table td {
  vertical-align: middle;
}

.warehouse-flow-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
}

.warehouse-flow-strip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.warehouse-flow-strip span i {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 50%;
  background: #fff;
  color: #64748b;
  font-style: normal;
  font-weight: 700;
}

.warehouse-flow-strip span.done { color: #15803d; }
.warehouse-flow-strip span.done i { border-color: #86efac; background: #dcfce7; color: #15803d; }
.warehouse-flow-strip span.active { color: #1d4ed8; font-weight: 700; }
.warehouse-flow-strip span.active i { border-color: #2563eb; background: #2563eb; color: #fff; }
.warehouse-flow-strip > b { color: #cbd5e1; font-weight: 400; }

.weihai-inbound-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}

.weihai-inbound-summary .card {
  min-height: 76px;
  padding: 11px 13px;
}

.weihai-inbound-summary .card:nth-child(1) { border-top: 3px solid #f59e0b; }
.weihai-inbound-summary .card:nth-child(2) { border-top: 3px solid #f97316; }
.weihai-inbound-summary .card:nth-child(3) { border-top: 3px solid #22c55e; }
.weihai-inbound-summary .card:nth-child(4) { border-top: 3px solid #94a3b8; }
.weihai-inbound-summary .card small { margin-top: 3px; color: #64748b; font-size: 10px; }

.repack-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.repack-progress-head span {
  color: #2563eb;
  font-size: 10px;
  font-weight: 700;
}

.repack-progress-track {
  overflow: hidden;
  height: 5px;
  margin: 6px 0 4px;
  border-radius: 99px;
  background: #e2e8f0;
}

.repack-progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
}

.repack-remaining-number { color: #c2410c; }

.repack-quantity-input {
  height: 36px;
  border-color: #bfdbfe !important;
  background: #f8fbff !important;
  font-weight: 700 !important;
  text-align: center;
}

.repack-row-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
  align-items: center;
}

.repack-row-actions .mini-btn {
  width: 92px;
  padding-right: 8px;
  padding-left: 8px;
}

.repack-empty-success b,
.repack-empty-success span {
  display: block;
}

.repack-empty-success b { color: #15803d; }
.repack-empty-success span { margin-top: 4px; color: #64748b; font-size: 11px; }

.warehouse-carton-entry {
  margin-top: 14px;
}

.warehouse-carton-summary {
  margin-top: 12px;
}

.warehouse-carton-editor {
  margin-top: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #f8fbff;
  padding: 14px;
}

.warehouse-carton-fields {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.warehouse-carton-fields label {
  display: grid;
  gap: 6px;
}

.warehouse-carton-fields label.wide {
  grid-column: 1 / -1;
}

.warehouse-carton-fields span,
.warehouse-carton-item-head span {
  color: #64748b;
  font-size: 11px;
}

.warehouse-carton-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 15px 0 8px;
}

.warehouse-carton-item-list {
  display: grid;
  gap: 7px;
}

.warehouse-carton-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 130px;
  gap: 12px;
  align-items: center;
  border: 1px solid #dbe5ef;
  border-radius: 6px;
  background: #fff;
  padding: 9px 10px;
}

.warehouse-carton-item > div,
.warehouse-carton-contents {
  min-width: 0;
}

.warehouse-carton-item b,
.warehouse-carton-item span,
.warehouse-carton-contents span {
  display: block;
}

.warehouse-carton-item > div span {
  overflow: hidden;
  margin-top: 3px;
  color: #64748b;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.warehouse-ready-quantity {
  color: #166534;
  text-align: right;
}

.warehouse-ready-quantity small,
.warehouse-ready-quantity b { display: block; }
.warehouse-ready-quantity small { color: #64748b; font-size: 10px; }
.warehouse-ready-quantity b { margin-top: 2px; font-size: 14px; }

.warehouse-carton-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.warehouse-carton-table {
  margin-top: 14px;
}

.warehouse-carton-table table {
  min-width: 900px;
  table-layout: fixed;
}

.warehouse-carton-table th:nth-child(1) { width: 18%; }
.warehouse-carton-table th:nth-child(2) { width: 38%; }
.warehouse-carton-table th:nth-child(3) { width: 10%; }
.warehouse-carton-table th:nth-child(4) { width: 12%; }
.warehouse-carton-table th:nth-child(5) { width: 9%; }
.warehouse-carton-table th:nth-child(6) { width: 13%; }

.warehouse-carton-contents {
  display: grid;
  gap: 4px;
}

.warehouse-carton-contents span {
  overflow: hidden;
  color: #334155;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  #logisticsReplenishmentPanel .logistics-replenishment-table table { min-width: 980px; }
  .warehouse-flow-strip { overflow-x: auto; }
  .weihai-inbound-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .warehouse-carton-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .warehouse-carton-item { grid-template-columns: minmax(0, 1fr) 80px 110px; }
}

@media (max-width: 560px) {
  .weihai-inbound-summary { grid-template-columns: 1fr 1fr; padding: 10px; }
  .weihai-inbound-summary .card { min-height: 70px; padding: 9px 10px; }
}

.wing-inbound-entry,
.wing-print-entry {
  margin-bottom: 14px;
}

.wing-inbound-grid,
.wing-print-grid {
  align-items: end;
}

.wing-inbound-summary {
  margin-top: 12px;
}

.wing-inbound-table,
.wing-print-table {
  margin-top: 12px;
}

.wing-inbound-table table {
  min-width: 1100px;
}

.wing-print-table table {
  min-width: 900px;
}

.wing-product-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
}

.wing-product-cell img {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #d8e2ef;
  background: #f8fafc;
}

.mini-btn.ghost {
  color: #475569;
  background: #f8fafc;
}

.logistics-replenishment-input {
  min-width: 104px;
  height: 34px;
  padding: 6px 8px;
  font-size: 12px;
}

.logistics-note-input {
  min-width: 180px;
}

.tracking-status-cell {
  min-width: 220px;
}

.tracking-status {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 200px;
  max-width: 300px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  white-space: normal;
}

.tracking-status b {
  color: var(--text);
  font-size: 12px;
}

.tracking-status small {
  color: var(--muted);
}

.tracking-status-head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.tracking-subscription {
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
}

.tracking-subscription.success { background: #dcfce7; color: #047857; }
.tracking-subscription.warning { background: #fef3c7; color: #92400e; }
.tracking-subscription.danger { background: #fee2e2; color: #b91c1c; }

.tracking-stage-line {
  display: grid;
  gap: 3px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.tracking-stage-line span {
  background: #e2e8f0;
  color: #94a3b8;
  font-size: 9px;
  overflow: hidden;
  padding: 3px 2px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tracking-stage-line span.done {
  background: #dbeafe;
  color: #1d4ed8;
}

.tracking-status.success b {
  color: #059669;
}

.tracking-status.info b {
  color: #2563eb;
}

.tracking-status.warning b {
  color: #d97706;
}

.tracking-status.danger b {
  color: #dc2626;
}

.tracking-status.muted,
.tracking-status.muted b {
  color: #94a3b8;
}

.manual-replenishment-sku-detail {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #fff;
}

.manual-replenishment-sku-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.manual-replenishment-sku-head strong,
.manual-replenishment-sku-head small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-replenishment-sku-head strong {
  color: #0f172a;
  font-size: 13px;
  font-weight: 900;
}

.manual-replenishment-sku-head small,
.manual-replenishment-sku-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.manual-replenishment-sku-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

.manual-replenishment-sku-option {
  display: flex;
  align-items: flex-start;
  min-width: 0;
  gap: 10px;
  padding: 8px;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
}

.manual-replenishment-sku-option:hover,
.manual-replenishment-sku-option:focus {
  border-color: #93c5fd;
  background: #eff6ff;
  outline: none;
}

.manual-replenishment-sku-option.selected {
  border-color: var(--blue);
  background: #eaf2ff;
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.manual-replenishment-sku-lines {
  display: grid;
  gap: 8px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px dashed #cbd5e1;
}

.manual-replenishment-sku-lines-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.manual-replenishment-sku-lines-head strong {
  color: #0f172a;
  font-size: 13px;
}

.manual-replenishment-sku-lines-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.manual-replenishment-sku-line {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) repeat(3, minmax(110px, 1fr));
  gap: 8px;
  align-items: end;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px;
}

.manual-replenishment-sku-line-product {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.manual-replenishment-sku-line-product strong,
.manual-replenishment-sku-line-product small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-replenishment-sku-line-product strong {
  color: #0f172a;
  font-size: 13px;
}

.manual-replenishment-sku-line-product small {
  color: var(--muted);
  font-size: 12px;
}

.manual-replenishment-sku-line label {
  display: grid;
  gap: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.manual-replenishment-sku-line input {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  font: inherit;
}

@media (max-width: 1100px) {
  .manual-replenishment-sku-line {
    grid-template-columns: 1fr 1fr;
  }

  .manual-replenishment-sku-line-product {
    grid-column: 1 / -1;
  }
}

.manual-replenishment-selected {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  max-width: 420px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.manual-replenishment-selected.selected {
  color: #0f172a;
}

.manual-replenishment-selected img {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
}

.manual-replenishment-selected small {
  color: var(--muted);
}

.replenishment-table table {
  min-width: 1880px;
}

.replenishment-product-table {
  margin-top: 12px;
}

.replenishment-product-table table {
  min-width: 2260px;
}

.replenishment-request-table table {
  min-width: 1780px;
}

.replenishment-request-table.review-mode {
  overflow-x: hidden;
}

.replenishment-request-table.review-mode table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.replenishment-request-table.review-mode th:nth-child(1) { width: 9%; }
.replenishment-request-table.review-mode th:nth-child(2) { width: 19%; }
.replenishment-request-table.review-mode th:nth-child(3) { width: 22%; }
.replenishment-request-table.review-mode th:nth-child(4) { width: 18%; }
.replenishment-request-table.review-mode th:nth-child(5) { width: 21%; }
.replenishment-request-table.review-mode th:nth-child(6) { width: 11%; }

.replenishment-review-main-row > td {
  min-width: 0;
  padding: 14px 12px;
  vertical-align: middle;
}

.replenishment-review-main-row.danger > td:first-child {
  box-shadow: inset 4px 0 #ef4444;
}

.replenishment-review-main-row.warning > td:first-child {
  box-shadow: inset 4px 0 #f59e0b;
}

.replenishment-review-main-row.ok > td:first-child {
  box-shadow: inset 4px 0 #22c55e;
}

.replenishment-review-main-row .status,
.replenishment-review-urgency {
  display: table;
  max-width: 100%;
  margin-bottom: 7px;
  white-space: nowrap;
}

.replenishment-review-urgency {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.replenishment-review-urgency.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.replenishment-review-urgency.warning {
  background: #fef3c7;
  color: #92400e;
}

.replenishment-review-urgency.ok {
  background: #dcfce7;
  color: #166534;
}

.replenishment-review-product {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.replenishment-review-product img,
.replenishment-review-product .replenishment-product-placeholder {
  width: 46px;
  height: 46px;
  border: 1px solid #dbe4f0;
  border-radius: 6px;
  background: #f1f5f9;
  object-fit: cover;
}

.replenishment-review-product-copy {
  min-width: 0;
}

.replenishment-review-product-copy strong {
  display: -webkit-box;
  overflow: hidden;
  color: #0f172a;
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.replenishment-review-product-copy span {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: #64748b;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replenishment-review-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 10px;
}

.replenishment-review-metrics.two-columns {
  grid-template-columns: 1fr;
  gap: 4px;
}

.replenishment-review-metrics span,
.replenishment-review-quantity span {
  min-width: 0;
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}

.replenishment-review-metrics b,
.replenishment-review-quantity b,
.replenishment-review-quantity strong {
  color: #0f172a;
  font-size: 13px;
}

.replenishment-review-metrics b.danger {
  color: #dc2626;
}

.replenishment-review-metrics b.warning {
  color: #b45309;
}

.replenishment-review-reason {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.replenishment-review-reason.danger { color: #b91c1c; }
.replenishment-review-reason.warning { color: #92400e; }
.replenishment-review-reason.ok { color: #166534; }

.replenishment-review-quantity {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.replenishment-review-quantity strong {
  color: #dc2626;
  font-size: 16px;
}

.replenishment-review-quantity small {
  color: #64748b;
  font-size: 11px;
}

.replenishment-review-application {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.replenishment-review-applicant {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.replenishment-review-applicant b {
  overflow: hidden;
  color: #0f172a;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replenishment-review-applicant time,
.replenishment-review-request-no {
  color: #64748b;
  font-size: 11px;
  white-space: nowrap;
}

.replenishment-review-spec-warning {
  color: #b91c1c;
  font-size: 11px;
  font-weight: 800;
}

.replenishment-review-request-no {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.replenishment-review-application > .mini-btn {
  width: fit-content;
  max-width: 100%;
}

.replenishment-review-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  align-items: stretch;
}

.replenishment-review-actions .mini-btn {
  width: 100%;
  min-width: 0;
}

.replenishment-review-detail-row > td {
  border-top: 0;
  background: #f8fafc;
  padding: 0;
}

.replenishment-review-detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  border-top: 1px dashed #cbd5e1;
  padding: 14px 18px 16px;
}

.replenishment-review-detail section {
  min-width: 0;
}

.replenishment-review-detail section > b {
  display: block;
  margin-bottom: 8px;
  color: #334155;
  font-size: 12px;
}

.replenishment-review-detail-reason p {
  margin: 0 0 7px;
  color: #0f172a;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.replenishment-review-detail-reason span {
  color: #64748b;
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.replenishment-review-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-bottom: 7px;
}

.replenishment-review-detail-meta span {
  margin: 0;
}

.replenishment-review-detail-meta strong {
  margin-left: 3px;
  color: #0f172a;
}

.replenishment-review-detail-summary {
  margin-bottom: 5px !important;
  color: #b91c1c !important;
  font-size: 12px;
  font-weight: 700;
}

.replenishment-review-detail-reason details {
  color: #475569;
  font-size: 11px;
}

.replenishment-review-detail-reason summary {
  width: fit-content;
  cursor: pointer;
  color: #2563eb;
  font-weight: 700;
}

.replenishment-review-detail-reason details p {
  margin: 7px 0 4px;
  border-left: 3px solid #cbd5e1;
  padding-left: 9px;
  color: #334155;
}

.replenishment-review-detail-skus {
  max-height: none;
  overflow: visible;
}

.replenishment-review-sku-grid {
  display: grid;
  gap: 4px;
}

.replenishment-review-sku-grid-head,
.replenishment-review-sku-grid-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 100px 120px 90px;
  gap: 12px;
  align-items: center;
}

.replenishment-review-sku-grid-head {
  border-bottom: 1px solid #e2e8f0;
  padding: 0 4px 6px;
  color: #64748b;
  font-size: 10px;
  font-weight: 800;
}

.replenishment-review-sku-grid-row {
  border-bottom: 1px solid #eef2f7;
  padding: 5px 4px;
}

.replenishment-review-sku-name {
  min-width: 0;
}

.replenishment-review-sku-name b,
.replenishment-review-sku-name small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replenishment-review-sku-name.missing-specification b,
.replenishment-review-sku-name.missing-specification small {
  color: #b91c1c;
}

.replenishment-review-sku-name b {
  color: #0f172a;
  font-size: 12px;
}

.replenishment-review-sku-name small {
  margin-top: 2px;
  color: #64748b;
  font-size: 10px;
}

.replenishment-review-sku-grid-row > strong {
  color: #0f172a;
  font-size: 12px;
  text-align: right;
}

.sku-quantity-difference {
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
}

.sku-quantity-difference.same {
  color: #64748b;
}

.sku-quantity-difference.changed {
  color: #d97706;
}

.replenishment-review-sku-grid-row input {
  width: 100%;
  height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 5px 7px;
  text-align: right;
}

.replenishment-review-detail-row.has-quantity-adjustment > td {
  background: #fffaf0;
}

.replenishment-review-detail-form {
  display: grid;
  grid-template-columns: minmax(150px, 180px) minmax(150px, 180px) minmax(260px, 1fr);
  gap: 10px 14px;
  align-content: start;
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
}

.replenishment-review-detail-form > b {
  grid-column: 1 / -1;
  margin-bottom: 0 !important;
}

.replenishment-review-detail-form label > span {
  display: block;
  margin-bottom: 5px;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
}

.replenishment-review-detail-form input[readonly] {
  background: #f1f5f9;
  color: #334155;
  cursor: default;
}

body[data-view-mode="replenishment-review"] .replenishment-cards {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  padding-top: 10px;
  margin-bottom: 10px;
}

body[data-view-mode="replenishment-review"] .replenishment-cards .card {
  padding: 9px 12px;
  box-shadow: none;
}

body[data-view-mode="replenishment-review"] .replenishment-cards .card b {
  display: inline;
  margin: 0 0 0 8px;
  font-size: 18px;
}

.replenishment-review-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 18px 0;
}

.replenishment-review-tabs {
  display: inline-flex;
  gap: 2px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #f8fafc;
  padding: 2px;
}

.replenishment-review-tabs button {
  min-height: 32px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  padding: 0 14px;
  color: #475569;
  cursor: pointer;
  font-weight: 800;
}

.replenishment-review-tabs button.active {
  background: #2563eb;
  color: #fff;
}

.replenishment-audit-panel {
  margin-top: 10px;
  border-top: 1px solid #e2e8f0;
}

.replenishment-audit-filters {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) repeat(3, minmax(150px, 0.7fr));
  gap: 10px;
  padding: 12px 18px;
  background: #f8fafc;
}

.replenishment-audit-filters label {
  min-width: 0;
}

.replenishment-audit-filters span {
  display: block;
  margin-bottom: 5px;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
}

.replenishment-audit-filters input,
.replenishment-audit-filters select {
  width: 100%;
  height: 34px;
}

.replenishment-audit-table,
.replenishment-product-history-table {
  overflow-x: hidden;
}

.replenishment-audit-table table,
.replenishment-product-history-table table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.replenishment-audit-table th:nth-child(1) { width: 12%; }
.replenishment-audit-table th:nth-child(2) { width: 12%; }
.replenishment-audit-table th:nth-child(3) { width: 17%; }
.replenishment-audit-table th:nth-child(4) { width: 9%; }
.replenishment-audit-table th:nth-child(5) { width: 10%; }
.replenishment-audit-table th:nth-child(6) { width: 10%; }
.replenishment-audit-table th:nth-child(7) { width: 12%; }
.replenishment-audit-table th:nth-child(8) { width: 10%; }
.replenishment-audit-table th:nth-child(9) { width: 8%; }

.replenishment-audit-table td,
.replenishment-product-history-table td {
  overflow-wrap: anywhere;
  vertical-align: middle;
}

.replenishment-product-history {
  background: #fff;
}

.replenishment-product-history-table {
  margin-top: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
}

.replenishment-product-history-table th:nth-child(1) { width: 16%; }
.replenishment-product-history-table th:nth-child(2) { width: 10%; }
.replenishment-product-history-table th:nth-child(3) { width: 12%; }
.replenishment-product-history-table th:nth-child(4) { width: 12%; }
.replenishment-product-history-table th:nth-child(5) { width: 14%; }
.replenishment-product-history-table th:nth-child(6) { width: 14%; }
.replenishment-product-history-table th:nth-child(7) { width: 11%; }
.replenishment-product-history-table th:nth-child(8) { width: 11%; }

@media (max-width: 900px) {
  .replenishment-audit-filters {
    grid-template-columns: 1fr 1fr;
  }

  .replenishment-audit-table,
  .replenishment-product-history-table {
    overflow-x: auto;
  }

  .replenishment-audit-table table {
    min-width: 1050px;
  }

  .replenishment-product-history-table table {
    min-width: 900px;
  }
}

@media (max-width: 1100px) {
  .replenishment-request-table.review-mode {
    overflow-x: auto;
  }

  .replenishment-request-table.review-mode table {
    min-width: 920px;
  }

  .replenishment-review-detail {
    grid-template-columns: 1fr;
  }

  .replenishment-review-detail-form {
    grid-template-columns: 1fr 1fr;
  }

  .replenishment-review-detail-form label:last-child {
    grid-column: 1 / -1;
  }
}

.purchase-approved-request-table {
  overflow-x: hidden;
}

.purchase-approved-request-table table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.purchase-approved-request-table th:nth-child(1) { width: 25%; }
.purchase-approved-request-table th:nth-child(2) { width: 49%; }
.purchase-approved-request-table th:nth-child(3) { width: 12%; }
.purchase-approved-request-table th:nth-child(4) { width: 14%; }

.purchase-approved-main-row > td {
  min-width: 0;
  padding: 13px 12px;
  vertical-align: top;
}

.purchase-approved-product {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.purchase-approved-product > span {
  overflow: hidden;
  color: #64748b;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-approved-product .purchase-approved-status {
  display: flex;
  align-items: center;
  gap: 7px;
}

.purchase-approved-sku-list {
  display: grid;
  gap: 5px;
}

.purchase-approved-sku-list.compact .purchase-approved-sku-row {
  min-height: 38px;
}

.purchase-approved-sku-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px;
  gap: 10px;
  align-items: center;
  min-width: 0;
  border-bottom: 1px solid #eef2f7;
  padding: 0 0 5px;
}

.purchase-approved-sku-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.purchase-approved-sku-row > div {
  min-width: 0;
}

.purchase-approved-sku-row b,
.purchase-approved-sku-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-approved-sku-row b {
  color: #0f172a;
  font-size: 12px;
}

.purchase-approved-sku-row span {
  margin-top: 2px;
  color: #64748b;
  font-size: 10px;
}

.purchase-approved-sku-row strong {
  color: #dc2626;
  font-size: 15px;
  text-align: right;
  white-space: nowrap;
}

.purchase-approved-sku-row.missing-specification {
  border-radius: 6px;
  background: #fef2f2;
  padding: 6px;
}

.purchase-approved-sku-row.missing-specification b,
.purchase-approved-sku-row.missing-specification span {
  color: #b91c1c;
}

.purchase-approved-sku-more {
  color: #2563eb;
  font-size: 11px;
  line-height: 1.4;
}

.purchase-approved-sku-missing {
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fef2f2;
  padding: 8px 10px;
  color: #b91c1c;
  font-size: 12px;
}

.purchase-approved-stock {
  display: grid;
  gap: 5px;
}

.purchase-approved-stock span {
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
}

.purchase-approved-stock b {
  color: #0f172a;
}

.purchase-approved-quantity {
  display: grid;
  gap: 4px;
}

.purchase-approved-quantity strong {
  color: #dc2626;
  font-size: 17px;
}

.purchase-approved-quantity span,
.purchase-approved-reviewer span {
  color: #64748b;
  font-size: 11px;
}

.purchase-approved-reason {
  display: -webkit-box;
  overflow: hidden;
  color: #334155;
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.purchase-approved-reviewer {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.purchase-approved-reviewer b,
.purchase-approved-reviewer span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-approved-actions {
  display: grid;
  gap: 6px;
}

.purchase-approved-actions .mini-btn {
  width: 100%;
}

.purchase-approved-status {
  display: grid;
  gap: 6px;
}

.purchase-approved-status .status {
  width: fit-content;
  max-width: 100%;
}

.purchase-approved-status small {
  color: #64748b;
  font-size: 10px;
  line-height: 1.4;
}

.purchase-approved-detail-row > td {
  border-top: 0;
  background: #f8fafc;
  padding: 0;
}

.purchase-approved-detail {
  display: grid;
  gap: 12px;
  border-top: 1px dashed #cbd5e1;
  padding: 14px 18px 16px;
}

.purchase-approved-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.purchase-approved-detail-head > div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.purchase-approved-detail-head b {
  color: #0f172a;
  font-size: 13px;
}

.purchase-approved-detail-head span {
  color: #64748b;
  font-size: 11px;
}

.purchase-approved-detail .purchase-approved-sku-list.full {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 18px;
}

.purchase-approved-detail .purchase-approved-sku-row {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  padding: 8px 10px;
}

.purchase-approved-detail section {
  min-width: 0;
}

.purchase-approved-detail section > b {
  display: block;
  margin-bottom: 7px;
  color: #334155;
  font-size: 12px;
}

.purchase-approved-detail p {
  margin: 0;
  color: #334155;
  line-height: 1.55;
}

.purchase-approved-detail section > span,
.purchase-approved-detail section > div {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .purchase-approved-request-table {
    overflow-x: auto;
  }

  .purchase-approved-request-table table {
    min-width: 880px;
  }

  .purchase-approved-detail .purchase-approved-sku-list.full {
    grid-template-columns: 1fr;
  }
}

.replenishment-request-status-strip {
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  gap: 0;
  min-height: 46px;
  padding: 0 18px;
}

.replenishment-request-status-strip span {
  border-right: 1px solid #e2e8f0;
  color: #64748b;
  padding: 0 22px;
}

.replenishment-request-status-strip span:first-child { padding-left: 0; }
.replenishment-request-status-strip span:last-child { border-right: 0; }
.replenishment-request-status-strip b { color: #0f172a; font-size: 16px; margin-left: 5px; }

.replenishment-request-records {
  border-top: 1px solid #e2e8f0;
  margin-top: 12px;
}

.replenishment-request-records > summary {
  color: #334155;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  list-style: none;
  padding: 12px 16px;
}

.replenishment-request-records > summary::-webkit-details-marker { display: none; }
.replenishment-request-records > summary::before { content: "▸"; margin-right: 7px; }
.replenishment-request-records[open] > summary::before { content: "▾"; }
.replenishment-request-records > summary span { color: #64748b; margin-left: 4px; }
.replenishment-request-records.review-mode > summary { display: none; }

.replenishment-simple-head {
  align-items: center;
  border-bottom: 0;
  min-height: 36px;
}

.replenishment-planning-settings {
  position: relative;
}

.replenishment-planning-settings summary {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #334155;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  list-style: none;
  padding: 7px 12px;
}

.replenishment-planning-settings summary::-webkit-details-marker { display: none; }

.replenishment-settings-popover {
  background: #fff;
  border: 1px solid #dbe4f0;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px;
  position: absolute;
  right: 0;
  top: 42px;
  width: 360px;
  z-index: 12;
}

.replenishment-settings-popover label,
.replenishment-simple-toolbar label {
  display: grid;
  gap: 5px;
}

.replenishment-settings-popover span,
.replenishment-simple-toolbar label > span {
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.replenishment-settings-note {
  color: #64748b;
  font-size: 11px;
  grid-column: 1 / -1;
  line-height: 1.45;
  margin: 0;
}

.replenishment-settings-save {
  grid-column: 1 / -1;
  justify-self: end;
  min-height: 32px;
  padding: 0 18px;
}

.replenishment-simple-toolbar {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(150px, 190px) minmax(320px, 1fr) auto;
}

.replenishment-decision-card {
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.replenishment-decision-card span {
  color: #64748b;
  display: block;
  font-size: 12px;
}

.replenishment-decision-card b {
  color: #0f172a;
  display: block;
  font-size: 22px;
  line-height: 1.2;
  margin-top: 4px;
}

.replenishment-decision-card.danger {
  border-top: 3px solid #ef4444;
}

.replenishment-decision-card.warning {
  border-top: 3px solid #f59e0b;
}

.replenishment-decision-card.ok {
  border-top: 3px solid #22c55e;
}

.replenishment-decision-card.neutral {
  border-top: 3px solid #94a3b8;
}

.replenishment-decision-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.replenishment-decision-filters button {
  align-items: center;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
}

.replenishment-decision-filters button.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.replenishment-decision-filters span {
  font-weight: 700;
}

.replenishment-suggestion-table {
  margin: 12px 0 0;
  padding: 0;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fff;
}

.replenishment-suggestion-table table {
  min-width: 1240px;
  table-layout: fixed;
}

.replenishment-suggestion-table th:nth-child(1) { width: 210px; }
.replenishment-suggestion-table th:nth-child(2) { width: 105px; }
.replenishment-suggestion-table th:nth-child(3) { width: 160px; }
.replenishment-suggestion-table th:nth-child(4) { width: 145px; }
.replenishment-suggestion-table th:nth-child(5) { width: 170px; }
.replenishment-suggestion-table th:nth-child(6) { width: 185px; }
.replenishment-suggestion-table th:nth-child(7) { width: 145px; }
.replenishment-suggestion-table th:nth-child(8) { width: 120px; }

.replenishment-suggestion-table td {
  vertical-align: middle;
}

.replenishment-plan-budget-input {
  height: 32px;
  min-width: 0;
  width: 82px;
}

.replenishment-budget-compact {
  align-items: center;
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.replenishment-suggested-qty {
  color: #dc2626;
  font-size: 16px;
}

.coupang-rocket-mark {
  color: #f97316;
  display: inline-block;
  font-size: 15px;
  margin-right: 4px;
  vertical-align: -1px;
}

.replenishment-orange-stock {
  color: #ea580c;
  font-size: 16px;
}

.replenishment-inventory-link-note {
  align-items: center;
  background: #effaf5;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  color: #166534;
  display: flex;
  gap: 10px;
  margin-top: 10px;
  padding: 9px 12px;
}

.replenishment-inventory-link-note b {
  font-size: 12px;
  font-weight: 600;
}

.replenishment-link-status {
  background: #16a34a;
  border-radius: 999px;
  color: #fff;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
}

.replenishment-auto-deduct-note {
  color: #15803d !important;
}

.replenishment-roi-value {
  color: #047857;
  font-size: 17px;
}

.replenishment-hold-text {
  color: #475569;
  font-size: 14px;
}

.replenishment-days-danger {
  color: #dc2626;
}

.replenishment-purchase-note {
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
}

.replenishment-product-detail-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 12px;
}

.replenishment-product-detail-grid > div {
  background: #fff;
  border: 1px solid #e2e8f0;
  min-width: 0;
  padding: 9px 10px;
}

.replenishment-product-detail-grid > div.wide { grid-column: 1 / -1; }
.replenishment-product-detail-grid span { color: #64748b; display: block; font-size: 11px; margin-bottom: 4px; }
.replenishment-product-detail-grid b { color: #334155; display: block; font-size: 12px; line-height: 1.45; }

.replenishment-detail-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 12px 10px;
}

.replenishment-reason-cell {
  line-height: 1.55;
  min-width: 280px;
  white-space: normal;
}

.replenishment-decision-row.urgent {
  background: #fff7f7;
}

.replenishment-decision-row.suggested {
  background: #fffaf0;
}

.replenishment-decision-row.watch {
  background: #f8fafc;
}

.replenishment-decision-row.loss,
.replenishment-decision-row.data_issue {
  background: #fafafa;
}

.replenishment-sku-detail-row td {
  background: #f8fafc;
  padding: 0;
}

.replenishment-sku-detail-box {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
}

.replenishment-sku-detail-title {
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.replenishment-sku-detail-item {
  align-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(240px, 2fr) repeat(5, minmax(90px, 1fr));
  padding: 8px 10px;
}

.replenishment-sku-detail-item strong,
.replenishment-sku-detail-item span {
  display: block;
}

.replenishment-sku-detail-item span {
  color: #64748b;
  font-size: 12px;
  margin-top: 2px;
}

@media (max-width: 900px) {
  .replenishment-simple-toolbar { grid-template-columns: 1fr 1fr; }
  .replenishment-product-control { grid-column: 1 / -1; }
  .replenishment-product-detail-grid { grid-template-columns: 1fr 1fr; }

  .replenishment-sku-detail-item {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .replenishment-request-status-strip { align-items: flex-start; flex-direction: column; gap: 8px; padding: 12px; }
  .replenishment-request-status-strip span { border-right: 0; padding: 0; }
  .replenishment-simple-toolbar { grid-template-columns: 1fr; }
  .replenishment-product-control { grid-column: auto; }
  .replenishment-product-detail-grid { grid-template-columns: 1fr; }
  .replenishment-inventory-link-note { align-items: flex-start; flex-direction: column; }
}

.replenishment-request-editor {
  background: #f8fbff;
}

.replenishment-request-snapshot,
.replenishment-request-sku-editor {
  padding: 10px 12px;
  border: 1px solid #dbe5f3;
  border-radius: 6px;
  background: #fff;
}

.replenishment-request-sku-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.replenishment-review-sku-line {
  display: grid;
  gap: 4px;
  min-width: 150px;
  margin-bottom: 6px;
}

.replenishment-review-sku-line input {
  width: 100%;
  height: 32px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 5px 7px;
}

.replenishment-request-cell {
  display: grid;
  gap: 6px;
  min-width: 96px;
}

.replenishment-request-review-input {
  width: 100%;
  min-width: 120px;
  height: 34px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 12px;
}

.replenishment-request-review-input.review-note {
  min-width: 170px;
}

.replenishment-request-actions {
  min-width: 210px;
  flex-wrap: wrap;
}

.replenishment-panel > .replenishment-table {
  display: none;
}

.replenishment-product-table td:nth-child(6),
.replenishment-product-table td:nth-child(11),
.replenishment-product-table td:nth-child(12),
.replenishment-product-table td:nth-child(13),
.replenishment-product-table td:nth-child(14),
.replenishment-table td:nth-child(9) {
  font-weight: 800;
}

.replenishment-table .progress-cell,
.replenishment-product-table .progress-cell {
  min-width: 230px;
}

.replenishment-table .text-cell,
.replenishment-product-table .text-cell {
  max-width: 240px;
  white-space: normal;
  line-height: 1.45;
}

.replenishment-table a {
  color: var(--blue);
  font-weight: 800;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-right: 6px;
  padding: 3px 7px;
  border-radius: 6px;
  color: #475569;
  background: #f1f5f9;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.source-badge.manual {
  color: #2563eb;
  background: #dbeafe;
}

.source-badge.sample {
  color: #9333ea;
  background: #f3e8ff;
}

.mini-btn.danger {
  color: #dc2626;
  border-color: #fecaca;
}

.mini-btn.danger:hover {
  background: #fee2e2;
}

.replenishment-product {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.replenishment-product.compact {
  min-width: 220px;
}

.replenishment-product img,
.replenishment-product-placeholder {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef4fb;
  object-fit: cover;
}

.replenishment-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.replenishment-status.linked {
  color: #059669;
  background: #d1fae5;
}

.replenishment-status.unmatched {
  color: #b45309;
  background: #fef3c7;
}

.replenishment-status.missing {
  color: #dc2626;
  background: #fee2e2;
}

.replenishment-progress {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.replenishment-progress.danger {
  color: #dc2626;
  background: #fee2e2;
}

.replenishment-progress.warning {
  color: #b45309;
  background: #fef3c7;
}

.replenishment-progress.info {
  color: #2563eb;
  background: #dbeafe;
}

.replenishment-progress.success {
  color: #059669;
  background: #d1fae5;
}

.replenishment-progress.neutral {
  color: #475569;
  background: #f1f5f9;
}

.replenishment-progress-card {
  display: grid;
  gap: 5px;
  min-width: 220px;
  max-width: 320px;
}

.replenishment-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.replenishment-progress-head span:last-child {
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.replenishment-track {
  display: grid;
  grid-template-columns: repeat(5, minmax(18px, 1fr));
  gap: 4px;
}

.replenishment-track span {
  height: 5px;
  border-radius: 999px;
  background: #e2e8f0;
}

.replenishment-track.step-1 span:nth-child(-n+1),
.replenishment-track.step-2 span:nth-child(-n+2),
.replenishment-track.step-3 span:nth-child(-n+3),
.replenishment-track.step-4 span:nth-child(-n+4),
.replenishment-track.step-5 span:nth-child(-n+5) {
  background: #2563eb;
}

.replenishment-progress-card.success .replenishment-track span,
.replenishment-progress-card.success .replenishment-track.step-5 span {
  background: #10b981;
}

.replenishment-progress-card.status-problem .replenishment-track span:nth-child(-n+5) {
  background: #ef4444;
}

.replenishment-track-labels {
  display: grid;
  grid-template-columns: repeat(5, minmax(18px, 1fr));
  color: #64748b;
  font-size: 11px;
  line-height: 1.2;
}

.replenishment-track-labels span {
  text-align: center;
}

.replenishment-current {
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.replenishment-next {
  font-weight: 800;
  color: #0f172a;
}

.replenishment-product-row.is-expanded {
  background: #eff6ff;
}

.replenishment-expand-row > td {
  padding: 0;
  background: #f8fbff;
}

.replenishment-detail-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border-top: 1px solid var(--line);
}

.replenishment-detail-section {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.replenishment-detail-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 900;
}

.replenishment-detail-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nested-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

.nested-table th,
.nested-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  vertical-align: middle;
}

.nested-table th {
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.nested-table .text-cell {
  max-width: 260px;
  white-space: normal;
  line-height: 1.45;
}

.compact-empty {
  padding: 14px;
}

.replenishment-sku-risk,
.replenishment-suggestion {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.replenishment-sku-risk.danger,
.replenishment-suggestion.danger {
  color: #dc2626;
  background: #fee2e2;
}

.replenishment-sku-risk.warning,
.replenishment-suggestion.warning {
  color: #b45309;
  background: #fef3c7;
}

.replenishment-sku-risk.ok,
.replenishment-suggestion.ok {
  color: #059669;
  background: #d1fae5;
}

.replenishment-sku-risk.neutral,
.replenishment-suggestion.neutral {
  color: #475569;
  background: #f1f5f9;
}

.finance-panel {
  margin-bottom: 16px;
}

.finance-cards {
  padding: 16px 18px 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body[data-view-mode="finance"] #filtersPanel .ad-only-filter {
  display: none;
}

.finance-summary-card {
  min-height: 92px;
  border-top: 4px solid #dbeafe;
}

.finance-summary-card.income {
  border-top-color: #10b981;
}

.finance-summary-card.expense {
  border-top-color: #f59e0b;
}

.finance-summary-card.net {
  border-top-color: #2563eb;
}

.finance-summary-card small {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.finance-negative {
  color: #dc2626 !important;
}

.finance-workspace {
  display: grid;
  grid-template-columns: minmax(440px, 1.15fr) minmax(360px, 0.85fr);
  gap: 14px;
  margin: 14px 18px 0;
  align-items: start;
}

.finance-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
}

.finance-entry {
  padding: 14px;
  margin: 0;
}

.finance-entry-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.finance-sources {
  padding: 14px;
  margin: 0;
}

.finance-records {
  margin: 14px 18px 0;
  overflow: hidden;
}

.finance-records .panel-subhead {
  padding: 14px 14px 10px;
}

.finance-record-search {
  width: min(440px, 100%);
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
}

.finance-voucher-hint {
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
}

.finance-voucher-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  color: #2563eb;
  font-weight: 800;
  text-decoration: none;
}

.finance-voucher-link:hover {
  text-decoration: underline;
}

.finance-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  align-items: end;
}

.finance-grid label {
  display: grid;
  gap: 5px;
  color: #102a43;
  font-size: 12px;
  font-weight: 800;
}

.finance-grid label.wide {
  grid-column: 1 / -1;
  min-width: 0;
}

.finance-mode-hidden {
  display: none !important;
}

.finance-grid input,
.finance-grid select {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  font: inherit;
}

.finance-grid .btn {
  min-height: 38px;
}

.finance-source-list {
  display: grid;
  gap: 10px;
}

.finance-source-item {
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.finance-source-item.income {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.finance-source-item.expense {
  border-color: #fde68a;
  background: #fffbeb;
}

.finance-source-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.finance-source-top strong {
  display: block;
  margin-top: 8px;
  color: #0f172a;
  font-size: 14px;
}

.finance-source-top small {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.finance-source-top b {
  color: #0f172a;
  font-size: 20px;
  white-space: nowrap;
}

.finance-source-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.finance-source-meta span {
  padding: 7px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.78);
  color: #0f172a;
  font-size: 12px;
  line-height: 1.35;
}

.finance-source-meta em {
  display: block;
  margin-bottom: 2px;
  color: #64748b;
  font-size: 11px;
  font-style: normal;
}

.finance-source-item p {
  margin: 10px 0 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.finance-source-empty {
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  text-align: center;
}

.finance-table table {
  min-width: 1180px;
}

.finance-table {
  margin: 0;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
}

.finance-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.finance-badge.income {
  color: #047857;
  background: #d1fae5;
}

.finance-badge.expense {
  color: #b45309;
  background: #fef3c7;
}

.finance-source-detail,
.finance-table .text-cell {
  max-width: 260px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

@media (max-width: 1200px) {
  .finance-cards {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

  .finance-workspace {
    grid-template-columns: 1fr;
  }

  .finance-entry-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .finance-grid,
  .design-image-grid,
  .finance-source-meta {
    grid-template-columns: 1fr;
  }
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.finance-panel {
  padding-bottom: 18px;
  background: #f8fafc;
}

.finance-panel > .panel-head {
  background: #fff;
}

.finance-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.finance-head-actions .account-info {
  margin-right: 4px;
}

.finance-cards {
  padding: 14px 18px 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.finance-summary-card {
  position: relative;
  min-height: 104px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-top-width: 3px;
  border-radius: 10px;
  box-shadow: none;
}

.finance-summary-card.count {
  border-top-color: #8b5cf6;
}

.finance-summary-card b {
  margin-top: 4px;
  font-size: clamp(22px, 2.1vw, 30px);
}

.finance-overview-grid {
  display: grid;
  grid-template-columns: minmax(440px, 1.05fr) minmax(420px, 0.95fr);
  gap: 14px;
  margin: 14px 18px 0;
}

.finance-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px 10px;
}

.finance-card-head h3,
.finance-ledger-head h3 {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
}

.finance-card-head p,
.finance-ledger-head p {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
}

.finance-chart-card,
.finance-sources,
.finance-records {
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.035);
}

.finance-chart-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 4px 16px 16px;
}

.finance-donut-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 220px;
  height: 220px;
}

#financeExpenseChart {
  display: block;
  width: 220px;
  height: 220px;
}

.finance-donut-center {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 118px;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.finance-donut-center span {
  display: block;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.finance-donut-center b {
  display: block;
  margin-top: 5px;
  color: #0f172a;
  font-size: 17px;
  line-height: 1.2;
}

.finance-expense-legend {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding-right: 3px;
}

.finance-legend-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #334155;
  text-align: left;
  cursor: pointer;
}

.finance-legend-item:hover,
.finance-legend-item.active {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.finance-legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.finance-legend-item span {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-legend-item b {
  color: #0f172a;
  font-size: 12px;
  white-space: nowrap;
}

.finance-source-list {
  gap: 7px;
  padding: 0 14px 14px;
}

.finance-source-item {
  padding: 10px 11px;
  border-radius: 7px;
}

.finance-source-item.pending {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.finance-source-top {
  align-items: center;
}

.finance-source-top strong {
  display: inline;
  margin: 0 0 0 7px;
  font-size: 13px;
}

.finance-source-top small {
  margin: 4px 0 0;
  font-size: 11px;
}

.finance-source-top b {
  font-size: 16px;
}

.finance-source-meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 7px;
}

.finance-source-item p {
  margin-top: 7px;
}

.finance-records {
  margin-top: 14px;
}

.finance-ledger-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px 10px;
}

.finance-filter-summary {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.finance-filter-bar {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(5, minmax(126px, auto)) auto;
  gap: 8px;
  align-items: center;
  padding: 0 14px 12px;
}

.finance-filter-bar input,
.finance-filter-bar select {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-size: 12px;
}

.finance-filter-bar input:focus,
.finance-filter-bar select:focus,
.finance-grid input:focus,
.finance-grid select:focus,
.finance-grid textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
  border-color: #2563eb;
}

.finance-search-field {
  min-width: 0;
}

.finance-table {
  max-height: min(58vh, 720px);
  overflow: auto;
}

.finance-table table {
  min-width: 1260px;
}

.finance-table thead {
  position: sticky;
  z-index: 3;
  top: 0;
}

.finance-table tbody tr {
  cursor: pointer;
}

.finance-table tbody tr:hover {
  background: #f8fbff;
}

.finance-table tbody tr.finance-row-voided {
  color: #94a3b8;
  background: #f8fafc;
}

.finance-table tbody tr.finance-row-auto {
  background: #fbfdff;
}

.finance-ledger-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.finance-ledger-title strong {
  color: #0f172a;
  font-size: 13px;
}

.finance-ledger-summary {
  max-width: 300px;
  color: #334155;
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}

.finance-ledger-amount {
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.finance-ledger-amount.income {
  color: #047857;
}

.finance-ledger-amount.expense {
  color: #b45309;
}

.finance-source-mode {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #475569;
  background: #f1f5f9;
  font-size: 11px;
  font-weight: 800;
}

.finance-source-mode.auto {
  color: #1d4ed8;
  background: #dbeafe;
}

.finance-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #475569;
  background: #f1f5f9;
  font-size: 11px;
  font-weight: 800;
}

.finance-status-pill.warning {
  color: #b45309;
  background: #fef3c7;
}

.finance-status-pill.ok {
  color: #047857;
  background: #d1fae5;
}

.finance-row-menu {
  position: relative;
  display: inline-block;
}

.finance-row-menu summary {
  display: grid;
  place-items: center;
  width: 32px;
  min-height: 30px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.finance-row-menu summary::-webkit-details-marker {
  display: none;
}

.finance-row-menu-popover {
  position: absolute;
  z-index: 8;
  top: calc(100% + 4px);
  right: 0;
  display: grid;
  min-width: 108px;
  padding: 5px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}

.finance-row-menu-popover button {
  padding: 7px 9px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #334155;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.finance-row-menu-popover button:hover {
  background: #f1f5f9;
}

.finance-row-menu-popover button.danger {
  color: #dc2626;
}

.finance-drawer-overlay {
  position: fixed;
  z-index: 1002;
  inset: 0;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(2px);
}

.finance-drawer {
  position: fixed;
  z-index: 1003;
  top: 0;
  right: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(520px, 96vw);
  height: 100vh;
  border-left: 1px solid #dbe3ef;
  background: #fff;
  box-shadow: -20px 0 50px rgba(15, 23, 42, 0.18);
  animation: financeDrawerIn 180ms ease-out;
}

@keyframes financeDrawerIn {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.finance-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid #e2e8f0;
}

.finance-drawer-kicker {
  color: #2563eb;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.finance-drawer-head h2 {
  margin: 5px 0 0;
  color: #0f172a;
  font-size: 22px;
}

.finance-drawer-head p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 12px;
}

.finance-drawer-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: #475569;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.finance-drawer-body {
  overflow: auto;
  padding: 18px 22px;
}

.finance-drawer .finance-grid {
  gap: 13px 12px;
}

.finance-drawer .finance-grid label {
  gap: 6px;
}

.finance-drawer .finance-grid input,
.finance-drawer .finance-grid select,
.finance-drawer .finance-grid textarea {
  min-height: 40px;
  border-radius: 7px;
  resize: vertical;
}

.finance-drawer .finance-grid small {
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
}

.finance-drawer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 13px 22px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.finance-detail-list {
  display: grid;
  gap: 0;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  overflow: hidden;
}

.finance-detail-list > div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  padding: 11px 13px;
  border-bottom: 1px solid #e2e8f0;
}

.finance-detail-list > div:last-child {
  border-bottom: 0;
}

.finance-detail-list span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.finance-detail-list b {
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.finance-change-log {
  margin-top: 16px;
}

.finance-change-log h3 {
  margin: 0 0 8px;
  color: #0f172a;
  font-size: 14px;
}

.finance-change-log-item {
  padding: 9px 0;
  border-bottom: 1px solid #e2e8f0;
  color: #475569;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 1260px) {
  .finance-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-overview-grid {
    grid-template-columns: 1fr;
  }

  .finance-filter-bar {
    grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(130px, auto));
  }
}

@media (max-width: 760px) {
  .finance-head-actions {
    justify-content: flex-start;
  }

  .finance-head-actions .account-info {
    flex-basis: 100%;
  }

  .finance-cards {
    grid-template-columns: 1fr 1fr;
    padding: 10px 10px 0;
  }

  .finance-summary-card {
    min-height: 92px;
  }

  .finance-overview-grid,
  .finance-records {
    margin-right: 10px;
    margin-left: 10px;
  }

  .finance-chart-layout {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .finance-expense-legend {
    width: 100%;
  }

  .finance-ledger-head {
    display: block;
  }

  .finance-filter-summary {
    margin-top: 8px;
    text-align: left;
  }

  .finance-filter-bar {
    grid-template-columns: 1fr 1fr;
  }

  .finance-search-field,
  .finance-filter-bar #resetFinanceFiltersBtn {
    grid-column: 1 / -1;
  }

  .finance-drawer {
    width: 100vw;
  }

  .finance-drawer-head,
  .finance-drawer-body,
  .finance-drawer-actions {
    padding-right: 16px;
    padding-left: 16px;
  }

  .finance-detail-list > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

.robot-broadcast-panel {
  display: block;
}

.broadcast-tabs {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
}

.broadcast-tabs button {
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  padding: 10px 16px;
}

.broadcast-tabs button.active {
  border-bottom-color: #2563eb;
  color: #1d4ed8;
}

.broadcast-tab-panel {
  padding: 0 16px 16px;
}

.broadcast-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.15fr) minmax(320px, 0.85fr);
  gap: 16px;
  margin-top: 16px;
}

.broadcast-group-layout {
  grid-template-columns: minmax(360px, 0.8fr) minmax(560px, 1.2fr);
}

.broadcast-group-layout .broadcast-channel-box {
  margin-top: 0;
}

.broadcast-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.broadcast-channel-box {
  margin-top: 16px;
}

.broadcast-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.broadcast-grid label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.broadcast-grid label.wide,
.broadcast-grid .wide {
  grid-column: 1 / -1;
}

.broadcast-grid input,
.broadcast-grid select {
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  padding: 0 12px;
  color: var(--ink);
  font-size: 14px;
}

.broadcast-toggle {
  grid-template-columns: 18px 1fr;
  align-items: center;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 12px;
}

.broadcast-toggle input {
  min-height: 0;
}

.broadcast-fields {
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.broadcast-fields-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #334155;
  font-weight: 900;
}

.broadcast-field-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.broadcast-field-group {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.broadcast-field-group b {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.broadcast-field-group div {
  display: grid;
  gap: 7px;
}

.broadcast-field-group label {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 7px;
  font-weight: 700;
}

.broadcast-field-group input {
  min-height: 0;
}

.broadcast-preview {
  min-height: 280px;
  margin: 0;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.broadcast-rules-box,
.broadcast-log-box {
  margin-top: 16px;
}

.broadcast-rules-box table {
  min-width: 760px;
}

.broadcast-rules-box th:nth-child(1) { width: 130px; }
.broadcast-rules-box th:nth-child(2) { width: 38%; }
.broadcast-rules-box th:nth-child(3) { width: 34%; }
.broadcast-rules-box th:nth-child(4) { width: 110px; }

.broadcast-rule-channel {
  min-height: 36px;
  width: 100%;
}

.status-badge.active,
.status-badge.paused,
.status-badge.deleted {
  display: inline-flex;
  min-width: 46px;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

.status-badge.active {
  background: #dcfce7;
  color: #047857;
}

.status-badge.paused {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.deleted {
  background: #fee2e2;
  color: #b91c1c;
}

@media (max-width: 1100px) {
  .broadcast-layout,
  .broadcast-field-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .product-view-settings-menu {
    position: fixed;
    top: 90px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100dvh - 110px);
  }

  .product-view-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .broadcast-grid {
    grid-template-columns: 1fr;
  }
}

.traffic-panel {
  margin-bottom: 16px;
}

.traffic-safe-note {
  display: flex;
  gap: 8px;
  margin: 14px 18px 0;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
  line-height: 1.5;
}

.traffic-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 14px 18px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.traffic-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.traffic-toggle input {
  width: 16px;
  height: 16px;
}

.traffic-entry {
  margin: 14px 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
}

.traffic-builder {
  margin: 14px 18px 0;
  padding: 14px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #f8fbff;
}

.traffic-plan-grid,
.traffic-rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  align-items: end;
}

.traffic-plan-grid label,
.traffic-rule-grid label {
  display: grid;
  gap: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.traffic-plan-grid label.wide,
.traffic-rule-grid label.wide {
  grid-column: span 2;
  min-width: 260px;
}

.traffic-plan-grid input,
.traffic-plan-grid select,
.traffic-plan-grid textarea,
.traffic-rule-grid input,
.traffic-rule-grid select,
.traffic-rule-grid textarea {
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  color: #0f172a;
  font: inherit;
}

.traffic-plan-grid textarea,
.traffic-rule-grid textarea {
  resize: vertical;
}

.traffic-rule-grid .traffic-toggle {
  align-self: end;
  justify-content: center;
  min-height: 34px;
  background: #fff;
}

.traffic-plan-grid .btn,
.traffic-rule-grid .btn {
  min-height: 34px;
}

.traffic-plan-table,
.traffic-rule-table,
.traffic-candidate-table,
.traffic-log-table {
  margin-top: 14px;
}

.traffic-plan-table table {
  min-width: 1280px;
}

.traffic-rule-table table {
  min-width: 1080px;
}

.traffic-candidate-table table {
  min-width: 1180px;
}

.traffic-log-table table {
  min-width: 1120px;
}

.traffic-panel .text-cell {
  max-width: 320px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.btn.danger {
  color: #fff;
  background: #dc2626;
}

.btn.danger:hover {
  background: #b91c1c;
}

.btn.ghost {
  color: #334155;
  background: #fff;
}

@media (max-width: 1400px) {
  .manual-replenishment-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .manual-replenishment-grid label.wide {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .manual-replenishment-title {
    flex-direction: column;
  }

  .manual-replenishment-grid {
    grid-template-columns: 1fr;
  }

  .manual-replenishment-grid label.wide {
    grid-column: auto;
  }

  .traffic-plan-grid,
  .traffic-rule-grid {
    grid-template-columns: 1fr;
  }

  .traffic-plan-grid label.wide,
  .traffic-rule-grid label.wide {
    grid-column: auto;
    min-width: 0;
  }
}



@media (max-height: 760px) and (min-width: 1101px) {
  .external-system-frame {
    height: calc(100dvh - 120px);
    min-height: 480px;
  }

  .topbar {
    margin-bottom: 12px;
  }
}


.product-table-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  border-right: 1px solid var(--line);
  scrollbar-gutter: stable;
  background: #fff;
}

.product-table-wrap table {
  width: var(--product-table-width, 100%);
  min-width: 0;
  table-layout: fixed;
  font-size: clamp(11px, 0.62vw, 13px);
}

.product-table-wrap th,
.product-table-wrap td {
  padding: clamp(6px, 0.42vw, 10px) clamp(4px, 0.34vw, 8px);
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.product-table-wrap .name {
  max-width: none;
}

.product-table-wrap .sub {
  font-size: clamp(10px, 0.55vw, 12px);
}

.product-table-wrap .manual-spend-cell {
  min-width: 0;
}

.product-table-wrap .manual-spend-editor {
  flex-wrap: wrap;
}

.product-table-wrap .manual-ad-spend-input {
  width: min(86px, 100%);
}

.product-table-wrap th.sortable {
  cursor: pointer;
  position: relative;
  padding-right: 18px;
  user-select: none;
}

.product-table-wrap th.sortable::after {
  color: #94a3b8;
  content: "↕";
  font-size: 10px;
  line-height: 1;
  opacity: 0.75;
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
}

.product-table-wrap th.sortable:hover {
  background: #eff6ff;
  color: var(--primary);
}

.product-table-wrap th.sortable.sorted-asc,
.product-table-wrap th.sortable.sorted-desc {
  color: var(--primary);
}

.product-table-wrap th.sortable.sorted-asc::after {
  color: var(--primary);
  content: "↑";
  opacity: 1;
}

.product-table-wrap th.sortable.sorted-desc::after {
  color: var(--primary);
  content: "↓";
  opacity: 1;
}

.product-table-wrap thead th {
  position: sticky;
  top: var(--product-table-sticky-offset, 0px);
  z-index: 18;
}

#productGroupTable > thead th:first-child,
#productGroupTable > tbody > tr.product-group-row > td:first-child {
  position: sticky;
  left: 0;
  z-index: 12;
  width: 132px;
  min-width: 132px;
  max-width: 132px;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
}

.product-code-cell {
  font-variant-numeric: tabular-nums;
}

.product-code-copy {
  max-width: 100%;
  border: 0;
  border-radius: 3px;
  padding: 2px 3px;
  background: transparent;
  color: #1d4ed8;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.35;
  white-space: nowrap;
}

.product-code-copy:hover {
  background: #eff6ff;
  color: #1e40af;
  text-decoration: underline;
}

.product-code-copy:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 1px;
}

.product-group-identity {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-width: 0;
}

.product-group-thumb {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: #f8fafc;
}

.product-group-thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
}

.product-group-copy {
  min-width: 0;
}

.product-group-copy b {
  display: block;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

#productGroupTable > tbody > tr.product-group-row > td:nth-child(1),
#productGroupTable > tbody > tr.product-group-row > td:nth-child(3),
#productGroupTable > tbody > tr.product-group-row > td:nth-child(4),
#productHeaderTable > thead th:nth-child(1),
#productHeaderTable > thead th:nth-child(3),
#productHeaderTable > thead th:nth-child(4) {
  overflow-wrap: normal;
  white-space: nowrap;
  word-break: normal;
}

#productGroupTable > tbody > tr.product-group-row > td:nth-child(1),
#productGroupTable > tbody > tr.product-group-row > td:nth-child(3),
#productGroupTable > tbody > tr.product-group-row > td:nth-child(4) {
  font-variant-numeric: tabular-nums;
}

#productGroupTable > tbody > tr.product-group-row > td:nth-child(7) .status {
  min-width: 84px;
  justify-content: center;
  white-space: nowrap;
}

.plan-status-cell .status {
  min-width: 72px;
  justify-content: center;
  white-space: nowrap;
}

.plan-status-cell .sub {
  white-space: nowrap;
}

#productGroupTable > thead th:first-child {
  top: var(--product-table-sticky-offset, 0px);
  z-index: 28;
  background: #f8fafc;
}

#productGroupTable > tbody > tr.product-group-row:hover > td:first-child {
  background: #f8fafc;
}

.product-table-head-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  overscroll-behavior-x: contain;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.product-table-head-wrap table {
  width: var(--product-table-width, 100%);
  min-width: 0;
  table-layout: fixed;
  font-size: clamp(11px, 0.62vw, 13px);
}

.product-table-head-wrap th {
  padding: clamp(6px, 0.42vw, 10px) clamp(4px, 0.34vw, 8px);
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.product-table-head-wrap th.sortable {
  cursor: pointer;
  position: relative;
  padding-right: 18px;
  user-select: none;
}

.product-table-head-wrap th.sortable::after {
  position: absolute;
  right: 5px;
  top: 50%;
  color: #94a3b8;
  content: "\2195";
  font-size: 10px;
  line-height: 1;
  opacity: 0.75;
  transform: translateY(-50%);
}

.product-table-head-wrap th.sortable:hover {
  background: #eff6ff;
  color: var(--primary);
}

.product-table-head-wrap th.sortable.sorted-asc,
.product-table-head-wrap th.sortable.sorted-desc {
  color: var(--primary);
}

.product-table-head-wrap th.sortable.sorted-asc::after {
  color: var(--primary);
  content: "\2191";
  opacity: 1;
}

.product-table-head-wrap th.sortable.sorted-desc::after {
  color: var(--primary);
  content: "\2193";
  opacity: 1;
}

.product-table-wrap thead.product-body-head {
  display: none;
}

#productHeaderTable > thead th:first-child {
  position: sticky;
  left: 0;
  z-index: 28;
  width: 132px;
  min-width: 132px;
  max-width: 132px;
  background: #f8fafc;
  box-shadow: 1px 0 0 var(--line);
}

.product-table-resize-handle {
  position: absolute;
  z-index: 35;
  top: 0;
  right: 0;
  bottom: 0;
  width: 9px;
  cursor: ew-resize;
  background: transparent;
}

.product-table-resize-handle::after {
  position: absolute;
  top: 0;
  right: 3px;
  bottom: 0;
  width: 2px;
  background: rgba(37, 99, 235, 0.18);
  content: "";
  opacity: 0;
}

.product-table-resize-handle:hover::after,
body.product-table-resizing .product-table-resize-handle::after {
  opacity: 1;
}

body.product-table-resizing {
  cursor: ew-resize;
  user-select: none;
}

body.product-table-resizing .product-table-wrap {
  transition: none;
}

.product-archive-panel {
  margin-bottom: 16px;
}

.product-archive-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.product-archive-toolbar {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(150px, 190px) auto;
  gap: 12px;
  align-items: end;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.product-archive-toolbar label {
  display: grid;
  gap: 6px;
}

.product-archive-table-wrap {
  max-height: calc(100vh - 330px);
  overflow: auto;
}

.product-archive-table {
  min-width: 1285px;
  table-layout: fixed;
}

.product-archive-table > thead > tr > th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f1f5f9;
}

.product-archive-table > thead > tr > th:nth-child(1) { width: 260px; }
.product-archive-table > thead > tr > th:nth-child(2) { width: 115px; }
.product-archive-table > thead > tr > th:nth-child(3) { width: 205px; }
.product-archive-table > thead > tr > th:nth-child(4) { width: 105px; }
.product-archive-table > thead > tr > th:nth-child(5) { width: 170px; }
.product-archive-table > thead > tr > th:nth-child(6) { width: 110px; }
.product-archive-table > thead > tr > th:nth-child(7) { width: 120px; }
.product-archive-table > thead > tr > th:nth-child(8) { width: 135px; }
.product-archive-table > thead > tr > th:nth-child(9) { width: 72px; }

.product-archive-table th,
.product-archive-table td {
  vertical-align: middle;
}

.product-archive-link-cell {
  display: flex;
  min-height: 32px;
  align-items: center;
}

.product-archive-link-cell .mini-btn,
.product-archive-link-state {
  min-width: 72px;
  min-height: 30px;
}

.product-archive-link-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #cbd5e1;
  border-radius: 7px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.product-archive-link-state.conflict {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #b91c1c;
}

.product-archive-group-row {
  background: #fff;
}

.product-archive-group-row:hover {
  background: #f8fbff;
}

.product-master-product-cell,
.product-master-sku-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.product-master-product-cell .product-archive-name,
.product-master-sku-cell > div {
  min-width: 0;
}

.product-master-sku-cell b {
  display: block;
  overflow-wrap: anywhere;
}

.product-master-spec-summary,
.product-master-metrics,
.product-master-barcode-count,
.product-master-barcode {
  display: grid;
  gap: 4px;
}

.product-master-spec-summary span,
.product-master-metrics span,
.product-master-barcode-count span,
.product-master-barcode span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.product-master-metrics .positive,
.product-master-spec-summary .positive,
.product-master-barcode-count.complete b {
  color: #047857;
}

.product-master-metrics .negative,
.product-master-spec-summary .negative,
.product-master-barcode-count.missing b {
  color: #dc2626;
}

.product-master-price-editor {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) 84px auto;
  gap: 6px;
  align-items: center;
}

.product-master-price-editor > div {
  display: grid;
  gap: 2px;
}

.product-master-price-editor > div span {
  color: var(--muted);
  font-size: 11px;
}

.product-master-price-editor .product-group-coupon-discount-input {
  width: 84px;
}

.product-master-status-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.product-archive-thumb {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: #f8fafc;
}

.product-archive-thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.product-archive-name {
  display: grid;
  gap: 3px;
  max-width: 460px;
}

.product-archive-name b {
  color: var(--text);
  line-height: 1.35;
}

.product-name-heading,
.product-name-editor {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.product-name-heading b {
  min-width: 0;
  overflow-wrap: anywhere;
}

.product-name-display {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

.product-name-code {
  color: #1d4ed8;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.product-name-text {
  color: var(--text);
}

.product-name-missing {
  color: #dc2626;
  font-weight: 700;
}

.product-name-conflict-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  color: #b45309;
  background: #fef3c7;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.product-display-name-input {
  width: min(300px, 100%);
  height: 34px;
}

.product-name-source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  color: #047857;
  background: #d1fae5;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.icon-text-btn {
  appearance: none;
  border: 0;
  padding: 2px 3px;
  color: var(--primary);
  background: transparent;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.icon-text-btn:hover {
  text-decoration: underline;
}

.product-archive-price-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-archive-price-cell.stacked {
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
}

.product-final-price-input,
.product-current-price-input,
.product-coupon-discount-input,
.product-group-coupon-discount-input {
  width: 132px;
  height: 34px;
}

.product-group-coupon-discount-input {
  width: 128px;
}

.product-archive-coupon {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  max-width: 260px;
  font-size: 12px;
  line-height: 1.35;
}

.product-archive-coupon b {
  color: var(--text);
}

.product-archive-coupon span {
  color: #dc2626;
  font-weight: 800;
}

.product-archive-status {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.product-archive-status.ok {
  color: #047857;
  background: #d1fae5;
}

.product-archive-status.missing {
  color: #b91c1c;
  background: #fee2e2;
}

.product-archive-status.partial {
  color: #92400e;
  background: #fef3c7;
}

.product-archive-group-price {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
}

.product-archive-group-price > span:last-child {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.product-archive-breakeven {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.product-archive-detail-row > td {
  padding: 0;
  background: #f8fafc;
}

.product-archive-sku-detail {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
}

.product-archive-detail-title {
  margin-bottom: 10px;
  font-weight: 800;
  color: var(--text);
}

.product-archive-sku-detail table {
  width: 100%;
  min-width: 1080px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.product-archive-sku-detail th,
.product-archive-sku-detail td {
  padding: 9px 10px;
}

.product-archive-sku-detail th {
  background: #f1f5f9;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.product-review-panel {
  overflow: hidden;
}

.product-review-topline {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 8px 16px;
}

.product-review-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.product-review-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 14px 16px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.product-review-summary > div {
  display: grid;
  min-width: 0;
  gap: 5px;
  padding: 15px 18px;
}

.product-review-summary > div + div {
  border-left: 1px solid var(--line);
}

.product-review-summary span,
.product-review-summary small {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.product-review-summary b {
  color: #0f172a;
  font-size: 25px;
  font-weight: 900;
  line-height: 1.1;
}

.product-review-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 230px) auto;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding: 14px 16px;
}

.product-review-toolbar label,
.product-review-field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.product-review-toolbar label > span,
.product-review-field > span {
  color: #334155;
  font-size: 12px;
  font-weight: 850;
}

.product-review-table-wrap {
  border-top: 1px solid var(--line);
}

.product-review-table {
  width: 100%;
  min-width: 1030px;
  table-layout: fixed;
}

.product-review-table th:nth-child(1) { width: 240px; }
.product-review-table th:nth-child(2) { width: 130px; }
.product-review-table th:nth-child(3) { width: 115px; }
.product-review-table th:nth-child(4) { width: 100px; }
.product-review-table th:nth-child(5) { width: 120px; }
.product-review-table th:nth-child(6) { width: 120px; }
.product-review-table th:nth-child(7) { width: 95px; }
.product-review-table th:nth-child(8) { width: 110px; }

.product-review-table th,
.product-review-table td {
  padding: 11px 12px;
  vertical-align: middle;
}

.product-review-product-cell,
.product-review-selected-product,
.product-review-record-product {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 11px;
}

.product-review-thumb {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
  object-fit: cover;
}

.product-review-thumb.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
}

.product-review-product-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.product-review-product-copy b {
  overflow: hidden;
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-review-product-copy span {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.product-review-progress {
  display: grid;
  gap: 7px;
}

.product-review-progress strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
}

.product-review-progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.product-review-progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
}

.product-review-progress.ready strong {
  color: #059669;
}

.product-review-progress.ready .product-review-progress-track i {
  background: #10b981;
}

.product-review-status {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.product-review-status.pending {
  background: #fff7ed;
  color: #c2410c;
}

.product-review-status.ready {
  background: #dcfce7;
  color: #047857;
}

.product-review-status.continuous {
  background: #dbeafe;
  color: #1d4ed8;
}

.product-review-status.negative {
  background: #fee2e2;
  color: #b91c1c;
}

.product-review-status.paused {
  background: #f1f5f9;
  color: #64748b;
}

.product-review-action {
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.product-review-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.product-review-profit,
.product-review-test-sales,
.product-review-order-cost,
.product-review-negative {
  display: grid;
  gap: 4px;
}

.product-review-profit strong,
.product-review-test-sales strong,
.product-review-order-cost strong,
.product-review-negative strong {
  color: #0f172a;
  font-size: 14px;
  font-weight: 900;
}

.product-review-profit span,
.product-review-test-sales span,
.product-review-order-cost span,
.product-review-negative span {
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
}

.product-review-profit.profit strong,
.product-review-profit.profit span,
.product-review-negative.clear strong {
  color: #047857;
}

.product-review-profit.loss strong,
.product-review-profit.loss span,
.product-review-negative.pending strong,
.product-review-negative.pending span {
  color: #b91c1c;
}

.product-review-link,
.product-review-link-missing {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
}

.product-review-link {
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.product-review-link:hover {
  border-color: #60a5fa;
  background: #dbeafe;
}

.product-review-link-missing {
  border: 1px dashed #cbd5e1;
  color: #94a3b8;
}

.product-review-maintenance-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #dbeafe;
  border-radius: 9px;
  background: #f8fbff;
  padding: 12px;
}

.product-review-maintenance-toggle input {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin-top: 1px;
}

.product-review-maintenance-toggle b,
.product-review-maintenance-toggle small {
  display: block;
}

.product-review-maintenance-toggle b {
  color: #0f172a;
  font-size: 13px;
}

.product-review-maintenance-toggle small {
  margin-top: 3px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.5;
}

.product-review-record-hint {
  grid-column: 1 / -1;
  border: 1px solid #bfdbfe;
  border-radius: 9px;
  background: #eff6ff;
  color: #1e40af;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.6;
}

.product-review-record-type {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 850;
}

.product-review-record-type.order {
  background: #fff7ed;
  color: #c2410c;
}

.product-review-record-type.negative {
  background: #fee2e2;
  color: #b91c1c;
}

.product-review-overlay {
  position: fixed;
  inset: 0;
  z-index: 215;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.52);
}

.product-review-modal {
  width: min(650px, 100%);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}

.product-review-record-modal {
  width: min(820px, 100%);
}

.product-review-modal-head {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #e2e8f0;
  padding: 0 22px;
}

.product-review-modal-head h2 {
  margin: 0;
  color: #0f172a;
  font-size: 20px;
  font-weight: 900;
}

.product-review-modal-head p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.product-review-modal-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 20px 22px;
}

.product-review-modal-body .wide {
  grid-column: 1 / -1;
}

.ad-stop-loss-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: #2563eb;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
}

.ad-stop-loss-settings-modal {
  width: min(760px, 100%);
}

.ad-stop-loss-settings-body {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ad-stop-loss-number-field {
  position: relative;
}

.ad-stop-loss-number-field input {
  padding-right: 56px;
  font-size: 16px;
  font-weight: 900;
}

.ad-stop-loss-number-field em {
  position: absolute;
  top: 50%;
  right: 11px;
  color: #64748b;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  transform: translateY(-50%);
  pointer-events: none;
}

.ad-stop-loss-wechat-toggle {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.ad-stop-loss-rule-summary {
  border: 1px solid #bfdbfe;
  border-radius: 9px;
  background: #f8fbff;
  padding: 13px 14px;
}

.ad-stop-loss-rule-summary strong,
.ad-stop-loss-rule-summary p,
.ad-stop-loss-rule-summary small {
  display: block;
}

.ad-stop-loss-rule-summary strong {
  color: #1e40af;
  font-size: 12px;
}

.ad-stop-loss-rule-summary p {
  margin: 5px 0 0;
  color: #0f172a;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.55;
}

.ad-stop-loss-rule-summary small {
  margin-top: 5px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.6;
}

.ad-stop-loss-safety-note {
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
  padding: 11px 13px;
}

.ad-stop-loss-safety-note img {
  width: 22px;
  height: 22px;
  opacity: 0.72;
}

.ad-stop-loss-safety-note b,
.ad-stop-loss-safety-note span {
  display: block;
}

.ad-stop-loss-safety-note b {
  color: #334155;
  font-size: 12px;
}

.ad-stop-loss-safety-note span {
  margin-top: 2px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

body[data-view-mode="ads"] .product-group-row.product-loss-pool-row,
body[data-view-mode="ads"] .product-group-row.product-loss-pool-row > td:first-child,
body[data-view-mode="ads"] .product-group-row.product-loss-pool-row > td:last-child,
body[data-view-mode="ads"] .product-group-row.product-loss-pool-row:hover,
body[data-view-mode="ads"] .product-group-row.product-loss-pool-row:hover > td:first-child,
body[data-view-mode="ads"] .product-group-row.product-loss-pool-row:hover > td:last-child {
  background: #fff7f7;
}

body[data-view-mode="ads"] .product-group-row.product-loss-pool-row > td:first-child {
  border-left: 4px solid #dc2626;
}

/* 评价关注池：只保留商品判断与归类，详细执行继续使用员工工作表。 */
.product-review-panel {
  background: #fff;
}

.product-review-topline {
  justify-content: space-between;
  min-height: 72px;
  padding: 12px 18px;
}

.product-review-topline h2 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
  font-weight: 950;
}

.product-review-topline p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.product-review-pool-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 18px 0;
}

.product-review-pool-tab {
  display: grid;
  min-width: 0;
  min-height: 118px;
  align-content: start;
  gap: 5px;
  border: 1px solid #dbe3ee;
  border-radius: 12px;
  background: #fff;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.product-review-pool-tab:hover {
  border-color: #93c5fd;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}

.product-review-pool-tab span,
.product-review-pool-tab small {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.product-review-pool-tab small {
  line-height: 1.45;
}

.product-review-pool-tab b {
  color: #0f172a;
  font-size: 25px;
  font-weight: 950;
  line-height: 1;
}

.product-review-pool-tab.active {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.product-review-pool-tab.focus.active {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.08);
}

.product-review-pool-tab.long-term.active {
  border-color: #10b981;
  background: #ecfdf5;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.08);
}

.product-review-rule-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 18px 0;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px 12px;
  color: #475569;
  font-size: 12px;
  line-height: 1.55;
}

.product-review-rule-note b {
  flex: 0 0 auto;
  color: #1d4ed8;
}

.product-review-toolbar {
  grid-template-columns: minmax(260px, 1fr) auto;
  margin-top: 12px;
  border-top: 0;
  padding: 12px 18px 14px;
}

.product-review-toolbar .account-info {
  align-self: center;
}

.product-review-table {
  min-width: 1640px;
}

.product-review-table th:nth-child(1) { width: 260px; }
.product-review-table th:nth-child(2) { width: 125px; }
.product-review-table th:nth-child(3) { width: 115px; }
.product-review-table th:nth-child(4) { width: 145px; }
.product-review-table th:nth-child(5) { width: 155px; }
.product-review-table th:nth-child(6) { width: 145px; }
.product-review-table th:nth-child(7) { width: 300px; }
.product-review-table th:nth-child(8) { width: 245px; }
.product-review-table th:nth-child(9) { width: 145px; }

.product-review-table th,
.product-review-table td {
  padding: 12px 14px;
}

.product-review-pool-row.pool-focus > td:first-child {
  border-left: 3px solid #f59e0b;
}

.product-review-pool-row.pool-long_term > td:first-child {
  border-left: 3px solid #10b981;
}

.product-review-product-copy em {
  width: fit-content;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  padding: 3px 7px;
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
}

.product-review-orders,
.product-review-stock,
.product-review-roi,
.product-review-pool-state {
  display: grid;
  gap: 5px;
}

.product-review-orders strong,
.product-review-stock strong,
.product-review-roi strong {
  color: #0f172a;
  font-size: 16px;
  font-weight: 950;
}

.product-review-orders span,
.product-review-stock span,
.product-review-roi span,
.product-review-pool-state small {
  color: #64748b;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.45;
}

.product-review-stock.empty strong,
.product-review-stock.empty span {
  color: #b91c1c;
}

.product-review-stock.unknown strong,
.product-review-stock.unknown span {
  color: #64748b;
}

.product-review-roi.profit strong,
.product-review-roi.profit span {
  color: #047857;
}

.product-review-roi.loss strong,
.product-review-roi.loss span {
  color: #b91c1c;
}

.product-review-roi.unknown strong,
.product-review-roi.unknown span {
  color: #64748b;
}

.product-review-pool-badge {
  display: inline-flex;
  width: fit-content;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}

.product-review-pool-badge.focus {
  background: #fef3c7;
  color: #b45309;
}

.product-review-pool-badge.long_term {
  background: #d1fae5;
  color: #047857;
}

.product-review-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.product-review-link-actions .mini-btn,
.product-review-link-actions .product-review-link {
  min-height: 32px;
}

.product-review-move-select {
  width: 100%;
  min-height: 36px;
  border-color: #cbd5e1;
  background-color: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.product-review-move-select:disabled {
  opacity: 0.58;
  cursor: wait;
}

.product-review-note-cell {
  min-width: 220px;
}

.product-review-rating-plan {
  display: grid;
  justify-items: start;
  gap: 7px;
}

.product-review-rating-plan.empty {
  color: #94a3b8;
  font-size: 11px;
  font-weight: 750;
}

.product-review-rating-plan-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.product-review-rating-plan-head strong {
  color: #ea580c;
  font-size: 15px;
  font-weight: 950;
}

.product-review-rating-plan-head span,
.product-review-rating-plan > small {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 750;
}

.product-review-rating-plan-targets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.product-review-rating-plan-targets span {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  gap: 4px;
  border: 1px solid #fed7aa;
  border-radius: 7px;
  background: #fff7ed;
  color: #c2410c;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 850;
}

.product-review-rating-plan-targets span.reached {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #047857;
}

.product-review-rating-plan-targets b {
  font-weight: 950;
}

.product-review-remark {
  display: grid;
  justify-items: start;
  gap: 6px;
}

.product-review-remark p {
  display: -webkit-box;
  max-width: 230px;
  margin: 0;
  overflow: hidden;
  color: #334155;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.product-review-remark small,
.product-review-remark.empty span,
.product-review-remark-counter {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 750;
}

.product-review-remark-editor {
  display: grid;
  gap: 7px;
}

.product-review-remark-editor textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border: 1px solid #93c5fd;
  border-radius: 9px;
  background: #fff;
  padding: 9px 10px;
  color: #0f172a;
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.product-review-remark-editor > div {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.product-review-remark-counter {
  margin-right: auto;
}

@media (max-width: 720px) {
  .product-review-pool-tabs {
    grid-template-columns: 1fr;
    margin: 12px 12px 0;
  }

  .product-review-pool-tab {
    grid-template-columns: 1fr auto;
    align-items: center;
    min-height: 0;
  }

  .product-review-pool-tab small {
    grid-column: 1 / -1;
  }

  .product-review-rule-note {
    align-items: flex-start;
    margin: 10px 12px 0;
  }

  .product-review-toolbar {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .product-review-link-actions {
    justify-content: flex-end;
  }

  .product-review-note-cell {
    min-width: 0;
  }

  .product-review-rating-plan {
    justify-items: end;
  }

  .product-review-rating-plan-targets {
    justify-content: flex-end;
  }

  .product-review-remark {
    justify-items: end;
  }

  .product-review-remark p {
    max-width: min(230px, 62vw);
    text-align: right;
  }

  .product-review-remark-editor {
    width: min(270px, 64vw);
    margin-left: auto;
  }
}

@media (max-width: 720px) {
  .ad-stop-loss-settings-body {
    grid-template-columns: 1fr;
  }

  .ad-stop-loss-overlay {
    align-items: flex-end;
    padding: 10px;
  }

  .ad-stop-loss-overlay .product-review-modal {
    max-height: calc(100dvh - 20px);
    border-radius: 14px 14px 10px 10px;
  }
}

.product-review-selected-product {
  grid-column: 1 / -1;
  border: 1px solid #dbeafe;
  border-radius: 9px;
  background: #f8fbff;
  padding: 10px 12px;
}

.product-review-record-product {
  margin: 16px 22px 0;
  border: 1px solid #dbeafe;
  border-radius: 9px;
  background: #f8fbff;
  padding: 12px 14px;
}

.product-review-record-product .product-review-progress {
  width: min(200px, 38%);
  margin-left: auto;
}

.product-review-history {
  margin: 0 22px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  overflow: hidden;
}

.product-review-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  padding: 11px 13px;
}

.product-review-history-head b {
  color: #0f172a;
  font-size: 13px;
}

.product-review-history-head span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.product-review-history table {
  min-width: 680px;
}

.product-review-history th,
.product-review-history td {
  padding: 9px 10px;
  font-size: 12px;
}

.product-review-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 22px 20px;
}

.system-alert-overlay.inventory-warning .system-alert-modal,
.system-alert-overlay.inventory-out .system-alert-modal {
  width: min(520px, 100%);
}

.system-alert-overlay.inventory-warning .system-alert-modal {
  border-top-color: #f59e0b;
}

.system-alert-overlay.inventory-out .system-alert-modal {
  border-top-color: #ef4444;
}

.system-alert-overlay.inventory-warning .system-alert-header {
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%);
}

.system-alert-overlay.inventory-out .system-alert-header {
  background: linear-gradient(180deg, #fff1f2 0%, #ffffff 100%);
}

.system-alert-overlay.inventory-warning .system-alert-only-reminder {
  border-color: #fde68a;
  background: #fffbeb;
  color: #b45309;
}

.system-alert-overlay.inventory-out .system-alert-only-reminder {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}

.system-alert-overlay.inventory-warning .system-alert-product {
  border-color: #fde68a;
  background: #fffdf7;
}

.system-alert-overlay.inventory-out .system-alert-product {
  border-color: #fecaca;
  background: #fffafa;
}

.system-alert-overlay.inventory-warning .system-alert-metric:nth-child(2) strong {
  color: #d97706;
}

.system-alert-overlay.inventory-out .system-alert-metric:nth-child(2) strong,
.system-alert-overlay.inventory-out .system-alert-metric:nth-child(3) strong {
  color: #dc2626;
}

.system-alert-overlay.inventory-out .system-alert-message {
  border-color: #fecaca;
  background: #fff1f2;
}

.system-alert-overlay.inventory-out .system-alert-message strong {
  color: #b91c1c;
}

.system-alert-overlay.inventory-out .system-alert-message p {
  color: #991b1b;
}

.system-alert-actions.inventory-alert-actions {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
}

.system-alert-overlay.inventory-out .system-alert-primary {
  border-color: #dc2626;
  background: #dc2626;
  box-shadow: 0 8px 18px rgba(220, 38, 38, 0.2);
}

.system-alert-overlay.inventory-out .system-alert-primary:hover {
  border-color: #b91c1c;
  background: #b91c1c;
}

@media (max-width: 680px) {
  .system-alert-actions.inventory-alert-actions {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.35fr);
  }

  .system-alert-actions.inventory-alert-actions .system-alert-primary {
    grid-column: auto;
  }
}

.system-alert-overlay.review-success .system-alert-modal {
  width: min(410px, 100%);
  border-top-color: #10b981;
}

.system-alert-overlay.review-success .system-alert-header {
  min-height: 62px;
  padding-right: 18px;
  padding-left: 18px;
}

.system-alert-overlay.review-success .system-alert-product,
.system-alert-overlay.review-success .system-alert-metrics,
.system-alert-overlay.review-success .system-alert-message {
  margin-right: 16px;
  margin-left: 16px;
}

.system-alert-overlay.review-success .system-alert-actions {
  padding-right: 16px;
  padding-left: 16px;
}

.system-alert-overlay.review-success .system-alert-warning-icon {
  display: none;
}

.system-alert-overlay.review-success .system-alert-only-reminder {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #047857;
}

.system-alert-overlay.review-success .system-alert-metric strong {
  color: #059669;
}

.system-alert-overlay.review-success .system-alert-metrics {
  grid-template-columns: 1fr;
}

.system-alert-overlay.review-success .system-alert-metric:nth-child(n + 2) {
  display: none;
}

.system-alert-overlay.review-success .system-alert-message {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.system-alert-overlay.review-success .system-alert-message > img {
  display: none;
}

.system-alert-overlay.review-success .system-alert-message {
  grid-template-columns: 1fr;
}

.system-alert-overlay.review-success .system-alert-message strong {
  color: #047857;
}

.system-alert-overlay.review-success .system-alert-message p {
  color: #166534;
}

.system-alert-actions.review-success-actions {
  grid-template-columns: 1fr 1.25fr;
}

@media (max-width: 900px) {
  .product-archive-toolbar {
    grid-template-columns: 1fr;
  }

  .product-archive-actions {
    justify-content: flex-start;
  }

  .product-breakeven-grid,
  .product-breakeven-result {
    grid-template-columns: 1fr;
  }

  .product-breakeven-grid label.wide {
    grid-column: auto;
  }

  .product-roi-cards,
  .product-roi-sections {
    grid-template-columns: 1fr;
  }

  .product-review-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .product-review-toolbar .account-info {
    grid-column: 1 / -1;
  }

  .product-table-wrap {
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
  }

  .product-table-wrap table {
    min-width: 1100px;
  }

  .product-table-resize-handle {
    display: none;
  }
}

@media (max-width: 720px) {
  body {
    background: #eef5f8;
  }

  .sidebar {
    overscroll-behavior-x: contain;
  }

  .product-review-table-wrap {
    overflow: visible;
    border-top: 0;
    background: #eef5f8;
    padding: 10px;
  }

  .product-review-table-wrap .product-review-table {
    display: block;
    width: 100%;
    min-width: 0;
    table-layout: auto;
  }

  .product-review-table thead {
    display: none;
  }

  .product-review-table tbody {
    display: grid;
    gap: 10px;
  }

  .product-review-table tr {
    display: grid;
    overflow: hidden;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
  }

  .product-review-table td {
    display: grid;
    min-width: 0;
    gap: 5px;
    border-bottom: 1px solid #eef2f7;
    padding: 10px 12px;
    overflow-wrap: anywhere;
  }

  .product-review-table td::before {
    color: #64748b;
    content: attr(data-label);
    font-size: 11px;
    font-weight: 800;
  }

  .product-review-table td:first-child,
  .product-review-table td:last-child {
    grid-column: 1 / -1;
  }

  .product-review-table td:first-child::before,
  .product-review-table td:last-child::before {
    display: none;
  }

  .product-review-table td:nth-child(2n) {
    border-right: 1px solid #eef2f7;
  }

  .product-review-table td:last-child {
    border-right: 0;
    border-bottom: 0;
  }

  .product-review-table .product-review-action {
    flex: 1 1 0;
    min-height: 40px;
  }

  .product-review-action-group {
    width: 100%;
  }

  .brand {
    padding: 10px 12px 6px;
  }

  .brand-title {
    font-size: 17px;
  }

  .brand-sub {
    margin-top: 3px;
  }

  nav {
    gap: 6px;
    padding: 7px 10px 9px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  nav::-webkit-scrollbar {
    display: none;
  }

  .nav-group-title {
    height: 34px;
    font-size: 10px;
  }

  nav a {
    height: 34px;
    padding: 0 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  .main {
    padding: 10px;
  }

  .topbar {
    gap: 10px;
    margin-bottom: 10px;
  }

  .topbar p,
  .panel-head p {
    font-size: 12px;
    line-height: 1.45;
  }

  .top-actions {
    display: grid;
    width: 100%;
    flex-basis: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .top-actions .auth-user {
    grid-column: 1 / -1;
    min-height: 36px;
    justify-content: center;
  }

  .top-actions .btn {
    width: 100%;
    height: 38px;
    padding: 0 10px;
    font-size: 13px;
  }

  .top-actions .install-app-btn {
    grid-column: 1 / -1;
  }

  .product-review-topline {
    align-items: stretch;
    flex-direction: column;
  }

  .product-review-topline .account-info {
    text-align: left;
  }

  .filters {
    gap: 10px;
    margin-bottom: 10px;
    padding: 12px;
  }

  input,
  select,
  textarea {
    min-height: 42px;
  }

  .date-shortcuts {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .date-shortcuts .btn {
    height: 36px;
    padding: 0 4px;
    font-size: 12px;
  }

  .cards,
  .creative-cards,
  .replenishment-cards,
  .finance-cards,
  .product-review-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .product-review-summary {
    margin: 10px;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .product-review-summary > div {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 11px;
  }

  .product-review-summary > div + div {
    border-left: 1px solid var(--line);
  }

  .product-review-toolbar,
  .product-review-modal-body {
    grid-template-columns: 1fr;
  }

  .product-review-toolbar {
    padding: 12px;
  }

  .product-review-toolbar .account-info,
  .product-review-modal-body .wide {
    grid-column: auto;
  }

  .product-review-head-actions {
    width: 100%;
    justify-content: stretch;
  }

  .product-review-head-actions .btn {
    flex: 1 1 0;
  }

  .product-review-overlay {
    align-items: flex-end;
    padding: 10px;
  }

  .product-review-modal {
    width: 100%;
    max-height: calc(100dvh - 20px);
  }

  .product-review-modal-head,
  .product-review-modal-body,
  .product-review-modal-actions {
    padding-right: 16px;
    padding-left: 16px;
  }

  .product-review-record-product {
    align-items: flex-start;
    flex-wrap: wrap;
    margin-right: 16px;
    margin-left: 16px;
  }

  .product-review-record-product .product-review-progress {
    width: 100%;
    margin-left: 0;
  }

  .product-review-history {
    margin-right: 16px;
    margin-left: 16px;
  }

  .card {
    padding: 10px;
  }

  .card span {
    font-size: 12px;
  }

  .card b {
    font-size: 20px;
  }

  .panel-head {
    padding: 12px;
  }

  .table-wrap,
  .product-table-wrap,
  .product-archive-table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .external-system-frame {
    height: calc(100dvh - 150px);
    min-height: 420px;
  }
}

@media (max-width: 420px) {
  .cards,
  .creative-cards,
  .replenishment-cards,
  .finance-cards,
  .product-review-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    background: #fff;
  }

  .product-review-summary > div {
    border: 0;
    border-radius: 0;
    padding: 10px 8px;
  }

  .product-review-summary > div + div {
    border-left: 1px solid var(--line);
  }

  .product-review-summary > div:last-child {
    grid-column: auto;
  }

  .product-review-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
  }

  .product-review-summary > div:nth-child(2n + 1) {
    border-left: 0;
  }

  .product-review-summary > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }
}

/* v91: exact SKU identity shared by replenishment, review and purchase. */
.sku-language-tag {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  margin-left: 6px;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  background: #f0fdf4;
  padding: 1px 6px;
  color: #15803d;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
  vertical-align: middle;
}

.sku-language-tag.original {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.replenishment-request-sku-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
  align-items: center;
  min-width: 0;
  border: 1px solid #dbe5f3;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.replenishment-request-sku-card.missing-specification,
.replenishment-sku-detail-item.missing-specification,
.purchase-approved-sku-row.missing-specification {
  border-color: #fecaca;
  background: #fff7f7;
}

.replenishment-request-sku-copy,
.replenishment-sku-identity,
.purchase-sku-identity {
  display: block;
  min-width: 0;
}

.replenishment-request-sku-copy b,
.replenishment-sku-identity strong,
.purchase-sku-identity strong {
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
}

.replenishment-request-sku-copy small,
.replenishment-sku-identity span,
.purchase-sku-identity small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: #64748b;
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replenishment-request-sku-card > input {
  width: 100%;
  height: 36px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 6px 9px;
  text-align: right;
}

.replenishment-sku-detail-item {
  min-height: 62px;
}

.replenishment-sku-detail-item > .replenishment-sku-identity {
  min-width: 210px;
}

.replenishment-sku-detail-item > div:not(.replenishment-sku-identity) {
  color: #1e293b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.replenishment-review-sku-name > span,
.purchase-approved-sku-name,
.replenishment-product.compact > div > span,
.manual-replenishment-sku-line-product > div > span,
.manual-replenishment-picker-text > span,
.purchase-sku-identity > span {
  display: flex;
  min-width: 0;
  align-items: center;
}

.replenishment-review-sku-name.archive-changed,
.purchase-approved-sku-row.archive-changed {
  border-left: 3px solid #f59e0b;
  padding-left: 8px;
  background: #fffbeb;
}

.replenishment-review-sku-name .sku-archive-change {
  color: #b45309;
  font-weight: 700;
  white-space: normal;
}

.purchase-approved-sku-row > div {
  min-width: 0;
}

.purchase-approved-sku-row > div > span {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 10px;
}

.purchase-order-sku-edit .purchase-sku-identity {
  grid-column: 1 / -1;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 7px;
}

@media (max-width: 720px) {
  .replenishment-request-sku-grid {
    grid-template-columns: 1fr;
  }

  .replenishment-review-sku-grid-head {
    display: none;
  }

  .replenishment-review-sku-grid-row {
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 9px;
  }

  .replenishment-review-sku-grid-row > .requested-sku-quantity::before {
    content: "申请 ";
    color: #64748b;
    font-size: 10px;
  }

  .replenishment-review-sku-grid-row > input {
    grid-column: 1 / 2;
  }

  .replenishment-review-sku-grid-row > .sku-quantity-difference {
    grid-column: 2 / 3;
  }

  .replenishment-request-sku-copy small,
  .replenishment-sku-identity span,
  .purchase-sku-identity small {
    white-space: normal;
  }
}

/* 评价管理：五星好评估算器。计算结果可保存为独立评分方案，不写入评价或财务数据。 */
body.product-review-rating-open {
  overflow: hidden;
}

.calculate-product-review-rating {
  width: fit-content;
  min-height: 27px;
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
  padding: 0 9px;
}

.calculate-product-review-rating:hover {
  border-color: #fb923c;
  background: #ffedd5;
}

.product-review-rating-overlay {
  position: fixed;
  z-index: 1800;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(520px, 620px);
}

.product-review-rating-backdrop {
  width: 100%;
  height: 100%;
  border: 0;
  background: rgba(15, 23, 42, 0.46);
  cursor: default;
  backdrop-filter: blur(2px);
}

.product-review-rating-drawer {
  display: grid;
  width: 100%;
  height: 100dvh;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: #f8fafc;
  box-shadow: -24px 0 55px rgba(15, 23, 42, 0.2);
  animation: product-review-rating-enter 0.2s ease-out both;
}

@keyframes product-review-rating-enter {
  from { transform: translateX(28px); }
  to { transform: translateX(0); }
}

.product-review-rating-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  padding: 22px 24px 18px;
}

.product-review-rating-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: #ea580c;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.1em;
}

.product-review-rating-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: 24px;
  font-weight: 950;
  line-height: 1.2;
}

.product-review-rating-header p {
  max-width: 390px;
  margin: 7px 0 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.product-review-rating-body {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow-y: auto;
  padding: 18px 24px 24px;
  overscroll-behavior: contain;
}

.product-review-rating-product-field {
  display: grid;
  gap: 7px;
}

.product-review-rating-product-field > span,
.product-review-rating-section-head > div > b {
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.product-review-rating-product-field select {
  width: 100%;
  min-height: 42px;
  border-color: #cbd5e1;
  background-color: #fff;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
}

.product-review-rating-product {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #eff6ff;
  padding: 11px 12px;
}

.product-review-rating-product-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.product-review-rating-product-thumb {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border: 1px solid #dbe3ee;
  border-radius: 9px;
  background: #fff;
  object-fit: cover;
}

.product-review-rating-product-thumb.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 800;
}

.product-review-rating-product-main > div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.product-review-rating-product-main b {
  overflow: hidden;
  color: #0f172a;
  font-size: 13px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-review-rating-product-main span,
.product-review-rating-link-missing {
  color: #64748b;
  font-size: 10px;
  font-weight: 750;
}

.product-review-rating-product > a {
  flex: 0 0 auto;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #fff;
  color: #1d4ed8;
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 850;
  text-decoration: none;
}

.product-review-rating-input-card,
.product-review-rating-result-card {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  padding: 15px;
}

.product-review-rating-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 13px;
}

.product-review-rating-section-head > div {
  display: grid;
  gap: 4px;
}

.product-review-rating-section-head > div > span {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 750;
}

.product-review-rating-section-head > label {
  display: grid;
  width: 126px;
  gap: 5px;
}

.product-review-rating-section-head > label > span {
  color: #475569;
  font-size: 10px;
  font-weight: 850;
}

.product-review-rating-section-head input {
  width: 100%;
  min-height: 39px;
  border-color: #fdba74;
  background: #fffaf5;
  color: #9a3412;
  font-size: 16px;
  font-weight: 950;
  text-align: center;
}

.product-review-rating-percent-list {
  display: grid;
  gap: 7px;
}

.product-review-rating-percent-list > label {
  display: grid;
  min-height: 42px;
  grid-template-columns: minmax(100px, 1fr) 88px 18px;
  align-items: center;
  gap: 8px;
  border-radius: 9px;
  background: #f8fafc;
  padding: 4px 8px 4px 11px;
}

.product-review-rating-percent-list > label > span {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.product-review-rating-percent-list b {
  color: #0f172a;
  font-size: 12px;
  font-weight: 900;
}

.product-review-rating-percent-list small {
  color: #94a3b8;
  font-size: 10px;
  font-weight: 750;
}

.product-review-rating-percent-list input {
  width: 100%;
  min-height: 34px;
  border-color: #dbe3ee;
  background: #fff;
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.product-review-rating-percent-list em {
  color: #64748b;
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.product-review-rating-percent-list > label:first-child {
  background: #fff7ed;
}

.product-review-rating-percent-list > label:first-child b {
  color: #ea580c;
}

.product-review-rating-percent-list > label:last-child {
  background: #fff1f2;
}

.product-review-rating-percent-list > label:last-child b {
  color: #be123c;
}

.product-review-rating-input-hint {
  margin-top: 10px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #64748b;
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.45;
}

.product-review-rating-input-hint.ready {
  background: #ecfdf5;
  color: #047857;
}

.product-review-rating-input-hint.attention {
  background: #fffbeb;
  color: #b45309;
}

.product-review-rating-current {
  display: grid;
  justify-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding: 2px 0 14px;
  text-align: center;
}

.product-review-rating-current > span {
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
}

.product-review-rating-current > strong {
  margin-top: 3px;
  color: #ea580c;
  font-size: 34px;
  font-weight: 950;
  line-height: 1.1;
}

.product-review-rating-current > small {
  margin-top: 5px;
  color: #64748b;
  font-size: 10px;
  font-weight: 750;
}

.product-review-rating-results {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 13px;
}

.product-review-rating-results article {
  display: grid;
  min-width: 0;
  gap: 6px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
  padding: 11px 9px;
  text-align: center;
}

.product-review-rating-results span {
  color: #64748b;
  font-size: 10px;
  font-weight: 850;
}

.product-review-rating-results b {
  color: #1d4ed8;
  font-size: 13px;
  font-weight: 950;
  white-space: nowrap;
}

.product-review-rating-results small {
  color: #64748b;
  font-size: 9px;
  font-weight: 750;
  line-height: 1.4;
}

.product-review-rating-results article.reached {
  border-color: #a7f3d0;
  background: #ecfdf5;
}

.product-review-rating-results article.reached b {
  color: #047857;
}

.product-review-rating-save-meta {
  margin-top: 10px;
  color: #64748b;
  font-size: 10px;
  font-weight: 750;
  text-align: center;
}

.product-review-rating-note {
  display: grid;
  gap: 4px;
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: #fffbeb;
  padding: 10px 12px;
}

.product-review-rating-note b {
  color: #92400e;
  font-size: 11px;
  font-weight: 900;
}

.product-review-rating-note span {
  color: #a16207;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.55;
}

.product-review-rating-actions {
  display: grid;
  grid-template-columns: 0.65fr 0.9fr 1.45fr;
  gap: 10px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
  padding: 14px 24px calc(14px + env(safe-area-inset-bottom));
}

.product-review-rating-actions .btn {
  width: 100%;
  min-height: 42px;
}

@media (max-width: 720px) {
  .product-review-rating-overlay {
    grid-template-columns: 1fr;
  }

  .product-review-rating-backdrop {
    display: none;
  }

  .product-review-rating-drawer {
    grid-column: 1;
  }

  .product-review-rating-header {
    padding: 17px 16px 14px;
  }

  .product-review-rating-header h2 {
    font-size: 21px;
  }

  .product-review-rating-body {
    gap: 11px;
    padding: 14px 14px 18px;
  }

  .product-review-rating-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .product-review-rating-section-head > label {
    width: 100%;
  }

  .product-review-rating-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .product-review-rating-results article {
    padding: 10px 5px;
  }

  .product-review-rating-results b {
    font-size: 13px;
  }

  .product-review-rating-product {
    align-items: flex-start;
  }

  .product-review-rating-actions {
    padding-right: 14px;
    padding-left: 14px;
  }
}
/* 客户咨询：数据库队列 + 单条咨询处理 */
.customer-service-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.customer-service-panel.hidden {
  display: none;
}

.customer-service-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 0 0;
}

.customer-service-head h2 {
  margin: 0;
  color: #162033;
  font-size: 22px;
  line-height: 1.3;
}

.customer-service-head p {
  margin: 6px 0 0;
  color: #66758f;
  font-size: 13px;
}

.customer-service-title-row,
.customer-service-head-actions,
.customer-service-detail-name-row,
.customer-service-reply-actions,
.customer-service-settings-section-head,
.customer-service-settings-actions {
  display: flex;
  align-items: center;
}

.customer-service-title-row {
  gap: 10px;
}

.customer-service-head-actions {
  gap: 10px;
}

.customer-service-database-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid #cfe0ff;
  border-radius: 999px;
  background: #eef5ff;
  color: #2867d9;
  font-size: 12px;
  font-weight: 700;
}

.customer-service-database-badge.warning {
  border-color: #ffd79a;
  background: #fff7e8;
  color: #ad6200;
}

.customer-service-auto-status {
  align-self: flex-end;
  padding: 9px 13px;
  border: 1px solid #d9e3f2;
  border-radius: 10px;
  background: #f8fafc;
  color: #5c6b82;
  font-size: 12px;
  font-weight: 600;
}

.customer-service-auto-status.enabled {
  border-color: #bce9cf;
  background: #effbf4;
  color: #13824c;
}

.customer-service-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #dce5f1;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 7px 22px rgba(31, 66, 111, 0.05);
}

.customer-service-summary-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  min-width: 0;
  padding: 17px 20px;
  border: 0;
  border-right: 1px solid #e3eaf3;
  background: #fff;
  color: #1d2a40;
  text-align: left;
  cursor: pointer;
}

.customer-service-summary-card:last-child {
  border-right: 0;
}

.customer-service-summary-card:hover,
.customer-service-summary-card.active {
  background: #f5f9ff;
}

.customer-service-summary-card.active {
  box-shadow: inset 0 -3px 0 #2563eb;
}

.customer-service-summary-card.transferred.active {
  box-shadow: inset 0 -3px 0 #f07a26;
}

.customer-service-summary-card span {
  color: #63718a;
  font-size: 13px;
}

.customer-service-summary-card b {
  grid-row: 1 / 3;
  grid-column: 2;
  color: #172237;
  font-size: 27px;
  line-height: 1.2;
}

.customer-service-summary-card small {
  color: #8793a7;
  font-size: 11px;
}

.customer-service-workspace {
  display: grid;
  grid-template-columns: minmax(360px, 0.78fr) minmax(560px, 1.45fr);
  min-height: 650px;
  overflow: hidden;
  border: 1px solid #dce5f1;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(31, 66, 111, 0.06);
}

.customer-service-queue-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  border-right: 1px solid #dfe7f2;
}

.customer-service-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid #dfe7f2;
}

.customer-service-tabs button {
  position: relative;
  min-height: 50px;
  border: 0;
  background: #fff;
  color: #63718a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.customer-service-tabs button:hover {
  color: #245fd2;
  background: #f8fbff;
}

.customer-service-tabs button.active {
  color: #175fe6;
}

.customer-service-tabs button.active::after {
  position: absolute;
  right: 18px;
  bottom: 0;
  left: 18px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: #2563eb;
  content: "";
}

.customer-service-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #e8edf4;
  background: #fbfcfe;
}

.customer-service-search-row input,
.customer-service-search-row select,
.customer-service-reply-toolbar select,
.customer-service-setting-field input,
.customer-service-setting-field select,
.customer-service-setting-field textarea,
.customer-service-rule-row select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid #d5dfec;
  border-radius: 8px;
  background: #fff;
  color: #24324a;
  font: inherit;
}

.customer-service-search-row input,
.customer-service-setting-field input {
  padding: 0 12px;
}

.customer-service-search-row select,
.customer-service-reply-toolbar select,
.customer-service-setting-field select,
.customer-service-rule-row select {
  padding: 0 30px 0 10px;
}

.customer-service-search-row input:focus,
.customer-service-search-row select:focus,
.customer-service-reply-toolbar select:focus,
.customer-service-reply-box textarea:focus,
.customer-service-setting-field input:focus,
.customer-service-setting-field select:focus,
.customer-service-setting-field textarea:focus,
.customer-service-template-row textarea:focus {
  border-color: #6ea1ff;
  outline: 3px solid rgba(37, 99, 235, 0.1);
}

.customer-service-queue {
  min-height: 0;
  max-height: 660px;
  overflow-y: auto;
}

.customer-service-queue-item {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 11px;
  width: 100%;
  padding: 13px 12px 13px 16px;
  border: 0;
  border-bottom: 1px solid #e7edf5;
  background: #fff;
  color: #1e2b41;
  text-align: left;
  cursor: pointer;
}

.customer-service-queue-item:hover {
  background: #f7faff;
}

.customer-service-queue-item.active {
  background: #f1f6ff;
}

.customer-service-queue-item.active::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: #2563eb;
  content: "";
}

.customer-service-product-image {
  width: 54px;
  height: 54px;
  border: 1px solid #dce5ef;
  border-radius: 9px;
  background: #f6f8fb;
  object-fit: cover;
}

.customer-service-product-image.large {
  width: 88px;
  height: 88px;
  border-radius: 11px;
}

.customer-service-queue-copy,
.customer-service-queue-title,
.customer-service-queue-badges {
  display: flex;
}

.customer-service-queue-copy {
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.customer-service-queue-title {
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.customer-service-queue-title b {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-service-queue-title em {
  flex: 0 0 auto;
  color: #ef5a42;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.customer-service-queue-code {
  overflow: hidden;
  color: #718097;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-service-queue-preview {
  display: -webkit-box;
  overflow: hidden;
  color: #4f5e75;
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.customer-service-translation-state {
  color: #2870d8;
  font-size: 10px;
  font-weight: 800;
}

.customer-service-queue-badges {
  align-items: flex-end;
  flex-direction: column;
  gap: 6px;
}

.customer-service-status,
.customer-service-risk,
.customer-service-source {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.customer-service-status.status-pending {
  background: #eaf2ff;
  color: #1763df;
}

.customer-service-status.status-transferred,
.customer-service-risk {
  background: #fff0e6;
  color: #c45514;
}

.customer-service-status.status-answered {
  background: #eaf9f1;
  color: #10824a;
}

.customer-service-queue-meta {
  margin-top: auto;
  padding: 10px 14px;
  border-top: 1px solid #e7edf5;
  color: #7d899d;
  font-size: 11px;
  text-align: right;
}

.customer-service-empty,
.customer-service-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  min-height: 180px;
  padding: 28px;
  color: #7b879a;
  text-align: center;
}

.customer-service-empty strong,
.customer-service-detail-empty strong {
  color: #2e3b51;
  font-size: 15px;
}

.customer-service-detail-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: #fff;
}

.customer-service-detail-product {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid #dfe7f2;
}

.customer-service-detail-product-copy {
  min-width: 0;
}

.customer-service-detail-name-row {
  flex-wrap: wrap;
  gap: 9px;
}

.customer-service-detail-name-row h3 {
  margin: 0;
  color: #162033;
  font-size: 18px;
}

.customer-service-source {
  background: #eef4ff;
  color: #2864cf;
}

.customer-service-detail-product-copy p {
  margin: 7px 0 0;
  color: #62718a;
  font-size: 12px;
}

.customer-service-detail-product-copy p.customer-service-unbound {
  color: #bf4b39;
  font-weight: 700;
}

.customer-service-detail-time {
  color: #78859a;
  font-size: 11px;
  white-space: nowrap;
}

.customer-service-detail-section {
  padding: 17px 18px;
  border-bottom: 1px solid #e4eaf2;
}

.customer-service-section-title {
  margin-bottom: 10px;
  color: #243149;
  font-size: 13px;
  font-weight: 800;
}

.customer-service-question {
  padding: 14px 15px;
  border: 1px solid #d8e1ed;
  border-radius: 9px;
  background: #f8fafc;
  color: #27354c;
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.customer-service-question-meta {
  margin-top: 8px;
  color: #8390a3;
  font-size: 11px;
}

.customer-service-translation-card {
  padding: 14px 15px;
  border: 1px solid #cfe0ff;
  border-radius: 9px;
  background: #f3f7ff;
  color: #263955;
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.customer-service-translation-meta,
.customer-service-ai-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
  color: #76869d;
  font-size: 11px;
}

.customer-service-ai-assistant {
  padding: 17px 18px;
  border-bottom: 1px solid #e4eaf2;
  background: #fbfaff;
}

.customer-service-ai-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 11px;
}

.customer-service-ai-header > div:first-child {
  display: grid;
  gap: 4px;
}

.customer-service-ai-header strong {
  color: #37285f;
  font-size: 14px;
}

.customer-service-ai-header small {
  color: #7d7197;
  font-size: 11px;
}

.customer-service-ai-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.customer-service-ai-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid #d8cef7;
  border-radius: 999px;
  background: #f2efff;
  color: #6546b7;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.customer-service-ai-badge.risk-high {
  border-color: #ffd29c;
  background: #fff5e8;
  color: #ae5d08;
}

.customer-service-ai-draft {
  display: grid;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid #ded5f7;
  border-radius: 10px;
  background: #fff;
}

.customer-service-ai-draft-block {
  display: grid;
  gap: 6px;
}

.customer-service-ai-draft-block + .customer-service-ai-draft-block {
  padding-top: 12px;
  border-top: 1px solid #ece7f8;
}

.customer-service-ai-draft-block span {
  color: #786b92;
  font-size: 11px;
  font-weight: 800;
}

.customer-service-ai-draft-block p {
  margin: 0;
  color: #29354a;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.customer-service-ai-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 14px;
  border: 1px dashed #d9d1ed;
  border-radius: 9px;
  background: #fff;
  color: #746b85;
  font-size: 12px;
}

.customer-service-ai-warning {
  margin-top: 9px;
  color: #a55b0a;
  font-size: 11px;
  line-height: 1.55;
}

.customer-service-history {
  max-height: 235px;
  overflow-y: auto;
}

.customer-service-history-item + .customer-service-history-item {
  margin-top: 10px;
}

.customer-service-history-item > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.customer-service-history-item b {
  color: #2c3950;
  font-size: 12px;
}

.customer-service-history-item span {
  color: #8390a3;
  font-size: 11px;
}

.customer-service-history-item p {
  margin: 7px 0 0;
  padding: 10px 12px;
  border: 1px solid #e0e7f0;
  border-radius: 8px;
  background: #fbfcfe;
  color: #344157;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.customer-service-history-empty {
  color: #8995a7;
  font-size: 12px;
}

.customer-service-reply-error {
  display: block;
  margin-top: 5px;
  color: #d53b35;
}

.customer-service-reply-box {
  margin-top: auto;
  padding: 16px 18px 18px;
  background: #fbfcfe;
}

.customer-service-reply-box.disabled {
  background: #f6f8fb;
}

.customer-service-reply-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) 1fr;
  align-items: end;
  gap: 14px;
  margin-bottom: 10px;
}

.customer-service-reply-toolbar label {
  display: grid;
  gap: 6px;
}

.customer-service-reply-toolbar label span {
  color: #4d5b72;
  font-size: 12px;
  font-weight: 700;
}

.customer-service-reply-toolbar > span {
  padding-bottom: 8px;
  color: #8190a5;
  font-size: 11px;
  text-align: right;
}

.customer-service-reply-box textarea {
  width: 100%;
  min-height: 110px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid #d5dfec;
  border-radius: 9px;
  background: #fff;
  color: #26344b;
  font: inherit;
  line-height: 1.6;
}

.customer-service-reply-actions {
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.customer-service-reply-actions span {
  color: #7e8b9e;
  font-size: 11px;
}

.customer-service-settings-overlay {
  position: fixed;
  z-index: 10040;
  inset: 0;
}

.customer-service-settings-overlay.hidden {
  display: none;
}

.customer-service-settings-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(17, 28, 46, 0.5);
}

.customer-service-settings-drawer {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  width: min(620px, 94vw);
  height: 100%;
  overflow-y: auto;
  flex-direction: column;
  padding: 24px;
  background: #fff;
  box-shadow: -14px 0 40px rgba(20, 36, 62, 0.18);
}

.customer-service-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e0e7f0;
}

.customer-service-settings-kicker {
  margin-bottom: 5px;
  color: #2463df;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.customer-service-settings-head h2 {
  margin: 0;
  color: #172237;
  font-size: 22px;
}

.customer-service-settings-head p {
  max-width: 470px;
  margin: 7px 0 0;
  color: #65738a;
  font-size: 12px;
  line-height: 1.6;
}

.customer-service-safety-note {
  display: grid;
  gap: 5px;
  margin-top: 16px;
  padding: 13px 14px;
  border: 1px solid #fed9a8;
  border-radius: 10px;
  background: #fff8ed;
}

.customer-service-safety-note strong {
  color: #9e5807;
  font-size: 13px;
}

.customer-service-safety-note span {
  color: #7d6648;
  font-size: 12px;
  line-height: 1.55;
}

.customer-service-setting-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 15px;
  border: 1px solid #d9e3ef;
  border-radius: 10px;
  background: #f9fbfe;
}

.customer-service-setting-toggle > div {
  display: grid;
  gap: 4px;
}

.customer-service-setting-toggle strong {
  color: #26344b;
  font-size: 14px;
}

.customer-service-setting-toggle span {
  color: #75839a;
  font-size: 11px;
}

.customer-service-setting-toggle input {
  width: 20px;
  height: 20px;
}

.customer-service-ai-settings {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid #d9d0f3;
  border-radius: 11px;
  background: #fbfaff;
}

.customer-service-ai-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.customer-service-ai-settings-head > div {
  display: grid;
  gap: 4px;
}

.customer-service-ai-settings-head strong {
  color: #3b2d63;
  font-size: 14px;
}

.customer-service-ai-settings-head span {
  color: #7c7292;
  font-size: 11px;
  line-height: 1.5;
}

.customer-service-ai-config-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eeeaf8;
  color: #6f5b98;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.customer-service-ai-config-badge.configured {
  background: #eaf9f1;
  color: #13804b;
}

.customer-service-ai-config-badge.missing {
  background: #fff0e8;
  color: #b8521e;
}

.customer-service-setting-toggle.compact {
  margin-top: 12px;
  padding: 12px;
  background: #fff;
}

.customer-service-setting-field {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.customer-service-setting-field textarea {
  min-height: 88px;
  resize: vertical;
  padding: 10px 12px;
  line-height: 1.55;
}

.customer-service-setting-field > span {
  color: #334158;
  font-size: 12px;
  font-weight: 800;
}

.customer-service-setting-field small {
  color: #7b889b;
  font-size: 11px;
}

.customer-service-settings-section {
  margin-top: 22px;
}

.customer-service-settings-section-head {
  justify-content: space-between;
  margin-bottom: 10px;
}

.customer-service-settings-section-head > div {
  display: grid;
  gap: 4px;
}

.customer-service-settings-section-head strong {
  color: #26344b;
  font-size: 14px;
}

.customer-service-settings-section-head span {
  color: #7b889b;
  font-size: 11px;
}

.customer-service-rule-rows,
.customer-service-template-rows {
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-radius: 10px;
}

.customer-service-rule-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 190px;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border-bottom: 1px solid #e4eaf2;
  background: #fff;
}

.customer-service-rule-row:last-child {
  border-bottom: 0;
}

.customer-service-rule-row.locked {
  background: #f7f8fa;
  opacity: 0.68;
}

.customer-service-rule-row input {
  width: 17px;
  height: 17px;
}

.customer-service-rule-row > span {
  display: grid;
  gap: 3px;
}

.customer-service-rule-row b {
  color: #2c3950;
  font-size: 12px;
}

.customer-service-rule-row small {
  color: #7f8b9d;
  font-size: 10px;
}

.customer-service-template-row {
  padding: 13px;
  border-bottom: 1px solid #e4eaf2;
}

.customer-service-template-row:last-child {
  border-bottom: 0;
}

.customer-service-template-row > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.customer-service-template-row b {
  color: #2a374d;
  font-size: 12px;
}

.customer-service-template-row span {
  color: #738097;
  font-size: 11px;
}

.customer-service-template-row textarea {
  width: 100%;
  min-height: 76px;
  resize: vertical;
  padding: 10px 11px;
  border: 1px solid #d8e1ed;
  border-radius: 8px;
  color: #2e3c52;
  font: inherit;
  font-size: 12px;
  line-height: 1.55;
}

.customer-service-settings-actions {
  position: sticky;
  bottom: -24px;
  justify-content: space-between;
  gap: 14px;
  margin: 24px -24px -24px;
  padding: 15px 24px;
  border-top: 1px solid #dce5ef;
  background: #fff;
}

.customer-service-settings-actions span {
  color: #7b889b;
  font-size: 11px;
}

body.customer-service-settings-open {
  overflow: hidden;
}

@media (max-width: 1150px) {
  .customer-service-workspace {
    grid-template-columns: minmax(330px, 0.85fr) minmax(480px, 1.15fr);
  }

  .customer-service-summary-card {
    padding: 15px;
  }
}

@media (max-width: 900px) {
  .customer-service-head {
    align-items: stretch;
    flex-direction: column;
  }

  .customer-service-head-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .customer-service-auto-status {
    align-self: stretch;
  }

  .customer-service-summary {
    grid-template-columns: 1fr 1fr;
  }

  .customer-service-summary-card:nth-child(2) {
    border-right: 0;
  }

  .customer-service-summary-card:nth-child(-n + 2) {
    border-bottom: 1px solid #e3eaf3;
  }

  .customer-service-workspace {
    grid-template-columns: 1fr;
  }

  .customer-service-queue-card {
    border-right: 0;
    border-bottom: 1px solid #dfe7f2;
  }

  .customer-service-queue {
    max-height: 430px;
  }

  .customer-service-detail-card {
    min-height: 590px;
  }
}

@media (max-width: 600px) {
  .customer-service-head h2 {
    font-size: 20px;
  }

  .customer-service-head-actions {
    grid-template-columns: 1fr;
  }

  .customer-service-summary-card {
    padding: 13px;
  }

  .customer-service-summary-card b {
    font-size: 23px;
  }

  .customer-service-tabs {
    overflow-x: auto;
    grid-template-columns: repeat(4, minmax(82px, 1fr));
  }

  .customer-service-search-row {
    grid-template-columns: 1fr;
  }

  .customer-service-queue-item {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .customer-service-product-image {
    width: 48px;
    height: 48px;
  }

  .customer-service-queue-badges {
    grid-column: 2;
    align-items: center;
    flex-direction: row;
  }

  .customer-service-detail-product {
    grid-template-columns: 72px minmax(0, 1fr);
    padding: 14px;
  }

  .customer-service-product-image.large {
    width: 72px;
    height: 72px;
  }

  .customer-service-detail-time {
    grid-column: 1 / -1;
  }

  .customer-service-detail-section,
  .customer-service-ai-assistant,
  .customer-service-reply-box {
    padding: 14px;
  }

  .customer-service-reply-toolbar {
    grid-template-columns: 1fr;
  }

  .customer-service-reply-toolbar > span {
    padding: 0;
    text-align: left;
  }

  .customer-service-ai-header,
  .customer-service-ai-empty,
  .customer-service-ai-settings-head {
    align-items: stretch;
    flex-direction: column;
  }

  .customer-service-ai-header-actions {
    justify-content: space-between;
  }

  .customer-service-reply-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .customer-service-reply-actions .btn {
    width: 100%;
    white-space: nowrap;
  }

  .customer-service-settings-drawer {
    width: 100%;
    padding: 18px;
  }

  .customer-service-rule-row {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .customer-service-rule-row select {
    grid-column: 2;
  }

  .customer-service-settings-actions {
    bottom: -18px;
    align-items: stretch;
    flex-direction: column;
    margin: 20px -18px -18px;
    padding: 13px 18px;
  }
}
