/* ============================================================
   Vendira Design System — tokens, base, layout shell, utilities
   ============================================================ */

/* ─── Design Tokens ─── */
:root {
  /* Neutrals */
  --bg:        oklch(98.4% 0.003 240);
  --surface:   #ffffff;
  --surface-2: oklch(97% 0.004 250);
  --line:      oklch(92% 0.005 250);
  --line-2:    oklch(95.5% 0.004 250);
  --ink:       oklch(22% 0.015 255);
  --ink-2:     oklch(38% 0.012 255);
  --ink-3:     oklch(55% 0.012 255);
  --ink-4:     oklch(70% 0.010 255);

  /* Brand primary — deep violet */
  --primary:      oklch(45% 0.22 295);
  --primary-2:    oklch(55% 0.24 300);
  --primary-soft: oklch(95% 0.04 295);
  --primary-ink:  oklch(36% 0.18 295);

  /* Brand accent — azure blue */
  --accent:      oklch(58% 0.20 250);
  --accent-soft: oklch(94% 0.05 250);
  --accent-ink:  oklch(40% 0.16 250);

  /* Status */
  --pos:       oklch(58% 0.13 155);
  --pos-soft:  oklch(94% 0.05 155);
  --neg:       oklch(60% 0.16 25);
  --neg-soft:  oklch(95% 0.04 25);
  --warn:      oklch(72% 0.13 75);
  --warn-soft: oklch(95% 0.06 75);
  --info:      oklch(58% 0.13 250);
  --info-soft: oklch(95% 0.04 250);

  --radius:    14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 0 oklch(0% 0 0 / 0.03), 0 1px 2px oklch(0% 0 0 / 0.04);
  --shadow-md: 0 1px 0 oklch(0% 0 0 / 0.03), 0 8px 24px -10px oklch(0% 0 0 / 0.10);
}

/* ─── Base ─── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;
}

.vd-mono {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0;
}

/* ─── Layout shell ─── */
.vd-app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.vd-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  position: sticky !important;
  top: 0 !important;
  height: 100vh !important;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  /* Hide scrollbar desktop */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  z-index: 10;
}

/* Hide scrollbar for Chrome/Safari/Opera */
.vd-sidebar::-webkit-scrollbar {
  display: none;
}

.vd-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 10px 18px 10px;
}

.vd-brand-mark {
  width: 36px;
  height: 36px;
  position: relative;
  transform: rotate(45deg);
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  border-radius: 8px;
  box-shadow:
    inset 0 0 0 1px oklch(100% 0 0 / 0.18),
    0 6px 14px -4px oklch(45% 0.22 295 / 0.45);
  flex: none;
}

.vd-brand-mark::before,
.vd-brand-mark::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 14px;
  height: 8px;
  background: linear-gradient(90deg, var(--accent), oklch(70% 0.16 245));
  transform: translateY(-50%);
  border-radius: 2px;
}

.vd-brand-mark::before {
  left: -9px;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.vd-brand-mark::after {
  right: -9px;
  clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

.vd-brand-mark svg {
  position: absolute;
  inset: 0;
  margin: auto;
  transform: rotate(-45deg);
  color: #fff;
}

.vd-brand-name {
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-left: 6px;
}

.vd-nav-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-4);
  letter-spacing: 0.14em;
  padding: 14px 12px 6px;
  text-transform: uppercase;
}

.vd-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 13.5px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.vd-nav-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.vd-nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}

.vd-nav-item svg,
.vd-nav-item i {
  width: 16px;
  height: 16px;
  flex: none;
  opacity: 0.85;
  font-size: 14px;
  text-align: center;
}

.vd-nav-item.active svg,
.vd-nav-item.active i {
  opacity: 1;
}

.vd-nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  background: oklch(94% 0.005 250);
  color: var(--ink-3);
  padding: 2px 6px;
  border-radius: 999px;
}

.vd-nav-item.active .vd-nav-badge {
  background: #fff;
  color: var(--accent-ink);
}

.vd-side-foot {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}

.vd-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  background: linear-gradient(135deg, oklch(80% 0.06 175), oklch(60% 0.10 220));
  color: white;
  font-weight: 700;
  font-size: 12px;
  display: grid;
  place-items: center;
  text-transform: uppercase;
}

.vd-side-foot .vd-meta {
  font-size: 12px;
  line-height: 1.3;
  min-width: 0;
}

.vd-side-foot .vd-meta b {
  display: block;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vd-side-foot .vd-meta span {
  color: var(--ink-4);
}

/* ─── Main area ─── */
.vd-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top bar */
.vd-topbar {
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 28px;
  position: sticky !important;
  top: 0 !important;
  z-index: 40 !important;
}

.vd-search {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--ink-3);
}

.vd-search input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
}

.vd-search input::placeholder { color: var(--ink-4); }

.vd-search kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--ink-3);
  background: var(--surface);
}

.vd-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.vd-icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 9px;
  cursor: pointer;
  color: var(--ink-2);
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.vd-icon-btn:hover {
  background: var(--surface-2);
  border-color: color-mix(in oklab, var(--accent) 34%, var(--line));
  color: var(--ink);
}
.vd-icon-btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.vd-action-buttons .vd-icon-btn[title]::before,
.vd-action-buttons .vd-icon-btn[title]::after,
.vd-action-tooltip[title]::before,
.vd-action-tooltip[title]::after {
  position: absolute;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 80;
}

.vd-action-buttons .vd-icon-btn[title]::before,
.vd-action-tooltip[title]::before {
  content: attr(title);
  bottom: calc(100% + 10px);
  min-width: max-content;
  max-width: 180px;
  padding: 7px 10px;
  border: 1px solid color-mix(in oklab, var(--ink) 12%, transparent);
  border-radius: 8px;
  background: var(--ink);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.vd-action-buttons .vd-icon-btn[title]::after,
.vd-action-tooltip[title]::after {
  content: "";
  bottom: calc(100% + 4px);
  border: 6px solid transparent;
  border-top-color: var(--ink);
}

.vd-action-buttons .vd-icon-btn[title]:hover::before,
.vd-action-buttons .vd-icon-btn[title]:hover::after,
.vd-action-buttons .vd-icon-btn[title]:focus-visible::before,
.vd-action-buttons .vd-icon-btn[title]:focus-visible::after,
.vd-action-tooltip[title]:hover::before,
.vd-action-tooltip[title]:hover::after,
.vd-action-tooltip[title]:focus-visible::before,
.vd-action-tooltip[title]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.vd-action-tooltip {
  position: relative;
}

.vd-action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.vd-top-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--surface);
  cursor: pointer;
}

.vd-top-user b {
  font-size: 13px;
  font-weight: 600;
}

.vd-top-user span {
  font-size: 11.5px;
  color: var(--ink-4);
  display: block;
  line-height: 1;
}

/* User dropdown */
.vd-user-menu {
  position: relative;
}

.vd-user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 60;
}

.vd-udd-head {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 6px;
}

.vd-udd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.vd-udd-item:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.vd-udd-item svg,
.vd-udd-item i {
  width: 15px;
  height: 15px;
  font-size: 13px;
  text-align: center;
  opacity: 0.85;
}

.vd-udd-sep {
  height: 1px;
  background: var(--line-2);
  margin: 6px;
}

.vd-udd-item.logout { color: var(--neg); }
.vd-udd-item.logout:hover { background: var(--neg-soft); }

/* ─── Content area ─── */
.vd-page {
  padding: 26px 28px 56px;
  flex: 1;
}

.vd-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 24px;
  position: relative;
}

.vd-page-head h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
}

.vd-page-head .vd-sub { color: var(--ink-3); font-size: 13.5px; }

.vd-card.vd-dashboard-filter-card {
  order: 10;
  flex: 1 0 100%;
  position: relative;
  padding: 18px;
  overflow: visible;
}

.vd-dashboard-filter-title {
  margin-bottom: 12px;
  color: var(--ink);
  font: 700 13px 'Plus Jakarta Sans';
}

.vd-dashboard-date-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.vd-dashboard-filter-card .vd-date-trigger {
  width: 100%;
  height: 38px;
  justify-content: flex-start;
  box-shadow: none;
}

.vd-dashboard-filter-card .vd-date-trigger span {
  text-align: left;
}

.vd-dashboard-filter-card .vd-date-trigger svg:last-child {
  margin-left: auto;
}

.vd-dashboard-date-field .vd-date-popover {
  z-index: 200;
}

.vd-date-modal {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.22);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.vd-date-modal .vd-date-popover {
  position: relative;
  top: auto;
  left: auto;
  width: min(700px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  transform: none;
  z-index: 1;
}

.vd-date-modal .vd-date-popover::before {
  display: none;
}

.vd-dashboard-filter-card .vd-filter-extras {
  flex-direction: column;
  padding-top: 0;
  margin-top: 10px;
  border-top: 0;
}

.vd-dashboard-filter-card .vd-filter-select {
  height: 38px;
  background: var(--surface);
}

.vd-dashboard-filter-card .vd-filter-footer {
  justify-content: flex-start;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 0;
}

.vd-crumbs { font-size: 12.5px; color: var(--ink-3); }
.vd-crumbs a {
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 600;
}

/* ─── Card ─── */
.vd-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  padding-top: 15px;
}

.vd-card-head {
  padding: 16px 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.vd-card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.vd-card-head .vd-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
}

.vd-card-body { padding: 0 18px 18px; }

.vd-head-date {
  position: relative;
  z-index: 45;
  flex: none;
}

.vd-date-trigger {
  height: 38px;
  width: 252px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  font: 700 12px 'Plus Jakarta Sans';
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.vd-date-trigger svg {
  color: var(--ink-3);
  flex: none;
}

.vd-date-popover {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  display: block;
  width: min(700px, calc(100vw - 40px));
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 46px oklch(0% 0 0 / 0.14);
}

.vd-date-calendars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.vd-date-popover::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 14px;
  height: 14px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--surface);
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
}

.vd-calendar-panel {
  min-width: 0;
}

.vd-calendar-label {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-3);
  font: 800 12px 'Plus Jakarta Sans';
  text-transform: uppercase;
  border-bottom: 1px solid var(--line-2);
  margin-bottom: 10px;
}

.vd-calendar-month {
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  margin-bottom: 16px;
}

.vd-calendar-month strong {
  text-align: center;
  font: 700 14px 'Plus Jakarta Sans';
  color: var(--ink);
}

.vd-calendar-month button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.vd-calendar-month button:hover {
  background: var(--surface-2);
}

.vd-calendar-weekdays,
.vd-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.vd-calendar-weekdays {
  margin-bottom: 8px;
}

.vd-calendar-weekdays span {
  text-align: center;
  color: var(--ink);
  font: 800 11px 'Plus Jakarta Sans';
}

.vd-calendar-days button {
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: 600 13px 'Plus Jakarta Sans';
  cursor: pointer;
}

.vd-calendar-days button:hover {
  background: var(--accent-soft);
}

.vd-calendar-days button.muted {
  color: var(--ink-4);
  opacity: 0.55;
}

.vd-calendar-days button.between {
  background: oklch(95% 0.032 242);
  color: var(--info);
  border-radius: 0;
}

.vd-calendar-days button.start,
.vd-calendar-days button.end {
  background: var(--info);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.vd-calendar-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  border-top: 1px solid var(--line-2);
  margin-top: 12px;
  padding-top: 12px;
}

.vd-calendar-presets button {
  height: 34px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink);
  font: 700 12px 'Plus Jakarta Sans';
  cursor: pointer;
}

.vd-calendar-presets button:hover {
  border-color: var(--line);
  background: var(--surface);
}

.vd-filter-extras {
  display: flex;
  gap: 10px;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--line-2);
}

.vd-filter-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.vd-filter-label {
  color: var(--ink-3);
  font: 700 11px 'Plus Jakarta Sans';
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.vd-filter-select {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: var(--surface-2);
  color: var(--ink);
  font: 600 12px 'Plus Jakarta Sans';
  cursor: pointer;
}

.vd-filter-select:focus {
  border-color: var(--info);
  background: var(--surface);
}

.vd-filter-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--line-2);
}

.vd-filter-reset,
.vd-filter-search {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  font: 700 12px 'Plus Jakarta Sans';
  cursor: pointer;
}

.vd-filter-reset {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-3);
}

.vd-filter-search {
  padding-inline: 18px;
  border: 0;
  background: var(--info);
  color: #fff;
}

.vd-filter-reset:hover { background: var(--surface-2); color: var(--ink); }
.vd-filter-search:hover { opacity: 0.88; }

@media (max-width: 1120px) {
  .vd-head-date {
    width: 100%;
    order: 10;
  }

  .vd-date-trigger {
    width: 100%;
  }

  .vd-date-popover {
    left: 0;
    transform: none;
  }

  .vd-date-popover::before {
    left: 28px;
    transform: rotate(45deg);
  }
}

