/* Parts Central design system
   Brand palette from the gear-and-spanner mark: charcoal ink and surfaces, brand red reserved for
   the mark and "you are here". Red never marks selection, so it can't be mistaken for an error. */

:root {
  --gunmetal: #26282c;
  --gunmetal-2: #35383d;
  --gunmetal-3: #4a4e55;
  --brand-red: #e5273a;
  --paper: #eff0f2;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --line: #cfd3d8;
  --line-soft: #e3e6e9;
  --ink: #26282c;
  --ink-2: #4f545c;
  --ink-3: #737982;
  --select: #e6edf5;
  --amber: #f2b300;
  --amber-soft: #fff4cc;
  --amber-ink: #6b4d00;
  --red: #a8192a;
  --red-soft: #fdecea;
  --green: #1e7b4c;
  --green-soft: #e3f4ea;
  --blue: #1f5d99;
  --blue-soft: #e5eff9;

  --font: "Barlow", system-ui, sans-serif;
  --font-cond: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;

  /* Type scale, ~1.25 ratio from a 15px body */
  --t-xs: 0.8125rem; /* 13 */
  --t-sm: 0.875rem; /* 14 */
  --t-md: 0.9375rem; /* 15 */
  --t-lg: 1.1875rem; /* 19 */
  --t-xl: 1.5rem; /* 24 */
  --t-2xl: 2rem; /* 32 */

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --shadow-pop: 0 1px 2px rgba(38, 40, 44, 0.12), 0 8px 24px rgba(38, 40, 44, 0.16);
  --sidebar-w: 236px;
  --focus: 0 0 0 2px var(--surface), 0 0 0 4px var(--gunmetal);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--t-md);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-cond);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.005em;
}

h1 {
  font-size: var(--t-2xl);
}
h2 {
  font-size: var(--t-xl);
}
h3 {
  font-size: var(--t-lg);
}
h4 {
  font-size: var(--t-md);
}

p {
  margin: 0;
}

a {
  color: var(--blue);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--gunmetal);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

/* Icons should never swallow clicks meant for their button */
i {
  pointer-events: none;
}

[hidden] {
  display: none !important;
}

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

.muted {
  color: var(--ink-3);
}

.capitalize {
  text-transform: capitalize;
}

.uppercase {
  text-transform: uppercase;
}

/* ---------- App shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100svh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--gunmetal);
  color: #dcdee1;
  overflow-y: auto;
}

.brand {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 12px;
  align-items: center;
  padding: 20px 20px 18px;
  color: #fff;
  text-decoration: none;
  border-bottom: 1px solid var(--gunmetal-2);
}

.brand:hover {
  color: #fff;
}

.logo-mark {
  grid-row: span 2;
  width: 38px;
  height: 38px;
  color: #dcdee1;
}

.brand-name {
  display: block;
  font-family: var(--font-cond);
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.brand-supplier {
  display: block;
  margin-top: 4px;
  font-size: var(--t-sm);
  color: #a3a8af;
  text-transform: capitalize;
}

.nav {
  padding: 12px 0;
  flex: 1;
}

.nav-group + .nav-group {
  margin-top: 14px;
}

.nav-heading {
  margin: 0;
  padding: 6px 20px;
  font-family: var(--font);
  font-size: var(--t-xs);
  font-weight: 500;
  color: #8a9098;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  color: #dcdee1;
  font-weight: 500;
  text-decoration: none;
}

.nav-link i {
  width: 16px;
  text-align: center;
  color: #8a9098;
}

.nav-link:hover {
  color: #fff;
  background: var(--gunmetal-2);
}

.nav-link[aria-current="page"] {
  color: #fff;
  background: var(--gunmetal-2);
}

.nav-link[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 0 2px 2px 0;
  background: var(--brand-red);
}

.nav-link[aria-current="page"] i {
  color: var(--brand-red);
}

.sidebar :focus-visible,
.topbar :focus-visible,
.auth-side :focus-visible {
  box-shadow: inset 0 0 0 2px #dcdee1;
}

.sidebar-foot {
  padding: 14px 20px 18px;
  border-top: 1px solid var(--gunmetal-2);
  font-size: var(--t-sm);
}

.sidebar-user {
  color: #fff;
  font-weight: 600;
}

.sidebar-foot-links {
  display: flex;
  gap: 16px;
  margin-top: 6px;
}

.sidebar-foot-links a {
  color: #a3a8af;
}

.sidebar-foot-links a:hover {
  color: #fff;
}

.main {
  min-width: 0;
  padding: 32px 40px 64px;
}

.topbar {
  display: none;
}

/* Signed-out pages have no sidebar */
.shell--bare {
  display: block;
}

