:root {
  --ink: #19332f;
  --muted: #63716e;
  --paper: #f6f4ee;
  --surface: #fffefa;
  --line: #dcded8;
  --teal: #177f74;
  --teal-dark: #0e5e56;
  --teal-soft: #dff2ed;
  --view-accent: #31418f;
  --view-accent-dark: #232f6b;
  --view-soft: #e7ebfb;
  --view-line: #b7c2ef;
  --blue-soft: #e7f0f3;
  --amber-soft: #f5ead3;
  --shadow: 0 14px 34px rgba(27, 55, 50, 0.1);
  --radius: 18px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top right, rgba(23, 127, 116, 0.12), transparent 32rem),
    var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

body > header {
  position: relative;
}

.settings-gear {
  position: absolute;
  top: 1rem;
  right: clamp(1rem, 4vw, 4rem);
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid rgba(23, 127, 116, 0.35);
  border-radius: 50%;
  background: var(--surface);
  color: var(--teal-dark);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.settings-gear svg {
  width: 1.3rem;
  height: 1.3rem;
}

.settings-gear:hover {
  background: var(--teal-soft);
}

.settings-gear:focus-visible {
  outline: 3px solid rgba(23, 127, 116, 0.45);
  outline-offset: 2px;
}

.settings-gear[aria-current="page"] {
  background: var(--teal);
  color: white;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  max-width: 1480px;
  margin: 0 auto;
  padding: 3.25rem clamp(1rem, 4vw, 4rem) 2rem;
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.45rem;
  color: var(--teal-dark);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 0.6rem;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.lede {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.55;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.15rem;
}

.header-action {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: var(--teal);
  color: white;
  padding: 0.65rem 1rem;
  font-weight: 750;
  text-decoration: none;
}

.header-action:hover {
  background: var(--teal-dark);
}

.header-action.secondary-action {
  border: 1px solid rgba(23, 127, 116, 0.35);
  background: var(--surface);
  color: var(--teal-dark);
}

.header-action.secondary-action:hover {
  background: var(--teal-soft);
}

.utility-menu {
  position: relative;
}

.utility-menu > summary {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 0.45rem;
  border: 1px solid rgba(79, 86, 84, 0.22);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.utility-menu > summary::-webkit-details-marker {
  display: none;
}

.utility-menu > summary::after {
  content: "▾";
  font-size: 0.78rem;
}

.utility-menu[open] > summary,
.utility-menu > summary:hover {
  border-color: rgba(23, 127, 116, 0.35);
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.utility-menu[open] > summary::after {
  transform: rotate(180deg);
}

.utility-menu-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.5rem);
  left: 0;
  display: grid;
  width: min(310px, calc(100vw - 2rem));
  gap: 0.25rem;
  padding: 0.75rem;
  border: 1px solid rgba(23, 127, 116, 0.22);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.utility-menu-heading {
  margin: 0 0 0.3rem;
  padding: 0.25rem 0.55rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.utility-menu-action {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink);
  padding: 0.55rem;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
}

.utility-menu-action:hover {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.utility-menu-divider {
  height: 1px;
  margin: 0.35rem 0.55rem;
  background: rgba(79, 86, 84, 0.16);
}

.file-header-action {
  cursor: pointer;
}

.file-header-action input {
  display: none;
}

.order-header-action {
  gap: 0.5rem;
}

.order-header-action span {
  display: inline-grid;
  min-width: 1.55rem;
  height: 1.55rem;
  margin-left: auto;
  place-items: center;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-size: 0.72rem;
}

.inventory-count {
  min-width: 150px;
  padding: 1.2rem 1.35rem;
  border: 1px solid rgba(23, 127, 116, 0.23);
  border-radius: var(--radius);
  background: rgba(255, 254, 250, 0.8);
  box-shadow: var(--shadow);
  text-align: right;
}

.inventory-count strong,
.inventory-count span {
  display: block;
}

.inventory-count strong {
  color: var(--teal-dark);
  font-size: 2rem;
  line-height: 1;
}

.inventory-count span {
  margin-top: 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
}

main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 4rem) 4rem;
}

.filters {
  position: sticky;
  z-index: 10;
  top: 0;
  padding: 1.3rem;
  border: 1px solid rgba(220, 222, 216, 0.92);
  border-radius: 22px;
  background: rgba(255, 254, 250, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.filter-heading,
.results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.filter-heading {
  margin-bottom: 1rem;
}

.filter-heading h2,
.results-heading h2 {
  margin-bottom: 0;
  font-size: 1.3rem;
}

.clear-button,
.empty-state button {
  border: 0;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  padding: 0.66rem 1rem;
  font-weight: 750;
}

.clear-button:hover,
.empty-state button:hover {
  background: #cce9e2;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.55fr) repeat(5, minmax(150px, 1fr));
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.38rem;
}

label > span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  padding: 0.66rem 0.85rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
}

.status-filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--teal-soft);
  border-radius: 12px;
  margin-bottom: 1rem;
  border: 1px solid var(--teal);
}

.status-filter-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--teal-dark);
}

