:root {
  --pos-primary: #2f5d62;
  --pos-primary-dark: #1f3f42;
  --pos-accent: #d98b3f;
  --pos-bg: #f4f6f7;
  --pos-surface: #ffffff;
  --pos-border: #e2e6e7;
  --pos-text: #1f2a2c;
  --pos-muted: #6b7a7c;
  --pos-danger: #c0453a;
  --pos-success: #3f8f5f;
  --radius: 10px;
}

* { box-sizing: border-box; }

body.pos-body {
  background: var(--pos-bg);
  color: var(--pos-text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.pos-navbar {
  background: linear-gradient(90deg, var(--pos-primary-dark), var(--pos-primary));
}

.pos-main { padding: 1.25rem; }

/* Bootstrap's .container-fluid adds its own left/right gutter on top of
   whatever padding wraps it — for the three page-content containers here
   (Home/DropOff/Menu, all direct children of .pos-main) that stacks with
   the padding above and makes the sides wider than the top/bottom. Zeroed
   out so .pos-main's own padding is the only margin on any side. Scoped to
   .pos-main so the navbar's own .container-fluid (which needs its normal
   gutter) is untouched. */
.pos-main > .container-fluid { padding-left: 0; padding-right: 0; }

/* ---- Cards / surfaces ---- */
.pos-card {
  background: var(--pos-surface);
  border: 1px solid var(--pos-border);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}

.pos-card-header {
  padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--pos-border);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pos-card-body { padding: 1.1rem; }

/* ---- Ticket column fills available height, cart scrolls internally ---- */
.ticket-column {
  /* navbar (~56px) + main's top+bottom padding (1.25rem each = 40px total) — adjust if you change either */
  height: calc(100vh - 100px);
  min-height: 420px;
}
.ticket-card {
  flex: 1 1 auto;
  min-height: 0; /* required so the flex child can actually shrink and scroll */
  display: flex;
  flex-direction: column;
}
.ticket-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* ---- Left column: Customer card keeps its natural size, Tickets card
   grows to fill whatever height is left, scrolling internally ---- */
.left-column {
  height: calc(100vh - 100px);
  min-height: 420px;
}
.tickets-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.tickets-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* ---- Tile grid (categories / items / sub-items / modifiers) ---- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: .5rem;
  max-height: 320px;
  overflow-y: auto;
  padding: .25rem;
}

/* Small, icon-sized tiles — used for the Modifiers strip, capped to about
   two visible rows before scrolling. */
.tile-grid-sm {
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: .35rem;
  max-height: 132px;
}
.tile-grid-sm .tile {
  min-height: 56px;
  padding: .3rem .2rem;
  font-size: .68rem;
}
.tile-grid-sm .tile-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  object-position: center;
  margin-bottom: .15rem;
}
.tile-grid-sm .tile-price { font-size: .62rem; }

/* Equal-width Modifier type tabs on Drop Off, regardless of label length. */
#modifier-type-tabs .btn {
  width: 80px;
}

/* Items no longer scrolls itself — its own card (.items-scroll) handles
   scrolling instead, so the grid shouldn't also cap/scroll internally. */
.tile-grid-flat {
  max-height: none;
  overflow-y: visible;
}

/* ---- Middle column: Categories (fixed size), Items (grows to fill
   whatever's left, scrolling internally), Modifiers (pinned at the
   bottom, always visible) — each its own card, like Modifiers already was ---- */
.menu-column {
  height: calc(100vh - 100px);
  min-height: 420px;
}
.categories-card {
  flex: 0 0 auto;
}
.items-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.items-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.modifiers-card {
  flex: 0 0 auto;
  height: 185px;
  display: flex;
  flex-direction: column;
}
.modifiers-card .pos-card-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}
.modifiers-card .pos-card-body .tile-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.tile {
  position: relative;
  border: 1px solid var(--pos-border);
  border-radius: 8px;
  background: #fff;
  padding: .5rem .4rem;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s ease, box-shadow .08s ease;
  user-select: none;
}

