/* ==========================================================================
   New sale (POS) — "counter ticket" layout. Uses theme.css tokens, works in
   both Day and Night themes.
   ========================================================================== */
#page-billing kbd {
  font: 600 10.5px/1 var(--sans);
  padding: 3px 6px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--muted);
  letter-spacing: .2px;
}

.pos2-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.pos2-head h1 { margin: 0; }
.pos2-head .sub { margin: 4px 0 0; }
.pos2-head-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pos2-head-meta .live-clock { margin: 0 !important; }
.pos2-head-meta .btn { display: inline-flex; align-items: center; gap: 7px; }
.pos2-head-meta .btn svg { width: 15px; height: 15px; }
.pos2-head-meta .bill-no-tag { font-size: 13px; padding: 6px 12px; }

/* ---------- two columns ---------- */
.pos-container.pos2 {
  display: grid !important;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr);
  gap: 18px;
  align-items: start;
}
.pos2-left, .pos2-ticket {
  padding: 18px !important;
  border-radius: var(--r-lg) !important;
  background: var(--surface) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-2) !important;
}
.pos2-left { display: flex; flex-direction: column; gap: 16px; }
.pos2-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px; color: var(--muted);
}
.pos2-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--accent); font: 600 12.5px var(--sans);
}
.pos2-link:hover { text-decoration: underline; }

/* ---------- smart bar ---------- */
.pos2-smart { position: relative; }
.pos2-smart-ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }
.pos2-smart-ic svg { width: 20px; height: 20px; }
#page-billing #pos-search {
  width: 100%;
  height: 56px;
  padding: 0 84px 0 48px !important;
  font-size: 16.5px !important;
  font-weight: 600;
  border-radius: 14px !important;
  background: var(--bg-2) !important;
  border: 1.5px solid var(--line-strong) !important;
  color: var(--text) !important;
}
#page-billing #pos-search:focus { border-color: var(--accent) !important; box-shadow: var(--focus) !important; outline: none; }
.pos2-smart-kbd { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.pos2-hint { font-size: 12.5px; color: var(--muted); margin-top: -8px; }
.pos2-hint b { color: var(--text-2); font-weight: 700; }

.pos2-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: 0 18px 40px -12px rgba(0,0,0,.55); padding: 6px; max-height: 340px; overflow: auto;
}
.pos2-sg {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--text);
}
.pos2-sg small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.pos2-sg .pr { font-weight: 700; font-variant-numeric: tabular-nums; }
.pos2-sg.on, .pos2-sg:hover { background: var(--accent-tint); }
.pos2-sg.on .pr { color: var(--accent); }
.pos2-sg .q { color: var(--accent); font-weight: 800; margin-right: 6px; }
.pos2-sg-head { padding: 6px 12px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--dim); }

/* ---------- quick picks ---------- */
.pos2-block { display: flex; flex-direction: column; gap: 10px; }
.pos2-quick { display: flex; flex-wrap: wrap; gap: 8px; }
.pos2-qbtn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 12px; border-radius: 999px; cursor: pointer;
  background: var(--bg-2); border: 1px solid var(--line-strong); color: var(--text);
  font: 600 13px var(--sans); transition: border-color .15s, background .15s;
}
.pos2-qbtn:hover { border-color: var(--accent-line); background: var(--accent-tint); }
.pos2-qbtn span { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.pos2-qbtn .k { color: var(--dim); font-size: 11px; border: 1px solid var(--line-strong); border-radius: 4px; padding: 1px 4px; }

/* ---------- catalog ---------- */
.pos2-catalog-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.pos2-catalog .catalog-tabs { margin: 0 !important; display: flex; gap: 6px; }
.pos2-catalog .catalog-tabs .tab { padding: 6px 12px !important; font-size: 12.5px !important; border-radius: 999px !important; }
#page-billing #pos-item-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
  gap: 10px !important;
  max-height: 460px !important; min-height: 120px; overflow: auto; padding: 2px;
}
#page-billing .item-tile {
  display: flex; flex-direction: column; gap: 6px; padding: 12px 13px !important; min-height: 92px;
  cursor: pointer; position: relative; transition: border-color .15s, transform .1s;
}
#page-billing .item-tile:active { transform: scale(.98) !important; }
#page-billing .item-tile .nm { font-weight: 700; font-size: 13px; line-height: 1.3; color: var(--text); }
#page-billing .item-tile .pr { font-weight: 800; font-size: 15px; color: var(--accent); margin-top: auto; font-variant-numeric: tabular-nums; }
#page-billing .item-tile .st { font-size: 11px; color: var(--muted); }
#page-billing .item-tile .hot {
  display: inline-block; margin-left: 6px; font-size: 10px; font-weight: 700; color: var(--pos);
  background: var(--pos-tint); border-radius: 999px; padding: 1px 7px; vertical-align: 1px;
}
#page-billing .item-tile .incart {
  position: absolute; top: 8px; right: 8px; min-width: 22px; height: 22px; border-radius: 11px;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 12px;
  display: flex; align-items: center; justify-content: center; padding: 0 6px;
}
#page-billing .item-tile.flash { animation: pos2flash .45s ease; }
@keyframes pos2flash { 0% { box-shadow: 0 0 0 0 var(--accent-line); } 100% { box-shadow: 0 0 0 10px transparent; } }

