:root {
  --green: #28ff0a;
  --green-dim: rgba(40, 255, 10, 0.18);
  --green-ink: #0a4a2d;
  --ink: #0d1a0d;
  --muted: #5a6b5a;
  --line: rgba(0, 80, 0, 0.12);
  --white: #ffffff;
  --surface: rgba(255, 255, 255, 0.88);
  --danger: #c62828;
  --radius: 18px;
  --font-display: "Syne", sans-serif;
  --font-ui: "Outfit", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* Song 1.6c AAAAA polish tokens */
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --text-primary: #0d1a0d;
  --text-secondary: #5a6b5a;
  --border-color: rgba(0, 80, 0, 0.12);
  --disabled-bg: #e8eee8;
  --disabled-ink: #6a7a6a;
  --disabled-border: #c5d0c5;
  --keypad-panel-top: rgba(255, 255, 255, 0.92);
  --shadow-soft: rgba(13, 26, 13, 0.12);
  color-scheme: light;
}

/* Manual theme only (Song 1.6c Polish2) — no prefers-color-scheme auto */
html.dark-mode {
  --green: #28ff0a;
  --green-dim: rgba(40, 255, 10, 0.22);
  --green-ink: #b8ff9a;
  --ink: #f4fff4;
  --muted: #a8b8a8;
  --line: rgba(180, 255, 180, 0.18);
  --white: #1a1a1a;
  --surface: rgba(45, 45, 45, 0.92);
  --danger: #ff8a80;
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --border-color: #404040;
  --disabled-bg: #2a322a;
  --disabled-ink: #8a9a8a;
  --disabled-border: #3a453a;
  --keypad-panel-top: rgba(45, 45, 45, 0.95);
  --shadow-soft: rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--text-primary, var(--ink));
  background: var(--bg-primary, var(--white));
  overflow-x: hidden;
  /* Never put transform/opacity gates on body — they break inputs & selects */
}

/* Author display rules must not override the hidden attribute */
.settings[hidden],
.backdrop[hidden],
.preview-ribbon[hidden],
.tally-lock[hidden] {
  display: none !important;
}

body.merchant-pulse .merchant-select-wrap {
  animation: pulse-ring 0.55s ease;
}

.preview-ribbon {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: #0d1a0d;
  color: #f4fff4;
  font-size: 0.82rem;
  line-height: 1.35;
}

.preview-ribbon p {
  margin: 0;
}

.preview-ribbon strong {
  color: var(--green);
  font-weight: 800;
}

.preview-dismiss {
  flex-shrink: 0;
  border: 1px solid rgba(0, 255, 0, 0.45);
  background: transparent;
  color: var(--green);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.preview-dismiss:hover {
  background: rgba(0, 255, 0, 0.12);
}

body.is-preview .top {
  padding-top: 16px;
}

body.is-preview .ad-slot::before {
  content: "Ad slot";
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 4px 2px;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 80% at 100% -10%, var(--green-dim), transparent 55%),
    radial-gradient(90% 60% at -10% 100%, rgba(0, 255, 0, 0.12), transparent 50%),
    linear-gradient(180deg, #f7fff7 0%, var(--white) 42%, #f3fff3 100%);
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    -18deg,
    transparent,
    transparent 22px,
    rgba(0, 255, 0, 0.03) 22px,
    rgba(0, 255, 0, 0.03) 23px
  );
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 70%);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(16px + var(--safe-top)) 20px 8px;
  max-width: 560px;
  margin: 0 auto;
}

.brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  line-height: 1;
  position: relative;
  min-width: 0;
}

.brand-logo {
  display: block;
  height: clamp(48px, 11vw, 68px);
  width: auto;
  max-width: min(180px, 42vw);
  flex-shrink: 0;
  object-fit: contain;
  object-position: left center;
  animation: brand-in 0.7s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

.brand-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
}

.brand-name {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.brand .plan-badge {
  margin: 0;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.icon-btn:hover {
  background: var(--green);
  border-color: var(--green);
  transform: rotate(28deg);
}

.shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 20px calc(28px + var(--safe-bottom));
}

.crumb {
  margin: 0 0 12px;
  font-size: 0.8rem;
  color: var(--muted);
}

.crumb-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.crumb-item:not(:last-child)::after {
  content: "/";
  margin-left: 0.35rem;
  opacity: 0.55;
}

.crumb a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.crumb a:hover {
  color: var(--ink);
}

.crumb-item[aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

.merchant-bar {
  margin: 12px 0 28px;
  animation: rise 0.55s 0.1s ease both;
  transform: none !important;
}

.merchant-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.merchant-select-wrap {
  position: relative;
  display: flex;
  gap: 6px;
  align-items: stretch;
  border-radius: var(--radius);
  background: var(--green);
  padding: 2px;
  box-shadow: 0 10px 30px rgba(0, 180, 0, 0.18);
}

.btn-geolocate {
  flex: 0 0 auto;
  appearance: none;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: var(--white);
  position: relative;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 10px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease;
  position: relative;
}

.btn-geolocate:hover {
  background: var(--green-dim);
}

.geo-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
  animation: geo-bubble-fade 2.5s ease forwards;
}

.geo-bubble::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--ink);
}

.geo-bubble.is-error {
  background: #8b1a1a;
}

.geo-bubble.is-error::after {
  border-top-color: #8b1a1a;
}

@keyframes geo-bubble-fade {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

.merchant-select {
  width: 100%;
  appearance: none;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%230d1a0d'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 14px center;
  font-family: var(--font-ui);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 16px 42px 16px 16px;
  color: var(--ink);
  cursor: pointer;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/*
 * Handshake amount stack only (below Hand to merchant, above Rates):
 * - editable inputs/selects → black text, green border
 * - calculated / auto labels + change output → C2M green, no border
 * Merchant bar and rate-badge/footer are intentionally untouched.
 */
#view-handshake .stack input.amount-edit {
  color: #000000;
  border: 1.5px solid var(--green);
  background: #ffffff;
}

#view-handshake .stack input.amount-edit::placeholder {
  color: rgba(0, 0, 0, 0.35);
}