.tile-sub-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--pos-accent);
  color: #fff;
  font-weight: 700;
  font-size: .75rem;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

.tile-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  margin-bottom: .3rem;
  pointer-events: none;
}

.tile-label { line-height: 1.15; }

.tile:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.tile:active { transform: translateY(0); }
.tile.selected { outline: 2px solid var(--pos-accent); outline-offset: -2px; }
.tile .tile-price { display: block; font-weight: 400; font-size: .72rem; color: var(--pos-muted); margin-top: 2px; }

/* ---- Setup (menu admin) screens ---- */
.tile.tile-add {
  background: transparent;
  border: 2px dashed var(--pos-border);
  color: var(--pos-muted);
  font-weight: 400;
}
.tile.tile-add:hover { border-color: var(--pos-primary); color: var(--pos-primary); }
.tile.tile-add .bi { font-size: 1.4rem; display: block; margin-bottom: .2rem; }
.tile .tile-code { display: block; font-size: .62rem; opacity: .75; margin-top: 1px; }
.tile[draggable="true"] { cursor: grab; }
.tile.dragging { opacity: .4; }

/* ---- Image picker (Setup modals) ---- */
.image-preview-box {
  width: 120px;
  height: 120px;
  border: 1px dashed var(--pos-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  background: #fff;
}
.image-preview-box:hover { border-color: var(--pos-primary); }
.image-preview-box img { width: 100%; height: 100%; object-fit: contain; }
.image-preview-placeholder { color: var(--pos-muted); font-size: .72rem; text-align: center; line-height: 1.3; }
.image-preview-placeholder .bi { font-size: 1.4rem; }

.image-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: .6rem;
  max-height: 55vh;
  overflow-y: auto;
}
.image-picker-item {
  border: 1px solid var(--pos-border);
  border-radius: 8px;
  padding: .4rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3rem;
  background: #fff;
  text-align: center;
}
.image-picker-item img { width: 64px; height: 64px; object-fit: contain; }
.image-picker-item span { font-size: .62rem; color: var(--pos-muted); word-break: break-all; line-height: 1.2; }
.image-picker-item:hover { border-color: var(--pos-primary); }
.image-picker-item.selected { outline: 2px solid var(--pos-accent); outline-offset: -2px; }

/* ---- Ticket cart table ---- */
.cart-table { font-size: .9rem; }
.cart-table td, .cart-table th { vertical-align: middle; }
.cart-table tbody tr.cart-row { cursor: pointer; }
.cart-table tbody tr.cart-row:hover { --bs-table-bg: #f7f9f9; }
.cart-table tbody tr.cart-row.selected {
  --bs-table-bg: #d8ebe8;
  box-shadow: inset 3px 0 0 0 var(--pos-primary);
}
.cart-table tbody tr.cart-row.selected td { font-weight: 600; }

.edit-line { color: var(--pos-muted); vertical-align: middle; }
.edit-line:hover { color: var(--pos-primary); }

.qty-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 .4rem;
  border-radius: 6px;
  background: var(--pos-primary);
  color: #fff;
  font-weight: 700;
  font-size: .95rem;
}
.cart-empty { color: var(--pos-muted); text-align: center; padding: 2rem 0; }

.totals-panel .row { padding: .15rem 0; }
.totals-panel .label { color: var(--pos-muted); }
.totals-panel .grand-total { font-size: 1.35rem; font-weight: 700; color: var(--pos-primary-dark); }
.totals-panel.pos-card-body { padding: .75rem .9rem; }
.totals-panel hr { margin: .5rem 0; }

/* ---- Totals panel: compact multi-column layout for Sub Total/Tax/Misc
   Charge/Discount/Pieces — label and amount sit on the same line to save
   vertical space, with Total kept full-width and prominent below ---- */
.totals-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .3rem 1.25rem;
}
.totals-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem;
  font-size: .85rem;
}
.totals-label {
  color: var(--pos-muted);
}
.totals-value {
  font-weight: 600;
  color: var(--pos-text);
  white-space: nowrap;
}

