* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #111827;
  color: #e5e7eb;
  min-height: 100vh;
  padding: 16px 14px 40px;
  max-width: 480px;
  margin: 0 auto;
}

h1 {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #f9fafb;
  letter-spacing: -0.5px;
}

.btn-sound {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 6px;
  line-height: 1;
  touch-action: manipulation;
  user-select: none;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-sound svg {
  width: 26px;
  height: 26px;
  color: #9ca3af;
}

.btn-sound:active { opacity: 0.6; }

/* ── New calculation section (always visible, with dividers) ── */
.new-section {
  border-top: 1px solid #374151;
  border-bottom: 1px solid #374151;
  padding: 18px 0;
  margin-bottom: 24px;
}

.btn-new {
  display: block;
  width: 100%;
  padding: 18px;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-new:active { filter: brightness(0.85); }

/* ── Active session header ── */
.active-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.active-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: #f9fafb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* ── Price buttons ── */
.price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}

.price-btn {
  background: #1f2937;
  border: 2px solid #374151;
  border-radius: 18px;
  color: #e5e7eb;
  cursor: pointer;
  padding: 18px 12px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  user-select: none;
  touch-action: manipulation;
  position: relative;
  overflow: hidden;
  transition: border-color 0.1s;
}

.price-btn:active { border-color: #6366f1; }

.price-btn .euro {
  font-size: 2.1rem;
  font-weight: 800;
  color: #a5b4fc;
  line-height: 1;
}

.price-btn .pcs {
  font-size: 1rem;
  color: #9ca3af;
}

@keyframes tap-flash {
  0%   { background: rgba(99, 102, 241, 0.55); }
  100% { background: rgba(99, 102, 241, 0); }
}

.price-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(99, 102, 241, 0);
  pointer-events: none;
}

.price-btn.flashing::after {
  animation: tap-flash 0.3s ease-out forwards;
}

/* ── Summary ── */
.summary {
  background: #1f2937;
  border-radius: 18px;
  padding: 22px 20px 18px;
  margin-bottom: 16px;
}

.summary .total-sum {
  font-size: 2.6rem;
  font-weight: 800;
  color: #a5b4fc;
  text-align: center;
  line-height: 1;
  margin-bottom: 4px;
}

.summary .total-count {
  font-size: 1rem;
  color: #6b7280;
  text-align: center;
  margin-bottom: 16px;
}

.breakdown {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.15rem;
  color: #9ca3af;
}

.breakdown-row .bd-right {
  font-weight: 600;
  color: #d1d5db;
}

/* ── Action buttons ── */
.actions {
  display: flex;
  gap: 10px;
  margin-bottom: 32px;
}

.btn {
  flex: 1;
  padding: 16px 8px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: filter 0.15s;
}

.btn:active:not(:disabled) { filter: brightness(0.85); }

.btn-undo {
  background: #374151;
  color: #e5e7eb;
}

.btn-undo:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-save  { background: #059669; color: #fff; }
.btn-save:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-reset { background: #b91c1c; color: #fff; }

/* ── Saved section ── */
.saved-section {}

.saved-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 12px;
}

.saved-empty {
  color: #4b5563;
  font-size: 0.95rem;
  text-align: center;
  padding: 18px 0;
}

.saved-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.saved-entry {
  background: #1f2937;
  border-radius: 16px;
  padding: 16px;
}

.saved-entry-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 8px;
}

.saved-meta { flex: 1; min-width: 0; }

.saved-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f3f4f6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-date {
  font-size: 0.82rem;
  color: #6b7280;
  margin-top: 2px;
}

.saved-total {
  font-size: 1.6rem;
  font-weight: 800;
  color: #a5b4fc;
  flex-shrink: 0;
}

.saved-breakdown {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

.saved-breakdown-row {
  font-size: 0.9rem;
  color: #6b7280;
}

.saved-entry-actions {
  display: flex;
  gap: 8px;
}

.btn-continue {
  flex: 1;
  padding: 13px;
  background: #1e3a5f;
  color: #93c5fd;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-continue:active { filter: brightness(0.85); }

.btn-del {
  padding: 13px 18px;
  background: #3b1515;
  color: #fca5a5;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.btn-del:active { filter: brightness(0.85); }

/* ── Modals ── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.overlay.open { display: flex; }

.modal {
  background: #1f2937;
  border-radius: 20px;
  padding: 28px 22px 22px;
  width: 100%;
  max-width: 360px;
  border: 1px solid #374151;
}

.modal h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #f9fafb;
  text-align: center;
  margin-bottom: 22px;
  line-height: 1.4;
}

.modal-btns {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-btn {
  padding: 17px;
  border: none;
  border-radius: 13px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.modal-btn:active { filter: brightness(0.85); }
.mbtn-green  { background: #059669; color: #fff; }
.mbtn-green:disabled { opacity: 0.3; cursor: not-allowed; }
.mbtn-red    { background: #b91c1c; color: #fff; }
.mbtn-cancel { background: #374151; color: #e5e7eb; }

.name-input {
  width: 100%;
  padding: 16px;
  background: #111827;
  border: 2px solid #374151;
  border-radius: 12px;
  color: #f9fafb;
  font-size: 1.05rem;
  margin-bottom: 16px;
  outline: none;
}

.name-input:focus { border-color: #6366f1; }

/* ── Custom price button ── */
.price-btn-custom {
  padding: 14px 12px 14px;
  grid-column: span 2;
  border-color: #4b5563;
  border-style: dashed;
}
.price-btn-custom .euro {
  /* color: #9ca3af; */
  font-size: 1.6rem;
  font-weight: 800;
}

/* ── Numpad ── */
.numpad-display {
  font-size: 2.4rem;
  font-weight: 800;
  color: #a5b4fc;
  text-align: center;
  background: #111827;
  border-radius: 12px;
  padding: 14px 0;
  margin-bottom: 16px;
  letter-spacing: 1px;
}

.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.numpad-btn {
  padding: 18px 0;
  background: #374151;
  color: #e5e7eb;
  border: none;
  border-radius: 12px;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.numpad-btn:active { filter: brightness(0.8); }

.numpad-zero { grid-column: span 2; }
.numpad-back { background: #4b5563; color: #f9fafb; }
