/* POS-style ticket panel (src/ticketPanel.js). Same palette + type as the board (styles.css :root).
   Phone (<900px): full screen, Techs/Services/Tickets tabs on top, a summary bar pinned at the bottom that opens the
   ticket as a bottom sheet. Desktop (≥900px): tab content left, the ticket summary always visible on the right. */
.tp[hidden] { display: none !important; }
.tp {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(43, 29, 31, .42);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: contain;
}
.tp *, .tp *::before, .tp *::after { box-sizing: border-box; }
.tp button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
.tp button:disabled { cursor: default; }
.tp small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
.tp-shell {
  position: absolute; inset: 0;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--bg); color: var(--ink);
  overflow: hidden;
}

/* ---------- header + tabs ---------- */
.tp-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "ttl x" "tabs tabs";
  gap: 8px 10px; align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.tp-ttl { grid-area: ttl; min-width: 0; }
.tp-title { font-size: 19px; font-weight: 800; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-sub { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.3em; }
.tp-x {
  grid-area: x; width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); font-size: 20px; font-weight: 800;
}
.tp-x:active { transform: scale(.94); }
.tp-tabs {
  grid-area: tabs; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 4px;
}
.tp-tab {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  min-height: 52px; border: 0; border-radius: 12px; background: transparent; padding: 4px 6px;
  font-weight: 800; font-size: 15px; line-height: 1.1; min-width: 0; position: relative;
}
.tp-tab-e { font-size: 20px; flex: none; }
.tp-tab-l { text-align: left; flex: none; }
.tp-tab-v {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; font-weight: 800; padding: 3px 8px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); max-width: 9em;
}
.tp-tab-v:empty, .tp-tab-v[hidden] { display: none; }
.tp-tab.on { background: var(--accent); color: #fff; box-shadow: 0 2px 6px rgba(122, 31, 61, .25); }
.tp-tab.on small { color: #f3d9e1; }
.tp-tab.on .tp-tab-v { background: rgba(255, 255, 255, .2); color: #fff; }
.tp-tab:focus-visible, .tp button:focus-visible, .tp input:focus-visible { outline: 3px solid rgba(122, 31, 61, .45); outline-offset: 2px; }

/* ---------- body ---------- */
.tp-body { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.tp-main { min-height: 0; min-width: 0; display: grid; }
.tp-pane { min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 12px 24px; }
.tp-pane[hidden] { display: none; }
.tp-pane-h { font-size: 17px; font-weight: 800; margin: 2px 2px 10px; }
.tp-pane-h small { display: inline; margin-left: 6px; }
.tp-note { font-size: 13px; color: var(--muted); line-height: 1.35; margin: 4px 2px 10px; }
.tp-empty { color: var(--muted); font-weight: 600; text-align: center; padding: 24px 8px; margin: 0; }

/* Techs tab: big tiles */
.tp-tgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tp-tech {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "no nm" "meta meta" "tags tags";
  gap: 6px 10px; align-items: center; text-align: left;
  min-height: 112px; padding: 12px; border-radius: 18px;
  background: var(--card); border: 2px solid var(--line);
  box-shadow: 0 1px 2px rgba(43, 29, 31, .05);
  transition: border-color .12s, box-shadow .12s, transform .08s;
}
.tp-tech:active:not(:disabled) { transform: scale(.98); }
.tp-tech:disabled { opacity: .45; }
.tp-tech.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), 0 6px 16px -8px rgba(122, 31, 61, .45); }
.tp-tno {
  grid-area: no; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); font-weight: 900; font-size: 17px; font-variant-numeric: tabular-nums;
}
.tp-tech.on .tp-tno { background: var(--accent); color: #fff; }
.tp-tnm { grid-area: nm; font-size: 21px; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; padding-right: 22px; }
.tp-tmeta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 14px; color: var(--muted); font-weight: 600; }
.tp-tmeta b { color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; }
.tp-tags { grid-area: tags; display: flex; flex-wrap: wrap; gap: 6px; }
.tp-tags:empty { display: none; }
.tp-tag { display: inline-flex; gap: 4px; align-items: baseline; font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 999px; }
.tp-tag small { display: inline; font-size: 10px; color: inherit; opacity: .8; }
.tp-tag.up { background: var(--accent); color: #fff; }
.tp-tag.bn { background: var(--gold-soft); color: #7a5300; border: 1px solid #f0d58a; }
.tp-tag.sk { background: #eee6df; color: var(--muted); }
.tp-tck {
  position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; font-weight: 900;
  background: var(--accent); color: #fff; opacity: 0; transform: scale(.6); transition: opacity .12s, transform .12s;
}
.tp-tech.on .tp-tck { opacity: 1; transform: none; }

/* Services tab */
.tp-svcs { padding-top: 0; }
.tp-svc-top {
  position: sticky; top: 0; z-index: 2; margin: 0 -12px 8px; padding: 10px 12px 8px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.tp-cats {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
  scroll-snap-type: x proximity;
}
.tp-cats::-webkit-scrollbar { display: none; }
.tp-cat {
  position: relative; flex: none; display: flex; align-items: center; gap: 6px; scroll-snap-align: start;
  min-height: 52px; padding: 6px 12px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); font-weight: 800; font-size: 15px; line-height: 1.1; text-align: left;
}
.tp-cat .e { font-size: 20px; }
.tp-cat.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tp-cat.on small { color: #f3d9e1; }
.tp-cat .n {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--gold); color: #fff; font-size: 12px; font-weight: 900;
}
.tp-search {
  display: flex; align-items: center; gap: 8px; margin-top: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 0 12px; min-height: 46px;
}
.tp-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; min-height: 44px; color: var(--ink); }
.tp-grp-t { font-size: 14px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; margin: 14px 2px 8px; }
.tp-svc-list > .tp-grp-t:first-child { margin-top: 6px; }
.tp-sgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tp-svc {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; text-align: left;
  min-height: 76px; padding: 10px 12px; border-radius: 16px; border: 2px solid var(--line); background: var(--card);
  transition: border-color .12s, background .12s, transform .08s;
}
.tp-svc:active { transform: scale(.97); }
.tp-svc .nm { font-weight: 800; font-size: 15.5px; line-height: 1.2; overflow-wrap: anywhere; padding-right: 28px; }
.tp-svc .pr { font-weight: 800; color: var(--accent); font-size: 16px; font-variant-numeric: tabular-nums; }
.tp-svc .pr .split { display: inline; font-size: 12px; color: var(--muted); font-weight: 600; }
.tp-svc .q {
  position: absolute; top: 8px; right: 8px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px;
  display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 900; font-size: 14px;
}
.tp-svc.on { border-color: var(--accent); background: #fdf6f8; }
.tp-svc.bump { animation: tp-pop .22s var(--sh-ease, ease-out); }
@keyframes tp-pop { 0% { transform: scale(.96); } 60% { transform: scale(1.02); } 100% { transform: none; } }

/* Other item form */
.tp-other { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-top: 6px; }
.tp-other-h { font-weight: 800; font-size: 17px; margin-bottom: 10px; }
.tp-other-h small { display: inline; margin-left: 6px; }
.tp-other-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.tp-other input {
  width: 100%; min-height: 52px; border: 1px solid var(--line); border-radius: 14px; padding: 0 14px;
  font: inherit; font-size: 17px; background: var(--bg); color: var(--ink);
}
.tp-other-pr { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 800; color: var(--muted); }
.tp-other-add { min-height: 52px; }
.tp-other-err { color: #b3261e; font-weight: 700; margin: 8px 0 0; font-size: 14px; }
.tp-other-err[hidden] { display: none; }
.tp-other-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tp-chip { display: inline-flex; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px; }

/* ---------- ticket summary ---------- */
.tp-sum {
  display: flex; flex-direction: column; gap: 10px; min-height: 0; min-width: 0;
  background: var(--card); padding: 12px;
}
.tp-grab { display: none; }
.tp-lines { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.tp-line {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.tp-line-main { min-width: 0; }
.tp-line-nm { display: block; font-weight: 800; font-size: 15px; line-height: 1.2; overflow-wrap: anywhere; }
.tp-line-unit { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.tp-badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: var(--gold-soft); color: #7a5300; vertical-align: 1px; }
.tp-qty { display: flex; align-items: center; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 2px; }
.tp-q-btn { width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--card); font-size: 20px; font-weight: 900; line-height: 1; }
.tp-q-btn:active { transform: scale(.92); }
.tp-q-n { min-width: 22px; text-align: center; font-weight: 900; font-variant-numeric: tabular-nums; }
.tp-line-pr { min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; font-size: 15px; }
.tp-line-x { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: #b3261e; font-weight: 900; }
.tp-line-empty { color: var(--muted); font-weight: 600; font-size: 14px; padding: 16px 4px; text-align: center; }
.tp-res-num { display: flex; align-items: baseline; gap: 8px; }
.tp-err { color: #b3261e; font-weight: 700; font-size: 14px; background: #fdecea; border-radius: 12px; padding: 8px 10px; }
.tp-err[hidden] { display: none; }
.tp-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.tp-actions .ghost, .tp-actions .add { min-height: 58px; font-size: 17px; line-height: 1.1; }
.tp-save:disabled, .tp-bar-save:disabled { opacity: .45; }

/* ---------- phone: bottom bar + summary sheet ---------- */
.tp-bar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch;
  padding: 8px 10px max(8px, env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line);
  box-shadow: 0 -8px 20px -12px rgba(43, 29, 31, .3); position: relative; z-index: 4;
}
.tp-bar-sum {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "who res car" "mid res car";
  gap: 0 8px; align-items: center; text-align: left; min-height: 58px; padding: 6px 12px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--bg);
}
.tp-bar-who { grid-area: who; font-weight: 800; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-bar-mid { grid-area: mid; font-size: 13px; color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-bar-res { grid-area: res; font-weight: 900; font-size: 18px; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tp-bar-res.is-bonus { color: #9a6a00; }
.tp-bar-res.bump { animation: tp-pop .25s ease-out; }
.tp-bar-car { grid-area: car; font-size: 16px; color: var(--muted); transition: transform .18s; }
.tp.sum-open .tp-bar-car { transform: rotate(180deg); }
.tp-bar-save { min-width: 96px; min-height: 58px; font-size: 17px; line-height: 1.1; }
.tp-bar-save small { color: #f3d9e1; }


/* Tickets tab */
.tp-tk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; }
.tp-tk-filt { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; flex: 1; min-width: 0; }
.tp-scope {
  flex: 1; min-height: 44px; min-width: 0; border: 0; border-radius: 10px; background: transparent;
  font-weight: 800; font-size: 15px; padding: 4px 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.tp-scope small { display: inline; margin-left: 4px; }
.tp-scope .n {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 900;
}
.tp-scope.on { background: var(--accent); color: #fff; }
.tp-scope.on small { color: #f3d9e1; }
.tp-scope.on .n { background: rgba(255,255,255,.22); color: #fff; }
.tp-scope:disabled { opacity: .4; }
.tp-tk-new {
  flex: none; min-height: 52px; padding: 4px 14px; border-radius: 14px; border: 2px solid var(--accent);
  background: var(--card); color: var(--accent); font-weight: 800; font-size: 15px; line-height: 1.1;
}
.tp-tk-new:disabled { opacity: .4; }
.tp-tk-new small { color: inherit; opacity: .8; }
.tp-tk-list { display: grid; gap: 14px; }
.tp-tk-group { display: grid; gap: 8px; }
.tp-tk-gh { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tp-tk-gh .tp-tno { width: 28px; height: 28px; font-size: 14px; }
.tp-tk-gh .nm { font-weight: 800; font-size: 17px; }
.tp-tk-gh .meta { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.tp-tk-out { font-size: 11px; font-weight: 800; color: var(--muted); background: #eee6df; border-radius: 6px; padding: 1px 6px; vertical-align: 1px; }
.tp-tk-none { margin: 0; padding: 10px 12px; color: var(--muted); font-weight: 600; font-size: 14px; }
.tp-tk {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "top top" "svcs pr" "edit edit";
  gap: 4px 10px; text-align: left; width: 100%;
  padding: 12px 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--card);
  transition: border-color .12s, box-shadow .12s, transform .08s;
}
.tp-tk:active { transform: scale(.99); }
.tp-tk.on { border-color: var(--accent); background: #fdf6f8; box-shadow: 0 0 0 3px var(--accent-soft); }
.tp-tk-top { grid-area: top; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.tp-tk-time { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.tp-tk-appt { font-size: 12px; font-weight: 800; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 6px; }
.tp-tk-res { margin-left: auto; font-weight: 900; font-size: 16px; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tp-tk-res.is-bonus { color: #9a6a00; }
.tp-tk-svcs { grid-area: svcs; font-size: 14.5px; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.tp-tk-pr { grid-area: pr; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; align-self: start; }
.tp-tk-edit { grid-area: edit; font-size: 12px; font-weight: 800; color: var(--accent); }

/* This-tech ticket chips in the summary (New / each saved ticket) */
.tp-pick { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; max-width: 100%; }
.tp-pick-btn { max-width: 100%; }
.tp-pick[hidden] { display: none; }
.tp-pick-btn {
  flex: none; min-height: 44px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg); font-weight: 800; font-size: 13.5px; line-height: 1.1; white-space: nowrap;
}
.tp-pick-btn small { display: inline; margin-left: 4px; }
.tp-pick-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tp-pick-btn.on small { color: #f3d9e1; }

@media (max-width: 899px) {
  .tp-tab { flex-direction: column; gap: 0; padding: 4px 2px 3px; min-height: 58px; font-size: 13.5px; }
  .tp-tab-e { font-size: 18px; }
  .tp-tab-l { text-align: center; }
  .tp-tab-v { position: absolute; top: 3px; right: 3px; max-width: 3.2em; padding: 1px 6px; font-size: 11px; }
  #tpTabWho { display: none; }
  .tp-sum {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
    max-height: calc(100% - 120px); overflow: hidden; padding: 8px 12px 14px;
    border-radius: 22px 22px 0 0; box-shadow: 0 -18px 40px -10px rgba(43, 29, 31, .35);
    transform: translateY(105%); visibility: hidden; transition: transform .22s var(--sh-ease, ease-out), visibility 0s .22s;
  }
  .tp.sum-open .tp-sum { transform: none; visibility: visible; transition: transform .22s var(--sh-ease, ease-out);
    box-shadow: 0 -18px 40px -10px rgba(43, 29, 31, .35), 0 0 0 100vmax rgba(43, 29, 31, .28); } /* dims the tiles behind; a tap there closes it */
  .tp-grab { display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 2px auto 0; flex: none; }
  .tp-body { position: relative; overflow: hidden; }
  .tp-main { position: relative; z-index: 1; }
  .tp-actions .tp-save { display: none; }
  .tp-actions { grid-template-columns: 1fr; }
}
@media (max-width: 599px) {
  /* every category visible at once: 4 per row, icon over the label */
  .tp-cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; overflow: visible; }
  .tp-cat { flex-direction: column; justify-content: center; gap: 2px; min-height: 60px; padding: 6px 4px; text-align: center; font-size: 13.5px; }
  .tp-cat .e { font-size: 19px; line-height: 1; }
  .tp-cat .l { min-width: 0; max-width: 100%; }
  .tp-cat small { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tp-cat .n { position: absolute; top: 3px; right: 3px; min-width: 19px; height: 19px; font-size: 11px; padding: 0 5px; }
}
@media (max-width: 360px) {
  .tp-tab-l small { display: none; }
  .tp-tab-v { display: none; }
  .tp-tk-gh .meta { display: none; }
  .tp-tgrid { grid-template-columns: minmax(0, 1fr); }
  .tp-tech { min-height: 0; }
}
@media (min-width: 600px) and (max-width: 899px) {
  .tp-tgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tp-sgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tp-sum { left: auto; width: min(440px, 100%); border-radius: 22px 0 0 0; }
}

/* ---------- desktop: summary always visible on the right ---------- */
@media (min-width: 900px) {
  .tp-shell {
    inset: 18px; margin: 0 auto; max-width: 1480px; border-radius: 22px;
    box-shadow: 0 30px 80px -20px rgba(43, 29, 31, .55);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .tp-head { grid-template-columns: minmax(160px, 1fr) minmax(420px, 680px) minmax(160px, 1fr); grid-template-areas: "ttl tabs x"; padding: 12px 16px; }
  .tp-x { justify-self: end; }
  .tp-title { font-size: 21px; }
  .tp-body { grid-template-columns: minmax(0, 1fr) minmax(380px, 30%); }
  .tp-pane { padding: 16px 20px 28px; }
  .tp-svc-top { margin: 0 -20px 10px; padding: 14px 20px 10px; display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 12px; align-items: center; }
  .tp-search { margin-top: 0; }
  .tp-cats { flex-wrap: wrap; overflow: visible; }
  .tp-sgrid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 10px; }
  .tp-svc { min-height: 88px; }
  .tp-tgrid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
  .tp-tech { min-height: 128px; }
  .tp-sum { border-left: 1px solid var(--line); padding: 16px; overflow: hidden; }
  .tp-bar { display: none; }
  .tp-other-row { grid-template-columns: minmax(0, 1fr) 180px auto; }
}
@media (min-width: 900px) and (max-height: 720px) {
  .tp-shell { inset: 8px; }
  .tp-c-big { font-size: 26px; }
  .tp-actions .ghost, .tp-actions .add { min-height: 52px; }
}
@media (hover: hover) {
  .tp-svc:hover { border-color: #d9b9c3; }
  .tp-tech:hover:not(:disabled) { border-color: #d9b9c3; }
  .tp-tech.on:hover, .tp-svc.on:hover { border-color: var(--accent); }
  .tp-tk:hover { border-color: #d9b9c3; }
  .tp-tk.on:hover { border-color: var(--accent); }
}
@media (prefers-reduced-motion: reduce) {
  .tp *, .tp *::before, .tp *::after { animation: none !important; transition: none !important; }
}
/* the board's global button rule sets color: inherit — keep the primary buttons white on burgundy */
.tp .add, .tp .add small { color: #fff; }
@media (min-width: 900px) {
  .tp-tk-group { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .tp-tk-gh, .tp-tk-none { grid-column: 1 / -1; }
}

/* boot: keep the board invisible until its first layout + snapshot (no visible shift); CSS fallback reveal */
html.booting body { visibility: hidden; animation: tp-boot-reveal 0s 2s forwards; }
@keyframes tp-boot-reveal { to { visibility: visible; } }

/* ---------- group checkout: pending tickets as cards in the summary ---------- */
.tp-sum-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; flex: none; }
.tp-sum-t { font-weight: 900; font-size: 17px; }
.tp-sum-t small { display: inline; margin-left: 4px; }
.tp-sum-n { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 13px; text-align: center; vertical-align: 2px; }
.tp-another { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1.5px dashed var(--accent); color: var(--accent); background: var(--card); font-weight: 800; font-size: 13.5px; white-space: nowrap; }
.tp-another small { display: inline; margin-left: 4px; color: inherit; }
.tp-another[hidden] { display: none; }
.tp-cards { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 3px; margin: -3px; overscroll-behavior: contain; }
.tp-card {
  flex: none; display: grid; gap: 6px; padding: 6px 10px 10px; border-radius: 18px;
  border: 2px solid var(--line); background: var(--bg); cursor: pointer; min-width: 0;
}
.tp-card.on { border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 3px var(--accent-soft); }
.tp-card.has-err { border-color: #b3261e; }
.tp-card.is-saved { opacity: .6; }
.tp-c-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tp-c-head {
  flex: 1; min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "no nm" "no meta";
  gap: 0 10px; align-items: center; text-align: left; min-height: 44px; padding: 0 4px 0 0; border: 0; background: transparent;
}
.tp-c-head .tp-tno { grid-area: no; width: 38px; height: 38px; font-size: 18px; background: var(--accent-soft); color: var(--accent); }
.tp-card.on .tp-c-head .tp-tno { background: var(--accent); color: #fff; }
.tp-c-nm { grid-area: nm; font-size: 18px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-c-meta { grid-area: meta; font-size: 12.5px; color: var(--muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-c-head > .tp-c-nm:only-child { grid-column: 1 / -1; }
.tp-c-rm { flex: none; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: #b3261e; font-weight: 900; font-size: 16px; }
.tp-c-clear { flex: none; min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 700; font-size: 13px; }
.tp-c-clear small { display: inline; margin-left: 3px; }
.tp-c-clear[hidden] { display: none; }
.tp-c-ok { flex: none; font-weight: 800; font-size: 13px; color: #155d2c; background: #e2f4e7; border-radius: 999px; padding: 6px 10px; }
.tp-c-appt { flex: none; }
.tp-c-appt .seg-btn { min-height: 40px; font-size: 14px; padding-top: 2px; padding-bottom: 2px; }
.tp-card .tp-q-btn { width: 36px; height: 36px; }
.tp-card .tp-line { padding: 4px 0; }
.tp-card .tp-line-x { width: 36px; height: 36px; }
.tp-res-num { flex-wrap: wrap; }
.tp-c-sub { margin-left: auto; display: inline-flex; align-items: baseline; gap: 6px; font-weight: 800; font-size: 13px; color: var(--ink); }
.tp-c-sub small { display: inline; margin-left: 2px; }
.tp-c-sub b { font-size: 19px; font-variant-numeric: tabular-nums; }
.tp-c-res { border-radius: 14px; padding: 8px 12px; background: var(--accent-soft); border: 1px solid #ecc9d3; display: grid; gap: 3px; min-width: 0; }
.tp-c-res.is-bonus { background: var(--gold-soft); border-color: #f0d58a; }
.tp-c-res.empty { background: var(--bg); border-color: var(--line); }
.tp-c-big { font-size: 30px; font-weight: 900; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.tp-c-unit { font-size: 15px; font-weight: 800; color: var(--accent); }
.tp-c-res.is-bonus .tp-c-big, .tp-c-res.is-bonus .tp-c-unit { color: #9a6a00; }
.tp-c-res.empty .tp-c-big { color: var(--muted); }
.tp-c-big.bump { animation: tp-pop .25s ease-out; }
.tp-c-reason { font-size: 12.5px; color: var(--ink); font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.tp-c-effect { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.tp-c-effect b { white-space: nowrap; }
.tp-c-effect .bn { color: #7a5300; }
.tp-c-err { color: #b3261e; font-weight: 700; font-size: 13.5px; background: #fdecea; border-radius: 10px; padding: 6px 10px; overflow-wrap: anywhere; }
.tp-foot { flex: none; display: grid; gap: 3px; padding: 6px 12px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.tp-foot[hidden] { display: none; }
.tp-foot-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-weight: 800; font-size: 15px; }
.tp-foot-row.sub { font-size: 13.5px; font-weight: 700; color: var(--muted); }
.tp-foot-row b { font-variant-numeric: tabular-nums; }
.tp-foot-sum { font-size: 19px; color: var(--ink); }
.tp-foot-next { font-size: 13px; font-weight: 700; color: var(--ink); background: var(--accent-soft); border-radius: 8px; padding: 4px 8px; overflow-wrap: anywhere; }
.tp-foot-next b { color: var(--accent); }
.tp-tag.pd { background: #e2f4e7; color: #155d2c; }
.tp-tech.has-draft { border-color: #8fcba3; }
.tp-tech.has-draft.on { border-color: var(--accent); }
.tp-pick-n { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; text-align: center; }
@media (max-width: 899px) {
  .tp-sum { max-height: calc(100% - 72px); }
  .tp.is-batch .tp-actions { display: none; }   /* new tickets: ✕ in the header cancels, the bar saves */
}

/* Lovely: an in-service / pending ticket is shown but not editable here */
.tp-tk.is-locked { opacity: .7; cursor: default; }
.tp-tk-res small { display: inline; margin-left: 4px; }
