:root {
  --bg: #f6f4ef;
  --ink: #202427;
  --muted: #687178;
  --line: #ddd8cf;
  --panel: #fffdf8;
  --accent: #006d77;
  --accent-dark: #064e56;
  --gold: #b7791f;
  --red: #9f3a38;
  --green: #2f6f4e;
  --shadow: 0 18px 50px rgba(32, 36, 39, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select,
a.sync {
  font: inherit;
}

button,
.file-button,
a.sync,
.button-link,
.download-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  min-height: 38px;
  padding: 0 13px;
  cursor: pointer;
}

a.sync {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.button-link {
  display: inline-grid;
  place-items: center;
  width: fit-content;
  text-decoration: none;
  font-weight: 800;
}

.download-button {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
  white-space: nowrap;
}

button:hover,
.file-button:hover {
  border-color: #9fb2b5;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.oauth-box {
  display: grid;
  gap: 8px;
}

.oauth-instructions {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #d8c079;
  border-radius: 8px;
  background: #fff7dc;
}

.oauth-instructions p {
  margin: 0;
  color: #5d5960;
}

.oauth-instructions code {
  overflow-wrap: anywhere;
}

#app {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 0;
  border-bottom: 1px solid var(--line);
  background: #252a2e;
  color: white;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 0;
  font-size: 0.9rem;
  min-height: 38px;
}

.brand small,
.eyebrow,
.metric span,
.item-copy small,
.review small,
.muted {
  color: var(--muted);
}

.sidebar .brand small {
  color: #adb8bd;
}

.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 7px;
  font-size: 0.82rem;
  background: #f3c969;
  color: #2a2418;
  font-weight: 900;
}

.logo-mark {
  overflow: hidden;
  background: #ffffff;
}

