:root {
  color-scheme: light;
  --bg: #edf3fb;
  --bg-soft: #f8fbff;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --ink: #122034;
  --muted: #66758d;
  --line: #d9e1ef;
  --primary: #4770b6;
  --primary-dark: #335ba0;
  --primary-soft: #dce7fb;
  --success: #2f9d57;
  --warning: #e89a2d;
  --danger: #d84a3a;
  --shadow: 0 18px 40px rgba(31, 58, 100, 0.16);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --content-max: 1120px;
  --floating-fabs-bottom: 18px;
  --floating-fabs-right: 16px;
  --fab-button-size: 30px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(71, 112, 182, 0.18), transparent 30%),
    radial-gradient(circle at right top, rgba(232, 154, 45, 0.10), transparent 24%),
    linear-gradient(180deg, #dce8fb 0%, #f4f8fe 34%, #ecf2fb 100%);
  color: var(--ink);
}

body.is-locked .search-card,
body.is-locked .chips,
body.is-locked .summary-card,
body.is-locked .page-controls,
body.is-locked .floating-fabs {
  opacity: 0.48;
  filter: saturate(0.6);
  pointer-events: none;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  background: none;
  color: inherit;
}

.app-shell {
  width: min(100%, var(--content-max));
  margin: 0 auto;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.hero {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 16px;
  background: linear-gradient(180deg, #4e76ba 0%, #3d67af 100%);
  color: #fff;
  box-shadow: 0 8px 22px rgba(42, 69, 120, 0.22);
}

.hero-copy {
  text-align: center;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(1.08rem, 2.2vw, 1.6rem);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.hero-copy p {
  margin: 4px 0 0;
  font-size: 0.82rem;
  opacity: 0.88;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.55rem;
  line-height: 1;
  cursor: pointer;
}

.content {
  padding: 14px 12px 0;
}

.search-card {
  display: grid;
  grid-template-columns: 28px 1fr 34px;
  align-items: center;
  gap: 10px;
  padding: 14px 14px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.search-icon {
  color: #73839c;
  font-size: 1.1rem;
}

.search-card input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.search-card input::placeholder {
  color: #8491a8;
}

.clear-button {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #dfe6f4;
  color: #627189;
  font-size: 1.2rem;
  cursor: pointer;
}

.chips-label {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  padding: 0 6px 0 2px;
  white-space: nowrap;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.condition-dropdown {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 176px;
  flex: 0 1 auto;
}

.condition-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  width: 100%;
  padding: 0 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, #607fc0 0%, #3f67ad 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(61, 103, 175, 0.18);
  cursor: pointer;
  white-space: nowrap;
}

.condition-trigger.active {
  background: linear-gradient(180deg, #4fa36d 0%, #2f8f50 100%);
  box-shadow: 0 10px 18px rgba(47, 143, 80, 0.24);
}

.condition-trigger:focus-visible,
.multi-switch:focus-within {
  outline: 2px solid rgba(255, 255, 255, 0.75);
  outline-offset: 3px;
}

.condition-trigger__label {
  flex: 0 0 auto;
}

.condition-trigger__value {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.20);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.condition-trigger__caret {
  margin-left: auto;
  font-size: 0.82rem;
  line-height: 1;
  opacity: 0.9;
}

.condition-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 12;
  display: grid;
  gap: 6px;
  min-width: 100%;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 30px rgba(31, 58, 100, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.condition-dropdown.is-open .condition-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.condition-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef3fb 100%);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.condition-option::after {
  content: '✓';
  opacity: 0;
  font-size: 0.9rem;
  line-height: 1;
}

.condition-option.active {
  background: linear-gradient(180deg, #4fa36d 0%, #2f8f50 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 18px rgba(47, 143, 80, 0.18);
}

.condition-option.active::after {
  opacity: 1;
}

.multi-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 14px 0 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, #607fc0 0%, #3f67ad 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(61, 103, 175, 0.18);
  cursor: pointer;
  user-select: none;
}

.multi-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.multi-switch-box {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  flex: 0 0 auto;
}

.multi-switch-box::after {
  content: '✓';
  color: #fff;
  font-size: 0.74rem;
  line-height: 1;
  opacity: 0;
  transform: translateY(-1px);
  transition: opacity 0.18s ease;
}

.multi-switch input:checked ~ .multi-switch-box::after {
  opacity: 1;
}

.multi-switch-text {
  white-space: nowrap;
}

.multi-switch.active {
  background: linear-gradient(180deg, #4fa36d 0%, #2f8f50 100%);
  box-shadow: 0 10px 18px rgba(47, 143, 80, 0.24);
}

.chip {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  background: linear-gradient(180deg, #5d80bf 0%, #446cae 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(61, 103, 175, 0.22);
  cursor: pointer;
}

.chip.active {
  background: linear-gradient(180deg, #7e9fd5 0%, #557abb 100%);
  box-shadow: 0 10px 18px rgba(61, 103, 175, 0.30);
}

.summary-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #7090c7 0%, #5d7fbd 100%);
  color: #fff;
  box-shadow: 0 10px 18px rgba(61, 103, 175, 0.18);
}

.summary-card strong {
  font-size: 1rem;
}

.summary-card span {
  opacity: 0.92;
}

.page-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 10px 18px rgba(61, 103, 175, 0.10);
  backdrop-filter: blur(10px);
}

.page-controls label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.page-controls select {
  min-width: 112px;
  min-height: 42px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f4f7fc 100%);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #66758d 50%),
    linear-gradient(135deg, #66758d 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  box-shadow: 0 6px 14px rgba(31, 58, 100, 0.08);
}

.page-controls select:focus {
  outline: 2px solid rgba(71, 112, 182, 0.28);
  outline-offset: 2px;
}

.results-card {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.table-head,
.result-row {
  display: grid;
  grid-template-columns: 86px minmax(260px, 1fr) 116px 92px 96px 92px;
  column-gap: 0;
  align-items: stretch;
}

.table-head {
  border-bottom: 1px solid var(--line);
  background: rgba(248, 251, 255, 0.94);
  color: #66758d;
  font-size: 0.85rem;
  font-weight: 700;
}

.table-head span,
.cell {
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}

.table-head span:last-child,
.cell:last-child {
  border-right: 0;
}

.results-list {
  display: grid;
}

.empty-state {
  display: grid;
  gap: 10px;
  place-items: center;
  min-height: 220px;
  padding: 28px 22px;
  text-align: center;
  color: var(--muted);
}

.empty-state.access-state {
  min-height: 260px;
  padding: 30px 22px;
  border: 1px solid rgba(71, 112, 182, 0.18);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(240, 245, 252, 0.96) 100%);
  box-shadow: 0 16px 30px rgba(31, 58, 100, 0.08);
}

.empty-state strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
}

.empty-state.access-state strong {
  font-size: 1.08rem;
}

.empty-state p {
  margin: 0;
  max-width: 32ch;
  line-height: 1.5;
}

.empty-state.access-state p {
  max-width: 42ch;
}

.empty-state span {
  color: var(--primary-dark);
  font-weight: 800;
}

.result-row {
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background 0.18s ease, transform 0.18s ease;
}

.result-row:hover,
.result-row.is-selected {
  background: rgba(80, 119, 186, 0.08);
}

.cell {
  display: flex;
  align-items: center;
  min-height: 58px;
  font-size: 0.92rem;
}

.cell.cn {
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  color: #2a3d5f;
}

.cell.product {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #1a2940;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.product-text {
  flex: 1;
  min-width: 0;
}

.copy-product-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 8px;
  background: rgba(95, 130, 192, 0.14);
  border: 1px solid rgba(95, 130, 192, 0.18);
  color: var(--primary-dark);
  font-size: 0.78rem;
  line-height: 1;
  cursor: pointer;
}

.copy-product-button:active {
  transform: translateY(1px);
}

.cell.serial {
  letter-spacing: 0.02em;
  color: #20314b;
}

.cell.actions {
  justify-content: center;
  align-items: center;
}

.result-row .copy-button {
  min-height: 34px;
  min-width: 72px;
  padding: 0 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #5f82c0 0%, #446cae 100%);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(61, 103, 175, 0.18);
  cursor: pointer;
}

.result-row .copy-button:active {
  transform: translateY(1px);
}

.result-row .copy-button:disabled {
  cursor: default;
  opacity: 0.5;
  box-shadow: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 0.42rem 0.7rem;
  border-radius: 10px;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
}

.badge.success {
  background: linear-gradient(180deg, #44aa62 0%, #2f8f50 100%);
}

.badge.info {
  background: linear-gradient(180deg, #5f8fe2 0%, #3f6fce 100%);
  color: #fff;
}

.badge.warning {
  background: linear-gradient(180deg, #f6d66a 0%, #e7bb2f 100%);
  color: #3d2d00;
}

.badge.orange {
  background: linear-gradient(180deg, #f3a24b 0%, #e37c16 100%);
}

.badge.danger {
  background: linear-gradient(180deg, #e25b4b 0%, #c93b2d 100%);
}

.cell.date {
  color: #1f314c;
  font-weight: 600;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 14;
  background: rgba(17, 31, 52, 0.28);
  backdrop-filter: blur(1px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.detail-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.detail-sheet {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%) translateY(120%);
  width: min(calc(100% - 18px), var(--content-max));
  max-height: min(74vh, 760px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 12px calc(14px + env(safe-area-inset-bottom));
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -18px 40px rgba(31, 58, 100, 0.16);
  backdrop-filter: blur(14px);
  z-index: 15;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.detail-sheet.is-open {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.detail-sheet .badge {
  color: #fff;
}

.detail-sheet .badge.warning {
  background: linear-gradient(180deg, #e0a12b 0%, #c68614 100%);
}

.pin-filter-backdrop,
.product-exclude-backdrop {
  position: fixed;
  inset: 0;
  z-index: 16;
  background: rgba(17, 31, 52, 0.22);
  backdrop-filter: blur(1px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.pin-filter-backdrop.show,
.product-exclude-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.pin-filter-sheet,
.product-exclude-sheet {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%) translateY(120%);
  width: min(440px, calc(100% - 18px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -18px 40px rgba(31, 58, 100, 0.16);
  backdrop-filter: blur(14px);
  z-index: 17;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.24s ease, opacity 0.24s ease;
}

.pin-filter-sheet.is-open,
.product-exclude-sheet.is-open {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.pin-filter-header,
.product-exclude-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 2px 4px 0;
}

.pin-filter-title,
.product-exclude-title {
  display: grid;
  gap: 2px;
}

.pin-filter-title span,
.product-exclude-title span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pin-filter-title strong,
.product-exclude-title strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
}

.pin-filter-close,
.product-exclude-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #dfe6f4;
  color: #52657e;
  font-size: 1.5rem;
  cursor: pointer;
}

.pin-filter-body,
.product-exclude-body {
  display: grid;
  gap: 12px;
  padding: 4px 4px 2px;
}

.pin-filter-ops {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pin-op-button {
  min-height: 42px;
  border-radius: 12px;
  background: linear-gradient(180deg, #607fc0 0%, #3f67ad 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(61, 103, 175, 0.18);
  cursor: pointer;
}

.pin-op-button.active {
  background: linear-gradient(180deg, #4fa36d 0%, #2f8f50 100%);
  box-shadow: 0 10px 18px rgba(47, 143, 80, 0.24);
}

.pin-filter-field,
.product-exclude-field {
  display: grid;
  gap: 8px;
}

.pin-filter-field span,
.product-exclude-field span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.pin-filter-field input,
.product-exclude-field input {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f7fc 100%);
  color: var(--ink);
  font-weight: 800;
}

.pin-filter-field input:focus,
.product-exclude-field input:focus {
  outline: 2px solid rgba(71, 112, 182, 0.28);
  outline-offset: 2px;
}

.pin-filter-hint,
.product-exclude-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.pin-filter-actions,
.product-exclude-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 2px;
}

.pin-filter-actions button,
.product-exclude-actions button {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, #5d80bf 0%, #446cae 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(61, 103, 175, 0.22);
  cursor: pointer;
}

.pin-filter-actions button:nth-child(1),
.product-exclude-actions button:nth-child(1) {
  background: linear-gradient(180deg, #dfe6f4 0%, #cfd9ea 100%);
  color: #52657e;
}

@media (max-width: 1024px) and (min-width: 641px) {
  .detail-sheet {
    width: min(760px, calc(100% - 22px));
    bottom: 10px;
    max-height: min(82vh, 780px);
    padding: 14px 14px calc(16px + env(safe-area-inset-bottom));
    border-radius: 20px;
  }

  .sheet-header {
    padding: 4px 4px 2px;
  }

  .sheet-title span {
    font-size: 0.82rem;
  }

  .sheet-title strong {
    font-size: 1.04rem;
  }

  .sheet-close {
    width: 42px;
    height: 42px;
  }

  .sheet-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 10px;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 6px;
    min-height: 0;
    padding: 8px 10px;
    border: 1px solid #e4eaf5;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fafe 100%);
    border-bottom: 0;
  }

  .detail-row span {
    font-size: 0.8rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
  }

  .detail-row strong {
    font-size: 0.95rem;
    line-height: 1.35;
  }

  .detail-copy-product {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    font-size: 0.76rem;
  }

  .sheet-body .detail-row:last-child {
    grid-column: 1 / -1;
  }

  .sheet-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 10px;
  }

  .sheet-actions button {
    min-height: 46px;
  }

  .pin-filter-sheet,
  .product-exclude-sheet {
    width: min(520px, calc(100% - 22px));
    bottom: 10px;
    padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
    border-radius: 20px;
  }
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 2px 4px 0;
}

.sheet-title {
  display: grid;
  gap: 2px;
}

.sheet-title span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sheet-title strong {
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 800;
}

.sheet-close {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #dfe6f4;
  color: #52657e;
  font-size: 1.5rem;
  cursor: pointer;
}

.sheet-handle {
  width: 72px;
  height: 5px;
  margin: 0 auto 2px;
  border-radius: 999px;
  background: #cdd6e6;
  cursor: pointer;
}

.sheet-body {
  flex: 1;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding: 8px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fefefe 0%, #f5f8fd 100%);
}

.detail-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  padding: 4px 2px;
  min-height: 0;
  border-bottom: 1px solid #e4eaf5;
}

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

.detail-row span {
  color: var(--muted);
  font-weight: 700;
}

.detail-row strong {
  color: var(--ink);
  font-weight: 800;
  word-break: break-word;
  line-height: 1.28;
}

.detail-row--product .detail-value {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.detail-row--product .detail-value strong {
  flex: 1;
  min-width: 0;
}

.detail-copy-product {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  border-radius: 8px;
  background: rgba(95, 130, 192, 0.14);
  border: 1px solid rgba(95, 130, 192, 0.18);
  color: var(--primary-dark);
  font-size: 0.82rem;
  line-height: 1;
  cursor: pointer;
}

.detail-copy-product:disabled {
  opacity: 0.45;
  cursor: default;
}

.sheet-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.sheet-actions button {
  min-height: 48px;
  padding: 0 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, #5d80bf 0%, #446cae 100%);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(61, 103, 175, 0.22);
  cursor: pointer;
}

.sheet-actions button:nth-child(1) {
  background: linear-gradient(180deg, #5073b2 0%, #3d5f99 100%);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 228px;
  transform: translateX(-50%);
  z-index: 20;
  display: none;
  padding: 12px 16px;
  border-radius: 999px;
  background: rgba(17, 31, 52, 0.92);
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.toast.show {
  display: block;
}

.floating-fabs {
  position: fixed;
  right: calc(env(safe-area-inset-right) + var(--floating-fabs-right));
  bottom: calc(env(safe-area-inset-bottom) + var(--floating-fabs-bottom));
  z-index: 26;
  display: grid;
  gap: 7px;
  justify-items: end;
  pointer-events: none;
}

.fab-button {
  display: grid;
  place-items: center;
  width: var(--fab-button-size);
  height: var(--fab-button-size);
  border-radius: 999px;
  background: linear-gradient(180deg, #5d80bf 0%, #446cae 100%);
  color: #fff;
  box-shadow: 0 14px 30px rgba(61, 103, 175, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(12px);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  pointer-events: auto;
}

.fab-page {
  font-size: 1.05rem;
  line-height: 1;
}

.fab-refresh {
  font-size: 0.95rem;
}

.fab-refresh-icon {
  display: inline-block;
  font-size: 1.05rem;
  line-height: 1;
  transform-origin: center;
}

.fab-button:hover {
  box-shadow: 0 16px 32px rgba(61, 103, 175, 0.34);
  transform: translateY(-1px);
}

.fab-button:active {
  transform: translateY(1px) scale(0.98);
}

.fab-button:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.82);
  outline-offset: 3px;
}

.fab-button:disabled {
  opacity: 0.72;
  cursor: progress;
}

.fab-refresh.is-loading .fab-refresh-icon {
  animation: refresh-spin 0.8s linear infinite;
}

@keyframes refresh-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 820px) {
  .table-head,
  .result-row {
    grid-template-columns: 72px minmax(0, 1fr) 100px 82px 82px 78px;
  }

  .table-head span,
  .cell {
    padding-left: 10px;
    padding-right: 10px;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 12px 12px 10px;
  }

  .hero-copy h1 {
    font-size: 0.98rem;
  }

  .hero-copy p {
    display: none;
  }

  .icon-button {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 1.35rem;
  }

  .content {
    padding: 10px 10px 0;
  }

  .page-controls {
    gap: 10px;
    padding: 12px 14px;
  }

  .page-controls label {
    font-size: 0.82rem;
    line-height: 1.2;
  }

  .page-controls select {
    min-width: 96px;
    min-height: 40px;
    padding-right: 34px;
  }

  .condition-dropdown {
    min-width: 154px;
  }

  .condition-trigger {
    min-height: 40px;
    padding: 0 12px;
  }

  .condition-trigger__label {
    font-size: 0.88rem;
  }

  .condition-trigger__value {
    font-size: 0.72rem;
    padding: 0 7px;
  }

  .condition-menu {
    min-width: 100%;
  }

  .multi-switch {
    min-height: 40px;
    padding: 0 12px 0 10px;
  }

  .multi-switch-text {
    font-size: 0.88rem;
  }

  .table-head {
    display: none;
  }

  .result-row {
    grid-template-columns: 74px 1fr auto;
    grid-template-areas:
      "cn product copy"
      "serial serial copy"
      "pin date copy";
    gap: 8px 10px;
    padding: 12px 12px 10px;
    border-bottom: 0;
    margin-bottom: 10px;
    border: 1px solid rgba(217, 225, 239, 0.9);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 10px 22px rgba(31, 58, 100, 0.08);
  }

  .results-list {
    gap: 0;
  }

  .empty-state {
    min-height: 180px;
    padding: 24px 18px;
  }

  .cell {
    min-height: 0;
    padding: 0;
    border-right: 0;
  }

  .cell.product {
    grid-area: product;
    align-items: flex-start;
    padding-top: 0;
    font-size: 0.84rem;
    line-height: 1.16;
    gap: 6px;
  }

  .product-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    line-height: 1.14;
  }

  .copy-product-button {
    width: 22px;
    height: 22px;
    margin-top: 0;
    border-radius: 7px;
    font-size: 0.72rem;
  }

  .cell.cn {
    grid-area: cn;
    align-items: center;
    justify-content: center;
    padding-top: 2px;
  }

  .cell.serial,
  .cell.date,
  .cell.pin {
    min-height: auto;
    padding: 0;
    color: #4b5b72;
  }

  .cell.serial {
    grid-area: serial;
    font-size: 0.84rem;
    justify-content: flex-start;
  }

  .cell.pin {
    grid-area: pin;
    justify-content: flex-start;
  }

  .cell.date {
    grid-area: date;
    justify-content: flex-end;
    padding-bottom: 0;
  }

  .cell.actions {
    grid-area: copy;
    justify-content: center;
    align-self: center;
    justify-self: end;
  }

  .result-row .copy-button {
    min-width: 60px;
    min-height: 34px;
    padding: 0 8px;
    font-size: 0.72rem;
  }

  .result-row.is-selected {
    outline: 2px solid rgba(71, 112, 182, 0.28);
    background: linear-gradient(180deg, rgba(235, 241, 252, 0.98) 0%, rgba(247, 250, 255, 0.98) 100%);
  }

  .detail-sheet {
    width: calc(100% - 12px);
    bottom: 6px;
    border-radius: 18px;
  }

  .pin-filter-sheet,
  .product-exclude-sheet {
    width: calc(100% - 12px);
    bottom: 6px;
    border-radius: 18px;
  }

  .sheet-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px;
  }

  .detail-row {
    min-height: 0;
    padding: 8px 10px;
  }

  .detail-row span {
    font-size: 0.78rem;
  }

  .detail-row strong {
    font-size: 0.94rem;
  }

  .detail-copy-product {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    font-size: 0.76rem;
  }

  .sheet-actions {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .sheet-actions button:nth-child(2),
  .sheet-actions button:nth-child(3) {
    display: none;
  }

  .sheet-actions button:nth-child(1) {
    width: min(220px, 100%);
  }

  .pin-filter-header {
    padding: 2px 2px 0;
  }

  .pin-filter-title span {
    font-size: 0.72rem;
  }

  .pin-filter-title strong {
    font-size: 0.94rem;
  }

  .pin-filter-close {
    width: 38px;
    height: 38px;
  }

  .pin-filter-body {
    gap: 10px;
  }

  .pin-filter-ops {
    gap: 7px;
  }

  .pin-op-button,
  .pin-filter-actions button,
  .pin-filter-field input {
    min-height: 40px;
    border-radius: 11px;
  }

  .toast {
    bottom: 246px;
  }

  :root {
    --fab-button-size: 28px;
  }
}

@media (min-width: 480px) and (max-width: 640px) {
  .detail-sheet {
    max-height: min(80vh, 760px);
    padding: 12px 12px calc(14px + env(safe-area-inset-bottom));
  }

  .sheet-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .detail-row {
    min-height: 0;
    padding: 8px 10px;
    border: 1px solid #e4eaf5;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fafe 100%);
    border-bottom: 0;
  }

  .detail-row span {
    font-size: 0.77rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
  }

  .detail-row strong {
    font-size: 0.92rem;
    line-height: 1.32;
  }

  .detail-copy-product {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    font-size: 0.76rem;
  }

  .sheet-body .detail-row:last-child {
    grid-column: 1 / -1;
  }

  .sheet-actions {
    grid-template-columns: 1fr;
    gap: 10px;
    justify-items: center;
  }

  .sheet-actions button:nth-child(2),
  .sheet-actions button:nth-child(3) {
    display: none;
  }

  .sheet-actions button:nth-child(1) {
    width: min(220px, 100%);
  }

  .pin-filter-sheet,
  .product-exclude-sheet {
    max-height: min(74vh, 540px);
    padding: 12px 12px calc(14px + env(safe-area-inset-bottom));
  }

  .pin-filter-ops {
    gap: 7px;
  }

  .pin-filter-body {
    gap: 10px;
  }

  .pin-filter-actions {
    gap: 7px;
  }
}