#view-handshake .stack input.amount-edit:focus {
  color: #000000;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
  background: #ffffff;
}

/* Currency dropdowns: black text + green border only (no surface/gradient fill) */
#view-handshake .stack select.currency,
#view-handshake .stack select.currency:focus,
#view-handshake .stack select.currency:hover,
#view-handshake .stack select.currency:active {
  color: #000000;
  border: 1.5px solid var(--green);
  border-radius: var(--radius);
  background-color: #ffffff;
  background-image: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}

#view-handshake .stack .amount.is-keypad-target {
  color: #000000;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
  background: #f3fff3;
}

#view-handshake .stack .change-out,
#view-handshake .stack .bilingual,
#view-handshake .stack .status {
  color: var(--green-ink); /* dark green matching logo €2$ mark */
  border: none;
  box-shadow: none;
  background: transparent;
}

#view-handshake .stack .change-out.is-negative {
  color: var(--danger);
  border: none;
  background: transparent;
}

/*
 * Tally — same rules as Handshake stack:
 * editable controls → black text + green border
 * calculated / auto text → logo dark green, no border
 * Bottom action bar (Clear / Save / Open / Copy2Handshake) left unchanged.
 */
body.page-tally .tally-langs select,
body.page-tally button.tally-cell,
body.page-tally .mode-btn,
body.page-tally .value-btn,
body.page-tally .tally-dock .keypad button {
  color: #000000;
  border: 1.5px solid var(--green);
  background-color: #ffffff;
  background-image: none;
  box-shadow: none;
}

body.page-tally .tally-langs select:focus,
body.page-tally button.tally-cell:focus,
body.page-tally .mode-btn:focus,
body.page-tally .value-btn:focus,
body.page-tally .tally-cell.is-active,
body.page-tally .value-btn.is-active {
  color: #000000;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
  background-color: #ffffff;
}

body.page-tally .sum-amt,
body.page-tally .tally-readonly,
body.page-tally .tally-total,
body.page-tally .sum-mid,
body.page-tally .tally-total-btn {
  color: var(--green-ink);
  border: none;
  box-shadow: none;
  background: transparent;
}

body.page-tally .tally-total {
  color: var(--green-ink);
}

.field-block {
  transform: none !important;
}

.row {
  display: grid;
  grid-template-columns: 1fr minmax(108px, 34%);
  gap: 10px;
  align-items: stretch;
}

.amount,
.currency {
  font-family: var(--font-ui);
  font-size: clamp(1.35rem, 5vw, 1.7rem);
  font-weight: 700;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 14px 14px;
  min-height: 64px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input.amount-edit {
  pointer-events: auto !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  opacity: 1 !important;
  cursor: text;
}

.amount:focus,
.currency:focus,
.merchant-select:focus,
.settings select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
}

.currency {
  appearance: none;
  font-size: 1rem;
  font-weight: 700;
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%230d1a0d'%3E%3Cpath d='M3 5l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}

.change-out {
  display: flex;
  align-items: center;
  border-style: solid;
  border-width: 2px;
  border-color: var(--green);
  background: linear-gradient(180deg, rgba(0, 255, 0, 0.12), var(--white));
  letter-spacing: -0.02em;
}

.change-out.is-ready {
  animation: settle 0.35s ease;
}

.change-out.is-negative {
  border-color: var(--danger);
  color: var(--danger);
  background: #fff5f5;
}

.bilingual {
  margin: 8px 4px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.bilingual.bi-stack {
  align-items: flex-start;
  text-align: left;
  gap: 2px;
}

.bilingual.bi-stack .bi-line-merchant {
  font-size: 0.9em;
  font-weight: 600;
  opacity: 0.92;
}

.merchant-label .bi-stack {
  align-items: flex-start;
  text-align: left;
}

.status {
  margin: 4px 4px 0;
  min-height: 1.2em;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--danger);
}

/* —— Ad slots (G-rated travel) —— */
.ad-slot {
  margin: 0 0 14px;
  min-height: 56px;
  animation: rise 0.5s 0.05s ease both;
}

.ad-slot-bottom {
  margin: 22px 0 0;
  min-height: 120px;
  animation-delay: 0.35s;
}

.ad-house {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 12px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  padding: 10px 12px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.ad-house:hover {
  border-color: rgba(0, 180, 0, 0.45);
  background: #f4fff4;
}

.ad-badge {
  grid-column: 1 / -1;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.ad-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ad-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.25;
}

.ad-sub {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.3;
}

.ad-cta {
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--green);
  color: var(--ink);
}

.ad-banner {
  min-height: 56px;
}

.ad-rect {
  min-height: 110px;
  padding: 14px 14px;
}

.ad-rect .ad-title {
  font-size: 1.05rem;
}

.ad-rect .ad-sub {
  font-size: 0.85rem;
}

.ad-slot .adsbygoogle {
  display: block;
  min-height: 50px;
  overflow: hidden;
  border-radius: 14px;
}

.rate-badge {
  margin: 16px 4px 8px;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.rate-badge.is-warn {
  color: #9a6b00;
}

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 24, 8, 0.35);
  opacity: 0;
  transition: opacity 0.22s ease;
  z-index: 40;
}

.backdrop.is-open {
  opacity: 1;
}

.settings {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 24px) scale(0.98);
  width: min(100%, 560px);
  max-height: min(88vh, 640px);
  overflow: auto;
  background: var(--white);
  border-radius: 24px 24px 0 0;
  padding: 24px 22px calc(22px + var(--safe-bottom));
  z-index: 50;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  border-top: 4px solid var(--green);
}

.settings.is-open {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  animation: c2m-fade-in-scale 0.3s ease;
}

.settings h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin: 0 0 18px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  font-weight: 600;
  font-size: 0.9rem;
}

.settings select {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--white);
}

.muted {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.8rem;
}

.geo-freq-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.geo-freq-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.geo-freq-select {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--white);
}

.geo-freq-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Tally QTY NumericUpDown */
.tally-qty-input {
  width: 3.5rem;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--muted);
  border-radius: 4px;
  padding: 2px 2px;
  background: var(--bg);
  color: var(--ink);
}

