body {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 32px;
  background: #f6f6f4;
  color: #111;
}

/* --- Online shop curation workspace --- */
.shop-mode-badge {
  align-self: center;
  background: #eef4ff;
  border: 1px solid #c7d7f3;
  border-radius: 999px;
  color: #244f93;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 11px;
  white-space: nowrap;
}

.shop-workspace {
  display: grid;
  gap: 20px;
  padding: 20px;
}

/* Candidate results are a floating layer and must be allowed to cross the
   inventory picker boundary without clipping against the surrounding card. */
#shop-section {
  overflow: visible;
}

.shop-safety-banner {
  align-items: center;
  background: linear-gradient(135deg, #f6f9ff, #eef4ff);
  border: 1px solid #cbdaf3;
  border-radius: 14px;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 16px 18px;
}

.shop-safety-banner div {
  display: grid;
  gap: 4px;
}

.shop-safety-banner strong { color: #183f78; }
.shop-safety-banner span { color: #53637c; font-size: 13px; line-height: 1.45; }

.shop-summary-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.shop-summary-grid > div {
  background: #f7f8fb;
  border: 1px solid #e2e6ed;
  border-radius: 12px;
  display: grid;
  gap: 4px;
  padding: 14px 16px;
}

.shop-summary-grid span { color: #697386; font-size: 12px; font-weight: 700; }
.shop-summary-grid strong { color: #27364f; font-size: 25px; }
.shop-summary-grid .is-published { background: #f0f8f3; border-color: #cce4d3; }
.shop-summary-grid .is-published strong { color: #28623b; }

.shop-inventory-picker,
.shop-curated-section {
  border: 1px solid #e1e5ec;
  border-radius: 14px;
  padding: 18px;
}

.shop-section-heading {
  align-items: end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.shop-section-heading h3 { margin: 0 0 4px; }
.shop-section-heading p { color: #697386; font-size: 13px; margin: 0; }
.shop-search-combobox {
  flex: 1 1 760px;
  width: min(860px, 64vw);
  min-width: 520px;
  max-width: 860px;
}
.shop-candidate-results { max-height: min(560px, 70vh); overflow: auto; }

.shop-candidate-result {
  align-items: start;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #edf0f4;
  color: #172033;
  cursor: pointer;
  display: grid;
  gap: 9px 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px;
  text-align: left;
  width: 100%;
}

.shop-candidate-result:hover,
.shop-candidate-result:focus-visible { background: #f4f7fc; outline: none; }
.shop-candidate-heading { display: grid; gap: 3px; min-width: 0; }
.shop-candidate-heading strong { font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.shop-candidate-heading span { color: #697386; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.shop-candidate-result em {
  align-self: start;
  background: #edf3fd;
  border-radius: 999px;
  color: #244f93;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  grid-column: 2;
  grid-row: 1;
  padding: 5px 8px;
}

.shop-candidate-description {
  grid-column: 1 / -1;
  margin: 0;
  color: #344054;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-line;
}

.shop-candidate-details,
.shop-source-details {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
}

.shop-candidate-details { grid-column: 1 / -1; }
.shop-candidate-details > div,
.shop-source-details > div {
  min-width: 0;
  border-radius: 8px;
  background: #f6f8fb;
  padding: 7px 9px;
}
.shop-candidate-details dt,
.shop-source-details dt {
  margin: 0 0 3px;
  color: #7a8496;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: .055em;
  text-transform: uppercase;
}
.shop-candidate-details dd,
.shop-source-details dd {
  margin: 0;
  color: #27364f;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.shop-product-list { display: grid; gap: 10px; margin-top: 16px; }
.shop-product-empty { background: #f8f9fb; border-radius: 12px; color: #697386; padding: 24px; text-align: center; }

.shop-product-row {
  align-items: center;
  border: 1px solid #e1e5ec;
  border-radius: 12px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 2fr) minmax(110px, .7fr) minmax(130px, .8fr) auto;
  padding: 13px 14px;
}

.shop-product-identity { display: grid; gap: 2px; min-width: 0; }
.shop-product-identity strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-product-identity span { color: #697386; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-product-price { font-weight: 800; }
.shop-product-availability { color: #697386; font-size: 12px; }

.shop-status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  justify-self: start;
  padding: 5px 8px;
}

.shop-status-pill.is-published { background: #e5f4ea; color: #23633a; }
.shop-status-pill.is-draft { background: #edf0f4; color: #596274; }
.shop-status-pill.is-unavailable { background: #fff2d7; color: #855700; }

.invoice-finalize-dialog.shop-product-dialog {
  width: min(1440px, calc(100vw - 48px));
  max-width: none;
}
.shop-product-form { box-sizing: border-box; max-height: min(94vh, 1080px); max-width: none; overflow: auto; width: 100%; }
.shop-product-context { color: #697386; line-height: 1.45; margin: 4px 0 0; overflow-wrap: anywhere; }

.shop-source-summary {
  margin: 18px 0 22px;
  border: 1px solid #dfe6f0;
  border-radius: 13px;
  background: #fbfcfe;
  padding: 14px;
}
.shop-source-summary-heading {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
}
.shop-source-summary-heading h3 { margin: 0; color: #27364f; font-size: 13px; }
.shop-source-summary-heading span { color: #697386; font-size: 11px; }
.shop-source-details .shop-source-description { grid-column: 1 / -1; }
.shop-source-details .shop-source-description dd { white-space: pre-line; }

.shop-editor-layout {
  align-items: start;
  display: grid;
  gap: 22px;
  grid-template-columns: minmax(0, 2.15fr) minmax(330px, .85fr);
}

.shop-editor-fields { display: grid; gap: 16px; }
.shop-editor-preview { position: sticky; top: 0; }
.shop-editor-preview > h3 { margin: 4px 0 12px; }
.shop-published-field { border-color: #bfd2ef; background: #f3f7fd; }

.shop-preview-card {
  background: #fff;
  border: 1px solid #e1e5ec;
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(25, 43, 73, .1);
  overflow: hidden;
}

.shop-preview-badge { align-self: start; background: #244f93; border-radius: 999px; color: #fff; font-size: 11px; font-weight: 800; margin-bottom: 3px; padding: 6px 9px; }
.shop-preview-body { display: grid; gap: 7px; padding: 15px; }
.shop-preview-producer { color: #244f93; font-size: 11px; font-weight: 850; letter-spacing: .07em; margin: 0; text-transform: uppercase; }
.shop-preview-body h4 { font-size: 19px; line-height: 1.25; margin: 0; }
.shop-preview-meta,
.shop-preview-teaser { color: #697386; font-size: 13px; line-height: 1.45; margin: 0; }
.shop-preview-teaser { min-height: 38px; }
.shop-preview-footer { align-items: end; border-top: 1px solid #e7e9ee; display: flex; gap: 10px; justify-content: space-between; margin-top: 5px; padding-top: 11px; }
.shop-preview-footer div { display: grid; }
.shop-preview-footer small { color: #697386; font-size: 10px; }
.shop-preview-availability { background: #edf0f4; border-radius: 999px; color: #596274; font-size: 10px; font-weight: 800; padding: 5px 7px; text-align: center; }
.shop-preview-availability.is-available { background: #e5f4ea; color: #23633a; }
.shop-preview-availability.is-low { background: #fff2d7; color: #855700; }
.shop-preview-availability.is-sold-out { background: #edf0f4; color: #596274; }

.shop-publish-checks { display: grid; gap: 6px; margin-top: 12px; }
.shop-publish-check { align-items: center; color: #667085; display: flex; font-size: 12px; gap: 7px; }
.shop-publish-check::before { border: 1px solid #cbd1db; border-radius: 50%; content: ""; height: 9px; width: 9px; }
.shop-publish-check.is-ready { color: #28623b; }
.shop-publish-check.is-ready::before { background: #3c8553; border-color: #3c8553; box-shadow: inset 0 0 0 2px #fff; }

@media (max-width: 900px) {
  .shop-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-editor-layout { grid-template-columns: minmax(0, 1fr); }
  .shop-editor-preview { position: static; }
  .invoice-finalize-dialog.shop-product-dialog { width: calc(100vw - 24px); }
  .shop-source-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .shop-mode-badge { display: none; }
  .shop-workspace { padding: 14px; }
  .shop-safety-banner,
  .shop-section-heading { align-items: stretch; flex-direction: column; }
  .shop-search-combobox { min-width: 0; width: 100%; }
  .shop-candidate-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shop-product-row { grid-template-columns: minmax(0, 1fr) auto; }
  .shop-product-price,
  .shop-product-availability { grid-column: 1; }
  .shop-product-row > button { grid-column: 2; grid-row: 1 / span 3; }
}

@media (max-width: 440px) {
  .shop-summary-grid { grid-template-columns: minmax(0, 1fr); }
  .shop-preview-footer { align-items: start; flex-direction: column; }
  .shop-candidate-details,
  .shop-source-details { grid-template-columns: minmax(0, 1fr); }
  .shop-source-summary-heading { align-items: flex-start; flex-direction: column; }
}

/* --- Horizontal application navigation --- */

.app-shell {
  display: block;
  min-height: 100vh;
}

.app-sidebar {
  position: sticky;
  z-index: 100;
  top: 0;
  width: 100%;
  height: 72px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "brand nav sync account";
  align-items: center;
  gap: 18px;
  box-sizing: border-box;
  padding: 10px clamp(18px, 2.7vw, 42px);
  background: #0f172a;
  color: #fff;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.14);
}

.sidebar-brand {
  grid-area: brand;
  width: 156px;
  min-width: 156px;
  margin: 0;
}

.sidebar-logo-frame {
  width: 156px;
  height: 48px;
  border-radius: 11px;
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.2);
}

.sidebar-logo {
  width: 166px;
}

.sidebar-product-label {
  display: none;
}

.sidebar-nav {
  grid-area: nav;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: row;
  gap: 3px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar {
  display: none;
}

.sidebar-nav a {
  position: relative;
  flex: 0 0 auto;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 9px;
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  scroll-margin-top: 92px;
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-nav a.is-active {
  background: rgba(143, 178, 238, 0.16);
  color: #fff;
  box-shadow: inset 0 -3px 0 #8fb2ee;
}

.sidebar-sync-card {
  position: relative;
  grid-area: sync;
  margin: 0;
  overflow: visible;
  border-radius: 11px;
}

.sidebar-sync-summary {
  min-height: 40px;
  padding: 7px 10px;
}

.sidebar-sync-summary > span:first-child {
  font-size: 0;
}

.sidebar-sync-summary > span:first-child::after {
  content: "Sync";
  font-size: 12px;
}

.sidebar-sync-content {
  position: absolute;
  z-index: 110;
  top: calc(100% + 9px);
  right: 0;
  width: min(300px, calc(100vw - 32px));
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: #0f172a;
  padding: 0 12px 12px;
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.3);
}

.sidebar-account {
  grid-area: account;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  border: 0;
  padding: 0;
  white-space: nowrap;
}

.sidebar-account > span {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-account form {
  padding-left: 9px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

.app-main {
  width: min(100%, 1840px);
  max-width: none;
  margin: 0 auto;
  padding: 26px clamp(18px, 2.7vw, 42px) 56px;
}

.review-mode-banner {
  top: 82px;
}

@media (max-width: 1220px) {
  .app-sidebar {
    gap: 10px;
  }

  .sidebar-nav {
    justify-content: flex-start;
  }

  .sidebar-account > span {
    display: none;
  }
}

@media (max-width: 980px) {
  .app-sidebar {
    position: sticky;
    height: auto;
    min-height: 98px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand sync"
      "nav nav";
    align-items: center;
    gap: 7px 12px;
    padding: 9px 16px 8px;
  }

  .sidebar-brand {
    width: 136px;
    min-width: 136px;
  }

  .sidebar-logo-frame {
    width: 136px;
    height: 42px;
    border-radius: 10px;
  }

  .sidebar-logo {
    width: 145px;
  }

  .sidebar-nav {
    justify-content: flex-start;
    margin: 0 -4px;
    padding: 0 4px 1px;
  }

  .sidebar-nav a {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 12px;
    scroll-margin-top: 120px;
  }

  .sidebar-account {
    display: none;
  }

  .sidebar-sync-summary {
    min-height: 38px;
  }

  .app-main {
    padding: 20px 16px 42px;
  }

  .review-mode-banner {
    top: 106px;
  }
}

@media (max-width: 480px) {
  .app-sidebar {
    min-height: 94px;
    padding: 8px 12px 7px;
  }

  .sidebar-brand {
    width: 126px;
    min-width: 126px;
  }

  .sidebar-logo-frame {
    width: 126px;
    height: 39px;
  }

  .sidebar-logo {
    width: 135px;
  }

  .app-main {
    padding: 16px 12px 36px;
  }

  .review-mode-banner {
    top: 101px;
  }
}

h1 {
  margin-bottom: 8px;
}

h2 {
  margin-top: 36px;
}

table {
  border-collapse: collapse;
  width: 100%;
  background: white;
}

th,
td {
  padding: 8px 10px;
  border-bottom: 1px solid #ddd;
  text-align: left;
  font-size: 13px;
}

th {
  background: #eee;
  font-weight: 600;
}

.button {
  background: #111;
  color: white;
  border: 0;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.delta-neg {
  color: #9b1c1c;
  font-weight: 600;
}

.delta-pos {
  color: #176b2c;
  font-weight: 600;
}

.meta {
  color: #666;
  margin-bottom: 20px;
}

.statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  background: white;
  border: 1px solid #ddd;
  padding: 12px 14px;
  border-radius: 10px;
  margin: 18px 0;
  font-size: 13px;
}

.pill {
  padding: 4px 9px;
  border-radius: 999px;
  font-weight: 600;
}

.ok {
  background: #e8f5eb;
  color: #176b2c;
}

.running {
  background: #fff4d6;
  color: #8a5a00;
}

.error {
  background: #f8e4e4;
  color: #9b1c1c;
}

.warning {
  background: #fff4d6;
  color: #8a5a00;
}

.bar {
  height: 6px;
  background: #ddd;
  border-radius: 999px;
  overflow: hidden;
  width: 160px;
}

.bar-inner {
  height: 100%;
  background: #111;
  width: 100%;
  animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

.saving {
  background: #fff4d6 !important;
}

.saved {
  background: #e8f5eb !important;
}

.failed {
  background: #f8e4e4 !important;
}


.recent-row {
  cursor: pointer;
}

.recent-row:hover {
  background: #f3f6fa;
}

.row-highlight {
  outline: 3px solid #111827;
  outline-offset: -3px;
  background: #fff7cc !important;
}


.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 14px 0 28px;
}

.page-button {
  border: 1px solid #ccc;
  background: white;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
}

.page-button.active {
  background: #111;
  color: white;
  border-color: #111;
}

th[data-recent-sort],
th[data-inventory-sort] {
  cursor: pointer;
  user-select: none;
}

th[data-recent-sort]:hover,
th[data-inventory-sort]:hover {
  text-decoration: underline;
}

th[data-recent-sort].sorted-asc::after,
th[data-inventory-sort].sorted-asc::after {
  content: " ▲";
  font-size: 11px;
}

th[data-recent-sort].sorted-desc::after,
th[data-inventory-sort].sorted-desc::after {
  content: " ▼";
  font-size: 11px;
}

.inventory-delete {
  border: 1px solid #c33;
  background: white;
  color: #c33;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}

.inventory-delete:hover {
  background: #c33;
  color: white;
}

/* --- Dashboard form system --- */

.dashboard-card {
  background: #fff;
  border: 1px solid #dcdfe4;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.04);
  margin: 24px 0;
  overflow: hidden;
  scroll-margin-top: 74px;
}

.dashboard-card:not([open]) {
  margin-top: 14px;
  margin-bottom: 14px;
  box-shadow: 0 5px 18px rgba(15, 23, 42, 0.035);
}

.dashboard-card summary {
  list-style: none;
}

.dashboard-card summary::-webkit-details-marker {
  display: none;
}

.card-header {
  position: relative;
  padding: 22px 26px 18px;
  border-bottom: 1px solid #eceff3;
  cursor: pointer;
}

.dashboard-card > summary.card-header {
  padding-right: 70px;
  transition: background 0.15s ease;
  user-select: none;
}

.dashboard-card > summary.card-header:hover {
  background: #f9fafb;
}

.dashboard-card > summary.card-header:focus-visible {
  outline: 3px solid rgba(36, 79, 145, 0.2);
  outline-offset: -3px;
}

.dashboard-card > summary.card-header::after {
  content: "›";
  position: absolute;
  top: 50%;
  right: 26px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #d7dce4;
  border-radius: 10px;
  color: #475467;
  font-size: 25px;
  line-height: 1;
  transform: translateY(-50%);
  transition: transform 0.16s ease, background 0.16s ease;
}

.dashboard-card[open] > summary.card-header::after {
  transform: translateY(-50%) rotate(90deg);
  background: #f2f4f7;
}

.dashboard-card:not([open]) > summary.card-header {
  border-bottom: 0;
}

.card-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.card-subtitle {
  margin: 7px 0 0;
  color: #667085;
  font-size: 14px;
}

.wine-form {
  padding: 0;
}

.form-section {
  padding: 22px 26px;
  border-bottom: 1px solid #eceff3;
}

.form-section:last-of-type {
  border-bottom: 0;
}

.form-section-title {
  margin: 0 0 16px;
  font-size: 12px;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #344054;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px 18px;
}

.form-grid.two-col {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: #101828;
}

.form-field.full {
  grid-column: 1 / -1;
}

.field-helper {
  color: #667085;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.35;
}

.required {
  color: #c62828;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #ccd2dc;
  border-radius: 10px;
  background: #fff;
  color: #101828;
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  min-height: 42px;
  outline: none;
}

.form-textarea {
  min-height: 104px;
  resize: vertical;
  line-height: 1.45;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: #101828;
  box-shadow: 0 0 0 3px rgba(16, 24, 40, 0.08);
}

.price-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.autocomplete-control {
  position: relative;
  width: 100%;
  min-width: 0;
}

.autocomplete-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  overflow: hidden;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(16, 24, 40, 0.14);
}

.autocomplete-option {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid #eaecf0;
  background: #fff;
  color: #101828;
  font: inherit;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}

.autocomplete-option:last-child {
  border-bottom: 0;
}

.autocomplete-option:hover,
.autocomplete-option.active {
  background: #f2f4f7;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #ccd2dc;
  border-radius: 10px;
  background: #f9fafb;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

.wine-active-field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid #cfd6e3;
  border-radius: 12px;
  background: #f8fafc;
  color: #101828;
  cursor: pointer;
}

.wine-active-field input {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: #2458a6;
}

.wine-stock-derived-active {
  cursor: default;
}

.wine-stock-derived-active input:disabled {
  cursor: default;
  opacity: 1;
}

.wine-active-field span {
  display: grid;
  gap: 2px;
}

.wine-active-field strong {
  font-size: 14px;
  line-height: 1.2;
}

.wine-active-field small {
  color: #667085;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  padding: 22px 26px 26px;
  border-top: 1px solid #eceff3;
  background: #fcfcfd;
}

.form-note {
  color: #667085;
  font-size: 13px;
}

.button-primary {
  background: #101828;
  color: #fff;
  border: 1px solid #101828;
  padding: 11px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
}

.button-primary:hover {
  background: #000;
}

@media (max-width: 1100px) {
  .form-grid,
  .form-grid.two-col {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 680px) {
  .form-grid,
  .form-grid.two-col {
    grid-template-columns: 1fr;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .button-primary {
    width: 100%;
  }
}

/* --- Add Wine visual refinement --- */

.add-wine-card {
  border-color: #d9dee8;
}

.add-wine-card .card-header {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.add-wine-card .form-section {
  margin: 12px;
  border: 1px solid #e3e7ee;
  border-radius: 14px;
  background: #fff;
}

.field-label {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.add-wine-card .form-input,
.add-wine-card .form-select {
  min-height: 46px;
  border-radius: 11px;
}

.add-wine-card .form-textarea {
  border-radius: 11px;
}

.description-guide-wrap {
  position: relative;
}

.description-guide {
  position: absolute;
  inset: 12px 14px auto 14px;
  z-index: 0;
  pointer-events: none;
  color: #98a2b3;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-line;
}

.description-guide-line {
  min-height: 20px;
}

.description-guide-line.filled {
  visibility: hidden;
}

.description-textarea {
  position: relative;
  z-index: 1;
  background: transparent;
  min-height: 126px;
  line-height: 1.45;
}

.description-textarea:focus {
  background: rgba(255,255,255,0.72);
}

/* --- Description guide alignment fix --- */

.description-guide {
  inset: 11px 13px auto 13px;
  font: inherit;
  font-weight: 400;
  line-height: 1.45;
}

.description-guide-line {
  min-height: 0;
  height: 1.45em;
  line-height: 1.45;
}

.description-textarea {
  padding: 10px 12px;
  font: inherit;
  font-weight: 400;
  line-height: 1.45;
}

/* --- Description guide precise line alignment --- */

.description-guide {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: 0;
  pointer-events: none;
  color: #98a2b3;
  font-size: 16px;
  font-weight: 400;
  line-height: 23px;
}

.description-guide-line {
  position: absolute;
  left: 0;
  height: 23px;
  line-height: 23px;
}

.description-guide-line[data-line="0"] {
  top: 0;
}

.description-guide-line[data-line="1"] {
  top: 23px;
}

.description-guide-line[data-line="2"] {
  top: 46px;
}

.description-textarea {
  padding: 10px 12px;
  font-size: 16px;
  font-weight: 400;
  line-height: 23px;
}

/* --- Inventory table polish --- */

#inventory-table {
  border: 1px solid #e3e7ee;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.035);
}

#inventory-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: 1px solid #d9dee8;
}

#inventory-table tbody tr {
  transition: background 0.14s ease, box-shadow 0.14s ease;
}

#inventory-table tbody tr:hover {
  background: #f9fbff;
}

#inventory-table td {
  vertical-align: middle;
}

#inventory-table select,
#inventory-table input {
  border: 1px solid #ccd2dc;
  border-radius: 8px;
  padding: 6px 8px;
  background: white;
  font-size: 13px;
}

#inventory-table select:focus,
#inventory-table input:focus {
  outline: none;
  border-color: #101828;
  box-shadow: 0 0 0 3px rgba(16, 24, 40, 0.08);
}

.stock-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.stock-controls button {
  width: 28px;
  height: 28px;
  border: 1px solid #ccd2dc;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}

.stock-controls button:hover {
  background: #f2f4f7;
}

.stock-controls input {
  height: 28px;
}

.row-highlight {
  animation: rowFlash 1.6s ease;
}

@keyframes rowFlash {
  0% { background: #fff4c2; }
  100% { background: transparent; }
}

/* --- Add Wine screenshot-aligned polish --- */

.add-wine-card {
  margin-top: 32px;
  border-radius: 14px;
  border: 1px solid #d9dee8;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
}

.add-wine-card .card-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 26px 28px;
  background: #fff;
}

.add-wine-card .card-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.add-wine-card .card-subtitle {
  font-size: 15px;
  color: #667085;
}

.add-wine-card .form-section {
  margin: 0;
  padding: 24px 28px;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  box-shadow: none;
}

.add-wine-card .form-section-title {
  color: #101828;
  font-size: 13px;
  letter-spacing: 0.16em;
}

.add-wine-card .form-grid {
  gap: 18px 28px;
}

.add-wine-card .form-field {
  font-size: 14px;
  font-weight: 700;
}

.add-wine-card .form-input,
.add-wine-card .form-select {
  height: 48px;
  border-radius: 12px;
  border-color: #cfd6e3;
  font-size: 15px;
  padding: 11px 14px;
}

.add-wine-card .form-textarea {
  border-color: #cfd6e3;
  border-radius: 12px;
  font-size: 15px;
}

.add-wine-card .form-actions {
  padding: 20px 28px 26px;
  background: #fff;
}

.add-wine-card .button-primary {
  min-width: 220px;
  height: 48px;
  border-radius: 10px;
  background: linear-gradient(180deg, #111827 0%, #020617 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.18);
}

.add-wine-card .button-secondary {
  height: 48px;
  padding: 0 16px;
  border-radius: 10px;
}

.description-guide,
.description-textarea {
  font-size: 15px !important;
  line-height: 22px !important;
}

.description-guide-line[data-line="1"] {
  top: 22px !important;
}

.description-guide-line[data-line="2"] {
  top: 44px !important;
}


/* --- Global dashboard shell --- */

body {
  margin: 0;
  background: #f3f5f8;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-width: 0;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #0f172a;
  color: #fff;
  padding: 26px 22px;
  box-sizing: border-box;
  min-width: 0;
}

.sidebar-brand {
  width: 216px;
  margin-bottom: 28px;
}

.sidebar-logo-frame {
  position: relative;
  width: 216px;
  height: 68px;
  overflow: hidden;
  box-sizing: border-box;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(2, 6, 23, 0.2);
}

.sidebar-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 230px;
  max-width: none;
  height: auto;
  display: block;
  transform: translate(-50%, -50%);
}

.sidebar-product-label {
  margin-top: 9px;
  padding-left: 2px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-nav a {
  color: #cbd5e1;
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.sidebar-nav a.is-active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  box-shadow: inset 3px 0 0 #8fb2ee;
}

.app-main {
  padding: 34px 42px 56px;
  max-width: 1600px;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.app-main > h1 {
  margin-top: 0;
  font-size: 38px;
  letter-spacing: -0.05em;
}

.app-main > .meta {
  font-size: 15px;
  color: #667085;
}

.app-main > h2,
.app-main > details > summary h2 {
  letter-spacing: -0.03em;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: relative;
    height: auto;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand sync"
      "nav nav";
    align-items: center;
    gap: 8px 12px;
    padding: 12px 16px 10px;
  }

  .sidebar-brand {
    grid-area: brand;
    width: auto;
    min-width: 0;
    margin: 0;
  }

  .sidebar-logo-frame {
    width: 136px;
    height: 42px;
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(2, 6, 23, 0.18);
  }

  .sidebar-logo {
    width: 145px;
  }

  .sidebar-product-label {
    display: none;
  }

  .sidebar-sync-card {
    position: relative;
    grid-area: sync;
    margin: 0;
    overflow: visible;
  }

  .sidebar-sync-summary {
    min-height: 42px;
    padding: 7px 10px;
  }

  .sidebar-sync-summary > span:first-child {
    font-size: 0;
  }

  .sidebar-sync-summary > span:first-child::after {
    content: "Sync";
    font-size: 12px;
  }

  .sidebar-sync-content {
    position: absolute;
    z-index: 50;
    top: calc(100% + 8px);
    right: 0;
    width: min(300px, calc(100vw - 32px));
    box-sizing: border-box;
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 12px;
    background: #0f172a;
    padding: 0 12px 12px;
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.3);
  }

  .sidebar-nav {
    grid-area: nav;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar-nav a {
    flex: 0 0 auto;
    padding: 8px 10px;
    white-space: nowrap;
    font-size: 13px;
  }

  .app-main {
    padding: 24px 18px 42px;
    width: 100%;
  }
}

/* --- Sidebar sync/status panel --- */

.sidebar-sync-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  margin: 0 0 22px;
  overflow: hidden;
}

.sidebar-sync-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  box-sizing: border-box;
  padding: 10px 12px;
  cursor: pointer;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 700;
  list-style: none;
}

.sidebar-sync-summary::-webkit-details-marker {
  display: none;
}

.sidebar-sync-summary:hover {
  background: rgba(255,255,255,0.05);
}

.sidebar-sync-summary:focus-visible {
  outline: 2px solid #8fb2ee;
  outline-offset: -2px;
}

.sidebar-sync-summary .pill {
  font-size: 12px;
}

.sidebar-sync-content {
  padding: 0 12px 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-sync-meta {
  display: grid;
  gap: 5px;
  color: #cbd5e1;
  font-size: 13px;
  margin: 12px 0 14px;
}

.sidebar-sync-meta strong {
  color: #fff;
  font-weight: 700;
}

.sidebar-sync-meta strong[data-state="success"] {
  color: #86efac;
}

.sidebar-sync-meta strong[data-state="running"],
.sidebar-sync-meta strong[data-state="waiting"] {
  color: #fde68a;
}

.sidebar-sync-meta strong[data-state="error"],
.sidebar-sync-meta strong[data-state="skipped"] {
  color: #fca5a5;
}

.sidebar-sync-button {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 10px;
  background: #020617;
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.sidebar-sync-button:hover {
  background: #111827;
}

.sidebar-nav a {
  scroll-margin-top: 24px;
}

@media (max-width: 980px) {
  .sidebar-sync-card {
    margin: 0;
  }

  .sidebar-sync-summary {
    min-height: 42px;
    padding: 7px 10px;
  }
}

html {
  scroll-behavior: smooth;
}

.review-mode-banner {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 0 20px;
  padding: 12px 16px;
  border: 1px solid #f5c451;
  border-radius: 12px;
  background: #fff8df;
  color: #6b4f00;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(107, 79, 0, 0.08);
}

body[data-review-mode="true"] #wine-submit-button,
body[data-review-mode="true"] #sidebar-sync-button,
body[data-review-mode="true"] .bulk-action-button,
body[data-review-mode="true"] .bulk-set-button,
body[data-review-mode="true"] .inventory-inline-select,
body[data-review-mode="true"] .inventory-inline-input,
body[data-review-mode="true"] .stock-controls,
body[data-review-mode="true"] .inventory-delete {
  pointer-events: none;
  opacity: 0.48;
  filter: grayscale(0.35);
}

body[data-review-mode="true"] #invoice-create-draft,
body[data-review-mode="true"] #invoice-finalize-button {
  pointer-events: none;
  opacity: 0.48;
  filter: grayscale(0.35);
}

.sidebar-sync-progress {
  width: 100%;
  margin: 0 0 12px;
  background: rgba(255,255,255,0.18);
}

/* --- Dashboard table cards --- */

.table-card {
  margin: 28px 0;
}

.table-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  background: #fff;
}

.table-card-header .card-title {
  font-size: 26px;
}

.table-card-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 16px 22px;
  border-bottom: 1px solid #eceff3;
  background: #fff;
}

.table-search {
  width: min(360px, 100%);
  height: 44px;
  box-sizing: border-box;
  border: 1px solid #ccd2dc;
  border-radius: 12px;
  background: #fff;
  padding: 0 14px;
  font-size: 14px;
  outline: none;
}

.table-search-control {
  width: min(360px, 100%);
}

.table-search-control .table-search {
  width: 100%;
}

.table-search-status {
  display: block;
  min-height: 18px;
  padding: 5px 2px 0;
  color: #667085;
  font-size: 12px;
}

.table-search-status.is-loading {
  color: #8a5a00;
}

.table-search-status.is-error {
  color: #9b1c1c;
}

.table-search:focus {
  border-color: #101828;
  box-shadow: 0 0 0 3px rgba(16, 24, 40, 0.08);
}

.table-wrap {
  overflow-x: auto;
}

.table-card table {
  margin: 0;
}

.table-pagination {
  padding: 14px 22px 22px;
  margin: 0;
}

@media (max-width: 860px) {
  .table-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .table-search,
  .table-search-control {
    width: 100%;
  }
}

/* --- Inventory toolbar polish --- */

.inventory-toolbar {
  padding: 18px 22px;
  border-bottom: 1px solid #eceff3;
  background: #fff;
}

.inventory-filter-form,
.bulk-toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.inventory-filter-form {
  margin-bottom: 12px;
}

.toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.toolbar-select {
  height: 44px;
  min-width: 180px;
  box-sizing: border-box;
  border: 1px solid #ccd2dc;
  border-radius: 12px;
  background: white;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
}

.toolbar-select:focus {
  border-color: #101828;
  box-shadow: 0 0 0 3px rgba(16, 24, 40, 0.08);
}

.toolbar-link {
  color: #667085;
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 12px;
}

.toolbar-link:hover {
  color: #101828;
  text-decoration: underline;
}

.toolbar-reset-button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.toolbar-status {
  color: #667085;
  font-size: 13px;
}

.inventory-inline-input {
  width: 140px;
  box-sizing: border-box;
  border: 1px solid #ccd2dc;
  border-radius: 8px;
  padding: 6px 8px;
  background: white;
  font-size: 13px;
}

/* --- Inventory action buttons --- */

.inventory-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inventory-actions .inventory-copy,
.inventory-actions .inventory-edit,
.inventory-actions .inventory-delete {
  height: 32px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #ccd2dc;
  background: #fff;
  cursor: pointer;
}

.inventory-actions .inventory-edit:hover {
  background: #f3f4f6;
}

.inventory-actions .inventory-copy {
  border-color: #b8c7e6;
  color: #244f91;
  background: #f7faff;
}

.inventory-actions .inventory-copy:hover {
  background: #eaf1fc;
}

.inventory-actions .inventory-delete {
  border-color: #f1c7c7;
  color: #b42318;
  background: #fff;
}

.inventory-actions .inventory-delete:hover {
  background: #fef3f2;
}

/* --- Inventory stock control final polish --- */

.stock-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.stock-step-button {
  width: 30px;
  height: 30px;
  border: 1px solid #ccd2dc;
  border-radius: 9px;
  background: #fff;
  color: #101828;
  cursor: pointer;
  font-weight: 800;
  line-height: 1;
}

.stock-step-button:hover {
  background: #f2f4f7;
}

.stock-input {
  width: 74px;
  height: 30px;
  box-sizing: border-box;
  border: 1px solid #ccd2dc;
  border-radius: 9px;
  padding: 0 8px;
  text-align: center;
  background: white;
  font-size: 13px;
}

#recent-table .recent-change-summary {
  min-width: 190px;
  white-space: normal;
  line-height: 1.35;
}

#recent-table .recent-event-neutral {
  color: #667085;
}

/* --- Inventory alignment correction --- */

#bulk-set-value {
  height: 44px;
  width: 150px;
  box-sizing: border-box;
  border: 1px solid #ccd2dc;
  border-radius: 12px;
  background: #fff;
  padding: 0 12px;
  font-size: 14px;
  color: #101828;
  outline: none;
}

#bulk-set-value:focus {
  border-color: #101828;
  box-shadow: 0 0 0 3px rgba(16, 24, 40, 0.08);
}

.bulk-set-field {
  min-width: 150px;
}

#inventory-table th,
#inventory-table td {
  vertical-align: middle;
}

#inventory-table td:last-child,
#inventory-table th:last-child {
  white-space: nowrap;
}

.inventory-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 216px;
  height: 34px;
}

.inventory-actions .inventory-copy,
.inventory-actions .inventory-edit,
.inventory-actions .inventory-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  min-width: 58px;
  padding: 0 12px;
  line-height: 1;
}

/* --- Inventory final alignment system --- */

#inventory-table {
  table-layout: auto;
  overflow: visible;
}

#inventory-table th,
#inventory-table td {
  vertical-align: middle !important;
  padding-top: 8px;
  padding-bottom: 8px;
}

#inventory-table tbody tr {
  height: 52px;
}

#inventory-table select.inventory-inline-select,
#inventory-table input.inventory-inline-input,
#inventory-table .stock-input {
  height: 34px !important;
  box-sizing: border-box;
  border: 1px solid #ccd2dc;
  border-radius: 9px;
  background: #fff;
  font-size: 13px;
}

#inventory-table select.inventory-inline-select {
  min-width: 180px;
  padding: 0 10px;
}

#inventory-table input.inventory-inline-input {
  width: 150px;
  padding: 0 10px;
}

.stock-controls {
  display: inline-grid !important;
  grid-template-columns: 30px 74px 30px;
  gap: 6px;
  align-items: center;
  height: 34px;
}

.stock-step-button {
  width: 30px !important;
  height: 30px !important;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stock-input {
  width: 74px !important;
  height: 30px !important;
  padding: 0 8px !important;
  text-align: center;
}

#inventory-table th:last-child,
#inventory-table td:last-child {
  width: 218px;
  min-width: 218px;
}

.inventory-actions {
  display: inline-grid !important;
  grid-template-columns: 58px 58px 68px;
  gap: 8px;
  align-items: center;
  height: 34px;
  min-width: 200px;
}

.inventory-actions .inventory-copy,
.inventory-actions .inventory-edit,
.inventory-actions .inventory-delete {
  height: 32px !important;
  min-width: 0;
  width: 100%;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
}

.bulk-toolbar {
  align-items: end !important;
}

#bulk-set-value {
  height: 44px !important;
  width: 150px !important;
  border-radius: 12px !important;
  padding: 0 12px !important;
}

/* --- Bulk toolbar alignment correction --- */

.bulk-toolbar {
  align-items: center !important;
}

.bulk-set-field {
  gap: 4px !important;
  justify-content: center;
}

.bulk-set-field span {
  line-height: 1;
  margin-bottom: 2px;
}

.bulk-action-button,
.bulk-set-button,
#bulk-set-value {
  margin-top: 0 !important;
}

/* --- Set stock height correction --- */

#bulk-set-value {
  height: 34px !important;
}

/* --- Inventory bulk toolbar final system --- */

.bulk-toolbar {
  display: grid !important;
  grid-template-columns: 112px 112px 150px 72px auto;
  column-gap: 12px !important;
  row-gap: 0 !important;
  align-items: end !important;
}

.bulk-toolbar .bulk-action-button,
.bulk-toolbar .bulk-set-button,
.bulk-toolbar #bulk-set-value {
  height: 38px !important;
  border-radius: 10px !important;
  box-sizing: border-box !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

.bulk-toolbar .bulk-action-button,
.bulk-toolbar .bulk-set-button {
  width: 100% !important;
  padding: 0 12px !important;
  border: 1px solid #101828 !important;
  background: #101010 !important;
  color: #fff !important;
  line-height: 1 !important;
}

.bulk-toolbar .bulk-action-button:disabled,
.bulk-toolbar .bulk-set-button:disabled {
  border-color: #d7dce4 !important;
  background: #e9edf2 !important;
  color: #98a2b3 !important;
  cursor: not-allowed !important;
}

.bulk-toolbar #bulk-set-value {
  width: 150px !important;
  padding: 0 12px !important;
  border: 1px solid #ccd2dc !important;
  background: #fff !important;
  color: #101828 !important;
  font-weight: 400 !important;
}

.bulk-toolbar .bulk-set-field {
  min-width: 150px !important;
  gap: 6px !important;
}

.bulk-toolbar .bulk-set-field span {
  margin: 0 !important;
  line-height: 1 !important;
}

.bulk-toolbar .toolbar-status {
  align-self: center !important;
  padding-left: 2px;
}

@media (max-width: 900px) {
  .bulk-toolbar {
    grid-template-columns: repeat(2, minmax(112px, 1fr)) 150px 72px;
  }
}

.is-hidden,
[hidden] {
  display: none !important;
}

.inventory-loading-row td,
.inventory-empty-row td,
.table-empty-row td {
  padding: 28px 16px;
  color: #667085;
  text-align: center;
}

#inventory-result-status {
  min-height: 20px;
  padding: 10px 4px 0;
}

/* --- Inventory usability layout --- */

.inventory-toolbar-section + .inventory-toolbar-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e9f0;
}

#inventory-section[open] {
  overflow: visible;
}

.inventory-sticky-controls {
  position: sticky;
  top: 0;
  z-index: 16;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(10px);
}

body[data-review-mode="true"] .inventory-sticky-controls {
  top: 43px;
}

.inventory-toolbar {
  padding: 14px 22px;
  background: transparent;
}

.inventory-toolbar-section {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: end;
  column-gap: 22px;
}

.inventory-toolbar-section > .inventory-toolbar-heading {
  margin: 0 0 12px;
}

.inventory-bulk-section {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: end;
  column-gap: 22px;
  padding: 14px 22px;
  border-bottom: 1px solid #dfe4eb;
  background: transparent;
}

.inventory-bulk-heading-row {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 0;
}

.inventory-bulk-heading-row .inventory-toolbar-heading {
  margin: 0;
}

.bulk-selection-summary {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: #f2f4f7;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.bulk-selection-summary.has-selection {
  background: #eef4ff;
  color: #244f91;
}

@media (max-width: 900px) {
  .inventory-toolbar-section,
  .inventory-bulk-section {
    grid-template-columns: 1fr;
    row-gap: 12px;
  }
}

.inventory-toolbar-heading {
  margin: 0 0 12px;
  color: #667085;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inventory-filter-form {
  margin-bottom: 0;
}

.inventory-table-statusbar {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 22px;
  border-bottom: 1px solid #e5e9f0;
  background: #f8fafc;
  box-sizing: border-box;
}

#inventory-section > .table-wrap {
  border: 1px solid #e3e7ee;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.035);
}

#inventory-section #inventory-table {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.inventory-view-status,
.inventory-filter-chips {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.inventory-view-status {
  margin-left: auto;
  white-space: nowrap;
}

.inventory-status-separator {
  color: #98a2b3;
}

.inventory-filter-chip {
  min-height: 30px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #c8d5ea;
  border-radius: 999px;
  padding: 5px 10px;
  background: #eef4ff;
  color: #244f91;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.inventory-filter-chip:hover {
  background: #e1ebfb;
}

#inventory-result-status {
  min-height: 0;
  padding: 0;
  color: #344054;
  font-weight: 700;
}

#inventory-table .inventory-article-cell {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 92px;
  background: #fff;
  box-shadow: 8px 0 12px -12px rgba(15, 23, 42, 0.45);
}

.inventory-article-number {
  display: block;
}

.inventory-inactive-stamp {
  display: table;
  margin-top: 7px;
  border: 1.5px solid #98a2b3;
  border-radius: 4px;
  padding: 2px 6px 1px;
  background: rgba(255, 255, 255, 0.42);
  box-shadow: inset 0 0 0 1px rgba(152, 162, 179, 0.18);
  color: #475467;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.09em;
  line-height: 1.45;
  text-transform: uppercase;
  transform: rotate(-2deg);
  transform-origin: left center;
}

#inventory-table thead .inventory-article-cell {
  z-index: 6;
  background: #f8fafc;
}

#inventory-table .inventory-actions-cell {
  position: sticky;
  right: 0;
  z-index: 3;
  background: #fff;
  box-shadow: -8px 0 12px -12px rgba(15, 23, 42, 0.45);
}

#inventory-table thead .inventory-actions-cell {
  z-index: 6;
  background: #f8fafc;
}

#inventory-table tbody tr:nth-child(even) > td {
  background: #fbfcfe;
}

#inventory-table tbody tr:hover > td {
  background: #f3f7fd;
}

#inventory-table .inventory-clamp-cell {
  min-width: 150px;
  max-width: 210px;
}

#inventory-table .inventory-location-cell {
  width: 118px;
  min-width: 118px;
  max-width: 118px;
}

#inventory-table .inventory-location-cell select.inventory-inline-select {
  width: 108px;
  min-width: 108px;
  max-width: 108px;
  padding-left: 7px;
  padding-right: 7px;
}