.status-filter-label select {
  min-width: 180px;
  font-weight: 600;
}

.status-filter-hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-left: auto;
}

input,
select {
  min-height: 44px;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 127, 116, 0.16);
}

.results {
  padding-top: 2rem;
}

.results-heading {
  margin-bottom: 1rem;
}

.results-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 700;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1rem;
}

.product-card {
  content-visibility: auto;
  overflow: hidden;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 5px 16px rgba(27, 55, 50, 0.06);
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    border-color 150ms ease;
}

.product-card:hover,
.product-card:focus-within {
  transform: translateY(-3px);
  border-color: rgba(23, 127, 116, 0.5);
  box-shadow: var(--shadow);
}

.product-card.in-order {
  border-color: var(--teal);
}

.card-button {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.card-image {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #f3f1eb;
}

.card-body {
  padding: 0.9rem 0.95rem 1rem;
}

.order-add-button {
  width: calc(100% - 1.9rem);
  min-height: 38px;
  margin: 0 0.95rem 0.95rem;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: white;
  color: var(--teal-dark);
  font-weight: 750;
}

.order-add-button:disabled {
  border-color: var(--line);
  background: var(--teal-soft);
  opacity: 1;
}

.card-category {
  overflow: hidden;
  margin-bottom: 0.45rem;
  color: var(--teal-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.card-title {
  display: -webkit-box;
  overflow: hidden;
  min-height: 2.8em;
  margin-bottom: 0.75rem;
  font-size: 0.98rem;
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.card-meta,
.dialog-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.card-location {
  display: grid;
  gap: 0.12rem;
  margin: 0.75rem 0 0;
  border-left: 3px solid var(--teal);
  border-radius: 8px;
  background: var(--teal-soft);
  padding: 0.52rem 0.62rem;
}

.card-location span,
.card-location small {
  color: var(--muted);
  font-size: 0.68rem;
}

.card-location strong {
  color: var(--teal-dark);
  font-size: 0.78rem;
}

.card-location.inferred {
  border-left-color: #c29228;
  background: var(--amber-soft);
}

.card-location.inferred strong {
  color: #715820;
}

.card-location.unknown {
  border-left-color: var(--line);
  background: var(--paper);
}

.card-location.unknown strong {
  color: var(--muted);
  font-weight: 650;
}

.badge {
  max-width: 100%;
  overflow: hidden;
  border-radius: 999px;
  padding: 0.28rem 0.52rem;
  background: var(--blue-soft);
  color: #315764;
  font-size: 0.72rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge.size {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.badge.brand {
  background: var(--amber-soft);
  color: #715820;
}

.empty-state {
  margin-top: 2rem;
  padding: 4rem 1rem;
  border: 1px dashed #b9c2bd;
  border-radius: var(--radius);
  text-align: center;
}

.empty-state p {
  color: var(--muted);
}

.product-dialog {
  width: min(1120px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  box-shadow: 0 30px 100px rgba(14, 54, 49, 0.3);
}

.product-dialog::backdrop {
  background: rgba(16, 35, 32, 0.68);
  backdrop-filter: blur(4px);
}

.order-dialog {
  width: min(1080px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  border: 0;
  border-radius: 24px;
  background: var(--surface);
  color: var(--ink);
  padding: clamp(1rem, 4vw, 2rem);
  box-shadow: 0 30px 100px rgba(14, 54, 49, 0.3);
}

.order-dialog::backdrop {
  background: rgba(16, 35, 32, 0.68);
  backdrop-filter: blur(4px);
}

.order-dialog-heading {
  padding-right: 2.5rem;
}

.order-dialog-heading h2 {
  margin-bottom: 0.45rem;
}

.order-dialog-heading p:last-child {
  color: var(--muted);
}

.package-switcher {
  margin-block: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  padding: 0.85rem;
}

.package-switcher-heading,
.package-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.package-switcher-heading h3,
.package-switcher-heading p {
  margin: 0;
}

.package-switcher-heading p {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.package-switcher-heading button,
.package-status-panel button {
  min-height: 36px;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: white;
  color: var(--teal-dark);
  padding: 0.48rem 0.72rem;
  font-size: 0.73rem;
  font-weight: 800;
}

.package-tabs {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.85rem;
  border-bottom: 1px solid var(--line);
}

.package-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.55rem 0.7rem;
  font-size: 0.76rem;
  font-weight: 850;
}

.package-tabs button.active {
  border-bottom-color: var(--teal);
  color: var(--teal-dark);
}

.package-tabs span {
  display: inline-grid;
  min-width: 1.45rem;
  height: 1.45rem;
  place-items: center;
  border-radius: 999px;
  background: #e5e8e5;
  font-size: 0.66rem;
}

.package-tabs button.active span {
  background: var(--teal-soft);
}

.order-package-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.order-package-list[hidden],
.order-search-workspace[hidden],
#package-view-toggle[hidden] {
  display: none;
}

.package-view-toggle {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  overflow: hidden;
  margin-top: 0.9rem;
  border: 1.5px solid var(--view-line);
  border-radius: 16px;
  background: linear-gradient(135deg, #f5f7ff 0%, var(--view-soft) 100%);
  padding: 0.6rem 0.7rem 0.6rem 1rem;
  box-shadow: 0 8px 20px rgba(49, 65, 143, 0.12);
}

.package-view-toggle::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 0.5rem;
  background: var(--view-accent);
}

.package-view-label {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--view-accent);
  padding: 0.28rem 0.6rem;
  color: white;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.package-view-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-left: auto;
  border: 1px solid var(--view-line);
  border-radius: 999px;
  background: white;
  padding: 0.22rem;
}

.package-view-toggle button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--view-accent-dark);
  padding: 0.42rem 0.72rem;
  font-size: 0.72rem;
  font-weight: 800;
}

.package-view-toggle button.active {
  background: var(--view-accent);
  color: white;
  box-shadow: 0 4px 10px rgba(49, 65, 143, 0.28);
}

.package-view-toggle button span {
  display: inline-grid;
  min-width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  margin-left: 0.3rem;
  border-radius: 999px;
  background: var(--view-soft);
  color: var(--view-accent-dark);
  font-size: 0.66rem;
}

.package-view-toggle button.active span {
  background: rgba(255, 255, 255, 0.28);
  color: white;
}

.order-search-workspace {
  margin-top: 0.75rem;
  border: 1.5px solid var(--view-line);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f7ff 100%);
  padding: 0.8rem;
  box-shadow: 0 8px 20px rgba(49, 65, 143, 0.08);
}

.order-item-package {
  display: inline-block;
  margin-top: 0.25rem;
  border-radius: 999px;
  background: #eef4f1;
  padding: 0.12rem 0.45rem;
  color: var(--teal-dark);
  font-size: 0.65rem;
  font-weight: 800;
}

.package-switch-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: var(--ink);
  padding: 0.65rem;
  text-align: left;
}

.package-switch-button.active {
  border: 3px solid var(--teal);
  background: #bde6df;
  box-shadow: 0 0 0 3px rgba(23, 127, 116, 0.2), 0 8px 20px rgba(23, 127, 116, 0.16);
}

.package-switch-button strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.package-switch-button span {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.7rem;
}

.package-switch-button .package-status {
  grid-column: 2;
  align-self: center;
}

.order-package-list.table-mode {
  display: block;
  overflow-x: auto;
}

.order-package-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.order-package-table th,
.order-package-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.order-package-table th {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
}

.order-package-table tbody tr {
  cursor: pointer;
}

.order-package-table tbody tr:hover {
  background: #f3f7f5;
}

.order-package-table tbody tr.active {
  background: #bde6df;
}

.package-heading-row {
  margin-bottom: 1rem;
}

.order-reference {
  display: grid;
  flex: 1;
  gap: 0.35rem;
}

.order-reference span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.package-shipping-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  padding: 0.75rem;
}

.package-shipping-fields label {
  display: grid;
  gap: 0.35rem;
}

.package-shipping-fields span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 750;
}

