:root {
  color-scheme: light;
  --sidebar-bg: #111827;
  --sidebar-border: #263244;
  --sidebar-muted: #9ca3af;
  --sidebar-text: #f9fafb;
  --active-bg: #f9fafb;
  --active-text: #111827;
  --page-bg: #f3f4f6;
  --page-text: #111827;
  --muted-text: #667085;
  --panel-bg: #ffffff;
  --panel-border: #d9dee7;
  --focus: #38bdf8;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--page-bg);
  color: var(--page-text);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: 72px;
  padding: 18px 10px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  color: var(--sidebar-text);
}

.brand {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f9fafb;
  color: #111827;
  font-size: 13px;
  font-weight: 800;
}

.nav-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.nav-bottom {
  margin-top: auto;
}

.nav-item {
  position: relative;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  color: var(--sidebar-muted);
}

.nav-item:hover {
  background: #1f2937;
  color: var(--sidebar-text);
}

.nav-item::before {
  position: absolute;
  left: -10px;
  width: 3px;
  height: 22px;
  border-radius: 999px;
  background: transparent;
  content: "";
}

.nav-item::after {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  z-index: 10;
  transform: translateY(-50%) translateX(-4px);
  padding: 7px 9px;
  border: 1px solid #263244;
  border-radius: 8px;
  background: #0b1220;
  color: #f9fafb;
  box-shadow: 0 12px 28px rgb(15 23 42 / 22%);
  content: attr(data-label);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition:
    opacity 120ms ease,
    transform 120ms ease;
}

.nav-item:hover::after,
.nav-item:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.nav-item:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.nav-item.is-active {
  background: var(--active-bg);
  color: var(--active-text);
}

.nav-item.is-active::before {
  background: #38bdf8;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
}

.nav-icon svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.95;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page {
  min-width: 0;
  padding: 40px;
}

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

.page h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 760;
  letter-spacing: 0;
}

.clients-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 1180px;
}

.orders-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: none;
}

.pennylane-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1100px;
}

.pennylane-panel {
  display: grid;
  gap: 14px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel-bg);
}

.pennylane-panel-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.pennylane-panel h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.pennylane-search {
  width: min(320px, 100%);
}

.pennylane-search input {
  min-height: 34px;
  padding: 7px 10px;
}

