/* =====================================================================================================
   The consolidated menu, the one period bar, smart search and tables-as-cards (js/vknav.js, vkperiod.js, vkfind.js) — the same look and
   way as the group portal (gomok-supermarket group/css/gnav.css), on this POS's colours (--panel / --line / --pink via css/ds.css tokens).
   The till (pos) and the kitchen screen (kds) keep their layout: the side menu keeps its width, only its buttons changed.
   ===================================================================================================== */

/* ---------- the rail (computer): Home, Search, the parents ---------- */
body.vn-on .nav nav .vn-find { color: var(--muted); }
body.vn-on .nav nav .vn-find kbd, .vn-findbar kbd { margin-left: auto; font: 600 .68rem/1 var(--ds-font, inherit); padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); color: var(--muted); background: var(--panel2); }
.vn-top { display: none; }

/* ---------- Home ---------- */
.vn-findbar { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; margin: 0 0 16px; padding: 10px 16px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--panel2); color: var(--muted); font: inherit; text-align: left; transition: border-color var(--ds-dur-1, .12s); }
.vn-findbar:hover { border-color: var(--pink); }
.vn-findbar > span:first-child { font-size: 1.2rem; }
.vn-tip { margin-top: 14px; }

/* ---------- a parent's pop-up: its pages as boxes, a few tabs when there are many ---------- */
.modal.vn-modal { max-width: 920px; }
.vn-sub { margin: -4px 0 0; }
.vn-filter { min-height: 46px; }
.vn-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.vn-tab { position: relative; min-height: 40px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-weight: 600; white-space: nowrap; }
.vn-tab.on { background: var(--ds-primary-soft, var(--panel3)); border-color: var(--pink); color: var(--text); box-shadow: inset 0 0 0 1px var(--pink); }
.vn-tab .badge, .vn-act .badge, .vn-f .badge { font-style: normal; background: var(--pink); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; padding: 1px 7px; }
.vn-tab .badge { margin-left: 6px; }
.vn-line { margin: 0 0 10px; color: var(--muted); font-size: .85rem; }
.vn-acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 10px; }
.vn-act, .vf-r { position: relative; display: flex; align-items: center; gap: 12px; min-height: 66px; padding: 10px 14px; text-align: left; border-radius: 16px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font: inherit; min-width: 0; width: 100%; transition: border-color var(--ds-dur-1, .12s), transform var(--ds-dur-1, .12s); }
.vn-act:hover, .vf-r:hover, .vf-r.on { border-color: var(--pink); transform: translateY(-1px); }
.vn-act.on { border-color: var(--pink); background: var(--ds-primary-soft, var(--panel3)); }
.vn-ic { flex: none; display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; font-size: 1.3rem;
  background: linear-gradient(145deg, color-mix(in srgb, var(--pink) 14%, var(--panel)), color-mix(in srgb, var(--pink) 28%, var(--panel))); }
.vn-tx { flex: 1; min-width: 0; display: grid; gap: 2px; } .vn-tx b { font-size: .97rem; line-height: 1.2; } .vn-tx small { font-size: .8rem; line-height: 1.3; }
.vn-act .badge { flex: none; }
.vn-me { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.vn-more h4 { margin-top: 18px; }

/* ---------- the slim path line (instead of the row of section chips) ---------- */
.vn-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 24px 0; font-size: .85rem; color: var(--muted); }
.vn-crumb button { background: none; border: 0; padding: 4px 8px; border-radius: 8px; color: var(--muted); font-weight: 600; }
.vn-crumb button:hover { background: var(--panel2); color: var(--text); }
.vn-crumb b { color: var(--text); font-weight: 600; padding: 4px 2px; }

/* ---------- smart search ---------- */
.vf-pop #vfQ { min-height: 50px; font-size: 1.05rem; }
#vfRes { display: grid; gap: 8px; max-height: min(60vh, 560px); overflow-y: auto; padding: 2px; }
#vfRes h4 { margin: 8px 0 0; }
.vf-r { min-height: 56px; }