.shell--bare .main {
  padding: 0;
}

@media (max-width: 900px) {
  .shell {
    display: block;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: var(--gunmetal);
    color: #fff;
  }

  .topbar .brand {
    padding: 0;
    border: 0;
  }

  .topbar .brand-supplier {
    display: none;
  }

  .topbar .logo-mark {
    grid-row: auto;
    width: 28px;
    height: 28px;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(300px, 85vw);
    transform: translateX(-100%);
    transition: transform 200ms ease;
  }

  .sidebar.is-open {
    transform: none;
    box-shadow: var(--shadow-pop);
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(38, 40, 44, 0.45);
  }

  .main {
    padding: 20px 16px 48px;
  }
}

/* ---------- Page header ---------- */

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 24px;
}

.page-head p {
  margin-top: 6px;
  color: var(--ink-2);
  max-width: 64ch;
}

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

.section + .section {
  margin-top: 32px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

/* ---------- Panels ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.panel-body {
  padding: 20px 24px;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}

/* ---------- SKU tag (signature element) ---------- */

.sku {
  display: inline-block;
  padding: 1px 7px;
  border: 1.5px solid var(--gunmetal);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--gunmetal);
  font-family: var(--font-cond);
  font-weight: 600;
  font-size: var(--t-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1.5;
}

.sku--lg {
  padding: 2px 12px;
  border-width: 2px;
  font-size: var(--t-xl);
  letter-spacing: 0.05em;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font: 600 var(--t-sm) / 1 var(--font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--gunmetal);
  color: #fff;
}
.btn--primary:hover:not(:disabled) {
  background: var(--gunmetal-3);
  color: #fff;
}

.btn--secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
.btn--secondary:hover:not(:disabled) {
  border-color: var(--ink-3);
  color: var(--ink);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-2);
}
.btn--ghost:hover:not(:disabled) {
  background: var(--line-soft);
  color: var(--ink);
}

.btn--danger {
  background: var(--red);
  color: #fff;
}
.btn--danger:hover:not(:disabled) {
  background: #8f1c13;
  color: #fff;
}

.btn--danger-quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--red);
}
.btn--danger-quiet:hover:not(:disabled) {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}

.btn--sm {
  min-height: 30px;
  padding: 0 10px;
  font-size: var(--t-xs);
}

.btn--icon {
  width: 34px;
  min-height: 34px;
  padding: 0;
}

.btn--on {
  background: var(--green-soft);
  border-color: #9fd0b4;
  color: var(--green);
}

/* ---------- Forms ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.label {
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink);
}

.help {
  font-size: var(--t-xs);
  color: var(--ink-3);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.input::placeholder {
  color: var(--ink-3);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--ink-3);
}

.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  border-color: var(--gunmetal);
}

.input:disabled,
.select:disabled {
  background-color: var(--surface-2);
  color: var(--ink-3);
  cursor: not-allowed;
}

.select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%2326282c' stroke-width='1.8'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  text-transform: capitalize;
}

.input.is-invalid,
.select.is-invalid {
  border-color: var(--red);
}

.field-error {
  font-size: var(--t-xs);
  color: var(--red);
}

.search {
  display: flex;
  gap: 8px;
  max-width: 720px;
}

.search .input {
  min-height: 44px;
  padding-left: 40px;
  font-size: 1rem;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='5.25' fill='none' stroke='%23737982' stroke-width='1.6'/%3E%3Cpath d='m11 11 3.5 3.5' stroke='%23737982' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat 14px center;
}

.search .btn {
  min-height: 44px;
}

/* Switch: a styled checkbox */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--t-sm);
  font-weight: 500;
  cursor: pointer;
}

