:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #737373;
  --faint: #a3a3a3;
  --border: #e5e5e5;
  --border-strong: #d4d4d4;
  --surface: #fafafa;
  --surface-hover: #f5f5f5;
  --sidebar-bg: #f3f4f3;
  --sidebar-border: #d1d5db;
  --sidebar-section: #ffffff;
  --sidebar-label: #4b5563;
  --po-panel: #ffffff;
  --po-panel-raised: #f7f8f7;
  --po-border: #d1d5db;
  --po-border-strong: #9ca3af;
  --po-label: #4b5563;
  --po-accent: #315f3a;
  --po-accent-soft: #eef7f0;
  --danger: #dc2626;
  --radius: 6px;
  --shadow-lg: 0 20px 50px rgba(10, 10, 10, 0.18);
}

* {
  box-sizing: border-box;
}

html, body {
  background: var(--bg);
  color: var(--fg);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

#form {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 200px;
  padding: 1rem 0.625rem;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  z-index: 80;
  transition: width 0.18s ease, padding 0.18s ease;
}

.sidebar .brand {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
  padding: 0.35rem 0.75rem 1rem;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.sidebar-section-items {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  padding: 0.12rem 0 0.35rem;
}

.sidebar-section.collapsed .sidebar-section-items {
  display: none;
}

.sidebar-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem 0.3rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #5f6762;
  cursor: pointer;
  font: inherit;
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  text-align: left;
  overflow: hidden;
  transition: background 0.1s, color 0.1s;
}

.sidebar-section-toggle:hover {
  color: var(--fg);
}

.sidebar-section-toggle span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-section-toggle svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  transition: transform 0.16s ease;
}

.sidebar-section.collapsed .sidebar-section-toggle svg {
  transform: rotate(-90deg);
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  transition: background 0.1s, color 0.1s;
}

.sidebar-section-items a {
  gap: 0.5rem;
  padding: 0.38rem 0.55rem 0.38rem 1.15rem;
  color: #5f6762;
  font-size: 0.78rem;
}

.sidebar-section-items a svg {
  width: 14px;
  height: 14px;
  flex-basis: 14px;
}

.sidebar-nav a svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.sidebar-nav a:hover {
  background: #e9ece9;
  color: var(--fg);
}

.sidebar-nav a.active {
  background: var(--fg);
  color: var(--bg);
}

.sidebar-section-items a.active {
  background: var(--fg);
  color: var(--bg);
}

.sidebar-toggle {
  position: absolute;
  top: 0.6rem;
  right: 0.5rem;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--faint);
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
}

.sidebar-toggle:hover {
  background: var(--surface-hover);
  color: var(--fg);
}

.sidebar-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform 0.18s;
}

/* Collapsed sidebar */
.sidebar.collapsed {
  width: 52px;
  padding: 1rem 0.3rem;
}

.sidebar.collapsed .brand {
  visibility: hidden;
  height: 0;
  padding: 0;
  margin-bottom: 2.25rem;
}

.sidebar.collapsed .sidebar-nav,
.sidebar.collapsed .sidebar-section,
.sidebar.collapsed .sidebar-section-items {
  gap: 0.35rem;
}

.sidebar.collapsed .sidebar-section,
.sidebar.collapsed .sidebar-section-items {
  padding: 0;
}

.sidebar.collapsed .sidebar-nav a,
.sidebar.collapsed .sidebar-logout button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  justify-content: center;
  padding: 0;
  margin-inline: auto;
}

.sidebar.collapsed .sidebar-nav a svg,
.sidebar.collapsed .sidebar-section-items a svg,
.sidebar.collapsed .sidebar-logout svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.sidebar.collapsed .sidebar-nav a > span,
.sidebar.collapsed .sidebar-logout button > span,
.sidebar.collapsed .sidebar-user {
  display: none;
}

.sidebar.collapsed .sidebar-section-toggle {
  display: none;
}

.sidebar.collapsed .sidebar-section.collapsed .sidebar-section-items {
  display: flex;
}

.sidebar.collapsed .sidebar-toggle {
  right: 50%;
  transform: translateX(50%);
}

.sidebar.collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

.sidebar-logout {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.sidebar-logout form {
  margin: 0;
}

.sidebar-logout button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  border: none;
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}

.sidebar-logout button:hover {
  background: var(--surface-hover);
  color: var(--fg);
}

.sidebar-logout svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.sidebar-user {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  padding: 0 0.75rem 0.35rem;
}

/* Login */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  min-height: 100vh;
  margin: 0;
  background: var(--surface);
}

.login-main {
  width: 100%;
  max-width: 340px;
}

.login-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem 1.75rem;
  box-shadow: 0 4px 24px rgba(10, 10, 10, 0.06);
}

.login-brand {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
  margin-bottom: 1.25rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.login-form label {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.login-form input[type=text],
.login-form input[type=password] {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
}

.login-form input:focus {
  outline: none;
  border-color: var(--fg);
}

.login-form button.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.25rem;
  margin-top: 1rem;
}

.button-spinner {
  display: none;
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: button-spin 0.7s linear infinite;
}

.is-loading .button-spinner {
  display: inline-block;
}

@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}
.login-note {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.login-error {
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
  color: var(--danger);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  margin-bottom: 0.25rem;
}

/* Home */
.home-main {
  width: auto;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 1.25rem 1.25rem 1.5rem 216px;
  background: var(--bg);
}

.sidebar.collapsed ~ .home-main {
  padding-left: 76px;
}

.home-shell {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.home-header h1 {
  margin: 0;
  color: var(--fg);
  font-size: 1.45rem;
  line-height: 1.1;
}

.home-header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.home-app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.75rem;
}

.home-app-card {
  min-height: 8.5rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.12s ease, background 0.12s ease, transform 0.12s ease;
}

.home-app-card:hover,
.home-app-card:focus-visible {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-1px);
  outline: none;
}

.home-app-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
}

.home-app-icon svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.home-app-copy {
  min-width: 0;
  display: grid;
  gap: 0.35rem;
}

.home-app-copy strong {
  color: var(--fg);
  font-size: 0.95rem;
  line-height: 1.2;
}

.home-app-copy span {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

/* Accounts */
.accounts-main {
  max-width: 1040px;
  height: 100vh;
}

.accounts-page {
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.account-create {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(0, 1.25fr);
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  margin-bottom: 1rem;
}

.account-create h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}

.account-create p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.account-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.account-form input[type=email],
.account-form input[type=password] {
  width: 100%;
  height: 2.3rem;
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
}

.account-form input:focus {
  outline: none;
  border-color: var(--fg);
}

.account-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: none;
  letter-spacing: 0;
}

.account-check input {
  margin: 0;
}

.account-success {
  padding: 0.5rem 0.7rem;
  color: #166534;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  font-size: 0.8rem;
}

.account-list-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.account-table {
  min-width: 720px;
}

/* Stats */
.stats-main {
  max-width: 1120px;
  height: 100vh;
}

.stats-page {
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.stats-card {
  min-height: 5rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.stats-card span,
.stats-panel h2,
.stats-recent h2 {
  margin: 0;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stats-card strong {
  color: var(--fg);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0;
}

.stats-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.stats-panel,
.stats-recent {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}

.stats-panel h2,
.stats-recent h2 {
  padding: 0.75rem 0.75rem 0.6rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.stats-table {
  min-width: 0;
  table-layout: auto;
}

.stats-table th,
.stats-table td {
  white-space: nowrap;
}

.stats-recent {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.stats-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.stats-recent-table {
  min-width: 980px;
}

.status-failed {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.status-partial {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

/* Model tools */
.model-tools-main {
  max-width: 1120px;
  height: 100vh;
}

.model-tools-page {
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.model-tool-list {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  padding-right: 0.15rem;
}

.model-tool-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}

.model-tool-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.model-tool-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
}

.model-tool-meta,
.model-tool-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.model-tool-meta {
  flex-wrap: wrap;
  color: var(--faint);
  font-size: 0.76rem;
}

.model-tool-actions {
  flex: 0 0 auto;
}

.model-tool-actions form {
  margin: 0;
}

.model-measurements {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.model-measurements div {
  min-width: 0;
  padding: 0.75rem 1rem;
  border-right: 1px solid var(--border);
}

.model-measurements div:last-child {
  border-right: 0;
}

.model-measurements dt {
  margin: 0 0 0.2rem;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.model-measurements dd {
  margin: 0;
  color: var(--fg);
  font-weight: 600;
}

.model-bucket-assets {
  padding: 0.85rem 1rem 1rem;
}

.model-section-label {
  margin-bottom: 0.6rem;
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.model-asset-row {
  display: flex;
  gap: 0.55rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
}

.model-asset-card {
  flex: 0 0 132px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  color: var(--fg);
  text-decoration: none;
}

.model-asset-card:hover {
  border-color: var(--border-strong);
}

.model-asset-card img {
  width: 100%;
  aspect-ratio: 3/4;
  display: block;
  object-fit: contain;
  background: var(--bg);
}

.model-asset-card span,
.model-asset-card small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-asset-card span {
  padding: 0.45rem 0.5rem 0.1rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.model-asset-card small {
  padding: 0 0.5rem 0.45rem;
  color: var(--faint);
  font-size: 0.65rem;
}

.model-empty,
.model-empty-state {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.model-empty-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.model-empty-state p {
  margin: 0;
}

.model-form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.model-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.model-form-actions .primary,
.model-form-actions .toolbar-button {
  width: auto;
  min-width: 8rem;
}

.row + .row {
  margin-top: 0.85rem;
}

#form > .row {
  flex: 0 0 auto;
}

#form > #results-section {
  flex: 1 1 auto;
}

.row-pair {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 0.75rem;
}

.row-pair .field {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.row-pair .field > :last-child {
  margin-top: auto;
}

label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin-bottom: 0.35rem;
}

label .muted-suffix {
  color: var(--faint);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

/* Pose selector button (opens modal) */
.select-button {
  width: 100%;
  height: 2.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--fg);
  text-align: left;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}

.select-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.select-button:focus-visible {
  outline: none;
  border-color: var(--fg);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.06);
}

.select-button .select-button-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-button .value {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.select-button .chevron {
  color: var(--faint);
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

/* Drop zone */
#dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.12s, background 0.12s;
}

#dropzone:hover {
  border-color: var(--faint);
  background: var(--surface-hover);
}

#dropzone.dragover {
  border-color: var(--fg);
  background: var(--surface-hover);
}

#dropzone p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

#preview-wrap {
  display: none;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  background: var(--bg);
}

#preview-wrap.visible {
  display: flex;
}

.ref-list {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
}

.ref-item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.ref-item img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.ref-name {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#preview-wrap .ref-remove {
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--faint);
  cursor: pointer;
  font-size: 0;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

#preview-wrap .ref-remove svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#preview-wrap .ref-remove:hover {
  background: var(--bg);
  border-color: var(--border);
  color: var(--danger);
}

#preview-wrap > button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--muted);
}

#preview-wrap > button:hover {
  border-color: var(--fg);
  color: var(--fg);
}

textarea {
  width: 100%;
  min-height: 44px;
  height: 44px;
  padding: 0.45rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.45;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  background: var(--bg);
  color: var(--fg);
}

textarea::placeholder {
  color: var(--faint);
}

textarea:focus {
  outline: none;
  border-color: var(--fg);
}

.measurement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.compact-measurement-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.measurement-field {
  min-width: 0;
}

.measurement-field > span {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 600;
}

.measurement-input {
  min-height: 2.4rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--muted);
}

.measurement-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 0.9rem;
}