.package-shipping-fields em {
  font-size: 0.67rem;
  font-style: normal;
  font-weight: 500;
}

.package-shipping-fields input {
  min-width: 0;
}

.package-order-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.package-order-detail {
  display: grid;
  gap: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f7f5ef;
  padding: 0.7rem;
}

.package-order-detail > span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
}

.package-order-detail em {
  font-size: 0.64rem;
  font-style: normal;
  font-weight: 500;
}

.package-order-detail strong {
  overflow-wrap: anywhere;
  font-size: 0.82rem;
}

.buyer-full-name-field input { min-width: 0; }

.handwritten-label {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 1rem;
  border: 2px solid var(--teal);
  border-radius: 14px;
  background: var(--teal-soft);
  padding: 0.8rem;
}

.handwritten-label p {
  margin: 0;
  font-size: 0.96rem;
}

.handwritten-label-heading {
  display: grid;
  gap: 0.15rem;
  margin-bottom: 0.35rem;
}

.handwritten-label-heading > span {
  display: block;
  color: var(--teal-dark);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.handwritten-label-heading > strong { font-size: 1rem; }

.handwritten-label-tracking strong {
  overflow-wrap: anywhere;
  color: var(--teal-dark);
  font-size: 1.05rem;
}

.handwritten-label-buyer { margin-top: 0.25rem !important; }

.package-status-panel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

.package-status-panel > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.package-status {
  display: inline-flex;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #715820;
  padding: 0.25rem 0.5rem;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.package-status.waiting {
  background: #f3f3ee;
  color: #6b6b60;
  border: 1px dashed #c9c9bd;
}

.package-status.found {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.package-status.prepared {
  background: #dfe9f7;
  color: #294d7a;
}

.package-status.shipped {
  background: #e7dff3;
  color: #5b3976;
}

.package-status.in_transit {
  background: #dff0f5;
  color: #1f5f74;
}

.package-status.delivered {
  background: #dff5e8;
  color: #1b6338;
}

.package-status.completed {
  background: #e5f5df;
  color: #18602b;
}

.package-progress {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.25rem 0.5rem;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.package-progress[hidden] {
  display: none;
}

.package-progress.not-started {
  background: #f3f3ee;
  color: #6b6b60;
  border: 1px dashed #c9c9bd;
}

.package-progress.in-progress {
  background: var(--amber-soft);
  color: #715820;
}

.package-progress.ready {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.package-status-panel button:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  color: var(--muted);
  opacity: 0.6;
}

.package-email-status {
  width: 100%;
  margin: 0;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: right;
}

.package-email-status strong {
  color: var(--ink);
  font-weight: 700;
}

.package-email-log {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.package-email-log h3 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink);
}

.package-email-log ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.package-email-log li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.78rem;
}

.package-email-log .package-email-log-label {
  color: var(--ink);
}

.package-email-log time {
  color: var(--muted);
  white-space: nowrap;
}

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

.order-stats article,
.order-group {
  border: 1px solid var(--line);
  background: var(--paper);
}

.order-stats article {
  border-radius: 12px;
  padding: 0.7rem;
}

.order-stats strong,
.order-stats span {
  display: block;
}

.order-stats strong {
  color: var(--teal-dark);
  font-size: 1.35rem;
}

.order-stats span {
  color: var(--muted);
  font-size: 0.72rem;
}

.order-groups {
  display: grid;
  gap: 1rem;
}

.order-group {
  border-radius: 16px;
  padding: 0.9rem;
}

.order-group > h3 {
  margin-bottom: 0.65rem;
  color: var(--teal-dark);
  font-size: 1rem;
}

.order-item {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  border-top: 1px solid var(--line);
  padding-block: 0.7rem;
}

.order-item:first-of-type {
  border-top: 0;
}

.order-item img {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
}

.order-item-copy h4,
.order-item-copy p {
  margin: 0;
}

.order-item-copy h4 {
  font-size: 0.88rem;
}

.order-item-copy p {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.order-item-status {
  display: inline-flex;
  margin-top: 0.35rem;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #715820;
  padding: 0.22rem 0.45rem;
  font-size: 0.67rem;
  font-weight: 800;
}

.order-item-status.found {
  background: var(--teal-soft);
  color: var(--teal-dark);
}

.order-item-status.not_found {
  background: #fde5df;
  color: #853b2c;
}

.order-item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  max-width: 290px;
}

.order-item-actions button,
.order-dialog-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  padding: 0.42rem 0.62rem;
  font-size: 0.7rem;
  font-weight: 750;
}

.order-item-actions [data-order-action="found"] {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.order-empty {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 2rem 1rem;
  text-align: center;
}

.order-empty p,
.order-save-state {
  color: var(--muted);
}

.order-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.order-dialog-actions .danger-order-action {
  color: #853b2c;
}

.order-save-state {
  min-height: 1.2em;
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  text-align: right;
}

.dialog-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.75fr) minmax(520px, 1.25fr);
}