.switch input {
  appearance: none;
  flex: none;
  position: relative;
  width: 34px;
  height: 20px;
  margin: 0;
  border-radius: 10px;
  background: var(--line);
  cursor: pointer;
  transition: background-color 120ms ease;
}

.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 120ms ease;
}

.switch input:checked {
  background: var(--gunmetal);
}

.switch input:checked::after {
  transform: translateX(14px);
}

.switch input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.check {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--gunmetal);
  cursor: pointer;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px 16px;
}

/* ---------- Disclosure (<details>) ---------- */

.disclosure {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.disclosure > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  border-radius: var(--r-lg);
}

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

.disclosure > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-right: 2px solid var(--ink-3);
  border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 150ms ease;
}

.disclosure[open] > summary::after {
  transform: rotate(-135deg) translateX(-2px);
}

.disclosure[open] > summary {
  border-bottom: 1px solid var(--line-soft);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.disclosure-body {
  padding: 20px;
}

.summary-note {
  font-weight: 400;
  color: var(--ink-3);
  font-size: var(--t-sm);
}

/* ---------- Tables ---------- */

.table-wrap {
  position: relative; /* keeps absolutely positioned children inside the scroll area */
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-sm);
}

.table th {
  padding: 10px 12px;
  text-align: left;
  font-family: var(--font-cond);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

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

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

.table tbody tr.is-selected td {
  background: var(--select);
}

.table .col-check {
  width: 44px;
}

.table .col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right;
}

.table .center {
  text-align: center;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
}

/* Sortable headers */
.sortable {
  cursor: pointer;
  user-select: none;
}

.sortable::after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 8px;
  vertical-align: middle;
  border: 4px solid transparent;
  border-top-color: var(--line);
  border-bottom-width: 0;
}

.sortable:hover {
  color: var(--ink);
}

.sortAsc::after {
  border-top-width: 0;
  border-bottom: 5px solid var(--gunmetal);
}

.sortDesc::after {
  border-top: 5px solid var(--gunmetal);
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: var(--t-xs);
  font-weight: 600;
  background: var(--line-soft);
  color: var(--ink-2);
  white-space: nowrap;
}

.badge--green {
  background: var(--green-soft);
  color: var(--green);
}

.badge--amber {
  background: var(--amber-soft);
  color: var(--amber-ink);
}

/* ---------- Pagination ---------- */

.pager {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pager .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--r-md);
  color: var(--ink);
  font-weight: 600;
  font-size: var(--t-sm);
  text-decoration: none;
  cursor: pointer;
}

.pager a.page-link:hover {
  background: var(--line-soft);
}

.pager .active .page-link {
  background: var(--gunmetal);
  color: #fff;
  cursor: default;
}

.pager .disabled .page-link,
.pager .gap .page-link {
  color: var(--ink-3);
  cursor: default;
}

.per-page {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--t-sm);
  color: var(--ink-2);
}

.per-page .select {
  width: auto;
  min-height: 34px;
  padding-top: 4px;
  padding-bottom: 4px;
}

/* ---------- Bulk action bar ---------- */

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.bulk-count {
  font-size: var(--t-sm);
  color: var(--ink-2);
  margin-right: 4px;
}

/* ---------- Popovers & menus (HTML popover API, positioned by ui.js) ---------- */

[popover] {
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-pop);
}

.menu {
  min-width: 220px;
  padding: 6px;
}