.tally-qty-input:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

/* Tally action bar (Clear / Save / Open / Copy2Handshake) */
.tally-action-bar {
  display: flex;
  gap: 8px;
  padding: 8px 0;
}
.tally-action-bar .btn { flex: 1; font-size: 0.85rem; font-weight: 700; padding: 10px 6px; border-radius: 8px; border: 0; cursor: pointer; }
.tally-btn-clear { background: #d32f2f; color: #fff; }
.tally-btn-save  { background: #1976d2; color: #fff; }
.tally-btn-open  { background: #f9a825; color: #222; }
.tally-btn-export {
  background: #0d3d14;
  color: #28ff0a;
}

/* Print masthead — screen-hidden; shown only in @media print */
.tally-print-masthead {
  display: none;
}

/* Tally open-file modal */
.tally-modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
}
.tally-modal-overlay[hidden] { display: none; }
.tally-modal {
  background: var(--bg, #fff); border-radius: 12px; padding: 20px 24px;
  min-width: 260px; max-width: 90vw; max-height: 70vh; overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.tally-modal h3 { margin: 0 0 12px; font-size: 1.1rem; }
.tally-file-list {
  list-style: none; margin: 0 0 12px; padding: 0;
}
.tally-file-list li {
  padding: 8px 12px; cursor: pointer; border-radius: 6px;
  font-family: var(--font-ui); font-size: 0.9rem;
}
.tally-file-list li:hover { background: var(--accent, #28FF0A); color: #000; }
.tally-file-list .no-files { color: var(--muted); cursor: default; }

.geo-freq-right {
  text-align: right;
  white-space: nowrap;
}

.settings-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn {
  flex: 1;
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease, filter 0.15s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn.primary {
  background: var(--green);
  color: var(--ink);
}

.btn.ghost {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--ink);
}

@keyframes brand-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes underline-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* No transform here — Chromium breaks <select> under transformed ancestors */
@keyframes rise {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes settle {
  0% { opacity: 0.85; }
  100% { opacity: 1; }
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(0, 255, 0, 0.55); }
  100% { box-shadow: 0 10px 30px rgba(0, 180, 0, 0.18); }
}

@media (min-width: 720px) {
  .shell {
    padding-top: 12px;
  }

  .settings {
    bottom: auto;
    top: 50%;
    border-radius: 24px;
    transform: translate(-50%, calc(-50% + 16px));
  }

  .settings.is-open {
    transform: translate(-50%, -50%);
  }
}

@media (max-width: 380px) {
  /* Keep amount | currency side-by-side on Handshake; only shrink targets */
  .currency {
    min-height: 52px;
  }

  .tally-sum-row {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .sum-amt,
  .tally-sum-row .sum-amt:last-child {
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  body {
    opacity: 1;
    transform: none;
  }
}

/* —— Header actions —— */
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}

a.brand-home {
  display: block;
  line-height: 0;
  text-decoration: none;
  color: inherit;
}

.text-btn:hover {
  background: var(--green-dim);
  border-color: rgba(0, 180, 0, 0.35);
}

.pro-pill {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green-ink);
  background: var(--green);
  padding: 2px 6px;
  border-radius: 6px;
}

.plan-badge {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  align-self: center;
}

.plan-badge-pro {
  color: var(--ink);
  background: var(--green);
}

.plan-badge-free {
  color: var(--muted);
  background: rgba(0, 80, 0, 0.08);
  box-shadow: inset 0 0 0 1px rgba(0, 80, 0, 0.14);
}

.text-btn.is-locked {
  opacity: 0.72;
}

.text-btn.is-locked .pro-pill {
  background: rgba(0, 180, 0, 0.35);
}

.plan-field {
  border: none;
  margin: 0 0 18px;
  padding: 0;
}

.plan-field legend {
  font-weight: 700;
  margin-bottom: 8px;
}

.plan-toggle {
  display: grid;
  gap: 8px;
}

.plan-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  box-shadow: inset 0 0 0 1px rgba(0, 80, 0, 0.14);
  cursor: pointer;
}

.plan-option:has(input:checked) {
  box-shadow: inset 0 0 0 2px var(--green);
  background: rgba(0, 255, 0, 0.08);
}

.plan-option input {
  margin-top: 4px;
}

.plan-option-body {
  display: grid;
  gap: 2px;
}

.plan-option-body strong {
  font-size: 0.95rem;
}

.plan-option-body small,
#plan-demo-note {
  color: var(--muted);
  line-height: 1.35;
}

.pro-gate {
  position: fixed;
  z-index: 60;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -48%);
  width: min(420px, calc(100vw - 32px));
  background: var(--white);
  padding: 24px 22px 20px;
  box-shadow:
    0 24px 60px rgba(13, 26, 13, 0.18),
    inset 0 0 0 1px rgba(0, 80, 0, 0.12);
}

.pro-gate h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.pro-gate p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.pro-gate-list {
  margin: 0 0 18px;
  padding-left: 1.15rem;
  color: var(--ink);
  line-height: 1.45;
}

body.is-pro .ad-slot {
  display: none !important;
}

.site-footer {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 20px calc(36px + var(--safe-bottom));
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.site-footer-disclaimer {
  margin: 0 0 10px;
}

.site-footer-copy {
  margin: 0 0 8px;
  font-weight: 600;
  color: var(--ink);
}

.site-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
}

.site-footer-nav a {
  color: var(--muted);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer-nav a:hover {
  color: var(--ink);
}

.settings-actions a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
}

/* —— Tally (Pro) —— */
.tally-shell {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  min-height: calc(100dvh - 88px);
  display: flex;
  flex-direction: column;
  padding: 0 12px calc(12px + var(--safe-bottom));
}

.tally-shell.is-locked .tally-scroll,
.tally-shell.is-locked .tally-dock {
  visibility: hidden;
  pointer-events: none;
  user-select: none;
}

.tally-lock {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(40, 255, 10, 0.12), transparent 55%),
    rgba(255, 255, 255, 0.92);
}

.tally-lock[hidden] {
  display: none !important;
}

.tally-lock-card {
  width: min(400px, 100%);
  padding: 22px 20px 18px;
  background: var(--white);
  box-shadow:
    0 18px 48px rgba(13, 26, 13, 0.14),
    inset 0 0 0 1px rgba(0, 80, 0, 0.12);
}

.tally-lock-eyebrow {
  margin: 0 0 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.tally-lock-card h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  letter-spacing: -0.03em;
}

.tally-lock-card p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.tally-scroll {
  flex: 1;
  overflow: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
}

.tally-sub {
  margin: 4px 8px 14px;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Lang/currency: one row of bilingual labels, then one flex row of selects (action-bar style) */
.tally-langs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.tally-langs-labels,
.tally-langs-selects {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.tally-langs-labels > .bi-stack,
.tally-langs-selects > select {
  flex: 1;
  min-width: 0;
}

.tally-langs-labels {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
}

/* Bilingual user / merchant stacked labels (Tally) */
.bi-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  line-height: 1.12;
  text-align: center;
}

.bi-line {
  display: block;
  white-space: nowrap;
}

.bi-line-merchant {
  font-size: 0.88em;
  opacity: 0.9;
}

.tally-langs-labels .bi-stack {
  align-items: center;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.tally-grid-head .bi-stack {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mode-btn.bi-stack,
.tally-action-bar .bi-stack {
  width: 100%;
  gap: 2px;
}

.mode-btn .bi-line {
  font-size: 0.72rem;
}

.mode-btn .bi-line-merchant {
  font-size: 0.66rem;
}

.tally-action-bar .bi-line {
  font-size: 0.78rem;
  line-height: 1.1;
}

.tally-action-bar .bi-line-merchant {
  font-size: 0.7rem;
}

.tally-langs-selects select {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--ink);
  width: 100%;
  cursor: pointer;
}

.tally-grid-head {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 1.1fr 40px;
  gap: 6px;
  padding: 0 4px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: none;
  color: var(--muted);
  text-align: center;
}

.tally-lines {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.tally-row {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 1.1fr 40px;
  gap: 6px;
  align-items: stretch;
}

.tally-cell,
.tally-readonly {
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 700;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 8px 10px;
}

button.tally-cell {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tally-cell.is-active,
.value-btn.is-active {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
  background: #f4fff4;
}

.tally-readonly {
  background: rgba(0, 255, 0, 0.06);
  justify-content: flex-end;
}

.tally-del {
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.tally-del:hover:not(:disabled) {
  color: var(--danger);
  background: #fff5f5;
}

.tally-del:disabled {
  opacity: 0.35;
  cursor: default;
}

.tally-summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
}

.tally-sum-row {
  display: grid;
  grid-template-columns: 1fr minmax(110px, 34%) 1fr;
  gap: 6px;
  align-items: center;
  padding: 8px 4px;
  border-top: 1px solid var(--line);
}

.sum-amt {
  font-size: 0.95rem;
  font-weight: 700;
  text-align: left;
}

.tally-sum-row .sum-amt:last-child {
  text-align: right;
}

.sum-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.mode-btn,
.value-btn {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  padding: 6px 8px;
  cursor: pointer;
  width: 100%;
}

.value-btn {
  font-size: 1rem;
  min-height: 40px;
}

.tally-total-btn {
  width: 100%;
  border: 2px solid var(--green);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(0, 255, 0, 0.16), var(--white));
  cursor: pointer;
  padding: 12px 6px;
  margin-top: 4px;
}

.tally-total {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--green-ink);
}

.tally-dock {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: linear-gradient(180deg, transparent, var(--white) 18%);
  padding-top: 8px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.keypad button {
  font-family: var(--font-ui);
  font-size: 1.35rem;
  font-weight: 700;
  min-height: 48px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.keypad button:active {
  background: var(--green);
}

.key-bk {
  font-size: 1.1rem;
}

.tally-apply-bar {
  width: 100%;
}

/* —— C2M Handshake keypad (Cost) —— */
.c2m-keypad-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  height: 0;
  pointer-events: none;
}

.c2m-keypad-dock[hidden] {
  display: none !important;
}

.c2m-keypad-pull {
  pointer-events: auto;
  position: absolute;
  left: 50%;
  bottom: var(--safe-bottom);
  transform: translateX(-50%);
  width: 72px;
  height: 28px;
  border: 1.5px solid var(--line);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  background: var(--white);
  color: var(--muted);
  box-shadow: 0 -4px 16px rgba(13, 26, 13, 0.06);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.c2m-keypad-pull-chevron,
.c2m-keypad-dismiss-chevron {
  width: 12px;
  height: 12px;
  border-right: 2.5px solid currentColor;
  border-bottom: 2.5px solid currentColor;
  transform: rotate(-135deg);
  margin-top: 4px;
}

.c2m-keypad-dismiss-chevron {
  transform: rotate(45deg);
  margin-top: -2px;
}

.c2m-keypad-dock.is-up .c2m-keypad-pull {
  opacity: 0;
  pointer-events: none;
}

.c2m-keypad-panel {
  pointer-events: none;
  visibility: hidden;
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(560px, 100%);
  background: linear-gradient(180deg, var(--keypad-panel-top), var(--white) 28%);
  border-top: 1.5px solid var(--line);
  box-shadow: 0 -10px 36px var(--shadow-soft);
  padding: 4px 12px calc(10px + var(--safe-bottom));
  transform: translate(-50%, 110%);
  opacity: 0;
  max-height: 0;
  transition: transform 0.3s ease, opacity 0.3s ease, max-height 0.3s ease, visibility 0.3s;
}

.c2m-keypad-dock.is-up .c2m-keypad-panel {
  pointer-events: auto;
  visibility: visible;
  transform: translate(-50%, 0);
  opacity: 1;
  max-height: 400px;
}

.c2m-keypad-handle-row {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.c2m-keypad-dismiss {
  width: 64px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.amount.is-keypad-target {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
  background: #f3fff3;
}

body.tally-open .c2m-keypad-dock {
  display: none !important;
}

body.c2m-keypad-open #view-handshake.shell {
  padding-bottom: calc(220px + var(--safe-bottom));
}

@media (max-width: 380px) {
  .tally-sum-row {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .sum-amt,
  .tally-sum-row .sum-amt:last-child {
    text-align: center;
  }
}

/* —— Welcome marketing home —— */
body.page-welcome {
  background: #f3faf4;
}

.welcome-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(14px + var(--safe-top)) 20px 12px;
  max-width: 1100px;
  margin: 0 auto;
}

.welcome-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #f4fff4;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.welcome-nav-brand img {
  width: 52px;
  height: auto;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
}

.welcome-nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  font-size: 0.92rem;
  font-weight: 600;
}

.welcome-nav-links a {
  color: rgba(244, 255, 244, 0.92);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.welcome-nav-links a:hover {
  color: #fff;
  border-bottom-color: var(--green);
}

.welcome-hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: end;
  overflow: hidden;
  color: #f4fff4;
}

.welcome-hero-media {
  position: absolute;
  inset: 0;
}

.welcome-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  transform: scale(1.04);
  animation: welcome-hero- ken 18s ease-out forwards;
}

@keyframes welcome-hero-ken {
  from {
    transform: scale(1.08);
  }
  to {
    transform: scale(1);
  }
}

.welcome-hero-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 28, 16, 0.55) 0%, rgba(8, 28, 16, 0.28) 42%, rgba(8, 28, 16, 0.78) 100%),
    radial-gradient(80% 60% at 80% 20%, rgba(40, 255, 10, 0.18), transparent 55%);
}

.welcome-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 720px;
  padding: 0 22px calc(48px + var(--safe-bottom));
  margin: 0 auto 0 0;
  width: min(1100px, 100%);
  margin-left: max(0px, calc((100% - 1100px) / 2));
  animation: welcome-rise 0.9s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}