@media (max-width: 760px) {
  .vd-page-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .vd-date-popover {
    width: min(100%, calc(100vw - 56px));
  }

  .vd-date-calendars { grid-template-columns: 1fr; }
  .vd-filter-extras { flex-direction: column; }

  /* ── Dashboard KPI & grid ── */
  .vd-kpis { grid-template-columns: repeat(2, 1fr); }
  .vd-grid-2-1 { grid-template-columns: 1fr; }
  .vd-grid-1-1 { grid-template-columns: 1fr; }

  /* ── vd-crumbs sembunyikan di mobile ── */
  .vd-crumbs { display: none; }

  /* ── Dashboard filter card ── */
  .vd-card.vd-dashboard-filter-card {
    padding: 14px;
    margin: 0 -4px;
  }

  .vd-dashboard-filter-title {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .vd-dashboard-filter-card .vd-date-trigger {
    height: 40px;
    font-size: 12px;
  }

  .vd-dashboard-filter-card .vd-filter-extras {
    gap: 8px;
    margin-top: 8px;
  }

  .vd-dashboard-filter-card .vd-filter-footer {
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 8px;
    margin-top: 8px;
  }

  .vd-dashboard-filter-card .vd-filter-footer .vd-btn {
    flex: 1;
    min-width: 0;
    text-align: center;
    justify-content: center;
  }

  /* Calendar popover fullscreen on mobile */
  .vd-date-modal {
    padding: 12px;
    align-items: flex-end;
  }

  .vd-date-modal .vd-date-popover {
    width: 100%;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
  }

  .vd-calendar-days button {
    height: 36px;
    font-size: 13px;
  }

  .vd-calendar-presets {
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
  }

  .vd-calendar-presets button {
    font-size: 11px;
    height: 32px;
  }
}

.vd-title-row {
  display: flex;
  align-items: baseline;
  gap: 5px;
  flex-wrap: wrap;
}

.vd-title-row h3 {
  line-height: 1.25;
}

.vd-month-label {
  color: var(--ink);
  font: 700 15px 'Plus Jakarta Sans';
  line-height: 1.25;
}

.vd-chart-filters {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.vd-chart-filters label {
  display: grid;
  gap: 4px;
}

.vd-chart-filters span,
.vd-chart-filters label span {
  color: var(--ink-4);
  font: 700 10px 'Plus Jakarta Sans';
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.vd-chart-filters input,
.vd-chart-filters select {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: 600 12px 'Plus Jakarta Sans';
  outline: none;
  padding: 0 9px;
}

.vd-chart-filters input[type="number"] { width: 76px; }
.vd-chart-filters select { width: 86px; }
.vd-chart-filters input[type="date"] { width: 132px; }

.vd-chart-filters input:focus,
.vd-chart-filters select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.vd-chart-filters.placeholder {
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

/* ─── Pill (status badge) ─── */
.vd-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  line-height: 1;
}

.vd-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.vd-pill.on  { background: var(--pos-soft);  color: var(--pos); }
.vd-pill.on::before  { background: var(--pos); }
.vd-pill.off { background: var(--neg-soft);  color: var(--neg); }
.vd-pill.off::before { background: var(--neg); }
.vd-pill.warn { background: var(--warn-soft); color: oklch(48% 0.13 75); }
.vd-pill.warn::before { background: var(--warn); }
.vd-pill.info { background: var(--info-soft); color: var(--info); }
.vd-pill.info::before { background: var(--info); }
.vd-pill.muted { background: var(--surface-2); color: var(--ink-4); }
.vd-pill.muted::before { background: var(--ink-4); }

/* ─── Table ─── */
.vd-t-wrap { overflow-x: auto; }

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

table.vd-t thead th {
  text-align: left;
  font: 600 11.5px 'Plus Jakarta Sans';
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 12px 18px;
  border-top: 1px solid var(--line-2);
  background: var(--surface-2);
}

table.vd-t tbody td {
  padding: 14px 18px;
  border-top: 1px solid var(--line-2);
  vertical-align: middle;
  font-size: 13px;
}

table.vd-t tbody tr:hover { background: oklch(98.5% 0.003 250); }

table.vd-t td .vd-prim { font-weight: 600; }
table.vd-t td .vd-sec {
  color: var(--ink-3);
  font-size: 11.5px;
  font-family: 'JetBrains Mono';
  margin-top: 3px;
}

table.vd-t td.vd-num { font-variant-numeric: tabular-nums; }
table.vd-t td .vd-code { font: 600 12px 'JetBrains Mono'; color: var(--info); }

/* ─── Pagination ─── */
.vd-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--line-2);
  font-size: 12.5px;
  color: var(--ink-3);
  min-width: 0;
}

.vd-pager .vd-pages {
  display: flex;
  gap: 4px;
  max-width: 100%;
  min-width: 0;
}

.vd-pager .vd-pg {
  min-width: 30px;
  width: auto;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
  font: 600 12px 'Plus Jakarta Sans';
  color: var(--ink-2);
}

.vd-pager .vd-pg.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.vd-pager .vd-pg.nav { color: var(--ink-3); }
.vd-pager .vd-pg-ellipsis { border-color: transparent; background: transparent; cursor: default; color: var(--ink-4); }
.vd-pager .vd-pg:disabled { opacity: 0.35; cursor: default; }

/* ─── Pagination — Mobile ─── */
@media (max-width: 768px) {
  .vd-pager {
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 12px;
  }

  .vd-pager-info {
    font-size: 12px;
    color: var(--ink-3);
    order: 2; /* info di bawah tombol */
  }

  .vd-pager .vd-pages {
    order: 1;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .vd-pager .vd-pg {
    min-width: 34px;
    width: auto;
    height: 34px;
    padding: 0 9px;
    font-size: 12px;
    border-radius: 8px;
  }
}

@media (max-width: 480px) {
  .vd-pager {
    padding: 14px 8px;
  }

  .vd-pager .vd-pages {
    gap: 3px;
    width: 100%;
    flex-wrap: nowrap;
    justify-content: center;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .vd-pager .vd-pg {
    min-width: 30px;
    width: auto;
    height: 30px;
    padding: 0 7px;
    font-size: 11px;
    border-radius: 7px;
    flex: 0 0 auto;
  }

  /* Ellipsis lebih ramping */
  .vd-pager .vd-pg-ellipsis {
    width: 14px;
    min-width: unset;
    padding: 0;
  }
}

/* ─── Buttons ─── */
.vd-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 9px;
  font: 600 13px 'Plus Jakarta Sans';
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}

.vd-btn.primary { background: var(--ink); color: #fff; }
.vd-btn.primary:hover { background: #000; }
.vd-btn.accent  { background: var(--accent); color: #fff; }
.vd-btn.ghost   { background: var(--surface); border-color: var(--line); color: var(--ink); }
.vd-btn.ghost:hover { background: var(--surface-2); }

/* ─── Form elements ─── */
.vd-input,
.vd-select,
.vd-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  font: 500 13.5px 'Plus Jakarta Sans';
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.vd-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  color: #111827;
  /* down arrow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23111827' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  padding-right: 36px;
}

/* on focus/active show the up arrow (simulate rotation) */
.vd-select:focus,
.vd-select:active,
.vd-select:focus-visible {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cg transform='rotate(180 8 8)'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23111827' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/g%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
}

.vd-input:focus,
.vd-select:focus,
.vd-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.vd-input::placeholder { color: var(--ink-4); }

/* ─── Chip (filter button) ─── */
.vd-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font: 500 12px 'Plus Jakarta Sans';
  color: var(--ink-2);
  cursor: pointer;
}

.vd-chip:hover { background: var(--surface); }
.vd-chip svg { width: 14px; height: 14px; }

/* ─── KPI strip ─── */
.vd-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.vd-kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.vd-kpi .vd-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vd-kpi .vd-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.vd-kpi .vd-val {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.vd-kpi .vd-val small {
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 500;
}

.vd-kpi .vd-delta {
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.vd-delta.pos { color: var(--pos); }
.vd-delta.neg { color: var(--neg); }

/* ─── Segmented control ─── */
.vd-seg {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  gap: 2px;
}

.vd-seg button {
  border: 0;
  background: transparent;
  padding: 5px 12px;
  font: 600 12px 'Plus Jakarta Sans';
  color: var(--ink-3);
  border-radius: 6px;
  cursor: pointer;
}

.vd-seg button.on {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ─── Tab bar (above tables) ─── */
.vd-tabbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px 0;
}

.vd-tabbar .vd-tab {
  padding: 8px 12px;
  font: 600 12.5px 'Plus Jakarta Sans';
  color: var(--ink-3);
  border-radius: 8px;
  cursor: pointer;
}

.vd-tabbar .vd-tab.on { background: var(--surface-2); color: var(--ink); }
.vd-tabbar .vd-right { margin-left: auto; display: flex; gap: 8px; padding-right: 4px; }

/* ─── Grid layouts ─── */
.vd-grid-2-1 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; }
.vd-grid-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ─── Placeholder (empty state) ─── */
.vd-placeholder {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.vd-placeholder .vd-icn {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--primary-soft);
  display: grid;
  place-items: center;
  color: var(--primary);
}

.vd-placeholder h2 { margin: 0; font-size: 20px; letter-spacing: -0.015em; }
.vd-placeholder p { margin: 0; color: var(--ink-3); max-width: 420px; }

/* ─── Login page ─── */
.vd-login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
}

.vd-login-left {
  padding: 36px;
  display: flex;
  flex-direction: column;
  gap: 36px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.vd-login-form-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vd-login-form { width: 360px; max-width: 100%; }

.vd-login-form h2 {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.vd-login-form .vd-lead { color: var(--ink-3); margin: 0 0 24px; font-size: 13.5px; }

.vd-pass-wrap { position: relative; }

.vd-pass-wrap .vd-show {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--ink-3);
  font: 600 11.5px 'Plus Jakarta Sans';
  padding: 4px 8px;
  border-radius: 6px;
}

.vd-pass-wrap .vd-show:hover { color: var(--ink); background: var(--surface-2); }

.vd-signin-btn {
  width: 100%;
  padding: 12px;
  border: 0;
  background: var(--ink);
  color: #fff;
  border-radius: 9px;
  font: 700 13.5px 'Plus Jakarta Sans';
  cursor: pointer;
  margin-top: 6px;
}

.vd-signin-btn:hover { background: #000; }

.vd-login-foot {
  font-size: 12px;
  color: var(--ink-4);
  text-align: center;
  margin-top: 20px;
}

.vd-login-right {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 80% 20%, oklch(94% 0.04 175), transparent 60%),
    radial-gradient(700px 500px at 20% 90%, oklch(95% 0.03 250), transparent 60%),
    oklch(97% 0.005 250);
  padding: 48px;
  display: flex;
  flex-direction: column;
}

.vd-login-quote {
  margin-top: auto;
  max-width: 420px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.vd-login-quote small {
  display: block;
  margin-top: 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0;
}

/* ─── Form section ─── */
.vd-form-section {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line-2);
}

.vd-form-section:last-child { border-bottom: 0; }

.vd-form-section h4 { margin: 0 0 4px; font-size: 14px; font-weight: 700; }
.vd-form-section .vd-desc { font-size: 12px; color: var(--ink-3); margin: 0 0 16px; }

.vd-form-foot {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 14px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-radius: 0 0 var(--radius) var(--radius);
}

.vd-field { 
  margin-bottom: 16px;
  margin-top: 6px; 
}

.vd-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--ink-2);
}

.vd-field label .vd-req { color: var(--neg); margin-left: 2px; }

.vd-field .vd-hint {
  font-size: 11.5px;
  color: var(--warn);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.vd-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Drop zone */
.vd-drop {
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 32px 18px;
  text-align: center;
  background: var(--surface-2);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

.vd-drop:hover { border-color: var(--accent); background: var(--accent-soft); }

/* Toggle switch */
.vd-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.vd-toggle .vd-sw {
  width: 38px;
  height: 22px;
  border-radius: 99px;
  background: var(--accent);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.vd-toggle .vd-sw::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 18px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px oklch(0% 0 0 / 0.2);
  transition: left 0.2s;
}

.vd-toggle.off .vd-sw { background: oklch(86% 0.005 250); }
.vd-toggle.off .vd-sw::after { left: 2px; }

/* ─── Machine status list ─── */
.vd-status-list { display: flex; flex-direction: column; }

.vd-status-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-top: 1px solid var(--line-2);
}

.vd-status-row:first-child { border-top: 0; }
.vd-status-row .vd-no { font: 600 11.5px 'JetBrains Mono'; color: var(--ink-4); }
.vd-status-row .vd-name { font-weight: 600; font-size: 13px; }
.vd-status-row .vd-code-sm { font: 500 11.5px 'JetBrains Mono'; color: var(--ink-3); margin-top: 2px; }

/* ─── Product rows (top selling) ─── */
.vd-product-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--line-2);
}

.vd-product-row:first-child { border-top: 0; }
.vd-pname { font-weight: 600; font-size: 13px; line-height: 1.25; }
.vd-pcode { font: 500 11px 'JetBrains Mono'; color: var(--ink-4); margin-top: 3px; }
.vd-pprice { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.vd-psales { text-align: right; font-size: 11.5px; color: var(--ink-4); margin-top: 3px; }

/* ─── Rank badge ─── */
.vd-rank {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font: 700 11px 'JetBrains Mono';
  color: var(--ink-3);
}

.vd-rank.top { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

/* ─── Product thumbnail placeholder ─── */
.vd-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: repeating-linear-gradient(45deg, var(--surface-2) 0 6px, var(--line-2) 6px 12px);
  border: 1px solid var(--line);
  flex: none;
  display: grid;
  place-items: center;
  color: var(--ink-4);
  font-size: 9px;
  font-family: 'JetBrains Mono';
  overflow: hidden;
}

.vd-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.vd-prod-cell { display: flex; align-items: center; gap: 12px; }

/* ─── Link button ─── */
.vd-link-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--ink-3);
  font: 600 12.5px 'Plus Jakarta Sans';
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  padding: 0;
}

.vd-link-btn:hover { color: var(--ink); }

/* ─── Inline code (transaction codes etc) ─── */
.vd-code-inline { font: 600 12px 'JetBrains Mono'; color: var(--info); }

/* ─── Chart legend row ─── */
.vd-legend { display: flex; gap: 18px; padding: 0 18px 6px; flex-wrap: wrap; }
.vd-legend-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.vd-legend-swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.vd-legend-item b { color: var(--ink); font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; margin-left: 4px; }

.vd-toggle.off .vd-sw { background: oklch(86% 0.005 250); }
.vd-toggle.off .vd-sw::after { left: 2px; }


/* ─── Viewport meta safety ─── */
* { box-sizing: border-box; }


.vd-hamburger {
  display: none;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  color: var(--ink);
  transition: background 0.2s ease;
}

.vd-hamburger:hover {
  background: var(--surface-2);
}

.vd-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}

