*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #ffffff;
  --text: #1a1a1a;
  --secondary: #888888;
  --border: #e0e0e0;
  --border-light: #f0f0f0;
  --accent: #16a34a;
  --accent-bg: #f0faf3;
  --radius: 100px;
  --card-radius: 16px;
  --shadow: 0 1px 4px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html, body {
  height: 100%;
  background: #f5f5f5;
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .screen { transition: none; }
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 24px 180px;
}

@media (min-width: 768px) {
  .screen {
    display: flex;
    flex-direction: column;
    background: #f5f5f5;
  }

  #screen-home {
    display: block;
  }

  .container {
    background: var(--bg);
    min-height: 100vh;
    box-shadow: 0 0 0 1px var(--border-light);
  }
}

@media (min-width: 1100px) {
  .container {
    max-width: 960px;
    padding: 0 56px 180px;
  }
}

.btn-primary {
  display: block;
  width: 100%;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 17px 24px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.12s ease;
  text-align: center;
  letter-spacing: -0.1px;
}

.btn-primary:hover:not(:disabled) { opacity: 0.85; }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-secondary {
  display: block;
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 17px 24px;
  font-size: 16px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  text-align: center;
  margin-top: 10px;
}

.btn-secondary:hover { background: #fafafa; border-color: #ccc; }

.home-hero {
  background: var(--text);
}

.hero-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 24px;
}

@media (min-width: 768px) {
  .hero-inner {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06);
  }
}

@media (min-width: 1100px) {
  .hero-inner {
    max-width: 960px;
    padding: 0 56px;
  }
}

.home-top-bar {
  display: flex;
  justify-content: flex-end;
  padding-top: 16px;
}

.settings-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  padding: 8px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.settings-btn:hover {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.85);
}

.hero-content {
  padding-top: 44px;
  padding-bottom: 52px;
}

.app-title {
  font-size: 52px;
  font-weight: 900;
  letter-spacing: -2.5px;
  line-height: 1;
  color: #ffffff;
  margin-bottom: 10px;
}

.app-subtitle {
  font-size: 16px;
  color: rgba(255,255,255,0.45);
  font-weight: 400;
}

@media (min-width: 1100px) {
  .hero-content {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-top: 64px;
    padding-bottom: 64px;
  }

  .app-title { font-size: 72px; letter-spacing: -3px; }
}

.home-body {
  display: flex;
  flex-direction: column;
  gap: 36px;
  padding-top: 40px;
}

.home-actions {
  display: flex;
  flex-direction: column;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.home-scan-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.btn-scan-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 20px;
  padding: 22px 12px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border: none;
  background: var(--text);
  color: white;
  transition: opacity 0.15s, transform 0.12s;
  text-align: center;
  user-select: none;
  -webkit-user-select: none;
}

.btn-scan-card:hover { opacity: 0.85; }
.btn-scan-card:active { transform: scale(0.97); }

.btn-upload-card {
  background: white;
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-upload-card:hover { opacity: 1; background: #fafafa; }

.btn-ghost {
  background: none;
  border: none;
  color: var(--secondary);
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  padding: 12px;
  text-align: center;
  width: 100%;
  transition: color 0.15s;
}

.btn-ghost:hover { color: var(--text); }

@media (min-width: 1100px) {
  .home-body {
    flex-direction: row;
    align-items: flex-start;
    gap: 80px;
    padding-top: 56px;
  }

  .home-actions {
    flex: 0 0 300px;
  }

  .how-it-works {
    flex: 1;
    padding-top: 10px;
  }
}

.how-it-works {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.how-step {
  font-size: 15px;
  color: var(--secondary);
  font-weight: 400;
}

.screen-nav {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-top: 20px;
  padding-bottom: 20px;
}

.screen-nav .back-btn {
  flex-shrink: 0;
  margin-top: 2px;
}

.screen-nav > div {
  flex: 1;
  min-width: 0;
}

.screen-nav h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.screen-nav > h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
  padding-top: 8px;
}

.screen-subtitle {
  font-size: 14px;
  color: var(--secondary);
  line-height: 1.4;
}

.processing-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding-top: 40px;
}

.receipt-preview {
  max-width: 200px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
  background: var(--border-light);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #f0f0f0;
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; border-top-color: var(--border-light); border-right-color: var(--text); }
}

.processing-text {
  font-size: 16px;
  color: var(--secondary);
  text-align: center;
  line-height: 1.5;
  max-width: 280px;
}

.processing-actions {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
}

.processing-actions.hidden { display: none; }

.edit-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 1100px) {
  .edit-list { grid-template-columns: repeat(2, 1fr); }
}

.edit-row {
  background: #fafafa;
  border: 1px solid var(--border-light);
  border-radius: var(--card-radius);
  padding: 14px 14px 12px;
  box-shadow: var(--shadow);
}