.pennylane-filters {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.pennylane-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pennylane-filter-group .button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.pennylane-filter-group .button.is-active {
  border-color: #111827;
  background: #111827;
  color: #ffffff;
}

.pennylane-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pennylane-row-actions .button {
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 750;
}

.pennylane-mapping-modal {
  width: min(440px, 100%);
}

.pennylane-mapping-summary {
  display: grid;
  gap: 5px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
}

.pennylane-mapping-summary span {
  color: var(--muted-text);
  font-size: 12px;
  font-weight: 800;
}

.pennylane-mapping-summary strong {
  color: #111827;
  font-size: 14px;
}

.pennylane-mapping-empty {
  margin: 0;
  color: var(--muted-text);
  font-size: 13px;
  font-weight: 700;
}

.pennylane-selected-product {
  display: grid;
  gap: 5px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
}

.pennylane-selected-product span {
  color: var(--muted-text);
  font-size: 12px;
  font-weight: 800;
}

.pennylane-selected-product strong {
  color: #111827;
  font-size: 14px;
}

.pennylane-selected-product.is-selected {
  border-color: #c7d2fe;
  background: #f8faff;
}

.pennylane-selected-product .button-compact {
  justify-self: start;
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.pennylane-product-results {
  display: grid;
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: #ffffff;
}

.pennylane-product-result {
  display: grid;
  gap: 3px;
  border: 0;
  border-bottom: 1px solid #edf0f5;
  padding: 9px 11px;
  background: #ffffff;
  color: #111827;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.pennylane-product-result:last-child {
  border-bottom: 0;
}

.pennylane-product-result:hover,
.pennylane-product-result.is-selected {
  background: #f8fafc;
}

.pennylane-product-result small {
  color: var(--muted-text);
  font-size: 11px;
  font-weight: 800;
}

.pennylane-product-result.is-disabled {
  border-left: 3px solid #e5e7eb;
  color: var(--muted-text);
  background: #f9fafb;
  cursor: not-allowed;
  opacity: 0.72;
}

.pennylane-product-result:disabled {
  pointer-events: none;
}

.pennylane-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.simple-table {
  width: 100%;
  border-collapse: collapse;
}

.simple-table th,
.simple-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 14px;
  line-height: 1.35;
}

.simple-table th {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

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

.pennylane-invoice-row:hover td,
.pennylane-invoice-row.is-open td {
  background: #f8fafc;
}

.pennylane-invoice-detail-row td {
  padding: 0;
  background: #f8fafc;
}

.pennylane-invoice-detail {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.pennylane-lines-table {
  border-top: 1px solid #e5e7eb;
  margin: 0;
  width: 100%;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
}

.pennylane-lines-table th,
.pennylane-lines-table td {
  padding-left: 18px;
  background: #ffffff;
}

.pennylane-lines-message {
  margin: 0;
  padding: 4px 8px;
  border-top: 1px solid #e5e7eb;
  color: var(--muted-text);
  font-size: 14px;
}

.pennylane-lines-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
}

.pennylane-lines-error p {
  margin: 0;
  color: var(--muted-text);
  font-size: 14px;
  font-weight: 700;
}

.pennylane-sync-action {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pennylane-sync-action .button {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.pennylane-sync-button {
  border-color: #cfd6e3;
  background: #ffffff;
  color: #344054;
}

.pennylane-sync-button:hover {
  border-color: #98a2b3;
  background: #f8fafc;
}

.pennylane-sync-message {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.pennylane-sync-message.is-success {
  color: #047857;
}

.pennylane-sync-message.is-error {
  color: #b42318;
}

.mapping-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.mapping-pill.is-mapped {
  background: #ecfdf3;
  color: #067647;
}

.mapping-pill.is-unmapped {
  background: #fff7ed;
  color: #b54708;
}

.mapping-pill.is-non-stockable {
  background: #f2f4f7;
  color: #667085;
}

.pennylane-empty {
  min-height: 120px;
}

.client-open-page {
  max-width: none;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.page-header p {
  margin: 8px 0 0;
  color: var(--muted-text);
  font-size: 14px;
  line-height: 1.5;
}

.button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.button-primary {
  background: #111827;
  color: #ffffff;
}

.button-primary:hover {
  background: #0b1220;
}

.button-secondary {
  border-color: var(--panel-border);
  background: #ffffff;
  color: #111827;
}

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

.button-ghost {
  min-height: 32px;
  border-color: #d7dce5;
  background: #ffffff;
  color: #344054;
  font-size: 13px;
}

.client-layout {
  display: grid;
  grid-template-columns: minmax(0, 720px);
  gap: 16px;
  align-items: start;
}

.client-list-panel,
.client-detail-panel {
  min-height: 260px;
}

.client-list-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.clients-header {
  align-items: center;
}

.clients-header .button {
  flex: 0 0 auto;
}

.client-card,
.empty-state,
.loading-state,
.placeholder-panel,
.client-space,
.api-error {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
}

.client-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin-bottom: 10px;
  padding: 15px 14px;
  cursor: pointer;
}

.client-card:hover,
.client-card.is-selected {
  border-color: #111827;
  box-shadow: 0 10px 24px rgb(17 24 39 / 8%);
}

.client-card h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 760;
}

.client-card p {
  margin: 5px 0 0;
  color: var(--muted-text);
  font-size: 13px;
}

.empty-state,
.loading-state,
.placeholder-panel,
.client-space {
  display: grid;
  min-height: 260px;
  align-content: center;
  justify-items: start;
  padding: 24px;
}

.client-space {
  min-height: 0;
  align-content: start;
  gap: 18px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.client-space-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
}

.client-back-button {
  width: fit-content;
  margin-bottom: 18px;
}

.empty-state h2,
.client-space h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.client-space h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 760;
  letter-spacing: 0;
}

.empty-state .button {
  margin-top: 16px;
}

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

.blank-panel {
  min-height: 220px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
  display: grid;
  place-items: center;
  color: var(--muted-text);
  font-size: 14px;
}

.placeholder-panel p,
.client-space p {
  margin: 8px 0 0;
  color: var(--muted-text);
  font-size: 14px;
  line-height: 1.5;
}

.section-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--muted-text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.api-error,
.form-error {
  padding: 12px 14px;
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
  font-size: 14px;
  font-weight: 650;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(15 23 42 / 42%);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(440px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 20px;
  background: #ffffff;
  box-shadow: 0 24px 56px rgb(15 23 42 / 24%);
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.3;
}

.create-client-modal {
  width: min(380px, 100%);
  gap: 18px;
}

.create-client-modal .modal-actions {
  padding-top: 2px;
}

.create-product-modal {
  width: min(380px, 100%);
  gap: 18px;
}

.client-products-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
}

.client-products-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

.client-products-table th,
.client-products-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 14px;
  line-height: 1.35;
}

.client-products-table th {
  background: #f8fafc;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.client-products-table tr:last-child td {
  border-bottom: 0;
}

.client-product-row {
  cursor: pointer;
}

.client-product-row:hover td,
.client-product-row.is-open td {
  background: #f8fafc;
}

.client-products-table td:not(:first-child) {
  color: var(--muted-text);
}

.stock-cell-button {
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 8px;
  background: transparent;
  color: #111827;
  font: inherit;
  font-weight: 700;
  cursor: text;
}

.stock-cell-button:hover {
  border-color: #cfd6e3;
  background: #ffffff;
}

.stock-cell-input {
  width: 92px;
  min-height: 30px;
  padding: 5px 8px;
}

.remaining-time-value {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 8px;
  color: #667085;
  font-weight: 800;
}

.remaining-time-green {
  background: #ecfdf3;
  color: #067647;
}

.remaining-time-orange {
  background: #fff7ed;
  color: #b54708;
}

.remaining-time-red {
  background: #fef3f2;
  color: #b42318;
}

.client-product-detail-row td {
  padding: 0;
  background: #f8fafc;
}

.client-product-detail {
  display: grid;
  gap: 14px;
  padding: 18px 20px 20px;
  border-top: 1px solid #e5e7eb;
  border-left: 3px solid #98a2b3;
  background: #fbfcfe;
}

.client-product-detail h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.client-product-detail p {
  margin: 0;
  color: var(--muted-text);
  font-size: 14px;
}

.stock-history {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.stock-history-toggle {
  width: fit-content;
  border: 0;
  border-bottom: 2px solid #111827;
  padding: 0 0 5px;
  background: transparent;
  color: #111827;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-align: left;
}

.product-business-table,
.stock-history-table {
  width: 100%;
  border-collapse: collapse;
}

.product-business-panel {
  display: grid;
  gap: 10px;
}

.product-inventory-panel {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 10px;
  border-top: 1px solid #e5e7eb;
  padding-top: 10px;
}

.product-inventory-label {
  color: #667085;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.product-inventory-button {
  justify-self: start;
}

.product-business-table th,
.product-business-table td,
.stock-history-table th,
.stock-history-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 13px;
}

.product-business-table th,
.stock-history-table th {
  color: #667085;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.product-business-table td {
  color: var(--muted-text);
  font-weight: 700;
}

.delivery-date-control {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.delivery-date-control.is-editing {
  position: relative;
  z-index: 30;
  align-items: flex-start;
  flex-direction: column;
}

.delivery-date-editor {
  display: grid;
  width: 210px;
  gap: 8px;
}

.delivery-date-value {
  min-height: 30px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #ffffff;
  padding: 4px 8px;
  color: #111827;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.delivery-date-value:hover,
.delivery-date-value:focus-visible {
  border-color: #98a2b3;
  outline: none;
}

.delivery-date-input {
  min-height: 30px;
  max-width: 150px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  padding: 4px 6px;
  color: #111827;
  font: inherit;
  font-weight: 700;
}

.delivery-calendar {
  position: relative;
  z-index: 31;
  width: 210px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.14);
}

.delivery-date-actions {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  padding-top: 2px;
}

.delivery-calendar-head {
  display: grid;
  grid-template-columns: 28px 1fr 28px;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: #111827;
  text-align: center;
}

.delivery-calendar-head strong {
  font-size: 12px;
  font-weight: 800;
  text-transform: capitalize;
}

.delivery-calendar-nav,
.delivery-calendar-day {
  border: 1px solid transparent;
  background: transparent;
  color: #111827;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.delivery-calendar-nav {
  min-height: 26px;
  border-radius: 6px;
  font-size: 16px;
}

.delivery-calendar-weekdays,
.delivery-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.delivery-calendar-weekdays {
  margin-bottom: 4px;
  color: #667085;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.delivery-calendar-day,
.delivery-calendar-empty {
  min-height: 24px;
  border-radius: 6px;
  font-size: 12px;
}

.delivery-calendar-day:hover,
.delivery-calendar-day:focus-visible,
.delivery-calendar-nav:hover,
.delivery-calendar-nav:focus-visible {
  border-color: #d0d5dd;
  background: #f9fafb;
  outline: none;
}

.delivery-calendar-day.is-selected {
  background: #111827;
  color: #ffffff;
}

.delivery-date-clear {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: #667085;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.delivery-date-clear:hover,
.delivery-date-clear:focus-visible {
  color: #111827;
  outline: none;
}

.delivery-date-reset {
  border: 0;
  background: transparent;
  padding: 0;
  color: #98a2b3;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.delivery-date-reset:hover,
.delivery-date-reset:focus-visible {
  color: #667085;
  outline: none;
}

.stock-history-table td.stock-history-entry {
  color: #15803d;
  font-weight: 800;
}

.stock-history-table td.stock-history-exit {
  color: #b42318;
  font-weight: 800;
}

.stock-history-table .stock-history-inventory-row td {
  border-top: 1px solid #d0d5dd;
  border-bottom: 1px solid #d0d5dd;
  background: #f8fafc;
  color: #344054;
  font-weight: 800;
}

.muted-value {
  color: #98a2b3;
  font-weight: 700;
}

.client-products-empty {
  min-height: 160px;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cfd6e3;
  border-radius: 8px;
  padding: 10px 11px;
  color: #111827;
  font: inherit;
  font-size: 14px;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

input[type="number"] {
  appearance: textfield;
}

textarea {
  resize: vertical;
}

select {
  background: #ffffff;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.product-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  width: 100%;
}

.product-list,
.product-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.product-table {
  min-width: 0;
}

.product-list-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.product-filter {
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  padding: 5px 10px;
  background: #ffffff;
  color: #475467;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.product-filter:hover,
.product-filter.is-active {
  border-color: #98a2b3;
  background: #f2f4f7;
  color: #101828;
}

.product-card,
.product-inline-detail {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
}

.product-card {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.product-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.45fr) minmax(90px, 0.7fr) minmax(104px, 0.8fr) minmax(96px, 0.72fr) minmax(92px, 0.72fr) minmax(112px, 0.9fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 16px;
  min-height: 42px;
  font-size: 13px;
}

.product-row-head {
  padding: 0 12px 2px 16px;
  color: var(--muted-text);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.product-row-group {
  display: grid;
  gap: 0;
}

.product-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 8px 0 0 8px;
  background: #98a2b3;
  content: "";
}

.product-card.status-red::before {
  background: #dc2626;
}

.product-card.status-orange::before {
  background: #f97316;
}

.product-card.status-green::before {
  background: #16a34a;
}

.product-card.status-slate::before {
  background: #64748b;
}

.product-card:hover,
.product-card.is-selected {
  border-color: #111827;
  box-shadow: 0 8px 18px rgb(17 24 39 / 7%);
}

.product-row-group.is-open .product-card {
  border-radius: 8px 8px 0 0;
}

.product-card h2 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.3;
}

.product-name {
  font-size: 15px;
  font-weight: 800;
}

.action-badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 26px;
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  padding: 3px 9px;
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.action-badge.status-red {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.action-badge.status-orange {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.action-badge.status-green {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.product-toggle {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.product-inline-detail {
  border-top: 0;
  border-radius: 0 0 8px 8px;
  padding: 14px 16px 16px;
  background: #ffffff;
}

.action-panel,
.order-form {
  margin-bottom: 12px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.action-panel {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(0, 1.6fr) auto;
  align-items: center;
  gap: 14px;
  border-color: #d0d5dd;
  background: #ffffff;
}

.action-panel.status-red {
  border-color: #fecaca;
  background: #fff7f7;
}

.action-panel.status-orange {
  border-color: #fed7aa;
  background: #fffaf4;
}

.action-panel.status-green {
  border-color: #bbf7d0;
  background: #f7fef9;
}

.action-panel h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.action-panel dl {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  margin: 0;
}

.action-panel dt {
  color: var(--muted-text);
  font-size: 12px;
  font-weight: 750;
}

.action-panel dd {
  margin: 4px 0 0;
  color: #111827;
  font-size: 18px;
  font-weight: 820;
}

.action-panel .order-form {
  grid-column: 1 / -1;
  margin: 0;
}

.inventory-panel {
  margin-bottom: 12px;
}

.inventory-open-button {
  width: fit-content;
}

.inventory-form {
  display: grid;
  grid-template-columns: minmax(130px, 0.75fr) minmax(150px, 0.75fr) auto;
  align-items: end;
  gap: 10px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.inventory-form .form-error {
  grid-column: 1 / -1;
}

.order-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr)) auto;
  align-items: end;
  gap: 10px;
}

.order-form .form-error {
  grid-column: 1 / -1;
}

.order-form-actions {
  display: flex;
  gap: 8px;
}

.orders-table {
  display: grid;
  gap: 6px;
}

.order-row-group {
  display: grid;
  gap: 0;
}

.orders-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(90px, 0.7fr) minmax(90px, 0.7fr) minmax(100px, 0.8fr) minmax(130px, 0.8fr) minmax(130px, 0.8fr) minmax(110px, 0.8fr) minmax(170px, auto);
  align-items: center;
  gap: 10px;
}

.orders-head {
  padding: 0 12px 2px;
  color: var(--muted-text);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.order-edit-row {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 8px 12px;
  background: #ffffff;
  font-size: 13px;
}

.order-edit-row input {
  min-width: 0;
  padding: 7px 8px;
  font-size: 13px;
}

.order-status {
  font-weight: 800;
}

.order-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.order-lines {
  border: 1px solid var(--panel-border);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #f8fafc;
  display: grid;
}

.order-line {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) repeat(4, minmax(86px, 0.7fr)) minmax(140px, auto);
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-top: 1px solid #edf0f5;
  font-size: 12px;
}

.order-line-head {
  color: var(--muted-text);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.receipt-form {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(130px, 0.6fr) minmax(140px, 0.6fr) auto;
  align-items: end;
  gap: 10px;
  padding-top: 8px;
}

.receipt-form .form-error {
  grid-column: 1 / -1;
}

.receipt-form-actions {
  display: flex;
  gap: 8px;
}

.order-receipts {
  border: 1px solid var(--panel-border);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: #ffffff;
  display: grid;
}

.order-lines + .order-receipts {
  border-top: 1px solid #edf0f5;
}

.order-receipt {
  display: grid;
  grid-template-columns: minmax(110px, 0.5fr) minmax(160px, 1fr) minmax(110px, 0.5fr) minmax(90px, 0.5fr) minmax(86px, auto);
  gap: 10px;
  padding: 6px 12px;
  border-top: 1px solid #edf0f5;
  font-size: 12px;
}

.order-receipt-head {
  color: var(--muted-text);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pennylane-sync-state,
.pennylane-section {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
}

.pennylane-sync-state {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  color: #344054;
  font-size: 13px;
}

.pennylane-sync-state strong {
  color: #067647;
}

.pennylane-section {
  margin-bottom: 14px;
  overflow: hidden;
}

.pennylane-section > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--panel-border);
  padding: 11px 12px;
}

.pennylane-section h2 {
  margin: 0;
  font-size: 15px;
}

.pennylane-section header span,
.pennylane-empty,
.pennylane-lines-empty {
  color: var(--muted-text);
  font-size: 12px;
}

.pennylane-list-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--panel-border);
  padding: 9px 10px;
}

.pennylane-search {
  width: min(320px, 100%);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 7px 9px;
  color: #344054;
  font: inherit;
  font-size: 12px;
}

.pennylane-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pennylane-filter {
  min-height: 30px;
  border: 0;
  border-right: 1px solid var(--panel-border);
  padding: 0 9px;
  background: #ffffff;
  color: #475467;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.pennylane-filter:last-child {
  border-right: 0;
}

.pennylane-filter.is-active {
  background: #f2f4f7;
  color: #111827;
}

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

.pennylane-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.pennylane-table th,
.pennylane-table td {
  border-bottom: 1px solid #edf0f5;
  padding: 8px 10px;
  vertical-align: top;
}

.pennylane-table th {
  color: var(--muted-text);
  font-size: 10px;
  text-transform: uppercase;
}

.pennylane-table td:first-child {
  color: #344054;
  font-weight: 800;
}

.mapping-status {
  color: #b54708;
  font-weight: 800;
  white-space: nowrap;
}

.mapping-status.is-mapped {
  color: #067647;
}

.mapping-select {
  min-width: 170px;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 6px 8px;
  background: #ffffff;
  color: #344054;
  font: inherit;
  font-size: 12px;
}

.preview-status {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.preview-ready {
  background: #ecfdf3;
  color: #067647;
}

.preview-done {
  background: #f2f4f7;
  color: #475467;
}

.preview-blocked {
  background: #fff6ed;
  color: #b54708;
}

.stock-import-button {
  min-width: 132px;
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.stock-follow-up-button {
  min-width: 146px;
  min-height: 30px;
  padding: 0 9px;
  font-size: 12px;
}

.stock-follow-up-button.is-active {
  border-color: #a6f4c5;
  background: #ecfdf3;
  color: #067647;
}

.pennylane-empty,
.pennylane-lines-empty {
  padding: 12px;
}

.pennylane-lines {
  min-width: 280px;
  padding-top: 6px;
}

.pennylane-lines div {
  display: grid;
  grid-template-columns: minmax(90px, auto) minmax(80px, auto) minmax(120px, 1fr);
  gap: 8px;
  border-top: 1px solid #edf0f5;
  padding: 6px 0;
}

.history-details {
  border-top: 1px solid var(--panel-border);
  padding-top: 10px;
}

.history-details summary {
  width: fit-content;
  color: #344054;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.history-table,
.history-empty {
  margin-top: 12px;
}

.history-table {
  display: grid;
  gap: 4px;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(92px, 0.55fr) minmax(110px, 0.72fr) minmax(180px, 1.8fr) minmax(86px, auto);
  gap: 10px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #eef2f7;
  font-size: 13px;
}

.history-action {
  padding: 5px 8px;
  font-size: 12px;
}

.history-row:last-child {
  border-bottom: 0;
}

.history-head {
  color: var(--muted-text);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-empty {
  margin: 0;
  color: var(--muted-text);
  font-size: 13px;
  font-weight: 750;
}

.analysis-error,
.analysis-warning {
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.analysis-error,
.analysis-warning {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
  font-size: 14px;
  font-weight: 700;
}

.analysis-warning ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

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

.date-field {
  position: relative;
}

.date-picker {
  position: relative;
  display: block;
}

.date-picker input {
  min-width: 0;
  padding-right: 44px;
  cursor: pointer;
}

.date-picker-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  display: grid;
  place-items: center;
  width: 40px;
  height: calc(100% - 2px);
  border: 0;
  border-left: 1px solid #d9dee7;
  border-radius: 0 8px 8px 0;
  background: #f8fafc;
  color: #344054;
  cursor: pointer;
}

.date-picker-toggle:hover {
  background: #eef2f7;
  color: #111827;
}

.date-picker-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.calendar-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 70;
  width: min(100%, 320px);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  box-shadow: 0 18px 42px rgb(15 23 42 / 18%);
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  text-transform: capitalize;
}

.calendar-nav,
.calendar-day {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #111827;
  font: inherit;
  cursor: pointer;
}

.calendar-nav {
  width: 32px;
  height: 32px;
  font-size: 20px;
  line-height: 1;
}

.calendar-nav:hover,
.calendar-day:hover {
  background: #f3f4f6;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted-text);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.calendar-day,
.calendar-empty {
  display: grid;
  place-items: center;
  min-height: 34px;
}

.calendar-day.is-selected {
  background: #111827;
  color: #ffffff;
}

.clients-page,
.client-open-page,
.pennylane-page,
.blank-page {
  max-width: 1180px;
}

.page-header,
.client-space-header,
.pennylane-panel-header {
  padding-bottom: 2px;
}

.client-card,
.client-products-table-wrap,
.pennylane-panel,
.blank-panel,
.modal {
  box-shadow: 0 1px 2px rgb(15 23 42 / 4%);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.button-ghost:hover {
  border-color: #b8c0cc;
  background: #f8fafc;
  color: #111827;
}

.simple-table th,
.simple-table td,
.client-products-table th,
.client-products-table td,
.stock-history-table th,
.stock-history-table td {
  vertical-align: middle;
}

.pennylane-panel {
  gap: 16px;
}

.pennylane-invoice-detail {
  border-top: 1px solid #e5e7eb;
  background: #f8fafc;
}

.pennylane-lines-table {
  background: #ffffff;
}

.pennylane-lines-table th:last-child,
.pennylane-lines-table td:last-child {
  width: 118px;
  text-align: right;
}

.pennylane-sync-action {
  justify-content: flex-end;
  border-top: 1px solid #e5e7eb;
  padding: 12px 2px 2px;
}

.pennylane-sync-action .button-primary {
  min-height: 36px;
  padding: 0 14px;
}

.pennylane-mapping-modal select option:disabled {
  color: #98a2b3;
}

.client-products-table-wrap,
.pennylane-table-wrap {
  scrollbar-width: thin;
}

.client-product-detail {
  border-left: 3px solid #98a2b3;
}

.stock-history {
  border-top: 1px solid #edf0f5;
  padding-top: 12px;
}

.stock-history-toggle:hover {
  color: #344054;
}

.modal-header {
  padding-bottom: 2px;
}

.modal-actions {
  align-items: center;
  border-top: 1px solid #edf0f5;
  padding-top: 14px;
}

.empty-state,
.loading-state,
.placeholder-panel {
  color: var(--muted-text);
}

@media (max-width: 720px) {
  .app-shell {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .sidebar {
    width: 64px;
    padding: 14px 8px;
  }

  .brand,
  .nav-item {
    width: 42px;
    height: 42px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .nav-item::after {
    display: none;
  }

  .nav-item::before {
    left: -8px;
  }

  .page {
    padding: 28px 22px;
  }

  .page-header,
  .client-space-header,
  .client-card,
  .product-card,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .client-layout {
    grid-template-columns: 1fr;
  }

  .client-space {
    gap: 28px;
  }

  .product-workspace,
  .field-grid,
  .calendar-popover {
    width: 100%;
  }

  .action-panel,
  .inventory-form,
  .order-form,
  .order-line,
  .order-receipt,
  .orders-row {
    grid-template-columns: 1fr;
  }

  .order-actions,
  .order-line-actions,
  .receipt-form,
  .order-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .receipt-form {
    grid-template-columns: 1fr;
  }

  .pennylane-list-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .pennylane-panel-header,
  .pennylane-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .pennylane-search {
    width: 100%;
  }

  .orders-head {
    display: none;
  }

  .product-row {
    grid-template-columns: 1fr;
  }

  .product-row-head {
    display: none;
  }

  .history-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .history-head {
    display: none;
  }

  .button {
    width: 100%;
  }

  .client-back-button {
    width: 100%;
  }
}
