:root {
  --ink: #17212b;
  --muted: #647282;
  --line: #d9e0e7;
  --page: #f4f7fb;
  --panel: #ffffff;
  --nav: #142032;
  --nav-soft: #20314a;
  --teal: #0f8f8c;
  --amber: #f2b705;
  --green: #2f9e63;
}

html {
  min-height: 100%;
}

body {
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
}

a {
  color: inherit;
}

.auth-shell {
  background: #f5f6f8;
}

.auth-page,
.login-page {
  align-items: center;
  display: flex;
  min-height: 100vh;
  padding: 38px;
}

.auth-panel {
  align-items: center;
  background: #fff;
  border: 1px solid #e7e9ed;
  border-radius: 8px;
  box-shadow: 0 3px 14px rgba(19, 28, 38, 0.13);
  display: grid;
  gap: 42px;
  grid-template-columns: minmax(300px, 1fr) 360px;
  margin: 0 auto;
  max-width: 980px;
  min-height: 492px;
  padding: 44px;
  width: 100%;
}

.auth-panel-register,
.auth-panel-recover {
  max-width: 760px;
  min-height: 430px;
}

.brand {
  align-items: center;
  display: inline-flex;
  font-size: 1.08rem;
  font-weight: 800;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--amber);
  border-radius: 8px;
  color: #142032;
  display: inline-flex;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.auth-logo-area {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 300px;
}

.auth-logo {
  display: block;
  height: auto;
  max-width: min(100%, 420px);
}

.crosszell-symbol {
  border: 22px solid #73529a;
  border-left-width: 26px;
  border-radius: 58% 42% 58% 42%;
  height: 118px;
  margin-bottom: 24px;
  transform: rotate(-34deg);
  width: 82px;
}

.crosszell-wordmark {
  color: #1e1718;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  font-size: 2.65rem;
  font-weight: 900;
  line-height: 1;
}

.crosszell-wordmark span {
  color: #73529a;
}

.eyebrow {
  color: var(--teal);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.auth-card,
.panel,
.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 42px rgba(23, 33, 43, 0.12);
}

.auth-card {
  align-self: center;
  padding: 34px;
}

.auth-form-area {
  margin: 0 auto;
  max-width: 360px;
  width: 100%;
}

.auth-card h2,
.auth-card h1,
.panel h2,
.auth-form-area h1 {
  font-size: 1.35rem;
  font-weight: 800;
  margin: 0 0 22px;
  text-align: center;
}

.auth-card p,
.panel p {
  color: var(--muted);
  margin-bottom: 24px;
}

.auth-help {
  color: var(--muted);
  margin: -10px 0 20px;
  text-align: center;
}

.oauth-actions {
  display: grid;
  gap: 10px;
}

.auth-oauth,
.register-oauth,
.credential-form {
  display: grid;
  gap: 14px;
}

.auth-input {
  background: #e8f0fe;
  border: 1px solid #cfd8e5;
  border-radius: 5px;
  color: #0f1720;
  font-size: 0.9rem;
  height: 35px;
  padding: 8px 12px;
  width: 100%;
}

.auth-submit {
  background: #73529a;
  border: 0;
  border-radius: 5px;
  color: #fff;
  font-weight: 800;
  height: 44px;
}

.auth-submit:hover {
  background: #614286;
}

.oauth-button,
.primary-link {
  align-items: center;
  border: 0;
  border-radius: 8px;
  display: inline-flex;
  font-weight: 800;
  gap: 10px;
  justify-content: center;
  min-height: 52px;
  padding: 10px 14px;
  text-decoration: none;
}

.oauth-button span,
.provider-badge {
  border-radius: 7px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 900;
  height: 30px;
  justify-content: center;
  line-height: 30px;
  width: 34px;
}

.oauth-button.marketplace {
  align-items: center;
  background: #fff;
  border: 1px solid #d4dbe4;
  color: #73529a;
  display: grid;
  grid-template-columns: minmax(96px, auto) minmax(0, 1fr);
  justify-content: stretch;
  overflow: hidden;
  text-align: left;
  width: 100%;
}

.oauth-button.marketplace:hover {
  border-color: #73529a;
  box-shadow: 0 4px 12px rgba(115, 82, 154, 0.12);
}

.oauth-text {
  color: #73529a;
  font-weight: 500;
  justify-self: end;
  line-height: 1;
  white-space: nowrap;
}