.edit-row-main {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.edit-name {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font);
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 6px 8px;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  min-width: 0;
}

.edit-name:focus {
  border-color: var(--border);
  background: white;
}

.edit-name.invalid { border-color: #ef4444 !important; }

.btn-delete-row {
  background: none;
  border: none;
  color: var(--secondary);
  cursor: pointer;
  font-size: 15px;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.btn-delete-row:hover {
  color: #ef4444;
  background: #fff1f2;
}

.edit-row-details {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.edit-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.edit-field-group:first-child { flex: 0 0 auto; }
.edit-field-group:nth-child(2) { flex: 1; }
.edit-field-group:last-child { flex: 0 0 auto; }

.edit-field-group > label {
  font-size: 11px;
  color: var(--secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.edit-qty,
.edit-price {
  font-size: 14px;
  font-family: var(--font);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 8px;
  background: white;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.edit-qty:focus,
.edit-price:focus { border-color: var(--text); }

.edit-qty.invalid,
.edit-price.invalid { border-color: #ef4444; }

.edit-qty { width: 56px; }
.edit-price { width: 90px; }

.edit-total {
  font-size: 14px;
  font-weight: 600;
  padding: 7px 0;
  display: block;
  white-space: nowrap;
}

.btn-add-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  background: none;
  border: 1.5px dashed var(--border);
  border-radius: var(--card-radius);
  padding: 13px 16px;
  font-size: 15px;
  font-family: var(--font);
  color: var(--secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.btn-add-item:hover {
  border-color: #aaa;
  color: var(--text);
}

.screen-footer-action {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.screen-footer-action .btn-primary {
  width: auto;
  min-width: 220px;
  max-width: 360px;
}

.selection-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding-bottom: 20px;
}

@media (min-width: 1100px) {
  .selection-list { grid-template-columns: repeat(2, 1fr); }
}

.selection-card {
  background: white;
  border-radius: var(--card-radius);
  padding: 14px 16px;
  border: 1.5px solid var(--border-light);
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}

.selection-card.selected {
  background: var(--accent-bg);
  border-color: var(--accent);
}

.card-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.selection-bubble {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: background 0.15s, border-color 0.15s;
}

.selection-bubble.selected {
  background: var(--accent);
  border-color: var(--accent);
}

.bubble-check {
  font-size: 11px;
  color: white;
  font-weight: 700;
  display: none;
  line-height: 1;
}

.selection-bubble.selected .bubble-check { display: block; }

.card-info { flex: 1; min-width: 0; }

.card-name {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-price {
  font-size: 13px;
  color: var(--secondary);
}

.qty-pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-left: 38px;
}

.qty-pills-row.hidden { display: none; }

.qty-pill {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: white;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  min-height: 32px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.qty-pill:hover { border-color: #aaa; }

.qty-pill.active {
  background: var(--text);
  border-color: var(--text);
  color: white;
}

.sticky-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-light);
  z-index: 10;
}

.footer-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 24px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 1100px) {
  .footer-inner {
    max-width: 960px;
    padding: 14px 56px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }
}

.footer-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-label {
  font-size: 14px;
  color: var(--secondary);
}

.footer-amount {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.result-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 24px;
}

.checkmark-circle {
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
  transform: scale(0);
}

.checkmark-circle.animated {
  animation: check-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes check-pop {
  to { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .checkmark-circle { transform: scale(1); }
  .checkmark-circle.animated { animation: none; }
}

.checkmark-svg { width: 100%; height: 100%; }

.checkmark-ring {
  stroke: var(--accent);
  stroke-width: 2.5;
}

.checkmark-tick {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.result-label {
  font-size: 15px;
  color: var(--secondary);
  margin-bottom: 4px;
  font-weight: 400;
}

.result-amount {
  font-size: 72px;
  font-weight: 900;
  letter-spacing: -3px;
  margin-bottom: 36px;
  line-height: 1;
}

.result-list {
  width: 100%;
  margin-bottom: 36px;
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.result-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.result-item-name {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-item-pill {
  font-size: 11px;
  color: var(--secondary);
  background: #f5f5f5;
  border-radius: 10px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

.result-item-amount {
  font-size: 14px;
  font-weight: 500;
  margin-left: 12px;
  flex-shrink: 0;
}

.result-divider {
  height: 1px;
  background: #f0f0f0;
}

.result-total-divider {
  height: 1px;
  background: var(--border);
  margin-top: 2px;
}

.result-total-row { padding: 14px 0 0; }

.result-total-label,
.result-total-amount {
  font-size: 15px;
  font-weight: 700;
}

.result-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.back-btn {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text);
  transition: background 0.15s;
  padding: 0 4px;
  flex-shrink: 0;
}

.back-btn:hover { background: var(--border-light); }

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.api-key-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.api-key-input {
  width: 100%;
  font-size: 15px;
  font-family: var(--font);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 14px 52px 14px 14px;
  outline: none;
  color: var(--text);
  transition: border-color 0.15s;
  background: white;
}

.api-key-input:focus { border-color: var(--text); }

.toggle-key-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font);
  font-weight: 600;
  color: var(--secondary);
  letter-spacing: 0.3px;
  min-width: 40px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}

.toggle-key-btn:hover { background: var(--border-light); color: var(--text); }

.settings-helper {
  font-size: 13px;
  color: var(--secondary);
  line-height: 1.5;
}

.settings-helper a { color: var(--text); }

.settings-helper code {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  background: var(--border-light);
  padding: 1px 5px;
  border-radius: 4px;
}

.save-confirmation {
  font-size: 14px;
  color: var(--accent);
  font-weight: 600;
  text-align: center;
  padding: 4px 0;
}

.save-confirmation.hidden { display: none; }

.btn-clear-key {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  text-align: center;
  padding: 8px;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--text);
  color: white;
  font-size: 14px;
  font-family: var(--font);
  padding: 10px 20px;
  border-radius: 24px;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  white-space: nowrap;
  z-index: 200;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .toast { transform: translateX(-50%); transition: opacity 0.2s ease; }
  .toast.visible { transform: translateX(-50%); }
}

.camera-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 300;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.camera-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.camera-modal {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.camera-video {
  flex: 1;
  width: 100%;
  object-fit: cover;
  display: block;
}

.camera-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 36px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: #000;
}

@media (min-width: 768px) {
  .camera-overlay {
    background: rgba(0, 0, 0, 0.75);
    align-items: center;
    justify-content: center;
  }

  .camera-modal {
    flex: none;
    width: 560px;
    height: 680px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
  }

  .camera-controls {
    padding: 20px 32px;
    padding-bottom: 20px;
    border-radius: 0 0 20px 20px;
  }
}

.camera-shutter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.btn-capture {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 4px solid white;
  background: white;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
  box-shadow: 0 0 0 5px rgba(255,255,255,0.25);
  flex-shrink: 0;
}

.btn-capture:active {
  transform: scale(0.88);
  opacity: 0.8;
}

.btn-capture-label {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  font-family: var(--font);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.btn-camera-cancel {
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  font-size: 15px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  padding: 8px;
  min-width: 64px;
  text-align: left;
  transition: color 0.15s;
}

.btn-camera-cancel:hover { color: white; }

.btn-flip-camera {
  background: rgba(255,255,255,0.12);
  border: none;
  color: white;
  cursor: pointer;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}

.btn-flip-camera:hover { background: rgba(255,255,255,0.2); }
.btn-flip-camera:active { background: rgba(255,255,255,0.1); }

.currency-picker {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.currency-picker-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.currency-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.currency-pill {
  padding: 5px 11px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: white;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  color: var(--secondary);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.currency-pill:hover:not(.active) {
  border-color: var(--accent);
  color: var(--accent);
}

.currency-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.currency-pill:disabled {
  opacity: 0.5;
  cursor: default;
}

.currency-source-note {
  width: 100%;
  font-size: 11px;
  color: var(--secondary);
  margin-top: 4px;
  letter-spacing: 0.1px;
}

.result-tip-note {
  font-size: 13px;
  color: var(--secondary);
  text-align: center;
  margin-top: -8px;
  margin-bottom: 12px;
  min-height: 0;
}

.tip-section {
  padding: 20px 0 4px;
}

.tip-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.tip-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tip-pill {
  padding: 6px 16px;
  border-radius: 100px;
  border: 1.5px solid var(--border);
  background: white;
  font-size: 14px;
  font-family: var(--font);
  font-weight: 500;
  cursor: pointer;
  color: var(--secondary);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.tip-pill:hover:not(.active) {
  border-color: var(--accent);
  color: var(--accent);
}

.tip-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.result-tip-row .result-tip-label,
.result-tip-row .result-tip-amount {
  font-size: 14px;
  color: var(--secondary);
}

.result-tip-row {
  padding: 10px 0;
}

.history-section {
  padding: 24px 0 40px;
}

.history-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--secondary);
  margin: 0 0 12px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.history-card-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-tip-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: rgba(99, 102, 241, 0.12);
  border-radius: 20px;
  padding: 2px 8px;
}

.history-card-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.history-date {
  font-size: 12px;
  color: var(--secondary);
  white-space: nowrap;
}

.history-total {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.history-delete {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--secondary);
  border-radius: 6px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
}

.history-delete:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
}

.history-items {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.history-item-chip {
  font-size: 12px;
  color: var(--secondary);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 8px;
}

@media (min-width: 1100px) {
  .history-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}