/* Animasi smooth menjadi X */
.vd-hamburger.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.vd-hamburger.is-open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.vd-hamburger.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.vd-topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.vd-topbar-logo {
  display: none;
  height: 28px;
  max-width: 120px;
  object-fit: contain;
}

.vd-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 49;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.vd-sidebar-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}


.vd-sidebar-close {
  display: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 7px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  font-size: 11px;
  flex-shrink: 0;
  margin-left: auto;
}
.vd-sidebar-close:hover { background: var(--line); }


.vd-t-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.vd-t-scroll-wrap table.vd-t {
  min-width: 600px;
}

/* ─── Shared list page UI: filter card / toolbar / empty state / pagination ─── */
.vd-list-filter {
  position: relative;
  z-index: 20;
  padding: 18px;
  margin-bottom: 14px;
  overflow: visible;
}

.vd-list-filter-title {
  margin-bottom: 12px;
  color: var(--ink);
  font-weight: 600;
}

.vd-list-filter-row {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.vd-list-filter-row label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vd-list-filter-row label > span {
  color: var(--ink-4);
  font-size: 11px;
  font-weight: 600;
}

.vd-list-filter-actions {
  display: flex;
  gap: 8px;
}

.vd-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.vd-list-limit {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vd-list-limit .vd-select {
  width: auto;
  min-width: 60px;
}

.vd-list-search {
  position: relative;
  width: min(320px, 100%);
}

.vd-list-search i {
  position: absolute;
  top: 50%;
  left: 13px;
  color: var(--ink-4);
  transform: translateY(-50%);
}

.vd-list-search .vd-input {
  width: 100%;
  padding-left: 38px;
}

.vd-list-empty {
  display: flex;
  min-height: 300px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.vd-list-empty > span {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 16px;
  background: var(--surface-2);
  color: #aac4e8;
  font-size: 24px;
}

.vd-list-empty h3 {
  margin: 14px 0 5px;
  color: var(--ink);
  font-size: 16px;
}

.vd-list-empty p {
  margin: 0;
  color: var(--ink-4);
  font-size: 12px;
}

.vd-list-pagination {
  padding: 12px 18px;
  border-top: 1px solid var(--line-2);
}

@media (max-width: 640px) {
  .vd-list-toolbar { align-items: stretch; flex-direction: column; }
  .vd-list-search { width: 100%; }
  .vd-list-filter-actions .vd-btn { flex: 1; justify-content: center; }
}


@media (max-width: 1024px) {
  .vd-app {
    grid-template-columns: 220px 1fr;
  }
}

@media (max-width: 768px) {

  /* Layout: 1 kolom, sidebar keluar dari grid */
  .vd-app {
    display: block;
  }

  /* Sidebar jadi offcanvas */
  .vd-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh; /* dynamic viewport height */
    width: 280px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .vd-sidebar.is-open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.15);
  }

  /* Overlay aktif di mobile */
  .vd-sidebar-overlay { display: block; }

  /* Hamburger muncul */
  .vd-hamburger { display: flex; }

  /* Close button di sidebar muncul */
  .vd-sidebar-close { display: flex; }

  /* Brand area: logo + close button sejajar */
  .vd-brand {
    display: flex;
    align-items: center;
    padding-right: 10px;
  }

  /* Topbar */
  .vd-topbar {
    padding: 0 14px;
    gap: 10px;
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 45;
    background: var(--surface);
    box-shadow: 0 1px 0 var(--line);
  }

  /* Topbar logo muncul */
  .vd-topbar-logo { display: block !important; }

  /* Hide notification button on mobile */
  .vd-notif-btn { display: none !important; }

  /* Page needs padding-top to account for fixed topbar */
  .vd-page {
    padding-top: 84px;
  }

  /* Sembunyikan nama & role user di topbar agar tidak penuh */
  .vd-top-user > div:not(.vd-avatar) { display: none; }
  .vd-top-user { padding: 5px 8px 5px 5px; }
  .vd-top-user .fa-chevron-down { display: none; }

  /* Main area */
  .vd-main {
    min-height: 100vh;
    overflow-x: hidden;
    padding-top: 0;
  }

  /* Page */
  .vd-page {
    padding: 84px 16px 48px;
    overflow-x: hidden;
  }

  /* Page head: stack vertikal */
  .vd-page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
  }

  .vd-page-head h1 { font-size: 20px; }
  .vd-crumbs { display: none; }

  /* Semua button di page head jadi full width */
  .vd-page-head > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .vd-page-head > div:last-child .vd-btn {
    flex: 1;
    justify-content: center;
    min-width: 100px;
  }

  /* KPI strip: 2 kolom */
  .vd-kpis {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }
  .vd-kpi .vd-val { font-size: 20px; }
  .vd-kpi { padding: 14px 14px; }

  /* Grid layouts: single column */
  .vd-grid-2-1 { grid-template-columns: 1fr; gap: 12px; }
  .vd-grid-1-1 { grid-template-columns: 1fr; gap: 12px; }

  /* Form row-2: single column */
  .vd-row-2 { grid-template-columns: 1fr; gap: 0; }

  /* Card head wrap */
  .vd-card-head { flex-wrap: wrap; gap: 10px; padding: 14px 14px 10px; }
  .vd-card-head h3 { font-size: 14px; }

  /* Segmented control lebih kompak */
  .vd-seg button { padding: 5px 9px; font-size: 11px; }

  /* Card scroll untuk tabel */
  .vd-card { overflow: visible; }

  /* Form sections */
  .vd-form-section { padding: 16px; }
  .vd-form-foot {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .vd-form-foot .vd-btn {
    flex: 1;
    min-width: 100px;
    justify-content: center;
  }

  /* Login: single column */
  .vd-login-shell { grid-template-columns: 1fr; }
  .vd-login-right { display: none; }
  .vd-login-left { padding: 28px 24px; border-right: 0; }
  .vd-login-form { width: 100%; max-width: 440px; }

  /* Dropdown width adjust */
  .vd-user-dropdown { width: 220px; }
  .vd-lang-dropdown { width: 180px; }

  /* Touch targets min 44px */
  .vd-nav-item { padding: 11px 12px; }
  .vd-icon-btn { width: 40px; height: 40px; }
  .vd-btn { min-height: 42px; }
}

@media (max-width: 640px) {

  .vd-page { padding: 16px 12px 44px; }
  .vd-topbar { padding: 0 12px; gap: 8px; }

  /* KPI: tetap 2 kolom tapi lebih compact */
  .vd-kpis { gap: 8px; }
  .vd-kpi .vd-val { font-size: 18px; }
  .vd-kpi .vd-label { font-size: 10.5px; }

  /* Card head: search full width */
  .vd-card-head > div { width: 100%; }
  .vd-card-head > div[style*="display:flex"],
  .vd-card-head > div[style*="display: flex"] {
    flex-wrap: wrap !important;
  }
  .vd-card-head .vd-input { width: 100%; }

  /* Form foot: stack */
  .vd-form-foot { flex-direction: column-reverse; }
  .vd-form-foot .vd-btn { width: 100%; }

  /* Placeholder */
  .vd-placeholder { padding: 32px 20px; min-height: 260px; }

  /* Login */
  .vd-login-left { padding: 24px 20px; }
  .vd-login-form h2 { font-size: 22px; }
}

@media (max-width: 480px) {

  .vd-page { padding: 14px 10px 36px; }
  .vd-topbar { padding: 0 10px; height: 56px; }

  /* KPI: 1 kolom */
  .vd-kpis { grid-template-columns: 1fr; }
  .vd-kpi .vd-val { font-size: 22px; }

  /* Page head */
  .vd-page-head h1 { font-size: 18px; }

  /* Table min-width lebih kecil */
  .vd-t-scroll-wrap table.vd-t { min-width: 480px; }

  /* Sidebar fullwidth-ish */
  .vd-sidebar { width: calc(100vw - 56px); max-width: 300px; }

  /* Lang dropdown tidak keluar layar */
  .vd-lang-dropdown { right: -30px; width: 160px; }
  .vd-user-dropdown { right: 0; width: calc(100vw - 40px); max-width: 260px; }

  /* Pagination */
  .pagination { justify-content: center; flex-wrap: wrap; }
  .pagination .page-item .page-link { min-width: 30px; padding: 5px 7px; font-size: 11px; }

  /* SweetAlert responsive */
  .swal2-popup { width: calc(100% - 32px) !important; max-width: 340px !important; }
}


@media (max-width: 768px) {
  /* Filter row yang pakai inline style display:flex */
  [style*="display:flex"][style*="gap:12px"],
  [style*="display: flex"][style*="gap: 12px"],
  [style*="display:flex"][style*="gap: 12px"],
  [style*="display: flex"][style*="gap:12px"] {
    flex-wrap: wrap !important;
  }

  /* Select di dalam filter row */
  [style*="display:flex"] > .vd-select,
  [style*="display: flex"] > .vd-select {
    flex: 1 1 140px;
    min-width: 130px;
  }

  /* Tombol Search/Reset di filter row */
  [style*="display:flex"] > div > .vd-btn,
  [style*="display: flex"] > div > .vd-btn {
    flex: 1;
    justify-content: center;
  }
}


@media (max-width: 768px) {
  [style*="grid-template-columns: repeat(2, minmax"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }
  [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: 1fr 1fr !important;
  }
  [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 480px) {
  [style*="grid-template-columns: repeat(2, minmax"] {
    grid-template-columns: 1fr !important;
  }
  [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: 1fr !important;
  }
  [style*="grid-template-columns: repeat(4"] {
    grid-template-columns: 1fr !important;
  }
}

body.sidebar-open {
  overflow: hidden;
}


@media (max-width: 768px) {
  .vs__dropdown-toggle,
  [class*="search-select"] {
    min-width: 0 !important;
    width: 100% !important;
    flex: 1 1 140px !important;
  }
}


/* Base responsive behavior */
html {
  -webkit-text-size-adjust: 100%;
  -ms-overflow-style: none;
  overflow-x: hidden !important;
}

body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
  position: relative !important;
  margin: 0 !important;
  padding: 0 !important;
}

.vd-app {
  overflow-x: hidden !important;
  max-width: 100% !important;
  width: 100% !important;
}

.vd-main {
  overflow-x: hidden !important;
  max-width: 100% !important;
  width: 100% !important;
  min-width: 0 !important;
}

.vd-page {
  overflow-x: hidden !important;
  max-width: 100% !important;
  width: 100% !important;
  min-width: 0 !important;
}

/* Body scroll management */
body.sidebar-open {
  overflow: hidden !important;
}

body:not(.sidebar-open) {
  overflow: auto !important;
}

@media (min-width: 769px) {
  .vd-app {
    display: grid !important;
    grid-template-columns: 248px 1fr !important;
    overflow: visible !important;
  }

  .vd-sidebar {
    position: sticky !important;
    top: 0 !important;
    height: 100vh !important;
    overflow-y: auto !important;
  }

  .vd-topbar {
    position: sticky !important;
    top: 0 !important;
    z-index: 40 !important;
  }

  .vd-main {
    margin-left: 0 !important;
    overflow: visible !important;
  }
}


@media (max-width: 768px) {
  .vd-app {
    display: block !important;
    grid-template-columns: none !important;
  }

  .vd-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    transform: translateX(-100%) !important;
    width: 280px !important;
    height: 100vh !important;
    z-index: 50 !important;
  }

  .vd-sidebar.is-open {
    transform: translateX(0) !important;
  }

  .vd-hamburger {
    display: flex !important;
  }

  .vd-sidebar-overlay {
    pointer-events: none !important;
    visibility: hidden !important;
    display: block !important;
  }

  .vd-sidebar-overlay.is-visible {
    pointer-events: auto !important;
    visibility: visible !important;
  }

  .vd-main {
    position: relative !important;
    z-index: 1 !important;
    padding-top: 0 !important;
    width: 100% !important;
  }

  /* Add padding to page content to prevent navbar overlap */
  .vd-page {
    padding-top: 80px !important;
  }

  .vd-topbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 45 !important;
  }

  .vd-topbar-logo {
    display: block !important;
  }

  .vd-notif-btn {
    display: none !important;
  }

  .vd-sidebar-close {
    display: flex !important;
  }

  /* Product images - make smaller on mobile */
  img[style*="width: 100px"],
  img[style*="width:100px"],
  img[style*="height: 100px"],
  img[style*="height:100px"] {
    max-width: 60px !important;
    max-height: 60px !important;
    width: 60px !important;
    height: auto !important;
  }

  /* Video elements */
  video[width="100"] {
    max-width: 60px !important;
    width: 60px !important;
  }

  /* Product card images */
  .vd-card img,
  .card img,
  table img {
    max-width: 70px !important;
    height: auto !important;
    object-fit: contain !important;
  }

  /* Table horizontal scroll wrapper */
  .vd-t-scroll-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Table styling for mobile */
  .vd-t {
    min-width: 600px !important;
    font-size: 12px !important;
  }

  .vd-t th,
  .vd-t td {
    padding: 10px 8px !important;
    font-size: 12px !important;
  }

  /* Buttons spacing */
  .btn,
  button,
  .vd-btn {
    font-size: 13px !important;
    padding: 10px 14px !important;
  }

  .vd-icon-btn {
    width: 32px !important;
    height: 32px !important;
  }

  .vd-action-buttons {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, 32px) !important;
    justify-content: center !important;
    align-content: start !important;
    align-items: center !important;
    justify-items: center !important;
    gap: 8px !important;
    min-width: 32px !important;
    width: max-content !important;
    max-width: 104px !important;
    margin: 0 auto !important;
  }

  .vd-action-buttons .vd-icon-btn {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
  }

  /* Page titles */
  h1 {
    font-size: 20px !important;
    margin-bottom: 0 !important;
  }

  h2, h3 {
    font-size: 17px !important;
  }

  h4 {
    font-size: 15px !important;
  }

  /* Card spacing */
  .vd-card {
    padding: 14px !important;
  }

  .vd-card-head {
    flex-direction: column !important;
    gap: 12px !important;
    align-items: flex-start !important;
  }

  /* Page head responsive */
  .vd-page-head {
    flex-direction: column !important;
    gap: 14px !important;
    align-items: flex-start !important;
  }

  /* Input and select */
  .vd-input,
  .vd-select {
    font-size: 13px !important;
    padding: 10px 12px !important;
  }

  /* Full width buttons on mobile */
  .vd-page-head .vd-btn {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Force all inline grids responsive */
  [style*="display: grid"][style*="grid-template-columns"],
  [style*="display:grid"][style*="grid-template-columns"] {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  /* CATATAN: Tidak memaksa semua flex wrap — terlalu agresif dan merusak
     tombol-tombol inline seperti filter bar, action buttons, dsb.
     Hanya flex container yang memang layout-container yang di-wrap. */

  [style*="repeat(2, minmax"],
  [style*="repeat(3"],
  [style*="repeat(4"] {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 480px) {
  [style*="display: grid"][style*="grid-template-columns"],
  [style*="display:grid"][style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  [style*="repeat(2, minmax"],
  [style*="repeat(3"],
  [style*="repeat(4"] {
    grid-template-columns: 1fr !important;
  }
}

  /* Product grid wrapper - center cards */
  [style*="display:flex"][style*="flex-wrap:wrap"][style*="gap:16px"] {
    justify-content: center !important;
    padding: 14px !important;
    gap: 14px !important;
  }

  /* Product cards - responsive width and center */
  .vd-card[style*="width:220px"] {
    width: 100% !important;
    max-width: 320px !important;
    margin: 0 auto !important;
  }

  /* Product card images - BIGGER on mobile */
  .vd-card[style*="width:220px"] img[style*="height:200px"] {
    height: 300px !important;
    max-height: 300px !important;
    object-fit: cover !important;
  }

  /* Product card content */
  .vd-card[style*="width:220px"] > div {
    padding: 16px !important;
  }

  /* Product buttons full width */
  .vd-card[style*="width:220px"] button,
  .vd-card[style*="width:220px"] .vd-btn {
    width: 100% !important;
  }

@media (max-width: 480px) {

  /* Product cards even wider on small screens */
  .vd-card[style*="width:220px"] {
    max-width: 100% !important;
    width: calc(100% - 28px) !important;
  }

  /* Product images MUCH BIGGER on small screens */
  .vd-card[style*="width:220px"] img[style*="height:200px"] {
    height: 320px !important;
    max-height: 320px !important;
    object-fit: cover !important;
  }

  /* Card padding */
  .vd-card[style*="width:220px"] > div {
    padding: 18px !important;
  }

  /* Font sizes - larger */
  .vd-card[style*="width:220px"] .vd-prim {
    font-size: 16px !important;
    font-weight: 600 !important;
  }

  .vd-card[style*="width:220px"] [style*="font-weight:700"] {
    font-size: 17px !important;
  }

  /* Grid force 1 column for very small screens */
  [style*="display: grid"][style*="grid-template-columns"],
  [style*="display:grid"][style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  [style*="repeat(2, minmax"],
  [style*="repeat(3"],
  [style*="repeat(4"] {
    grid-template-columns: 1fr !important;
  }
}

.vd-sidebar {
  padding-bottom: max(18px, env(safe-area-inset-bottom, 18px));
}

.vd-side-foot {
  flex-shrink: 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
}

@media (max-width: 768px) {
  .vd-sidebar {
    height: 100dvh;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
  }

  .vd-side-foot {
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
    position: sticky;
    bottom: 0;
    background: var(--surface);
    z-index: 1;
    flex-shrink: 0;
  }

  .vd-topbar {
    padding-top: max(0px, env(safe-area-inset-top, 0px));
  }

  .vd-page {
    padding-top: calc(80px + max(0px, env(safe-area-inset-top, 0px))) !important;
  }
}

@media (max-width: 768px) {
  /* Wrapper flex card produk → grid 2 kolom */
  .vd-card-body > div[style*="display:flex"][style*="flex-wrap"],
  .vd-card-body > div[style*="display: flex"][style*="flex-wrap"],
  .vd-page > div[style*="display:flex"][style*="flex-wrap"],
  .vd-page > div[style*="display: flex"][style*="flex-wrap"] {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
    justify-items: center !important;
    padding: 12px !important;
  }

  /* Card dengan inline style width:220px */
  div[style*="width:220px"],
  div[style*="width: 220px"] {
    width: 100% !important;
    max-width: 170px !important;
    margin: 0 auto !important;
  }

  /* Gambar di dalam card */
  div[style*="width:220px"] img,
  div[style*="width: 220px"] img,
  img[style*="height:200px"],
  img[style*="height: 200px"] {
    width: 100% !important;
    height: 150px !important;
    max-height: 150px !important;
    object-fit: cover !important;
  }

  /* Padding konten card */
  div[style*="width:220px"] > div,
  div[style*="width: 220px"] > div {
    padding: 10px 12px !important;
  }

  /* Nama produk */
  div[style*="width:220px"] .vd-prim,
  div[style*="width: 220px"] .vd-prim {
    font-size: 12px !important;
    line-height: 1.3 !important;
  }

  /* Harga produk */
  div[style*="width:220px"] [style*="font-weight:700"],
  div[style*="width: 220px"] [style*="font-weight: 700"] {
    font-size: 13px !important;
  }

  /* Tombol (Edit/Delete, Ubah/Hapus) */
  div[style*="width:220px"] button,
  div[style*="width: 220px"] button,
  div[style*="width:220px"] .vd-btn,
  div[style*="width: 220px"] .vd-btn {
    padding: 8px 10px !important;
    font-size: 12px !important;
    flex: 1 !important;
  }
}

@media (max-width: 480px) {
  /* 1 kolom di layar sangat kecil */
  .vd-card-body > div[style*="display:flex"][style*="flex-wrap"],
  .vd-card-body > div[style*="display: flex"][style*="flex-wrap"],
  .vd-page > div[style*="display:flex"][style*="flex-wrap"],
  .vd-page > div[style*="display: flex"][style*="flex-wrap"] {
    grid-template-columns: 1fr !important;
  }

  /* Card lebih lebar */
  div[style*="width:220px"],
  div[style*="width: 220px"] {
    max-width: 300px !important;
    width: calc(100% - 24px) !important;
  }

  /* Gambar lebih besar */
  div[style*="width:220px"] img,
  div[style*="width: 220px"] img,
  img[style*="height:200px"],
  img[style*="height: 200px"] {
    height: 200px !important;
    width: 100% !important;
    object-fit: cover !important;
  }
}

@media (max-width: 768px) {

  /* Grid 2 kolom, card lebih kecil */
  .vd-page > div[style*="display:flex"][style*="flex-wrap:wrap"],
  .vd-page > div[style*="display: flex"][style*="flex-wrap: wrap"],
  .vd-page > div[style*="display:flex"][style*="flex-wrap"] {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    padding: 10px !important;
    justify-items: center !important;
  }

  /* Card lebih kecil */
  div[style*="width:220px"],
  div[style*="width: 220px"] {
    width: 100% !important;
    max-width: 160px !important;
    margin: 0 auto !important;
    overflow: hidden !important;
  }

  /* Gambar di tengah card */
  div[style*="width:220px"] img,
  div[style*="width: 220px"] img {
    display: block !important;
    width: 80px !important;
    height: 100px !important;
    object-fit: contain !important;
    margin: 10px auto !important;
  }

  /* Hapus padding berlebih di area gambar */
  div[style*="width:220px"] > img,
  div[style*="width: 220px"] > img {
    width: 80px !important;
    height: 100px !important;
    margin: 10px auto !important;
    display: block !important;
  }

  /* Konten teks di dalam card */
  div[style*="width:220px"] > div,
  div[style*="width: 220px"] > div {
    padding: 8px 10px 10px !important;
  }

  /* Nama & SKU */
  div[style*="width:220px"] .vd-prim,
  div[style*="width: 220px"] .vd-prim {
    font-size: 11px !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  div[style*="width:220px"] .vd-sec,
  div[style*="width: 220px"] .vd-sec {
    font-size: 10px !important;
  }

  /* Harga */
  div[style*="width:220px"] [style*="font-weight:700"],
  div[style*="width: 220px"] [style*="font-weight:700"],
  div[style*="width:220px"] [style*="font-weight: 700"],
  div[style*="width: 220px"] [style*="font-weight: 700"] {
    font-size: 12px !important;
    margin-bottom: 8px !important;
  }

  /* Tombol */
  div[style*="width:220px"] [style*="display:flex"][style*="gap:8px"],
  div[style*="width: 220px"] [style*="display:flex"][style*="gap:8px"] {
    gap: 6px !important;
  }

  div[style*="width:220px"] button,
  div[style*="width: 220px"] button {
    padding: 7px 6px !important;
    font-size: 11px !important;
    flex: 1 !important;
    min-width: 0 !important;
  }
}

@media (max-width: 480px) {
  /* 1 kolom di layar kecil */
  .vd-page > div[style*="display:flex"][style*="flex-wrap:wrap"],
  .vd-page > div[style*="display: flex"][style*="flex-wrap: wrap"],
  .vd-page > div[style*="display:flex"][style*="flex-wrap"] {
    grid-template-columns: 1fr !important;
  }

  div[style*="width:220px"],
  div[style*="width: 220px"] {
    max-width: 280px !important;
    width: calc(100% - 20px) !important;
  }

  /* Gambar lebih besar di 1 kolom */
  div[style*="width:220px"] img,
  div[style*="width: 220px"] img {
    width: 100px !important;
    height: 130px !important;
    margin: 12px auto !important;
  }
}

@media (max-width: 768px) {

  /* Pastikan 2 kolom merata */
  .vd-page > div[style*="display:flex"][style*="flex-wrap"],
  .vd-page > div[style*="display: flex"][style*="flex-wrap"] {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    padding: 10px !important;
  }

  /* Card mengisi kolom penuh */
  div[style*="width:220px"],
  div[style*="width: 220px"] {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
  }

  /* Gambar di tengah, ukuran konsisten */
  div[style*="width:220px"] img,
  div[style*="width: 220px"] img {
    display: block !important;
    width: 90px !important;
    height: 90px !important;
    object-fit: contain !important;
    margin: 12px auto !important;
  }

  /* SKU (vd-sec) — 1 baris, ellipsis */
  div[style*="width:220px"] .vd-sec,
  div[style*="width: 220px"] .vd-sec {
    font-size: 11px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    display: block !important;
  }

  /* Nama produk (vd-prim) — max 2 baris, ellipsis */
  div[style*="width:220px"] .vd-prim,
  div[style*="width: 220px"] .vd-prim {
    font-size: 12px !important;
    line-height: 1.4 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
    word-break: break-word !important;
  }

  /* Harga */
  div[style*="width:220px"] [style*="font-weight:700"],
  div[style*="width: 220px"] [style*="font-weight:700"],
  div[style*="width:220px"] [style*="font-weight: 700"],
  div[style*="width: 220px"] [style*="font-weight: 700"] {
    font-size: 12px !important;
    margin-bottom: 8px !important;
    white-space: nowrap !important;
  }

  /* Deskripsi produk — max 2 baris */
  div[style*="width:220px"] [style*="font-size:13px"],
  div[style*="width: 220px"] [style*="font-size:13px"],
  div[style*="width:220px"] [style*="font-size: 13px"],
  div[style*="width: 220px"] [style*="font-size: 13px"] {
    font-size: 11px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  /* Padding konten */
  div[style*="width:220px"] > div,
  div[style*="width: 220px"] > div {
    padding: 8px 10px 12px !important;
  }

  /* Tombol sejajar */
  div[style*="width:220px"] > div > div[style*="display:flex"],
  div[style*="width: 220px"] > div > div[style*="display:flex"],
  div[style*="width:220px"] > div > div[style*="display: flex"],
  div[style*="width: 220px"] > div > div[style*="display: flex"] {
    gap: 6px !important;
  }

  div[style*="width:220px"] button,
  div[style*="width: 220px"] button {
    flex: 1 !important;
    padding: 8px 4px !important;
    font-size: 12px !important;
    min-width: 0 !important;
    white-space: nowrap !important;
  }
}
/* Sidebar desktop: padding bottom aman */
.vd-sidebar {
  padding-bottom: max(18px, env(safe-area-inset-bottom, 18px));
}

/* Footer sidebar tidak boleh tertutup home indicator */
.vd-side-foot {
  flex-shrink: 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
}

@media (max-width: 768px) {

  /* Sidebar offcanvas: pakai 100dvh + padding safe area */
  .vd-sidebar {
    height: 100dvh !important;
    padding-bottom: max(24px, env(safe-area-inset-bottom, 24px)) !important;
  }

  /* Footer sidebar sticky + tidak tertutup home indicator */
  .vd-side-foot {
    position: sticky !important;
    bottom: 0 !important;
    background: var(--surface) !important;
    z-index: 2 !important;
    flex-shrink: 0 !important;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 20px)) !important;
    border-top: 1px solid var(--line) !important;
  }

  /* Topbar fixed: tambah safe area atas (notch iPhone) */
  .vd-topbar {
    padding-top: env(safe-area-inset-top, 0px) !important;
    height: calc(64px + env(safe-area-inset-top, 0px)) !important;
  }

  /* Page content: offset topbar + safe area atas */
  .vd-page {
    padding-top: calc(80px + env(safe-area-inset-top, 0px)) !important;
  }
}

.vd-action-cell {
  display: flex !important;
  gap: 6px !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
}

/* Icon button: ukuran konsisten, tidak boleh mengecil */
.vd-icon-btn {
  flex-shrink: 0 !important;
  display: inline-grid !important;
  place-items: center !important;
}

/* Icon & SVG di dalam icon-btn: ukuran terkunci */
.vd-icon-btn svg,
.vd-icon-btn i {
  width: 16px !important;
  height: 16px !important;
  font-size: 14px !important;
  flex-shrink: 0 !important;
  display: block !important;
  line-height: 1 !important;
}

/* Nav item icon di sidebar: konsisten */
.vd-nav-item svg,
.vd-nav-item i {
  width: 16px !important;
  height: 16px !important;
  font-size: 14px !important;
  flex-shrink: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

@media (max-width: 768px) {

  /* Tabel: icon tetap 32x32, tidak mengecil akibat override CSS lama */
  .vd-icon-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
  }

  /* Icon di dalam tabel: jangan override ukuran gambar produk */
  table.vd-t .vd-icon-btn svg,
  table.vd-t .vd-icon-btn i {
    width: 15px !important;
    height: 15px !important;
    font-size: 13px !important;
  }

  /* Khusus: gambar produk kecil di tabel LIST tidak terpengaruh */
  table.vd-t img {
    flex-shrink: 0 !important;
    object-fit: cover !important;
  }

  /* Card head: toggle view mode tetap sejajar */
  .vd-view-toggle {
    display: flex !important;
    gap: 6px !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }

  /* Card head tidak stack saat ada toggle */
  .vd-card-head {
    align-items: center !important;
  }
}

/* Sidebar desktop: padding bottom aman */
.vd-sidebar {
  padding-bottom: max(18px, env(safe-area-inset-bottom, 18px));
}

/* Footer sidebar tidak boleh tertutup home indicator */
.vd-side-foot {
  flex-shrink: 0;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px));
}

@media (max-width: 768px) {

  /* Sidebar offcanvas: pakai 100dvh + padding safe area */
  .vd-sidebar {
    height: 100dvh !important;
    padding-bottom: max(24px, env(safe-area-inset-bottom, 24px)) !important;
  }

  /* Footer sidebar sticky + tidak tertutup home indicator */
  .vd-side-foot {
    position: sticky !important;
    bottom: 0 !important;
    background: var(--surface) !important;
    z-index: 2 !important;
    flex-shrink: 0 !important;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 20px)) !important;
    border-top: 1px solid var(--line) !important;
  }

  /* Topbar fixed: tambah safe area atas (notch iPhone) */
  .vd-topbar {
    padding-top: env(safe-area-inset-top, 0px) !important;
    height: calc(64px + env(safe-area-inset-top, 0px)) !important;
  }

  /* Page content: offset topbar + safe area atas */
  .vd-page {
    padding-top: calc(80px + env(safe-area-inset-top, 0px)) !important;
  }
}