.market-logo {
  align-self: center;
  display: block;
  height: 38px;
  justify-self: start;
  max-width: 178px;
  object-fit: contain;
  width: 100%;
}

.ml-logo {
  height: 40px;
  max-width: 190px;
}

.gs-logo {
  height: 38px;
  max-width: 142px;
}

.oauth-button.gs,
.primary-link {
  background: var(--teal);
  color: #fff;
}

.oauth-button.gs span,
.provider-badge {
  background: rgba(255, 255, 255, 0.16);
}

.redirect-card {
  margin: 0 auto;
  max-width: 520px;
}

.auth-links {
  color: #314050;
  font-size: 0.94rem;
  margin-top: 18px;
  text-align: center;
}

.auth-links p {
  margin: 12px 0 0;
}

.auth-links a {
  color: #1f2c3d;
  font-weight: 800;
  text-decoration: none;
}

.app-shell {
  background: var(--page);
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  transition: grid-template-columns 0.18s ease;
}

.sidebar {
  background: var(--nav);
  color: #fff;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 100vh;
  overflow-y: auto;
  padding: 26px 18px;
  position: sticky;
  top: 0;
}

.sidebar-head {
  align-items: flex-start;
  display: block;
  gap: 12px;
  margin-bottom: 30px;
}

.sidebar .brand {
  display: flex;
  margin-bottom: 0;
  min-width: 0;
}

.sidebar-logo {
  background: #fff;
  border-radius: 6px;
  height: auto;
  max-width: 188px;
  padding: 8px 10px;
  width: 100%;
}

.sidebar-logo-small {
  background: #fff;
  border-radius: 8px;
  display: none;
  height: 42px;
  object-fit: contain;
  padding: 6px;
  width: 42px;
}

.sidebar-toggle {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-size: 1.5rem;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  line-height: 1;
  margin-top: auto;
  width: 100%;
}

.sidebar-toggle:hover {
  background: var(--nav-soft);
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 78px minmax(0, 1fr);
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 22px 12px;
}

.app-shell.sidebar-collapsed .sidebar-head {
  display: flex;
  justify-content: center;
}

.app-shell.sidebar-collapsed .sidebar-logo {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-logo-small {
  display: block;
}

.app-shell.sidebar-collapsed .side-nav,
.app-shell.sidebar-collapsed .nav-sub {
  display: none;
}

.sidebar-toggle .chevron-right,
.app-shell.sidebar-collapsed .sidebar-toggle .chevron-left {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-toggle .chevron-right {
  display: inline;
}

.side-nav {
  display: grid;
  gap: 10px;
}

.side-nav a,
.nav-group button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.78);
  display: block;
  font-weight: 700;
  padding: 12px 14px;
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.side-nav a:hover,
.nav-group button:hover {
  background: var(--nav-soft);
  color: #fff;
}

.nav-sub {
  display: grid;
  gap: 4px;
  margin-top: 4px;
  padding-left: 10px;
}

.nav-sub a {
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.9rem;
  padding: 9px 14px;
}

.workspace {
  min-width: 0;
}

.topbar {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 86px;
  padding: 18px 32px;
}

.topbar h1 {
  font-size: 1.42rem;
  font-weight: 850;
  margin: 0;
}

.profile-button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  gap: 10px;
  padding: 7px 10px;
}

.profile-button span {
  align-items: center;
  background: var(--teal);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.content {
  padding: 32px;
}

.metric-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 22px;
}

.metric-card {
  border-color: #dfe6ee;
  box-shadow: 0 10px 28px rgba(20, 32, 50, 0.08);
  min-height: 142px;
  overflow: hidden;
  padding: 20px 22px;
  position: relative;
}