.logo-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.logo-settings {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.logo-preview {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
}

.logo-preview .mark {
  width: 56px;
  height: 56px;
}

nav {
  display: flex;
  align-items: center;
  align-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1 1 520px;
  min-width: min(100%, 420px);
}

nav button {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #dde4e6;
  text-align: center;
  min-height: 38px;
  padding: 0 11px;
  font-size: 0.84rem;
  white-space: nowrap;
}

nav button.active,
nav button:hover {
  background: rgba(255, 255, 255, 0.11);
  color: white;
}

.nav-group {
  display: grid;
  gap: 4px;
  align-self: stretch;
  padding: 2px 4px 5px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-heading {
  padding: 0 4px;
  color: #9fb0b6;
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.impersonation-card {
  display: grid;
  gap: 7px;
  margin-bottom: 8px;
  padding: 8px;
  border: 1px solid rgba(243, 201, 105, 0.45);
  border-radius: 7px;
  background: rgba(243, 201, 105, 0.13);
  color: white;
  font-size: 0.78rem;
  line-height: 1.25;
}

.impersonation-card button {
  min-height: 26px;
  padding: 0 7px;
  background: rgba(255, 255, 255, 0.12);
}

main {
  min-width: 0;
  padding: 28px;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
}

.login-brand {
  margin-bottom: 4px;
}

.topbar,
.detail-head,
.panel-title,
.pane-head,
.detail-actions,
.photo-actions,
.top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.sync {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 12px;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  white-space: nowrap;
}

.compact-select {
  min-width: 180px;
}

.sync.ok {
  border: 1px solid #b8d6c6;
  background: #eaf7ef;
  color: var(--green);
}

.sync.warn {
  border: 1px solid #edd2a4;
  background: #fff6df;
  color: var(--gold);
}

.sync.connect {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.eyebrow {
  margin: 0 0 5px;
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 2rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0;
}

.metric,
.panel,
.list-pane,
.detail-pane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
}

.metric strong {
  display: block;
  margin-top: 7px;
  font-size: 1.5rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.workflow-workspace {
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 24px;
  align-items: start;
}

.sku-log-panel {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.sku-log-table {
  display: grid;
  gap: 6px;
}

.sku-log-row {
  display: grid;
  grid-template-columns: 110px 120px minmax(110px, 1fr) minmax(90px, 140px);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.sku-log-row.head {
  background: #eef1f0;
  color: #3d474d;
}

.sku-log-row small {
  color: var(--muted);
}

.sku-history-row {
  grid-template-columns: 96px minmax(180px, 1.4fr) minmax(150px, 0.9fr) minmax(90px, 0.55fr) minmax(90px, 0.65fr) minmax(76px, auto);
}

.label-row {
  grid-template-columns: minmax(180px, 1.35fr) minmax(145px, 0.9fr) minmax(90px, 0.5fr) minmax(86px, 0.55fr) minmax(120px, 0.75fr) minmax(76px, auto);
}

.sku-title-button {
  border: 0;
  background: transparent;
  color: #0f766e;
  font-weight: 900;
  text-align: left;
  padding: 0;
  min-height: 0;
  overflow-wrap: anywhere;
  text-decoration: underline;
}

.sku-reprint-button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.84rem;
}

.feedback-button {
  border-color: #0f766e;
  background: #e8f6f4;
  color: #0b625b;
  font-weight: 900;
}

.feedback-panel {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.feedback-table {
  display: grid;
  gap: 6px;
}

.feedback-row {
  display: grid;
  grid-template-columns: 170px 150px 150px minmax(280px, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.feedback-row.head {
  background: #eef1f0;
  color: #3d474d;
}

.feedback-row p {
  margin: 0;
  line-height: 1.4;
}

.feedback-row span,
.feedback-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-log-panel {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.ai-log-controls {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.ai-log-controls label {
  min-width: 220px;
}

.ai-log-table {
  display: grid;
  gap: 6px;
}

.ai-log-row {
  display: grid;
  grid-template-columns: 170px 150px minmax(260px, 1fr) minmax(180px, 260px);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.ai-log-row.head {
  background: #eef1f0;
  color: #3d474d;
}

.ai-log-row span,
.ai-log-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-log-row small {
  color: var(--muted);
}

.label-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(360px, 1.2fr);
  gap: 14px;
  margin-top: 24px;
  align-items: start;
}

.label-panel {
  display: grid;
  gap: 14px;
}

.intake-panel,
.intake-form,
.intake-review-editor {
  display: grid;
  gap: 14px;
}

.intake-panel {
  margin-top: 24px;
}

.intake-staged {
  min-height: 128px;
}

.warning-flag {
  background: #fde8e6;
  color: #5b1715;
  border-color: #df9a95;
}

.label-wide {
  grid-column: 1 / -1;
}

.label-row {
  grid-template-columns: minmax(150px, 1fr) minmax(90px, 0.7fr) minmax(90px, 0.6fr) minmax(130px, 0.9fr);
}

.bin-storage-panel {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.bin-add {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(130px, 190px) minmax(130px, 190px) auto;
  gap: 12px;
  align-items: end;
}

.bin-grid {
  display: grid;
  gap: 8px;
}

.bin-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(140px, 200px) minmax(140px, 200px) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.bin-row.head {
  background: #eef1f0;
  color: #3d474d;
}

.bin-row.ok {
  border-color: #9dccb2;
  background: #e7f6ed;
  color: #173d29;
}

.bin-row.high {
  border-color: #df9a95;
  background: #fde8e6;
  color: #5b1715;
}

.bin-row input,
.label-panel select {
  border-color: rgba(32, 36, 39, 0.22);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

.capacity-edit {
  display: grid;
  grid-template-columns: minmax(70px, 1fr) 56px;
  gap: 8px;
  align-items: center;
}

.capacity-edit strong {
  text-align: right;
}

.bin-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.bin-actions [data-action="delete-bin"] {
  border-color: #df9a95;
  color: var(--red);
}

.printer-secret {
  display: grid;
  gap: 8px;
}

.printer-secret input {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.printer-row {
  grid-template-columns: minmax(80px, 0.5fr) minmax(120px, 1fr) minmax(90px, 0.8fr) minmax(130px, 0.9fr);
}

.online {
  color: var(--green);
}

.offline {
  color: var(--red);
}

.settings-grid .panel {
  display: grid;
  gap: 12px;
}

.user-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.user-add,
.user-main {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  gap: 12px;
  align-items: end;
}

.user-list {
  display: grid;
  gap: 10px;
}

.pay-summary-grid {
  display: grid;
  gap: 14px;
}

.pay-card {
  display: grid;
  gap: 14px;
}

.pay-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.user-row {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.profile-form {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto auto;
  gap: 12px;
  align-items: end;
}

.access-chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.access-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
  font-size: 0.84rem;
  font-weight: 800;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
}

.pay-credit-inline {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  font-weight: 700;
}

.check-line input {
  width: auto;
}

.settings-save {
  grid-column: 1 / -1;
  justify-self: start;
}

.list-pane,
.detail-pane {
  min-height: 620px;
}

.workflow-list-pane {
  position: sticky;
  top: 92px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: calc(100vh - 108px);
  overflow: hidden;
}

.workflow-list-pane .pane-head {
  flex: 0 0 auto;
  align-items: flex-start;
}

.workflow-item-list {
  overflow: auto;
}

.rail-controls {
  display: grid;
  gap: 8px;
  min-width: 145px;
}

.rail-controls label {
  display: grid;
  gap: 5px;
  font-size: 0.78rem;
}

.rail-job-panel {
  display: grid;
  gap: 9px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfaf4;
}

.rail-job-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.9rem;
}

.rail-job-title span {
  border-radius: 999px;
  padding: 2px 8px;
  background: #e5eceb;
  color: var(--accent-dark);
  font-weight: 900;
}

.pane-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.pane-head h2,
.panel-title h3,
.detail-head h2 {
  margin-bottom: 0;
}

.item-list {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.item-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 72px;
  text-align: left;
  background: white;
}

.item-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 109, 119, 0.15);
}

.workflow-list-pane .item-card {
  grid-template-columns: 48px minmax(0, 1fr);
  min-height: 66px;
}

.workflow-list-pane .queue-badge {
  grid-column: 2;
  justify-self: start;
}

.workflow-list-pane .thumb {
  width: 46px;
  height: 46px;
}

.thumb {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border-radius: 8px;
  background: #e5eceb;
  color: var(--accent-dark);
  font-weight: 800;
}

.thumb img,
.photos img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-copy {
  min-width: 0;
}

.item-copy strong,
.item-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.draft-job-panel {
  margin: 18px 0;
  display: grid;
  gap: 10px;
}

.draft-job-list {
  display: grid;
  gap: 8px;
}

.draft-job-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  background: white;
}

.draft-job-row strong,
.draft-job-row span,
.draft-job-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding: 0;
  background: #ffffff;
}

.ai-topbar {
  padding: 14px 28px 12px;
  border-bottom: 1px solid #edf0ef;
}

.ai-workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: min(760px, calc(100vh - 170px));
  gap: 0;
}

.admin-ai-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  min-height: min(760px, calc(100vh - 170px));
  gap: 0;
}

.admin-ai-chat-shell {
  border-right: 1px solid #edf0ef;
}

.admin-ai-context-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px max(24px, calc((100vw - 1140px) / 2)) 0;
}

.admin-ai-context-strip span {
  border: 1px solid #dfe5e4;
  border-radius: 999px;
  padding: 5px 10px;
  color: #3d474d;
  background: #f8faf9;
  font-size: 0.82rem;
  font-weight: 800;
}

.admin-ai-proposals {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  background: #fbfcfb;
}

.admin-ai-proposal-list {
  display: grid;
  gap: 12px;
}

.admin-ai-proposal {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.admin-ai-proposal.approved {
  border-color: #b8d6c6;
  background: #f3fbf6;
}

.admin-ai-proposal.rejected {
  border-color: #dfc4c1;
  background: #fff7f6;
}

.proposal-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.proposal-head strong,
.proposal-head small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-ai-proposal p {
  margin: 0;
}

.admin-ai-patch {
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.admin-ai-patch-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 8px;
  font-size: 0.86rem;
}

.admin-ai-patch-row strong {
  color: var(--muted);
}

.admin-ai-patch-row span {
  overflow-wrap: anywhere;
}

.proposal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.admin-ai-composer {
  margin-bottom: 16px;
}

.ebay-main {
  display: grid;
  gap: 18px;
}

.ebay-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
  align-items: start;
}

.ebay-inventory-panel,
.ebay-ai-panel {
  min-width: 0;
}

.ebay-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px 150px;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
}

.ebay-controls label {
  display: grid;
  gap: 5px;
  font-weight: 800;
  color: #384149;
}

.ebay-inventory-list {
  display: grid;
  gap: 10px;
}

.ebay-inventory-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) 145px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.ebay-thumb {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border: 1px solid #e3e1dc;
  border-radius: 7px;
  overflow: hidden;
  background: #f4f4f1;
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: none;
}

.ebay-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ebay-row-main {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.ebay-title {
  color: var(--ink);
  font-weight: 900;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ebay-title:hover {
  color: var(--accent);
  text-decoration: underline;
}

.ebay-row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.ebay-specifics {
  display: block;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ebay-row-stats {
  display: grid;
  gap: 5px;
  justify-items: end;
  text-align: right;
}

.ebay-row-stats strong {
  font-size: 1.05rem;
}

.ebay-row-stats span,
.ebay-row-stats small {
  color: var(--muted);
  font-size: 0.82rem;
}

.ebay-ai-panel {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 12px;
}

.ebay-ai-messages {
  max-height: min(560px, calc(100vh - 300px));
  overflow-y: auto;
  padding-right: 3px;
}

.ai-archive {
  border-right: 1px solid #edf0ef;
  background: #fbfcfb;
  padding: 14px;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 14px;
}

.ai-archive-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ai-archive-head button,
.danger-link {
  min-height: 32px;
}

.ai-project {
  display: grid;
  gap: 6px;
}

.ai-project h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.ai-project button {
  display: grid;
  gap: 2px;
  min-height: 46px;
  padding: 7px 9px;
  text-align: left;
  background: white;
}

.ai-project button.active {
  border-color: var(--accent);
  background: #eef8f8;
}

.ai-project button span,
.ai-project button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.danger-link {
  color: var(--red);
  border-color: #e5bbb8;
}

.ai-chat-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  margin-top: 0;
}

.ai-chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
  background: #ffffff;
}

.ai-thread-settings {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(220px, 1fr);
  gap: 10px;
  padding: 12px max(24px, calc((100vw - 1140px) / 2)) 0;
}

.ai-thread-settings label {
  font-size: 0.78rem;
}

.ai-chat-messages {
  display: grid;
  align-content: start;
  gap: 24px;
  overflow-y: auto;
  padding: 22px max(24px, calc((100vw - 1140px) / 2)) 20px;
}

.ai-empty {
  width: min(760px, 100%);
  margin: 10vh auto 0;
  text-align: center;
}

.ai-empty h2 {
  margin: 0 0 22px;
  color: #262a2d;
  font-size: 1.9rem;
  letter-spacing: 0;
}

.ai-prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ai-prompt-chip {
  min-height: 56px;
  border-color: #dfe5e4;
  border-radius: 12px;
  background: #ffffff;
  color: #273136;
  text-align: left;
  padding: 0 14px;
  font-weight: 800;
}

.ai-prompt-chip:hover {
  border-color: #b9c5c3;
  background: #f8faf9;
}

.ai-message {
  display: grid;
  gap: 8px;
  width: min(820px, 100%);
  justify-self: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.ai-message.user {
  background: transparent;
  border-color: transparent;
}

.ai-message.assistant {
  background: transparent;
}

.ai-message strong {
  color: #30383d;
  font-size: 0.83rem;
}

.ai-message.user strong {
  justify-self: end;
  margin-right: 12px;
}

.ai-message p {
  margin: 0;
  line-height: 1.55;
}

.ai-message.user p {
  justify-self: end;
  max-width: min(680px, 88%);
  border-radius: 18px;
  background: #eef1f0;
  padding: 10px 14px;
}

.ai-thinking p {
  color: var(--muted);
}

.ai-message-images,
.ai-attachments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.ai-message-images img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ai-composer {
  display: grid;
  gap: 8px;
  width: min(820px, calc(100% - 48px));
  margin: 0 auto 18px;
  padding: 10px;
  border: 1px solid #dfe5e4;
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 10px 34px rgba(31, 38, 42, 0.12);
}

.ai-composer textarea {
  min-height: 48px;
  max-height: 180px;
  border: 0;
  padding: 10px 12px;
  resize: vertical;
}

.ai-composer textarea:focus {
  outline: 0;
}

.ai-composer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 0 2px 2px;
}

.ai-tool-button,
.ai-composer-actions button {
  min-height: 34px;
  border-radius: 999px;
  padding: 0 12px;
}

.ai-send {
  min-width: 74px;
  margin-left: auto;
}

.ai-draft-actions {
  display: flex;
  justify-content: stretch;
  padding: 2px;
}

.ai-draft-button {
  width: 100%;
  min-height: 40px;
}

.ai-attachments figure {
  max-width: 118px;
}

.queue-badge {
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #3d474d;
  background: #eef1f0;
}

.queue-badge.queued {
  border-color: #edd2a4;
  background: #fff6df;
  color: var(--gold);
}

.queue-badge.processing {
  border-color: #9fb2b5;
  background: #e5eceb;
  color: var(--accent-dark);
}

.queue-badge.local-changes {
  border-color: #edd2a4;
  background: #fff6df;
  color: var(--gold);
}

.queue-badge.unlisted {
  border-color: #edd2a4;
  background: #fff6df;
  color: var(--gold);
}

.queue-badge.succeeded {
  border-color: #b8d6c6;
  background: #eaf7ef;
  color: var(--green);
}

.queue-badge.failed {
  border-color: #df9a95;
  background: #fde8e6;
  color: var(--red);
}

.queue-badge.sold,
.sold-panel {
  border-color: #9fb2b5;
  background: #eef1f0;
  color: #202427;
}

.inventory-manager-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  overflow: hidden;
}

.active-sync-panel {
  margin-top: 12px;
  padding-block: 12px;
}

.sync-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 8px;
}

.sync-status-pill {
  min-height: 54px;
  display: grid;
  align-content: start;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.sync-status-pill .queue-badge {
  justify-self: start;
}

.sync-status-pill strong {
  font-size: 0.88rem;
  line-height: 1.15;
  text-transform: capitalize;
}

.sync-status-pill small {
  color: var(--muted);
  line-height: 1.25;
}

.operation-request-panel {
  margin-top: 10px;
  padding-block: 12px;
}

.operation-request-list {
  display: grid;
  gap: 8px;
}

.operation-request-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.operation-request-row div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.operation-request-row strong,
.operation-request-row small {
  overflow-wrap: anywhere;
}

.operation-request-row small {
  color: var(--muted);
}

.operation-request-empty {
  padding: 9px 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
}

.admin-ebay-sync-log {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.admin-ebay-sync-log .metrics {
  margin: 8px 0;
}

.admin-log-group,
.admin-log-details,
.admin-sync-error-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf7;
}

.admin-log-group {
  padding: 10px 12px;
}

.admin-log-group > summary,
.admin-log-details > summary {
  cursor: pointer;
  font-weight: 800;
}

.admin-log-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.admin-log-details {
  padding: 9px 10px;
}

.admin-log-details.failed {
  border-left: 5px solid #dc2626;
  background: #fff5f5;
}

.admin-log-details > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.admin-log-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 6px 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
}

.admin-log-meta.compact {
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  margin-top: 0;
  font-size: 0.8rem;
}

.admin-sync-error-row {
  display: grid;
  gap: 7px;
  padding: 10px;
}

.admin-sync-error-row.diagnostic {
  border-left: 5px solid #6b7280;
}

.admin-sync-error-row.diagnostic.info {
  border-left-color: #0f766e;
  background: #f0fdfa;
}

.admin-sync-error-row.diagnostic.warn,
.admin-sync-error-row.diagnostic.warning {
  border-left-color: #d97706;
  background: #fffbeb;
}

.admin-sync-error-row.diagnostic.error {
  border-left-color: #dc2626;
  background: #fff5f5;
}

.admin-sync-error-row strong,
.admin-sync-error-row small {
  display: block;
}

.admin-sync-error-row small {
  color: var(--muted);
}

.mini-table {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 80px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 0.9rem;
}

.mini-row.header {
  background: #f3f4f6;
}

.mini-row strong:last-child {
  text-align: right;
}

.nifty-product-tabs,
.inventory-tabs,
.inventory-toolbar,
.nifty-filter-row,
.inventory-summary-row,
.marketplace-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nifty-product-tabs {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.nifty-product-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  font-weight: 900;
}

.nifty-product-tabs button.active {
  border-bottom-color: var(--accent);
  color: var(--accent-dark);
}

.nifty-product-tabs button span {
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef1f0;
  color: #3d474d;
  font-size: 0.78rem;
}

.inventory-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.inventory-tabs button.active {
  border-color: var(--accent);
  background: #e5f3f2;
  color: var(--accent-dark);
}

.inventory-tabs button span,
.inventory-issue-pill {
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef1f0;
  color: #3d474d;
  font-size: 0.78rem;
  font-weight: 900;
}

.inventory-bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f8f7;
}

.inventory-bulk-toolbar strong {
  margin-right: auto;
}

.inventory-issue-pill.has-issues {
  border: 1px solid #df9a95;
  background: #fde8e6;
  color: var(--red);
}

.inventory-toolbar {
  justify-content: space-between;
}

.inventory-toolbar label {
  display: grid;
  gap: 5px;
  min-width: min(100%, 230px);
  flex: 1 1 260px;
}

.inventory-toolbar label:nth-child(2) {
  flex-basis: 420px;
}

.compact-search {
  display: grid;
  gap: 5px;
  margin: 8px 0;
  font-size: 0.82rem;
  font-weight: 800;
}

.inventory-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.inventory-pagination > span {
  margin-right: auto;
  font-weight: 800;
  color: var(--ink);
}

.inventory-pagination label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
}