.menu-item {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: var(--t-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.menu-item[aria-current="true"] {
  background: var(--select);
}

.menu-item small {
  color: var(--ink-3);
}

.menu-item--danger {
  color: var(--red);
  font-weight: 600;
}

.menu-sep {
  height: 1px;
  margin: 6px 4px;
  background: var(--line-soft);
}

.menu form {
  margin: 0;
}

.pop {
  padding: 12px 14px;
  max-width: 280px;
}

.pop h4 {
  margin-bottom: 6px;
  font-size: var(--t-sm);
  color: var(--ink-2);
}

.pop-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- Dialogs (modals & drawers use native <dialog>) ---------- */

dialog {
  padding: 0;
  border: 0;
  color: var(--ink);
  background: var(--surface);
}

dialog::backdrop {
  background: rgba(38, 40, 44, 0.5);
}

.modal {
  width: min(520px, calc(100vw - 32px));
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
}

.modal--wide {
  width: min(820px, calc(100vw - 32px));
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line-soft);
}

.dialog-body {
  padding: 20px 24px;
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 24px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-2);
}

.drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(440px, 100vw);
  height: 100svh;
  max-height: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-pop);
}

.drawer:not([open]) {
  display: none;
}

.drawer .dialog-body {
  flex: 1;
  overflow-y: auto;
}

@media (prefers-reduced-motion: no-preference) {
  .drawer[open] {
    animation: drawer-in 200ms ease-out;
  }

  .modal[open] {
    animation: modal-in 160ms ease-out;
  }
}

@keyframes drawer-in {
  from {
    transform: translateX(32px);
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(400px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border-left: 4px solid var(--ink-3);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  font-weight: 500;
  pointer-events: auto;
}

.toast-text {
  flex: 1;
  padding-top: 5px;
}

.toast--success {
  border-left-color: var(--green);
}
.toast--error {
  border-left-color: var(--red);
}
.toast--warn {
  border-left-color: var(--amber);
}
.toast--info {
  border-left-color: var(--blue);
}

.toast-icon {
  padding-top: 7px;
}
.toast--success .toast-icon {
  color: var(--green);
}
.toast--error .toast-icon {
  color: var(--red);
}
.toast--warn .toast-icon {
  color: #b38400;
}
.toast--info .toast-icon {
  color: var(--blue);
}

/* Session timeout warning */
.session-warning {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  display: none;
  width: min(340px, calc(100vw - 32px));
  padding: 16px;
  border: 2px solid var(--amber);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}

.session-warning.show {
  display: block;
}

.session-warning p + p {
  margin-top: 4px;
  font-size: var(--t-sm);
  color: var(--ink-2);
}

.session-warning .btn {
  margin-top: 12px;
}

/* ---------- Empty states ---------- */

.empty {
  padding: 48px 24px;
  text-align: center;
}

.empty h3 {
  margin-bottom: 6px;
}

.empty p {
  color: var(--ink-2);
  margin: 0 auto 16px;
  max-width: 48ch;
}

/* ---------- Home ---------- */

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  max-width: 1100px;
}

.task {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  color: var(--ink);
  text-decoration: none;
}

.task:hover {
  border-color: var(--gunmetal);
  color: var(--ink);
}

.task-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--gunmetal);
  margin-bottom: 4px;
}

.task p {
  color: var(--ink-2);
  font-size: var(--t-sm);
}

.home-search {
  max-width: 1100px;
  margin-bottom: 32px;
  padding: 28px;
  border-radius: var(--r-lg);
  background: var(--gunmetal);
  color: #fff;
}

.home-search h2 {
  margin-bottom: 14px;
}

.home-search .input {
  border-color: transparent;
}

/* ---------- Auth pages ---------- */