#inventory-table .inventory-bin-cell {
  width: 108px;
  min-width: 108px;
  max-width: 108px;
}

#inventory-table .inventory-bin-cell input.inventory-inline-input {
  width: 98px;
  min-width: 98px;
  max-width: 98px;
  padding-left: 7px;
  padding-right: 7px;
}

#inventory-table .inventory-description-cell {
  min-width: 260px;
  max-width: 340px;
}

.inventory-description-text {
  display: block;
  overflow-wrap: anywhere;
  white-space: pre-line;
  font-size: 13px;
  line-height: 1.35;
}

#inventory-table tbody tr.inventory-row-inactive > td {
  background: #f4f5f7;
  color: #667085;
}

#inventory-table tbody tr.inventory-row-inactive:hover > td {
  background: #eceff3;
}

#inventory-table tbody tr.inventory-row-inactive .inventory-description-text {
  color: #475467;
}

.inventory-clamped-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.35;
}

#inventory-table .inventory-centered-cell {
  text-align: center;
}

#inventory-table .inventory-stock-cell {
  text-align: right;
}

#inventory-table .inventory-stock-cell .stock-controls {
  margin-left: auto;
}

@media (max-width: 720px) {
  body[data-review-mode="true"] .inventory-sticky-controls {
    top: 76px;
  }

  .inventory-bulk-heading-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .inventory-table-statusbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .inventory-view-status {
    margin-left: 0;
    white-space: normal;
  }
}

