html {
  scroll-behavior: smooth;
}

:root {
  --bg: #0f1115;
  --bg-alt: #181c22;
  --bg-soft: #1f252d;
  --surface: #242b34;
  --border: #2f3944;
  --text: #e6ebf0;
  --text-dim: #9aa6b5;
  --accent: #3d8bfd;
  --accent-hover: #2474eb;
  --danger: #ff4d4f;
  --warn: #ffb347;
  --ok: #32c671;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 10px;
  --shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.4),
    0 2px 4px -1px rgba(0, 0, 0, 0.3);
  --gap-xs: 4px;
  --gap-sm: 8px;
  --gap: 16px;
  --gap-lg: 24px;
  --trans: 160ms ease;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial,
    sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(145deg, var(--bg) 0%, #12161c 70%);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

img,
svg {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  line-height: 1.2;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Top Bar */
.top-bar {
  position: sticky;
  top: 0;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  background: rgba(20, 24, 30, 0.85);
  border-bottom: 1px solid var(--border);
  padding: 14px clamp(16px, 4vw, 42px);
  display: flex;
  align-items: center;
  z-index: 50;
}

.top-bar h1 {
  font-size: clamp(1.05rem, 2.2vw, 1.4rem);
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #fff, #b6d4ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Container */
.container {
  width: min(1280px, 100%);
  margin-inline: auto;
  padding: 18px clamp(14px, 3vw, 40px) 60px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--gap-lg);
}
.summary {
  display: grid;
  gap: var(--gap);
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 1fr);
  overflow-x: auto;
  /* Removed scrollbar-width & scrollbar-color (Firefox-only) for cross-browser lint cleanliness */
}
.summary::-webkit-scrollbar {
  height: 6px;
}
.summary::-webkit-scrollbar-track {
  background: transparent;
}
.summary::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--accent), var(--accent-hover));
  border-radius: 20px;
}