.measurement-input input:focus {
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  box-shadow: none;
}

input[type=search]::-webkit-search-decoration,
input[type=search]::-webkit-search-cancel-button,
input[type=search]::-webkit-search-results-button,
input[type=search]::-webkit-search-results-decoration {
  display: none;
  -webkit-appearance: none;
}

button.primary {
  width: 100%;
  padding: 0.55rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  background: var(--fg);
  color: var(--bg);
  border: 1px solid var(--fg);
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.12s;
}

button.primary:hover {
  opacity: 0.88;
}

button.primary:disabled {
  opacity: 0.4;
  cursor: wait;
}

#status {
  margin-top: 0.6rem;
  min-height: 1.1rem;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

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

/* Results */
#results-section {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#results-section > label {
  flex: 0 0 auto;
}

.results {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.35rem;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.card {
  flex: 0 0 calc((100% - 1rem) / 3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  scroll-snap-align: start;
}

.card img {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: block;
  background: var(--surface);
  object-fit: contain;
}

.card-footer {
  flex: 0 0 auto;
}

.card-placeholder {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  align-items: center;
  justify-content: center;
  color: var(--faint);
}

.card-placeholder svg {
  width: 2.25rem;
  height: 2.25rem;
  opacity: 0.8;
}

.card-footer {
  padding: 0.5rem 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-footer a {
  color: var(--fg);
  text-decoration: none;
}

.card-footer a:hover {
  text-decoration: underline;
}

.card-err {
  padding: 1.25rem 0.75rem;
  text-align: center;
  color: var(--danger);
  font-size: 0.8rem;
}

#form .results {
  flex: 0 0 auto;
  align-items: start;
}

#form .card {
  align-self: start;
}

#form .card img,
#form .card-placeholder {
  aspect-ratio: 3/4;
}

#form .card img {
  flex: 0 0 auto;
  height: auto;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 10, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
  animation: fade 0.12s ease-out;
}

.modal.open {
  display: flex;
}

.modal-dialog {
  background: var(--bg);
  border-radius: 10px;
  width: 100%;
  max-width: 820px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop 0.14s ease-out;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 4px;
}

.modal-close:hover {
  background: var(--surface);
  color: var(--fg);
}

.modal-close svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.modal-footer button {
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.85rem;
  border-radius: var(--radius);
  cursor: pointer;
}

.modal-footer .secondary {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
}

.modal-footer .secondary:hover {
  border-color: var(--fg);
}

.modal-footer .primary {
  width: auto;
  padding: 0.5rem 1.25rem;
}

.shopify-fetch-dialog {
  max-width: 420px;
}

.shopify-fetch-form select {
  width: 100%;
  min-height: 2.35rem;
  padding: 0.45rem 0.65rem;
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
}

/* Pose picker (inside modal) */
.poses {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
}

.poses figure {
  margin: 0;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.12s, background 0.12s;
}

.poses figure:hover {
  border-color: var(--faint);
}

.poses figure.selected {
  border-color: var(--fg);
}

.poses figure.selected figcaption {
  color: var(--fg);
}

.poses figure:not(.selected) img {
  opacity: 0.35;
}

.poses img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: contain;
  display: block;
  transition: opacity 0.12s;
}

.poses figcaption {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@keyframes fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
/* Segmented control (model picker) */
.segment-control {
  display: inline-flex;
  width: 100%;
  height: 2.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  padding: 2px;
  gap: 2px;
}

.segment {
  flex: 1;
  min-width: 0;
  padding: 0 0.5rem;
  font: inherit;
  font-size: 0.85rem;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: calc(var(--radius) - 2px);
  transition: background 0.12s, color 0.12s;
}

.segment:hover {
  color: var(--fg);
}

.segment.active {
  background: var(--fg);
  color: var(--bg);
}

/* Custom select (listbox) */
.custom-select {
  position: relative;
}

.custom-select[data-open=true] > .custom-select-trigger {
  border-color: var(--fg);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.06);
}

.custom-select[data-open=true] .chevron {
  transform: rotate(180deg);
}

.custom-select-trigger .chevron {
  transition: transform 0.12s;
}

.custom-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(10, 10, 10, 0.12);
  max-height: 12rem;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  animation: pop 0.1s ease-out;
}

.custom-select-menu::-webkit-scrollbar {
  width: 0.35rem;
}

.custom-select-menu::-webkit-scrollbar-track {
  background: transparent;
}

.custom-select-menu::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

.custom-select-menu::-webkit-scrollbar-thumb:hover {
  background: var(--faint);
}

.custom-select-menu[hidden] {
  display: none;
}

.custom-select-option {
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  color: var(--fg);
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  transition: background 0.08s, color 0.08s;
  outline: none;
}

.custom-select-option:hover,
.custom-select-option:focus {
  background: var(--surface-hover);
}

.custom-select-option[aria-selected=true] {
  background: var(--fg);
  color: var(--bg);
}

.custom-select-option[aria-selected=true]:hover,
.custom-select-option[aria-selected=true]:focus {
  background: var(--fg);
  color: var(--bg);
  opacity: 0.92;
}

/* Collection badge */
.collection-tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* Nav */
/* Save panel (index page, after results) */
.save-panel {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
  flex: 0 0 auto;
  transition: opacity 0.12s;
}

.save-panel.disabled {
  opacity: 0.55;
}

.save-panel > label {
  margin-bottom: 0.3rem;
}

.save-row {
  display: flex;
  gap: 0.5rem;
}

.save-row input {
  flex: 1;
  padding: 0.5rem 0.7rem;
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
}

.save-row input:focus {
  outline: none;
  border-color: var(--fg);
}

.save-row input:disabled {
  background: var(--surface);
  color: var(--faint);
  cursor: not-allowed;
}

.save-row button.primary {
  width: auto;
  padding: 0.5rem 1.25rem;
}

#save-status {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  min-height: 1.1rem;
}

#save-status.error {
  color: var(--danger);
}

#save-status a {
  color: var(--fg);
}

/* Library (products list) */
.empty {
  text-align: center;
  color: var(--muted);
  margin-top: 3rem;
  font-size: 0.9rem;
}

.empty a {
  color: var(--fg);
}

.library-main {
  max-width: 1040px;
  height: 100vh;
}

.product-index {
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.product-index-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.product-index-toolbar h1 {
  flex: 0 0 auto;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0;
}

.toolbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 2rem;
  padding: 0 0.75rem;
  background: var(--fg);
  border: 1px solid var(--fg);
  border-radius: var(--radius);
  color: var(--bg);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  flex: 0 0 auto;
  cursor: pointer;
}

.toolbar-button[type=submit] {
  font: inherit;
}