.auth {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.auth-side {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 48px;
  background: var(--gunmetal);
  color: #dcdee1;
}

.auth-side .brand-name {
  color: #fff;
}

.auth-side-copy h1 {
  color: #fff;
  font-size: 2.75rem;
  max-width: 14ch;
}

.auth-side-copy p {
  margin-top: 14px;
  max-width: 40ch;
  color: #a3a8af;
}


.auth-main {
  display: grid;
  place-items: center;
  padding: 40px 24px;
}

.auth-form {
  width: min(380px, 100%);
}

.auth-form h2 {
  margin-bottom: 4px;
}

.auth-form > p {
  color: var(--ink-2);
  margin-bottom: 24px;
}

.auth-alt {
  margin-top: 20px;
  font-size: var(--t-sm);
  color: var(--ink-2);
}

@media (max-width: 800px) {
  .auth {
    grid-template-columns: 1fr;
  }

  .auth-side {
    padding: 24px 16px;
  }

  .auth-side-copy h1 {
    font-size: 2rem;
  }
}

/* ---------- Shared form & data components ---------- */

/* Inline notice for messages that belong to a section or form (not a toast) */
.notice {
  margin: 0;
  padding: 8px 12px;
  border-left: 3px solid var(--ink-3);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: var(--t-sm);
  font-weight: 500;
}

.notice--error {
  border-left-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.notice--warn {
  border-left-color: var(--amber);
  background: var(--amber-soft);
  color: var(--amber-ink);
}

.notice--success {
  border-left-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
}

/* Progress bar */
.progress-track {
  height: 8px;
  border-radius: 4px;
  background: var(--line-soft);
  overflow: hidden;
}

.progress-fill,
.progressFill {
  width: 0;
  height: 100%;
  border-radius: 4px;
  background: var(--gunmetal);
  transition: width linear 200ms;
}

/* Destructive switch */
.switch--danger input:checked {
  background: var(--red);
}

/* ---------- Upload ---------- */

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

.upload-types {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.upload-type {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.upload-type:hover {
  border-color: var(--ink-3);
}

.upload-type[aria-selected="true"] {
  border-color: var(--gunmetal);
  box-shadow: inset 3px 0 0 var(--brand-red);
}

.upload-type-label {
  font-family: var(--font-cond);
  font-size: 1rem;
  font-weight: 600;
}

.upload-type-summary {
  font-size: var(--t-xs);
  color: var(--ink-2);
}

.upload-panel .panel-head p {
  margin-top: 2px;
  font-size: var(--t-sm);
}

.upload-subhead {
  margin-bottom: 8px;
  font-size: var(--t-sm);
  color: var(--ink-2);
}

.upload-columns {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  border-collapse: separate;
  border-spacing: 0;
}

.upload-columns th {
  width: 160px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
}

.upload-columns tr:last-child th {
  border-bottom: 0;
}

.upload-columns tbody tr:hover td {
  background: none;
}

.upload-note {
  margin-top: 8px;
}

.file-input {
  width: 100%;
  padding: 18px 16px;
  border: 1.5px dashed var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--ink-2);
  font: inherit;
  font-size: var(--t-sm);
  cursor: pointer;
}

.file-input:hover {
  border-color: var(--ink-3);
}

.file-input::file-selector-button {
  margin-right: 14px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: 600 var(--t-sm) / 1 var(--font);
  cursor: pointer;
}

.replace-existing {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  border-radius: var(--r-md);
}

.replace-existing .help {
  max-width: 60ch;
}

.uploadProgress {
  display: none;
}

.progressText {
  margin-top: 6px;
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-2);
}

.validationFeedback {
  display: none;
}

@media (max-width: 900px) {
  .upload-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .upload-columns th {
    width: auto;
  }
}

/* ---------- Export ---------- */

.category-picker {
  max-width: 900px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.category-list {
  width: 100%;
  height: 340px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--t-sm);
  text-transform: capitalize;
}

.category-list option {
  padding: 5px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
}

.category-list option:checked {
  background: var(--select);
  color: var(--ink);
}

.category-list:focus-visible option:checked {
  background: var(--gunmetal) linear-gradient(var(--gunmetal), var(--gunmetal));
  color: #fff;
}

.category-moves {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding-top: 24px;
}

.export-status {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 520px;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.export-card {
  display: flex;
  flex-direction: column;
}

.export-card .panel-body {
  flex: 1;
}

.export-card h3 {
  margin-bottom: 4px;
}

.export-card .muted {
  font-size: var(--t-sm);
  max-width: 52ch;
}

.export-count {
  margin-bottom: 2px;
  font-family: var(--font-cond);
  font-size: var(--t-2xl);
  font-weight: 600;
  line-height: 1.1;
}

@media (max-width: 700px) {
  .category-picker {
    grid-template-columns: minmax(0, 1fr);
  }

  .category-list {
    height: 220px;
  }

  .category-moves {
    flex-direction: row;
    justify-content: center;
    padding-top: 0;
  }

  .category-moves .fa-chevron-right,
  .category-moves .fa-angles-right,
  .category-moves .fa-chevron-left,
  .category-moves .fa-angles-left {
    transform: rotate(90deg);
  }
}

/* ---------- Admin & account pages ---------- */

/* Two fields side by side, stacking on narrow screens */
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px 16px;
}

/* ---------- Suppliers ---------- */

.supplier-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.supplier-list .disclosure > summary .badge {
  font-weight: 600;
}

.supplier-body {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr);
  gap: 24px 40px;
}

.supplier-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-heading {
  margin-bottom: 2px;
  font-family: var(--font);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-3);
}