.vd-action-cell {
  display: flex !important;
  gap: 6px !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
}

/* Icon button: ukuran konsisten, tidak boleh mengecil */
.vd-icon-btn {
  flex-shrink: 0 !important;
  display: inline-grid !important;
  place-items: center !important;
}

/* Icon & SVG di dalam icon-btn: ukuran terkunci */
.vd-icon-btn svg,
.vd-icon-btn i {
  width: 16px !important;
  height: 16px !important;
  font-size: 14px !important;
  flex-shrink: 0 !important;
  display: block !important;
  line-height: 1 !important;
}

/* Nav item icon di sidebar: konsisten */
.vd-nav-item svg,
.vd-nav-item i {
  width: 16px !important;
  height: 16px !important;
  font-size: 14px !important;
  flex-shrink: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  line-height: 1 !important;
}

@media (max-width: 768px) {

  /* Tabel: icon tetap 32x32, tidak mengecil akibat override CSS lama */
  .vd-icon-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
  }

  /* Icon di dalam tabel: jangan override ukuran gambar produk */
  table.vd-t .vd-icon-btn svg,
  table.vd-t .vd-icon-btn i {
    width: 15px !important;
    height: 15px !important;
    font-size: 13px !important;
  }

  /* Khusus: gambar produk kecil di tabel LIST tidak terpengaruh */
  table.vd-t img {
    flex-shrink: 0 !important;
    object-fit: cover !important;
  }

  /* Card head: toggle view mode tetap sejajar */
  .vd-view-toggle {
    display: flex !important;
    gap: 6px !important;
    align-items: center !important;
    flex-shrink: 0 !important;
  }

  /* Card head tidak stack saat ada toggle */
  .vd-card-head {
    align-items: center !important;
  }
}