.pagination-buttons {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.pagination-buttons button {
  min-width: 36px;
  padding: 7px 9px;
}

.pagination-buttons button.active {
  border-color: var(--accent);
  background: #e5f3f2;
  color: var(--accent-dark);
}

.nifty-filter-row {
  justify-content: flex-end;
  padding: 9px 0 0;
  color: var(--muted);
}

.nifty-filter-row > span {
  margin-right: auto;
  font-weight: 800;
}

.nifty-filter-row label {
  display: grid;
  gap: 4px;
  min-width: 150px;
  font-size: 0.78rem;
}

.inventory-summary-row {
  justify-content: space-between;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf4;
  color: #3d474d;
  font-size: 0.88rem;
}

.inventory-matrix {
  display: grid;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.inventory-matrix-row {
  display: grid;
  grid-template-columns: minmax(320px, 1.35fr) minmax(210px, 0.85fr) repeat(3, minmax(155px, 0.6fr)) minmax(230px, 0.8fr);
  gap: 12px;
  align-items: center;
  min-width: 1280px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.inventory-matrix-row:not(.head) {
  cursor: pointer;
}

.inventory-matrix-row:not(.head):hover,
.inventory-matrix-row.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 109, 119, 0.12);
}

.inventory-matrix-row.head {
  min-height: 42px;
  background: #eef1f0;
  color: #3d474d;
  font-size: 0.86rem;
}

.inventory-matrix-entry {
  display: grid;
  gap: 8px;
  min-width: 1280px;
}

.inventory-matrix-entry.expanded {
  padding: 0;
  border-radius: 10px;
}

.sync-error-console {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid #efc2bd;
  border-radius: 8px;
  background: #fff7f5;
}

.sync-error-console strong {
  display: block;
  font-size: 0.9rem;
}

.sync-error-console small {
  color: var(--muted);
}

.sync-error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.sync-error-actions label {
  display: grid;
  gap: 4px;
  min-width: min(100%, 280px);
  font-size: 0.78rem;
  font-weight: 800;
}

.sync-error-actions input {
  min-height: 38px;
}

.inventory-inline-editor {
  display: grid;
  min-width: 1280px;
}

.inventory-inline-editor .inventory-edit-shell {
  margin-top: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.inventory-item-cell {
  display: grid;
  grid-template-columns: 24px 56px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-width: 0;
}

.inventory-row-select {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.inventory-select-spacer {
  width: 18px;
  height: 18px;
}

.sourcing-capture {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.sourcing-form,
.sourcing-detail form {
  display: grid;
  gap: 12px;
}

.sourcing-submit-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.sourcing-photo-button {
  border-color: #111;
  background: #111;
  color: #fff;
  font-weight: 900;
}

.sourcing-photo-button:hover {
  border-color: #000;
  background: #000;
  color: #fff;
}

.sourcing-submit-button {
  border-color: #1d7a44;
  background: #1d7a44;
  color: #fff;
  min-height: 46px;
  font-size: 1rem;
}

.sourcing-submit-button:hover {
  border-color: #176437;
  background: #176437;
}

.inline-field-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.sourcing-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.sourcing-list,
.sourcing-detail {
  min-width: 0;
}

.sourcing-list .item-list {
  max-height: 72vh;
  overflow-y: auto;
}

.sourcing-detail {
  display: grid;
  align-content: start;
  gap: 14px;
}

.sourcing-photos figure {
  min-height: 130px;
}

.sourcing-photos figure > img {
  width: 100%;
  height: 100%;
  min-height: 130px;
  object-fit: cover;
}

.sourcing-review {
  display: grid;
  gap: 8px;
}

.sourcing-review p {
  margin: 0;
}

@media (max-width: 820px) {
  .sourcing-workspace {
    grid-template-columns: 1fr;
  }

  .sourcing-list .item-list {
    max-height: 320px;
  }

  .inline-field-action {
    grid-template-columns: 1fr;
  }

  .sourcing-submit-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

.marketplace-cell,
.inventory-meta-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.marketplace-cell strong,
.inventory-meta-cell strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.marketplace-cell small,
.inventory-meta-cell small {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-action {
  justify-self: start;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.marketplace-placeholder {
  min-height: 74px;
  place-items: center;
  align-content: center;
  justify-items: center;
  border: 1px dashed #cfd8d9;
  border-radius: 8px;
  background: #f9faf8;
  color: #7a858a;
  text-align: center;
}

.marketplace-placeholder span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid #cfd8d9;
  background: white;
  font-weight: 900;
}

.marketplace-placeholder strong {
  max-width: 100%;
  font-size: 0.82rem;
}

.inventory-edit-shell {
  display: grid;
  grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
  gap: 0;
  margin-top: 16px;
  padding: 0;
  overflow: hidden;
}

.inventory-edit-rail {
  display: grid;
  align-content: start;
  gap: 13px;
  padding: 16px;
  border-right: 1px solid var(--line);
  background: #fbfaf4;
}

.rail-step {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.rail-step span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
}

.rail-step small,
.rail-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.rail-step p {
  color: var(--accent-dark);
  font-weight: 800;
}

.rail-actions {
  display: grid;
  gap: 8px;
}

.inventory-edit-main {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
}

.inventory-edit-title {
  align-items: flex-start;
}

.inventory-edit-title .detail-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.inventory-edit-title .detail-actions > span:last-child {
  color: var(--accent-dark);
  font-weight: 900;
}

.inventory-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.inventory-section summary {
  padding: 11px 13px;
  background: #eef1f0;
  cursor: pointer;
  font-weight: 900;
}

.inventory-section-body {
  display: grid;
  gap: 12px;
  padding: 13px;
}

.marketplace-details {
  display: grid;
  gap: 10px;
}

.marketplace-heading {
  justify-content: space-between;
}

.marketplace-heading h3 {
  margin-bottom: 0;
}

.sync-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
  color: #283136;
}

.sync-strip.warning {
  border-color: #df9a95;
  background: #fff1ef;
}

.sync-strip .error-text {
  color: var(--red);
  font-weight: 800;
}

.sync-detail-list {
  flex-basis: 100%;
  display: grid;
  gap: 4px;
  margin-top: 4px;
  font-size: 0.88rem;
}

.sync-details summary {
  cursor: pointer;
  font-weight: 800;
}

.sync-details span {
  display: block;
  margin-top: 4px;
}

.error-list,
.warning-list {
  margin: 8px 0 0;
  padding-left: 20px;
}

.error-list {
  color: var(--red);
}

.warning-list {
  color: var(--gold);
}

.event-log {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.92rem;
}

.event-log p {
  margin: 0;
}

.event-log span {
  color: var(--muted);
  font-weight: 800;
}

.gold,
.gold-button.on {
  border-color: #f0c15c;
  background: #fff4cc;
  color: var(--gold);
  font-weight: 900;
}

.detail-pane {
  padding: 18px;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 14px;
  margin-top: 18px;
}

.panel {
  padding: 16px;
  box-shadow: none;
}

.form-panel,
.ai-panel,
.draft-panel {
  display: grid;
  gap: 12px;
}

.shipping-profile-status,
.shipping-presets-list,
.shipping-preset form {
  display: grid;
  gap: 12px;
}

.boxes-panel,
.box-list {
  display: grid;
  gap: 12px;
}

.box-form,
.box-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) repeat(3, minmax(90px, 0.7fr)) minmax(160px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.box-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.shipping-preset {
  padding: 0;
}

.shipping-preset form {
  padding: 0 16px 16px;
}

.preset-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 14px 16px;
  cursor: pointer;
  list-style-position: inside;
}

.preset-summary strong,
.preset-summary small {
  display: block;
}

.preset-summary small {
  color: var(--muted);
  font-weight: 700;
  margin-top: 2px;
}

.preset-summary .row-actions {
  margin-left: auto;
}

.ai-steering-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.snippet-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.chip-button {
  border-radius: 999px;
  padding: 6px 10px;
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
}

.ai-steering-input {
  min-height: 220px;
  border-color: #0f766e;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(20, 27, 31, 0.46);
}

.feedback-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 27, 31, 0.5);
}

.feedback-modal {
  width: min(560px, 100%);
  max-height: 88vh;
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.feedback-modal form {
  display: grid;
  gap: 12px;
}

.feedback-modal textarea {
  min-height: 160px;
  resize: vertical;
}

.cashout-modal {
  width: min(520px, 100%);
  max-height: 88vh;
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.cashout-modal form {
  display: grid;
  gap: 12px;
}

.cashout-modal textarea {
  min-height: 92px;
  resize: vertical;
}

.feedback-modal-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
  flex-wrap: wrap;
}

.ai-guide-modal {
  width: min(760px, 100%);
  max-height: min(760px, 88vh);
  overflow: auto;
  background: white;
}

.guide-copy {
  display: grid;
  gap: 10px;
}

.guide-copy h4 {
  margin: 8px 0 0;
}

.guide-copy pre {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8f7;
  padding: 12px;
}

.compact-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.preset-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.preset-head small {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-top: 2px;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.shipping-grid {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(220px, 1.4fr) repeat(4, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}

.package-grid {
  grid-template-columns: minmax(170px, 1.3fr) repeat(6, minmax(90px, 1fr));
}

.shipping-grid input[type="checkbox"] {
  width: 20px;
  height: 20px;
  padding: 0;
}

label {
  display: grid;
  gap: 6px;
  color: #3d474d;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dimension-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, 96px));
  gap: 10px;
  align-items: end;
}

.dimension-row input {
  max-width: 96px;
}

.category-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.item-specifics-panel {
  display: grid;
  gap: 12px;
}

.specifics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.specific-field span:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.specific-field small {
  color: var(--muted);
  font-weight: 600;
}

.required-pill {
  border: 1px solid #eccaca;
  border-radius: 999px;
  padding: 1px 7px;
  background: #fff1f0;
  color: var(--red);
  font-size: 0.72rem;
  font-weight: 900;
}

.specifics-optional {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbf9;
  padding: 10px;
}

.specifics-optional summary {
  cursor: pointer;
  font-weight: 800;
}

.specifics-optional .specifics-grid {
  margin-top: 12px;
}

.specific-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.selected-category {
  min-height: 44px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf9;
  color: var(--text);
}

.photo-panel {
  grid-row: span 2;
}

.file-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
}

#captureCanvas {
  display: none;
}

.file-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

video {
  display: none;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin: 14px 0 10px;
  border-radius: 8px;
  background: #202427;
  object-fit: cover;
}

video.on {
  display: block;
}

.photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.center-action {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

figure {
  position: relative;
  margin: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef1f0;
}

figure[draggable="true"] {
  cursor: grab;
}

figure.dragging {
  opacity: 0.58;
  cursor: grabbing;
}

figure.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.22);
}

figure button:not(.photo-preview-button) {
  position: absolute;
  right: 6px;
  bottom: 6px;
  min-height: 30px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 800;
}

.photo-preview-button {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
}

.photo-preview-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.main-photo {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.28);
}

.main-photo-badge,
.photo-index {
  position: absolute;
  left: 6px;
  top: 6px;
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 900;
}

.photo-index {
  left: auto;
  right: 6px;
  color: #283136;
}

.photo-editor-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(20, 27, 31, 0.62);
}