.summary .card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 14px 16px 12px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  isolation: isolate;
  min-width: 150px;
  box-shadow: 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  transition: background var(--trans), border-color var(--trans),
    transform var(--trans);
}
.summary .card:hover {
  background: var(--surface);
  border-color: #3b4652;
  transform: translateY(-2px);
}
.summary .card h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 600;
  color: var(--text-dim);
}
.summary .card .value {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(90deg, #fff, #d2e6ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.summary .card.accent {
  background: linear-gradient(145deg, #18324d, #1f2d3d);
  border-color: #2d4f78;
}
.summary .card.alt {
  background: linear-gradient(145deg, #2c2338, #352c42);
  border-color: #44385a;
}
.summary .card.danger {
  background: linear-gradient(145deg, #3d1e23, #472329);
  border-color: #5f2d33;
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.controls input[type="text"],
.controls select {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
  border-radius: var(--radius-sm);
  outline: none;
  min-width: 180px;
  transition: border-color var(--trans), background var(--trans),
    box-shadow var(--trans);
}
.controls input[type="text"]:focus,
.controls select:focus {
  border-color: var(--accent);
  background: #223041;
  box-shadow: 0 0 0 3px rgba(61, 139, 253, 0.25);
}

.chk {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  -webkit-user-select: none;
  user-select: none;
}

.chk input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

button {
  background: var(--accent);
  color: #fff;
  font: inherit;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  cursor: pointer;
  letter-spacing: 0.3px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
  transition: background var(--trans), transform var(--trans),
    box-shadow var(--trans);
}
button:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 14px -4px rgba(61, 139, 253, 0.6);
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* Cards Wrapper */
.cards-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

/* Product List Grid */
.product-list {
  --min: 250px;
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(auto-fill, minmax(min(var(--min), 100%), 1fr));
}

@media (min-width: 520px) {
  .product-list {
    --min: 260px;
  }
}
@media (min-width: 780px) {
  .product-list {
    --min: 270px;
  }
}
@media (min-width: 1100px) {
  .product-list {
    --min: 280px;
  }
}

/* Product Card */
.product-card {
  position: relative;
  background: linear-gradient(155deg, var(--bg-soft) 0%, #222a33 65%);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  padding: 14px 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  isolation: isolate;
  min-height: 190px;
  box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.5);
  transition: transform var(--trans), background var(--trans),
    border-color var(--trans), box-shadow var(--trans);
}
.product-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
      circle at 14% 18%,
      rgba(255, 255, 255, 0.07),
      transparent 55%
    ),
    radial-gradient(
      circle at 88% 82%,
      rgba(255, 255, 255, 0.06),
      transparent 60%
    );
  opacity: 0.75;
  pointer-events: none;
  mix-blend-mode: overlay;
}
.product-card:hover {
  transform: translateY(-4px);
  border-color: #3a4652;
  background: linear-gradient(145deg, #28323c, #222a33);
  box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.7);
}

.product-card.low {
  border-color: var(--warn);
  box-shadow: 0 0 0 1px rgba(255, 179, 71, 0.4),
    0 8px 18px -10px rgba(255, 179, 71, 0.4);
}
.product-card.low:hover {
  background: linear-gradient(150deg, #332a1c, #2a2118);
}

.pc-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.pc-name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.4px;
  margin: 0;
  flex: 1;
  line-height: 1.25;
}

.status {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 8px 5px;
  border-radius: 40px;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  box-shadow: 0 2px 4px -2px rgba(0, 0, 0, 0.6);
}

.status.ok {
  background: linear-gradient(135deg, #1d3c2b, #224a34);
  border-color: #2c6a48;
  color: #b7f6d4;
}
.status.low {
  background: linear-gradient(135deg, #4a3a1e, #5a4725);
  border-color: #8f6d2e;
  color: #ffd88e;
}
.status.out {
  background: linear-gradient(135deg, #4a1f25, #571e25);
  border-color: #822e39;
  color: #ffc1c6;
}

.pc-body {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr;
  font-size: 0.8rem;
}

.pc-row {
  display: flex;
  gap: 6px;
  align-items: baseline;
  padding: 4px 0;
  position: relative;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}
.pc-row:last-child {
  border-bottom: none;
}

.pc-row .lbl {
  min-width: 78px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.3px;
  font-size: 0.72rem;
  text-transform: uppercase;
}

.pc-row .val {
  flex: 1;
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.2px;
  word-break: break-word;
}

.pc-row.price .val {
  color: #dbe9ff;
  font-weight: 600;
}
.pc-row.stock .val {
  font-variant-numeric: tabular-nums;
  color: #fafcff;
}
.pc-row.note .val {
  font-weight: 400;
  color: var(--text-dim);
  position: relative;
  padding-left: 16px;
}
.pc-row.note .val::before {
  content: none !important;
}
.pc-row.note {
  padding-left: 0;
}

/* List keterangan multi-bullet */
.note-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.note-list li {
  position: relative;
  padding-left: 18px;
  line-height: 1.35;
  letter-spacing: 0.3px;
  color: var(--text-dim);
  font-weight: 400;
  /* sedikit koreksi posisi */
  top: 0.62em;
}
.note-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1b8f4a, #32c671);
  box-shadow: 0 0 0 2px rgba(50, 198, 113, 0.18),
    0 0 4px 1px rgba(50, 198, 113, 0.32); /* lebih halus */
  transform: translateY(-50%);
}
.note-list li:hover::before {
  box-shadow: 0 0 0 2px rgba(50, 198, 113, 0.28),
    0 0 5px 2px rgba(50, 198, 113, 0.45);
}

.empty {
  text-align: center;
  padding: 48px 20px 60px;
  color: var(--text-dim);
  font-size: 0.9rem;
  background: repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.02),
      rgba(255, 255, 255, 0.02) 6px,
      transparent 6px,
      transparent 12px
    ),
    linear-gradient(145deg, #161a21, #12161c);
  border: 1px dashed #2f3944;
  border-radius: var(--radius);
  will-change: opacity;
  animation: pulseFade 6s ease-in-out infinite;
}
@keyframes pulseFade {
  0%,
  100% {
    opacity: 0.95;
  }
  50% {
    opacity: 1;
  }
}

/* Footer */
.footer {
  margin-top: auto;
  padding: 24px 28px 40px;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  opacity: 0.75;
}

/* Focus ring global */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Utility spacing for smaller screens */
@media (max-width: 620px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  .controls input[type="text"],
  .controls select,
  .controls button {
    width: 100%;
  }
  .pc-row {
    padding: 2px 0 3px;
  }
  .product-card {
    padding: 14px 14px 15px;
  }
}

/* Micro interactions */
.product-card:active {
  transform: translateY(1px);
}

/* Scroll padding for sticky top-bar anchor jumps */
:target {
  scroll-margin-top: 90px;
}
/* Micro interactions */
.product-card:active {
  transform: translateY(1px);
}

/* Scroll padding for sticky top-bar anchor jumps */
:target {
  scroll-margin-top: 90px;
}
#categoryFilter {
  max-width: 250px; /* batasi box */
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #222;
  color: #fff;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
#categoryFilter option {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