/* --- Action notifications --- */

.toast-region {
  position: fixed;
  top: 22px;
  right: 24px;
  z-index: 1000;
  display: flex;
  width: min(380px, calc(100vw - 32px));
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

body[data-review-mode="true"] .toast-region {
  top: 92px;
}

.toast {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  box-sizing: border-box;
  padding: 11px 10px 11px 13px;
  border: 1px solid #d7dce4;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  color: #101828;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.18);
  opacity: 0;
  pointer-events: auto;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-symbol {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 900;
}

.toast-message {
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.toast-dismiss {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #667085;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.toast-dismiss:hover {
  background: #f2f4f7;
  color: #101828;
}

.toast-success {
  border-color: #b7dfc3;
}

.toast-success .toast-symbol {
  background: #e8f5eb;
  color: #176b2c;
}

.toast-error {
  border-color: #efc0bd;
}

.toast-error .toast-symbol {
  background: #fef3f2;
  color: #b42318;
}

.toast-warning {
  border-color: #ecd28c;
}

.toast-warning .toast-symbol {
  background: #fff4d6;
  color: #8a5a00;
}

.toast-info {
  border-color: #bfd1ee;
}

.toast-info .toast-symbol {
  background: #eef4ff;
  color: #244f91;
}

@media (max-width: 640px) {
  .toast-region {
    top: 14px;
    right: 16px;
    left: 16px;
    width: auto;
  }

  body[data-review-mode="true"] .toast-region {
    top: 86px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }
}

/* --- Invoice workspace --- */

.invoice-card .card-header {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
}

.invoice-workspace {
  background: #fff;
  min-width: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.invoice-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  border-bottom: 1px solid #e3e7ee;
  background: #f8fafc;
  padding: 0 28px;
  list-style: none;
}

.invoice-steps li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-bottom: 3px solid transparent;
  padding: 14px 10px 11px;
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.invoice-steps li span {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e4e7ec;
  color: #475467;
  font-size: 11px;
}

.invoice-steps li.is-active {
  border-color: #244f91;
  color: #244f91;
}

.invoice-steps li.is-active span {
  background: #244f91;
  color: #fff;
}

.invoice-steps li.is-complete {
  color: #176b2c;
}

.invoice-steps li.is-complete span {
  background: #dff3e5;
  color: #176b2c;
}

.invoice-card .form-section {
  padding: 24px 28px;
}

.invoice-card .form-grid {
  grid-template-columns: minmax(260px, 1.6fr) repeat(3, minmax(150px, 0.7fr));
}

.invoice-customer-field {
  min-width: 0;
}

.invoice-customer-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #b7dfc3;
  border-radius: 11px;
  background: #f3fbf5;
  padding: 11px 12px;
}

.invoice-customer-card[hidden] {
  display: none;
}

.invoice-customer-card > div,
.invoice-customer-card span {
  display: block;
  min-width: 0;
}

.invoice-customer-card strong {
  display: block;
  margin-bottom: 3px;
  color: #101828;
  font-size: 14px;
}

.invoice-customer-card span {
  overflow-wrap: anywhere;
  color: #475467;
  font-size: 12px;
  line-height: 1.45;
}

.button-link {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  padding: 2px;
  color: #244f91;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.button-link:hover,
.button-link:focus-visible {
  text-decoration: underline;
}

.field-help {
  min-height: 18px;
  color: #667085;
  font-size: 12px;
  font-weight: 500;
}

.field-help.is-selected {
  color: #176b2c;
}

.remote-combobox {
  position: relative;
  min-width: 0;
}

.remote-results {
  position: absolute;
  z-index: 45;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  background: #fff;
  padding: 6px;
  color: #667085;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
  font-size: 13px;
}

.remote-result {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 3px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  padding: 10px 11px;
  color: #101828;
  cursor: pointer;
  text-align: left;
}

.remote-result:hover,
.remote-result:focus-visible,
.remote-result.is-active {
  background: #eef4ff;
  outline: none;
}

.remote-result mark {
  border-radius: 3px;
  background: #ffecb5;
  color: inherit;
  padding: 0 1px;
}

.remote-result strong {
  font-size: 14px;
}

.remote-result span {
  color: #667085;
  font-size: 12px;
}

.invoice-section-heading-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 16px;
}

.invoice-items-sticky-heading {
  position: sticky;
  z-index: 30;
  top: 0;
  margin: -8px -8px 16px;
  border-bottom: 1px solid #eef1f5;
  background: rgba(255, 255, 255, 0.97);
  padding: 8px;
  backdrop-filter: blur(8px);
}

.invoice-item-tools {
  display: flex;
  width: min(590px, 58%);
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.invoice-running-total {
  flex: 0 0 auto;
  color: #101828;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.invoice-section-heading-row .form-section-title {
  margin-bottom: 7px;
}

.invoice-section-note {
  margin: 0;
  color: #667085;
  font-size: 13px;
}

.invoice-article-picker {
  width: min(480px, 100%);
  flex: 1 1 360px;
}

.invoice-lines-wrap {
  border: 1px solid #e3e7ee;
  border-radius: 12px;
  max-width: 100%;
}

#invoice-lines-table {
  min-width: 920px;
}

#invoice-lines-table th,
#invoice-list-table th {
  background: #f8fafc;
  color: #344054;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

#invoice-lines-table td {
  vertical-align: middle;
}

#invoice-lines-table td:first-child {
  width: 108px;
  min-width: 108px;
}