.metric-card::before {
  background: linear-gradient(135deg, #ffffff 0%, #fbfcfe 58%, #f5f8fb 100%);
  content: "";
  inset: 0;
  position: absolute;
  z-index: 0;
}

.metric-card::after {
  border-radius: 0;
  content: "";
  height: 100%;
  left: 0;
  opacity: 1;
  position: absolute;
  top: 0;
  width: 4px;
  z-index: 0;
}

.metric-card > * {
  position: relative;
  z-index: 1;
}

.metric-card span {
  color: #5c6878;
  display: block;
  font-size: 0.9rem;
  font-weight: 760;
  margin-bottom: 10px;
}

.metric-card strong {
  color: #172233;
  display: block;
  font-size: 2rem;
  line-height: 1.05;
}

.metric-card span {
  min-height: 2.4em;
}

.metric-secondary,
.metric-right {
  align-items: baseline;
  color: #667386;
  display: inline-grid;
  font-size: 0.82rem;
  font-weight: 800;
  gap: 4px 10px;
  grid-template-columns: max-content max-content;
}

.metric-secondary {
  margin-top: 10px;
}

.metric-right {
  bottom: 16px;
  position: absolute;
  right: 18px;
  text-align: right;
}

.metric-secondary span,
.metric-right span {
  display: inline;
  margin: 0;
  min-height: 0;
}

.metric-secondary b,
.metric-right b {
  color: #192435;
  font-size: 1rem;
}

.metric-blue::after { background: #3b6ea8; }
.metric-green::after { background: #3f8f68; }
.metric-teal::after { background: #3b8d8b; }
.metric-amber::after { background: #b8872f; }
.metric-orange::after { background: #b56f3d; }
.metric-red::after { background: #a85656; }
.metric-purple::after { background: #75639a; }
.metric-cyan::after { background: #4f86a3; }

.work-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: 1.2fr 0.8fr;
}

.work-grid.single-panel {
  grid-template-columns: minmax(0, 1fr);
}

.panel {
  padding: 24px;
}

.status-row {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 14px 0;
}

.status-row strong {
  color: var(--green);
}

.account-list {
  max-width: 760px;
}

.account-table-wrap {
  max-width: 860px;
}

.account-table th,
.account-table td {
  padding: 13px 18px;
  vertical-align: middle;
}

.account-table th:nth-child(1),
.account-table td:nth-child(1) {
  width: 34%;
}

.account-table th:nth-child(2),
.account-table td:nth-child(2) {
  width: 44%;
}

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

.connect-actions {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(270px, 390px));
  margin-top: 26px;
}

.connect-button {
  min-height: 62px;
}

.connect-button.oauth-button.marketplace {
  gap: 8px;
  grid-template-columns: max-content minmax(96px, 140px);
  justify-content: center;
  padding-inline: 14px;
}

.connect-button .oauth-text {
  font-size: 0.8rem;
  justify-self: end;
  letter-spacing: 0;
}

.connect-button .ml-logo {
  height: 27px;
  max-width: 132px;
}

.connect-button .gs-logo {
  height: 28px;
  max-width: 110px;
}

.status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  padding: 7px 10px;
}

.status-pill.status-active {
  background: #e4f7ed;
  color: #157347;
}

.status-pill.status-muted {
  background: #eef2f6;
  color: #667085;
}

.password-policy {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  margin: 12px 0 0;
  text-align: center;
}

.section-heading {
  align-items: start;
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
}

.profile-panel {
  max-width: 980px;
}

.profile-editor {
  max-width: 1180px;
}

.profile-title {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 14px;
}

.profile-title h2 {
  font-size: 1.55rem;
  font-weight: 850;
  margin: 0;
}

.profile-title-icon {
  align-items: center;
  background: #73529a;
  border-radius: 7px;
  color: #fff;
  display: inline-flex;
  font-size: 0.85rem;
  font-weight: 900;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.profile-card-form {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(19, 28, 38, 0.08);
  min-height: 720px;
  padding: 38px 36px 30px;
}

.profile-card-form .form-control,
.profile-card-form .form-select {
  border-color: #d4dbe4;
  border-radius: 6px;
  min-height: 36px;
}

.profile-field {
  margin-bottom: 16px;
}

.profile-field label {
  color: #263445;
  display: block;
  font-size: 0.94rem;
  font-weight: 700;
  margin-bottom: 7px;
}

.company-field {
  max-width: 545px;
}

.tax-field,
.password-field {
  max-width: 360px;
}

.profile-row {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.password-toggle {
  background: transparent;
  border: 0;
  color: #263445;
  font-weight: 800;
  margin: 2px 0 9px;
  padding: 0;
}

.password-input-wrap {
  position: relative;
}

.password-input-wrap .form-control {
  padding-right: 72px;
}

.show-password {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  height: 32px;
  position: absolute;
  right: 8px;
  top: 2px;
}

.profile-hint {
  color: var(--muted);
  font-size: 0.82rem;
  max-width: 480px;
}

.profile-actions {
  justify-content: end;
  margin-top: 80px;
}

.profile-actions .primary-link {
  background: #73529a;
  min-height: 42px;
  min-width: 112px;
}

.profile-form {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-form label {
  color: #344252;
  font-weight: 700;
}

.profile-form .form-control,
.profile-form .form-select {
  margin-top: 7px;
}

.profile-toggles,
.form-actions {
  align-items: center;
  display: flex;
  gap: 18px;
  grid-column: 1 / -1;
}

.settings-modal {
  border: 0;
  border-radius: 8px;
}

.settings-dialog {
  max-width: min(98vw, 1760px);
  width: min(98vw, 1760px);
}

.settings-modal .modal-title {
  font-size: 1.35rem;
  font-weight: 850;
}

.settings-body {
  display: grid;
  gap: 24px;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 78vh;
  overflow: hidden;
}

.settings-nav {
  border-right: 1px solid var(--line);
  display: grid;
  gap: 8px;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  height: 100%;
  padding-right: 18px;
  position: sticky;
  top: 0;
}

.settings-nav button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #344252;
  display: flex;
  font-weight: 800;
  justify-content: center;
  padding: 12px 14px;
  text-align: center;
}

.settings-nav button.active,
.settings-nav button:hover {
  background: #e9f3f3;
  color: var(--teal);
}

.settings-pane h3 {
  font-size: 1.1rem;
  font-weight: 850;
}

.settings-pane p {
  color: var(--muted);
}

.settings-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-pane {
  max-height: 78vh;
  min-width: 0;
  overflow: auto;
  padding-right: 4px;
}

.settings-data-source {
  display: grid;
  gap: 14px;
}

.settings-pane-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding-bottom: 14px;
}

.settings-pane-header h3 {
  font-size: 1.25rem;
  margin: 0;
}

.settings-kicker {
  color: var(--teal);
  display: block;
  font-size: 0.75rem;
  font-weight: 900;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.settings-save-status {
  color: var(--green);
  font-weight: 850;
}

.settings-save-status.error {
  color: #b42318;
}

.settings-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.settings-section summary {
  background: #eef5f2;
  color: #23543d;
  cursor: pointer;
  font-weight: 900;
  padding: 13px 16px;
}

.settings-section:nth-of-type(3) summary {
  background: #f4efe7;
  color: #6a4a22;
}

.settings-form {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.settings-two-col {
  display: grid;
  gap: 14px 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-three-col {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-form label {
  color: #243244;
  font-size: 0.9rem;
  font-weight: 800;
}

.settings-form label input,
.settings-form label select,
.settings-form label textarea {
  font-weight: 500;
  margin-top: 6px;
}

.settings-check {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #dce3eb;
  border-radius: 6px;
  display: flex;
  gap: 8px;
  min-height: 36px;
  padding: 6px 10px;
}

.settings-check input {
  margin: 0;
}

.settings-list-editor {
  display: grid;
  gap: 8px;
}

.settings-inline {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.danger-light-button {
  background: #fff5f5;
  border-color: #f0b8b8;
  color: #a12626;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
}

.formula-textarea {
  font-family: Consolas, "Courier New", monospace;
  font-size: 0.84rem;
}

.category-settings-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(280px, 38%) minmax(0, 1fr);
  padding: 16px;
}

.category-tree-tools {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.amazon-category-tree {
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 560px;
  overflow: auto;
  padding: 8px;
}

.category-tree-node {
  padding-left: calc(var(--depth) * 16px);
}

.category-tree-node label {
  align-items: center;
  border-radius: 5px;
  display: flex;
  gap: 6px;
  margin: 1px 0;
  min-height: 28px;
}

.category-tree-node button {
  background: transparent;
  border: 0;
  color: #253449;
  font-size: 0.86rem;
  overflow: hidden;
  padding: 3px 6px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-expand-button {
  color: #36546f;
  font-weight: 900;
  min-width: 22px;
  padding: 2px 4px;
}

.category-filter-grid span {
  display: block;
}


.category-tree-node button.active,
.category-tree-node button:hover {
  background: #e9f3f3;
  border-radius: 5px;
  color: var(--teal);
}

.category-selected-header {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #dce3eb;
  border-radius: 8px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 12px;
}

.category-selected-header strong {
  display: block;
  font-size: 0.92rem;
}

.category-settings-form h4 {
  border-top: 1px solid var(--line);
  font-size: 1rem;
  font-weight: 900;
  margin: 4px 0 0;
  padding-top: 14px;
}

.description-template {
  min-height: 220px;
}

.settings-section-inline {
  background: #f8fafc;
  border: 1px solid #dce3eb;
  border-radius: 8px;
  display: grid;
  gap: 14px;
  padding: 14px;
}

.settings-section-inline h4 {
  font-size: 1rem;
  font-weight: 900;
  margin: 0;
}

.warranty-block {
  background: #f9fbff;
}

.settings-image-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-image-grid label {
  background: #fff;
  border: 1px solid #dce3eb;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.channel-image-preview {
  border: 1px solid #e4e9ef;
  border-radius: 6px;
  display: block;
  max-height: 82px;
  object-fit: contain;
  width: 100%;
}

.channel-image-preview:not([src]),
.channel-image-preview[src=""] {
  display: none;
}

.password-error {
  color: #c62828;
  font-size: 0.82rem;
  font-weight: 700;
  min-height: 18px;
  margin-top: -8px;
}

.sales-page {
  background: #fff;
  min-height: calc(100vh - 150px);
  padding: 8px 0 24px;
}

.sales-page h2 {
  color: #4f6fa9;
  font-size: 1.5rem;
  font-weight: 500;
  margin: 0 0 24px;
  text-align: center;
}

.sales-filters {
  display: grid;
  gap: 16px 30px;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  margin-bottom: 34px;
}

.search-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px;
}

.search-pair.wide {
  grid-column: span 2;
}

.search-pair .form-control,
.sales-filters .form-select {
  border-color: #cfd7e2;
  border-radius: 4px 0 0 4px;
  min-height: 38px;
}

.sales-filters .form-select {
  border-radius: 4px;
}

.search-pair button,
.sales-tools button {
  background: #164a9b;
  border: 0;
  border-radius: 0 4px 4px 0;
  color: #fff;
  font-weight: 800;
}

.sales-tools {
  display: flex;
  gap: 10px;
  justify-content: end;
  margin-bottom: 66px;
}

.sales-tools button {
  border-radius: 5px;
  height: 38px;
  width: 42px;
}

.sales-tool-link {
  align-items: center;
  background: #f8fafc;
  border: 1px solid #cfd8e3;
  border-radius: 5px;
  color: #263445;
  display: inline-flex;
  font-weight: 800;
  min-height: 38px;
  padding: 0 12px;
  text-decoration: none;
}

.sales-table-wrap {
  overflow-x: auto;
}

.sales-table {
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 1420px;
  width: 100%;
}

.sales-table thead {
  border-bottom: 3px solid #dce3eb;
  border-top: 1px solid #dce3eb;
}

.sales-table th {
  color: #111827;
  font-weight: 900;
  padding: 14px 12px;
  white-space: nowrap;
}

.sales-table td {
  border-top: 1px solid #dce3eb;
  padding: 16px 12px;
  vertical-align: top;
}

.sales-table tbody tr:nth-child(odd) {
  background: #f2f2f2;
}

.sales-table a {
  color: #4265a4;
  display: block;
  text-decoration: none;
}

.sales-table small {
  display: block;
  margin-top: 6px;
}

.truck {
  color: #0d9488;
  display: block;
  margin-top: 6px;
}

.asin {
  border: 1px solid #111;
  border-radius: 2px;
  display: inline-flex;
  font-size: 0.9rem;
  line-height: 1;
  padding: 1px 3px;
}

.danger {
  color: red;
}

.row-actions {
  color: #111827;
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.pdf-button {
  background: #fff;
  border: 1px solid #e4e9ef;
  padding: 4px;
}

.pdf-button img {
  display: block;
  height: 24px;
  object-fit: contain;
  width: 24px;
}

.weight-cell {
  min-width: 150px;
}

.missing-data {
  color: #b42318;
  font-weight: 800;
}

.pagination-bar {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: flex-end;
  margin-top: 18px;
}

.pagination-bar span {
  color: #586577;
  font-size: 0.9rem;
  font-weight: 800;
}

.secondary-button.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.sale-edit-modal {
  border: 0;
  border-radius: 8px;
}

.sale-edit-body {
  display: grid;
  gap: 12px;
}

.sale-edit-body .input-group-text {
  min-width: 158px;
}

.sale-edit-note {
  background: #fff1f1;
  border: 1px solid #f5c2c7;
  border-radius: 6px;
  margin: 2px 0 0;
  padding: 9px 12px;
}

.product-upload-page {
  display: grid;
  gap: 26px;
}

.upload-header {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  padding: 22px 24px;
}

.right-only-header {
  justify-content: flex-end;
}

.upload-header h2 {
  font-size: 1.35rem;
  font-weight: 850;
  margin: 0 0 4px;
}

.upload-header p {
  color: var(--muted);
  margin: 0;
}

.upload-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.upload-panel,
.manual-upload,
.upload-history {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(23, 33, 43, 0.06);
  padding: 22px;
}

.upload-panel-title {
  align-items: center;
  background: #eef8ef;
  border: 1px solid #cfe9d2;
  border-left: 4px solid #67b26f;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 14px;
}

.upload-panel-title span {
  align-items: center;
  background: #e9f3f3;
  border-radius: 8px;
  color: var(--teal);
  display: inline-flex;
  font-weight: 900;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.upload-panel-title h3,
.history-heading h3 {
  font-size: 1rem;
  font-weight: 850;
  margin: 0;
}

.upload-fields,
.advanced-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.upload-fields label,
.manual-main label,
.advanced-grid label {
  color: #263445;
  font-size: 0.9rem;
  font-weight: 750;
}

.file-field {
  grid-column: 1 / -1;
}

.upload-actions {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-top: 18px;
}

.upload-actions a,
.advanced-toggle {
  background: transparent;
  border: 0;
  color: #164a9b;
  font-weight: 800;
  padding: 0;
  text-decoration: none;
}

.primary-action,
.secondary-button {
  border: 0;
  border-radius: 6px;
  color: #fff;
  font-weight: 850;
  min-height: 38px;
  padding: 8px 14px;
}

.primary-action {
  background: var(--green);
}

.secondary-button {
  background: #164a9b;
}

.manual-main {
  align-items: end;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(180px, 260px) minmax(190px, 240px) minmax(220px, 1fr) 150px 100px;
}

.code-type {
  border: 0;
  display: flex;
  gap: 18px;
  margin: 0;
  padding: 0 0 7px;
}

.code-type legend {
  color: #263445;
  float: none;
  font-size: 0.9rem;
  font-weight: 750;
  margin: 0 0 8px;
}

.code-type label,
.force-load {
  align-items: center;
  display: inline-flex;
  gap: 8px;
}

.advanced-toggle {
  margin-top: 14px;
}

.advanced-grid {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 18px;
}

.advanced-grid label:nth-child(3) {
  grid-column: 1 / -1;
}

.gs-country-field {
  grid-column: 1 / -1;
}

.gs-country-field select {
  min-height: 132px;
}

.history-heading {
  align-items: center;
  background: #f7efe7;
  border: 1px solid #ead9c8;
  border-left: 4px solid #b88455;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 12px 14px;
}

.history-search {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(220px, 320px) 92px;
}

.last-upload {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  margin-bottom: 14px;
  padding: 14px 16px;
}

.last-upload span,
.last-upload small {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
}

.last-upload strong {
  display: block;
  font-size: 1rem;
  margin: 3px 0;
}

.history-table-wrap {
  overflow-x: auto;
}

.history-table {
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 980px;
  width: 100%;
}

.history-table th,
.history-table td {
  border-top: 1px solid var(--line);
  padding: 12px 10px;
  vertical-align: middle;
}

.history-table th {
  color: #263445;
  font-weight: 900;
}

.status-chip {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 900;
  margin: 2px 4px 2px 0;
  padding: 5px 10px;
}

.status-chip.error,
.status-chip.con-error {
  background: #fdecec;
  color: #b42318;
}

.status-chip.published,
.status-chip.publicado {
  background: #e8f7ee;
  color: #207348;
}

.status-chip.pending,
.status-chip.pendiente,
.status-chip.procesando {
  background: #edf0f4;
  color: #596579;
}

.status-chip.updated,
.status-chip.actualizado {
  background: #e7edff;
  color: #244b92;
}

.status-chip.status-active {
  background: #e6f6ec;
  color: #197346;
}

.status-chip.status-paused {
  background: #fff1cf;
  color: #8a5a00;
}

.status-chip.status-review {
  background: #e6f0ff;
  color: #2354a6;
}

.status-chip.status-deleted {
  background: #eceff3;
  color: #5b6472;
}

.history-table tbody tr.latest-history-row {
  background: #f8fafc;
  box-shadow: inset 4px 0 0 #9aa6b2;
}

.history-table tbody tr.latest-history-row td {
  border-bottom: 1px solid #b8c2cc;
  border-top: 1px solid #b8c2cc;
}

.history-actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.load-more-history {
  display: flex;
  justify-content: center;
  padding-top: 18px;
}

.load-more-history a {
  text-decoration: none;
}

.detail-modal-footer {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding-top: 16px;
}

.batch-detail-dialog {
  max-width: min(98vw, 1720px);
  width: min(98vw, 1720px);
}

.batch-detail-content {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.24);
  min-height: min(90vh, 980px);
}

.batch-detail-header {
  background: linear-gradient(90deg, #dff4f0, #eef4ff 58%, #fff7ed);
  border-bottom: 1px solid #c9d7e4;
}

.batch-detail-header h2 {
  color: #142032;
  font-size: 1.25rem;
  font-weight: 900;
}

.detail-summary-bar {
  align-items: center;
  background: linear-gradient(90deg, #142032, #1b4f72);
  border-radius: 8px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 10px 12px;
}

.detail-tools {
  align-items: center;
  display: flex;
  gap: 8px;
}

.detail-tools .form-select {
  min-height: 36px;
  min-width: 160px;
}

.detail-table thead {
  background: #dff4f0;
  position: sticky;
  top: 0;
  z-index: 1;
}

.detail-table th {
  color: #163047;
}

.detail-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.detail-table tbody tr:hover {
  background: #fff7ed;
}

.detail-id {
  background: #eef4ff;
  border-radius: 6px;
  color: #244b92;
  display: inline-block;
  font-weight: 800;
  min-width: 72px;
  padding: 4px 8px;
  text-align: center;
}

.detail-status {
  border-radius: 999px;
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 900;
  padding: 5px 9px;
  white-space: nowrap;
}

.detail-status.pending {
  background: #edf0f4;
  color: #596579;
}

.detail-status.published {
  background: #dff4e8;
  color: #137333;
}

.detail-status.updated {
  background: #e7edff;
  color: #244b92;
}

.detail-status.error {
  background: #fde2e1;
  color: #b42318;
}

.detail-message {
  color: #344252;
  display: inline-block;
  max-width: 520px;
  white-space: normal;
}

.marketplace-link {
  align-items: center;
  display: inline-flex;
  margin-left: 8px;
  vertical-align: middle;
}

.marketplace-link img {
  height: 24px;
  max-width: 24px;
  object-fit: contain;
  width: 24px;
}

.date-column {
  min-width: 154px;
  white-space: nowrap;
}

.truncate-cell {
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asin-link {
  color: #174ea6;
  font-weight: 800;
  text-decoration: none;
}

.asin-link:hover {
  text-decoration: underline;
}

.nowrap-button {
  white-space: nowrap;
}

.category-input-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(150px, 260px) 190px;
}

.category-button,
.category-input-row .secondary-button {
  min-width: 190px;
  white-space: nowrap;
}

.category-modal-content {
  border: 0;
  border-radius: 8px;
  min-height: min(82vh, 860px);
}

.category-modal-header {
  background: linear-gradient(90deg, #e9f3f3, #eef4ff);
  border-bottom: 1px solid var(--line);
}

.category-toolbar {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 10px 12px;
}

.category-toolbar span {
  color: #263241;
  font-weight: 850;
}

.category-list {
  display: grid;
  gap: 8px;
}

.category-row {
  align-items: stretch;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr auto;
  padding: 8px;
}

.category-open-button {
  background: #f8fafc;
  border: 0;
  border-radius: 6px;
  color: #182331;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  text-align: left;
}

.category-open-button:hover {
  background: #e9f3f3;
}

.category-open-button strong {
  font-size: 0.94rem;
}

.category-open-button span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.category-empty {
  align-items: center;
  background: #f8fafc;
  border: 1px dashed #c9d7e4;
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 22px;
}

.moderation-page {
  display: grid;
  gap: 18px;
}

.moderation-filters {
  align-items: end;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(23, 33, 43, 0.06);
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(180px, 220px) minmax(160px, 200px) minmax(160px, 200px) minmax(420px, 1fr) auto;
  padding: 18px;
}

.moderation-reason-field {
  justify-self: end;
  width: 100%;
}

.reason-filter-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(260px, 1fr) 86px;
}

.clear-reason-button {
  min-height: 38px;
  padding: 8px 10px;
}

.moderation-search-button {
  justify-self: end;
  min-width: 92px;
  padding-left: 16px;
  padding-right: 16px;
}

.moderation-filters label[hidden] {
  display: none;
}

.moderation-stats .history-heading small {
  color: var(--muted);
  font-weight: 800;
}

.publication-page {
  display: grid;
  gap: 18px;
}

.publication-filters {
  align-items: end;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(23, 33, 43, 0.06);
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(180px, 240px) minmax(160px, 220px) minmax(320px, 1fr) auto auto;
  padding: 18px;
}

.publication-asin-filter {
  width: 100%;
}

.clear-publication-filter {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  text-decoration: none;
}

.publication-table {
  min-width: 1320px;
}

.publication-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 196px;
}

.publication-actions form {
  margin: 0;
}

.danger-button {
  background: #b42318;
  border: 0;
  border-radius: 6px;
  color: #fff;
  font-weight: 850;
  min-height: 38px;
  padding: 8px 12px;
}

.icon-button {
  align-items: center;
  background: #164a9b;
  border: 0;
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  font-size: 1.05rem;
  font-weight: 900;
  height: 36px;
  justify-content: center;
  line-height: 1;
  min-width: 36px;
  padding: 0;
}

.icon-button:hover {
  filter: brightness(0.94);
}

.icon-button.sync-on {
  background: #207348;
}

.icon-button.sync-off {
  background: #6b7280;
}

.icon-button.force-sync {
  background: #1f6f8b;
}

.danger-icon-button {
  background: #b42318;
}

.confirm-delete-modal {
  border: 0;
  border-radius: 8px;
  overflow: hidden;
}

.delete-warning-box {
  background: #fff4e5;
  border: 1px solid #f4c989;
  border-radius: 8px;
  color: #704400;
  display: grid;
  gap: 5px;
  margin-bottom: 16px;
  padding: 14px;
}

.delete-summary {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px 14px;
}

.delete-summary div {
  align-items: center;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
}

.delete-summary dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  margin: 0;
}

.delete-summary dd {
  font-weight: 850;
  margin: 0;
  overflow-wrap: anywhere;
}

.modal-header-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.pending-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 3px 14px rgba(19, 28, 38, 0.13);
  margin: 0 auto;
  max-width: 620px;
  padding: 46px;
  text-align: center;
}

.pending-card .auth-logo {
  margin: 0 auto 26px;
  max-width: 360px;
}

.pending-card h1 {
  font-size: 1.55rem;
  font-weight: 850;
}

.pending-card p {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 12px 0 26px;
}

.admin-panel {
  max-width: 1500px;
}

.external-grid {
  display: grid;
  gap: 8px;
  overflow-x: auto;
}

.external-grid-head,
.external-grid-row {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 1fr) minmax(130px, 0.7fr) minmax(130px, 0.7fr) minmax(130px, 0.7fr) minmax(160px, 0.8fr) 210px;
  min-width: 1250px;
}

.external-grid-head {
  color: #344252;
  font-size: 0.82rem;
  font-weight: 850;
  padding: 0 8px;
}

.external-grid-row {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.external-new-row {
  background: #eef7f7;
}

.external-actions {
  display: flex;
  gap: 6px;
}

.external-actions button {
  border: 0;
  border-radius: 6px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  min-height: 34px;
  padding: 6px 10px;
}

.grid-save {
  background: var(--teal);
}

.grid-copy {
  background: #4f6fa9;
}

.grid-delete {
  background: #b42318;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    min-height: auto;
    position: static;
  }

  .side-nav,
  .metric-grid,
  .work-grid,
  .connect-actions,
  .sales-filters,
  .upload-grid,
  .upload-fields,
  .manual-main,
  .advanced-grid,
  .history-heading,
  .history-search,
  .last-upload,
  .external-grid-head,
  .external-grid-row,
  .profile-form,
  .profile-row,
  .settings-body,
  .settings-grid,
  .auth-panel,
  .login-panel,
  .category-input-row,
  .category-row,
  .detail-tools,
  .reason-filter-row {
    grid-template-columns: 1fr;
  }

  .detail-tools {
    align-items: stretch;
    display: grid;
  }

  .moderation-filters {
    grid-template-columns: 1fr;
  }

  .publication-filters {
    grid-template-columns: 1fr;
  }

  .topbar,
  .content,
  .auth-page,
  .login-page {
    padding: 22px;
  }

  .auth-panel {
    gap: 16px;
    min-height: 0;
    padding: 28px;
  }

  .auth-logo-area {
    min-height: 190px;
  }

  .crosszell-wordmark {
    font-size: 2.05rem;
  }

  .settings-nav {
    border-bottom: 1px solid var(--line);
    border-right: 0;
    padding: 0 0 18px;
  }
}