/* ---------- the one period bar ---------- */
.vp-bar { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.vp-cur { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 5px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); text-align: left; min-width: 0; }
.vp-cur > span:first-child { font-size: 1.2rem; } .vp-cur .tx { min-width: 0; } .vp-cur b { display: block; font-size: .95rem; } .vp-cur small { display: block; font-size: .76rem; }
.vp-cur .vp-chg { font-size: .78rem; font-weight: 700; color: var(--pink); margin-left: 6px; }
.vp-cur:hover { border-color: var(--pink); }
.vp-quick { display: flex; flex-wrap: wrap; gap: 6px; } .vp-q { min-height: 40px; }
.vp-cmp { flex-basis: 100%; font-size: .8rem; }
.vp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 46%), 1fr)); gap: 8px; }
.vp-t { display: grid; gap: 2px; text-align: left; min-height: 60px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); }
.vp-t b { font-size: .95rem; } .vp-t small { font-size: .75rem; } .vp-t:hover { border-color: var(--pink); }
.vp-t.on { border-color: var(--pink); box-shadow: inset 0 0 0 1px var(--pink); background: var(--ds-primary-soft, var(--panel3)); }
.vp-cust { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; } .vp-cust label { display: grid; gap: 4px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.vp-cust input { width: 100%; min-height: 46px; }
.vp-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; } .vp-seg button { min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-weight: 600; }
.vp-seg button.on { background: linear-gradient(135deg, var(--pink), var(--violet)); color: #fff; border-color: transparent; }
@media print { .vp-bar, .vn-crumb, #vnFoot { display: none !important; } }

/* ---------- clean tables on a computer: roomy rows, header that stays, a soft hover, no zebra ---------- */
.main .grid-table thead th { position: sticky; top: 0; z-index: 1; background: var(--panel); }
.main .grid-table tbody tr { transition: background var(--ds-dur-1, .12s); }
.main .grid-table tbody tr:hover td { background: color-mix(in srgb, var(--pink) 6%, transparent); }

/* ---------- phone and small tablet (≤ 900 px): a slim top bar + the sticky footer ---------- */
#vnFoot { display: none; }
@media (max-width: 900px) {
  body.vn-on .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  body.vn-on .nav { flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 8px; padding: 6px 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  body.vn-on .nav nav, body.vn-on .nav .nav-foot { display: none; }
  body.vn-on .nav .brand { flex: 1; min-width: 0; padding: 0; } body.vn-on .nav .brand b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.vn-on .vn-top { display: flex; gap: 6px; } body.vn-on .vn-top .btn { min-width: 44px; min-height: 44px; font-size: 1.15rem; }
  body.vn-on.vn-foot .vn-top .vn-menu { display: none; }
  body.vn-on.vn-foot #vnFoot { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--panel) 94%, transparent); border-top: 1px solid var(--line);
    box-shadow: 0 -8px 24px -12px rgb(0 0 0 / .35); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
  body.vn-on.vn-foot { --pop-bottom: 66px; }
  body.vn-on.vn-foot .main { padding-bottom: calc(70px + env(safe-area-inset-bottom)); scroll-padding-bottom: 80px; }
  body.vn-on.vn-foot #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  body.vn-on.vn-foot .mem-bar { bottom: calc(80px + env(safe-area-inset-bottom)); }
  body.vn-on:has(#ckKiosk) #vnFoot, body.tv-mode #vnFoot { display: none !important; }
  .vn-crumb { padding: 8px 16px 0; }
  .vn-findbar kbd { display: none; }
  .vp-cust { grid-template-columns: 1fr 1fr; } .vp-cust .btn { grid-column: 1 / -1; }
}
#vnFoot .vn-f { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px; border: 0; background: none; color: var(--muted); border-radius: 14px; padding: 4px 2px; font: inherit; min-width: 0; }
#vnFoot .vn-f .ic { font-size: 1.3rem; line-height: 1; display: inline-grid; place-items: center; width: 48px; height: 30px; border-radius: 999px; transition: background var(--ds-dur-1, .12s); }
#vnFoot .vn-f .lb { font-size: .7rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#vnFoot .vn-f.on { color: var(--pink); } #vnFoot .vn-f.on .ic { background: var(--ds-primary-soft, var(--panel3)); }
#vnFoot .vn-f .badge { position: absolute; top: 2px; left: calc(50% + 8px); font-size: .64rem; min-width: 17px; padding: 1px 5px; }
@media (max-width: 640px) {
  .vn-acts { grid-template-columns: 1fr; gap: 8px; } .vn-act { min-height: 58px; padding: 9px 12px; } .vn-ic { width: 38px; height: 38px; }
  .vn-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .vp-bar { width: 100%; } .vp-cur { flex: 1 1 100%; } .vp-quick { width: 100%; } .vp-q { flex: 1 1 0; padding: 6px 2px; font-size: .78rem; }
  .vp-seg { grid-template-columns: 1fr; }
}

/* ---------- on a phone a table becomes cards: the first cell is the title, the rest "column · value" lines ---------- */
@media (max-width: 640px) {
  body.vp-cards .main table.vp-card, body.vp-cards .main table.vp-card tbody, body.vp-cards .main table.vp-card tfoot { display: block; width: 100%; }
  body.vp-cards .main table.vp-card thead { display: none; }
  body.vp-cards .main table.vp-card tbody, body.vp-cards .main table.vp-card tfoot { display: grid; gap: 8px; }
  body.vp-cards .main table.vp-card tr { display: block; border: 1px solid var(--line); border-radius: 16px; background: var(--panel2); padding: 8px 2px 6px; }
  body.vp-cards .main table.vp-card td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 12px; border: 0; white-space: normal; text-align: right; font-size: .9rem; }
  body.vp-cards .main table.vp-card td::before { content: attr(data-l); color: var(--muted); font-size: .78rem; text-align: left; flex: none; max-width: 48%; }
  body.vp-cards .main table.vp-card td:first-child { font-weight: 700; font-size: 1rem; justify-content: flex-start; text-align: left; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
  body.vp-cards .main table.vp-card td:first-child::before { content: none; }
  body.vp-cards .main table.vp-card td:empty { display: none; }
  body.vp-cards .main table.vp-card tbody tr:hover td { background: transparent; }
}
/* [hidden] must win over the boxes' own display */
.vn-act[hidden], .vn-tabs[hidden], .vn-none[hidden], .vn-sec[hidden], .vp-cust[hidden], .vf-r[hidden] { display: none !important; }
