:root {
  --ink: #181a1f;
  --muted: #667085;
  --line: #e1e5ec;
  --bg: #f6f7f9;
  --green: #285a4b;
  --accent: #285a4b;
  --accent-soft: #eef4f1;
  --success: #24734d;
  --rust: #c94a24;
}
body {color: var(--ink);}
button, a, input, textarea {transition: background-color 150ms, border-color 150ms, color 150ms;}
button:hover {background: #f0f3f8;}
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {outline-color: var(--accent);}
body.home-mode {background: var(--bg);}
body.home-mode #modeHome {padding: 48px 40px;}
.home-inner {max-width: 1120px;}
.home-heading {display: flex; align-items: baseline; justify-content: flex-start; gap: 16px; padding: 0; margin: 0 0 72px; border: 0;}
.home-heading > span {font-size: 28px; font-weight: 700; color: var(--ink);}
.home-heading h1 {font-size: 18px; font-weight: 500; color: var(--muted); margin: 0;}
.mode-entries {gap: 0;}
.mode-entry {height: 278px; padding: 0 48px 0 0; border: 0; border-radius: 0; background: transparent; min-width: 0;}
.mode-entry:hover, .mode-entry:focus-within, .image-entry[data-dragging] {background: transparent;}
.image-entry {padding: 0 0 0 48px; border-left: 1px solid #dce1e8;}
.entry-title {display: flex; align-items: center; gap: 14px; margin-bottom: 28px;}
.entry-title h2 {font-size: 28px; font-weight: 600; line-height: 36px; margin: 0;}
.mode-entry .entry-icon {width: 24px; height: 24px; margin: 0; color: var(--ink); stroke-width: 1.7;}
.home-search-field {position: relative; display: block; width: 100%; height: 210px; flex: none; margin: 0; border: 1px solid #d3d9e3; border-radius: 8px; background: white; overflow: hidden;}
.home-search-field:focus-within {border-color: var(--accent); box-shadow: 0 0 0 3px #285a4b0d;}
.home-search-field textarea {display: block; width: 100%; height: 138px; resize: none; border: 0; outline: none; background: transparent; font-size: 16px; line-height: 26px; padding: 20px; color: var(--ink);}
.home-search-field textarea::placeholder {color: #8992a2;}
.home-search-field button {position: absolute; right: 14px; bottom: 14px; width: 104px; height: 42px; min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 6px; background: var(--accent); color: white; font-size: 14px;}
.home-image-actions {position: relative; display: block; height: 210px; width: 100%; margin: 0;}
.home-image-actions #homeUpload {width: 100%; height: 100%; display: flex; flex-direction: column; gap: 14px; padding: 30px 20px 72px; background: white; border: 1px dashed #bbc6d8; border-radius: 8px; color: var(--ink); font-size: 16px;}
.home-image-actions #homeUpload svg {width: 36px; height: 36px; color: var(--accent); stroke-width: 1.5;}
.home-image-actions #homeUpload:hover, .image-entry[data-dragging] #homeUpload {border-color: var(--accent); background: var(--accent-soft);}
.home-image-actions .home-paste {position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); width: auto; height: 32px; min-height: 32px; padding: 4px 10px; background: transparent; border: 0; font-size: 13px; color: var(--muted);}
.home-image-actions .home-paste:hover {color: var(--accent); background: var(--accent-soft);}
#homeResume {display: flex; gap: 20px; flex-wrap: wrap; margin-top: 28px; min-height: 32px;}
#homeResume button {border: 0; background: transparent; color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 8px; padding: 4px 0;}
#homeResume button:hover {color: var(--accent);}
.sidebar {background: #f6f7f9;}
.sidebar .rail-new, .sidebar .rail-action:hover, .sidebar .rail-action.active {color: var(--accent); background: var(--accent-soft);}
.sidebar .rail-action {color: #667085;}
.query-bar .image-search[aria-pressed="true"] {background: var(--accent); box-shadow: none;}
.image-search-mode .query-bar {border-bottom: 1px solid var(--line);}
.query-bar #prompt:focus {border-color: var(--accent);}
.query-bar #send, .image-run {background: var(--accent); border-color: var(--accent); color: white;}
:is(.home-search-field button, .query-bar #send, .image-run) {
  border: 1px solid #214c3f;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  letter-spacing: 0;
  box-shadow: inset 0 1px 0 #ffffff1a, 0 2px 3px #183b3014;
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease, transform 120ms ease;
}
:is(.home-search-field button, .query-bar #send, .image-run) svg {
  flex-shrink: 0;
  stroke-width: 1.7;
  transition: transform 180ms ease;
}
@media (hover: hover) and (pointer: fine) {
  :is(.home-search-field button, .query-bar #send, .image-run):hover:not(:disabled) {
    background: #214e40;
    border-color: #193e32;
    box-shadow: inset 0 1px 0 #ffffff24, 0 3px 6px #183b3024;
  }
  :is(.home-search-field button, .query-bar #send, .image-run):hover:not(:disabled) svg {transform: translateX(2px);}
}
:is(.home-search-field button, .query-bar #send, .image-run):active:not(:disabled) {
  transform: translateY(1px);
  background: #1b4035;
  box-shadow: inset 0 1px 2px #10291f33;
}
:is(.home-search-field button, .query-bar #send, .image-run):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
:is(.home-search-field button, .query-bar #send, .image-run):disabled {
  background: #506e62;
  border-color: #506e62;
  color: #fff;
  opacity: 1;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}
.mode-heading .text-button:hover, #switchMode:hover {color: var(--accent);}
.chip, nav button.active, .selected, .outfit-tab.active {color: var(--accent); background: var(--accent-soft);}
.region-toolbar [aria-pressed="true"] {color: var(--accent); border-color: #adc5bb; background: var(--accent-soft);}
.region-stage {background: #f1f3f6; border-radius: 6px;}
#regionChanged {display: flex; gap: 6px; align-items: center; margin-top: 10px; font-size: 12px; color: #9c481a; text-align: left;}
#regionChanged svg {width: 14px; height: 14px;}
.image-search-mode .outfit-tab.active {border-color: var(--accent);}
.image-search-mode #results .product {border-color: var(--line);}
.image-search-mode #results .sku {font-size: 13px; font-weight: 650;}
.image-search-mode #results .metrics, .image-search-mode #results .metrics b {color: #667085; font-weight: 400;}
.image-search-mode #results .confirm {color: var(--accent); background: #f0f5f2; font-weight: 500;}
.image-search-mode #results .confirm:hover {background: #e1ece6;}
.image-search-mode #results .confirm.confirmed {color: var(--success); background: #eaf5ee;}
.image-search-mode #results .reject-candidate {color: #7b8492; font-size: 11px;}
.image-search-mode #results .reject-candidate:hover {color: #b24027; background: #fff6f2;}
.badge {background: #c94a24; color: white; box-shadow: none;}
.review-summary > span {color: #667085;}
.review-confirm {background: var(--accent);}
.product .photo {background: #f3f4f6;}
.photo-retry {width: 100%; height: 100%; color: #667085; font-size: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;}
.photo-retry svg {width: 24px; height: 24px;}
.query-pending {display: grid; grid-template-columns: repeat(auto-fill, 200px); gap: 12px;}
#queryPending {grid-column: 2; grid-row: 2; min-width: 0; overflow: auto;}
.manual-region h2::before, .outfit-tab.manual-region::before {content: ""; display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 2px; background: var(--region-color);}
.image-search-mode .outfit-tab.manual-region.active {border-color: var(--region-color);}
button:disabled .lucide-loader-circle {animation: query-spin .9s linear infinite;}
@keyframes query-spin {to {transform: rotate(360deg);}}
.query-placeholder {border: 1px solid var(--line); border-radius: 6px; overflow: hidden;}
.query-placeholder::before {content: ""; display: block; aspect-ratio: 3/4; background: #edf0f4;}
.query-placeholder::after {content: ""; display: block; height: 146px; background: #f7f8fa;}
@media(min-width:1800px) {.query-pending {grid-template-columns: repeat(auto-fill, 220px);}}
@media(max-width:760px) {
  body.home-mode #modeHome {padding: 28px 24px;}
  .home-inner {max-width: 480px;}
  .home-heading {gap: 12px; margin-bottom: 34px;}
  .home-heading > span {font-size: 24px;}
  .home-heading h1 {font-size: 16px;}
  .mode-entries {gap: 26px;}
  .mode-entry {padding: 0; height: auto;}
  .image-entry {border-left: 0; border-top: 1px solid var(--line); padding-top: 26px;}
  .entry-title {gap: 10px; margin-bottom: 16px;}
  .entry-title h2 {font-size: 22px; line-height: 28px;}
  .mode-entry .entry-icon {width: 22px; height: 22px;}
  .home-search-field, .home-image-actions {height: 160px;}
  .home-search-field textarea {height: 98px; padding: 14px; font-size: 16px;}
  .home-search-field button {height: 38px; min-height: 38px; bottom: 12px; right: 12px; width: 92px;}
  .home-image-actions #homeUpload {padding: 20px 16px 58px; gap: 10px;}
  .home-image-actions #homeUpload svg {width: 30px; height: 30px;}
  .home-image-actions .home-paste {bottom: 10px;}
  .query-pending {grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px;}
  .image-search-mode .image-stage-actions {position: sticky; bottom: 0; background: white; padding: 8px 0; z-index: 3;}
}
@media(max-width:760px) and (max-height:650px) {
  body.home-mode #modeHome {padding: 20px 22px;}
  .home-heading {margin-bottom: 24px;}
  .mode-entries {gap: 20px;}
  .image-entry {padding-top: 20px;}
  .home-search-field, .home-image-actions {height: 144px;}
  .home-search-field textarea {height: 85px;}
  .entry-title {margin-bottom: 12px;}
}
@media(prefers-reduced-motion:reduce) {button, a, input, textarea {transition: none;} button:disabled .lucide-loader-circle {animation: none;}}
@media(prefers-reduced-motion:reduce) {
  :is(.home-search-field button, .query-bar #send, .image-run),
  :is(.home-search-field button, .query-bar #send, .image-run) svg {transition: none; transform: none !important;}
}
:is(.home-search-field button, .query-bar #send, .image-search-mode .image-stage-actions .image-run) {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
:is(.home-search-field button, .query-bar #send, .image-run) svg {width: 20px; height: 20px;}
.image-search-mode .image-stage-actions .image-run {margin-left: auto;}
#homeReference {position: relative; width: 100%; height: 210px; background: #edf0ee; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;}
#homeReferenceImage {display: block; width: 100%; height: 100%; object-fit: contain; padding-bottom: 48px;}
.home-reference-actions {position: absolute; bottom: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 4px 8px; background: #ffffffed;}
.home-image-run {margin-left: auto; width: 40px; height: 40px; flex: 0 0 40px; background: var(--accent); color: white; border: 1px solid #214c3f; border-radius: 6px;}
.home-image-run:hover:not(:disabled) {background: #214e40;}
.home-image-run:active:not(:disabled) {transform: translateY(1px);}
.home-image-run:disabled {background: #506e62; color: white; cursor: not-allowed;}
body.home-has-preview #modeHome {align-items: flex-start; padding-top: 40px;}
body.home-has-preview .home-inner {max-width: 1600px; margin: 0 auto;}
body.home-has-preview .home-heading {margin-bottom: 28px;}
body.home-has-preview .mode-entry {height: auto;}
body.home-has-preview .entry-title {margin-bottom: 14px;}
body.home-has-preview .entry-title h2 {font-size: 22px; line-height: 30px;}
body.home-has-preview .home-search-field, body.home-has-preview .home-image-actions, body.home-has-preview #homeReference {height: 160px;}
body.home-has-preview .home-search-field textarea {height: 98px;}
#homePreview {margin-top: 36px; border-top: 1px solid var(--line); padding-top: 20px;}
@media (prefers-reduced-motion: no-preference) {
  #homePreview:not([hidden]) {animation: home-preview-enter 200ms ease-out;}
  @keyframes home-preview-enter {from {opacity: 0; transform: translateY(8px);} to {opacity: 1; transform: translateY(0);}}
}
#homePreviewStatus {font-size: 13px; color: var(--muted); margin-bottom: 16px;}
#homePreviewStatus:empty {display: none;}
.home-preview-group + .home-preview-group {margin-top: 28px;}
.home-preview-group > header {display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px;}
.home-preview-group h2 {min-width: 0; overflow-wrap: anywhere; margin: 0; font-size: 16px; font-weight: 600;}
.home-preview-group h2 span {font-size: 12px; color: var(--muted); margin-left: 12px; font-weight: 400; white-space: nowrap;}
.home-preview-group > header button {flex-shrink: 0; color: var(--accent);}
.home-preview-grid {display: grid; grid-template-columns: repeat(12,minmax(0,1fr)); gap: 10px;}
.home-preview-item {min-width: 0;}
.home-preview-item .photo {position: relative; aspect-ratio: 3/4; height: auto; overflow: hidden; border-radius: 4px; background: #eef0ef;}
.home-preview-item .photo > button {width: 100%; height: 100%; padding: 0; border: 0; display: block; background: transparent;}
.home-preview-item img {width: 100%; height: 100%; object-fit: contain;}
.home-preview-item .sku {display: block; width: 100%; padding: 8px 0; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left;}
.home-preview-item .badge {font-size: 10px; padding: 3px 4px; top: 4px; left: 4px;}
.home-preview-empty {font-size: 14px; color: var(--muted); padding: 24px 0;}
.home-preview-skeleton {aspect-ratio: 3/4; background: #e9edeb; border-radius: 4px; margin-bottom: 30px;}
@media (min-width:761px) and (max-width:1100px) {.home-preview-grid {grid-template-columns: repeat(6,minmax(0,1fr));}.home-preview-item:nth-child(n+7), .home-preview-skeleton:nth-child(n+7) {display: none;}}
@media (max-width:760px) {
  #homeReference {height: 160px;}
  body.home-has-preview #modeHome {padding: 24px 20px;}
  body.home-has-preview .home-inner {max-width: 480px;}
  .home-preview-grid {grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px;}
  .home-preview-item:nth-child(n+5), .home-preview-skeleton:nth-child(n+5) {display: none;}
  .home-preview-item .sku {font-size: 12px;}
}