.toolbar-button svg {
  width: 0.95rem;
  height: 0.95rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.toolbar-button:hover {
  opacity: 0.88;
}

.toolbar-button.secondary {
  background: var(--surface);
  border-color: var(--border);
  color: var(--muted);
}

.toolbar-button.danger {
  background: #fff5f5;
  border-color: #efb8b8;
  color: var(--danger);
}

.toolbar-button:disabled,
.toolbar-button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.toolbar-button.loading {
  opacity: 0.65;
}

.product-search {
  flex: 1 1 420px;
  width: auto;
  max-width: 460px;
  height: 2.25rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.product-search:focus-within {
  background: var(--bg);
  border-color: var(--fg);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.06);
}

.product-search svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.product-search input {
  min-width: 0;
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 0.9rem;
}

.product-search input::placeholder {
  color: var(--faint);
}

.product-results {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.product-section-list {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: hidden;
  padding-right: 0.15rem;
}

.product-state-tabs {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.15rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.product-state-tabs a {
  min-height: 2.1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0 0.7rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.product-state-tabs a span {
  white-space: nowrap;
}

.product-state-tabs a:hover {
  background: var(--surface);
  color: var(--fg);
}

.product-state-tabs a.active {
  background: var(--bg);
  border-color: var(--border-strong);
  color: var(--fg);
}

.product-state-tabs strong {
  min-width: 1.28rem;
  height: 1.28rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.product-state-tabs a.active strong {
  background: var(--fg);
  color: var(--bg);
}

.product-state-section {
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.product-state-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.product-state-heading h2 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0;
}

.product-state-heading > div {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.product-state-heading > div > span {
  color: var(--faint);
  font-size: 0.78rem;
  white-space: nowrap;
}

.product-table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(100vh - 15.5rem);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.product-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  table-layout: fixed;
}

.product-table th,
.product-table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.product-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  color: var(--faint);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.product-table td {
  color: var(--muted);
  font-size: 0.85rem;
}

.product-table tbody tr:hover {
  background: var(--surface);
}

.product-table tbody tr:last-child td {
  border-bottom: none;
}

.table-empty {
  height: 8rem;
  text-align: center !important;
  color: var(--muted);
}

.select-col {
  width: 42px;
}

.product-table th:nth-child(2),
.product-table td:nth-child(2) {
  width: auto;
}

.product-table th:nth-child(3),
.product-table td:nth-child(3) {
  width: 138px;
}

.product-table th:nth-child(4),
.product-table td:nth-child(4) {
  width: 92px;
}

.actions-col {
  width: 92px;
  text-align: right;
  padding-right: 0.5rem !important;
}

.actions-col form {
  margin: 0;
  display: inline-flex;
}

.actions-col {
  white-space: nowrap;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.25rem;
  min-width: 4.25rem;
  vertical-align: middle;
}

.table-actions .icon-button {
  margin: 0;
}

.checkbox-box {
  width: 1rem;
  height: 1rem;
  display: inline-block;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg);
  vertical-align: middle;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  color: var(--fg);
  text-decoration: none;
}

.product-cell:hover .product-name {
  text-decoration: underline;
}

.product-name-link,
.product-local-link {
  text-decoration: none;
}

.product-name-link:hover,
.product-local-link:hover {
  text-decoration: underline;
}

.product-thumb-stack {
  width: 34px;
  height: 42px;
  flex: 0 0 34px;
  display: block;
}

.product-thumb-stack img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  display: block;
}

.product-thumb-stack:empty {
  border: 1px dashed var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
}

.product-cell-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.product-name-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.product-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg);
}

.product-external-link {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
  border-radius: 4px;
}

.product-external-link:hover {
  color: var(--fg);
  background: var(--surface-hover);
}

.product-external-link svg {
  width: 0.85rem;
  height: 0.85rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.product-subtitle,
.muted-table-text {
  color: var(--faint);
}

.product-upload-status {
  display: none;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
}

.product-upload-status.is-visible {
  display: block;
}

.product-upload-meter {
  width: min(11rem, 100%);
  height: 0.28rem;
  display: none;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface);
}

.product-upload-meter.is-visible {
  display: block;
}

.product-upload-meter span {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--fg);
  transition: width 160ms ease;
}

.product-upload-meter.is-indeterminate span {
  width: 42% !important;
  animation: upload-saving 1.05s ease-in-out infinite;
}

@keyframes upload-saving {
  0% {
    transform: translateX(-115%);
  }
  100% {
    transform: translateX(250%);
  }
}
.mobile-hide-col {
  display: table-cell;
}

.toast-region {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.upload-toast {
  max-width: min(22rem, 100vw - 2rem);
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--fg);
  color: var(--bg);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(10, 10, 10, 0.16);
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 180ms ease;
}

.upload-toast.error {
  background: #8f1d1d;
}

.upload-toast.loading {
  position: relative;
  overflow: hidden;
  padding-left: 2.1rem;
}

.upload-toast.loading::before {
  content: "";
  position: absolute;
  left: 0.85rem;
  top: 50%;
  width: 0.72rem;
  height: 0.72rem;
  margin-top: -0.36rem;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: var(--bg);
  border-radius: 999px;
  animation: spin 0.75s linear infinite;
}

.upload-toast.is-hiding {
  opacity: 0;
  transform: translateY(0.35rem);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  min-height: 1.45rem;
  padding: 0 0.58rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--muted);
}

.status-no-reference {
  background: #fff7f7;
  border-color: #f3c7c7;
  color: #8f1d1d;
}

.status-no-reference::before {
  background: #dc2626;
}

.status-has-reference {
  background: #f6f9ff;
  border-color: #c8d8f5;
  color: #214f94;
}

.status-has-reference::before {
  background: #2563eb;
}

.status-review {
  background: #fffaf0;
  border-color: #efd99a;
  color: #7a4b08;
}

.status-review::before {
  background: #d97706;
}

.status-added {
  background: #f4fbf6;
  border-color: #bfe2c8;
  color: #1f6b35;
}

.status-added::before {
  background: #16a34a;
}

.status-pending {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

.status-pending::before {
  background: #64748b;
}

.status-in_transit {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.status-in_transit::before {
  background: #2563eb;
}

.status-delivered {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.status-delivered::before {
  background: #16a34a;
}

.status-exception {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.status-exception::before {
  background: #dc2626;
}

.status-unknown {
  background: #f5f5f5;
  border-color: #d4d4d4;
  color: #525252;
}

.status-unknown::before {
  background: #737373;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.product-pagination {
  flex: 0 0 auto;
  min-height: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pagination-actions a,
.pagination-actions > span:not(:nth-child(2)) {
  width: 1.75rem;
  height: 1.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--bg);
}

.pagination-actions a:hover {
  color: var(--fg);
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.pagination-actions > span:not(:nth-child(2)) {
  opacity: 0.45;
}

.pagination-actions svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  flex: 0 0 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0;
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--faint);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  text-decoration: none;
  vertical-align: middle;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.icon-button svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover {
  background: var(--surface-hover);
  border-color: var(--border);
  color: var(--fg);
}

.icon-button:disabled,
.icon-button.loading {
  opacity: 0.5;
  cursor: not-allowed;
}

.icon-button:focus-visible {
  outline: none;
  border-color: var(--fg);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.06);
}

.icon-button.danger-icon:hover,
.icon-button.danger-icon:focus-visible {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger);
}

.product-images {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
}

.product-images figure {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface);
}

.product-images figure.ref-thumb {
  border-color: var(--border-strong);
  background: var(--bg);
}

.product-images img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  display: block;
}

.product-images figcaption {
  padding: 0.25rem 0.5rem;
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}

/* Product detail */
.product-detail-main {
  max-width: 720px;
  height: 100vh;
}

