:root {
  --primary: #ff385c;
  --primary-dark: #e00b41;
  --primary-soft: #fff0f3;
  --ink: #222222;
  --body: #3f3f3f;
  --muted: #6a6a6a;
  --muted-soft: #929292;
  --hairline: #dddddd;
  --hairline-soft: #ebebeb;
  --surface: #ffffff;
  --surface-soft: #f7f7f7;
  --surface-strong: #f2f2f2;
  --success: #16845b;
  --success-soft: #eaf8f2;
  --warning: #b55d00;
  --warning-soft: #fff4e8;
  --shadow: 0 0 0 1px rgba(0, 0, 0, 0.02), 0 2px 6px rgba(0, 0, 0, 0.04),
    0 4px 12px rgba(0, 0, 0, 0.09);
  --font: Inter, "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--surface);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-width: 320px;
}

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

button {
  color: inherit;
}

button,
a,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

svg {
  display: block;
}

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

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  height: 80px;
  border-bottom: 1px solid var(--hairline-soft);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(1280px, calc(100% - 48px));
  height: 100%;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 11px;
  background: var(--primary);
  color: white;
}

.nav-tabs {
  display: flex;
  align-self: stretch;
  gap: 32px;
}

.nav-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

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

.nav-tab.active {
  color: var(--ink);
}

.nav-tab.active::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  content: "";
}

.top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.warehouse-pill,
.avatar-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  border: 1px solid var(--hairline);
  background: white;
  cursor: pointer;
}

.warehouse-pill {
  padding: 0 15px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.avatar-button {
  width: 42px;
  justify-content: center;
  border-radius: 50%;
}

.page {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 42px 0 72px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.hero h1,
.page-heading h1 {
  margin: 0;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -1.2px;
}

.hero-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 160ms ease, border 160ms ease, transform 160ms ease;
}

.button:active {
  transform: scale(0.98);
}

.button-primary {
  background: var(--primary);
  color: white;
}

.button-primary:hover {
  background: var(--primary-dark);
}

.button-secondary {
  border-color: var(--ink);
  background: white;
}

.button-secondary:hover,
.button-ghost:hover {
  background: var(--surface-soft);
}

.button-ghost {
  border-color: var(--hairline);
  background: white;
}

.button-small {
  min-height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  background: white;
  cursor: pointer;
}

.icon-button:hover {
  background: var(--surface-soft);
}

.search-surface {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto auto 52px;
  align-items: center;
  height: 68px;
  margin-bottom: 28px;
  padding: 7px 8px 7px 24px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: white;
  box-shadow: var(--shadow);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 15px;
}

.search-field input::placeholder {
  color: var(--muted);
}

.search-filter {
  min-width: 150px;
  padding: 0 22px;
  border-right: 1px solid var(--hairline);
  color: var(--muted);
}

.search-filter:first-of-type {
  border-left: 1px solid var(--hairline);
}

.search-filter label {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.search-filter select {
  width: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.search-orb {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  cursor: pointer;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  padding: 22px;
  border: 1px solid var(--hairline-soft);
  border-radius: 16px;
  background: white;
}

.stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
}

.stat-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--ink);
}

.stat-icon.accent {
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-value {
  margin-bottom: 5px;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -1px;
}

.stat-note {
  color: var(--muted);
  font-size: 12px;
}

.stat-note strong {
  color: var(--success);
  font-weight: 600;
}

.section-head,
.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.section-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.4px;
}

.section-subtitle,
.page-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.inventory-card {
  overflow: hidden;
  border: 1px solid var(--hairline-soft);
  border-radius: 18px;
  background: white;
  cursor: pointer;
  transition: box-shadow 180ms ease, transform 180ms ease;
}

.inventory-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-visual {
  position: relative;
  display: flex;
  min-height: 148px;
  padding: 20px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background: linear-gradient(145deg, #f5f1ed, #e8dfd6);
}

.card-visual.blue {
  background: linear-gradient(145deg, #edf3f5, #d9e5e9);
}

.card-visual.green {
  background: linear-gradient(145deg, #edf3ed, #dce8dc);
}

.card-visual::after {
  position: absolute;
  right: -36px;
  bottom: -54px;
  width: 170px;
  height: 170px;
  border: 22px solid rgba(255, 255, 255, 0.48);
  border-radius: 38px;
  content: "";
  transform: rotate(24deg);
}

.location-badge {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  font-size: 12px;
  font-weight: 700;
}

.visual-part-count {
  position: relative;
  z-index: 1;
}

.visual-part-count strong {
  display: block;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -1px;
}

.visual-part-count span {
  color: var(--muted);
  font-size: 12px;
}

.card-body {
  padding: 18px 20px 20px;
}

.card-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  font-size: 11px;
  font-weight: 700;
}

.status-badge.low {
  background: var(--warning-soft);
  color: var(--warning);
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.progress-caption {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
}

.list-shell {
  overflow: hidden;
  border: 1px solid var(--hairline-soft);
  border-radius: 18px;
}

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--hairline-soft);
}

.compact-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(420px, 100%);
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
}

.compact-search input {
  width: 100%;
  border: 0;
  outline: 0;
}

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

.table th,
.table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--hairline-soft);
  text-align: left;
  font-size: 13px;
}

.table th {
  color: var(--muted);
  background: #fcfcfc;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

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

.table tbody tr {
  cursor: pointer;
}

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

.table-primary {
  font-weight: 650;
}

.table-secondary {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.location-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 650;
}

.part-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.part-chip {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-strong);
  font-size: 11px;
  font-weight: 600;
}

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