#invoice-lines-table td:nth-child(2) {
  width: 290px;
  min-width: 240px;
}

#invoice-lines-table td:nth-child(2) strong,
.invoice-pdf-description-lines {
  display: block;
}

.invoice-pdf-column-label {
  display: inline-flex;
  margin-left: 4px;
  border: 1px solid #b9c8e5;
  border-radius: 999px;
  padding: 1px 5px;
  background: #f3f7ff;
  color: #31558c;
  font-size: 9px;
  letter-spacing: 0.08em;
  vertical-align: 1px;
}

.invoice-pdf-article-number {
  color: #344054;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.invoice-pdf-description strong {
  color: #101828;
  font-size: 14px;
  line-height: 1.35;
}

.invoice-pdf-description-lines {
  margin-top: 5px;
  color: #475467;
  font-size: 12px;
  line-height: 1.4;
  white-space: pre-line;
}

.invoice-line-input {
  width: 82px;
  height: 36px;
  box-sizing: border-box;
  border: 1px solid #ccd2dc;
  border-radius: 9px;
  padding: 0 8px;
  background: #fff;
  font: inherit;
  text-align: right;
}

.invoice-price-input {
  width: 104px;
}

.invoice-line-input:focus {
  border-color: #101828;
  box-shadow: 0 0 0 3px rgba(16, 24, 40, 0.08);
  outline: none;
}

.invoice-line-input.is-invalid {
  border-color: #d92d20;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.1);
}

.invoice-stock-cell strong,
.invoice-stock-cell span,
.invoice-stock-note {
  display: block;
}

.invoice-stock-cell span,
.invoice-stock-note {
  margin-top: 3px;
  color: #667085;
  font-size: 10px;
  white-space: nowrap;
}

.invoice-stock-note:not(:empty) {
  color: #b42318;
  font-weight: 700;
}

.invoice-line-total {
  white-space: nowrap;
  font-weight: 700;
}

.invoice-remove-line {
  width: 32px;
  height: 32px;
  border: 1px solid #efc0bd;
  border-radius: 9px;
  background: #fff;
  color: #b42318;
  cursor: pointer;
  font-size: 20px;
}

.invoice-remove-line:hover {
  background: #fef3f2;
}

.invoice-empty-row td {
  padding: 30px 16px;
  color: #667085;
  text-align: center;
}

.invoice-empty-add {
  border: 1px dashed #9bb5dd;
  border-radius: 10px;
  background: #f7faff;
  padding: 10px 16px;
  color: #244f91;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.invoice-empty-add:hover,
.invoice-empty-add:focus-visible {
  border-style: solid;
  background: #eef4ff;
}

.invoice-summary-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 0.5fr);
  gap: 28px;
  margin-top: 22px;
}

.invoice-notes-field .form-textarea {
  min-height: 116px;
}

.invoice-totals {
  align-self: stretch;
  position: sticky;
  top: 84px;
  height: fit-content;
  margin: 0;
  border: 1px solid #e3e7ee;
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px 16px;
}

.invoice-totals > div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 0;
  color: #475467;
}

.invoice-totals dt,
.invoice-totals dd {
  margin: 0;
}

.invoice-totals dd {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.invoice-totals .invoice-grand-total {
  margin-top: 5px;
  border-top: 1px solid #d7dce4;
  padding-top: 14px;
  color: #101828;
  font-size: 17px;
  font-weight: 800;
}

.invoice-form-actions {
  justify-content: space-between;
}

.invoice-form-messages {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.invoice-autosave-status {
  min-height: 15px;
  color: #667085;
  font-size: 11px;
}

.invoice-created-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin: 22px 28px;
  border: 1px solid #b7dfc3;
  border-radius: 14px;
  background: #f3fbf5;
  padding: 18px 20px;
}

.invoice-created-kicker {
  color: #176b2c;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.invoice-created-panel h3 {
  margin: 4px 0;
  font-size: 21px;
}

.invoice-created-panel p {
  margin: 0;
  color: #475467;
  font-size: 13px;
}

.invoice-created-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.invoice-submit-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.invoice-document-actions {
  vertical-align: middle;
}

.invoice-document-actions-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 1px solid #ccd2dc;
  border-radius: 10px;
  background: #fff;
  padding: 10px 16px;
  color: #101828;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.button-secondary:hover {
  background: #f2f4f7;
}

.invoice-recent-section {
  border-top: 1px solid #eceff3;
  background: #fff;
}

.invoice-recent-summary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 56px 22px 28px;
  cursor: pointer;
  list-style: none;
}

.invoice-recent-summary::-webkit-details-marker {
  display: none;
}

.invoice-recent-summary::after {
  position: absolute;
  top: 50%;
  right: 30px;
  color: #667085;
  content: "›";
  font-size: 24px;
  transform: translateY(-50%) rotate(90deg);
  transition: transform 160ms ease;
}

.invoice-recent-section:not([open]) .invoice-recent-summary::after {
  transform: translateY(-50%);
}

.invoice-recent-summary:hover {
  background: #fafbfc;
}

.invoice-recent-summary .form-section-title {
  margin-bottom: 7px;
}

.invoice-recent-content {
  padding: 0 28px 28px;
}

.invoice-recent-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.invoice-recent-toolbar .table-search {
  flex: 1 1 380px;
  max-width: 520px;
}

.invoice-status-filter {
  display: flex;
  width: 180px;
  flex: 0 0 180px;
  flex-direction: column;
  gap: 5px;
  color: #475467;
  font-size: 11px;
  font-weight: 700;
}

.invoice-status-filter .form-select {
  height: 42px;
}

.invoice-recent-section .table-wrap {
  border: 1px solid #e3e7ee;
  border-radius: 12px;
}

.invoice-status-pill {
  display: inline-flex;
  border-radius: 999px;
  background: #e8f5eb;
  padding: 4px 8px;
  color: #176b2c;
  font-size: 12px;
  font-weight: 700;
}

.invoice-status-pill.is-draft {
  background: #fff4d6;
  color: #8a5a00;
}

.invoice-document-link {
  color: #244f91;
  font-weight: 700;
  white-space: nowrap;
}

.invoice-edit-draft-link {
  border: 0;
  background: transparent;
  padding: 0;
  color: #244f91;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  white-space: nowrap;
}

.invoice-edit-draft-link:hover,
.invoice-edit-draft-link:focus-visible {
  text-decoration: underline;
}

.invoice-list-row {
  cursor: pointer;
}