.dialog-layout > img {
  width: 100%;
  height: 100%;
  min-height: 520px;
  object-fit: contain;
  background: #f3f1eb;
}

.dialog-copy {
  padding: clamp(1.5rem, 4vw, 3rem);
}

.dialog-category {
  margin-bottom: 0.55rem;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dialog-copy h2 {
  margin-bottom: 1rem;
  font-size: clamp(1.65rem, 4vw, 2.7rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.dialog-data-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.dialog-data-panel,
.dialog-description-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.95rem;
}

.vinted-data-panel {
  background: #f7f5ef;
}

.own-data-panel {
  background: var(--teal-soft);
}

.own-data-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.own-data-status {
  border-radius: 999px;
  background: var(--amber-soft);
  color: #715820;
  padding: 0.22rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 800;
}

.own-data-status.confirmed {
  background: white;
  color: var(--teal-dark);
}

.own-data-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.8rem;
  margin: 0.85rem 0 0;
}

.own-data-summary > .own-summary-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  border-bottom: 1px solid rgb(16 112 104 / 14%);
  padding-bottom: 0.42rem;
}

.own-data-summary > .own-summary-wide {
  grid-column: 1 / -1;
}

.own-data-summary dt {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 750;
}

.own-data-summary dd {
  margin: 0.12rem 0 0;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.own-field-edit {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--teal-dark);
  font-size: 1rem;
}