.photo-editor-modal {
  width: min(980px, 100%);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 18px 48px rgba(20, 27, 31, 0.24);
  padding: 16px;
}

.photo-editor-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
}

.photo-editor-canvas-wrap {
  display: grid;
  place-items: center;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #202427;
  overflow: hidden;
}

.photo-crop-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.photo-editor-canvas-wrap canvas {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  touch-action: none;
  cursor: default;
}

.photo-crop-box {
  position: absolute;
  display: none;
  pointer-events: auto;
  touch-action: none;
  border: 2px solid #ffffff;
  background: rgba(15, 118, 110, 0.16);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.32), 0 0 0 1px rgba(15, 118, 110, 0.85);
  cursor: move;
}

.photo-crop-box [data-crop-handle] {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.28);
}

.photo-crop-box [data-crop-handle="nw"] {
  left: -12px;
  top: -12px;
  cursor: nwse-resize;
}

.photo-crop-box [data-crop-handle="n"] {
  left: calc(50% - 11px);
  top: -12px;
  cursor: ns-resize;
}

.photo-crop-box [data-crop-handle="ne"] {
  right: -12px;
  top: -12px;
  cursor: nesw-resize;
}

.photo-crop-box [data-crop-handle="e"] {
  right: -12px;
  top: calc(50% - 11px);
  cursor: ew-resize;
}