.product-detail {
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.detail-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.detail-heading form {
  margin: 0;
  flex: 0 0 auto;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.detail-actions .toolbar-button,
.detail-actions .icon-button {
  height: 2rem;
}

.detail-actions form {
  margin: 0;
  display: inline-flex;
}

.state-inline-form {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.state-select {
  width: 8.75rem;
}

.state-select .select-button {
  height: 2rem;
  min-height: 2rem;
  padding-inline: 0.55rem;
  font-size: 0.78rem;
}

.state-select .custom-select-menu {
  min-width: 9rem;
}

.detail-heading-copy {
  min-width: 0;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: none;
}

.detail-back:hover {
  color: var(--fg);
}

.detail-back svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.detail-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.detail-title span {
  min-width: 0;
}

.detail-external-link {
  width: 1.35rem;
  height: 1.35rem;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  margin-top: 0.3rem;
  color: var(--faint);
  font-size: 0.78rem;
}

.detail-meta .status-pill {
  min-height: 1.35rem;
  padding-inline: 0.52rem;
  font-size: 0.64rem;
}

.workflow-form,
.reference-upload {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.workflow-form input[type=text],
.workflow-form input[type=number],
.workflow-form select,
.workflow-form input[type=file],
.reference-upload input[type=file] {
  width: 100%;
  min-height: 2.35rem;
  padding: 0.45rem 0.65rem;
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
}

.workflow-form input[type=file],
.reference-upload input[type=file] {
  padding: 0.28rem;
  color: var(--muted);
  cursor: pointer;
}

.workflow-form input[type=file]::file-selector-button,
.reference-upload input[type=file]::file-selector-button {
  min-height: 1.7rem;
  margin-right: 0.65rem;
  padding: 0 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--radius) - 1px);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.workflow-form input[type=file]::file-selector-button:hover,
.reference-upload input[type=file]::file-selector-button:hover {
  background: var(--surface-hover);
}

.workflow-form input:focus,
.workflow-form select:focus,
.reference-upload input:focus {
  outline: none;
  border-color: var(--fg);
}

input:focus,
select:focus,
textarea:focus {
  outline: none !important;
  border-color: var(--border) !important;
  box-shadow: none !important;
}

.product-search:focus-within {
  border-color: var(--border);
  box-shadow: none;
}

.workflow-form button.primary {
  margin-top: 0.25rem;
}

.reference-upload {
  margin-bottom: 0.75rem;
  padding: 0.75rem;
  gap: 0.45rem;
}

.reference-upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
}

.capture-detail {
  max-width: 760px;
}

.capture-form {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.capture-form > input[type=file] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.capture-drop {
  min-height: 10rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
}

.capture-drop:hover {
  background: var(--surface-hover);
}

.capture-drop svg {
  width: 2rem;
  height: 2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.capture-drop span {
  font-size: 0.92rem;
  font-weight: 600;
}

.capture-preview {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.65rem;
}

.capture-preview:empty {
  display: none;
}

.capture-preview-card {
  position: relative;
  aspect-ratio: 3/4;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.capture-preview-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.capture-preview-card .icon-button {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  background: rgba(255, 255, 255, 0.92);
}

.capture-actions {
  display: flex;
  align-items: center;
  justify-content: stretch;
  gap: 0.5rem;
  padding-top: 0.25rem;
}

.capture-actions .toolbar-button {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  height: 2.25rem;
  min-height: 2.25rem;
  margin: 0;
  padding: 0 0.85rem;
  font-size: 0.9rem;
  line-height: 1;
  appearance: none;
}

.detail-section {
  min-height: 0;
  min-width: 0;
}

.detail-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.detail-section-heading h2 {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
}

.detail-section-heading span {
  color: var(--muted);
  font-size: 0.78rem;
}

.detail-image-grid {
  display: flex;
  gap: 0.75rem;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.05rem 0.05rem 0.55rem;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
  -webkit-overflow-scrolling: touch;
}

.detail-image-grid::-webkit-scrollbar {
  height: 0.45rem;
}

.detail-image-grid::-webkit-scrollbar-track {
  background: transparent;
}

.detail-image-grid::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

.detail-image-card {
  flex: 0 0 clamp(168px, 23vw, 210px);
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  min-width: 0;
  display: flex;
  flex-direction: column;
  scroll-snap-align: start;
  transition: border-color 0.12s ease;
}

.detail-image-card:hover {
  border-color: var(--border-strong);
}

.detail-image-card img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  background: var(--bg);
}

.detail-image-footer {
  min-height: 2.45rem;
  padding: 0.5rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.detail-image-footer span,
.detail-image-footer a,
.detail-image-footer {
  min-width: 0;
}

.detail-image-footer span,
.detail-ref .detail-image-footer {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-image-footer a {
  flex: 0 0 auto;
  color: var(--fg);
  text-decoration: none;
}

.detail-image-footer a:hover {
  text-decoration: underline;
}

.detail-image-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
}

.detail-image-actions form,
.detail-image-footer form {
  margin: 0;
}

.detail-image-footer .icon-button {
  width: 1.55rem;
  height: 1.55rem;
}

.detail-image-footer .icon-button svg {
  width: 0.82rem;
  height: 0.82rem;
}

.detail-empty {
  flex: 1 0 100%;
  margin: 0;
  padding: 1.25rem;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
  font-size: 0.85rem;
}

/* Hover magnifier */
#magnifier {
  position: fixed;
  top: 50%;
  right: 1.5rem;
  transform: translateY(-50%);
  width: min(36vw, 480px);
  aspect-ratio: 3/4;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface) 0 0/auto no-repeat;
  box-shadow: var(--shadow-lg);
  z-index: 60;
  pointer-events: none;
  animation: fade 0.12s ease-out;
}

#magnifier[hidden] {
  display: none;
}

@media (max-width: 960px) {
  #magnifier {
    display: none !important;
  }
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .stats-panels {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  body {
    padding-top: 48px;
  }
  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }
  input:focus,
  select:focus,
  textarea:focus {
    outline: none;
    border-color: var(--border);
    box-shadow: none;
  }
  .product-search:focus-within {
    border-color: var(--border);
    box-shadow: none;
  }
  .select-button:focus-visible,
  .icon-button:focus-visible {
    outline: none;
    box-shadow: none;
  }
  .sidebar,
  .sidebar.collapsed {
    flex-direction: row;
    width: 100%;
    height: 48px;
    bottom: auto;
    padding: 0.35rem 0;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
  }
  .sidebar .brand,
  .sidebar.collapsed .brand,
  .sidebar-logout,
  .sidebar.collapsed .sidebar-logout {
    display: none;
  }
  .sidebar-nav,
  .sidebar.collapsed .sidebar-nav {
    flex-direction: row;
    gap: 0.15rem;
    flex: 1;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0.5rem;
    margin: 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar-nav::-webkit-scrollbar,
  .sidebar.collapsed .sidebar-nav::-webkit-scrollbar {
    display: none;
  }
  .sidebar-section,
  .sidebar.collapsed .sidebar-section {
    flex-direction: row;
    gap: 0.15rem;
    flex: 0 0 auto;
    padding: 0;
    border: none;
    background: transparent;
  }
  .sidebar-section-toggle,
  .sidebar.collapsed .sidebar-section-toggle {
    display: none;
  }
  .sidebar-section-items,
  .sidebar.collapsed .sidebar-section-items,
  .sidebar-section.collapsed .sidebar-section-items,
  .sidebar.collapsed .sidebar-section.collapsed .sidebar-section-items {
    display: flex;
    flex-direction: row;
    gap: 0.15rem;
  }
  .sidebar-nav a,
  .sidebar.collapsed .sidebar-nav a {
    flex: 0 0 auto;
    padding: 0.45rem 0.65rem;
    justify-content: flex-start;
  }
  .sidebar-nav a > span,
  .sidebar.collapsed .sidebar-nav a > span {
    display: inline;
  }
  .sidebar-toggle {
    display: none;
  }
  main {
    padding: 1rem 1rem;
  }
  .product-index-toolbar {
    flex-wrap: wrap;
    gap: 0.75rem;
  }
  .library-main {
    max-width: none;
  }
  .product-search {
    order: 3;
    flex-basis: 100%;
    max-width: none;
    margin: 0;
  }
  .product-state-tabs {
    width: calc(100vw - 2rem);
    margin-inline: 0;
    padding-bottom: 0.35rem;
  }
  .product-state-tabs a {
    min-height: 2rem;
    padding-inline: 0.65rem;
    font-size: 0.78rem;
  }
  .product-state-heading {
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 0.2rem;
  }
  .product-state-heading > div {
    min-width: max-content;
  }
  .product-state-heading .status-pill {
    flex: 0 0 auto;
  }
  .product-table-wrap {
    max-height: calc(100vh - 16.5rem);
  }
  .product-table {
    min-width: 0;
    table-layout: auto;
  }
  .product-table th,
  .product-table td {
    padding: 0.55rem 0.5rem;
  }
  .product-table th.mobile-hide-col,
  .product-table td.mobile-hide-col,
  .product-table .select-col {
    display: none;
  }
  .product-table th:nth-child(2),
  .product-table td:nth-child(2) {
    width: auto;
  }
  .product-table .actions-col {
    width: 5.75rem;
    padding-right: 0.4rem !important;
  }
  .product-thumb-stack {
    display: none;
  }
  .product-cell {
    gap: 0;
  }
  .product-subtitle {
    display: none;
  }
  .product-upload-status.is-visible {
    display: block;
  }
  .product-upload-meter {
    width: min(9rem, 100vw - 8.25rem);
  }
  .product-name-row {
    max-width: 50vw;
  }
  .product-name {
    display: block;
    max-width: 100%;
    font-size: 0.84rem;
  }
  .table-actions {
    min-width: 4.25rem;
  }
  .capture-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .capture-actions {
    position: sticky;
    bottom: 0;
    padding: 0.75rem 0 0;
    background: var(--bg);
  }
  .capture-actions .toolbar-button {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
  }
  .state-inline-form {
    flex: 1 1 100%;
  }
  .state-select {
    flex: 1 1 auto;
    width: auto;
  }
  .toast-region {
    right: 0.75rem;
    bottom: 0.75rem;
    left: 0.75rem;
  }
  .upload-toast {
    max-width: none;
  }
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .model-tool-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .model-measurements {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .model-measurements div:nth-child(2) {
    border-right: 0;
  }
  .model-measurements div:nth-child(-n+2) {
    border-bottom: 1px solid var(--border);
  }
  .model-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .model-form-grid {
    grid-template-columns: 1fr;
  }
  .model-form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }
  .model-form-actions .primary,
  .model-form-actions .toolbar-button {
    width: 100%;
  }
  .card {
    flex-basis: min(72vw, 220px);
  }
  .product-images {
    grid-template-columns: repeat(2, 1fr);
  }
  .detail-image-card {
    flex-basis: min(72vw, 210px);
  }
  .row-pair {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    gap: 1.25rem;
  }
}
.po-main {
  width: auto;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 1rem 1rem 1.5rem 216px;
  display: block;
  background: var(--bg);
}

.sidebar.collapsed ~ .po-main {
  padding-left: 76px;
}

.po-workspace {
  width: 100%;
  min-width: 0;
  max-width: 1640px;
  margin: 0 auto;
}

.po-workspace.wide {
  max-width: 1500px;
}

.po-header,
.po-header-actions,
.po-section-heading,
.po-export-heading,
.po-actions,
.po-form-row {
  display: flex;
  align-items: center;
}

.po-header {
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.po-header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.button-icon {
  flex: 0 0 auto;
  width: 0.95rem;
  height: 0.95rem;
}

.po-header h1 {
  margin: 0;
  color: var(--fg);
  font-size: 1.35rem;
  line-height: 1.1;
}

.po-header p,
.po-section-heading p,
.po-export-heading p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.po-layout {
  display: block;
}

.po-rail {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.po-command-bar,
.po-history,
.po-csv-full {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.po-upload-dialog {
  width: min(92vw, 32rem);
}

.po-history-dialog {
  width: min(94vw, 46rem);
}

.modal-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.po-upload-dialog .po-form {
  gap: 0;
}

.po-upload-dialog .po-form-row {
  grid-template-columns: 1fr;
}

.po-modal-history-list {
  max-height: min(64vh, 36rem);
}

.po-modal-history-list .po-history-item:first-child {
  border-top: 0;
}

.po-modal-history-list .po-history-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.po-modal-history-list .po-history-meta > span:not(.status-pill) {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.po-command-bar {
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem;
}

.po-form {
  display: grid;
  min-width: 0;
  gap: 0.4rem;
}

.po-form label {
  color: var(--fg);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.po-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  min-width: 0;
}

.po-form select,
.po-form input[type=file] {
  width: 100%;
  min-height: 2.1rem;
  min-width: 0;
  padding: 0 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
}

.po-form input[type=file] {
  padding: 0.38rem 0.55rem;
  font-size: 0.72rem;
}

.po-form input[type=file]::file-selector-button {
  min-height: 1.45rem;
  margin: -0.12rem 0.45rem -0.12rem -0.25rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
}

.po-form .toolbar-button {
  flex: 0 0 auto;
  min-height: 2.1rem;
  padding: 0 0.65rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

.po-review {
  display: grid;
  gap: 0.85rem;
  min-width: 0;
  overflow: visible;
}

.po-review > .po-section-heading,
.po-review > .po-summary,
.po-review > .po-tab-shell,
.po-review > .po-start-panel,
.po-review > .login-error {
  overflow: hidden;
  border: 1px solid var(--po-border);
  border-radius: var(--radius);
  background: var(--po-panel);
}

.po-section-heading,
.po-export-heading {
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
}

.po-section-heading.compact {
  padding-bottom: 0.45rem;
}

.po-section-heading h2,
.po-export-heading h3 {
  margin: 0;
  color: var(--fg);
  font-size: 0.88rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.po-export-heading h3 {
  font-size: 0.82rem;
}

.po-actions {
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.po-inline-form {
  display: inline-flex;
  margin: 0;
}

.po-document-actions {
  display: grid;
  justify-items: end;
  gap: 0.55rem;
}

.po-actions .toolbar-button {
  min-height: 1.85rem;
  padding: 0 0.65rem;
  font-size: 0.75rem;
}

.po-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--po-border);
  border-bottom: 1px solid var(--po-border);
}

.po-summary div {
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border-right: 1px solid var(--po-border);
}

.po-summary div:last-child {
  border-right: 0;
}

.po-summary span {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--po-label);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.po-summary strong {
  display: block;
  min-width: 0;
  color: var(--fg);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.po-tab-shell {
  display: grid;
  min-width: 0;
}

.po-tab-list {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  padding: 0.5rem;
  border-bottom: 1px solid var(--po-border);
  background: var(--po-panel-raised);
  overflow-x: auto;
}

.po-tab-button {
  flex: 0 0 auto;
  min-height: 2rem;
  padding: 0 0.85rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
}

.po-tab-button:hover,
.po-tab-button:focus-visible {
  border-color: var(--po-border);
  color: var(--fg);
}

.po-tab-button.active {
  border-color: var(--po-border-strong);
  background: var(--po-panel);
  color: var(--fg);
}

.po-tab-panel {
  min-width: 0;
}

.po-tab-panel[hidden] {
  display: none;
}

.po-export-list {
  display: grid;
}

.po-shiphero-export-list {
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--po-panel-raised);
}

.po-product-table {
  background: var(--bg);
}

.po-product-list {
  display: grid;
  gap: 0.45rem;
  padding: 0.5rem;
  background: var(--po-panel-raised);
}

.po-product-card {
  overflow: hidden;
  border: 1px solid var(--po-border);
  border-radius: var(--radius);
  background: var(--po-panel);
}

.po-product-card[open] {
  border-color: var(--po-border-strong);
}

.po-product-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 1rem;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.58rem;
  cursor: pointer;
  list-style: none;
}

.po-product-summary::-webkit-details-marker {
  display: none;
}

.po-product-summary-main {
  display: grid;
  min-width: 0;
  gap: 0.08rem;
}

.po-product-summary-main strong {
  overflow: hidden;
  color: var(--fg);
  font-size: 0.8rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.po-product-summary-main span,
.po-product-summary-meta {
  color: var(--po-label);
  font-size: 0.64rem;
}

.po-product-summary-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
  min-width: 0;
}

.po-product-summary-meta span {
  max-width: 12rem;
  overflow: hidden;
  padding: 0.1rem 0.3rem;
  border: 1px solid var(--po-border);
  border-radius: 999px;
  background: var(--po-panel-raised);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.po-product-summary > svg {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--po-label);
  transition: transform 0.15s ease;
}

.po-product-card[open] .po-product-summary > svg {
  transform: rotate(180deg);
}

.po-product-body {
  border-top: 1px solid var(--po-border);
}

.po-shopify-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.38rem 0.5rem;
  border-bottom: 1px solid var(--po-border);
  background: var(--po-panel-raised);
}

.po-shopify-row > div:first-child {
  display: grid;
  min-width: 0;
  gap: 0.12rem;
}

.po-shopify-row strong {
  color: var(--fg);
  font-size: 0.74rem;
}

.po-shopify-row span {
  color: var(--po-label);
  font-size: 0.68rem;
  overflow-wrap: anywhere;
}

.po-shiphero-api-review {
  display: grid;
  gap: 0.62rem;
}

.po-shiphero-row {
  border: 1px solid var(--po-border);
  border-radius: var(--radius);
}

.po-api-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.28rem;
  padding: 0.14rem 0.42rem;
  border: 1px solid var(--po-border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--po-label);
  font-size: 0.62rem;
  font-weight: 800;
  white-space: nowrap;
}

.po-api-state.ready {
  border-color: rgba(49, 95, 58, 0.28);
  background: rgba(49, 95, 58, 0.08);
  color: var(--po-accent);
}

.po-api-state.blocked {
  border-color: rgba(151, 61, 43, 0.26);
  background: rgba(151, 61, 43, 0.08);
  color: #8e3b2d;
}

.po-shiphero-field-sections {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(14rem, 0.7fr);
  gap: 0.55rem;
}

.po-shiphero-field-section {
  display: grid;
  align-content: start;
  gap: 0.42rem;
  min-width: 0;
  padding: 0.55rem;
  border: 1px solid var(--po-border);
  border-radius: var(--radius);
  background: var(--po-panel);
}

.po-shiphero-field-section:first-child {
  grid-row: span 2;
}

.po-shiphero-field-section h4 {
  margin: 0;
  color: var(--fg);
  font-size: 0.72rem;
}

.po-shiphero-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
  gap: 0.35rem;
}

.po-shiphero-field-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
}

.po-shiphero-field {
  display: grid;
  min-width: 0;
  gap: 0.1rem;
  padding: 0.38rem 0.42rem;
  border: 1px solid var(--po-border);
  border-radius: 5px;
  background: var(--po-panel-raised);
}

.po-shiphero-field span,
.po-shiphero-field small {
  color: var(--po-label);
  font-size: 0.58rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.po-shiphero-field strong {
  color: var(--fg);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.po-shiphero-product-list {
  padding: 0;
  background: transparent;
}

.po-shiphero-product-card .po-product-summary-meta {
  flex-wrap: wrap;
}

.po-shiphero-line-list {
  display: grid;
  padding: 0.45rem;
  overflow-x: auto;
  scrollbar-color: rgba(68, 83, 72, 0.28) transparent;
  scrollbar-width: thin;
}

.po-shiphero-line-header,
.po-shiphero-line-item {
  display: grid;
  grid-template-columns: minmax(8.25rem, 0.9fr) minmax(9rem, 1fr) minmax(8.5rem, 0.9fr) minmax(3.8rem, 0.34fr) minmax(4.15rem, 0.38fr) minmax(4.8rem, 0.42fr) minmax(6.5rem, 0.5fr) minmax(5.6rem, 0.45fr) minmax(5.6rem, 0.45fr) minmax(4.8rem, 0.38fr);
  min-width: 1060px;
  align-items: stretch;
}

.po-shiphero-line-header {
  padding: 0 0.32rem 0.22rem;
  color: var(--po-label);
  font-size: 0.54rem;
  font-weight: 800;
}

.po-shiphero-line-header > div {
  padding: 0 0.12rem;
}

.po-shiphero-line-item {
  padding: 0.3rem 0.32rem;
  border: 1px solid var(--po-border);
  border-bottom: 0;
  background: var(--bg);
  color: var(--fg);
  font-size: 0.68rem;
}

.po-shiphero-line-item:first-of-type {
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.po-shiphero-line-item:last-child {
  border-bottom: 1px solid var(--po-border);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

.po-shiphero-line-item > div {
  min-width: 0;
  padding: 0 0.12rem;
  overflow-wrap: anywhere;
}

.po-shiphero-sku {
  display: grid;
  gap: 0.08rem;
}

.po-shiphero-sku strong {
  color: var(--fg);
  font-size: 0.68rem;
}

.po-shiphero-sku span {
  color: var(--po-label);
  font-size: 0.58rem;
}

.po-shiphero-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.po-product-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1.7rem;
  align-items: start;
  gap: 0.34rem;
  padding: 0.38rem 0.5rem;
}

.po-product-fields {
  display: grid;
  grid-template-columns: minmax(11rem, 1fr) repeat(4, minmax(5.25rem, 0.38fr));
  min-width: 0;
  gap: 0.24rem;
}

.po-product-form input,
.po-product-form textarea,
.po-variant-item input {
  width: 100%;
  min-width: 0;
  height: 1.55rem;
  min-height: 1.55rem;
  padding: 0.18rem 0.3rem;
  border: 1px solid var(--po-border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.7rem;
}

.po-product-form input:focus,
.po-product-form textarea:focus,
.po-variant-item input:focus {
  border-color: var(--po-accent);
  box-shadow: 0 0 0 2px rgba(49, 95, 58, 0.14);
}

.po-product-form textarea {
  height: 2.45rem;
  min-height: 2.45rem;
  resize: vertical;
}

.po-product-field {
  display: grid;
  min-width: 0;
  gap: 0.12rem;
}

.po-product-fields > span {
  display: none;
}

.po-product-field span {
  color: var(--po-label);
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.po-product-description-field {
  grid-column: 1/-1;
}

.po-product-name-input {
  color: var(--fg);
  font-size: 0.76rem;
  font-weight: 700;
}

.icon-save-button {
  width: 1.7rem;
  height: 1.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--fg);
  border-radius: var(--radius);
  background: var(--fg);
  color: var(--bg);
  cursor: pointer;
}

.icon-save-button svg {
  width: 0.82rem;
  height: 0.82rem;
}

.icon-save-button:hover {
  opacity: 0.88;
}

.icon-save-button:disabled,
.icon-save-button.loading {
  opacity: 0.55;
  cursor: not-allowed;
}

.po-variant-panel {
  border-top: 1px solid var(--po-border);
}

.po-variant-panel summary {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.42rem 0.55rem;
  background: var(--po-panel-raised);
  color: var(--fg);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 700;
  list-style: none;
}

.po-variant-panel summary::-webkit-details-marker {
  display: none;
}

.po-variant-panel summary strong {
  min-width: 1.25rem;
  min-height: 1.05rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--po-border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--po-label);
  font-size: 0.62rem;
}

.po-variant-panel summary svg {
  width: 0.88rem;
  height: 0.88rem;
  margin-left: auto;
  color: var(--po-label);
  transition: transform 0.15s ease;
}

.po-variant-panel[open] summary svg {
  transform: rotate(180deg);
}

.po-variant-list {
  display: grid;
  gap: 0;
  padding: 0.4rem 0.48rem 0.5rem;
  overflow-x: auto;
  scrollbar-color: rgba(68, 83, 72, 0.28) transparent;
  scrollbar-width: thin;
}

.po-variant-header,
.po-variant-item {
  display: grid;
  grid-template-columns: minmax(6.75rem, 1.05fr) minmax(5rem, 0.72fr) minmax(3.65rem, 0.44fr) minmax(3.75rem, 0.45fr) minmax(3.05rem, 0.34fr) minmax(3.9rem, 0.46fr) minmax(3.9rem, 0.46fr) 1.58rem;
  min-width: 600px;
  align-items: stretch;
}

.po-variant-header {
  padding: 0 0.32rem 0.2rem;
  color: var(--po-label);
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.po-variant-header > div {
  padding: 0 0.12rem;
}

.po-variant-item {
  gap: 0;
  padding: 0.22rem 0.32rem;
  border: 1px solid var(--po-border);
  border-bottom: 0;
  background: var(--bg);
}

.po-variant-item:first-of-type {
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.po-variant-item:last-child {
  border-bottom: 1px solid var(--po-border);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

.po-variant-item:hover {
  background: var(--po-accent-soft);
}

.po-variant-name {
  padding: 0 0.12rem;
  display: flex;
  align-items: center;
  color: var(--fg);
  font-size: 0.7rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.po-variant-item label {
  display: grid;
  min-width: 0;
  padding: 0 0.12rem;
}

.po-variant-item label span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.po-variant-item input {
  height: 1.55rem;
  min-height: 1.55rem;
  padding: 0.18rem 0.28rem;
  background: var(--po-panel-raised);
}

.po-variant-item .icon-save-button {
  width: 1.55rem;
  height: 1.55rem;
  align-self: stretch;
}

.po-variant-item .icon-save-button {
  justify-self: end;
}

@media (max-width: 1120px) {
  .po-variant-header,
  .po-shiphero-line-header {
    display: none;
  }
  .po-variant-item,
  .po-shiphero-line-item {
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr)) 2.15rem;
    gap: 0.45rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--po-border);
    border-radius: var(--radius);
  }
  .po-shiphero-line-item {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .po-shiphero-field-sections {
    grid-template-columns: 1fr;
  }
  .po-shiphero-field-section:first-child {
    grid-row: auto;
  }
  .po-variant-name {
    grid-column: 1/-1;
    padding: 0;
  }
  .po-variant-item label {
    padding: 0;
  }
  .po-variant-item label span {
    position: static;
    width: auto;
    height: auto;
    margin: 0 0 0.2rem;
    overflow: visible;
    clip: auto;
    color: var(--po-label);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: normal;
  }
  .po-variant-item input {
    height: auto;
  }
}
@media (max-width: 720px) {
  .po-product-summary {
    grid-template-columns: minmax(0, 1fr) 1rem;
  }
  .po-shopify-row,
  .po-shiphero-row {
    align-items: stretch;
    flex-direction: column;
  }
  .po-shopify-row .po-actions,
  .po-shiphero-row .po-actions {
    justify-content: flex-start;
  }
  .po-product-summary-meta {
    grid-column: 1/-1;
    grid-row: 2;
    justify-content: flex-start;
  }
  .po-product-form,
  .po-variant-item {
    grid-template-columns: minmax(0, 1fr) 2.15rem;
  }
  .po-product-fields {
    grid-template-columns: 1fr;
  }
  .po-variant-name,
  .po-variant-item label,
  .po-shiphero-line-item > div {
    grid-column: 1/-1;
  }
  .po-variant-item .icon-save-button {
    grid-column: 2;
  }
}
@media (min-width: 721px) and (max-width: 1280px) {
  .po-product-fields {
    grid-template-columns: minmax(0, 1fr) minmax(7rem, 0.7fr) minmax(7rem, 0.7fr);
  }
  .po-product-description-field {
    grid-column: 1/-1;
  }
}
.po-product-empty {
  padding: 0.85rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.po-export-block {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.po-export-block:last-child {
  border-bottom: 1px solid var(--border);
}

/* Color validator */
.color-main {
  max-width: 1180px;
}

.color-validator {
  display: grid;
  gap: 0.85rem;
}

.color-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.color-toolbar h1 {
  margin: 0;
  color: var(--fg);
  font-size: 1.3rem;
  line-height: 1.15;
}

.color-toolbar p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.color-scan-form {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.color-scan-form select,
.color-product-actions select,
.color-actions select {
  height: 2.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.82rem;
}

.color-scan-form select {
  width: min(15rem, 24vw);
  padding: 0.35rem 0.45rem;
}

.color-manual-lookup {
  display: grid;
  gap: 0.75rem;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.color-manual-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.color-manual-heading h2 {
  margin: 0;
  color: var(--fg);
  font-size: 0.9rem;
}

.color-manual-heading p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.color-manual-search,
.color-manual-product-form,
.color-manual-variant-form {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.color-manual-search input,
.color-manual-product-form select,
.color-manual-variant-form select {
  min-height: 2rem;
  min-width: 0;
  padding: 0 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.78rem;
}

.color-manual-search input {
  width: min(24rem, 42vw);
}

.color-manual-results {
  display: grid;
  gap: 0.65rem;
}

.color-manual-card {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.color-manual-card .color-image {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.color-manual-body {
  display: grid;
  min-width: 0;
  gap: 0.65rem;
}

.color-manual-product-form select,
.color-manual-variant-form select {
  min-width: 9rem;
}

.color-manual-variant-form {
  justify-content: flex-end;
}

.color-manual-variant-row {
  grid-template-columns: minmax(9rem, 1.1fr) minmax(6rem, 0.7fr) minmax(6rem, 0.7fr) minmax(12rem, auto);
}

.color-tabs {
  margin-top: 0.1rem;
}

.color-issue-list {
  display: grid;
  gap: 0.6rem;
}

.color-issue-card {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  align-items: start;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.color-issue-card.is-removing {
  opacity: 0;
  transform: translateY(-0.25rem);
}

.color-image {
  width: 100%;
  aspect-ratio: 1/1.2;
  min-height: 0;
  align-self: start;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.74rem;
  text-decoration: none;
}

.color-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.color-issue-body {
  display: grid;
  gap: 0.55rem;
  min-width: 0;
  padding: 0.65rem 0.75rem;
}

.color-issue-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
}

.color-issue-heading h2 {
  margin: 0;
  color: var(--fg);
  font-size: 0.98rem;
  line-height: 1.2;
}

.color-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.color-meta span {
  padding: 0.08rem 0.34rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.color-comparison {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.color-comparison div {
  min-width: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.color-comparison span {
  display: block;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.color-comparison strong {
  display: block;
  margin-top: 0.12rem;
  overflow: hidden;
  color: var(--fg);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.color-reason {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.color-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.color-actions form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.color-actions select {
  min-width: 9rem;
  padding: 0.25rem 0.45rem;
}

.color-product-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.color-product-actions form {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
}

.color-product-actions select {
  min-width: 9rem;
  padding: 0.25rem 0.45rem;
}

.color-variant-list {
  display: grid;
  gap: 0.4rem;
}

.color-variant-row {
  display: grid;
  grid-template-columns: minmax(9rem, 1.1fr) minmax(5.5rem, 0.65fr) minmax(5.5rem, 0.65fr) minmax(5.5rem, 0.65fr) auto;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.48rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.color-variant-row.is-removing {
  opacity: 0;
  transform: translateX(0.25rem);
}

.color-variant-main,
.color-variant-value {
  min-width: 0;
}

.color-variant-main span,
.color-variant-value span {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.color-variant-main strong,
.color-variant-value strong {
  display: block;
  margin-top: 0.1rem;
  overflow: hidden;
  color: var(--fg);
  font-size: 0.82rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.color-variant-main small {
  display: block;
  margin-top: 0.08rem;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.color-variant-actions {
  justify-content: flex-end;
}

.color-variant-actions form {
  flex-wrap: nowrap;
}

.color-variant-actions .toolbar-button {
  min-height: 2.1rem;
  padding-inline: 0.6rem;
}

.color-variant-row > .color-reason,
.color-variant-row > .login-error {
  grid-column: 1/-1;
}

.color-clear-form {
  display: flex;
  justify-content: flex-end;
  margin: -0.2rem 0 0;
}

.tapcart-cache-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.tapcart-cache-card .color-scan-form {
  justify-content: flex-start;
}

.tapcart-cache-card input[type=text] {
  width: min(24rem, 48vw);
  height: 2.1rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.82rem;
}

/* Amazon delivery */
.amazon-main {
  width: auto;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 1.25rem 1.25rem 2rem 216px;
  background: var(--bg);
}

.sidebar.collapsed ~ .amazon-main {
  padding-left: 76px;
}

.amazon-delivery {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  display: grid;
  gap: 0.85rem;
}

.amazon-toolbar,
.amazon-filter-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.amazon-toolbar h1 {
  margin: 0;
  color: var(--fg);
  font-size: 1.3rem;
  line-height: 1.15;
}

.amazon-toolbar p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.amazon-toolbar-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.amazon-toolbar-actions form,
.amazon-row-actions form {
  margin: 0;
}

.amazon-notice {
  padding: 0.5rem 0.7rem;
  color: #655225;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  font-size: 0.8rem;
}

.amazon-notice code {
  font-size: 0.78rem;
}

.amazon-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.6rem;
}

.amazon-stat {
  min-width: 0;
  min-height: 4.8rem;
  display: grid;
  align-content: space-between;
  gap: 0.45rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.amazon-stat span,
.amazon-panel h2 {
  margin: 0;
  color: var(--faint);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.amazon-stat strong {
  overflow: hidden;
  color: var(--fg);
  font-size: 1.18rem;
  font-weight: 650;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amazon-action-grid {
  display: grid;
  grid-template-columns: minmax(18rem, 0.8fr) minmax(0, 1.7fr);
  gap: 0.75rem;
}

.amazon-panel {
  min-width: 0;
  display: grid;
  gap: 0.6rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.amazon-form-row,
.amazon-filter-form {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.amazon-form-row input[type=file] {
  min-width: 0;
  width: 100%;
  font: inherit;
  font-size: 0.78rem;
}

.amazon-manual-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 0.45rem;
}

.amazon-manual-form input,
.amazon-manual-form select,
.amazon-filter-form input,
.amazon-filter-form select {
  min-width: 0;
  width: 100%;
  height: 2.1rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.8rem;
}

.amazon-manual-form label {
  margin: 0;
}

.amazon-manual-form label span {
  display: block;
  margin-bottom: 0.22rem;
  color: var(--faint);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.amazon-tabs {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.amazon-tabs a {
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0 0.65rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.amazon-tabs a:hover {
  background: var(--surface);
  color: var(--fg);
}

.amazon-tabs a.active {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

.amazon-tabs span {
  min-width: 1.2rem;
  min-height: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.32rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.68rem;
}

.amazon-tabs a.active span {
  background: rgba(255, 255, 255, 0.18);
  color: var(--bg);
}

.amazon-filter-form {
  justify-content: flex-end;
  flex: 1 1 28rem;
}

.amazon-filter-form input {
  max-width: 18rem;
}

.amazon-filter-form select {
  max-width: 15rem;
}

.amazon-table-wrap {
  min-width: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.amazon-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

.amazon-table th,
.amazon-table td {
  padding: 0.62rem 0.68rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.amazon-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  color: var(--faint);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.amazon-table tbody tr:hover {
  background: var(--surface);
}

.amazon-table tbody tr:last-child td {
  border-bottom: 0;
}

.amazon-table td {
  min-width: 0;
  color: var(--fg);
  font-size: 0.78rem;
}

.amazon-table td:nth-child(1) {
  width: 17%;
}

.amazon-table td:nth-child(2) {
  width: 13%;
}

.amazon-table td:nth-child(3),
.amazon-table td:nth-child(4) {
  width: 12%;
}

.amazon-table td:nth-child(5) {
  width: 16%;
}

.amazon-table td:nth-child(6) {
  width: 20%;
}

.amazon-table td:nth-child(7) {
  width: 8%;
}

.amazon-table strong,
.amazon-table span,
.amazon-table small,
.amazon-order-link {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.amazon-table strong,
.amazon-order-link {
  color: var(--fg);
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.amazon-order-link:hover {
  text-decoration: underline;
}

.amazon-table span,
.amazon-table small {
  margin-top: 0.14rem;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.25;
}

.amazon-table .status-pill {
  display: inline-flex;
  margin: 0 0 0.22rem;
}

.amazon-late,
.amazon-error-text {
  color: var(--danger) !important;
}

.amazon-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.2rem;
}

.amazon-row-actions .icon-button.danger:hover,
.amazon-row-actions .icon-button.danger:focus-visible {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger);
}

.amazon-process-row td {
  padding: 0;
  background: var(--surface);
}

.amazon-process-details {
  padding: 0.58rem 0.68rem 0.65rem;
  border-top: 1px solid var(--border);
}

.amazon-process-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--fg);
  cursor: pointer;
  font-size: 0.76rem;
}

.amazon-process-details summary span {
  color: var(--fg);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.amazon-process-details summary strong {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.amazon-process-grid {
  display: grid;
  gap: 0.65rem;
  padding-top: 0.7rem;
}

.amazon-process-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.45rem;
}

.amazon-process-summary div,
.amazon-proof,
.amazon-event-timeline,
.amazon-raw-payload {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.amazon-process-summary div {
  padding: 0.5rem 0.6rem;
}

.amazon-process-summary span,
.amazon-proof dt {
  display: block;
  color: var(--faint);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.amazon-process-summary strong {
  display: block;
  margin-top: 0.12rem;
  overflow: hidden;
  color: var(--fg);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amazon-proof,
.amazon-event-timeline {
  padding: 0.65rem;
}

.amazon-proof h3,
.amazon-event-timeline h3 {
  margin: 0 0 0.55rem;
  color: var(--fg);
  font-size: 0.78rem;
}

.amazon-proof dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0;
}

.amazon-proof dd {
  margin: 0.1rem 0 0;
  overflow-wrap: anywhere;
  color: var(--fg);
  font-size: 0.78rem;
}

.amazon-proof a {
  color: var(--fg);
  font-weight: 650;
}

.amazon-event-timeline ol {
  display: grid;
  gap: 0.38rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.amazon-event-timeline li {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.1rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.amazon-event-timeline li > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
}

.amazon-event-timeline strong {
  min-width: 0;
  overflow: hidden;
  color: var(--fg);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amazon-event-timeline span,
.amazon-event-timeline small {
  color: var(--muted);
  font-size: 0.7rem;
}

.amazon-event-timeline p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.amazon-raw-payload summary {
  padding: 0.55rem 0.65rem;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
}

.amazon-raw-payload pre {
  max-height: 18rem;
  margin: 0;
  padding: 0.65rem;
  overflow: auto;
  border-top: 1px solid var(--border);
  color: var(--fg);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.68rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.amazon-empty {
  padding: 1.4rem;
  color: var(--muted);
  text-align: center;
}

.amazon-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.amazon-pagination a {
  color: var(--fg);
  font-weight: 650;
  text-decoration: none;
}

@media (max-width: 900px) {
  .color-main {
    padding-left: 1rem;
  }
  .color-toolbar,
  .color-scan-form,
  .color-manual-heading,
  .color-manual-search,
  .color-manual-product-form,
  .color-manual-variant-form {
    align-items: stretch;
    flex-direction: column;
  }
  .color-scan-form select,
  .color-manual-search input,
  .color-manual-product-form select,
  .color-manual-variant-form select {
    width: 100%;
  }
  .tapcart-cache-card input[type=text] {
    width: 100%;
  }
  .color-issue-card,
  .color-manual-card,
  .color-comparison,
  .color-variant-row {
    grid-template-columns: 1fr;
  }
  .color-issue-heading,
  .color-product-actions,
  .color-product-actions form,
  .color-variant-actions,
  .color-variant-actions form {
    align-items: stretch;
    flex-direction: column;
  }
  .color-product-actions {
    width: 100%;
  }
  .color-variant-actions {
    justify-content: stretch;
  }
  .color-image {
    aspect-ratio: 16/10;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .amazon-main,
  .sidebar.collapsed ~ .amazon-main {
    padding: 1.25rem 1rem 2rem 92px;
  }
  .amazon-toolbar,
  .amazon-filter-bar,
  .amazon-form-row,
  .amazon-filter-form {
    align-items: stretch;
    flex-direction: column;
  }
  .amazon-toolbar-actions,
  .amazon-filter-form,
  .amazon-filter-form input,
  .amazon-filter-form select {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
  }
  .amazon-stat-grid,
  .amazon-action-grid,
  .amazon-manual-form,
  .amazon-process-summary,
  .amazon-proof dl {
    grid-template-columns: 1fr;
  }
  .amazon-process-details summary,
  .amazon-event-timeline li > div {
    align-items: flex-start;
    flex-direction: column;
  }
}
.po-csv-preview {
  display: block;
  width: 100%;
  max-width: 100%;
  height: min(15rem, 42vh);
  max-height: 15rem;
  margin: 0;
  overflow-x: scroll;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-right: 0;
  border-left: 0;
  border-radius: 0;
  background: var(--bg);
  overscroll-behavior-x: contain;
  overscroll-behavior-y: contain;
  scrollbar-color: rgba(68, 83, 72, 0.28) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.po-csv-preview::-webkit-scrollbar,
.po-history-list::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.po-csv-preview::-webkit-scrollbar-track,
.po-history-list::-webkit-scrollbar-track {
  background: transparent;
}

.po-csv-preview::-webkit-scrollbar-thumb,
.po-history-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(68, 83, 72, 0.22);
  background-clip: padding-box;
}

.po-csv-preview::-webkit-scrollbar-thumb:hover,
.po-history-list::-webkit-scrollbar-thumb:hover {
  background: rgba(68, 83, 72, 0.34);
  background-clip: padding-box;
}

.po-csv-preview::-webkit-scrollbar-corner {
  background: transparent;
}

.po-csv-preview:focus {
  outline: 2px solid #315f3a;
  outline-offset: 2px;
}

.po-csv-preview.full {
  width: 100%;
  height: calc(100vh - 11rem);
  max-height: calc(100vh - 11rem);
  margin: 0;
  border: 0;
  border-radius: 0;
}

.po-csv-scroll-inner {
  display: block;
  width: fit-content;
  min-width: 100%;
}

.po-csv-grid {
  --csv-col-width: 7.25rem;
  width: fit-content;
  min-width: max(100%, var(--po-csv-cols) * var(--csv-col-width));
  font-size: 0.68rem;
}

.po-csv-row {
  display: grid;
  grid-template-columns: repeat(var(--po-csv-cols), var(--csv-col-width));
  width: calc(var(--po-csv-cols) * var(--csv-col-width));
  min-width: 100%;
}

.po-csv-header-row {
  position: sticky;
  top: 0;
  z-index: 2;
}

.po-csv-cell {
  box-sizing: border-box;
  min-width: var(--csv-col-width);
  width: var(--csv-col-width);
  max-width: var(--csv-col-width);
  padding: 0.32rem 0.42rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.po-csv-header-cell {
  background: var(--surface);
  color: var(--fg);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.po-csv-cell {
  color: var(--fg);
}

.po-cell-text {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: normal;
}

.po-csv-header-cell .po-cell-text {
  line-height: 1.25;
}

.po-csv-cell .po-cell-text,
.po-csv-preview.full .po-csv-cell .po-cell-text {
  max-height: none;
  overflow: visible;
}

.po-csv-empty-row {
  min-width: 100%;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.po-csv-full,
.po-history,
.po-start-panel {
  overflow: hidden;
}

.po-start-panel {
  display: grid;
  min-width: 0;
}

.po-start-panel .po-empty-state {
  border-bottom: 1px solid var(--border);
}

.po-history-list.po-start-history-list {
  max-height: min(58vh, 34rem);
}

.po-start-history-list .po-history-item:first-child {
  border-top: 0;
}

.po-history-list {
  max-height: calc(100vh - 15rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(68, 83, 72, 0.28) transparent;
  scrollbar-width: thin;
}

.po-history-item {
  display: grid;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.po-history-item.selected {
  background: #f4fbf6;
}

.po-history-main {
  display: grid;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.po-history-main strong {
  overflow: hidden;
  color: var(--fg);
  font-size: 0.78rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.po-history-main span {
  color: var(--muted);
  font-size: 0.68rem;
}

.po-history-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.po-history-meta .status-pill {
  min-height: 1.45rem;
  padding: 0 0.45rem;
  font-size: 0.68rem;
}

.po-empty-state {
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.po-empty-state h2 {
  margin: 0 0 0.35rem;
  color: var(--fg);
  font-size: 1rem;
}

.po-empty-state p {
  margin: 0;
  font-size: 0.82rem;
}

.po-library {
  min-height: calc(100vh - 7rem);
}

.po-library-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.po-library-heading h2 {
  margin: 0;
  color: var(--fg);
  font-size: 0.95rem;
  line-height: 1.2;
}

.po-library-heading p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.po-library-list {
  display: grid;
  max-height: calc(100vh - 10.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(68, 83, 72, 0.28) transparent;
  scrollbar-width: thin;
}

.po-library-list::-webkit-scrollbar {
  width: 8px;
}

.po-library-list::-webkit-scrollbar-track {
  background: transparent;
}

.po-library-list::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(68, 83, 72, 0.22);
  background-clip: padding-box;
}

.po-library-list::-webkit-scrollbar-thumb:hover {
  background: rgba(68, 83, 72, 0.34);
  background-clip: padding-box;
}

.po-library-item {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(11rem, 0.75fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.po-library-main {
  display: grid;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.po-library-main strong {
  overflow: hidden;
  color: var(--fg);
  font-size: 0.84rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.po-library-main span,
.po-library-details span:last-child {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.po-library-details {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.55rem;
}

.po-library-details .status-pill {
  flex: 0 0 auto;
  min-height: 1.45rem;
  padding: 0 0.45rem;
  font-size: 0.68rem;
}

.po-selected-row td {
  background: #f4fbf6;
}

.table-action {
  display: inline-block;
  color: #315f3a;
  font-weight: 700;
  text-decoration: none;
}

.table-action + .table-action {
  margin-left: 0.65rem;
}

.table-action:hover {
  text-decoration: underline;
}

.status-pill.status-processing {
  background: #f3ead2;
  border-color: #e4c46f;
  color: #665222;
}

.status-pill.status-processing::before {
  background: #b48a21;
}

.status-pill.status-success {
  background: #ddf1df;
  border-color: #aadbb1;
  color: #24632d;
}

.status-pill.status-success::before {
  background: #1d8f34;
}

.status-pill.status-failed {
  background: #f7dddd;
  border-color: #edb5b5;
  color: #7d2424;
}

.status-pill.status-failed::before {
  background: #c53030;
}

@media (max-width: 1120px) {
  .po-layout {
    grid-template-columns: 1fr;
  }
  .po-rail {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.85fr);
    align-items: start;
  }
  .po-history-list {
    max-height: 14rem;
  }
}
@media (max-width: 980px) {
  .home-main,
  .sidebar.collapsed ~ .home-main {
    padding: 1.25rem 1rem 2rem 92px;
  }
  .po-main,
  .sidebar.collapsed ~ .po-main {
    padding: 1.25rem 1rem 2rem 92px;
  }
  .po-header,
  .po-section-heading,
  .po-export-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .po-rail {
    grid-template-columns: 1fr;
  }
  .po-actions {
    justify-content: flex-start;
  }
  .po-library-heading,
  .po-library-item {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }
  .po-document-actions {
    justify-items: start;
  }
}
@media (max-width: 680px) {
  .home-main,
  .sidebar.collapsed ~ .home-main {
    padding-left: 1rem;
  }
  .home-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .home-app-grid {
    grid-template-columns: 1fr;
  }
  .po-main,
  .sidebar.collapsed ~ .po-main {
    padding-left: 1rem;
  }
  .po-form-row {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }
  .po-form-row .toolbar-button {
    width: 100%;
  }
  .po-summary {
    grid-template-columns: 1fr;
  }
  .po-summary div,
  .po-summary div:last-child {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .po-summary div:last-child {
    border-bottom: 0;
  }
}