/* ---------- ticket ---------- */
.pos2-ticket { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 12px; }
.pos2-cust { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; border-bottom: 1px dashed var(--line-strong); }
.pos2-cust-top { display: flex; justify-content: space-between; align-items: center; }
.pos2-cust-fields { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; }
.pos2-cust-fields input { height: 42px; font-weight: 600; }
#page-billing #cart-customer-phone { font-variant-numeric: tabular-nums; letter-spacing: .4px; }
#cart-customer-picker-field label { font-size: 11.5px; color: var(--warn); }
.pos2-warn { background: var(--neg-tint) !important; border: 1px solid var(--neg-line) !important; color: var(--neg) !important;
  border-radius: 10px !important; padding: 9px 11px !important; font-size: 12.5px !important; font-weight: 600 !important; margin: 0 !important; }

.pos2-insight {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  font-size: 12px; color: var(--muted);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
}
.pos2-insight b { color: var(--text); font-weight: 700; }
.pos2-insight .tag { border-radius: 999px; padding: 2px 8px; background: var(--steel-tint); color: var(--steel); font-weight: 700; font-size: 11px; }
.pos2-insight .tag.due { background: var(--neg-tint); color: var(--neg); }
.pos2-insight .pos2-repeat {
  margin-left: auto; border: 1px solid var(--accent-line); background: var(--accent-tint); color: var(--accent);
  border-radius: 8px; padding: 5px 9px; font: 700 12px var(--sans); cursor: pointer;
}

.pos2-lines-head {
  display: grid; grid-template-columns: 1fr 104px 76px 26px; gap: 8px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .7px; color: var(--dim); padding: 0 2px;
}
.pos2-lines-head span:nth-child(2) { text-align: center; }
.pos2-lines-head span:nth-child(3) { text-align: right; }
#page-billing #cart-lines { max-height: 300px !important; min-height: 70px; overflow: auto; margin: -4px 0 0; }
#page-billing .cart-empty { text-align: center; padding: 26px 10px; color: var(--muted); font-size: 13px; }
#page-billing .cart-empty b { display: block; color: var(--text-2); font-size: 14px; margin-bottom: 4px; }
.pos2-line {
  display: grid; grid-template-columns: 1fr 104px 76px 26px; gap: 8px; align-items: center;
  padding: 9px 2px; border-bottom: 1px solid var(--line);
}
.pos2-line .nm { font-weight: 700; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos2-line .rate { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; white-space: nowrap; overflow: hidden; }
.pos2-line .rate button { background: none; border: 0; padding: 0; color: var(--dim); cursor: pointer; font: 600 11px var(--sans); }
.pos2-line .rate button:hover { color: var(--accent); }
.pos2-line .amt { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text); font-size: 13.5px; }
.pos2-line .x { background: none; border: 0; color: var(--dim); cursor: pointer; font-size: 15px; padding: 2px; border-radius: 6px; }
.pos2-line .x:hover { color: var(--neg); background: var(--neg-tint); }
.pos2-line .pos-stepper { display: grid; grid-template-columns: 28px 1fr 28px; height: 30px; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.pos2-line .pos-stepper-btn { border: 0 !important; border-radius: 0 !important; padding: 0 !important; height: 100%; font-size: 15px; background: var(--surface-2) !important; }
.pos2-line .pos-stepper-input { border: 0 !important; border-radius: 0 !important; height: 100%; text-align: center; padding: 0 !important; font-weight: 700; background: var(--bg-2) !important; width: 100%; -moz-appearance: textfield; }
.pos2-line .pos-stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.pos2-line.added { animation: pos2in .35s ease; }
@keyframes pos2in { from { background: var(--accent-tint); } to { background: transparent; } }
#page-billing .cart-line-details-wrap { padding: 4px 0 8px; }

.pos2-sums { display: flex; flex-direction: column; gap: 7px; padding-top: 4px; }
.pos2-sum { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--text-2); }
.pos2-sum .num { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text) !important; font-size: 13.5px !important; }
.pos2-disc-ctl { display: flex; gap: 5px; align-items: center; }
.pos2-disc-ctl .fee-chip { padding: 3px 8px !important; font-size: 11.5px !important; margin: 0 !important; }
#page-billing #cart-discount-input { width: 64px; height: 30px; padding: 0 8px !important; text-align: right; font-weight: 700; }
.pos2-fee { color: var(--warn) !important; font-weight: 700; }
.pos2-total {
  display: flex !important; justify-content: space-between; align-items: baseline;
  margin: 6px 0 0 !important; padding: 12px 14px !important; border-radius: 12px !important;
  background: var(--bg-2) !important; border: 1px solid var(--line-strong) !important;
}
.pos2-total > span:first-child { font-weight: 800; font-size: 14px; color: var(--text); text-transform: uppercase; letter-spacing: .6px; }
#page-billing #cart-total { font-size: 32px !important; font-weight: 800 !important; color: var(--pos) !important; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }

.pos2-paylabel { display: flex; align-items: center; justify-content: space-between; margin-top: 2px; }
.pos2-usual { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--steel); font-size: 11.5px; }
.fintech-pay-grid.pos2-pay { display: grid !important; grid-template-columns: repeat(3, 1fr) !important; gap: 7px !important; margin: 0 !important; }
.pos2-pay .fintech-pay-btn, .pos2-pay .pay-opt {
  display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 10px 6px !important; min-height: 62px; border-radius: 11px !important;
  font: 700 12.5px var(--sans) !important; color: var(--text-2) !important; text-align: center;
}
.pos2-pay svg { width: 19px; height: 19px; color: var(--muted); }
.pos2-pay .active svg { color: var(--accent); }
.pos2-pay .active { color: var(--text) !important; }

.pos2-note {
  display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--text-2); line-height: 1.45;
  background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 12px; padding: 11px 13px;
}
.pos2-note b { color: var(--text); font-size: 13px; display: flex; justify-content: space-between; }
.pos2-note.warn { border-color: var(--accent-line); background: var(--accent-tint); }
#cashfree-fee-badge { color: var(--steel); font-weight: 700; }
.pos2-two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pos2-two label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 600; }
.pos2-two input { height: 38px; font-weight: 700; font-variant-numeric: tabular-nums; }

.pos2-cash { display: flex; flex-direction: column; gap: 8px; background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 12px; padding: 12px 13px; }
.pos2-cash-top { display: flex; justify-content: space-between; align-items: center; }
.pos2-cash-top label { font-size: 12px; font-weight: 700; color: var(--muted); }
#page-billing #cash-received-inp { height: 44px; font-size: 18px !important; font-weight: 800; font-variant-numeric: tabular-nums; }
.pos2-cashchips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 !important; }
.pos2-cashchips .fee-chip { flex: 1; min-width: 56px; margin: 0 !important; padding: 7px 6px !important; font-weight: 700 !important; }
#page-billing .cash-change-banner {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--pos-tint) !important; border: 1px solid var(--pos-line) !important; border-radius: 10px !important; padding: 9px 12px !important; margin: 0 !important;
}
#cash-change-label { font-size: 12.5px; font-weight: 700; color: var(--pos); }
#cash-change-val { font-size: 19px; font-weight: 800; color: var(--pos); font-variant-numeric: tabular-nums; }

.pos2-more summary { cursor: pointer; font-size: 12.5px; color: var(--muted); font-weight: 600; list-style: none; }
.pos2-more summary::before { content: '+ '; }
.pos2-more[open] summary::before { content: '− '; }
.pos2-more input { margin-top: 8px; height: 38px; }

.pos2-actions { display: flex; flex-direction: column; gap: 8px; }
#page-billing .pos2-charge {
  height: 56px; display: flex !important; align-items: center; justify-content: center; gap: 10px;
  font-size: 16px !important; font-weight: 800 !important; border-radius: 14px !important;
  background: var(--accent) !important; color: var(--accent-ink) !important; border: 0 !important;
  box-shadow: 0 10px 26px -10px var(--accent-line) !important;
}
#page-billing .pos2-charge svg { width: 20px; height: 20px; }
#page-billing .pos2-charge kbd { background: rgba(0,0,0,.12); border-color: rgba(0,0,0,.15); color: var(--accent-ink); }
#page-billing .pos2-charge:disabled { opacity: .45; box-shadow: none !important; cursor: not-allowed; }
.pos2-actions-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.pos2-actions-row .btn { height: 40px; font-size: 13px !important; font-weight: 700 !important; }
.pos2-clear { color: var(--neg) !important; }
.pos2-keys { font-size: 11px; color: var(--dim); text-align: center; display: flex; gap: 6px; justify-content: center; align-items: center; flex-wrap: wrap; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .pos-container.pos2 { grid-template-columns: 1fr; }
  .pos2-ticket { position: static; }
}
@media (max-width: 600px) {
  .pos2-left, .pos2-ticket { padding: 14px !important; }
  #page-billing #pos-search { height: 50px; font-size: 15px !important; padding-right: 16px !important; }
  .pos2-smart-kbd, .pos2-keys, .pos2-hint { display: none; }
  #page-billing #pos-item-grid { grid-template-columns: repeat(2, 1fr) !important; max-height: 340px !important; }
  .pos2-lines-head, .pos2-line { grid-template-columns: 1fr 96px 64px 24px; }
  .fintech-pay-grid.pos2-pay { grid-template-columns: repeat(3, 1fr) !important; }
  .pos2-head-meta .btn kbd { display: none; }
  .pos2-line .rate [data-toggle-details] { display: none; }
  .pos2-line .rate { gap: 6px; font-size: 11px; }
}

/* elements toggled with the hidden attribute */
#page-billing [hidden] { display: none !important; }