.own-field-edit:hover {
  border-color: var(--teal);
  background: white;
}

.own-inline-editor {
  display: grid;
  grid-column: 1 / -1;
  gap: 0.4rem;
}

.own-inline-editor input,
.own-inline-editor select,
.own-inline-editor textarea {
  width: 100%;
  min-height: 38px;
  padding: 0.5rem 0.58rem;
  font-size: 0.75rem;
}

.own-inline-editor textarea {
  resize: vertical;
}

.own-inline-actions,
.own-data-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.own-inline-actions button,
.own-data-footer button {
  min-height: 36px;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: var(--teal);
  color: white;
  padding: 0.45rem 0.65rem;
  font-size: 0.7rem;
  font-weight: 750;
}

.own-inline-actions .secondary-location-action,
.own-data-footer .secondary-location-action {
  background: white;
  color: var(--teal-dark);
}

.data-panel-kicker {
  margin: 0 0 0.22rem;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.dialog-data-panel h3,
.dialog-description-panel h3 {
  margin: 0;
  font-size: 1rem;
}

.dialog-data-panel dl {
  display: grid;
  grid-template-columns: minmax(80px, max-content) 1fr;
  gap: 0.48rem 0.75rem;
  margin: 0.85rem 0 0;
}

.dialog-data-panel dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.dialog-data-panel dd {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 750;
}

.dialog-description-panel {
  margin-top: 0.75rem;
  background: white;
}

.dialog-description-panel .dialog-description {
  margin: 0.65rem 0 0;
}

.location-confirmation {
  display: grid;
  gap: 0.7rem;
  margin-top: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  padding: 0.9rem;
}

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

.location-confirmation h3,
.dialog-location-summary,
.location-save-state {
  margin: 0;
}

.location-confirmation h3 {
  font-size: 1rem;
}

.location-status {
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  padding: 0.25rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 800;
}

.location-status.inferred {
  background: var(--amber-soft);
  color: #715820;
}

.location-status.unknown {
  background: #ecece8;
  color: var(--muted);
}

.dialog-location-summary {
  color: var(--teal-dark);
  font-size: 0.88rem;
  font-weight: 750;
}

.location-confirmation label {
  display: grid;
  gap: 0.35rem;
}

.location-confirmation label span,
.location-save-state {
  color: var(--muted);
  font-size: 0.72rem;
}

.location-confirmation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.location-confirmation-actions button {
  min-height: 38px;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: var(--teal);
  color: white;
  padding: 0.5rem 0.75rem;
  font-weight: 750;
}

.location-confirmation-actions .confirmed-location-action {
  border-color: var(--teal-dark);
  background: var(--teal-dark);
  box-shadow: 0 0 0 3px rgba(23, 127, 116, 0.16);
}

.location-save-state:empty {
  display: none;
}

.location-save-state.success,
.location-save-state.notice,
.location-save-state.error {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 800;
}

.location-save-state.success {
  border-color: rgba(23, 127, 116, 0.32);
  background: #d7efe9;
  color: var(--teal-dark);
}

.location-save-state.notice {
  border-color: rgba(194, 146, 40, 0.32);
  background: var(--amber-soft);
  color: #715820;
}

.location-save-state.error {
  border-color: rgba(133, 59, 44, 0.25);
  background: #fde5df;
  color: #853b2c;
}

.location-confirmation-actions .secondary-location-action {
  background: white;
  color: var(--teal-dark);
}

.dialog-description {
  color: #40514e;
  line-height: 1.6;
  white-space: pre-line;
}

.dialog-close {
  position: absolute;
  z-index: 1;
  top: 0.85rem;
  right: 0.85rem;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 254, 250, 0.92);
  color: var(--ink);
  font-size: 1.65rem;
  line-height: 1;
  box-shadow: 0 4px 16px rgba(27, 55, 50, 0.15);
}

