/* The Inventory (inventory.fadlanamada.web.id). Loaded after the Journal's stylesheet
   (/assets/journal/journal.css), whose colours, type, buttons, dialogs, tags and menus it uses as they are.
   Only what the Journal has no part for lives here: photo thumbnails, the item page, the form. */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.v-sep { margin: 0 0.35em; color: var(--muted); opacity: 0.8; }
.v-warn { color: var(--danger); }
@keyframes v-spin { to { transform: rotate(360deg); } }
.v-spin { animation: v-spin 1s linear infinite; }

/* ---------- list ---------- */
.v-filters { display: flex; align-items: center; gap: 6px; margin: -6px 0 12px; overflow-x: auto; scrollbar-width: none; padding: 2px 1px; }
.v-filters::-webkit-scrollbar { display: none; }
.v-chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none; height: 32px; padding: 0 8px 0 10px; border-radius: 8px;
  border: 1px solid var(--line); background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.v-chip:hover { background: var(--hover); }
.v-chip .ic { width: 15px; height: 15px; color: var(--muted); }
.v-chip .v-chip__chev { width: 14px; height: 14px; }
.v-chip.is-on { background: var(--accent-soft); border-color: color-mix(in oklab, var(--accent) 35%, transparent); color: var(--ink); }
.v-chip.is-on .ic { color: var(--accent); }
.v-chip .v-sep { display: none; }
.v-layout { width: 36px; height: 32px; color: var(--muted); }
.v-layout .ic { width: 18px; height: 18px; }
.v-sumrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px 0 6px 4px; }
.v-sum { font-size: 13px; color: var(--muted); margin: 0; }
.v-sum strong { color: var(--ink-2); font-weight: 700; }
#v-list > .j-section-label { margin: 18px 4px 10px; }
#v-list > .v-sumrow + .j-section-label { margin-top: 4px; }
.v-menu__n { margin-left: auto; padding-left: 12px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.j-menu { max-height: min(70dvh, 520px); overflow-y: auto; }
.j-menu button[aria-checked='true'] { font-weight: 700; }
.j-menu button[aria-checked='true'] .ic { color: var(--accent); }

.v-rows { display: grid; gap: 8px; }
.v-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px;
  padding: 10px 8px 10px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.v-item:hover { border-color: color-mix(in oklab, var(--c) 40%, var(--line)); box-shadow: 0 2px 10px rgba(43, 41, 36, 0.06); }
.v-item:focus-visible, .v-tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.v-item.is-gone { opacity: 0.62; }
.v-thumb {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 11px; overflow: hidden; flex: none;
  background: var(--panel-2);
}
.v-thumb img, .v-tile__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.v-thumb.v-thumb--none, .v-tile__img.v-tile__img--none { background: var(--tint); color: var(--ct); }
.v-thumb--none .ic { width: 24px; height: 24px; stroke-width: 1.7; }
.v-item__text { display: grid; gap: 3px; min-width: 0; }
.v-item__name { font-weight: 700; font-size: 15.5px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.v-item__name mark, .v-tile__name mark { background: color-mix(in oklab, var(--accent) 25%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.v-qty { color: var(--muted); font-weight: 600; font-size: 0.88em; white-space: nowrap; }
.v-star { display: inline-grid; vertical-align: -2px; margin-right: 5px; color: #b39150; }
.v-star .ic { width: 15px; height: 15px; fill: currentColor; }
.v-item__meta { display: flex; align-items: center; gap: 5px; min-width: 0; color: var(--muted); font-size: 13px; }
.v-item__meta > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-item__meta .ic { width: 14px; height: 14px; flex: none; }
.v-none { font-style: italic; opacity: 0.8; }
.v-item__badges { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.v-badge { gap: 4px; height: 22px; font-size: 11.5px; font-weight: 600; letter-spacing: 0; color: var(--ink-2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.v-badge .ic { width: 12px; height: 12px; flex: none; }
.v-badge--warn { color: var(--danger); background: color-mix(in oklab, var(--danger) 9%, var(--panel)); border-color: color-mix(in oklab, var(--danger) 22%, transparent); }
.v-item__end { display: flex; align-items: center; gap: 2px; }
.v-price { font-size: 13.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.v-item__chev { width: 20px; height: 20px; color: var(--ct); }
.v-item__price { display: none; font-size: 13px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.v-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.v-tile {
  position: relative; display: grid; gap: 2px; padding: 6px 6px 10px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; min-width: 0;
}
.v-tile:hover { border-color: color-mix(in oklab, var(--c) 40%, var(--line)); }
.v-tile__img { display: grid; place-items: center; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--panel-2); margin-bottom: 6px; }
.v-tile__img--none .ic { width: 34px; height: 34px; stroke-width: 1.5; }
.v-tile__name { font-weight: 700; font-size: 14px; line-height: 1.3; padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-tile__meta { font-size: 12.5px; color: var(--muted); padding: 0 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-tile__star, .v-tile__qty {
  position: absolute; top: 12px; display: inline-grid; place-items: center; height: 24px; min-width: 24px; padding: 0 6px; border-radius: 7px;
  background: color-mix(in oklab, var(--panel) 88%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  font-size: 12px; font-weight: 700; color: var(--ink-2);
}
.v-tile__star { left: 12px; color: #b39150; padding: 0; }
.v-tile__star .ic { width: 14px; height: 14px; fill: currentColor; }
.v-tile__qty { right: 12px; }

/* ---------- suggestions under a place box ---------- */
.v-suggests { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.v-suggest {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 32px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer;
}
.v-suggest:hover { background: var(--hover); }
.v-suggest .ic { width: 13px; height: 13px; color: var(--muted); flex: none; }
.v-suggest span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- one item ---------- */
.v-detail { width: min(720px, 100%); margin: 0 auto; padding: 16px 16px calc(56px + env(safe-area-inset-bottom)); display: grid; gap: 16px; }
.v-gallery { position: relative; margin: 0 -16px; }
.v-gallery__track { display: flex; aspect-ratio: 4 / 3; max-height: 62dvh; width: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; background: var(--panel-2); }
.v-gallery__track::-webkit-scrollbar { display: none; }
.v-gallery__slide { flex: 0 0 100%; height: 100%; min-width: 0; scroll-snap-align: center; border: 0; padding: 0; margin: 0; background: none; cursor: zoom-in; display: grid; place-items: center; }
.v-gallery__slide img { width: 100%; height: 100%; object-fit: contain; display: block; }
/* the gallery sits right under the bar on a phone */
.v-detail > .v-gallery:first-child { margin-top: -16px; }
.v-gallery__dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.v-gallery__dots span { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.55); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12); transition: background 0.2s, transform 0.2s; }
.v-gallery__dots span.is-on { background: #fff; transform: scale(1.25); }
.v-nophoto {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 120px; border-radius: 16px;
  border: 1.5px dashed color-mix(in oklab, var(--c) 45%, var(--line-strong)); background: var(--tint); color: var(--ct);
  font-weight: 700; font-size: 14.5px; text-decoration: none;
}
.v-nophoto .ic { width: 24px; height: 24px; }
.v-head { display: grid; gap: 10px; }
.v-title { margin: 4px 0 0; font: 800 27px/1.2 var(--serif); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.v-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.v-tags .j-chip { height: 30px; text-decoration: none; background: var(--tint); border-color: color-mix(in oklab, var(--c) 35%, transparent); color: var(--ct); cursor: pointer; }
.v-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.v-fact {
  position: relative; display: grid; align-content: start; gap: 3px; min-width: 0; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.v-fact--wide { grid-column: 1 / -1; padding-right: 104px; }
.v-fact__k { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.v-fact__k .ic { width: 14px; height: 14px; stroke-width: 2.1; }
.v-fact__v { font-size: 16px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.v-fact__sub { font-size: 13px; color: var(--muted); }
.v-fact__btn { justify-self: start; margin: 4px 0 -6px -8px; }
.v-fact--wide .v-fact__btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); margin: 0; }
.v-sec { display: grid; gap: 10px; padding: 14px 16px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.v-sec h2 { display: flex; align-items: center; gap: 8px; margin: 0; font: 700 13px/1.3 var(--sans); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.v-sec h2 .ic { width: 15px; height: 15px; stroke-width: 2.1; }
.v-sec .j-info { grid-template-columns: minmax(96px, auto) 1fr; gap: 9px 18px; }
.v-sec .j-info dd { font-weight: 500; }
.v-notes { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15.5px; line-height: 1.6; color: var(--ink); }
.v-notes a, .v-sec dd a { color: var(--accent); text-underline-offset: 3px; }
.v-copy { display: inline-flex; align-items: center; gap: 8px; border: 0; padding: 2px 6px; margin: -2px -6px; border-radius: 6px; background: none; cursor: pointer; font: 500 14px var(--mono); color: inherit; text-align: left; overflow-wrap: anywhere; }
.v-copy:hover { background: var(--hover); }
.v-copy .ic { width: 14px; height: 14px; color: var(--muted); flex: none; }
.v-docs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.v-docs li { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); padding: 2px 2px 2px 0; }
.v-docs li > a:first-child, .v-docs__row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px 4px 8px 12px; text-decoration: none; color: var(--ink); font-size: 14px; }
.v-docs li > a:first-child .ic, .v-docs__row .ic { width: 18px; height: 18px; color: var(--accent); flex: none; }
.v-docs__name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.v-docs .j-muted { font-size: 12.5px; flex: none; }
.v-docs .j-iconbtn { width: 36px; height: 36px; }
.v-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.v-log li { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 0 0 14px; font-size: 14.5px; line-height: 1.45; }
.v-log li:not(:last-child)::before { content: ''; position: absolute; left: 13.5px; top: 28px; bottom: 2px; width: 1px; background: var(--line-strong); }
.v-log li > .ic { width: 28px; height: 28px; padding: 6px; border-radius: 50%; background: var(--panel-2); color: var(--muted); stroke-width: 2; }
.v-log li > span { padding-top: 3px; overflow-wrap: anywhere; }
.v-log time { display: block; font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.v-sec > .j-hint { margin: -6px 0 0; }
.v-starbtn.is-on { color: #b39150; }
.v-starbtn.is-on .ic { fill: currentColor; }

/* full-screen photos */
.v-lightbox { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; border: 0; border-radius: 0; background: #111110; box-shadow: none; }
.v-lightbox::backdrop { background: #111110; }
.v-lightbox[open] { animation: none; display: block; }
.v-lightbox__track { display: flex; width: 100%; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.v-lightbox__track::-webkit-scrollbar { display: none; }
.v-lightbox__slide { flex: 0 0 100%; height: 100%; margin: 0; scroll-snap-align: center; display: grid; place-items: center; padding: calc(56px + env(safe-area-inset-top)) 0 calc(48px + env(safe-area-inset-bottom)); }
.v-lightbox__slide img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.v-lightbox__close { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 10px; color: #eee; background: rgba(255, 255, 255, 0.08); }
.v-lightbox__close:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.v-lightbox__count { position: fixed; left: 0; right: 0; bottom: calc(16px + env(safe-area-inset-bottom)); margin: 0; text-align: center; color: #bbb; font-size: 13px; font-weight: 600; pointer-events: none; }

/* ---------- the form ---------- */
.v-formwrap { width: min(640px, 100%); margin: 0 auto; padding: 16px 16px calc(40px + env(safe-area-inset-bottom)); }
.v-form { display: grid; gap: 12px; }
.v-block { display: grid; gap: 14px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); min-width: 0; scroll-margin-top: calc(var(--bar) + 12px); }
.v-block__title { display: flex; align-items: center; gap: 8px; margin: 0; font: 700 13px/1.3 var(--sans); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.v-block__title .ic { width: 15px; height: 15px; stroke-width: 2.1; }
.v-block .j-hint { margin: -6px 0 0; }
.v-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.j-field input[type='date'] { -webkit-appearance: none; appearance: none; display: block; text-align: left; min-width: 0; color: var(--ink); }
.j-field input[type='date']::-webkit-date-and-time-value { text-align: left; }
.j-field input::placeholder, .j-editor::placeholder { color: color-mix(in oklab, var(--muted) 75%, transparent); }
.v-barsave { min-height: 36px; padding: 0 16px; margin-right: 4px; }
.v-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; border-radius: 12px; }
.v-photos.is-over { outline: 2px dashed var(--accent); outline-offset: 4px; }
.v-photo {
  position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); padding: 0;
  background: var(--panel-2); cursor: pointer;
}
.v-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.v-photo.is-up img { opacity: 0.5; }
.v-photo.is-err { border-color: var(--danger); }
.v-photo.is-err img { opacity: 0.35; }
.v-photo__cover { position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 6px; background: rgba(20, 20, 19, 0.6); color: #fff; font-size: 11px; font-weight: 700; }
.v-photo__state { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink); }
.v-photo.is-err .v-photo__state { color: var(--danger); }
.v-photo--add {
  display: grid; place-items: center; align-content: center; gap: 6px; border: 1.5px dashed var(--line-strong); background: var(--bg);
  color: var(--muted); font-size: 12.5px; font-weight: 700;
}
.v-photo--add:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }
.v-photo--add .ic { width: 24px; height: 24px; color: var(--accent); }
.v-photos:has(> .v-photo--add:only-child) { grid-template-columns: 1fr; }
.v-photo--add:only-child { aspect-ratio: auto; min-height: 112px; font-size: 14px; }
.v-stepper { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); padding: 2px; width: max-content; }
.v-stepper .j-iconbtn { width: 40px; height: 40px; }
.j-field .v-stepper input { width: 64px; min-height: 40px; border: 0; background: transparent; text-align: center; font-weight: 700; padding: 0; box-shadow: none !important; }
.v-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.v-choices--even { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.v-choice {
  -webkit-tap-highlight-color: transparent; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink-2); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.v-choice:hover { background: var(--hover); }
.v-choice .ic { width: 15px; height: 15px; color: var(--muted); }
.v-choice[aria-pressed='true'] { background: var(--accent-soft); border-color: color-mix(in oklab, var(--accent) 55%, transparent); color: var(--ink); }
.v-choice[aria-pressed='true'] .ic { color: var(--accent); }
.v-money { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--bg); }
.v-money:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.v-money > span { color: var(--muted); font-size: 14px; font-weight: 600; }
.j-field .v-money input { border: 0; padding: 0; min-height: 42px; background: transparent; box-shadow: none !important; font-variant-numeric: tabular-nums; }
.v-fold { padding: 0; gap: 0; }
.v-fold > summary { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 16px; cursor: pointer; list-style: none; font-weight: 700; font-size: 14.5px; }
.v-fold > summary::-webkit-details-marker { display: none; }
.v-fold > summary .ic { width: 16px; height: 16px; color: var(--muted); transition: transform 0.15s; }
.v-fold[open] > summary .ic { transform: rotate(90deg); }
.v-fold > summary .j-muted { margin-left: auto; font-weight: 500; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.v-fold__body { display: grid; gap: 14px; padding: 2px 16px 16px; }
.v-notes-input { min-height: 120px; }
.v-docs--edit li.is-up { opacity: 0.7; }
.v-chip-edit { border-style: dashed; background: transparent; color: var(--muted); }
.v-chip-edit .ic { display: block; width: 14px; height: 14px; stroke-width: 2; }
.v-form__foot { display: grid; gap: 10px; justify-items: center; padding: 6px 0 0; }
.v-form__foot .j-alert { width: 100%; margin: 0; }
.v-delete { color: var(--danger); }

/* ---------- desktop ---------- */
@media (min-width: 761px) {
  .v-rows { gap: 10px; }
  .v-item { padding: 12px 10px 12px 12px; }
  .v-thumb { width: 64px; height: 64px; border-radius: 12px; }
  .v-detail { padding-top: 24px; gap: 18px; }
  .v-gallery { margin: 0; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); }
  .v-detail > .v-gallery:first-child { margin-top: 0; }
  .v-title { font-size: 32px; }
  .v-facts { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .v-facts .v-fact--wide { grid-column: 1 / -1; }
  .v-formwrap { padding-top: 24px; }
  .v-block { padding: 18px 20px; }
  .v-fold > summary { padding: 0 20px; }
  .v-fold__body { padding: 2px 20px 18px; }
}

/* ---------- phone ---------- */
@media (max-width: 640px) {
  .j-top .j-btn--primary span { display: none; }
  .j-top .j-btn--primary { width: 40px; padding: 0; border-radius: 12px; }
  .j-top .j-btn--primary .ic { width: 22px; height: 22px; }
  .v-item { gap: 12px; padding: 8px 4px 8px 8px; border-radius: 13px; }
  .v-thumb { width: 52px; height: 52px; border-radius: 10px; }
  .v-item__name { font-size: 15px; }
  /* on a phone the price moves under the name, so the name keeps the width */
  .v-item__end .v-price { display: none; }
  .v-item__price { display: block; }
  .v-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .v-title { font-size: 24px; }
  .v-facts > .v-fact:last-child:nth-child(even) { grid-column: 1 / -1; } /* a lone last box takes the row */
  .v-two { gap: 10px; }
  .v-choices--even { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .v-choice { padding: 0 10px; font-size: 13px; }
  .v-block { padding: 14px; border-radius: 14px; }
  .v-fold > summary { padding: 0 14px; }
  .v-fold__body { padding: 2px 14px 14px; }
  .v-fold > summary .j-muted { display: none; }
  .v-formwrap, .v-detail { padding-left: 12px; padding-right: 12px; }
  .v-gallery { margin: 0 -12px; }
}
@media (max-width: 420px) {
  .v-two { grid-template-columns: 1fr; }
}