@keyframes welcome-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.welcome-mark {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 8vw, 4.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--green);
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

.welcome-hero h1 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(1.85rem, 5.2vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.welcome-lead {
  margin: 0 0 22px;
  max-width: 34rem;
  font-size: 1.08rem;
  line-height: 1.45;
  color: rgba(244, 255, 244, 0.92);
}

.welcome-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.welcome-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
}

.welcome-btn-ghost {
  border-color: rgba(244, 255, 244, 0.45);
  color: #f4fff4;
  background: rgba(8, 28, 16, 0.25);
}

.welcome-btn-ghost:hover {
  background: rgba(40, 255, 10, 0.14);
  border-color: var(--green);
  color: #fff;
}

.welcome-section {
  max-width: 960px;
  margin: 0 auto;
  padding: 64px 22px 12px;
}

.welcome-section h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.25rem);
  letter-spacing: -0.03em;
  color: var(--green-ink);
}

.welcome-section h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.welcome-section-lead {
  margin: 0 0 28px;
  max-width: 40rem;
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--muted);
}

.welcome-eyebrow {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green-ink);
}

.welcome-moment {
  display: grid;
  gap: 22px;
  margin: 0 0 48px;
  align-items: center;
}

@media (min-width: 760px) {
  .welcome-moment {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 36px;
  }

  .welcome-moment-b {
    direction: rtl;
  }

  .welcome-moment-b > * {
    direction: ltr;
  }
}