.invoice-list-row:hover td,
.invoice-list-row:focus-visible td {
  background: #f7faff;
}

.invoice-list-row:focus-visible {
  outline: 2px solid #244f91;
  outline-offset: -2px;
}

.invoice-finalize-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  box-sizing: border-box;
  overflow: auto;
  border: 0;
  border-radius: 18px;
  background: #fff;
  padding: 0;
  color: #101828;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
}

.invoice-finalize-dialog::backdrop {
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(2px);
}

.invoice-customer-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.invoice-customer-label-row .button-link {
  flex: 0 0 auto;
  font-size: 12px;
}

.customer-create-dialog {
  width: min(720px, calc(100vw - 32px));
}

.customer-create-intro {
  margin: 7px 0 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}

.customer-create-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 13px 16px;
  margin: 16px 0;
}

.customer-create-grid > .form-field {
  grid-column: span 6;
}

.customer-create-grid .full {
  grid-column: 1 / -1;
}

.customer-create-grid .customer-kind-field,
.customer-create-grid .customer-postal-field,
.customer-create-grid .customer-country-field,
.customer-create-grid .customer-language-field,
.customer-create-grid .customer-vat-field {
  grid-column: span 4;
}

.customer-create-grid .customer-company-field,
.customer-create-grid .customer-city-field {
  grid-column: span 8;
}

.customer-create-grid .customer-notes-field .form-textarea {
  min-height: 78px;
}

.customer-zefix-help {
  min-height: 17px;
  line-height: 1.4;
}

.customer-zefix-help.is-selected {
  color: #176b2c;
  font-weight: 700;
}

.customer-zefix-help.is-selected::before {
  content: "✓ ";
}

.customer-zefix-help.is-error {
  color: #9b1c1c;
}

.zefix-results {
  min-width: min(440px, calc(100vw - 76px));
}

.customer-post-help {
  min-height: 17px;
  line-height: 1.4;
}

.customer-post-help.is-selected {
  color: #176b2c;
  font-weight: 700;
}

.customer-post-help.is-selected::before {
  content: "✓ ";
}

.customer-post-help.is-error {
  color: #9b1c1c;
}

.swiss-post-results {
  min-width: min(440px, calc(100vw - 76px));
}

.swiss-post-place-results {
  min-width: min(300px, calc(100vw - 76px));
}

.customer-create-warning {
  margin-top: 2px;
}

#customer-create-status {
  min-height: 20px;
  margin: 12px 0 0;
}

.invoice-finalize-card {
  padding: 24px;
}

.invoice-finalize-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.invoice-finalize-header h2 {
  margin: 5px 0 0;
  font-size: 25px;
  letter-spacing: -0.03em;
}

.dialog-close {
  width: 36px;
  height: 36px;
  border: 1px solid #d0d5dd;
  border-radius: 9px;
  background: #fff;
  color: #475467;
  cursor: pointer;
  font-size: 23px;
}

.invoice-finalize-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 22px 0;
  overflow: hidden;
  border: 1px solid #e3e7ee;
  border-radius: 12px;
  background: #e3e7ee;
}

.invoice-finalize-summary > div {
  min-width: 0;
  background: #fff;
  padding: 13px 14px;
}

.invoice-finalize-summary dt,
.invoice-finalize-summary dd {
  margin: 0;
}

.invoice-finalize-summary dt {
  margin-bottom: 4px;
  color: #667085;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.invoice-finalize-summary dd {
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 800;
}

.invoice-finalize-warning {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid #f2c4bf;
  border-radius: 12px;
  background: #fff7f6;
  padding: 14px 15px;
  color: #7a271a;
  font-size: 13px;
  line-height: 1.45;
}

.invoice-finalize-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.button-danger {
  border: 1px solid #b42318;
  border-radius: 10px;
  background: #b42318;
  padding: 10px 16px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
}

.button-danger:hover {
  background: #912018;
}

.button-danger:disabled {
  cursor: wait;
  opacity: 0.62;
}

@media (max-width: 1100px) {
  .invoice-card .form-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
}

@media (max-width: 760px) {
  .customer-create-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    margin: 16px 0;
  }

  .customer-create-grid > .form-field,
  .customer-create-grid .full {
    grid-column: auto;
  }

  .zefix-results {
    min-width: 0;
  }

  .invoice-customer-label-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .invoice-card .form-grid,
  .invoice-summary-grid {
    grid-template-columns: 1fr;
  }

  .invoice-card .form-section {
    padding: 20px 18px;
  }

  .invoice-steps {
    padding: 0 12px;
  }

  .invoice-section-heading-row,
  .invoice-created-panel,
  .invoice-created-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .invoice-item-tools,
  .invoice-article-picker {
    width: 100%;
  }

  .invoice-items-sticky-heading {
    top: 0;
    margin: -6px -2px 14px;
    padding: 8px 2px 10px;
  }

  .invoice-totals {
    position: static;
  }

  .invoice-created-panel {
    margin: 18px;
  }

  .invoice-recent-summary {
    padding: 20px 50px 20px 18px;
  }

  .invoice-recent-summary::after {
    right: 20px;
  }

  .invoice-recent-content {
    padding: 0 18px 22px;
  }

  .invoice-recent-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .invoice-recent-toolbar .table-search,
  .invoice-status-filter {
    width: 100%;
    max-width: none;
    flex: 0 0 auto;
  }

  .invoice-form-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .invoice-submit-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .invoice-form-actions .button-primary,
  .invoice-submit-actions .button-secondary {
    width: 100%;
  }
}

/* --- Login and settings --- */

.login-page {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(75, 113, 176, 0.2), transparent 34%),
    linear-gradient(145deg, #0b1220 0%, #15223b 55%, #0f172a 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  box-sizing: border-box;
}

.login-card {
  width: min(430px, 100%);
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.97);
  padding: 38px;
  box-shadow: 0 30px 80px rgba(2, 6, 23, 0.42);
}

.login-logo {
  display: block;
  width: 188px;
  max-width: 70%;
  height: 58px;
  object-fit: cover;
  object-position: center;
  margin-bottom: 24px;
  border-radius: 10px;
}

.login-kicker {
  color: #244f91;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.login-card h1 {
  margin: 7px 0 8px;
  color: #101828;
  font-size: 32px;
  letter-spacing: -0.04em;
}

.login-card > p {
  margin: 0 0 24px;
  color: #667085;
  line-height: 1.5;
}

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

.login-form label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.login-form .form-input {
  height: 48px;
}

.login-form .button-primary {
  width: 100%;
  height: 50px;
  margin-top: 4px;
}

.login-error {
  margin: 0 0 18px;
  border: 1px solid #f2c4bf;
  border-radius: 10px;
  background: #fff4f2;
  padding: 11px 12px;
  color: #b42318;
  font-size: 13px;
}

.login-security-note {
  display: block;
  margin-top: 18px;
  color: #667085;
  font-size: 11px;
  text-align: center;
}

.app-sidebar {
  display: flex;
  flex-direction: column;
}

.sidebar-account {
  display: grid;
  gap: 7px;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 18px;
  color: #cbd5e1;
  font-size: 12px;
}

.sidebar-account form {
  margin: 0;
}

.sidebar-account button {
  border: 0;
  background: transparent;
  padding: 0;
  color: #8fb2ee;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.settings-workspace {
  padding: 28px;
  background: #f8fafc;
}

.settings-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, #101d35 0%, #244f91 100%);
  padding: 22px 24px;
  color: #fff;
}

.settings-hero h3 {
  margin: 5px 0 3px;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.settings-hero p {
  margin: 0;
  color: #dbe7fb;
  font-size: 13px;
}

.settings-hero .invoice-created-kicker {
  color: #b9cff1;
}

.settings-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-hero-actions form {
  margin: 0;
}

.settings-hero-actions .button-secondary {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.settings-security-badge {
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
}

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

.settings-panel {
  min-width: 0;
  border: 1px solid #e3e7ee;
  border-radius: 16px;
  background: #fff;
  padding: 22px;
}

.settings-users-panel {
  grid-column: 1 / -1;
}

.settings-panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.settings-panel-heading h3 {
  margin: 0 0 5px;
  color: #101828;
  font-size: 18px;
}

.settings-panel-heading p {
  margin: 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}

.settings-review-note {
  margin-bottom: 14px;
  border: 1px solid #efd28b;
  border-radius: 10px;
  background: #fffaeb;
  padding: 10px 12px;
  color: #854a0e;
  font-size: 12px;
}

.settings-users-wrap {
  margin-top: 8px;
  border: 1px solid #e3e7ee;
  border-radius: 12px;
}

.settings-users-table th {
  background: #f8fafc;
  color: #475467;
  font-size: 11px;
  text-transform: uppercase;
}

.settings-users-table tr.is-inactive {
  opacity: 0.62;
}

.settings-user-identity {
  display: grid;
  gap: 3px;
}

.settings-user-identity span {
  color: #667085;
  font-size: 11px;
}

.settings-user-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 800;
}

.settings-user-status.is-active {
  background: #eaf7ee;
  color: #176b2c;
}

.settings-user-status.is-inactive {
  background: #f2f4f7;
  color: #667085;
}

.settings-user-edit {
  min-height: 34px;
  padding: 6px 10px;
}

.settings-check-list {
  display: grid;
  gap: 10px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}

.settings-check-list li {
  position: relative;
  padding-left: 24px;
  color: #344054;
  font-size: 13px;
}

.settings-check-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #176b2c;
  font-weight: 900;
}

.settings-facts {
  display: grid;
  gap: 0;
  margin: 0;
}

.settings-facts div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid #eef1f5;
  padding: 11px 0;
}

.settings-facts div:last-child {
  border-bottom: 0;
}

.settings-facts dt {
  color: #667085;
  font-size: 12px;
}

.settings-facts dd {
  margin: 0;
  color: #101828;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.settings-dialog {
  width: min(620px, calc(100vw - 28px));
}

.settings-dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0;
}

.settings-dialog-grid .full {
  grid-column: 1 / -1;
}

@media (max-width: 980px) {
  .app-sidebar {
    display: grid;
  }

  .sidebar-account {
    display: none;
  }
}

@media (max-width: 720px) {
  .login-card {
    padding: 28px 22px;
  }

  .settings-workspace {
    padding: 18px;
  }

  .settings-hero,
  .settings-panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-hero-actions {
    justify-content: space-between;
  }

  .settings-grid,
  .settings-dialog-grid {
    grid-template-columns: 1fr;
  }

  .settings-users-panel,
  .settings-dialog-grid .full {
    grid-column: auto;
  }

  .settings-panel-heading .button-primary {
    width: 100%;
  }

  .settings-users-table th:nth-child(4),
  .settings-users-table td:nth-child(4) {
    display: none;
  }

  .settings-users-wrap {
    overflow: visible;
    border: 0;
  }

  .settings-users-table,
  .settings-users-table tbody,
  .settings-users-table tr,
  .settings-users-table td {
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  .settings-users-table thead {
    display: none;
  }

  .settings-users-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 8px 10px;
    border: 1px solid #e3e7ee;
    border-radius: 12px;
    padding: 12px;
  }

  .settings-users-table td {
    border: 0;
    padding: 0;
  }

  .settings-users-table td:first-child {
    grid-column: 1 / -1;
    padding-bottom: 5px;
  }

  .settings-users-table td:nth-child(2) {
    color: #475467;
    font-size: 12px;
  }

  .settings-user-edit {
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .app-sidebar {
    padding: 10px 12px 8px;
  }

  .sidebar-nav {
    padding-bottom: 2px;
  }

  .sidebar-nav a {
    padding: 8px 9px;
  }

  .app-main {
    padding: 18px 12px 36px;
  }

  .invoice-steps li {
    gap: 5px;
    padding-right: 3px;
    padding-left: 3px;
    font-size: 10px;
  }

  .invoice-steps li span {
    width: 21px;
    height: 21px;
  }

  .invoice-item-tools {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .invoice-running-total {
    align-self: flex-end;
  }

  .invoice-finalize-summary {
    grid-template-columns: 1fr;
  }

  .invoice-finalize-card {
    padding: 20px 18px;
  }

  .invoice-finalize-actions {
    flex-direction: column-reverse;
  }

  .invoice-finalize-actions button {
    width: 100%;
  }
}

/* --- Purchase invoice extraction and review --- */

.purchase-invoice-card .card-header {
  background: linear-gradient(180deg, #fff 0%, #fbfcff 100%);
}

.purchase-import-workspace {
  min-width: 0;
  background: #fff;
}

.purchase-upload-section {
  padding: 28px;
}

.purchase-dropzone {
  display: flex;
  width: 100%;
  min-height: 210px;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  border: 2px dashed #aebfd8;
  border-radius: 16px;
  background: linear-gradient(145deg, #fbfdff, #f5f8fc);
  color: #344054;
  cursor: pointer;
  font: inherit;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.purchase-dropzone:hover,
.purchase-dropzone:focus-visible,
.purchase-dropzone.is-dragging {
  border-color: #244f91;
  background: #eef4ff;
  outline: 0;
  transform: translateY(-1px);
}

.purchase-dropzone-icon {
  display: inline-flex;
  width: 50px;
  height: 50px;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  border-radius: 14px;
  background: #244f91;
  color: #fff;
  font-size: 27px;
  font-weight: 800;
}

.purchase-dropzone strong {
  color: #101828;
  font-size: 18px;
}

.purchase-dropzone span:last-child {
  color: #667085;
  font-size: 13px;
}

.purchase-upload-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 18px;
}

.purchase-upload-actions > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.purchase-upload-actions strong,
.purchase-upload-actions span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-upload-actions span {
  color: #667085;
  font-size: 12px;
}

.purchase-upload-actions .button-primary:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.purchase-extraction-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  border-radius: 10px;
  background: #f8fafc;
  padding: 12px 14px;
  color: #475467;
  font-size: 12px;
}

.purchase-extraction-progress .bar {
  width: 120px;
  flex: 0 0 120px;
}

#purchase-extraction-status {
  display: block;
  margin-top: 13px;
}

.purchase-review {
  min-width: 0;
  padding: 26px 28px 28px;
}

.purchase-review-toolbar,
.purchase-panel-heading,
.purchase-review-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.purchase-review-toolbar {
  align-items: center;
  margin-bottom: 18px;
}

.purchase-review-toolbar h3,
.purchase-panel-heading h4 {
  margin: 4px 0;
  color: #101828;
}

.purchase-review-toolbar h3 {
  font-size: 22px;
  letter-spacing: -0.025em;
}

.purchase-review-toolbar p,
.purchase-panel-heading span {
  margin: 0;
  color: #667085;
  font-size: 12px;
}

.purchase-review-warnings {
  margin-bottom: 18px;
  border: 1px solid #efd28b;
  border-radius: 12px;
  background: #fffbeb;
  padding: 13px 15px;
  color: #7a5200;
  font-size: 12px;
}

.purchase-review-warnings ul {
  margin: 7px 0 0;
  padding-left: 18px;
}

.purchase-review-warnings li + li {
  margin-top: 4px;
}

.purchase-manual-entry {
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid #b8c9e4;
  border-radius: 14px;
  background: #f7faff;
}

.purchase-manual-entry .purchase-panel-heading {
  align-items: center;
  background: #eef4ff;
}

.purchase-manual-entry .purchase-panel-heading > div {
  min-width: 0;
}

.purchase-manual-body {
  padding: 16px;
}

.purchase-manual-body > p {
  margin: 0 0 11px;
  color: #475467;
  font-size: 12px;
  line-height: 1.5;
}

#purchase-paste-rows {
  min-height: 150px;
  resize: vertical;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre;
}

.purchase-manual-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
}