.noscript {
  margin: 1rem;
  padding: 1rem;
  border-radius: 10px;
  background: #fff0d8;
}

@media (max-width: 1100px) {
  .filter-grid {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .search-field {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .package-shipping-fields,
  .package-order-details {
    grid-template-columns: 1fr;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
    padding-top: 2rem;
  }

  .inventory-count {
    align-self: flex-start;
    min-width: 130px;
    text-align: left;
  }

  .filters {
    position: static;
    padding: 1rem;
  }

  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .search-field {
    grid-column: 1 / -1;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .card-body {
    padding: 0.75rem;
  }

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

  .dialog-layout > img {
    min-height: auto;
    max-height: 52vh;
  }

  .order-stats {
    grid-template-columns: 1fr 1fr;
  }

  .package-switcher-heading,
  .package-heading-row {
    align-items: stretch;
    flex-direction: column;
  }

  .package-status-panel {
    justify-content: flex-start;
  }


  .order-item {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .order-item img {
    width: 64px;
    height: 64px;
  }

  .order-item-actions {
    grid-column: 2;
    justify-content: flex-start;
    max-width: none;
  }
}

@media (max-width: 440px) {
  .utility-menu-panel {
    right: 0;
    left: auto;
  }

  .filter-heading {
    align-items: flex-start;
  }

  .clear-button {
    padding-inline: 0.75rem;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .search-field {
    grid-column: auto;
  }

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

  .own-data-summary {
    grid-template-columns: 1fr;
  }

  .own-data-summary > .own-summary-wide {
    grid-column: auto;
  }

  .order-dialog-actions {
    align-items: stretch;
    flex-direction: column;
}
  }

  .order-item.unmatched {
    opacity: 0.85;
    border-left: 3px solid var(--warning, #e6a500);
  }

  .order-item-status.unmatched {
    background: var(--warning, #e6a500);
    color: #fff;
  }

  .order-item-actions .create-catalog {
    background: var(--primary, #007b5e);
    color: #fff;
    font-weight: 700;
  }

  .order-item-actions .create-catalog:hover {
    filter: brightness(1.1);
  }

  .package-origin-badge.manual {
    background: var(--warning, #e6a500);
    color: #fff;
    font-size: 0.55rem;
    padding: 0.1rem 0.35rem;
    border-radius: 0.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  @media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