.welcome-shot {
  margin: 0;
  overflow: hidden;
  border-radius: 4px;
  min-height: 220px;
  background: #d8eadc;
}

.welcome-shot img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 240px;
  object-fit: cover;
  transition: transform 0.7s ease;
}

.welcome-moment:hover .welcome-shot img {
  transform: scale(1.03);
}

.welcome-moment-copy p {
  margin: 0;
  line-height: 1.55;
  color: var(--muted);
  font-size: 1.02rem;
}

.welcome-platform {
  max-width: 1100px;
}

.welcome-platform-grid {
  display: grid;
  gap: 28px;
  align-items: center;
}

@media (min-width: 800px) {
  .welcome-platform-grid {
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }
}

.welcome-platform p {
  line-height: 1.55;
  color: var(--muted);
  font-size: 1.05rem;
}

.welcome-shot-tall img {
  min-height: 280px;
}

.welcome-handshake-blurb,
.welcome-tally {
  padding-bottom: 40px;
}

.welcome-feature-list {
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
  max-width: 36rem;
}

.welcome-feature-list li {
  position: relative;
  padding: 12px 0 12px 28px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.02rem;
  line-height: 1.4;
}

.welcome-feature-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.15em;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
}

.welcome-footer {
  margin-top: 24px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  max-width: 960px;
}

@media (max-width: 640px) {
  .welcome-nav-brand span {
    display: none;
  }

  .welcome-nav-links {
    font-size: 0.85rem;
    gap: 10px 12px;
  }

  .welcome-hero-copy {
    padding-bottom: calc(36px + var(--safe-bottom));
  }
}

/* —— Account (signup / login / profile) —— */
body.page-account {
  min-height: 100svh;
}

.account-shell {
  position: relative;
  z-index: 1;
  max-width: 420px;
  margin: 0 auto;
  padding: calc(28px + var(--safe-top)) 22px calc(40px + var(--safe-bottom));
}

.account-brand a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--green-ink);
  font-family: var(--font-display);
  font-weight: 800;
}

.account-brand img {
  width: 56px;
  height: auto;
}

.account-shell h1 {
  margin: 18px 0 8px;
  font-family: var(--font-display);
  font-size: 1.85rem;
  letter-spacing: -0.03em;
  color: var(--green-ink);
}

.account-lead {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.45;
}

.account-form {
  display: grid;
  gap: 14px;
}

.account-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.92rem;
}

.account-form input {
  font-family: var(--font-ui);
  font-size: 1rem;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}

.account-form input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
}

.account-error {
  background: #ffebee;
  color: var(--danger);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.92rem;
  line-height: 1.4;
}

.account-switch {
  margin-top: 22px;
  font-size: 0.95rem;
  color: var(--muted);
}

.account-switch a,
#plan-live-note a {
  color: var(--green-ink);
  font-weight: 700;
}

.account-meta {
  margin: 0 0 20px;
  display: grid;
  gap: 14px;
}