.empty-icon {
  display: grid;
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
}

.empty-state h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(0, 0, 0, 0.48);
}

.modal {
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 20px;
  background: white;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
}

.modal-wide {
  width: min(840px, 100%);
}

.modal-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--hairline-soft);
  background: white;
}

.modal-header h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  position: sticky;
  z-index: 2;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--hairline-soft);
  background: white;
}

.detail-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  margin-bottom: 24px;
  padding: 22px;
  border-radius: 16px;
  background: var(--surface-soft);
}

.detail-id {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.detail-title {
  margin: 0 0 10px;
  font-size: 21px;
  font-weight: 650;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}

.detail-location {
  align-self: center;
  padding: 12px 16px;
  border-radius: 12px;
  background: white;
  text-align: center;
}

.detail-location small {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.detail-location strong {
  font-size: 18px;
}

.parts-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.parts-heading h3 {
  margin: 0;
  font-size: 16px;
}

.parts-heading span {
  color: var(--muted);
  font-size: 12px;
}

.parts-list {
  border: 1px solid var(--hairline-soft);
  border-radius: 14px;
}

.part-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--hairline-soft);
}

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

.part-status-icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
}

.part-row.shipped .part-status-icon {
  background: var(--surface-strong);
  color: var(--muted);
}

.part-row.shipped .part-name {
  color: var(--muted);
  text-decoration: line-through;
}

.part-code {
  margin-bottom: 3px;
  font-size: 13px;
  font-weight: 650;
}

.part-name {
  color: var(--muted);
  font-size: 12px;
}

.shipped-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

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

.field label {
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 13px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  outline: 0;
  background: white;
  color: var(--ink);
}

.field textarea {
  min-height: 86px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border: 2px solid var(--ink);
  padding: 11px 12px;
}

.field-help {
  color: var(--muted);
  font-size: 11px;
}

.field input.invalid,
.field select.invalid {
  border: 2px solid #c13515;
  padding: 11px 12px;
}

.form-alert {
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: 10px;
  background: #fff0ed;
  color: #c13515;
  font-size: 12px;
  font-weight: 600;
}

.form-alert[hidden] {
  display: none;
}

.form-section {
  margin-top: 26px;
}

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

.form-section-head h3 {
  margin: 0;
  font-size: 15px;
}

.check-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--hairline-soft);
  border-radius: 11px;
  cursor: pointer;
}

.check-item:hover {
  background: var(--surface-soft);
}

.check-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.check-copy strong {
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
}

.check-copy span {
  color: var(--muted);
  font-size: 11px;
}

.dynamic-part {
  display: grid;
  grid-template-columns: 0.65fr 1.35fr 40px;
  gap: 10px;
  margin-bottom: 10px;
}

.dynamic-part input {
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: 9px;
  outline: 0;
}

.dynamic-part input:focus {
  border: 2px solid var(--ink);
}

.remove-part {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
}

#toast-root {
  position: fixed;
  z-index: 200;
  right: 24px;
  bottom: 24px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.2);
  font-size: 13px;
  animation: toast-in 200ms ease;
}

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

.mobile-nav {
  display: none;
}

@media (max-width: 980px) {
  .topbar-inner {
    grid-template-columns: 1fr auto;
  }

  .nav-tabs {
    display: none;
  }

  .hero {
    flex-wrap: wrap;
    gap: 24px;
  }

  .hero-actions {
    justify-content: flex-start;
  }

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

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

  .mobile-nav {
    position: fixed;
    z-index: 30;
    right: 12px;
    bottom: 12px;
    left: 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    height: 64px;
    padding: 6px;
    border: 1px solid var(--hairline);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
  }

  .mobile-nav button {
    display: grid;
    gap: 2px;
    place-items: center;
    border: 0;
    border-radius: 15px;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
  }

  .mobile-nav button.active {
    background: var(--primary-soft);
    color: var(--primary);
  }

  .page {
    padding-bottom: 100px;
  }
}

@media (max-width: 720px) {
  .topbar {
    height: 68px;
  }

  .topbar-inner,
  .page {
    width: min(100% - 28px, 1280px);
  }

  .brand {
    font-size: 18px;
  }

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

  .warehouse-pill {
    display: none;
  }

  .page {
    padding-top: 28px;
  }

  .hero h1,
  .page-heading h1 {
    font-size: 29px;
  }

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

  .hero-actions,
  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions .button,
  .page-heading .button {
    width: 100%;
  }

  .search-surface {
    grid-template-columns: 1fr 48px;
    height: 62px;
    padding-left: 18px;
  }

  .search-filter {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-head {
    margin-bottom: 14px;
  }

  .stat-icon {
    width: 32px;
    height: 32px;
  }

  .stat-value {
    font-size: 25px;
  }

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

  .list-shell {
    overflow-x: auto;
  }

  .table {
    min-width: 700px;
  }

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

  .compact-search {
    width: 100%;
  }

  .modal-backdrop {
    padding: 0;
    place-items: end center;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
  }

  .modal-body {
    padding: 18px;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-location {
    text-align: left;
  }

  .form-grid,
  .check-list {
    grid-template-columns: 1fr;
  }

  .dynamic-part {
    grid-template-columns: 1fr 40px;
  }

  .dynamic-part input:first-child {
    grid-column: 1;
  }

  .dynamic-part input:nth-child(2) {
    grid-row: 2;
  }

  .remove-part {
    grid-row: 1;
    grid-column: 2;
  }
}