.purchase-manual-actions > div {
  display: flex;
  flex: 0 0 auto;
  gap: 9px;
}

.purchase-manual-actions .form-note {
  margin: 0;
}

.purchase-review-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.25fr) minmax(330px, 0.75fr);
  align-items: start;
  gap: 18px;
}

.purchase-source-panel,
.purchase-header-panel,
.purchase-lines-section {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e3e7ee;
  border-radius: 14px;
  background: #fff;
}

.purchase-panel-heading {
  align-items: baseline;
  border-bottom: 1px solid #e9edf2;
  background: #f8fafc;
  padding: 13px 15px;
}

.purchase-panel-heading h4 {
  font-size: 14px;
}

#purchase-pdf-preview,
#purchase-image-preview {
  display: block;
  width: 100%;
  height: 620px;
  box-sizing: border-box;
  border: 0;
  background: #eef1f5;
  object-fit: contain;
}

.purchase-header-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px;
}

.purchase-header-grid .form-field {
  min-width: 0;
}

.purchase-price-basis-field {
  border: 1px solid #aec2e2;
  border-radius: 12px;
  background: #f3f7fd;
  padding: 13px;
}

.purchase-price-basis-field.needs-review {
  border-color: #e0b34f;
  background: #fffbeb;
}

.purchase-price-basis-title {
  color: #173f7a;
  font-size: 13px;
  font-weight: 800;
}

.purchase-price-basis-field.needs-review .purchase-price-basis-title {
  color: #8a5a00;
}

#purchase-price-basis {
  margin-top: 7px;
  font-weight: 700;
}

#purchase-price-basis-help {
  display: block;
  margin-top: 7px;
  color: #475467;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
}

.purchase-lines-section {
  margin-top: 20px;
}

.purchase-lines-heading {
  align-items: center;
}

.purchase-lines-heading > div {
  min-width: 0;
}

.purchase-lines-heading strong {
  color: #244f91;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.purchase-lines-wrap {
  max-height: 720px;
  overflow: auto;
}

#purchase-lines-table {
  min-width: 1250px;
}

#purchase-lines-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f4f6f8;
}

#purchase-lines-table td {
  min-width: 110px;
  vertical-align: top;
  padding: 12px 10px;
}

#purchase-lines-table td:nth-child(1) {
  width: 130px;
}

#purchase-lines-table td:nth-child(2) {
  width: 235px;
}

#purchase-lines-table td:nth-child(3),
#purchase-lines-table td:nth-child(4) {
  width: 220px;
}

#purchase-lines-table td:nth-child(5) {
  width: 270px;
}

.purchase-line-row.is-review td:first-child {
  box-shadow: inset 4px 0 #d69e2e;
}

.purchase-line-row.is-ready td:first-child {
  box-shadow: inset 4px 0 #2f855a;
}

.purchase-status-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}

.purchase-status-badge.is-ready {
  background: #e8f5eb;
  color: #176b2c;
}

.purchase-status-badge.is-new {
  background: #efe7f8;
  color: #68408f;
}

.purchase-status-badge.is-review {
  background: #fff4d6;
  color: #8a5a00;
}

.purchase-status-badge.is-neutral {
  background: #eef1f5;
  color: #475467;
}

.purchase-line-warning,
.purchase-match-note {
  display: block;
  margin-top: 7px;
  color: #667085;
  font-size: 10px;
  line-height: 1.35;
}

.purchase-line-type,
.purchase-line-input {
  width: 100%;
  height: 34px;
  box-sizing: border-box;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  padding: 6px 8px;
  color: #101828;
  font: inherit;
  font-size: 12px;
}

.purchase-line-input + .purchase-line-input,
.purchase-line-type + .purchase-line-input {
  margin-top: 6px;
}

.purchase-line-input.is-primary {
  font-weight: 700;
}

.purchase-line-mini-grid,
.purchase-quantity-grid,
.purchase-price-grid {
  display: grid;
  gap: 6px;
}

.purchase-line-mini-grid {
  grid-template-columns: 1fr 0.8fr;
  margin-top: 6px;
}

.purchase-quantity-grid,
.purchase-price-grid {
  grid-template-columns: repeat(3, minmax(62px, 1fr));
}

.purchase-quantity-grid label,
.purchase-price-grid label {
  min-width: 0;
  color: #667085;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.purchase-quantity-grid .purchase-line-input,
.purchase-price-grid .purchase-line-input {
  margin-top: 4px;
}

.purchase-match-select {
  height: auto;
  min-height: 38px;
  font-size: 11px;
}

.purchase-new-article-button {
  margin-top: 8px;
}

.purchase-muted-cell {
  color: #667085;
  font-size: 12px;
}

.purchase-evidence summary {
  color: #244f91;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.purchase-evidence span {
  display: block;
  max-width: 190px;
  margin-top: 7px;
  color: #667085;
  font-size: 10px;
  line-height: 1.4;
  white-space: normal;
}

.purchase-review-footer {
  align-items: center;
  margin-top: 18px;
  border: 1px solid #b7dfc3;
  border-radius: 12px;
  background: #f3fbf5;
  padding: 14px 15px;
  color: #176b2c;
}

.purchase-review-footer > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.purchase-review-footer .purchase-review-footer-actions {
  align-items: flex-end;
  gap: 10px;
}

.purchase-review-footer span {
  font-size: 11px;
}

#purchase-model-note {
  color: #667085;
  text-align: right;
}

.purchase-receipt-dialog {
  width: min(720px, calc(100vw - 32px));
}

.purchase-receipt-plan {
  display: grid;
  gap: 9px;
  margin: 18px 0;
}

.purchase-receipt-plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid #dfe5ec;
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px 13px;
}

.purchase-receipt-plan-row > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.purchase-receipt-plan-row strong {
  overflow: hidden;
  color: #101828;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-receipt-plan-row > div > span {
  color: #667085;
  font-size: 11px;
  line-height: 1.4;
}

.purchase-receipt-plan-row.is-create_new {
  border-color: #d7c4ed;
  background: #fbf8ff;
}

.purchase-receipt-action {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  background: #e8f5eb;
  color: #176b2c;
  font-size: 10px;
  font-weight: 800;
}

.purchase-receipt-action.is-create_new {
  background: #efe7f8;
  color: #68408f;
}

#purchase-receipt-status {
  min-height: 18px;
  margin: 12px 0 0;
}

.purchase-new-article-dialog {
  width: min(860px, calc(100vw - 32px));
}

.purchase-new-article-intro {
  max-width: 620px;
  margin: 7px 0 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}

.purchase-required-note {
  margin: 7px 0 0;
  color: #667085;
  font-size: 11px;
  font-weight: 600;
}

.purchase-new-article-dialog .form-input.is-invalid,
.purchase-new-article-dialog .form-select.is-invalid,
.purchase-new-article-dialog .form-textarea.is-invalid {
  border-color: #c62828;
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.1);
}

.purchase-new-article-source {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(2, minmax(130px, 0.65fr));
  gap: 10px;
  margin: 20px 0;
}

.purchase-new-article-source > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  border: 1px solid #d9e3f1;
  border-radius: 11px;
  background: #f6f9fd;
  padding: 11px 12px;
}

.purchase-new-article-source span {
  color: #667085;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.purchase-new-article-source strong {
  overflow: hidden;
  color: #173f7a;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-new-article-section {
  margin-top: 17px;
  border-top: 1px solid #eaecf0;
  padding-top: 16px;
}

.purchase-new-article-section h3 {
  margin: 0 0 12px;
  color: #344054;
  font-size: 13px;
}

.purchase-new-article-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 16px;
}

.purchase-new-article-grid .full {
  grid-column: 1 / -1;
}

.purchase-new-article-assurance {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 19px;
  border: 1px solid #b7dfc3;
  border-radius: 11px;
  background: #f3fbf5;
  padding: 12px 13px;
  color: #176b2c;
}

.purchase-new-article-assurance strong {
  font-size: 12px;
}

.purchase-new-article-assurance span {
  font-size: 11px;
  line-height: 1.45;
}

#purchase-new-article-status {
  min-height: 18px;
  margin: 11px 0 0;
}

#purchase-new-article-status.is-error {
  color: #b42318;
  font-weight: 700;
}

@media (max-width: 1100px) {
  .purchase-review-grid {
    grid-template-columns: 1fr;
  }

  #purchase-pdf-preview,
  #purchase-image-preview {
    height: 520px;
  }
}

@media (max-width: 760px) {
  .purchase-upload-section,
  .purchase-review {
    padding: 20px 18px;
  }

  .purchase-upload-actions,
  .purchase-review-toolbar,
  .purchase-review-footer,
  .purchase-manual-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .purchase-upload-actions .button-primary,
  .purchase-review-toolbar .button-secondary,
  .purchase-manual-actions button {
    width: 100%;
  }

  .purchase-manual-actions > div {
    flex-direction: column-reverse;
  }

  .purchase-header-grid {
    grid-template-columns: 1fr;
  }

  #purchase-pdf-preview,
  #purchase-image-preview {
    height: 420px;
  }

  #purchase-model-note {
    text-align: left;
  }

  .purchase-review-footer .purchase-review-footer-actions {
    align-items: stretch;
  }

  #purchase-review-receipt {
    width: 100%;
  }

  .purchase-receipt-plan-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .purchase-new-article-source,
  .purchase-new-article-grid {
    grid-template-columns: 1fr;
  }

  .purchase-new-article-grid .full {
    grid-column: auto;
  }
}

/* --- Wine data cleanup preview --- */

.cleanup-card > summary {
  align-items: center;
}

.cleanup-preview-badge,
.cleanup-decision {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.cleanup-preview-badge {
  border: 1px solid #b9cbee;
  background: #f2f6fd;
  color: #244f91;
}

.cleanup-workspace {
  padding: 0 24px 26px;
}

.cleanup-safety-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #b7dfc3;
  border-radius: 13px;
  background: #f3fbf5;
  padding: 15px 16px;
}

.cleanup-safety-banner > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #176b2c;
}

.cleanup-safety-banner strong {
  font-size: 13px;
}

.cleanup-safety-banner span {
  font-size: 11px;
  line-height: 1.45;
}

.cleanup-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.cleanup-summary-grid > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
  border: 1px solid #d9e3f1;
  border-radius: 12px;
  background: #f8fafd;
  padding: 13px 15px;
}

.cleanup-summary-grid > div.is-ready {
  border-color: #b7dfc3;
  background: #f4fbf6;
}

.cleanup-summary-grid > div.is-review {
  border-color: #f0d49c;
  background: #fffaf0;
}

.cleanup-summary-grid > div.is-confirmed {
  border-color: #b9cbee;
  background: #f2f6fd;
}

.cleanup-summary-grid span {
  overflow: hidden;
  color: #667085;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.cleanup-summary-grid strong {
  color: #173f7a;
  font-size: 24px;
  line-height: 1;
}

.cleanup-coverage-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 16px;
  border: 1px solid #b9cbee;
  border-radius: 13px;
  background: #f2f6fd;
  padding: 15px 16px;
}

.cleanup-coverage-panel > div:first-child {
  display: grid;
  gap: 4px;
}

.cleanup-coverage-panel strong {
  color: #173f7a;
  font-size: 14px;
}

.cleanup-coverage-panel p {
  margin: 0;
  color: #52647d;
  font-size: 11px;
  line-height: 1.45;
}

.cleanup-coverage-actions {
  display: grid;
  min-width: 240px;
  gap: 9px;
}

.cleanup-coverage-actions progress {
  width: 100%;
  height: 9px;
  accent-color: #24579b;
}

.cleanup-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(180px, 0.7fr) minmax(210px, 0.8fr);
  align-items: end;
  gap: 13px;
  border: 1px solid #e4e9f0;
  border-radius: 12px;
  background: #fff;
  padding: 13px;
}

.cleanup-protection-note {
  display: flex;
  min-height: 42px;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  border-left: 3px solid #2e6eb8;
  padding-left: 11px;
}

.cleanup-protection-note strong {
  color: #173f7a;
  font-size: 12px;
}

.cleanup-protection-note span {
  color: #667085;
  font-size: 10px;
}

.cleanup-status {
  min-height: 18px;
  margin: 13px 2px 9px;
}

.cleanup-table-wrap {
  border: 1px solid #e4e9f0;
  border-radius: 12px;
}

.cleanup-table {
  min-width: 1080px;
}

.cleanup-table th {
  background: #f7f9fc;
  color: #475467;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cleanup-table td {
  vertical-align: top;
  border-bottom: 1px solid #eaecf0;
  padding-top: 13px;
  padding-bottom: 13px;
}

