html, body { margin: 0; padding: 0; min-height: 100%; background: #F5F6FB; }
* { box-sizing: border-box; }
body {
  font-family: 'Hiragino Sans', 'Yu Gothic', -apple-system, 'Segoe UI', sans-serif;
  color: #14142B;
}
::selection { background: #C7CBF9; }
::-webkit-scrollbar { height: 8px; width: 8px; }
::-webkit-scrollbar-thumb { background: #D6D9EE; border-radius: 8px; }

input[type=text]:focus {
  outline: 2px solid #4338CA33; border-color: #4338CA !important;
}

.search-wrap { position: relative; flex: 1 1 280px; }
.search-wrap .icon-slot { position: absolute; left: 12px; top: 11px; color: #9297BB; }
.search-wrap input {
  width: 100%; padding: 10px 12px 10px 34px; border-radius: 10px; border: 1px solid #E4E6F1; font-size: 14px; font-family: inherit;
}

.table-card { background: #fff; border: 1px solid #E4E6F1; border-radius: 16px; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data thead tr { background: #F8F8FC; border-bottom: 1px solid #E4E6F1; text-align: left; }
table.data th { padding: 12px 16px; color: #6B7094; font-weight: 700; white-space: nowrap; }
table.data td { padding: 12px 16px; border-bottom: 1px solid #EEF0F8; }
table.data tbody tr:last-child td { border-bottom: none; }
.table-foot { padding: 10px 16px; font-size: 12px; color: #9297BB; border-top: 1px solid #EEF0F8; }

.status-badge {
  display: inline-flex; align-items: center; justify-content: center; height: 28px; padding: 0 12px;
  border-radius: 999px; font-weight: 800; font-size: 13px; white-space: nowrap;
}
.status-badge.ok { background: #ECFBF3; color: #0B6B45; }
.status-badge.low { background: #FFF6E5; color: #B45309; }
.status-badge.out { background: #FEECEC; color: #C2410C; }

.topbar-mark {
  width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, #4338CA, #6366F1);
  display: flex; align-items: center; justify-content: center;
}

.public-shell { min-height: 100vh; background: #F5F6FB; display: flex; flex-direction: column; }
.public-head { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid #E4E6F1; padding: 20px 24px; }
.public-head-inner { max-width: 1300px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.public-title { font-size: 19px; font-weight: 800; }
.public-sub { font-size: 12px; color: #8388AC; }
.public-body { flex: 1; padding: 24px 20px 40px; }
.public-body-inner { max-width: 1300px; margin: 0 auto; }

.category-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px; margin-bottom: 14px;
}
.category-tile {
  background: #fff; border: 1px solid #E4E6F1; border-radius: 12px; padding: 12px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-decoration: none; color: #3A3D5C; transition: border-color .12s ease, background .12s ease;
}
.category-tile:hover { border-color: #C7CBF9; background: #F8F8FF; }
.category-tile.active { border-color: #4338CA; background: #EEF0FE; color: #4338CA; }
.category-tile-icon {
  width: 34px; height: 34px; border-radius: 9px; background: #EEF0FE; color: #4338CA;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.category-tile.active .category-tile-icon { background: #4338CA; color: #fff; }
.category-tile-label { font-size: 11.5px; font-weight: 600; text-align: center; line-height: 1.3; }
.category-tile-count { font-size: 10.5px; color: #9297BB; }
.category-tile.active .category-tile-count { color: #6D74D6; }

.product-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px;
}
.product-card {
  background: #fff; border: 1px solid #E4E6F1; border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column;
}
.product-image-wrap {
  width: 100%; aspect-ratio: 1 / 1; background: #F1F2F8; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.product-image-wrap img { width: 100%; height: 100%; object-fit: cover; }
.product-image-wrap .placeholder-icon { color: #C7CBDA; }
.product-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-code { font-size: 12px; color: #4338CA; font-weight: 700; }
.product-name { font-size: 14.5px; font-weight: 700; line-height: 1.4; }
.product-status-row { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; }
.catalog-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 9px 12px;
  background: #EEF0FE; color: #4338CA; border-radius: 9px; font-size: 13px; font-weight: 700;
  text-decoration: none; justify-content: center;
}
.catalog-link:hover { background: #E0E3FC; }
.no-results { padding: 60px 20px; text-align: center; color: #9297BB; background: #fff; border: 1px solid #E4E6F1; border-radius: 16px; }
.product-grid .no-results { grid-column: 1 / -1; }

.result-foot { position: relative; display: flex; align-items: center; justify-content: center; margin-top: 14px; padding: 4px 0; }
.result-foot .table-count { position: absolute; right: 0; top: 50%; transform: translateY(-50%); white-space: nowrap; }
.pagination-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.page-link {
  display: inline-flex; align-items: center; justify-content: center; padding: 9px 15px; border-radius: 9px;
  background: #F1F2F8; color: #5C6084; font-size: 13px; font-weight: 700; text-decoration: none;
}
.page-link.active { background: #4338CA; color: #fff; }
.page-link.disabled { color: #C7CBDA; }
.page-ellipsis { padding: 8px 4px; color: #9297BB; font-size: 13px; }

.view-toggle { display: flex; background: #F0F1F9; border-radius: 10px; padding: 3px; }
.view-toggle a {
  padding: 8px 14px; font-size: 13px; font-weight: 700; color: #5C6084; border-radius: 8px;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.view-toggle a.active { background: #4338CA; color: #fff; }

.product-list { display: flex; flex-direction: column; gap: 10px; }
.product-list-row {
  background: #fff; border: 1px solid #E4E6F1; border-radius: 14px; padding: 12px 16px;
  display: flex; align-items: center; gap: 16px;
}
.product-list-row .product-image-wrap {
  width: 84px; height: 84px; aspect-ratio: auto; border-radius: 12px; flex-shrink: 0;
}
.product-list-row .product-info { flex: 1; min-width: 0; }
.product-list-row .product-name { font-size: 15px; }
.product-list-row .product-status-row { margin-top: 4px; padding-top: 0; justify-content: flex-start; gap: 10px; }
.product-list-row .catalog-link { margin-top: 0; flex-shrink: 0; white-space: nowrap; }