.vd-icon-btn {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  padding: 0 !important;

  /* Layout: selalu center */
  display: inline-grid !important;
  place-items: center !important;
  align-items: center !important;
  justify-content: center !important;

  /* Ukuran tidak boleh dikecilkan oleh flex parent */
  flex-shrink: 0 !important;
  flex-grow: 0 !important;

  /* Bawaan */
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 9px;
  cursor: pointer;
  color: var(--ink-2);
  text-decoration: none;
  box-sizing: border-box !important;

  /* PENTING: override rule button global yg set font-size/padding */
  font-size: unset !important;
  line-height: 1 !important;
}

/* Icon & SVG di dalam icon-btn — ukuran terkunci */
.vd-icon-btn > svg,
.vd-icon-btn svg,
.vd-icon-btn > i,
.vd-icon-btn i {
  width: 15px !important;
  height: 15px !important;
  font-size: 14px !important;
  flex-shrink: 0 !important;
  display: block !important;
  line-height: 1 !important;
  pointer-events: none;
}


.vd-icon-btn:hover { background: var(--surface-2) !important; }
.vd-icon-btn.on    { background: var(--ink) !important; color: #fff !important; border-color: var(--ink) !important; }

.vd-t td > div,
td .vd-action-wrap {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
}

.vd-t td:last-child {
  white-space: nowrap;
}



@media (max-width: 768px) {

  .vd-icon-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    padding: 0 !important;
    border-radius: 8px !important;
  }

  button.vd-icon-btn,
  a.vd-icon-btn {
    padding: 0 !important;
    font-size: unset !important;
    min-height: unset !important;
  }


  .vd-icon-btn > i,
  .vd-icon-btn > svg,
  .vd-icon-btn i,
  .vd-icon-btn svg {
    font-size: 13px !important;
    width: 14px !important;
    height: 14px !important;
  }

  .vd-t td > div,
  td .vd-action-wrap {
    flex-wrap: nowrap !important;
    gap: 5px !important;
  }
}

@media (max-width: 480px) {
  .vd-icon-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
  }
}

.vd-lang-btn {
  width: auto !important;
  min-width: 36px !important;
  padding: 0 10px 0 8px !important;
  gap: 6px !important;
  font: 700 12px "Plus Jakarta Sans" !important;
}

/* Notif button: tetap square */
.vd-notif-btn {
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
}


.vd-nav-item > i,
.vd-nav-item > svg {
  width: 16px !important;
  height: 16px !important;
  font-size: 14px !important;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  line-height: 1 !important;
}


.vd-btn:not(.vd-icon-btn) {
  padding: 10px 16px !important;
  font-size: 13px !important;
  height: auto !important;
  width: auto !important;
  min-width: unset !important;
  min-height: 40px !important;
}

@media (max-width: 768px) {
  .vd-btn:not(.vd-icon-btn) {
    min-height: 42px !important;
    font-size: 13px !important;
    padding: 10px 14px !important;
  }
}

.vd-t td img {
  max-width: none !important;
  width: 36px !important;
  height: 36px !important;
  object-fit: cover !important;
  border-radius: 6px !important;
  flex-shrink: 0 !important;
  display: block !important;
}

.vd-product-card .vd-product-card__img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
}


@media (max-width: 768px) {

  .vd-card-head {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
  }
  .vd-card-head > * {
    flex-shrink: 0;
  }
}


.vd-side-foot {
  flex-shrink: 0 !important;
  padding-bottom: max(12px, env(safe-area-inset-bottom, 12px)) !important;
}

.vd-sidebar {
  padding-bottom: max(18px, env(safe-area-inset-bottom, 18px)) !important;
}

@media (max-width: 768px) {
  .vd-sidebar {
    height: 100dvh !important;
    padding-bottom: max(24px, env(safe-area-inset-bottom, 24px)) !important;
  }

  .vd-side-foot {
    position: sticky !important;
    bottom: 0 !important;
    background: var(--surface) !important;
    z-index: 2 !important;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 20px)) !important;
  }

  .vd-topbar {
    padding-top: env(safe-area-inset-top, 0px) !important;
    height: calc(64px + env(safe-area-inset-top, 0px)) !important;
  }

  .vd-page {
    padding-top: calc(80px + env(safe-area-inset-top, 0px)) !important;
  }
}

@media (max-width: 768px) {
  .vd-side-foot {
    display: none !important;
  }
}

.vd-lang-btn {
  display: inline-flex !important;
  flex-direction: row-reverse !important;
  align-items: center !important;
  gap: 4px !important;
  width: auto !important;
  min-width: unset !important;
  padding: 0 10px !important;
  font-weight: 700 !important;
  font-size: 12px !important;
}

/* Pastikan teks & chevron tidak tertukar ukuran */
.vd-lang-btn > svg,
.vd-lang-btn > i {
  width: 12px !important;
  height: 12px !important;
  font-size: 11px !important;
  flex-shrink: 0 !important;
}

