/* TROS Register — self-contained styles for the full-viewport register room
   (register-tab slice 1). Mirrors admin.css's .st-room dark-instrument token
   values (not imported — this file must stand alone, see build-assets.mjs
   file-list scan). House law: docs/DESIGN-RULES.md — radius 0 everywhere,
   no dim-overlay modals, 12px type floor, 44-48px+ touch targets. */

.reg-room {
  /* directive 14: re-derived off Admin's --st-* Studio Darkroom token family
     when present (e.g. this room ever renders nested inside .st-room);
     literal fallback is today's exact value so a standalone register
     screen looks identical to before. */
  --reg-bg: var(--st-bg, #0A0A0B);
  --reg-surface: var(--st-surface, #131316);
  --reg-surface-2: var(--st-surface-2, #1B1B1F);
  --reg-border: var(--st-line, #2A2A30);
  --reg-text: var(--st-text, #F2F2F3);
  --reg-text-dim: var(--st-dim, #9A9AA2);
  --reg-accent: var(--st-silver-hi, #E8E8EA);
  --reg-danger: var(--st-error, #E5484D);
  --reg-good: var(--st-green, #3DD68C);

  /* speed-key palette (engine v18, directive 8: fixed token set) */
  --reg-color-slate: var(--st-slate, #71717A);
  --reg-color-red: var(--reg-danger);
  --reg-color-green: var(--reg-good);
  --reg-color-blue: var(--st-blue, #4C9FFE);
  --reg-color-amber: var(--st-amber, #F5A623);
  --reg-color-violet: var(--st-violet, #A78BFA);

  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  background: var(--reg-bg);
  color: var(--reg-text);
  font-family: "Schibsted Grotesk", system-ui, sans-serif;
  font-size: 15px;
  border-radius: 0;
}

.reg-room * { box-sizing: border-box; border-radius: 0 !important; }

.reg-room button {
  font-family: inherit;
  cursor: pointer;
  background: var(--reg-surface-2);
  color: var(--reg-text);
  border: 1px solid var(--reg-border);
}
.reg-room button:disabled { opacity: 0.4; cursor: default; }
.reg-room input {
  font-family: inherit;
  background: var(--reg-surface);
  color: var(--reg-text);
  border: 1px solid var(--reg-border);
}

/* ── boot / error ─────────────────────────────────────────────────────── */
.reg-boot, .reg-error {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding: 32px;
}
.reg-error-title { font-size: 22px; font-weight: 600; }
.reg-error-detail { color: var(--reg-text-dim); font-size: 14px; max-width: 480px; }
.reg-error-retry { padding: 16px 32px; font-size: 16px; min-height: 56px; }
.reg-pair-input { padding: 14px 16px; font-size: 16px; width: 320px; max-width: 90vw; min-height: 48px; }

/* ── PIN screen ───────────────────────────────────────────────────────── */
.reg-pin {
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}
.reg-pin-title { font-family: "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0.08em; color: var(--reg-text-dim); font-size: 13px; }
.reg-pin-dots { display: flex; gap: 14px; }
.reg-pin-dot { width: 18px; height: 18px; border: 1px solid var(--reg-border); background: transparent; }
.reg-pin-dot.is-filled { background: var(--reg-accent); }
.reg-pin-error { min-height: 20px; color: var(--reg-danger); font-size: 13px; }
.reg-pin-pad { display: grid; grid-template-columns: repeat(3, 80px); gap: 12px; }
.reg-pin-key { width: 80px; height: 72px; font-size: 22px; }
.reg-pin-key.is-empty { visibility: hidden; }

/* ── sell screen ──────────────────────────────────────────────────────── */
.reg-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--reg-border);
  min-height: 56px;
}
.reg-header-title { font-family: "IBM Plex Mono", ui-monospace, monospace; letter-spacing: 0.08em; font-size: 13px; color: var(--reg-text-dim); }
.reg-refusal { flex: 1; color: var(--reg-danger); font-size: 13px; opacity: 0; transition: opacity 0.15s; }
.reg-refusal.is-shown { opacity: 1; }
.reg-exit { margin-left: auto; padding: 10px 18px; min-height: 48px; font-size: 13px; letter-spacing: 0.04em; }

.reg-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* cart pane — left */
.reg-cart {
  width: 40%;
  min-width: 340px;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--reg-border);
  min-height: 0;
}
.reg-cart-lines { flex: 1; overflow-y: auto; }
.reg-cart-empty { padding: 32px 20px; color: var(--reg-text-dim); font-size: 14px; }
.reg-line { padding: 14px 20px; border-bottom: 1px solid var(--reg-border); }
.reg-line-top { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.reg-line-name { font-weight: 500; }
.reg-line-total { font-variant-numeric: tabular-nums; }
.reg-line-meta { display: flex; gap: 10px; color: var(--reg-text-dim); font-size: 12px; margin-top: 4px; }
.reg-line-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.reg-qty-btn { width: 72px; height: 72px; font-size: 20px; }
.reg-qty-input { width: 64px; height: 72px; text-align: center; font-size: 16px; }
.reg-line-remove { margin-left: auto; min-height: 48px; min-width: 48px; padding: 0 14px; font-size: 12px; letter-spacing: 0.04em; color: var(--reg-danger); }
.reg-wine-disc { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
.reg-disc-btn { min-height: 72px; font-size: 13px; }
.reg-disc-btn.is-active { background: var(--reg-accent); color: var(--reg-bg); }
.reg-line-readonly .reg-line-ctrl { display: none; }

.reg-totals { padding: 14px 20px; border-top: 1px solid var(--reg-border); }
.reg-total-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--reg-text-dim); padding: 3px 0; }
.reg-total-row.is-grand { font-size: 20px; color: var(--reg-text); font-weight: 600; padding-top: 8px; }

.reg-pay-btn {
  margin: 16px 20px 20px;
  min-height: 80px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--reg-accent);
  color: var(--reg-bg);
  border: none;
}
.reg-tender-next { background: var(--reg-good); }

/* work surface — right */
.reg-work { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 20px; gap: 16px; }
.reg-search-wrap { position: relative; }
.reg-search-input { width: 100%; height: 56px; padding: 0 16px; font-size: 18px; }
.reg-search-results {
  position: absolute; top: 60px; left: 0; right: 0; z-index: 10;
  background: var(--reg-surface); border: 1px solid var(--reg-border);
  max-height: 320px; overflow-y: auto;
}
.reg-search-hit { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; font-size: 15px; border: none; border-bottom: 1px solid var(--reg-border); text-align: left; }
.reg-search-empty { padding: 14px 16px; color: var(--reg-text-dim); font-size: 13px; }

.reg-speedgrid { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.reg-speedgrid-tiles {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  overflow-y: auto;
  align-content: start;
}
.reg-speedkey {
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  text-align: left;
  background: var(--reg-surface);
}
/* .reg-room button's border shorthand (class+element) otherwise outranks a
   bare .reg-speedkey-colored (class only) -- doubled selector wins on
   specificity instead of reaching for !important. */
.reg-speedkey.reg-speedkey-colored { border-left: 4px solid var(--reg-key-color, transparent); }
.reg-speedkey-label { font-size: 14px; font-weight: 500; }
.reg-speedkey-price { font-size: 13px; color: var(--reg-text-dim); font-variant-numeric: tabular-nums; }
.reg-speedgrid-pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding-top: 12px; }
.reg-pager-btn { min-height: 48px; min-width: 48px; padding: 0 16px; font-size: 13px; }
.reg-pager-label { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; color: var(--reg-text-dim); }

/* ── tender ───────────────────────────────────────────────────────────── */
.reg-tender { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 20px; overflow-y: auto; }
.reg-tender-due { font-family: "IBM Plex Mono", ui-monospace, monospace; color: var(--reg-text-dim); font-size: 13px; letter-spacing: 0.06em; }
.reg-tender-amount { font-size: 44px; font-weight: 600; font-variant-numeric: tabular-nums; }
.reg-tender-presets { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.reg-preset-btn { min-height: 72px; min-width: 72px; padding: 0 18px; font-size: 16px; }
.reg-preset-exact { background: var(--reg-accent); color: var(--reg-bg); }
.reg-preset-btn.is-active { background: var(--reg-accent); color: var(--reg-bg); }
.reg-tip-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-width: 96px; }
.reg-tip-pct { font-size: 17px; font-weight: 600; }
.reg-tip-amt { font-size: 12px; color: var(--reg-text-dim); font-variant-numeric: tabular-nums; }
.reg-tender-pad { grid-template-columns: repeat(3, 88px); }
.reg-tender-pad .reg-pin-key { width: 88px; height: 72px; }
.reg-tender-change { font-size: 28px; font-weight: 600; color: var(--reg-good); opacity: 0; min-height: 36px; }
.reg-tender-change.is-shown { opacity: 1; }

/* card tender state + dialog error/note text — shared across tender and
   the More-menu dialogs (slice 2) */
.reg-card-status { font-size: 18px; text-align: center; min-height: 28px; }
.reg-card-status-bad { color: var(--reg-danger); }
.reg-dialog-error { min-height: 20px; color: var(--reg-danger); font-size: 13px; text-align: center; }
.reg-dialog-note { min-height: 18px; color: var(--reg-text-dim); font-size: 13px; text-align: center; }

/* ── More-menu form fields (misc reason, gift cert code, tax-exempt) ───── */
.reg-field-input { width: 100%; max-width: 420px; min-height: 56px; padding: 0 16px; font-size: 16px; }
.reg-field-label { font-size: 12px; letter-spacing: 0.04em; color: var(--reg-text-dim); text-transform: uppercase; }

/* ── Transactions view + refunds (slice 3) ──────────────────────────────── */
.reg-txn-panel { width: 100%; max-width: 640px; }
.reg-txn-lookup { display: flex; gap: 10px; width: 100%; max-width: 420px; }
.reg-txn-lookup .reg-field-input { max-width: none; }
.reg-txn-detail { width: 100%; display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.reg-txn-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reg-txn-sale-no { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 15px; letter-spacing: 0.04em; }
.reg-txn-status { font-size: 12px; letter-spacing: 0.06em; padding: 4px 10px; border: 1px solid var(--reg-border); color: var(--reg-text-dim); }
.reg-txn-badge { align-self: flex-start; font-size: 12px; letter-spacing: 0.06em; padding: 4px 10px; border: 1px solid var(--reg-accent); color: var(--reg-accent); }
.reg-txn-lines { border: 1px solid var(--reg-border); }
.reg-txn-lines .reg-line { padding: 12px 16px; }
.reg-txn-payments { display: flex; flex-direction: column; gap: 4px; }
.reg-txn-payment { font-size: 14px; color: var(--reg-text-dim); font-variant-numeric: tabular-nums; }
.reg-txn-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.reg-txn-actions .reg-pay-btn { margin: 0; min-height: 56px; }
.reg-txn-refund-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px 0; border-bottom: 1px solid var(--reg-border); }
.reg-txn-refund-outcome { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 0; }

/* ── Recent-sales list (slice 3b) — the Transactions pane's default view ── */
.reg-txn-recent { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-bottom: 16px; }
.reg-txn-recent-row {
  display: flex; flex-direction: column; gap: 4px; align-items: stretch;
  width: 100%; min-height: 72px; padding: 10px 16px;
  background: var(--reg-surface-2); border: 1px solid var(--reg-border); color: var(--reg-text);
  text-align: left; font: inherit; cursor: pointer;
}
.reg-txn-recent-row:hover { border-color: var(--reg-accent); }
.reg-txn-recent-top, .reg-txn-recent-mid { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reg-txn-recent-time { font-size: 12px; color: var(--reg-text-dim); }
.reg-txn-recent-total { font-size: 16px; font-variant-numeric: tabular-nums; }
.reg-txn-recent-tender { font-size: 12px; color: var(--reg-text-dim); font-variant-numeric: tabular-nums; }
.reg-txn-empty { padding: 16px 0; color: var(--reg-text-dim); font-size: 14px; }

/* Status is never just color (directive: never color-only state) — the text
   itself already reads COMPLETED / PARTIALLY REFUNDED / REFUNDED; color is a
   secondary, redundant cue on top of that text. */
.reg-txn-status-completed { color: var(--reg-text-dim); border-color: var(--reg-border); }
.reg-txn-status-partially-refunded { color: var(--reg-good); border-color: var(--reg-good); }
.reg-txn-status-refunded { color: var(--reg-danger); border-color: var(--reg-danger); }

/* ── print (last receipt) — the only element visible when printing ─────── */
.reg-print-receipt { display: none; }
@media print {
  body * { visibility: hidden; }
  .reg-print-receipt, .reg-print-receipt * { visibility: visible; }
  .reg-print-receipt {
    display: block;
    position: fixed;
    inset: 0;
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 13px;
    white-space: pre-wrap;
    color: #000;
    background: #fff;
  }
}