.photo-crop-box [data-crop-handle="se"] {
  right: -12px;
  bottom: -12px;
  cursor: nwse-resize;
}

.photo-crop-box [data-crop-handle="s"] {
  left: calc(50% - 11px);
  bottom: -12px;
  cursor: ns-resize;
}

.photo-crop-box [data-crop-handle="sw"] {
  left: -12px;
  bottom: -12px;
  cursor: nesw-resize;
}

.photo-crop-box [data-crop-handle="w"] {
  left: -12px;
  top: calc(50% - 11px);
  cursor: ew-resize;
}

.photo-editor-controls,
.photo-editor-crops {
  display: grid;
  gap: 10px;
  align-content: start;
}

.photo-editor-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-editor-crops label {
  display: grid;
  gap: 4px;
}

.photo-editor-hint {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f7f6;
  color: #425058;
  font-weight: 700;
}

.file-button.dark {
  border-color: #151a1d;
  background: #151a1d;
  color: #ffffff;
}

.intake-fast-actions {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f8f6;
}

.intake-submit {
  background: #16843b;
  border-color: #16843b;
}

.ai-suggestion-panel {
  display: grid;
  gap: 10px;
}

.ai-suggestion-list,
.ebay-error-actions {
  display: grid;
  gap: 8px;
}