/* ─── 3. Profile page — responsive mobile ─── */
@media (max-width: 768px) {
  /* Wrapper utama: stack vertikal, full width */
  .vd-profile-wrap,
  .vd-page > div[style*="display:flex"][style*="flex-wrap:wrap"],
  .vd-page > div[style*="display: flex"][style*="flex-wrap: wrap"] {
    flex-direction: column !important;
    gap: 16px !important;
  }

  /* Card gambar: full width, tidak fixed 320px */
  .vd-profile-wrap > div:first-child,
  .vd-page > div[style*="flex-wrap"] > div[style*="flex:0 0 320px"],
  .vd-page > div[style*="flex-wrap"] > div[style*="flex: 0 0 320px"] {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Card informasi: full width */
  .vd-profile-wrap > div:last-child,
  .vd-page > div[style*="flex-wrap"] > div[style*="flex:1"],
  .vd-page > div[style*="flex-wrap"] > div[style*="flex: 1"] {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Form footer (tombol Simpan & Batal): stack vertikal, full width */
  .vd-form-foot {
    flex-direction: column-reverse !important;
    gap: 10px !important;
  }

  .vd-form-foot .vd-btn,
  .vd-form-foot button {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Input field full width di mobile */
  .vd-form-section .vd-form-group,
  .vd-form-section > div {
    width: 100% !important;
  }

  /* Page head tidak membutuhkan margin besar */
  .vd-page-head {
    margin-bottom: 14px !important;
  }
}

/* ============================================================
   MOBILE RESPONSIVE PATCHES — Added for 5-page fix
   Issues: withdraw/voucher/transaction/replacement/dashboard
   ============================================================ */

/* ─── Fix: vd-t-scroll-wrap harus bisa scroll di dalam vd-page ─── */
/* vd-page punya overflow-x: hidden !important yang memblokir
   horizontal scroll tabel. Kita override khusus untuk wrap-nya. */
@media (max-width: 768px) {
  .vd-t-scroll-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    /* Buat stacking context baru agar overflow-x: auto bekerja
       meski parent punya overflow-x: hidden */
    position: relative !important;
  }

  /* Table di dalam scroll wrap: tidak perlu max-width dibatasi */
  .vd-t-scroll-wrap > table,
  .vd-t-scroll-wrap table {
    min-width: max-content !important;
  }

  /* vd-card yang berisi tabel jangan clip overflow-nya */
  .vd-card:has(.vd-t-scroll-wrap) {
    overflow: visible !important;
  }
}

/* ─── Fix: Dashboard — dropdown filter top selling products ─── */
/* Dropdown `.vd-user-dropdown` yang ada di dalam card tertutup
   karena card punya overflow:hidden. Override agar dropdown bisa muncul. */
.vd-card .vd-user-dropdown {
  z-index: 100;
}

@media (max-width: 768px) {
  /* Card yang memuat dropdown: jangan clip overflow */
  .vd-card-head {
    overflow: visible !important;
  }

  .vd-card-head > div[style*="position:relative"],
  .vd-card-head > div[style*="position: relative"] {
    overflow: visible !important;
  }

  /* Dropdown di card head: posisi dan ukuran mobile-friendly */
  .vd-card-head .vd-user-dropdown {
    position: absolute !important;
    right: 0 !important;
    top: calc(100% + 4px) !important;
    min-width: 150px !important;
    z-index: 200 !important;
  }
}

/* ─── Fix: Replacement _action — tabel machine list di panel kiri ─── */
@media (max-width: 768px) {
  /* Panel kiri replacement: tabel bisa scroll */
  .list-product .vd-t-scroll-wrap {
    overflow-x: auto !important;
  }

  /* Pastikan card replacement tidak clip kontennya */
  .vd-replenish-left,
  .vd-replenish-right {
    overflow: visible !important;
  }
}

/* ─── Fix: Replacement detail — cards selalu stack vertikal ─── */
/* Sudah diatur langsung di template dengan flex-direction:column */

/* ─── Fix: scroll tabel horizontal di mobile ─── */
/* vd-page punya overflow-x: hidden !important — override jadi auto
   di mobile agar vd-t-scroll-wrap bisa scroll horizontal.
   Tidak pakai clip-path karena itu memotong render konten tabel. */
@media (max-width: 768px) {
  .vd-page {
    overflow-x: auto !important;
  }

  .vd-t-scroll-wrap {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

/* ─── Fix: Bootstrap modal — semua ukuran layar ─── */
/* Root cause: body.modal-open .vd-page { pointer-events: none }
   menyebabkan modal content ikut tidak bisa diklik karena
   modal berada di dalam DOM yang sama dengan vd-page.
   Solusi: JANGAN matikan pointer-events vd-page saat modal buka.
   Bootstrap sudah menangani backdrop sendiri. */

/* Pastikan modal dan backdrop Bootstrap selalu interaktif */
.modal,
.modal *,
.modal-backdrop {
  pointer-events: auto !important;
}

/* Modal dialog sizing - responsive */
@media (max-width: 768px) {
  .modal-dialog {
    margin: 16px auto !important;
    max-width: calc(100vw - 32px) !important;
  }

  /* Body saat modal terbuka: cegah scroll background */
  body.modal-open {
    overflow: hidden !important;
    padding-right: 0 !important;
  }

  /* Backdrop Bootstrap di mobile: pastikan di bawah modal */
  .modal-backdrop {
    z-index: 1040 !important;
  }

  .modal {
    z-index: 1050 !important;
  }
}

/* ─── Fix: SweetAlert2 backdrop juga jangan diblokir ─── */
.swal2-container {
  pointer-events: auto !important;
  z-index: 9999 !important;
}

.swal2-container * {
  pointer-events: auto !important;
}

/* ═══════════════════════════════════════════════════════════════
   Fix: Machine Board — responsive layout & gambar tidak terpotong
   ═══════════════════════════════════════════════════════════════ */

/* Board grid — desktop default: 4 kolom */
.vd-board-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.vd-board-grid > div {
  flex: 0 0 calc(25% - 16px);
  min-width: 200px;
}

/* Board card image — KUNCI: height fleksibel bukan fixed */
.vd-board-card-img {
  position: relative;
  cursor: pointer;
}

.vd-board-card-img img {
  width: 100% !important;
  height: auto !important;
  max-height: 220px !important;
  object-fit: cover !important;
  object-position: center !important;
  border-radius: 12px !important;
  display: block !important;
}

/* Override CSS global yang mungkin memotong gambar */
@media (max-width: 768px) {
  /* Board product grid: 2 kolom di tablet/mobile */
  .vd-board-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .vd-board-grid > div {
    flex: none !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  /* Gambar board: proporsional, tidak terpotong */
  .vd-board-card-img img,
  .vd-board-grid img[style*="height:300px"],
  .vd-board-grid img[style*="height: 300px"] {
    height: auto !important;
    max-height: 160px !important;
    width: 100% !important;
    object-fit: cover !important;
  }

  /* Override selector global yang memotong gambar di card */
  .vd-card img {
    max-width: 100% !important;
    height: auto !important;
    max-height: 160px !important;
    object-fit: cover !important;
  }

  /* Filter bar pada board: wrap tombol-tombol */
  .vd-board-filter-actions {
    margin-left: 0 !important;
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .vd-board-filter-actions .vd-btn {
    flex: 1 !important;
    min-width: 80px !important;
  }
}

@media (max-width: 480px) {
  /* 1 kolom di layar sangat kecil */
  .vd-board-grid {
    grid-template-columns: 1fr !important;
  }

  .vd-board-grid img[style*="height:300px"],
  .vd-board-grid img[style*="height: 300px"] {
    max-height: 200px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Fix: Dashboard — top_selling_machines & top_selling_product
   Pastikan tabel & product rows tampil benar di mobile
   ═══════════════════════════════════════════════════════════════ */

/* Tabel best selling machines: scroll horizontal di mobile */
@media (max-width: 768px) {
  .vd-t-scroll-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    display: block !important;
  }

  /* Tabel tidak diputus-putus */
  .vd-t-scroll-wrap .vd-t {
    min-width: 500px !important;
    width: max-content !important;
  }

  /* Product rows di top selling: jangan overflow */
  .vd-product-row {
    padding: 10px 12px !important;
    gap: 8px !important;
    overflow: hidden !important;
  }

  .vd-pname {
    font-size: 12px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 140px !important;
  }

  .vd-pcode {
    font-size: 10px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 140px !important;
  }

  .vd-pprice {
    font-size: 12px !important;
    white-space: nowrap !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Fix: Modal scroll di mobile — isi modal bisa discroll
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .modal-dialog {
    margin: 8px auto !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100vh - 16px) !important;
  }

  .modal-content {
    max-height: calc(100vh - 32px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 16px !important;
  }

  .modal-body {
    overflow-y: auto !important;
    max-height: calc(100vh - 100px) !important;
    padding: 16px !important;
  }

  /* Tabel di dalam modal */
  .table-product-modal {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .table-product-modal .vd-t {
    min-width: 300px !important;
  }
}


/* ═══════════════════════════════════════════════════════════════
   Vue-native Modal — pengganti Bootstrap modal JS
   Digunakan di: transaction/detail, machines/board
   ═══════════════════════════════════════════════════════════════ */
.vd-native-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1055;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.vd-native-modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md), 0 20px 60px -10px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 500px;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: vd-modal-in 0.18s ease;
}

.vd-native-modal--lg {
  max-width: 640px;
}

@keyframes vd-modal-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.vd-native-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.vd-native-modal-header h5 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.vd-native-modal-close {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.vd-native-modal-close:hover {
  background: var(--line);
  color: var(--ink);
}

.vd-native-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

.vd-native-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  flex-shrink: 0;
}

/* modal-toggle-wrapper sudah ada padding dari parent */
.vd-native-modal-body .modal-toggle-wrapper {
  padding: 0;
}

/* Mobile override */
@media (max-width: 768px) {
  .vd-native-modal-backdrop {
    padding: 8px;
    align-items: flex-end;
  }

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

  .vd-native-modal--lg {
    max-width: 100%;
  }

  .vd-native-modal-body {
    padding: 16px;
    max-height: calc(92vh - 120px);
  }
}

/* ═══════════════════════════════════════════════════════════════
   Fix: Board grid item — wrapper yang bersih
   ═══════════════════════════════════════════════════════════════ */
.vd-board-grid-item {
  flex: 0 0 calc(25% - 16px);
  min-width: 200px;
}

@media (max-width: 768px) {
  .vd-board-grid-item {
    flex: none !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  /* Board card: tombol hapus tidak keluar card */
  .vd-board-grid-item .vd-card-body {
    padding: 12px !important;
  }

  /* Button row di dalam card board */
  .vd-board-grid-item .vd-card-body > div:last-child > div[style*="display:flex"],
  .vd-board-grid-item .vd-card-body > div > div[style*="display:flex; gap:8px; margin-top:12px"] {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .vd-board-grid-item .vd-card-body button.vd-btn {
    flex: 1 1 calc(50% - 3px) !important;
    min-width: 70px !important;
    font-size: 12px !important;
    padding: 6px 8px !important;
  }
}

@media (max-width: 480px) {
  .vd-board-grid-item {
    width: 100% !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Fix: Dashboard product row — overflow di mobile
   ═══════════════════════════════════════════════════════════════ */
.vd-product-row-info {
  min-width: 0;
  overflow: hidden;
}

@media (max-width: 768px) {
  .vd-product-row {
    padding: 10px 12px !important;
    gap: 8px !important;
  }

  .vd-product-row-info .vd-pname,
  .vd-product-row-info .vd-pcode {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
}


/* ═══════════════════════════════════════════════════════════════
   Board card — image + action buttons (clean, no overflow issues)
   ═══════════════════════════════════════════════════════════════ */

/* Card image: always fill width, height adapts */
.vd-board-card-img-el {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

/* Action button row */
.vd-board-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  width: 100%;
}

.vd-board-card-btn {
  flex: 1;
  min-width: 0;
  text-align: center;
  white-space: nowrap;
}

.vd-board-card-btn--del {
  background: var(--neg) !important;
  color: #fff !important;
}

/* Mobile overrides */
@media (max-width: 768px) {
  /* 2-col grid: image smaller */
  .vd-board-card-img-el {
    height: 130px;
  }

  /* Card body tighter on mobile */
  .vd-board-grid-item .vd-card-body {
    padding: 10px 12px 12px !important;
  }

  /* Buttons compact */
  .vd-board-card-btn {
    font-size: 12px !important;
    padding: 6px 4px !important;
  }

  /* Card itself must not overflow */
  .vd-board-grid-item .vd-card {
    overflow: hidden;
  }
}

@media (max-width: 480px) {
  /* 1-col: image can be taller again */
  .vd-board-card-img-el {
    height: 180px;
  }

  .vd-board-card-btn {
    font-size: 13px !important;
    padding: 7px 8px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Fix: vd-seg small variant — for dashboard top product filter
   ═══════════════════════════════════════════════════════════════ */
.vd-seg--sm button {
  padding: 4px 10px;
  font-size: 11px;
}

/* On very small card-heads, seg wraps gracefully */
@media (max-width: 480px) {
  .vd-card-head .vd-seg {
    flex-wrap: wrap;
    gap: 4px;
  }
  .vd-card-head .vd-seg button {
    flex: 1;
    min-width: 52px;
    text-align: center;
  }
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD — filter card + date picker + calendar
   ═══════════════════════════════════════════════════════════════ */

/* ── Filter card di page-head ── */
.vd-dashboard-filter-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 460px;
  box-shadow: none;
}

.vd-dashboard-filter-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* ── Date trigger button ── */
.vd-dashboard-date-field {
  position: relative;
}

.vd-date-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s;
}
.vd-date-trigger:hover {
  border-color: var(--brand);
}
.vd-date-trigger span {
  flex: 1;
}

/* ── Date modal overlay ── */
.vd-date-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.32);
  padding: 16px;
}

/* ── Popover box ── */
.vd-date-popover {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
  padding: 16px;
  max-width: 680px;
  width: 100%;
  overflow: auto;
  max-height: 90vh;
}

/* ── Two calendar panels side by side ── */
.vd-date-calendars {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.vd-calendar-panel {
  flex: 1 1 260px;
  min-width: 240px;
}

/* Calendar label ("From" / "To") */
.vd-calendar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 8px;
}

/* Month nav */
.vd-calendar-month {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.vd-calendar-month strong {
  font-size: 14px;
}
.vd-calendar-month button {
  background: none;
  border: none;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink);
  display: flex;
  align-items: center;
}
.vd-calendar-month button:hover {
  background: var(--bg-2, #f4f5f7);
}

/* Weekday row */
.vd-calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.vd-calendar-weekdays span {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-2);
  padding: 4px 0;
}

/* Day grid */
.vd-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.vd-calendar-days button {
  aspect-ratio: 1;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  color: var(--ink);
  transition: background .12s, color .12s;
}
.vd-calendar-days button:hover {
  background: var(--brand-pale, rgba(var(--brand-rgb,.3,.4,.9), .1));
}
.vd-calendar-days button.muted {
  color: var(--text-3, #c4c9d4);
}
.vd-calendar-days button.start,
.vd-calendar-days button.end {
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}
.vd-calendar-days button.between {
  background: var(--brand-pale, rgba(37,99,235,.10));
  border-radius: 0;
  color: var(--brand);
}

/* Presets row */
.vd-calendar-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.vd-calendar-presets button {
  flex: 1;
  min-width: 60px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.vd-calendar-presets button:hover {
  border-color: var(--brand);
  background: var(--brand-pale, rgba(37,99,235,.06));
  color: var(--brand);
}

/* ── Filter extras (client + machine select) ── */
.vd-filter-extras {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.vd-filter-field {
  flex: 1;
  min-width: 160px;
}

/* ── Filter footer (reset + search) ── */
.vd-filter-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.vd-filter-footer .vd-btn {
  min-width: 80px;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  /* Filter card — full width di bawah page-head title */
  .vd-dashboard-filter-card {
    max-width: 100%;
    padding: 12px;
  }

  /* Date popover — full width modal */
  .vd-date-popover {
    padding: 12px;
    border-radius: 16px;
    max-height: 85vh;
  }

  /* Satu kalender saja yang tampil di mobile (sembunyikan panel ke-2) */
  .vd-date-calendars {
    flex-direction: column;
    gap: 0;
  }
  .vd-calendar-panel:last-child {
    display: none;
  }

  /* Filter extras stack */
  .vd-filter-extras {
    flex-direction: column;
  }
  .vd-filter-field {
    min-width: 0;
    width: 100%;
  }

  /* Footer buttons full width */
  .vd-filter-footer {
    flex-direction: row;
  }
  .vd-filter-footer .vd-btn {
    flex: 1;
  }
}

/* ═══════════════════════════════════════════════════════════════
   DASHBOARD — top-product dropdown position fix (titik tiga)
   ═══════════════════════════════════════════════════════════════ */
/* Pastikan parent relative dan dropdown tidak keluar layar */
.vd-card-head .vd-user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 140px;
  z-index: 200;
  /* Jangan pernah keluar ke kanan layar */
  max-width: calc(100vw - 24px);
}

@media (max-width: 480px) {
  /* Di layar kecil, dropdown muncul ke kiri icon supaya tidak terpotong */
  .vd-card-head .vd-user-dropdown {
    right: 0;
    left: auto;
  }
}

/* ═══════════════════════════════════════════════════════════════
   MACHINE BOARD — edit/hapus button spacing fix
   ═══════════════════════════════════════════════════════════════ */

/* Tambah gap dan margin-top yang lebih lega */
.vd-board-card-actions {
  display: flex;
  gap: 10px !important;       /* gap lebih besar dari sebelumnya (8px→10px) */
  margin-top: 14px !important; /* jarak dari konten di atas (12px→14px) */
  width: 100%;
}

/* Hapus button — merah */
.vd-board-card-btn--del {
  background: var(--neg) !important;
  color: #fff !important;
  border-color: var(--neg) !important;
}
.vd-board-card-btn--del:hover {
  opacity: .88;
}

/* Edit button — lebih tegas terlihat berbeda */
.vd-board-card-btn:not(.vd-board-card-btn--del) {
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  color: var(--ink) !important;
}

@media (max-width: 768px) {
  .vd-board-card-actions {
    flex-direction: column;
    gap: 8px !important;
    margin-top: 12px !important;
  }
  .vd-board-card-btn {
    width: 100% !important;
    justify-content: center !important;
    font-size: 12px !important;
    padding: 8px 10px !important;
  }
}

.vd-top-product-filter {
  flex: none;
  width: auto;
  margin-left: auto;
}

@media (max-width: 640px) {
  .vd-card-head > .vd-top-product-filter {
    width: auto !important;
    margin-left: auto;
  }

  .vd-top-product-filter .vd-user-dropdown {
    right: 0 !important;
    left: auto !important;
    transform: none !important;
  }
}

/* Dashboard header responsive layout */
.vd-dashboard-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title crumbs"
    "filter filter";
  align-items: end;
  column-gap: 20px;
  row-gap: 16px;
}

.vd-dashboard-head > div:first-child {
  grid-area: title;
  min-width: 0;
}

.vd-dashboard-head > .vd-dashboard-filter-card {
  --vd-dashboard-filter-control-height: 40px;
  grid-area: filter;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(420px, 2fr) auto;
  grid-template-areas:
    "filter-title filter-title filter-title"
    "date extras actions";
  align-items: end;
  gap: 12px;
  order: 0;
  flex: none;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 16px;
}

.vd-dashboard-head > .vd-crumbs {
  grid-area: crumbs;
  align-self: end;
  white-space: nowrap;
}

.vd-dashboard-head .vd-dashboard-filter-title {
  grid-area: filter-title;
  margin: 0;
}

.vd-dashboard-head .vd-dashboard-date-field {
  grid-area: date;
}

.vd-dashboard-head .vd-filter-extras {
  grid-area: extras;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
}

.vd-dashboard-head .vd-filter-field {
  min-width: 0;
  width: 100%;
}

.vd-dashboard-head .vd-filter-footer {
  grid-area: actions;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
  padding-top: 0;
  margin-top: 0;
}

.vd-dashboard-head .vd-date-trigger {
  min-height: var(--vd-dashboard-filter-control-height);
  height: var(--vd-dashboard-filter-control-height);
  padding-top: 6px;
  padding-bottom: 6px;
}

.vd-dashboard-head .vd-search-select-wrapper,
.vd-dashboard-head .vd-vselect,
.vd-dashboard-head .vd-vselect .vs__dropdown-toggle {
  flex: none !important;
  width: 100% !important;
  min-width: 0 !important;
}

.vd-dashboard-head .vd-search-select-wrapper {
  min-height: var(--vd-dashboard-filter-control-height);
}

.vd-dashboard-head .vd-vselect .vs__dropdown-toggle {
  box-sizing: border-box;
  min-height: var(--vd-dashboard-filter-control-height);
  height: auto;
  padding: 4px 30px 4px 6px;
  align-items: center;
}

.vd-dashboard-head .vd-vselect .vs__selected-options {
  min-height: 30px;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  overflow: visible;
  padding-top: 0;
  padding-bottom: 0;
}

.vd-dashboard-head .vd-vselect .vs__search,
.vd-dashboard-head .vd-vselect .vs__search:focus {
  height: 28px;
  padding-top: 0;
  padding-bottom: 0;
  font-size: 13px;
  line-height: 28px;
}

.vd-dashboard-head .vd-vselect.vs--multiple .vs__selected {
  flex: 0 0 auto;
  max-width: none;
  margin: 0;
  padding: 3px 7px;
  font-size: 12px;
  line-height: 16px;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.vd-dashboard-head .vd-vselect.vs--multiple .vs__search {
  flex: 1 0 24px;
  min-width: 24px;
  height: 22px;
  line-height: 22px;
  padding: 0 4px;
}

.vd-dashboard-head .vd-vselect .vs__actions {
  align-items: center;
  min-height: 30px;
  padding-top: 0;
  padding-bottom: 0;
}

.vd-dashboard-head .vd-filter-footer .vd-btn {
  min-height: var(--vd-dashboard-filter-control-height);
  height: var(--vd-dashboard-filter-control-height);
  padding-top: 0;
  padding-bottom: 0;
  align-items: center;
}

.vd-dashboard-head .vd-vselect .vs__clear {
  color: #9ca3af;
  margin-right: 6px;
  padding: 0;
}

.vd-dashboard-head .vd-vselect .vs__clear:hover {
  color: #374151;
}

.vd-dashboard-head .vd-vselect .vs__dropdown-menu {
  position: absolute;
}

@media (max-width: 1120px) {
  .vd-dashboard-head {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "filter"
      "crumbs";
    row-gap: 14px;
    align-items: start;
  }

  .vd-dashboard-head > .vd-dashboard-filter-card {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "filter-title filter-title"
      "date date"
      "extras extras"
      "actions actions";
    max-width: 100%;
  }

  .vd-dashboard-head .vd-filter-footer {
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .vd-dashboard-head > .vd-dashboard-filter-card {
    --vd-dashboard-filter-control-height: 42px;
  }

  .vd-dashboard-head {
    row-gap: 12px;
  }

  .vd-dashboard-head > .vd-dashboard-filter-card {
    grid-template-columns: 1fr;
    grid-template-areas:
      "filter-title"
      "date"
      "extras"
      "actions";
    padding: 12px;
    margin: 0;
  }

  .vd-dashboard-head .vd-filter-extras {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .vd-dashboard-head .vd-vselect .vs__dropdown-toggle {
    min-height: var(--vd-dashboard-filter-control-height);
    height: auto;
  }

  .vd-dashboard-head .vd-filter-footer {
    flex-wrap: nowrap;
  }

  .vd-dashboard-head .vd-filter-footer .vd-btn {
    flex: 1 1 0;
    min-width: 0;
    justify-content: center;
    white-space: nowrap;
  }
}

/* Promotion content table mobile alignment */
@media (max-width: 640px) {
  .vd-promotion-content-page {
    padding-left: 10px;
    padding-right: 10px;
  }

  .vd-promotion-content-page .vd-card-head {
    padding-left: 12px;
    padding-right: 12px;
  }

  .vd-promotion-content-page .vd-t-scroll-wrap {
    width: 100%;
    overflow-x: hidden !important;
  }

  .vd-promotion-content-page .vd-t-scroll-wrap table.vd-t,
  .vd-promotion-content-page table.vd-t {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
  }

  .vd-promotion-content-page table.vd-t th,
  .vd-promotion-content-page table.vd-t td {
    padding: 9px 6px !important;
    font-size: 11px !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .vd-promotion-content-page table.vd-t th:nth-child(1),
  .vd-promotion-content-page table.vd-t td:nth-child(1) {
    width: 10%;
  }

  .vd-promotion-content-page table.vd-t th:nth-child(2),
  .vd-promotion-content-page table.vd-t td:nth-child(2) {
    width: 24%;
  }

  .vd-promotion-content-page table.vd-t th:nth-child(3),
  .vd-promotion-content-page table.vd-t td:nth-child(3) {
    width: 17%;
  }

  .vd-promotion-content-page table.vd-t th:nth-child(4),
  .vd-promotion-content-page table.vd-t td:nth-child(4) {
    width: 22%;
    text-align: center;
  }

  .vd-promotion-content-page table.vd-t th:nth-child(5),
  .vd-promotion-content-page table.vd-t td:nth-child(5) {
    width: 27%;
    text-align: center;
  }

  .vd-promotion-content-page table.vd-t img,
  .vd-promotion-content-page table.vd-t video {
    max-width: 46px !important;
    width: 46px !important;
    height: auto !important;
  }

  .vd-promotion-content-page .vd-action-buttons {
    display: inline-flex !important;
    width: auto !important;
    max-width: none !important;
    gap: 6px !important;
    margin: 0 !important;
  }

  .vd-promotion-content-page .vd-action-buttons .vd-icon-btn {
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
  }
}

/* Machine group table mobile alignment */
@media (max-width: 640px) {
  .vd-machine-group-page {
    padding-left: 10px;
    padding-right: 10px;
  }

  .vd-machine-group-page .vd-card-head {
    padding-left: 12px;
    padding-right: 12px;
  }

  .vd-machine-group-page .vd-card > div[style*="overflow-x"] {
    overflow-x: hidden !important;
  }

  .vd-machine-group-page .vd-t-scroll-wrap {
    width: 100%;
    overflow-x: hidden !important;
  }

  .vd-machine-group-page .vd-t-scroll-wrap table.vd-t,
  .vd-machine-group-page table.vd-t {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
  }

  .vd-machine-group-page table.vd-t th,
  .vd-machine-group-page table.vd-t td {
    padding: 9px 5px !important;
    font-size: 10.5px !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .vd-machine-group-page table.vd-t th:nth-child(1),
  .vd-machine-group-page table.vd-t td:nth-child(1) {
    width: 10%;
  }

  .vd-machine-group-page table.vd-t th:nth-child(2),
  .vd-machine-group-page table.vd-t td:nth-child(2) {
    width: 17%;
  }

  .vd-machine-group-page table.vd-t th:nth-child(3),
  .vd-machine-group-page table.vd-t td:nth-child(3) {
    width: 22%;
  }

  .vd-machine-group-page table.vd-t th:nth-child(4),
  .vd-machine-group-page table.vd-t td:nth-child(4) {
    width: 25%;
  }

  .vd-machine-group-page table.vd-t th:nth-child(5),
  .vd-machine-group-page table.vd-t td:nth-child(5) {
    width: 26%;
    text-align: center;
  }

  .vd-machine-group-page table.vd-t .vd-prim,
  .vd-machine-group-page table.vd-t .vd-stack-list {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .vd-machine-group-page table.vd-t .vd-pill {
    padding: 4px 7px;
    font-size: 9.5px;
    white-space: nowrap;
  }

  .vd-machine-group-page .vd-action-buttons {
    display: inline-flex !important;
    width: auto !important;
    max-width: none !important;
    gap: 6px !important;
    margin: 0 !important;
  }

  .vd-machine-group-page .vd-action-buttons .vd-icon-btn {
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
  }
}

/* Machine account table mobile alignment */
@media (max-width: 640px) {
  .vd-machine-account-page {
    padding-left: 10px;
    padding-right: 10px;
  }

  .vd-machine-account-page .vd-card-head,
  .vd-machine-account-page .vd-card-body {
    padding-left: 12px;
    padding-right: 12px;
  }

  .vd-machine-account-page .vd-t-scroll-wrap {
    width: 100%;
    overflow-x: hidden !important;
  }

  .vd-machine-account-page .vd-t-scroll-wrap table.vd-t,
  .vd-machine-account-page table.vd-t {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
  }

  .vd-machine-account-page table.vd-t th,
  .vd-machine-account-page table.vd-t td {
    padding: 10px 7px !important;
    font-size: 11px !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .vd-machine-account-page table.vd-t th:nth-child(1),
  .vd-machine-account-page table.vd-t td:nth-child(1) {
    width: 12%;
  }

  .vd-machine-account-page table.vd-t th:nth-child(2),
  .vd-machine-account-page table.vd-t td:nth-child(2) {
    width: 60%;
    white-space: nowrap;
  }

  .vd-machine-account-page table.vd-t th:nth-child(3),
  .vd-machine-account-page table.vd-t td:nth-child(3) {
    width: 28%;
    text-align: center;
  }

  .vd-machine-account-page .vd-action-buttons {
    display: inline-flex !important;
    width: auto !important;
    max-width: none !important;
    gap: 6px !important;
    margin: 0 !important;
  }

  .vd-machine-account-page .vd-action-buttons .vd-icon-btn {
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
  }
}

/* Dashboard date range picker: keep end date visible on mobile */
@media (max-width: 768px) {
  .vd-dashboard-head .vd-date-modal {
    align-items: center;
    padding: 10px;
  }

  .vd-dashboard-head .vd-date-modal .vd-date-popover {
    width: 100%;
    max-height: calc(100vh - 28px);
    overflow-y: auto;
  }

  .vd-dashboard-head .vd-date-calendars {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .vd-dashboard-head .vd-calendar-panel {
    flex: none;
    min-width: 0;
    width: 100%;
  }

  .vd-dashboard-head .vd-calendar-panel:last-child {
    display: block;
  }

  .vd-dashboard-head .vd-calendar-presets {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    padding-bottom: 0;
  }
}

/* Dashboard best selling machines table mobile alignment */
@media (max-width: 640px) {
  .vd-dashboard-best-machines-card .vd-t-scroll-wrap {
    width: 100%;
    overflow-x: hidden !important;
  }

  .vd-dashboard-best-machines-card .vd-t-scroll-wrap table.vd-t,
  .vd-dashboard-best-machines-card table.vd-t {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed;
  }

  .vd-dashboard-best-machines-card table.vd-t th,
  .vd-dashboard-best-machines-card table.vd-t td {
    padding: 9px 6px !important;
    font-size: 10.5px !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .vd-dashboard-best-machines-card table.vd-t th:nth-child(1),
  .vd-dashboard-best-machines-card table.vd-t td:nth-child(1) {
    width: 36%;
  }

  .vd-dashboard-best-machines-card table.vd-t th:nth-child(2),
  .vd-dashboard-best-machines-card table.vd-t td:nth-child(2) {
    width: 17%;
    text-align: center;
  }

  .vd-dashboard-best-machines-card table.vd-t th:nth-child(3),
  .vd-dashboard-best-machines-card table.vd-t td:nth-child(3) {
    width: 24%;
    text-align: right;
  }

  .vd-dashboard-best-machines-card table.vd-t th:nth-child(4),
  .vd-dashboard-best-machines-card table.vd-t td:nth-child(4) {
    width: 23%;
    text-align: right;
  }

  .vd-dashboard-best-machines-card table.vd-t .vd-prim,
  .vd-dashboard-best-machines-card table.vd-t .vd-sec {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
.log-total{display:flex;align-items:center;gap:10px;padding:10px 14px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink-3);font-size:12px}
.log-total>i{display:grid;place-items:center;width:34px;height:34px;border-radius:9px;background:#eef6ff;color:var(--accent)}
.log-total strong{display:block;color:var(--ink);font-size:16px}
.log-table{min-width:980px}
.log-code{display:inline-flex;padding:5px 8px;border-radius:6px;background:var(--surface-2);color:var(--accent);font-size:11px;font-weight:700}
.log-date{display:flex;align-items:center;gap:7px;white-space:nowrap}
.log-date i{color:var(--accent)}
.log-download{color:var(--accent)}
.machine-log-filter-card .vd-list-filter-row{display:grid;grid-template-columns:minmax(240px,1fr) minmax(320px,1.2fr) auto;align-items:end;gap:14px}
.machine-log-filter-field{display:flex;min-width:0;flex-direction:column;gap:7px}
.machine-log-machine-filter{min-width:0}
.machine-log-filter-card.is-date-open{z-index:10070!important;overflow:visible}
.machine-log-date-field{min-width:0}
.machine-log-filter-label{display:block;margin:0;color:var(--ink-4);font-size:11px;font-weight:600;line-height:16px}
.machine-log-filter-card .vd-search-select-wrapper .vs__dropdown-toggle,.machine-log-date-field .vd-date-trigger{min-height:48px}
.machine-log-date-field .vd-date-trigger{width:100%;justify-content:flex-start}
.machine-log-date-field .vd-date-trigger span{flex:1;text-align:left}
.machine-log-date-field .vd-date-trigger i:last-child{margin-left:auto;font-size:11px}
.machine-log-filter-card .vd-list-filter-actions{align-items:center;height:48px}
.machine-log-filter-card .vd-list-filter-actions .vd-btn{height:48px;justify-content:center;white-space:nowrap}
.machine-log-filter-card .vd-date-modal{z-index:10060;background:rgba(15,23,42,.32);backdrop-filter:blur(9px)}
.machine-log-filter-card .vd-calendar-days button.start,.machine-log-filter-card .vd-calendar-days button.end{background:#2563eb;color:#fff;font-weight:800;box-shadow:0 6px 14px rgba(37,99,235,.24)}
.machine-log-filter-card .vd-calendar-days button.between{background:rgba(37,99,235,.12);color:#1d4ed8}
.log-actions{display:flex;align-items:center;gap:6px}.log-detail-modal{position:fixed;inset:0;z-index:11000;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(15,23,42,.5);backdrop-filter:blur(7px)}.log-detail-card{display:flex;width:min(1040px,100%);max-height:min(820px,90vh);overflow:hidden;flex-direction:column;border:1px solid var(--line);border-radius:16px;background:var(--surface);box-shadow:0 24px 70px rgba(15,23,42,.28)}.log-detail-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:18px 20px;border-bottom:1px solid var(--line)}.log-detail-head h2{margin:4px 0;color:var(--ink);font-size:18px}.log-detail-head p{margin:0;color:var(--ink-4);font-size:12px}.log-detail-kicker{color:var(--accent);font-size:10px;font-weight:800;letter-spacing:.08em}.log-detail-loading{display:flex;min-height:360px;align-items:center;justify-content:center;flex-direction:column;gap:12px;color:var(--ink-4)}.log-detail-loading i{color:var(--accent);font-size:24px}.log-detail-notice{padding:10px 18px;border-bottom:1px solid #fde7b2;background:#fff8e7;color:#8a5a00;font-size:12px}.log-detail-notice i{margin-right:6px}.log-detail-content{min-height:320px;margin:0;padding:18px;overflow:auto;flex:1;background:#111827;color:#d7e2f2;font:11.5px/1.65 Consolas,"Courier New",monospace}
.log-line{display:flex;gap:14px;padding:1px 6px;border-radius:4px}
.log-line:hover{background:rgba(255,255,255,.06)}
.log-line-no{flex:0 0 auto;min-width:34px;color:#4b5b73;text-align:right;user-select:none}
.log-line-text{flex:1;min-width:0;white-space:pre-wrap;overflow-wrap:anywhere}
.log-detail-content--empty{display:flex;align-items:center;justify-content:center;gap:8px;color:#6b7a90;font-style:italic}
.json-key{color:#7dd3fc}
.json-string{color:#fbbf85}
.json-number{color:#c4b5fd}
.json-bool{color:#f472b6}
.json-null{color:#f472b6;font-style:italic}.log-detail-footer{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 18px;border-top:1px solid var(--line);color:var(--ink-4);font-size:11px}.log-detail-footer>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.log-detail-footer .vd-btn{flex:none}
.log-detail-back{display:inline-flex;align-items:center;gap:7px;margin-bottom:9px;color:var(--accent);font-size:12px;font-weight:700;text-decoration:none}.machine-log-detail-page .vd-page-head h1{margin-top:0}.log-detail-summary{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:0;margin-bottom:14px;overflow:hidden}.log-detail-summary>div{display:flex;align-items:flex-start;gap:12px;min-height:92px;padding:18px;border-right:1px solid var(--line)}.log-detail-summary>div:last-child{border-right:0}.log-detail-summary span,.log-detail-summary strong,.log-detail-summary small{display:block}.log-detail-summary span{margin-bottom:8px;color:var(--ink-4);font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.05em}.log-detail-summary strong{overflow:hidden;color:var(--ink);font-size:14px;text-overflow:ellipsis;white-space:nowrap}.log-detail-summary small{margin-top:4px;color:var(--ink-4);font-size:11px}.log-detail-summary .log-detail-summary-icon{display:grid;flex:0 0 auto;width:34px;height:34px;place-items:center;border-radius:9px;background:#eef6ff;color:var(--accent);font-size:13px;margin-bottom:0;text-transform:none;letter-spacing:normal}
.log-detail-summary .log-detail-summary-icon i{display:block}.log-detail-note{display:flex;align-items:center;gap:8px;margin:-4px 0 14px;padding:10px 16px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink-3);font-size:12px}.log-detail-note i{color:var(--accent)}.log-viewer-card{overflow:hidden}.log-viewer-head{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:15px 18px;border-bottom:1px solid var(--line)}.log-viewer-head>div{display:flex;align-items:center;gap:11px}.log-viewer-head>div>i{display:grid;width:36px;height:36px;place-items:center;border-radius:9px;background:#eef6ff;color:var(--accent)}.log-viewer-head strong{display:block;color:var(--ink);font-size:13px}.log-viewer-meta{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.machine-log-detail-page .log-detail-content{min-height:480px;max-height:calc(100vh - 360px)}
.log-detail-frame{display:block;width:100%;height:max(480px,calc(100vh - 360px));border:0;background:#fff}
@media(max-width:640px){
  .machine-log-page .vd-page-head{align-items:stretch}
  .log-total{align-self:flex-start}
  .machine-log-filter-card .vd-list-filter-row{grid-template-columns:1fr}
  .machine-log-filter-card .vd-list-filter-actions{width:100%}
  .machine-log-filter-card .vd-list-filter-actions .vd-btn{flex:1}
  .log-detail-modal{padding:10px}.log-detail-card{max-height:94vh;border-radius:12px}.log-detail-head{padding:14px}.log-detail-content{min-height:260px;padding:13px;font-size:10.5px}.log-detail-footer{align-items:stretch;flex-direction:column}.log-detail-footer>span{white-space:normal}.log-detail-footer .vd-btn{justify-content:center}
  .log-detail-summary{grid-template-columns:1fr 1fr}.log-detail-summary>div{border-bottom:1px solid var(--line)}.log-detail-summary>div:nth-child(2){border-right:0}.log-detail-summary>div:nth-child(n+3){border-bottom:0}.log-viewer-head{flex-direction:column;align-items:stretch}.log-viewer-meta{justify-content:flex-start}.machine-log-detail-page .log-detail-content{min-height:360px;max-height:none}
}
@media(min-width:641px) and (max-width:900px){
  .machine-log-filter-card .vd-list-filter-row{grid-template-columns:1fr 1fr}
  .machine-log-filter-card .vd-list-filter-actions{grid-column:1/-1;justify-content:flex-end}
}

/* Match the dashboard date picker: keep focus without dimming the page. */
body.vd-date-picker-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10050;
  background: rgba(15, 23, 42, 0.04);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  pointer-events: none;
}

/* Keep non-date filter controls beneath the date picker backdrop on every date-filter page. */
body.vd-date-picker-open .vd-dashboard-filter-card .vd-search-select-wrapper,
body.vd-date-picker-open .vd-dashboard-filter-card .vd-select,
body.vd-date-picker-open .vd-transaction-filter-card .vd-search-select-wrapper,
body.vd-date-picker-open .vd-transaction-filter-card .vd-select,
body.vd-date-picker-open .vd-machine-content-filter-card .vd-search-select-wrapper,
body.vd-date-picker-open .vd-machine-content-filter-card .vd-select {
  position: relative;
  z-index: 1 !important;
}