/* ---- Customer search ---- */
.cust-result {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--pos-border);
  cursor: pointer;
}
.cust-result:hover { background: #f0f4f4; }
.cust-result:last-child { border-bottom: none; }
.cust-result .name { font-weight: 600; }
.cust-result .meta { font-size: .8rem; color: var(--pos-muted); }

/* ---- Ticket status badges ---- */
.badge-status-A { background: #dff0e4; color: var(--pos-success); }
.badge-status-C { background: #fbe8d3; color: #b06a12; }
.badge-status-D, .badge-status-V { background: #eee; color: var(--pos-muted); }

/* ---- Dashboard tiles (Home) ---- */
.dash-tile {
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  color: #fff;
  text-decoration: none;
  display: block;
  height: 100%;
  transition: transform .1s ease;
}
.dash-tile:hover { transform: translateY(-2px); color: #fff; }
.dash-tile h3 { margin: .3rem 0 0; font-size: 1.05rem; }
.dash-tile p { font-size: .8rem; }
.dash-tile i { font-size: 1.5rem; }
.dash-tile.tile-dropoff { background: linear-gradient(135deg, #2f5d62, #1f3f42); }

.employee-chip {
  border: 1px solid var(--pos-border);
  border-radius: 999px;
  padding: .35rem .9rem;
  font-size: .85rem;
  background: #fff;
}

/* ---- Dashboard: KPI strip ---- */
.kpi-card {
  padding: 1rem 1.1rem;
  position: relative;
  overflow: hidden;
}
.kpi-clickable {
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.kpi-clickable:hover, .kpi-clickable:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .1);
  outline: none;
}

.dash-list-row { cursor: pointer; }
.dash-list-row:hover { background: var(--pos-bg); }
.kpi-icon {
  position: absolute;
  top: .8rem;
  right: .9rem;
  font-size: 1.4rem;
  opacity: .18;
}
.kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.15; }
.kpi-label { font-size: .78rem; color: var(--pos-muted); text-transform: uppercase; letter-spacing: .03em; margin-top: .15rem; }
.kpi-sub { font-size: .74rem; color: var(--pos-muted); margin-top: .35rem; }
.kpi-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}
.kpi-primary::before { background: var(--pos-primary); }
.kpi-success::before { background: var(--pos-success); }
.kpi-accent::before { background: var(--pos-accent); }
.kpi-info::before { background: #3f7f8f; }
.kpi-danger::before { background: var(--pos-border); }
.kpi-danger.kpi-danger-active::before { background: var(--pos-danger); }
.kpi-danger.kpi-danger-active .kpi-value { color: var(--pos-danger); }

/* ---- Dashboard: 7-day trend chart (plain CSS bars, no chart lib) ---- */
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: .6rem;
  height: 150px;
  padding-top: .5rem;
}
.trend-col {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}
.trend-bar-track {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  align-items: flex-end;
  max-width: 34px;
  margin: 0 auto;
}
.trend-bar {
  width: 100%;
  background: linear-gradient(180deg, var(--pos-primary), var(--pos-primary-dark));
  border-radius: 4px 4px 0 0;
  min-height: 3px;
  transition: height .25s ease;
}
.trend-label {
  font-size: .72rem;
  color: var(--pos-muted);
  margin-top: .4rem;
}

/* ---- Dashboard: horizontal mix bars (service / payment breakdown) ---- */
.mix-row-top {
  display: flex;
  justify-content: space-between;
  font-size: .82rem;
  margin-bottom: .25rem;
}
.mix-label { font-weight: 600; }
.mix-amount { color: var(--pos-muted); }
.mix-track {
  background: var(--pos-bg);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.mix-bar { height: 100%; border-radius: 999px; }
.mix-bar-primary { background: var(--pos-primary); }
.mix-bar-accent { background: var(--pos-accent); }

/* ---- Dashboard: top staff list ---- */
.staff-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.staff-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .88rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--pos-border);
}
.staff-row:last-child { border-bottom: none; padding-bottom: 0; }
.staff-name { font-weight: 600; }

/* ---- Dashboard: recent activity feed ---- */
.activity-card { display: flex; flex-direction: column; }
.activity-scroll { max-height: 320px; overflow-y: auto; }
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-row {
  display: flex;
  gap: .6rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--pos-border);
}
.activity-row:last-child { border-bottom: none; }
.activity-icon { font-size: 1rem; margin-top: .15rem; }
.activity-desc { font-size: .85rem; }
.activity-meta { font-size: .72rem; color: var(--pos-muted); }

/* ---- Ticket info modal: pickup location callout ---- */
.location-callout {
  background: linear-gradient(135deg, #2f5d62, #1f3f42);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  text-align: center;
}
.location-label { font-size: .8rem; opacity: .8; text-transform: uppercase; letter-spacing: .04em; }
.location-value { font-size: 2.4rem; font-weight: 700; line-height: 1.2; }

/* ---- Ticket info modal: multi-column field grid (Customer/Timeline/
   Financials/Other) — several compact "label — value" cells per row
   instead of one long stacked list ---- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .25rem 1.25rem;
}
.info-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem;
  font-size: .85rem;
  padding: .15rem 0;
  border-bottom: 1px dashed var(--pos-border);
}
.info-label { color: var(--pos-muted); }
.info-value { font-weight: 600; color: var(--pos-text); text-align: right; }

/* ---- Change due popup ---- */
.change-due-amount { font-size: 2.6rem; font-weight: 700; color: var(--pos-success); }

/* ---- Ticket list row status cues ---- */
.ticket-row-processing { border-left: 3px solid var(--pos-success); }
.ticket-row-ready { border-left: 3px solid var(--pos-accent); }
.ticket-row-unpaid { border-left: 3px solid var(--pos-danger); }
.ticket-row-closed { border-left: 3px solid var(--pos-border); opacity: .8; }

/* ---- Highlighted info chips ---- */
.pcs-highlight, .rack-highlight {
  display: inline-block;
  border-radius: 4px;
  padding: 0 6px;
  font-weight: 700;
  color: #fff;
}
.pcs-highlight { background: var(--pos-primary); }
.rack-highlight { background: var(--pos-accent); }

.balance-highlight {
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 4px;
}
.balance-highlight.due { background: var(--pos-danger); color: #fff; }
.balance-highlight.clear { background: #e7ece9; color: var(--pos-muted); }

/* ---- Due date/time bar in the Ticket panel — bigger, friendlier picker ---- */
.due-date-bar { background: #fafcfb; }

.due-date-input {
  font-size: 1.05rem;
  font-weight: 600;
  padding: .5rem .7rem;
  border: 2px solid var(--pos-primary);
  border-radius: 8px;
  color: var(--pos-primary-dark);
  background: #fff;
  transition: box-shadow .15s ease, border-color .15s ease;
}
.due-date-input:hover { border-color: var(--pos-accent); }
.due-date-input:focus {
  border-color: var(--pos-accent);
  box-shadow: 0 0 0 .2rem rgba(217, 139, 63, .25);
}

/* Enlarges and tints the little calendar icon (Chrome/Edge only — Safari
   and Firefox don't expose this pseudo-element, so they just get the
   bigger input/border/focus styling above). */
.due-date-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  padding: 3px;
  margin-left: 4px;
  transform: scale(1.4);
  filter: invert(32%) sepia(15%) saturate(1200%) hue-rotate(140deg) brightness(90%);
}

.due-time-input {
  font-size: 1.05rem;
  font-weight: 600;
  padding: .5rem 1.8rem .5rem .7rem;
  border: 2px solid var(--pos-primary);
  border-radius: 8px;
  color: var(--pos-primary-dark);
}
.due-time-input:focus {
  border-color: var(--pos-accent);
  box-shadow: 0 0 0 .2rem rgba(217, 139, 63, .25);
}


#ticket-header-customer:not(:empty) {
  display: block;
  font-size: .75rem;
  margin-top: 2px;
}

/* ---- Dashboard drill-down modals ---- */
#dash-detail-modal .modal-content,
#dash-ticket-modal .modal-content {
  border: none;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .18);
}
.dash-modal-header {
  background: linear-gradient(120deg, var(--pos-primary-dark), var(--pos-primary));
  color: #fff;
  padding: 1.1rem 1.4rem;
  border: none;
}
.dash-modal-header .btn-close { filter: invert(1) grayscale(100%) brightness(200%); opacity: .85; }
.dash-modal-header .btn-close:hover { opacity: 1; }
.dash-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .16);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.dash-modal-title { font-size: 1.05rem; font-weight: 700; margin: 0; color: #fff; }
.dash-modal-subtitle { font-size: .8rem; color: rgba(255, 255, 255, .78); margin-top: .1rem; }
#dash-detail-modal .modal-body, #dash-ticket-modal .modal-body { padding: 1.1rem 1.3rem; background: var(--pos-bg); }
#dash-ticket-modal .modal-footer { border-top: 1px solid var(--pos-border); background: var(--pos-surface); }

.dash-loading, .dash-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 2.75rem 1rem;
  color: var(--pos-muted);
  text-align: center;
}
.dash-loading i, .dash-empty i { font-size: 1.8rem; opacity: .5; }
.dash-loading .spinner-border { width: 1.75rem; height: 1.75rem; color: var(--pos-primary); }

/* Row-card list used for every drill-down (tickets/payments/customers/
   credit activity) instead of a plain table — icon, title/subtitle, and a
   right-aligned amount/status, matching the app's card visual language. */
.dash-row-card {
  display: flex;
  align-items: center;
  gap: .85rem;
  background: var(--pos-surface);
  border: 1px solid var(--pos-border);
  border-radius: 10px;
  padding: .7rem .9rem;
  margin-bottom: .55rem;
  transition: box-shadow .12s ease, transform .12s ease;
}
.dash-row-card:last-child { margin-bottom: 0; }
.dash-row-card.dash-list-row { cursor: pointer; }
.dash-row-card.dash-list-row:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
  transform: translateY(-1px);
  border-color: var(--pos-primary);
}
.drc-icon {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--pos-bg);
  color: var(--pos-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.drc-icon.success { background: #dff0e4; color: var(--pos-success); }
.drc-icon.info { background: #e3eef4; color: #3f7f8f; }
.drc-main { flex: 1 1 auto; min-width: 0; }
.drc-title { font-weight: 600; font-size: .92rem; color: var(--pos-text); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.drc-sub { font-size: .8rem; color: var(--pos-muted); margin-top: .1rem; }
.drc-meta { font-size: .72rem; color: var(--pos-muted); margin-top: .15rem; }
.drc-amounts { text-align: right; flex-shrink: 0; }
.drc-total { font-weight: 700; color: var(--pos-text); font-size: .95rem; }
.drc-balance { font-size: .78rem; margin-top: .1rem; }
.drc-chevron { color: var(--pos-muted); font-size: .9rem; flex-shrink: 0; }

/* Ticket-detail line items, styled as row-cards rather than a plain table */
.dash-line-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  background: var(--pos-surface);
  border: 1px solid var(--pos-border);
  border-radius: 10px;
  padding: .65rem .85rem;
  margin-bottom: .5rem;
}
.dash-line-item:last-child { margin-bottom: 0; }
.dash-line-qty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 .4rem;
  border-radius: 6px;
  background: var(--pos-bg);
  color: var(--pos-primary-dark);
  font-weight: 700;
  font-size: .78rem;
  margin-right: .5rem;
}
.dash-ticket-summary-card {
  background: var(--pos-surface);
  border: 1px solid var(--pos-border);
  border-radius: 10px;
  padding: .9rem 1rem;
  margin-bottom: 1rem;
}

/* ---- Login (landing page) ---- */
.login-body {
  min-height: 100vh;
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 380px;
}
.login-logo {
  font-size: 2.5rem;
  color: var(--pos-primary);
}