.supplier-details address {
  font-style: normal;
}

.supplier-keys {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.key-field {
  display: flex;
  gap: 6px;
}

.key-field .input {
  flex: 1;
  min-width: 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.key-field .input:disabled {
  color: var(--ink);
  cursor: text;
}

.key-field .btn--icon {
  width: 40px;
  min-height: 40px;
}

.key-field .btn:not(.btn--icon) {
  min-height: 40px;
}

.copy-key.is-copied {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green);
}

.supplier-foot {
  grid-column: 1 / -1;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

@media (max-width: 760px) {
  .supplier-body {
    grid-template-columns: 1fr;
  }

  .key-field {
    flex-wrap: wrap;
  }

  .key-field .input {
    flex-basis: 100%;
  }
}

/* ---------- Profile ---------- */

.profile-panel {
  max-width: 560px;
}

/* ---------- Global suppliers ---------- */

.gs-panel {
  max-width: 760px;
}

.clearable-input {
  position: relative;
}

.clearable-input .input {
  padding-right: 40px;
}

.clearable-input-button {
  position: absolute;
  top: 50%;
  right: 4px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-3);
  transform: translateY(-50%);
  cursor: pointer;
}

.clearable-input-button:hover {
  background: var(--line-soft);
  color: var(--ink);
}

.gs-file {
  padding: 6px;
}

.gs-file::file-selector-button {
  margin-right: 12px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink);
  font: 600 var(--t-sm) var(--font);
  cursor: pointer;
}

.gs-panel .uploadProgress {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gs-progress-track {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--line-soft);
  overflow: hidden;
}

.gs-panel .progressFill {
  width: 0;
  height: 100%;
  border-radius: 4px;
  background: var(--gunmetal);
  transition: width 200ms linear;
}

.gs-panel .progressText {
  min-width: 80px;
  font-size: var(--t-sm);
  font-weight: 600;
  text-align: right;
}

/* ---------- 404 ---------- */

.not-found {
  max-width: 560px;
  padding-top: 48px;
}

.not-found--bare {
  margin: 0 auto;
  padding: 64px 24px;
}

.not-found--bare .brand-name {
  color: var(--ink);
}

.not-found--bare .logo-mark {
  color: var(--gunmetal);
}

.not-found-code {
  font-family: var(--font-cond);
  font-size: 4.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--line);
  letter-spacing: 0.02em;
}

.not-found h1 {
  margin-top: 8px;
}

.not-found > p:not(.not-found-code) {
  margin: 12px 0 24px;
  color: var(--ink-2);
}

/* ---------- Fittings & new part pages ---------- */

/* ---------- Part header (fitting editor, global fittings) ---------- */