.account-meta dt {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.account-meta dd {
  margin: 4px 0 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.account-actions .btn {
  flex: 1 1 auto;
  text-align: center;
  text-decoration: none;
  min-width: 110px;
}

.plan-field[hidden],
#plan-live-note[hidden] {
  display: none !important;
}

/* —— Tally Under Development (production) —— */
body.page-tally-wip {
  min-height: 100svh;
}

.tally-wip-shell {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(24px + var(--safe-top)) 20px calc(40px + var(--safe-bottom));
}

.tally-wip-brand a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--green-ink);
  font-family: var(--font-display);
  font-weight: 800;
}

.tally-wip-brand img {
  width: 56px;
  height: auto;
}

.tally-wip-eyebrow {
  margin: 22px 0 6px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tally-wip-shell h1 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.3rem);
  letter-spacing: -0.03em;
  color: var(--green-ink);
}

.tally-wip-lead {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 1.05rem;
}

.tally-wip-figure {
  margin: 0 0 22px;
  border-radius: 16px;
  overflow: hidden;
  border: 1.5px solid var(--line);
  background: #eef6ef;
  box-shadow: 0 12px 36px rgba(13, 26, 13, 0.08);
}

.tally-wip-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.tally-wip-figure figcaption {
  padding: 10px 14px 12px;
  font-size: 0.82rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.92);
}

.tally-wip-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tally-wip-actions .btn {
  flex: 1 1 auto;
  text-align: center;
  text-decoration: none;
  min-width: 140px;
}

/* —— Pricing / Paddle checkout —— */
.pricing-plans {
  display: grid;
  gap: 16px;
  margin: 1.25rem 0 1.5rem;
}
@media (min-width: 640px) {
  .pricing-plans {
    grid-template-columns: 1fr 1fr;
  }
}
.pricing-card {
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.85);
}
.pricing-card-featured {
  border-color: var(--green);
  box-shadow: 0 0 0 2px var(--green-dim);
}
.pricing-card h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}
.pricing-price {
  margin: 0 0 12px;
  font-size: 1.35rem;
}
.pricing-save {
  margin: -6px 0 12px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--green-ink);
}
.pricing-card .btn {
  width: 100%;
}
.pricing-note {
  font-size: 0.92rem;
  color: var(--muted);
}
.pricing-status {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef6ef;
  font-size: 0.9rem;
}
.pricing-status.is-error {
  background: #fdecea;
  color: #8a1f11;
}

.pricing-redeem {
  margin: 2rem 0 1.5rem;
  padding: 1.1rem 1.15rem 1.25rem;
  border-top: 1px solid var(--line);
}
.pricing-redeem h2 {
  margin-top: 0;
}
.pricing-redeem-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.75rem;
}
.pricing-redeem-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted, #5a6b5a);
}
.pricing-redeem-paste,
.pricing-redeem-input {
  font: inherit;
  font-weight: 500;
  color: var(--ink, #0d1a0d);
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(0, 80, 0, 0.22);
  border-radius: 8px;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}
.pricing-redeem-paste {
  resize: vertical;
  min-height: 3.2rem;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85rem;
}
.pricing-redeem-grid {
  display: grid;
  gap: 0.75rem;
}
@media (min-width: 560px) {
  .pricing-redeem-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.pricing-redeem-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  align-items: center;
}
.pricing-redeem-file {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  margin: 0;
}
.pricing-scan {
  margin-top: 0.85rem;
  padding: 0.75rem;
  border: 1px solid rgba(0, 80, 0, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
}
.pricing-scan video {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 0 auto 0.5rem;
  border-radius: 8px;
  background: #0d1a0d;
}
.account-upgrade {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 8px;
}
.account-upgrade .btn {
  text-decoration: none;
}

/* —— Handshake feel-slider (Major 20260826 · slider gutter · fields full-bleed right) —— */
.hs-cost-tender-group {
  position: relative;
  display: block;
  width: 100%;
}
.hs-mode-slider {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 10%;
  max-width: 48px;
  min-width: 40px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 2px 0;
  user-select: none;
  touch-action: none;
  z-index: 2;
}
/* #11–16: full interface width on the right (align #12/#15 with shell / chrome);
   left padding reserves the slider gutter — narrows #11 & #14 */
.hs-cost-tender-fields {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
  padding-left: max(10%, 44px);
}
.hs-cost-tender-fields .row {
  /* Narrower amount (#11/#14); fixed currency (#12/#15) on the right edge */
  grid-template-columns: minmax(0, 1fr) minmax(100px, 7.5rem);
}
.hs-cost-tender-group[data-side="right"] .hs-mode-slider {
  left: auto;
  right: 0;
}
.hs-cost-tender-group[data-side="right"] .hs-cost-tender-fields {
  padding-left: 0;
  padding-right: max(10%, 44px);
}
.hs-mode-slider .sl-track-wrap {
  position: relative;
  width: 100%;
  max-width: 40px;
  height: 140px;
  flex: 0 0 140px;
  margin: 0 auto;
}
.hs-mode-slider .sl-track {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 4px;
  margin-left: -2px;
  background: rgba(0, 80, 0, 0.18);
  border-radius: 4px;
}
.hs-mode-slider .sl-thumb {
  position: absolute;
  left: 50%;
  width: 36px;
  height: 36px;
  margin-left: -18px;
  margin-top: -18px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--green-ink);
  cursor: grab;
  top: 50%;
  transition: top 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(10, 74, 45, 0.22);
}
.hs-mode-slider .sl-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.field-block.is-slider-disabled .amount,
.field-block.is-slider-disabled .currency {
  opacity: 0.45;
  filter: grayscale(0.35);
  pointer-events: none;
  background: var(--disabled-bg) !important;
  color: var(--disabled-ink) !important;
  border-color: var(--disabled-border) !important;
  box-shadow: none !important;
}
.field-block.is-slider-disabled .bilingual {
  opacity: 0.55;
}
#change-currency.is-feel-locked {
  opacity: 0.7;
  pointer-events: none;
}

/* ============================================================================
   RESPONSIVE — Handshake + Tally (phone → tablet → desktop)
   ============================================================================ */