.ai-suggestion-row,
.ebay-error-actions button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #ffffff;
}

.ai-suggestion-row p,
.ebay-error-actions small {
  margin: 2px 0 0;
  color: var(--muted);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.ebay-error-actions {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #e9c8c1;
  border-radius: 8px;
  background: #fff7f4;
}

.ebay-error-actions button {
  width: 100%;
  text-align: left;
  grid-template-columns: minmax(0, 1fr);
}

.review {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.review-console {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfb;
}

pre {
  max-height: 280px;
  overflow: auto;
  margin: 10px 0 0;
  border-radius: 8px;
  background: #202427;
  color: #eaf2f3;
  padding: 12px;
  white-space: pre-wrap;
  font-size: 0.82rem;
}

.warning {
  margin: 8px 0 0;
  color: var(--red);
  font-weight: 700;
}

.empty,
.welcome {
  padding: 22px;
  color: var(--muted);
}

@media (max-width: 1080px) {
  #app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 8px;
  }

  .brand {
    margin-bottom: 0;
  }

  nav {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    overflow: visible;
    padding-bottom: 0;
  }

  .nav-group {
    padding: 2px 3px 4px;
  }

  nav button {
    flex: 0 0 auto;
    white-space: nowrap;
    text-align: center;
    min-height: 34px;
    padding: 0 9px;
    font-size: 0.78rem;
  }

  .workspace,
  .detail-grid,
  .settings-grid,
  .label-grid,
  .shipping-grid,
  .package-grid,
  .profile-form,
  .box-form,
  .box-row {
    grid-template-columns: 1fr;
  }

  .workflow-list-pane {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .workflow-item-list {
    overflow: visible;
  }

  .inventory-edit-shell {
    grid-template-columns: 1fr;
  }

  .inventory-edit-rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .rail-actions {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .label-wide {
    grid-column: auto;
  }

  .ai-main {
    min-height: 0;
  }

  .ai-workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .admin-ai-workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .ebay-workspace,
  .ebay-controls {
    grid-template-columns: 1fr;
  }

  .ebay-ai-panel {
    position: static;
  }

  .admin-ai-chat-shell {
    border-right: 0;
    border-bottom: 1px solid #edf0ef;
  }

  .admin-ai-proposals {
    max-height: none;
  }

  .ai-archive {
    border-right: 0;
    border-bottom: 1px solid #edf0ef;
    max-height: 220px;
  }

  .ai-chat-shell {
    min-height: 640px;
  }
}

@media (max-width: 720px) {
  .photo-editor-backdrop {
    padding: 8px;
  }

  .photo-editor-modal {
    max-height: 96vh;
    padding: 12px;
  }

  .photo-editor-body {
    grid-template-columns: 1fr;
  }

  .photo-editor-canvas-wrap {
    min-height: 240px;
  }

  .sidebar {
    max-height: none;
  }

  .brand {
    gap: 6px;
    margin-bottom: 5px;
    font-size: 0.68rem;
  }

  .mark {
    width: 23px;
    height: 23px;
    font-size: 0.6rem;
  }

  .brand small {
    display: none;
  }

  nav {
    gap: 4px;
  }

  .nav-heading {
    font-size: 0.58rem;
  }

  nav button {
    min-height: 32px;
    padding: 0 8px;
    border-radius: 5px;
    font-size: 0.72rem;
  }

  main {
    padding: 18px;
  }

  .ai-main {
    padding: 0;
    min-height: 0;
  }

  .ai-topbar {
    padding: 10px 14px;
  }

  .ai-topbar .top-actions {
    align-items: stretch;
    flex-direction: row;
  }

  .ai-chat-shell {
    min-height: 560px;
  }

  .ai-thread-settings {
    grid-template-columns: 1fr;
    padding: 10px 12px 0;
  }

  .ebay-inventory-row {
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: start;
  }

  .ebay-thumb {
    width: 72px;
    height: 72px;
  }

  .ebay-row-stats {
    grid-column: 1 / -1;
    justify-items: start;
    text-align: left;
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }

  .ai-chat-messages {
    gap: 18px;
    padding: 18px 12px 14px;
  }

  .ai-empty {
    margin-top: 4vh;
  }

  .ai-empty h2 {
    font-size: 1.45rem;
  }

  .ai-prompt-grid {
    grid-template-columns: 1fr;
  }

  .ai-composer {
    width: calc(100% - 20px);
    margin-bottom: 10px;
    border-radius: 18px;
  }

  .ai-message.user p {
    max-width: 94%;
  }

  .topbar,
  .detail-head,
  .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metrics,
  .split,
  .dimension-row,
  .category-picker,
  .specifics-grid,
    .bin-add,
  .bin-row,
  .user-add,
  .user-main,
  .pay-credit-inline {
    grid-template-columns: 1fr;
  }

  .preset-head,
  .preset-summary,
  .row-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .sku-log-row,
  .ai-log-row,
  .feedback-row,
  .label-row,
  .printer-row {
    grid-template-columns: 1fr;
  }

  .feedback-row span,
  .feedback-row strong,
  .ai-log-row span,
  .ai-log-row small {
    white-space: normal;
  }

  .feedback-modal-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