.cleanup-table td:first-child,
.cleanup-table td:nth-child(2),
.cleanup-table td:last-child {
  min-width: 135px;
}

.cleanup-table td > strong,
.cleanup-table td > span {
  display: block;
}

.cleanup-table td > span {
  margin-top: 4px;
  color: #667085;
  font-size: 10px;
}

.cleanup-row.is-review {
  background: #fffdf8;
}

.cleanup-row.is-confirmed {
  background: #f8fbff;
}

.cleanup-row.is-stale {
  background: #fffaf0;
}

.cleanup-row.is-incomplete {
  background: #fff8f5;
}

.cleanup-change {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  min-width: 180px;
}

.cleanup-change > span:first-child {
  color: #667085;
  font-size: 11px;
}

.cleanup-change-arrow {
  color: #2e6eb8;
  font-weight: 800;
}

.cleanup-change strong {
  color: #173f7a;
  font-size: 11px;
}

.cleanup-change.is-same .cleanup-change-arrow,
.cleanup-change.is-same strong {
  color: #667085;
}

.cleanup-description-preview {
  display: flex;
  min-width: 190px;
  flex-direction: column;
  gap: 3px;
  border-left: 3px solid #cad7ea;
  padding-left: 9px;
}

.cleanup-description-preview strong,
.cleanup-description-preview span {
  color: #344054;
  font-size: 11px;
  line-height: 1.35;
}

.cleanup-decision.is-ready {
  background: #e8f5eb;
  color: #176b2c;
}

.cleanup-decision.is-review {
  background: #fff0cf;
  color: #8a5700;
}

.cleanup-decision.is-unchanged {
  background: #eef2f6;
  color: #475467;
}

.cleanup-decision.is-confirmed {
  background: #e6effc;
  color: #244f91;
}

.cleanup-decision.is-stale {
  background: #fff0cf;
  color: #8a5700;
}

.cleanup-decision.is-incomplete {
  background: #fee8e2;
  color: #9f2d1f;
}

.cleanup-decision-reason,
.cleanup-fingerprint {
  display: block;
  max-width: 190px;
  margin-top: 7px;
  color: #667085;
  font-size: 10px;
  line-height: 1.4;
}

.cleanup-review-button {
  display: block;
  width: 100%;
  max-width: 190px;
  margin-top: 9px;
  padding: 7px 9px;
  font-size: 10px;
}

.cleanup-decision-dialog {
  width: min(1040px, calc(100vw - 32px));
}

.cleanup-decision-meta {
  max-width: 560px;
  margin: 6px 0 0;
  color: #667085;
  font-size: 12px;
}

.cleanup-entry-overview {
  margin-top: 20px;
  border: 1px solid #d9e3f1;
  border-radius: 14px;
  background: #f8fafd;
  padding: 16px;
}

.cleanup-entry-overview-heading,
.cleanup-proposal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.cleanup-entry-overview-heading h3,
.cleanup-proposal-heading h3 {
  margin: 4px 0 0;
  color: #173f7a;
  font-size: 16px;
}

.cleanup-entry-overview-note {
  margin: 6px 0 0;
  color: #667085;
  font-size: 11px;
  line-height: 1.45;
}

.cleanup-entry-state {
  border-radius: 999px;
  padding: 5px 9px;
  background: #e8f5eb;
  color: #176b2c;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cleanup-entry-state.is-inactive {
  background: #f2f4f7;
  color: #667085;
}

#cleanup-decision-form.is-inactive-entry .required {
  opacity: 0.28;
}

.cleanup-entry-editor-grid,
.cleanup-commercial-editor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px 14px;
  margin-top: 18px;
  border: 1px solid #cddbf0;
  border-radius: 12px;
  background: #fff;
  padding: 14px;
}

.cleanup-entry-editor-grid .form-field,
.cleanup-commercial-editor-grid .form-field {
  min-width: 0;
}

.cleanup-entry-editor-grid .form-input,
.cleanup-commercial-editor-grid .form-input {
  background: #fff;
}

.cleanup-commercial-heading,
.cleanup-reference-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
}

.cleanup-commercial-heading p,
.cleanup-reference-heading p {
  max-width: 430px;
  margin: 0;
  color: #667085;
  font-size: 10px;
  line-height: 1.45;
  text-align: right;
}

.cleanup-checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: #fff;
  padding: 9px 11px;
  cursor: pointer;
}

.cleanup-checkbox-field input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #24579b;
}

.cleanup-checkbox-field span {
  display: grid;
  gap: 2px;
}

.cleanup-checkbox-field strong {
  color: #344054;
  font-size: 11px;
}

.cleanup-checkbox-field small {
  color: #667085;
  font-size: 9px;
  line-height: 1.35;
}

.cleanup-entry-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 14px 0 0;
}

.cleanup-entry-facts > div {
  min-width: 0;
  border: 1px solid #e4e9f0;
  border-radius: 10px;
  background: #fff;
  padding: 9px 10px;
}

.cleanup-entry-facts > div.is-protected {
  border-color: #b7dfc3;
  background: #f4fbf6;
}

.cleanup-protected-facts > div {
  border-color: #b7dfc3;
  background: #f4fbf6;
}

.cleanup-entry-facts > div.full {
  grid-column: 1 / -1;
}

.cleanup-entry-facts dt {
  margin-bottom: 4px;
  color: #667085;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cleanup-entry-facts dd {
  overflow-wrap: anywhere;
  margin: 0;
  color: #344054;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.4;
}

.cleanup-entry-description pre {
  margin: 0;
  color: #344054;
  font: inherit;
  white-space: pre-wrap;
}

.cleanup-proposal-heading {
  margin-top: 20px;
  border-top: 1px solid #eaecf0;
  padding-top: 18px;
}

.cleanup-proposal-heading > span {
  max-width: 260px;
  color: #667085;
  font-size: 10px;
  line-height: 1.45;
  text-align: right;
}

.cleanup-decision-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
  margin-top: 20px;
}

.cleanup-decision-grid .full {
  grid-column: 1 / -1;
}

.cleanup-decision-assurance {
  margin-top: 18px;
  border: 1px solid #b7dfc3;
  border-radius: 11px;
  background: #f3fbf5;
  padding: 11px 13px;
  color: #176b2c;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

#cleanup-decision-status {
  min-height: 18px;
  margin: 10px 0 0;
}

#cleanup-decision-reset {
  margin-right: auto;
}

.cleanup-fingerprint {
  margin-top: 5px;
  color: #2e6eb8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
}

.harmonization-panel {
  margin: 18px 0 22px;
  border: 1px solid #cad8ee;
  border-radius: 16px;
  background: linear-gradient(180deg, #f7faff 0%, #fff 190px);
  padding: 20px;
}

.harmonization-heading,
.harmonization-progress,
.harmonization-group-header,
.harmonization-group-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.harmonization-heading h3 {
  margin: 3px 0 5px;
  color: #17253f;
  font-size: 18px;
}

.harmonization-heading p,
.harmonization-progress p,
.harmonization-group-header p,
.harmonization-section-note {
  margin: 0;
  color: #667085;
  font-size: 11px;
  line-height: 1.5;
}

.harmonization-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 17px;
}

.harmonization-summary > div {
  border: 1px solid #e1e8f3;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.92);
  padding: 11px 13px;
}

.harmonization-summary span,
.harmonization-summary strong {
  display: block;
}

.harmonization-summary span {
  color: #667085;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.harmonization-summary strong {
  margin-top: 5px;
  color: #1f3f74;
  font-size: 16px;
}

.harmonization-progress {
  margin-top: 12px;
  border-radius: 12px;
  background: #eaf2ff;
  padding: 13px 15px;
}

.harmonization-progress strong {
  display: block;
  margin-bottom: 3px;
  color: #1f4e91;
  font-size: 12px;
}

.harmonization-review-section {
  margin-top: 14px;
  border: 1px solid #e3e8ef;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.harmonization-review-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  color: #17253f;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
}

.harmonization-review-section > summary::-webkit-details-marker {
  display: none;
}

.harmonization-review-section > summary::after {
  content: "⌄";
  margin-left: 4px;
  color: #2e6eb8;
  font-size: 15px;
}

.harmonization-review-section[open] > summary::after {
  transform: rotate(180deg);
}

.harmonization-review-section > summary strong {
  margin-left: auto;
  color: #8a4b17;
  font-size: 10px;
}

.harmonization-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.35fr);
  gap: 12px;
  border-top: 1px solid #edf0f4;
  background: #fafbfc;
  padding: 13px 16px;
}

.harmonization-section-note {
  border-top: 1px solid #edf0f4;
  padding: 12px 16px 0;
}

.harmonization-groups {
  display: grid;
  gap: 12px;
  max-height: 780px;
  overflow: auto;
  padding: 14px 16px 16px;
}

.harmonization-group-card {
  border: 1px solid #e0e6ef;
  border-left: 4px solid #d58a37;
  border-radius: 12px;
  background: #fff;
  padding: 14px;
}

.harmonization-group-card.is-strong {
  border-left-color: #2e6eb8;
}

.harmonization-group-card.is-reviewed {
  border-left-color: #2f8f4e;
  background: #fbfefc;
}

.harmonization-group-header {
  align-items: flex-start;
}

.harmonization-group-header h4 {
  margin: 4px 0;
  color: #17253f;
  font-size: 13px;
  line-height: 1.35;
}

.harmonization-confidence,
.harmonization-review-state {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.harmonization-confidence.is-strong {
  background: #eaf2ff;
  color: #1f4e91;
}

.harmonization-confidence.is-possible {
  background: #fff5e8;
  color: #8a4b17;
}

.harmonization-confidence.is-duplicate {
  background: #f4eefe;
  color: #6941c6;
}

.harmonization-review-state {
  background: #fff4e5;
  color: #8a4b17;
}

.harmonization-review-state.is-reviewed {
  background: #e9f8ee;
  color: #176b2c;
}

.producer-variant-list,
.duplicate-article-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.producer-variant-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.42fr);
  align-items: center;
  gap: 14px;
  border-radius: 9px;
  background: #f7f9fc;
  padding: 10px 12px;
}

.producer-variant-row > div strong,
.producer-variant-row > div span,
.producer-variant-row label > span,
.duplicate-article-row strong,
.duplicate-article-row span {
  display: block;
}

.producer-variant-row > div strong,
.duplicate-article-row strong {
  color: #26364f;
  font-size: 11px;
}

.producer-variant-row > div span,
.duplicate-article-row span {
  margin-top: 3px;
  color: #667085;
  font-size: 9px;
  line-height: 1.4;
}

.producer-variant-row label > span {
  margin-bottom: 4px;
  color: #667085;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.producer-variant-row select {
  width: 100%;
}

.duplicate-article-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.34fr);
  align-items: center;
  gap: 14px;
  border-radius: 9px;
  background: #f7f9fc;
  padding: 9px 11px;
}

.duplicate-article-row label > span {
  display: block;
  margin-bottom: 4px;
  color: #667085;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.duplicate-action-select {
  width: 100%;
}

.harmonization-group-actions {
  justify-content: flex-end;
  margin-top: 12px;
  border-top: 1px solid #edf0f4;
  padding-top: 11px;
}

.harmonization-group-actions .button-link:first-child {
  margin-right: auto;
}

@media (max-width: 900px) {
  .cleanup-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .cleanup-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .cleanup-protection-note {
    grid-column: 1 / -1;
  }

  .cleanup-entry-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cleanup-entry-editor-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cleanup-commercial-editor-grid,
  .cleanup-decision-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .harmonization-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .cleanup-workspace {
    padding: 0 14px 18px;
  }

  .cleanup-safety-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .cleanup-coverage-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .cleanup-coverage-actions {
    min-width: 0;
  }

  .cleanup-summary-grid,
  .cleanup-toolbar {
    grid-template-columns: 1fr;
  }

  .cleanup-protection-note {
    grid-column: auto;
  }

  .cleanup-decision-grid {
    grid-template-columns: 1fr;
  }

  .cleanup-decision-grid .full {
    grid-column: auto;
  }

  .cleanup-entry-overview-heading,
  .cleanup-proposal-heading,
  .cleanup-commercial-heading,
  .cleanup-reference-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .cleanup-proposal-heading > span,
  .cleanup-commercial-heading p,
  .cleanup-reference-heading p {
    max-width: none;
    text-align: left;
  }

  .cleanup-entry-editor-grid,
  .cleanup-commercial-editor-grid,
  .cleanup-entry-facts {
    grid-template-columns: 1fr;
  }

  .cleanup-entry-facts > div.full {
    grid-column: auto;
  }

  .harmonization-panel {
    padding: 14px;
  }

  .harmonization-heading,
  .harmonization-progress,
  .harmonization-group-header,
  .harmonization-group-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .harmonization-summary,
  .harmonization-toolbar,
  .producer-variant-row,
  .duplicate-article-row {
    grid-template-columns: 1fr;
  }

  .harmonization-group-actions .button-link:first-child {
    margin-right: 0;
  }
}

/* Horizontal shell overrides belong last so legacy component rules cannot
   reintroduce the former sidebar layout. */
body .app-shell {
  display: block;
  min-height: 100vh;
}

body .app-sidebar {
  position: sticky;
  z-index: 100;
  top: 0;
  width: 100%;
  height: 72px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "brand nav sync account";
  align-items: center;
  flex-direction: initial;
  gap: 18px;
  box-sizing: border-box;
  padding: 10px clamp(18px, 2.7vw, 42px);
}

body .sidebar-brand {
  grid-area: brand;
  width: 156px;
  min-width: 156px;
  margin: 0;
}

body .sidebar-logo-frame {
  width: 156px;
  height: 48px;
  border-radius: 11px;
}

body .sidebar-logo {
  width: 166px;
}

body .sidebar-product-label {
  display: none;
}

body .sidebar-nav {
  grid-area: nav;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 3px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
}

body .sidebar-nav a {
  position: relative;
  flex: 0 0 auto;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  scroll-margin-top: 92px;
}

body .sidebar-nav a.is-active {
  background: rgba(143, 178, 238, 0.16);
  box-shadow: inset 0 -3px 0 #8fb2ee;
}