/* —— Shared chrome (both apps) —— */
@media (max-width: 560px) {
  .top {
    padding-left: 12px;
    padding-right: 12px;
    gap: 8px;
  }

  .brand {
    gap: 8px;
  }

  .brand-logo {
    height: clamp(40px, 10vw, 56px);
    max-width: min(140px, 36vw);
  }

  .brand-name {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
  }

  .top-actions {
    gap: 4px;
    flex-shrink: 0;
  }

  .text-btn {
    padding: 6px 8px;
    font-size: 0.78rem;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .site-footer {
    padding-left: 12px;
    padding-right: 12px;
  }

  .site-footer-nav {
    flex-wrap: wrap;
    gap: 8px 14px;
  }
}

@media (max-width: 420px) {
  .top {
    flex-wrap: wrap;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .brand-meta {
    max-width: 42vw;
  }
}

/* —— Handshake —— */
@media (max-width: 560px) {
  body.page-handshake .merchant-bar {
    margin-bottom: 18px;
  }

  body.page-handshake .merchant-select {
    font-size: 1rem;
    padding: 12px 36px 12px 12px;
  }

  body.page-handshake .btn-geolocate {
    font-size: 0.72rem;
    padding: 8px 8px;
  }

  body.page-handshake .amount,
  body.page-handshake .currency {
    font-size: clamp(1.15rem, 4.6vw, 1.45rem);
    min-height: 56px;
    padding: 10px 12px;
  }

  body.page-handshake .row {
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) minmax(88px, 7rem);
  }

  body.page-handshake .hs-cost-tender-fields {
    padding-left: max(12%, 40px);
  }

  body.page-handshake .hs-cost-tender-group[data-side="right"] .hs-cost-tender-fields {
    padding-right: max(12%, 40px);
  }

  body.page-handshake .hs-mode-slider {
    max-width: 40px;
    min-width: 36px;
  }

  body.page-handshake .hs-mode-slider .sl-track-wrap {
    height: 120px;
    flex-basis: 120px;
  }

  body.page-handshake .hs-mode-slider .sl-thumb {
    width: 32px;
    height: 32px;
    margin-left: -16px;
    margin-top: -16px;
  }

  body.page-handshake .hs-cost-tender-fields .row {
    grid-template-columns: minmax(0, 1fr) minmax(88px, 6.75rem);
  }

  body.page-handshake .stack {
    gap: 16px;
  }

  body.page-handshake .bilingual {
    font-size: 0.92rem;
  }

  body.c2m-keypad-open #view-handshake.shell {
    padding-bottom: calc(200px + var(--safe-bottom));
  }

  .c2m-keypad-panel .keypad button {
    min-height: 46px;
  }
}

@media (max-width: 360px) {
  body.page-handshake .merchant-select-wrap {
    flex-wrap: wrap;
  }

  body.page-handshake .btn-geolocate {
    flex: 1 1 100%;
  }

  body.page-handshake .merchant-select {
    flex: 1 1 100%;
  }

  body.page-handshake .row,
  body.page-handshake .hs-cost-tender-fields .row {
    grid-template-columns: minmax(0, 1fr) minmax(80px, 6.25rem);
    gap: 6px;
  }

  body.page-handshake .amount,
  body.page-handshake .currency {
    min-height: 52px;
    font-size: 1.1rem;
    padding: 8px 10px;
  }
}

@media (min-width: 720px) {
  body.page-handshake .shell,
  body.page-handshake .top {
    max-width: 560px;
  }
}

/* —— Tally —— */
@media (max-width: 560px) {
  .tally-shell {
    padding-left: 10px;
    padding-right: 10px;
    min-height: calc(100dvh - 96px);
  }

  .tally-sub {
    margin: 2px 4px 10px;
    font-size: 0.82rem;
  }

  .tally-langs-labels,
  .tally-langs-selects {
    gap: 6px;
  }

  .tally-langs-labels {
    font-size: 0.62rem;
  }

  .tally-langs-selects select {
    font-size: 0.78rem;
    padding: 8px 6px;
    min-height: 42px;
  }

  .tally-grid-head,
  .tally-row {
    grid-template-columns: 1.2fr 0.65fr 1fr 36px;
    gap: 4px;
  }

  .tally-grid-head {
    font-size: 0.65rem;
    padding: 0 2px 4px;
  }

  .tally-cell,
  .tally-readonly {
    font-size: 0.95rem;
    min-height: 44px;
    padding: 6px 8px;
    border-radius: 10px;
  }

  .tally-sum-row {
    grid-template-columns: 1fr minmax(96px, 32%) 1fr;
    gap: 4px;
    padding: 6px 2px;
  }

  .sum-amt {
    font-size: 0.85rem;
  }

  .mode-btn,
  .value-btn {
    font-size: 0.75rem;
    padding: 6px 6px;
    min-height: 36px;
  }

  .tally-action-bar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .tally-action-bar .btn {
    flex: 1 1 calc(50% - 6px);
    min-width: 0;
    font-size: 0.78rem;
    padding: 10px 4px;
  }

  .keypad button {
    min-height: 44px;
    font-size: 1.2rem;
  }

  .tally-total {
    font-size: 1.05rem;
  }
}

@media (max-width: 420px) {
  /* Lang/currency: 2×2 instead of cramped 4-across */
  .tally-langs-labels,
  .tally-langs-selects {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 8px;
  }

  .tally-grid-head,
  .tally-row {
    grid-template-columns: minmax(0, 1.3fr) minmax(48px, 0.6fr) minmax(0, 1fr) 32px;
    gap: 3px;
  }

  .tally-cell,
  .tally-readonly {
    font-size: 0.88rem;
    min-height: 42px;
    padding: 5px 6px;
  }

  .tally-sum-row {
    grid-template-columns: 1fr;
    gap: 6px;
    text-align: center;
  }

  .sum-amt,
  .tally-sum-row .sum-amt:last-child {
    text-align: center;
  }

  .sum-mid {
    order: -1;
  }

  .tally-action-bar .btn {
    flex: 1 1 100%;
  }
}