.back-link {
  margin: -8px 0 12px -10px;
}

.part-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.part-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin: 10px 0 0;
  font-size: var(--t-sm);
}

.part-meta div {
  display: flex;
  gap: 6px;
}

.part-meta dt {
  color: var(--ink-3);
}

.part-meta dd {
  margin: 0;
  font-weight: 500;
}

.part-head p {
  margin-top: 10px;
}

/* ---------- Fitting tables ---------- */

.fit-table td {
  padding-top: 6px;
  padding-bottom: 6px;
}

#make-filter {
  text-transform: none;
}

.fit-table .num {
  font-variant-numeric: tabular-nums;
}

/* Inline-editable cell: reads as plain text until hovered or focused.
   The negative margin lines its text up with the column heading. */
.cell-input {
  width: calc(100% + 9px);
  margin-left: -9px;
  min-width: 70px;
  min-height: 32px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
}

.cell-input--num {
  max-width: 96px;
  font-variant-numeric: tabular-nums;
}

.cell-input:hover {
  border-color: var(--line);
  background: var(--surface);
}

.cell-input:focus-visible {
  border-color: var(--gunmetal);
  background: var(--surface);
}

.cell-input:disabled {
  color: var(--ink-3);
  cursor: not-allowed;
}

.cell-input:disabled:hover {
  border-color: transparent;
  background: transparent;
}

/* Hide number spinners in the dense table */
.cell-input--num::-webkit-inner-spin-button,
.cell-input--num::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cell-input--num {
  -moz-appearance: textfield;
}

/* A row with unsaved changes */
.table tbody tr.is-dirty td {
  background: var(--select);
}

.table tbody tr.is-dirty td:first-child {
  box-shadow: inset 3px 0 0 var(--gunmetal);
}

/* ---------- Dialog content ---------- */

.fitting-summary {
  font-family: var(--font-cond);
  font-size: var(--t-lg);
  font-weight: 600;
}

.validation-box {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--red);
  border-radius: var(--r-md);
  background: var(--red-soft);
  font-size: var(--t-sm);
}

.validation-box ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.save-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.save-choice + .save-choice {
  border-top: 1px solid var(--line-soft);
}

.save-choice h3 {
  font-size: var(--t-md);
}

.save-choice p {
  margin-top: 2px;
  font-size: var(--t-sm);
  color: var(--ink-2);
}

.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ---------- New part ---------- */

.alt-skus {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.alt-skus legend {
  padding: 0;
  margin-bottom: 6px;
}

.alt-sku-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.alt-sku-container {
  width: 170px;
}

.alt-sku-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.fit-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) minmax(0, 0.8fr) minmax(0, 0.9fr) minmax(0, 0.9fr) 92px 34px;
  align-items: center;
  gap: 8px;
}

.fit-grid--head {
  padding-bottom: 6px;
  font-family: var(--font-cond);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink-2);
}

#form-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fitting-form {
  margin: 0;
  border-radius: var(--r-md);
  transition: background-color 150ms ease, box-shadow 150ms ease;
}

/* Row waiting on the "Remove this fitting?" confirmation */
.fitting-form.is-pending-remove {
  background: var(--red-soft);
  box-shadow: 0 0 0 6px var(--red-soft);
}

/* The "All years" text only shows when rows stack on small screens */
.fit-grid-label {
  display: none;
}

@media (max-width: 760px) {
  .fit-grid {
    grid-template-columns: 1fr 1fr;
  }

  .fit-grid--head {
    display: none;
  }

  .fitting-form {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line-soft);
  }

  .fit-grid-label {
    display: inline;
  }

  .alt-sku-container {
    width: 100%;
  }

  .save-choice {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Uppercase inputs keep sentence-case placeholders */
.fit-grid .input::placeholder {
  text-transform: none;
}

/* Give make and model room to read when the table scrolls on small screens */
.fit-table td:nth-child(-n + 2) .cell-input {
  min-width: 130px;
}