body .sidebar-sync-card {
  position: relative;
  grid-area: sync;
  margin: 0;
  overflow: visible;
  border-radius: 11px;
}

body .sidebar-sync-summary {
  min-height: 40px;
  padding: 7px 10px;
}

body .sidebar-sync-summary > span:first-child {
  font-size: 0;
}

body .sidebar-sync-summary > span:first-child::after {
  content: "Sync";
  font-size: 12px;
}

body .sidebar-sync-content {
  position: absolute;
  z-index: 110;
  top: calc(100% + 9px);
  right: 0;
  width: min(300px, calc(100vw - 32px));
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: #0f172a;
  padding: 0 12px 12px;
}

body .sidebar-account {
  grid-area: account;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  border: 0;
  padding: 0;
  white-space: nowrap;
}

body .sidebar-account > span {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

body .sidebar-account form {
  padding-left: 9px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}

body .app-main {
  width: min(100%, 1840px);
  max-width: none;
  margin: 0 auto;
  padding: 26px clamp(18px, 2.7vw, 42px) 56px;
}

body .review-mode-banner {
  top: 82px;
}

@media (max-width: 1220px) {
  body .app-sidebar {
    gap: 10px;
  }

  body .sidebar-nav {
    justify-content: flex-start;
  }

  body .sidebar-account > span {
    display: none;
  }
}

@media (max-width: 980px) {
  body .app-sidebar {
    height: auto;
    min-height: 98px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand sync"
      "nav nav";
    gap: 7px 12px;
    padding: 9px 16px 8px;
  }

  body .sidebar-brand {
    width: 136px;
    min-width: 136px;
  }

  body .sidebar-logo-frame {
    width: 136px;
    height: 42px;
  }

  body .sidebar-logo {
    width: 145px;
  }

  body .sidebar-nav {
    justify-content: flex-start;
    margin: 0 -4px;
    padding: 0 4px 1px;
  }

  body .sidebar-nav a {
    min-height: 34px;
    padding: 7px 9px;
    font-size: 12px;
    scroll-margin-top: 120px;
  }

  body .sidebar-account {
    display: none;
  }

  body .sidebar-sync-summary {
    min-height: 38px;
  }

  body .app-main {
    padding: 20px 16px 42px;
  }

  body .review-mode-banner {
    top: 106px;
  }
}

@media (max-width: 480px) {
  body .app-sidebar {
    min-height: 94px;
    padding: 8px 12px 7px;
  }

  body .sidebar-brand {
    width: 126px;
    min-width: 126px;
  }

  body .sidebar-logo-frame {
    width: 126px;
    height: 39px;
  }

  body .sidebar-logo {
    width: 135px;
  }

  body .app-main {
    padding: 16px 12px 36px;
  }

  body .review-mode-banner {
    top: 101px;
  }
}

/* --- Compact Inventory action column --- */

#inventory-table th.inventory-actions-cell,
#inventory-table td.inventory-actions-cell {
  box-sizing: border-box;
  width: 176px;
  min-width: 176px;
  max-width: 176px;
}

#inventory-table .inventory-actions {
  grid-template-columns: 46px 44px 56px;
  gap: 5px;
  min-width: 156px;
}

#inventory-table .inventory-actions .inventory-copy,
#inventory-table .inventory-actions .inventory-edit,
#inventory-table .inventory-actions .inventory-delete {
  height: 30px !important;
  border-radius: 8px;
  font-size: 12px;
}

/* --- Sticky Inventory headings --- */

body .inventory-sticky-controls,
body[data-review-mode="true"] .inventory-sticky-controls {
  top: var(--inventory-controls-sticky-top, 72px);
  z-index: 30;
}

#inventory-table thead th {
  background: #f8fafc;
  box-shadow: inset 0 -1px 0 #dfe4ea;
}

@media (min-width: 981px) {
  #inventory-section .table-wrap {
    overflow: visible;
  }

  #inventory-table thead th {
    position: sticky;
    top: var(--inventory-header-sticky-top, 250px);
    z-index: 15;
  }

  #inventory-table thead .inventory-article-cell,
  #inventory-table thead .inventory-actions-cell {
    z-index: 18;
  }
}

@media (max-width: 980px) {
  body .inventory-sticky-controls,
  body[data-review-mode="true"] .inventory-sticky-controls {
    position: static;
    top: auto;
  }

  #inventory-section .table-wrap {
    max-height: calc(100vh - 150px);
    overflow: auto;
    overscroll-behavior: contain;
  }

  #inventory-table thead th {
    position: sticky;
    top: 0;
    z-index: 8;
  }

  #inventory-table thead .inventory-article-cell,
  #inventory-table thead .inventory-actions-cell {
    z-index: 11;
  }
}

/* --- Responsive dashboard refinement --- */

details.dashboard-card:not([open]) > :not(summary) {
  display: none !important;
}

#invoice-list-table th:not(:nth-child(3)),
#invoice-list-table td:not(:nth-child(3)) {
  white-space: nowrap;
}

#invoice-list-table th:nth-child(3),
#invoice-list-table td:nth-child(3) {
  min-width: 200px;
  white-space: normal;
}

@media (max-width: 1100px) {
  .invoice-section-heading-row {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .invoice-item-tools {
    width: 100%;
    justify-content: space-between;
  }

  .invoice-article-picker {
    width: 100%;
    max-width: none;
    flex-basis: auto;
  }
}

@media (max-width: 980px) {
  body .sidebar-nav {
    scroll-snap-type: x proximity;
    box-shadow:
      inset 18px 0 14px -18px rgba(255, 255, 255, 0.72),
      inset -18px 0 14px -18px rgba(255, 255, 255, 0.72);
  }

  body .sidebar-nav a {
    scroll-snap-align: center;
  }
}

@media (max-width: 760px) {
  body .sidebar-nav a,
  .page-button,
  .toolbar-reset-button,
  .invoice-document-link,
  .invoice-edit-draft-link {
    min-height: 40px;
  }

  .invoice-document-link,
  .invoice-edit-draft-link {
    display: inline-flex;
    align-items: center;
  }

  .add-wine-card .wine-form-actions {
    position: sticky;
    z-index: 24;
    bottom: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
    border-top: 1px solid #dfe4ea;
    background: rgba(255, 255, 255, 0.98);
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -14px 30px rgba(15, 23, 42, 0.1);
    backdrop-filter: blur(10px);
  }

  .add-wine-card .wine-form-actions .form-note {
    margin: 0;
    font-size: 11px;
    line-height: 1.35;
  }

  .add-wine-card .wine-form-actions .button-primary,
  .add-wine-card .wine-form-actions .button-secondary {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }

  .inventory-bulk-section {
    min-width: 0;
  }

  .inventory-bulk-section .bulk-toolbar {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .inventory-bulk-section .bulk-set-field {
    width: 100%;
    min-width: 0 !important;
  }

  .inventory-bulk-section #bulk-set-value {
    width: 100% !important;
    min-width: 0;
  }

  .inventory-bulk-section .bulk-action-button,
  .inventory-bulk-section .bulk-set-button {
    min-height: 40px;
  }

  .inventory-bulk-section .toolbar-status {
    grid-column: 1 / -1;
  }

  .invoice-recent-section .table-wrap,
  #recent-changes .table-wrap,
  #inventory-section .table-wrap {
    max-height: none;
    overflow: visible;
  }

  #invoice-list-table,
  #invoice-list-table tbody,
  #recent-table,
  #recent-table tbody,
  #inventory-table,
  #inventory-table tbody {
    display: block;
    min-width: 0;
    width: 100%;
  }

  #invoice-list-table thead,
  #recent-table thead,
  #inventory-table thead {
    display: none;
  }

  #invoice-list-table tbody,
  #recent-table tbody,
  #inventory-table tbody {
    box-sizing: border-box;
    padding: 7px;
  }

  #invoice-list-table .invoice-list-row,
  #recent-table .recent-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
    margin: 7px 0;
    border: 1px solid #dfe4ea;
    border-radius: 13px;
    background: #fff;
    padding: 14px;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.05);
  }

  #invoice-list-table .invoice-list-row td,
  #recent-table .recent-row td {
    min-width: 0;
    border: 0;
    background: transparent;
    padding: 0;
    white-space: normal;
  }

  #invoice-list-table .invoice-list-row td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
  }

  #invoice-list-table .invoice-list-row td::before,
  #recent-table .recent-row td::before,
  #inventory-table .inventory-row > td[data-label]::before {
    color: #667085;
    content: attr(data-label);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.055em;
    text-transform: uppercase;
  }

  #invoice-list-table .invoice-list-customer,
  #invoice-list-table .invoice-document-actions {
    grid-column: 1 / -1;
  }

  #invoice-list-table .invoice-list-customer {
    min-width: 0;
  }

  #invoice-list-table .invoice-document-actions {
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    border-top: 1px solid #eef1f5;
    padding-top: 10px;
  }

  #invoice-list-table .invoice-document-actions::before {
    margin-right: auto;
  }

  #invoice-list-table tbody > tr:not(.invoice-list-row),
  #recent-table tbody > tr:not(.recent-row),
  #inventory-table tbody > tr:not(.inventory-row) {
    display: block;
    margin: 7px;
  }

  #invoice-list-table tbody > tr:not(.invoice-list-row) td,
  #recent-table tbody > tr:not(.recent-row) td,
  #inventory-table tbody > tr:not(.inventory-row) td {
    display: block;
    border: 0;
    padding: 18px 12px;
    text-align: center;
  }

  #recent-table .recent-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #recent-table .recent-row td {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    overflow-wrap: anywhere;
  }

  #recent-table .recent-row td[data-label="Wine"],
  #recent-table .recent-row td[data-label="Appellation"],
  #recent-table .recent-row td[data-label="Change"],
  #recent-table .recent-row td[data-label="Detected"] {
    grid-column: 1 / -1;
  }

  #recent-table .recent-row td[data-label="ID"],
  #recent-table .recent-row td[data-label="Size"] {
    display: none;
  }

  #recent-table .recent-row.is-hidden {
    display: none;
  }

  #inventory-table tbody {
    display: grid;
    gap: 12px;
    padding: 10px;
  }

  #inventory-table tbody tr.inventory-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    grid-template-areas:
      "select article stock"
      "description description description"
      "location bin bin"
      "actions actions actions";
    align-items: start;
    gap: 12px 10px;
    border: 1px solid #dfe4ea;
    border-radius: 14px;
    background: #fff;
    padding: 14px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.055);
  }

  #inventory-table tbody tr.inventory-row-inactive {
    background: #f2f4f7;
    border-color: #cfd5de;
  }

  #inventory-table tbody tr.inventory-row > td {
    position: static;
    z-index: auto;
    width: auto;
    min-width: 0;
    max-width: none;
    border: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
  }

  #inventory-table tbody tr.inventory-row:hover > td,
  #inventory-table tbody tr.inventory-row-inactive > td,
  #inventory-table tbody tr.inventory-row-inactive:hover > td,
  #inventory-table tbody tr:nth-child(even) > td {
    background: transparent;
  }

  #inventory-table .inventory-select-cell {
    grid-area: select;
    padding-top: 3px;
  }

  #inventory-table .inventory-select-cell::before,
  #inventory-table .inventory-article-cell::before,
  #inventory-table .inventory-description-cell::before,
  #inventory-table .inventory-actions-cell::before {
    display: none;
  }

  #inventory-table .inventory-article-cell {
    grid-area: article;
    font-size: 15px;
    font-weight: 800;
  }

  #inventory-table .inventory-description-cell {
    grid-area: description;
    border-top: 1px solid #eef1f5;
    padding-top: 11px;
  }

  #inventory-table .inventory-location-cell {
    grid-area: location;
  }

  #inventory-table .inventory-bin-cell {
    grid-area: bin;
  }

  #inventory-table .inventory-stock-cell {
    grid-area: stock;
  }

  #inventory-table .inventory-actions-cell {
    grid-area: actions;
    border-top: 1px solid #eef1f5;
    padding-top: 11px;
  }

  #inventory-table .inventory-centered-cell {
    display: none;
  }

  #inventory-table .inventory-location-cell,
  #inventory-table .inventory-bin-cell,
  #inventory-table .inventory-stock-cell {
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: left;
  }

  #inventory-table .inventory-stock-cell {
    align-items: flex-end;
  }

  #inventory-table .inventory-location-cell select.inventory-inline-select,
  #inventory-table .inventory-bin-cell input.inventory-inline-input {
    width: 100%;
    min-width: 0;
    max-width: none;
    min-height: 42px;
    scroll-margin-top: 16px;
    scroll-margin-bottom: 96px;
  }

  #inventory-section input:focus,
  #inventory-section select:focus {
    scroll-margin-top: 16px;
    scroll-margin-bottom: 96px;
  }

  #inventory-table .inventory-stock-cell .stock-controls {
    margin: 0;
  }

  #inventory-table .inventory-actions {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  #inventory-table .inventory-actions .inventory-copy,
  #inventory-table .inventory-actions .inventory-edit,
  #inventory-table .inventory-actions .inventory-delete,
  #inventory-table .stock-step-button {
    min-height: 40px !important;
  }
}

/* --- iPhone inventory usability repair --- */

@media (max-width: 760px) {
  .inventory-toolbar,
  .inventory-bulk-section {
    padding-right: 14px;
    padding-left: 14px;
  }

  .inventory-filter-form {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
  }

  .inventory-filter-form .toolbar-field,
  .inventory-filter-form .inventory-filter-input {
    width: 100%;
    min-width: 0;
    max-width: none;
    box-sizing: border-box;
  }

  .inventory-filter-form .toolbar-reset-button {
    width: 100%;
    min-height: 40px;
    margin: 0;
    border: 1px solid #d0d5dd;
    border-radius: 10px;
    background: #fff;
    color: #344054;
    font-weight: 700;
  }

  .inventory-table-statusbar {
    padding-right: 14px;
    padding-left: 14px;
  }

  #inventory-table tbody tr.inventory-row {
    height: auto !important;
    min-height: 0;
    grid-template-areas:
      "select article stock"
      "description description description"
      "location location location"
      "bin bin bin"
      "actions actions actions";
    align-content: start;
  }
}