@media (max-width: 360px) {
  .tally-grid-head {
    display: none; /* labels implied by cell focus / a11y on very small */
  }

  .tally-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "price qty"
      "line del";
  }

  .tally-row > :nth-child(1) { grid-area: price; }
  .tally-row > :nth-child(2) { grid-area: qty; }
  .tally-row > :nth-child(3) { grid-area: line; }
  .tally-row > :nth-child(4) { grid-area: del; }
}

@media (min-width: 720px) {
  .tally-shell {
    max-width: 560px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .tally-langs-selects select {
    min-height: 48px;
  }

  .keypad button {
    min-height: 52px;
  }
}

/* Landscape phones: keep keypad usable, reduce vertical chrome */
@media (max-height: 480px) and (orientation: landscape) {
  .brand-logo {
    height: 36px;
  }

  body.page-handshake .stack {
    gap: 10px;
  }

  body.page-handshake .amount,
  body.page-handshake .currency {
    min-height: 44px;
    padding: 6px 10px;
  }

  .c2m-keypad-panel .keypad button,
  .tally-dock .keypad button {
    min-height: 40px;
    font-size: 1.1rem;
  }

  body.c2m-keypad-open #view-handshake.shell {
    padding-bottom: calc(160px + var(--safe-bottom));
  }

  .tally-scroll {
    max-height: calc(100dvh - 120px);
  }
}

/* ============================================================================
   PRINT / PDF EXPORT — Tally Pro offline snapshot (Song 1.6a)
   Trigger: window.print() from #btn-tally-export-pdf
   ============================================================================ */
@media print {
  @page {
    margin: 0.5in;
    size: auto;
  }

  html,
  body {
    background: #fff !important;
    color: #111 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body.page-tally .atmosphere,
  body.page-tally .top,
  body.page-tally .top-actions,
  body.page-tally .tally-dock,
  body.page-tally .tally-action-bar,
  body.page-tally .tally-modal-overlay,
  body.page-tally .tally-lock,
  body.page-tally .no-print,
  body.page-tally .tally-del,
  body.page-tally .site-footer,
  body.page-tally #c2m-keypad-dock {
    display: none !important;
  }

  body.page-tally .tally-shell,
  body.page-tally .tally-scroll {
    max-width: none !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  body.page-tally .tally-print-masthead {
    display: flex !important;
    align-items: center;
    gap: 16px;
    margin: 0 0 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid #0d3d14;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.page-tally .tally-print-logo {
    height: 64px;
    width: auto;
  }

  body.page-tally .tally-print-mark {
    margin: 0;
    font-family: Syne, Outfit, sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    color: #0d3d14;
  }

  body.page-tally .tally-print-title {
    margin: 2px 0;
    font-size: 1rem;
    font-weight: 600;
  }

  body.page-tally .tally-print-meta {
    margin: 0;
    font-size: 0.78rem;
    color: #333;
  }

  body.page-tally .tally-sub {
    margin-bottom: 12px;
    font-size: 0.9rem;
  }

  body.page-tally .tally-langs,
  body.page-tally .tally-grid-head,
  body.page-tally .tally-row,
  body.page-tally .tally-sum-row,
  body.page-tally .tally-total-btn {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.page-tally .tally-grid-head,
  body.page-tally .tally-row {
    grid-template-columns: 1.4fr 0.6fr 1fr !important;
  }

  body.page-tally .tally-grid-head #label-tally-del {
    display: none !important;
  }

  body.page-tally .tally-cell,
  body.page-tally .tally-readonly,
  body.page-tally .mode-btn,
  body.page-tally .value-btn,
  body.page-tally .tally-langs select {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    background: #fff !important;
    color: #111 !important;
    -webkit-appearance: none;
    appearance: none;
  }

  body.page-tally .tally-total-btn {
    border: 2px solid #0d3d14 !important;
    background: #f3faf4 !important;
  }

  body.page-tally .tally-total {
    font-weight: 800 !important;
    font-size: 1.15rem !important;
  }

  body.page-tally button {
    cursor: default !important;
  }
}

/* —— Song 1.6c AAAAA polish (dark atmosphere · micro-motion · tally stripes) —— */
@keyframes c2m-fade-in-scale {
  from {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

html.dark-mode .atmosphere {
  background:
    radial-gradient(120% 80% at 100% -10%, rgba(40, 255, 10, 0.14), transparent 55%),
    radial-gradient(90% 60% at -10% 100%, rgba(40, 255, 10, 0.1), transparent 50%),
    linear-gradient(180deg, #141914 0%, #1a1a1a 42%, #121612 100%);
}

html.dark-mode .hs-mode-slider .sl-track {
  background: rgba(180, 255, 180, 0.28);
}

html.dark-mode .c2m-keypad-pull {
  background: var(--bg-secondary);
}

html.dark-mode .keypad button {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

html.dark-mode .tally-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.04);
}

html.dark-mode .tally-row:nth-child(odd) {
  background: transparent;
}

html.dark-mode .preview-ribbon {
  background: #0a120a;
}

html:not(.dark-mode) .tally-row:nth-child(even) {
  background: rgba(0, 80, 0, 0.03);
}

.c2m-theme-toggle {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.c2m-theme-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--bg-secondary, var(--white));
  cursor: pointer;
  font-weight: 700;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.c2m-theme-option:has(input:checked) {
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-dim);
}

.c2m-theme-option input {
  accent-color: var(--green);
}

.top-actions .btn,
.tally-action-bar .btn,
.btn-geolocate {
  transition: background-color 0.2s ease, transform 0.1s ease, filter 0.15s ease, box-shadow 0.2s ease;
}

.top-actions .btn:hover,
.tally-action-bar .btn:hover,
.btn-geolocate:hover {
  transform: translateY(-2px);
}

.top-actions .btn:active,
.tally-action-bar .btn:active,
.btn-geolocate:active {
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Maintenance banner (admin System flags → maintenance_mode) */
.c2m-maint-banner {
  margin: 0.75rem 1rem 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1.5px solid #c62828;
  background: #ffebee;
  color: #8b1e1e;
  font-weight: 700;
  font-family: var(--font-ui, Outfit, sans-serif);
}

